Merge
authorherrick
Fri, 20 Aug 2010 14:48:10 -0400
changeset 6786 08f72406f403
parent 6785 8c33458fc946 (current diff)
parent 6225 439de530aac5 (diff)
child 6787 648846ff9d14
Merge
jdk/test/java/net/Socket/AccurateTimeout.java
--- a/.hgtags	Thu Aug 12 23:21:17 2010 -0700
+++ b/.hgtags	Fri Aug 20 14:48:10 2010 -0400
@@ -77,3 +77,7 @@
 2d6ba7a221915bdf0311acc5641c7f3875cb793e jdk7-b100
 2548ac036b8fca3326d058d758e6df8355a42469 jdk7-b101
 88db80c8e49cea352c2900f689600dc410761c1f jdk7-b102
+64770970865839b0443066370e7d476ef47e90cd jdk7-b103
+10bc903a228d3a8efdf46fb8c3fcf82a59b88bc5 jdk7-b104
+1ce7938efb03224ccc8b3cdd7803eb39e889539c jdk7-b105
+6bdae472f77205046703b685eff2ac4f7a0ecf4e jdk7-b106
--- a/.hgtags-top-repo	Thu Aug 12 23:21:17 2010 -0700
+++ b/.hgtags-top-repo	Fri Aug 20 14:48:10 2010 -0400
@@ -77,3 +77,7 @@
 b218a53ec7d3d42be61d31d6917a6c5c037b6f56 jdk7-b100
 4193eaf5f1b82794c6a0fb1a8d11af43d1b1d611 jdk7-b101
 a136a51f5113da4dad3853b74a8536ab583ab112 jdk7-b102
+be2aedc4e3b1751c1310f334242ba69e90867f38 jdk7-b103
+f8be576feefce0c6695f188ef97ec16b73ad9cfd jdk7-b104
+9f96a4269d7727dad68864eaab795eafce270311 jdk7-b105
+43096cccf1cee749c2f4e7714ee71f4e9e0f4d7f jdk7-b106
--- a/corba/.hgtags	Thu Aug 12 23:21:17 2010 -0700
+++ b/corba/.hgtags	Fri Aug 20 14:48:10 2010 -0400
@@ -77,3 +77,7 @@
 a56d734a1e970e1a21a8f4feb13053e9a33674c7 jdk7-b100
 86a239832646a74811695428984b6947c0bd6dc8 jdk7-b101
 78561a95779090b5106c8d0f1a75360a027ef087 jdk7-b102
+11e7678c3eb169b77d9a9892fe5e3dfa1d1a0d51 jdk7-b103
+9607213481d400ac477183191cc080e1bef6f475 jdk7-b104
+6f21b030092fb61244cc8a0aedf8058f7c022b81 jdk7-b105
+519daea48888196af76a975a3b31258efa860bad jdk7-b106
--- a/hotspot/.hgtags	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/.hgtags	Fri Aug 20 14:48:10 2010 -0400
@@ -107,3 +107,10 @@
 6c3a919105b68c15b7db923ec9a00006e9560910 jdk7-b101
 ad1977f08c4d69162a0775fe3f9576b9fd521d10 hs19-b03
 c5cadf1a07717955cf60dbaec16e35b529fd2cb0 jdk7-b102
+cb4250ef73b21de6c487ea14e2b0b99eed67b4b6 jdk7-b103
+e55900b5c1b865cac17e18abc639c7dc50de7fd8 hs19-b04
+b4acf10eb134fe930802c97e36db65e7ccb544b5 jdk7-b104
+6709c14587c2cc6faca208767335afeb01e33de5 jdk7-b105
+1b81ca701fa5fc30adc4cfdaa4bdd153df5e6c86 jdk7-b106
+cc3fdfeb54b049f18edcf3463e6ab051d0b7b609 hs19-b05
+688a538aa65412178286ae2a6b0c00b6711e121b hs19-b06
--- a/hotspot/agent/src/os/linux/ps_proc.c	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/agent/src/os/linux/ps_proc.c	Fri Aug 20 14:48:10 2010 -0400
@@ -253,7 +253,11 @@
     if (nwords > 5 && find_lib(ph, word[5]) == false) {
        intptr_t base;
        lib_info* lib;
+#ifdef _LP64
        sscanf(word[0], "%lx", &base);
+#else
+       sscanf(word[0], "%x", &base);
+#endif
        if ((lib = add_lib_info(ph, word[5], (uintptr_t)base)) == NULL)
           continue; // ignore, add_lib_info prints error
 
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java	Fri Aug 20 14:48:10 2010 -0400
@@ -297,6 +297,7 @@
     case JVM_CONSTANT_NameAndType:        return "JVM_CONSTANT_NameAndType";
     case JVM_CONSTANT_MethodHandle:       return "JVM_CONSTANT_MethodHandle";
     case JVM_CONSTANT_MethodType:         return "JVM_CONSTANT_MethodType";
+    case JVM_CONSTANT_InvokeDynamic:      return "JVM_CONSTANT_InvokeDynamic";
     case JVM_CONSTANT_Invalid:            return "JVM_CONSTANT_Invalid";
     case JVM_CONSTANT_UnresolvedClass:    return "JVM_CONSTANT_UnresolvedClass";
     case JVM_CONSTANT_UnresolvedClassInError:    return "JVM_CONSTANT_UnresolvedClassInError";
@@ -355,6 +356,7 @@
         case JVM_CONSTANT_NameAndType:
         case JVM_CONSTANT_MethodHandle:
         case JVM_CONSTANT_MethodType:
+        case JVM_CONSTANT_InvokeDynamic:
           visitor.doInt(new IntField(new NamedFieldIdentifier(nameForTag(ctag)), indexOffset(index), true), true);
           break;
         }
@@ -517,6 +519,18 @@
                                           + ", type = " + signatureIndex);
                   break;
               }
+
+              case JVM_CONSTANT_InvokeDynamic: {
+                  dos.writeByte(cpConstType);
+                  int value = getIntAt(ci);
+                  short bootstrapMethodIndex = (short) extractLowShortFromInt(value);
+                  short nameAndTypeIndex = (short) extractHighShortFromInt(value);
+                  dos.writeShort(bootstrapMethodIndex);
+                  dos.writeShort(nameAndTypeIndex);
+                  if (DEBUG) debugMessage("CP[" + ci + "] = indy BSM = " + bootstrapMethodIndex
+                                          + ", N&T = " + nameAndTypeIndex);
+                  break;
+              }
               default:
                   throw new InternalError("unknown tag: " + cpConstType);
           } // switch
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java	Fri Aug 20 14:48:10 2010 -0400
@@ -42,6 +42,7 @@
     public static final int JVM_CONSTANT_NameAndType        = 12;
     public static final int JVM_CONSTANT_MethodHandle       = 15;
     public static final int JVM_CONSTANT_MethodType         = 16;
+    public static final int JVM_CONSTANT_InvokeDynamic      = 17;
 
     // JVM_CONSTANT_MethodHandle subtypes
     public static final int JVM_REF_getField                = 1;
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java	Fri Aug 20 14:48:10 2010 -0400
@@ -303,12 +303,12 @@
                 case JVM_CONSTANT_MethodHandle: {
                      dos.writeByte(cpConstType);
                      int value = cpool.getIntAt(ci);
-                     short refIndex = (short) extractHighShortFromInt(value);
-                     byte  refKind  = (byte)  extractLowShortFromInt(value);
-                     dos.writeByte(refKind);
-                     dos.writeShort(refIndex);
-                     if (DEBUG) debugMessage("CP[" + ci + "] = MH index = " + refIndex
-                                        + ", kind = " + refKind);
+                     short bootstrapMethodIndex = (short) extractLowShortFromInt(value);
+                     short nameAndTypeIndex = (short) extractHighShortFromInt(value);
+                     dos.writeShort(bootstrapMethodIndex);
+                     dos.writeShort(nameAndTypeIndex);
+                     if (DEBUG) debugMessage("CP[" + ci + "] = indy BSM = " +
+                           bootstrapMethodIndex + ", N&T = " + nameAndTypeIndex);
                      break;
                 }
 
@@ -321,6 +321,15 @@
                      break;
                 }
 
+                case JVM_CONSTANT_InvokeDynamic: {
+                     dos.writeByte(cpConstType);
+                     int value = cpool.getIntAt(ci);
+                     short refIndex = (short) value;
+                     dos.writeShort(refIndex);
+                     if (DEBUG) debugMessage("CP[" + ci + "] = MT index = " + refIndex);
+                     break;
+                }
+
                 default:
                   throw new InternalError("Unknown tag: " + cpConstType);
             } // switch
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java	Fri Aug 20 14:48:10 2010 -0400
@@ -582,6 +582,11 @@
                buf.cell(Integer.toString(cpool.getIntAt(index)));
                break;
 
+            case JVM_CONSTANT_InvokeDynamic:
+               buf.cell("JVM_CONSTANT_InvokeDynamic");
+               buf.cell(genLowHighShort(cpool.getIntAt(index)));
+               break;
+
             default:
                throw new InternalError("unknown tag: " + ctag);
          }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java	Fri Aug 20 14:48:10 2010 -0400
@@ -40,6 +40,7 @@
   private static int JVM_CONSTANT_NameAndType             = 12;
   private static int JVM_CONSTANT_MethodHandle            = 15;  // JSR 292
   private static int JVM_CONSTANT_MethodType              = 16;  // JSR 292
+  private static int JVM_CONSTANT_InvokeDynamic           = 17;  // JSR 292
   private static int JVM_CONSTANT_Invalid                 = 0;   // For bad value initialization
   private static int JVM_CONSTANT_UnresolvedClass         = 100; // Temporary tag until actual use
   private static int JVM_CONSTANT_ClassIndex              = 101; // Temporary tag while constructing constant pool
@@ -78,6 +79,7 @@
   public boolean isUtf8()             { return tag == JVM_CONSTANT_Utf8; }
   public boolean isMethodHandle()     { return tag == JVM_CONSTANT_MethodHandle; }
   public boolean isMethodType()       { return tag == JVM_CONSTANT_MethodType; }
+  public boolean isInvokeDynamic()    { return tag == JVM_CONSTANT_InvokeDynamic; }
 
   public boolean isInvalid()          { return tag == JVM_CONSTANT_Invalid; }
 
--- a/hotspot/make/Makefile	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/make/Makefile	Fri Aug 20 14:48:10 2010 -0400
@@ -85,14 +85,21 @@
 C2_VM_TARGETS=product  fastdebug  optimized  jvmg
 KERNEL_VM_TARGETS=productkernel fastdebugkernel optimizedkernel jvmgkernel
 ZERO_VM_TARGETS=productzero fastdebugzero optimizedzero jvmgzero
+SHARK_VM_TARGETS=productshark fastdebugshark optimizedshark jvmgshark
 
 # JDK directory list
 JDK_DIRS=bin include jre lib demo
 
 all:           all_product all_fastdebug
+ifndef BUILD_CLIENT_ONLY
 all_product:   product product1 productkernel docs export_product
 all_fastdebug: fastdebug fastdebug1 fastdebugkernel docs export_fastdebug
 all_debug:     jvmg jvmg1 jvmgkernel docs export_debug
+else
+all_product:   product1 docs export_product
+all_fastdebug: fastdebug1 docs export_fastdebug
+all_debug:     jvmg1 docs export_debug
+endif
 all_optimized: optimized optimized1 optimizedkernel docs export_optimized
 
 allzero:           all_productzero all_fastdebugzero
@@ -101,6 +108,12 @@
 all_debugzero:     jvmgzero docs export_debug
 all_optimizedzero: optimizedzero docs export_optimized
 
+allshark:           all_productshark all_fastdebugshark
+all_productshark:   productshark docs export_product
+all_fastdebugshark: fastdebugshark docs export_fastdebug
+all_debugshark:     jvmgshark docs export_debug
+all_optimizedshark: optimizedshark docs export_optimized
+
 # Do everything
 world:         all create_jdk
 
@@ -131,6 +144,10 @@
 	$(CD) $(GAMMADIR)/make; \
 	$(MAKE) VM_TARGET=$@ generic_buildzero $(ALT_OUT)
 
+$(SHARK_VM_TARGETS):
+	$(CD) $(GAMMADIR)/make; \
+	$(MAKE) VM_TARGET=$@ generic_buildshark $(ALT_OUT)
+
 # Build compiler1 (client) rule, different for platforms
 generic_build1:
 	$(MKDIR) -p $(OUTPUTDIR)
@@ -197,6 +214,12 @@
 		$(MAKE) -f $(ABS_OS_MAKEFILE) \
 			$(MAKE_ARGS) $(VM_TARGET)
 
+generic_buildshark:
+	$(MKDIR) -p $(OUTPUTDIR)
+	$(CD) $(OUTPUTDIR); \
+		$(MAKE) -f $(ABS_OS_MAKEFILE) \
+			$(MAKE_ARGS) $(VM_TARGET) 
+
 # Export file rule
 generic_export: $(EXPORT_LIST)
 export_product:
@@ -228,15 +251,22 @@
 C2_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_compiler2
 KERNEL_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_kernel
 ZERO_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_zero
+SHARK_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_shark
 C1_DIR=$(C1_BASE_DIR)/$(VM_SUBDIR)
 C2_DIR=$(C2_BASE_DIR)/$(VM_SUBDIR)
 KERNEL_DIR=$(KERNEL_BASE_DIR)/$(VM_SUBDIR)
 ZERO_DIR=$(ZERO_BASE_DIR)/$(VM_SUBDIR)
+SHARK_DIR=$(SHARK_BASE_DIR)/$(VM_SUBDIR)
 
 # Misc files and generated files need to come from C1 or C2 area
 ifeq ($(ZERO_BUILD), true)
+ifeq ($(SHARK_BUILD), true)
+  MISC_DIR=$(SHARK_DIR)
+  GEN_DIR=$(SHARK_BASE_DIR)/generated
+else
   MISC_DIR=$(ZERO_DIR)
   GEN_DIR=$(ZERO_BASE_DIR)/generated
+endif
 else
 ifeq ($(ARCH_DATA_MODEL), 32)
   MISC_DIR=$(C1_DIR)
@@ -290,11 +320,20 @@
 # Shared Library
 ifneq ($(OSNAME),windows)
   ifeq ($(ZERO_BUILD), true)
+    ifeq ($(SHARK_BUILD), true)
+$(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(SHARK_DIR)/%.so
+	$(install-file)
+$(EXPORT_SERVER_DIR)/%.so:       $(SHARK_DIR)/%.so
+	$(install-file)
+    else
 $(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(ZERO_DIR)/%.so
 	$(install-file)
 $(EXPORT_SERVER_DIR)/%.so:       $(ZERO_DIR)/%.so
 	$(install-file)
+    endif
   else
+$(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(C1_DIR)/%.so
+	$(install-file)
 $(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(C2_DIR)/%.so
 	$(install-file)
 $(EXPORT_CLIENT_DIR)/%.so:       $(C1_DIR)/%.so
@@ -348,6 +387,7 @@
 	$(RM) -r $(C2_DIR)
 	$(RM) -r $(KERNEL_DIR)
 	$(RM) -r $(ZERO_DIR)
+	$(RM) -r $(SHARK_DIR)
 clean_export:
 	$(RM) -r $(EXPORT_PATH)
 clean_jdk:
--- a/hotspot/make/defs.make	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/make/defs.make	Fri Aug 20 14:48:10 2010 -0400
@@ -192,13 +192,16 @@
 
   # Use uname output for SRCARCH, but deal with platform differences. If ARCH
   # is not explicitly listed below, it is treated as x86. 
-  SRCARCH     = $(ARCH/$(filter sparc sparc64 ia64 amd64 x86_64 zero,$(ARCH)))
+  SRCARCH     = $(ARCH/$(filter sparc sparc64 ia64 amd64 x86_64 arm ppc zero,$(ARCH)))
   ARCH/       = x86
   ARCH/sparc  = sparc
   ARCH/sparc64= sparc
   ARCH/ia64   = ia64
   ARCH/amd64  = x86
   ARCH/x86_64 = x86
+  ARCH/ppc64  = ppc
+  ARCH/ppc    = ppc
+  ARCH/arm    = arm
   ARCH/zero   = zero
 
   # BUILDARCH is usually the same as SRCARCH, except for sparcv9
@@ -223,6 +226,9 @@
   LIBARCH/sparc   = sparc
   LIBARCH/sparcv9 = sparcv9
   LIBARCH/ia64    = ia64
+  LIBARCH/ppc64   = ppc
+  LIBARCH/ppc     = ppc
+  LIBARCH/arm     = arm
   LIBARCH/zero    = $(ZERO_LIBARCH)
 
   LP64_ARCH = sparcv9 amd64 ia64 zero
--- a/hotspot/make/hotspot_version	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/make/hotspot_version	Fri Aug 20 14:48:10 2010 -0400
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=19
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=04
+HS_BUILD_NUMBER=06
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=7
--- a/hotspot/make/linux/Makefile	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/make/linux/Makefile	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -168,6 +168,13 @@
 #       profiledzero    zero            <os>_<arch>_zero/profiled
 #       productzero     zero            <os>_<arch>_zero/product
 #
+#       debugshark      shark           <os>_<arch>_shark/debug
+#       fastdebugshark  shark           <os>_<arch>_shark/fastdebug
+#       jvmgshark       shark           <os>_<arch>_shark/jvmg
+#       optimizedshark  shark           <os>_<arch>_shark/optimized
+#       profiledshark   shark           <os>_<arch>_shark/profiled
+#       productshark    shark           <os>_<arch>_shark/product
+#
 # What you get with each target:
 #
 # debug*     - "thin" libjvm_g - debug info linked into the gamma_g launcher
@@ -191,12 +198,14 @@
 SUBDIRS_TIERED    = $(addprefix $(OSNAME)_$(BUILDARCH)_tiered/,$(TARGETS))
 SUBDIRS_CORE      = $(addprefix $(OSNAME)_$(BUILDARCH)_core/,$(TARGETS))
 SUBDIRS_ZERO      = $(addprefix $(OSNAME)_$(VARIANTARCH)_zero/,$(TARGETS))
+SUBDIRS_SHARK     = $(addprefix $(OSNAME)_$(VARIANTARCH)_shark/,$(TARGETS))
 
 TARGETS_C2        = $(TARGETS)
 TARGETS_C1        = $(addsuffix 1,$(TARGETS))
 TARGETS_TIERED    = $(addsuffix tiered,$(TARGETS))
 TARGETS_CORE      = $(addsuffix core,$(TARGETS))
 TARGETS_ZERO      = $(addsuffix zero,$(TARGETS))
+TARGETS_SHARK     = $(addsuffix shark,$(TARGETS))
 
 BUILDTREE_MAKE    = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make
 BUILDTREE_VARS    = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) ARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH)
@@ -213,6 +222,7 @@
 	@echo "  $(TARGETS_C1)"
 	@echo "  $(TARGETS_CORE)"
 	@echo "  $(TARGETS_ZERO)"
+	@echo "  $(TARGETS_SHARK)"
 
 checks: check_os_version check_j2se_version
 
@@ -266,6 +276,10 @@
 	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
 	$(BUILDTREE) VARIANT=zero VARIANTARCH=$(VARIANTARCH)
 
+$(SUBDIRS_SHARK): $(BUILDTREE_MAKE) platform_zero
+	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
+	$(BUILDTREE) VARIANT=shark VARIANTARCH=$(VARIANTARCH)
+
 platform_zero: $(GAMMADIR)/make/$(OSNAME)/platform_zero.in
 	$(SED) 's/@ZERO_ARCHDEF@/$(ZERO_ARCHDEF)/g;s/@ZERO_LIBARCH@/$(ZERO_LIBARCH)/g;' < $< > $@
 
@@ -306,11 +320,19 @@
 	cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) install
 endif
 
+$(TARGETS_SHARK):  $(SUBDIRS_SHARK)
+	cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS)
+	cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && ./test_gamma
+ifdef INSTALL
+	cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) install
+endif
+
 # Just build the tree, and nothing else:
 tree:      $(SUBDIRS_C2)
 tree1:     $(SUBDIRS_C1)
 treecore:  $(SUBDIRS_CORE)
 treezero:  $(SUBDIRS_ZERO)
+treeshark: $(SUBDIRS_SHARK)
 
 # Doc target.  This is the same for all build options.
 #     Hence create a docs directory beside ...$(ARCH)_[...]
@@ -327,20 +349,22 @@
 
 zero: jvmgzero productzero
 
+shark: jvmgshark productshark
+
 clean_docs:
 	rm -rf $(SUBDIR_DOCS)
 
-clean_compiler1 clean_compiler2 clean_core clean_zero:
+clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark:
 	rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@)
 
-clean:  clean_compiler2 clean_compiler1 clean_core clean_zero clean_docs
+clean:  clean_compiler2 clean_compiler1 clean_core clean_zero clean_shark clean_docs
 
 include $(GAMMADIR)/make/$(OSNAME)/makefiles/cscope.make
 
 #-------------------------------------------------------------------------------
 
-.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO)
-.PHONY: tree tree1 treecore treezero
-.PHONY: all compiler1 compiler2 core zero
-.PHONY: clean clean_compiler1 clean_compiler2 clean_core clean_zero docs clean_docs
+.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO) $(TARGETS_SHARK)
+.PHONY: tree tree1 treecore treezero treeshark
+.PHONY: all compiler1 compiler2 core zero shark
+.PHONY: clean clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark docs clean_docs
 .PHONY: checks check_os_version check_j2se_version
--- a/hotspot/make/linux/makefiles/build_vm_def.sh	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/make/linux/makefiles/build_vm_def.sh	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,12 @@
 #!/bin/sh
 
-nm --defined-only $* | awk '
+# If we're cross compiling use that path for nm
+if [ "$ALT_COMPILER_PATH" != "" ]; then 
+NM=$ALT_COMPILER_PATH/nm
+else
+NM=nm
+fi
+
+$NM --defined-only $* | awk '
    { if ($3 ~ /^_ZTV/ || $3 ~ /^gHotSpotVM/) print "\t" $3 ";" }
    '
--- a/hotspot/make/linux/makefiles/buildtree.make	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/make/linux/makefiles/buildtree.make	Fri Aug 20 14:48:10 2010 -0400
@@ -339,12 +339,16 @@
 WRONG_DATA_MODE_MSG = \
 	echo "JAVA_HOME must point to $(DATA_MODE)bit JDK."
 
+CROSS_COMPILING_MSG = \
+	echo "Cross compiling for ARCH $(CROSS_COMPILE_ARCH), skipping gamma run."
+
 test_gamma:  $(BUILDTREE_MAKE) $(GAMMADIR)/make/test/Queens.java
 	@echo Creating $@ ...
 	$(QUIETLY) ( \
 	echo '#!/bin/sh'; \
 	$(BUILDTREE_COMMENT); \
 	echo '. ./env.sh'; \
+	echo "if [ \"$(CROSS_COMPILE_ARCH)\" != \"\" ]; then { $(CROSS_COMPILING_MSG); exit 0; }; fi"; \
 	echo "if [ -z \$$JAVA_HOME ]; then { $(NO_JAVA_HOME_MSG); exit 0; }; fi"; \
 	echo "if ! \$${JAVA_HOME}/bin/java $(JAVA_FLAG) -fullversion 2>&1 > /dev/null"; \
 	echo "then"; \
--- a/hotspot/make/linux/makefiles/defs.make	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/make/linux/makefiles/defs.make	Fri Aug 20 14:48:10 2010 -0400
@@ -98,6 +98,22 @@
   HS_ARCH          = x86
 endif
 
+# ARM
+ifeq ($(ARCH), arm)
+  ARCH_DATA_MODEL  = 32
+  PLATFORM         = linux-arm
+  VM_PLATFORM      = linux_arm
+  HS_ARCH          = arm
+endif
+
+# PPC
+ifeq ($(ARCH), ppc)
+  ARCH_DATA_MODEL  = 32
+  PLATFORM         = linux-ppc
+  VM_PLATFORM      = linux_ppc
+  HS_ARCH          = ppc
+endif
+
 JDK_INCLUDE_SUBDIR=linux
 
 # FIXUP: The subdirectory for a debug build is NOT the same on all platforms
@@ -107,22 +123,32 @@
 
 # client and server subdirectories have symbolic links to ../libjsig.so
 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.so
+EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
 
-EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
+ifndef BUILD_CLIENT_ONLY
 EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.so
+endif
+
 ifneq ($(ZERO_BUILD), true)
   ifeq ($(ARCH_DATA_MODEL), 32)
     EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
     EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
     EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.so 
-    EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so
-    EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar 
-  else
-    ifeq ($(ARCH),ia64)
-      else
-        EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so
-        EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar
-    endif
   endif
 endif
+
+# Serviceability Binaries
+# No SA Support for PPC, IA64, ARM or zero
+ADD_SA_BINARIES/x86   = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so \
+                        $(EXPORT_LIB_DIR)/sa-jdi.jar 
+ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so \
+                        $(EXPORT_LIB_DIR)/sa-jdi.jar 
+ADD_SA_BINARIES/ppc   = 
+ADD_SA_BINARIES/ia64  = 
+ADD_SA_BINARIES/arm   = 
+ADD_SA_BINARIES/zero  = 
+
+EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH))
+
+
--- a/hotspot/make/linux/makefiles/gcc.make	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/make/linux/makefiles/gcc.make	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,14 @@
 #------------------------------------------------------------------------
 # CC, CPP & AS
 
+ifdef ALT_COMPILER_PATH
+CPP = $(ALT_COMPILER_PATH)/g++
+CC  = $(ALT_COMPILER_PATH)/gcc
+else
 CPP = g++
 CC  = gcc
+endif
+
 AS  = $(CC) -c
 
 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
@@ -55,6 +61,9 @@
 ifeq ($(ZERO_BUILD), true)
 CFLAGS += $(LIBFFI_CFLAGS)
 endif
+ifeq ($(SHARK_BUILD), true)
+CFLAGS += $(LLVM_CFLAGS)
+endif
 CFLAGS += $(VM_PICFLAG)
 CFLAGS += -fno-rtti
 CFLAGS += -fno-exceptions
@@ -67,18 +76,31 @@
 ARCHFLAG/ia64    =
 ARCHFLAG/sparc   = -m32 -mcpu=v9
 ARCHFLAG/sparcv9 = -m64 -mcpu=v9
+ARCHFLAG/arm     =  -fsigned-char
 ARCHFLAG/zero    = $(ZERO_ARCHFLAG)
+ifndef E500V2
+ARCHFLAG/ppc     =  -mcpu=powerpc
+endif
 
 CFLAGS     += $(ARCHFLAG)
 AOUT_FLAGS += $(ARCHFLAG)
 LFLAGS     += $(ARCHFLAG)
 ASFLAGS    += $(ARCHFLAG)
 
+ifdef E500V2
+CFLAGS += -DE500V2
+endif
+
 # Use C++ Interpreter
 ifdef CC_INTERP
   CFLAGS += -DCC_INTERP
 endif
 
+# Build for embedded targets
+ifdef JAVASE_EMBEDDED
+  CFLAGS += -DJAVASE_EMBEDDED
+endif
+
 # Keep temporary files (.ii, .s)
 ifdef NEED_ASM
   CFLAGS += -save-temps
@@ -171,6 +193,8 @@
 # Note: The Itanium gcc compiler crashes when using -gstabs.
 DEBUG_CFLAGS/ia64  = -g
 DEBUG_CFLAGS/amd64 = -g
+DEBUG_CFLAGS/arm   = -g
+DEBUG_CFLAGS/ppc   = -g
 DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
 ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
 DEBUG_CFLAGS += -gstabs
@@ -181,3 +205,15 @@
   DEBUG_CFLAGS = -g
   CFLAGS += $(DEBUG_CFLAGS)
 endif
+
+# If we are building HEADLESS, pass on to VM
+# so it can set the java.awt.headless property
+ifdef HEADLESS
+CFLAGS += -DHEADLESS
+endif
+
+# We are building Embedded for a small device
+# favor code space over speed
+ifdef MINIMIZE_RAM_USAGE
+CFLAGS += -DMINIMIZE_RAM_USAGE
+endif
--- a/hotspot/make/linux/makefiles/product.make	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/make/linux/makefiles/product.make	Fri Aug 20 14:48:10 2010 -0400
@@ -46,7 +46,11 @@
 
 # use -g to strip library as -x will discard its symbol table; -x is fine for
 # executables.
-STRIP = strip
+ifdef CROSS_COMPILE_ARCH
+  STRIP = $(ALT_COMPILER_PATH)/strip
+else
+  STRIP = strip
+endif
 STRIP_LIBJVM = $(STRIP) -g $@ || exit 1;
 STRIP_AOUT   = $(STRIP) -x $@ || exit 1;
 
--- a/hotspot/make/linux/makefiles/sa.make	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/make/linux/makefiles/sa.make	Fri Aug 20 14:48:10 2010 -0400
@@ -55,10 +55,13 @@
 SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties
 
 # if $(AGENT_DIR) does not exist, we don't build SA
-# also, we don't build SA on Itanium or zero.
+# also, we don't build SA on Itanium, PowerPC, ARM or zero.
 
 all: 
-	if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" -a "$(SRCARCH)" != "zero" ] ; then \
+	if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \
+             -a "$(SRCARCH)" != "arm" \
+             -a "$(SRCARCH)" != "ppc" \
+             -a "$(SRCARCH)" != "zero" ] ; then \
 	   $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \
 	fi
 
--- a/hotspot/make/linux/makefiles/saproc.make	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/make/linux/makefiles/saproc.make	Fri Aug 20 14:48:10 2010 -0400
@@ -53,10 +53,10 @@
 endif
 
 # if $(AGENT_DIR) does not exist, we don't build SA
-# also, we don't build SA on Itanium or zero.
+# also, we don't build SA on Itanium, PPC, ARM or zero.
 
 checkAndBuildSA:
-	$(QUIETLY) if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" -a "$(SRCARCH)" != "zero" ] ; then \
+	$(QUIETLY) if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" -a "$(SRCARCH)" != "arm" -a "$(SRCARCH)" != "ppc" -a "$(SRCARCH)" != "zero" ] ; then \
 	   $(MAKE) -f vm.make $(LIBSAPROC); \
 	fi
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/make/linux/makefiles/shark.make	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2008, 2010 Red Hat, Inc.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute 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.
+#  
+#
+
+# Sets make macros for making Shark version of VM
+
+TYPE = SHARK
+
+VM_SUBDIR = server
+
+CFLAGS += -DSHARK
--- a/hotspot/make/linux/makefiles/top.make	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/make/linux/makefiles/top.make	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -75,6 +75,7 @@
 Include_DBs/COMPILER2   = $(Include_DBs/CORE) $(VM)/includeDB_compiler2
 Include_DBs/TIERED      = $(Include_DBs/CORE) $(VM)/includeDB_compiler1 $(VM)/includeDB_compiler2
 Include_DBs/ZERO        = $(Include_DBs/CORE) $(VM)/includeDB_zero
+Include_DBs/SHARK       = $(Include_DBs/ZERO) $(VM)/includeDB_shark
 Include_DBs = $(Include_DBs/$(TYPE))
 
 Cached_plat = $(GENERATED)/platform.current
--- a/hotspot/make/linux/makefiles/vm.make	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/make/linux/makefiles/vm.make	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -98,6 +98,7 @@
 
 # Extra flags from gnumake's invocation or environment
 CFLAGS += $(EXTRA_CFLAGS)
+LFLAGS += $(EXTRA_CFLAGS)
 
 LIBS += -lm -ldl -lpthread
 
@@ -136,10 +137,14 @@
 vm.def: $(Res_Files) $(Obj_Files)
 	sh $(GAMMADIR)/make/linux/makefiles/build_vm_def.sh *.o > $@
 
-ifeq ($(ZERO_LIBARCH), ppc64)
+ifeq ($(SHARK_BUILD), true)
   STATIC_CXX = false
 else
-  STATIC_CXX = true
+  ifeq ($(ZERO_LIBARCH), ppc64)
+    STATIC_CXX = false
+  else
+    STATIC_CXX = true
+  endif
 endif
 
 ifeq ($(LINK_INTO),AOUT)
@@ -167,6 +172,10 @@
 ifeq ($(ZERO_BUILD), true)
   LIBS_VM += $(LIBFFI_LIBS)
 endif
+ifeq ($(SHARK_BUILD), true)
+  LFLAGS_VM += $(LLVM_LDFLAGS)
+  LIBS_VM   += $(LLVM_LIBS)
+endif
 
 LINK_VM = $(LINK_LIB.c)
 
@@ -210,15 +219,17 @@
 	    $(LINK_LIB.CC/POST_HOOK)                                    \
 	    rm -f $@.1; ln -s $@ $@.1;                                  \
 	    [ -f $(LIBJVM_G) ] || { ln -s $@ $(LIBJVM_G); ln -s $@.1 $(LIBJVM_G).1; }; \
-	    if [ -x /usr/sbin/selinuxenabled ] ; then                   \
-	      /usr/sbin/selinuxenabled;                                 \
-              if [ $$? = 0 ] ; then					\
-		/usr/bin/chcon -t textrel_shlib_t $@;                   \
-		if [ $$? != 0 ]; then                                   \
-		  echo "ERROR: Cannot chcon $@";			\
-		fi							\
-	      fi							\
-	    fi                                                          \
+            if [ \"$(CROSS_COMPILE_ARCH)\" = \"\" ] ; then                    \
+	      if [ -x /usr/sbin/selinuxenabled ] ; then                 \
+	        /usr/sbin/selinuxenabled;                               \
+                if [ $$? = 0 ] ; then					\
+		  /usr/bin/chcon -t textrel_shlib_t $@;                 \
+		  if [ $$? != 0 ]; then                                 \
+		    echo "ERROR: Cannot chcon $@";			\
+		  fi							\
+	        fi							\
+	      fi                                                        \
+            fi 								\
 	}
 
 DEST_JVM = $(JDK_LIBDIR)/$(VM_SUBDIR)/$(LIBJVM)
--- a/hotspot/make/solaris/makefiles/defs.make	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/make/solaris/makefiles/defs.make	Fri Aug 20 14:48:10 2010 -0400
@@ -70,20 +70,24 @@
 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.so
 
 EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
+ifneq ($(BUILD_CLIENT_ONLY),true)
 EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.so
 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.so
 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.so
+endif
 ifeq ($(ARCH_DATA_MODEL), 32)
   EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.so 
   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.so 
-  EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.so 
-  EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.so
+  EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.so
   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.so
-  EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.so
   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.so
+  ifneq ($(BUILD_CLIENT_ONLY), true)
+    EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.so
+    EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.so
+  endif
 endif
 
 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so
--- a/hotspot/make/solaris/makefiles/sparcWorks.make	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/make/solaris/makefiles/sparcWorks.make	Fri Aug 20 14:48:10 2010 -0400
@@ -145,11 +145,20 @@
 OPT_CFLAGS/O2=-xO2
 OPT_CFLAGS/NOOPT=-xO1
 
+#################################################
+# Begin current (>=5.9) Forte compiler options #
+#################################################
+
 ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
 ifeq ($(Platform_arch), x86)
 OPT_CFLAGS/NO_TAIL_CALL_OPT  = -Wu,-O~yz
 OPT_CCFLAGS/NO_TAIL_CALL_OPT = -Qoption ube -O~yz
+OPT_CFLAGS/stubGenerator_x86_32.o = $(OPT_CFLAGS) -xspace
+OPT_CFLAGS/stubGenerator_x86_64.o = $(OPT_CFLAGS) -xspace
 endif # Platform_arch == x86
+ifeq ("${Platform_arch}", "sparc")
+OPT_CFLAGS/stubGenerator_sparc.o = $(OPT_CFLAGS) -xspace
+endif
 endif # COMPILER_REV_NUMERIC >= 509
 
 #################################################
--- a/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -626,7 +626,7 @@
 }
 
 // This code sequence is relocatable to any address, even on LP64.
-void MacroAssembler::jumpl(AddressLiteral& addrlit, Register temp, Register d, int offset, const char* file, int line) {
+void MacroAssembler::jumpl(const AddressLiteral& addrlit, Register temp, Register d, int offset, const char* file, int line) {
   assert_not_delayed();
   // Force fixed length sethi because NativeJump and NativeFarCall don't handle
   // variable length instruction streams.
@@ -672,7 +672,7 @@
   }
 }
 
-void MacroAssembler::jump(AddressLiteral& addrlit, Register temp, int offset, const char* file, int line) {
+void MacroAssembler::jump(const AddressLiteral& addrlit, Register temp, int offset, const char* file, int line) {
   jumpl(addrlit, temp, G0, offset, file, line);
 }
 
--- a/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1974,12 +1974,12 @@
 
   // address pseudos: make these names unlike instruction names to avoid confusion
   inline intptr_t load_pc_address( Register reg, int bytes_to_skip );
-  inline void load_contents(AddressLiteral& addrlit, Register d, int offset = 0);
-  inline void load_ptr_contents(AddressLiteral& addrlit, Register d, int offset = 0);
-  inline void store_contents(Register s, AddressLiteral& addrlit, Register temp, int offset = 0);
-  inline void store_ptr_contents(Register s, AddressLiteral& addrlit, Register temp, int offset = 0);
-  inline void jumpl_to(AddressLiteral& addrlit, Register temp, Register d, int offset = 0);
-  inline void jump_to(AddressLiteral& addrlit, Register temp, int offset = 0);
+  inline void load_contents(const AddressLiteral& addrlit, Register d, int offset = 0);
+  inline void load_ptr_contents(const AddressLiteral& addrlit, Register d, int offset = 0);
+  inline void store_contents(Register s, const AddressLiteral& addrlit, Register temp, int offset = 0);
+  inline void store_ptr_contents(Register s, const AddressLiteral& addrlit, Register temp, int offset = 0);
+  inline void jumpl_to(const AddressLiteral& addrlit, Register temp, Register d, int offset = 0);
+  inline void jump_to(const AddressLiteral& addrlit, Register temp, int offset = 0);
   inline void jump_indirect_to(Address& a, Register temp, int ld_offset = 0, int jmp_offset = 0);
 
   // ring buffer traceable jumps
@@ -1987,8 +1987,8 @@
   void jmp2( Register r1, Register r2, const char* file, int line );
   void jmp ( Register r1, int offset,  const char* file, int line );
 
-  void jumpl(AddressLiteral& addrlit, Register temp, Register d, int offset, const char* file, int line);
-  void jump (AddressLiteral& addrlit, Register temp,             int offset, const char* file, int line);
+  void jumpl(const AddressLiteral& addrlit, Register temp, Register d, int offset, const char* file, int line);
+  void jump (const AddressLiteral& addrlit, Register temp,             int offset, const char* file, int line);
 
 
   // argument pseudos:
--- a/hotspot/src/cpu/sparc/vm/assembler_sparc.inline.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.inline.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -650,28 +650,28 @@
 }
 
 
-inline void MacroAssembler::load_contents(AddressLiteral& addrlit, Register d, int offset) {
+inline void MacroAssembler::load_contents(const AddressLiteral& addrlit, Register d, int offset) {
   assert_not_delayed();
   sethi(addrlit, d);
   ld(d, addrlit.low10() + offset, d);
 }
 
 
-inline void MacroAssembler::load_ptr_contents(AddressLiteral& addrlit, Register d, int offset) {
+inline void MacroAssembler::load_ptr_contents(const AddressLiteral& addrlit, Register d, int offset) {
   assert_not_delayed();
   sethi(addrlit, d);
   ld_ptr(d, addrlit.low10() + offset, d);
 }
 
 
-inline void MacroAssembler::store_contents(Register s, AddressLiteral& addrlit, Register temp, int offset) {
+inline void MacroAssembler::store_contents(Register s, const AddressLiteral& addrlit, Register temp, int offset) {
   assert_not_delayed();
   sethi(addrlit, temp);
   st(s, temp, addrlit.low10() + offset);
 }
 
 
-inline void MacroAssembler::store_ptr_contents(Register s, AddressLiteral& addrlit, Register temp, int offset) {
+inline void MacroAssembler::store_ptr_contents(Register s, const AddressLiteral& addrlit, Register temp, int offset) {
   assert_not_delayed();
   sethi(addrlit, temp);
   st_ptr(s, temp, addrlit.low10() + offset);
@@ -679,7 +679,7 @@
 
 
 // This code sequence is relocatable to any address, even on LP64.
-inline void MacroAssembler::jumpl_to(AddressLiteral& addrlit, Register temp, Register d, int offset) {
+inline void MacroAssembler::jumpl_to(const AddressLiteral& addrlit, Register temp, Register d, int offset) {
   assert_not_delayed();
   // Force fixed length sethi because NativeJump and NativeFarCall don't handle
   // variable length instruction streams.
@@ -688,7 +688,7 @@
 }
 
 
-inline void MacroAssembler::jump_to(AddressLiteral& addrlit, Register temp, int offset) {
+inline void MacroAssembler::jump_to(const AddressLiteral& addrlit, Register temp, int offset) {
   jumpl_to(addrlit, temp, G0, offset);
 }
 
--- a/hotspot/src/cpu/sparc/vm/bytecodeInterpreter_sparc.inline.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/bytecodeInterpreter_sparc.inline.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -236,19 +236,19 @@
 }
 
 inline jint BytecodeInterpreter::VMintShl(jint op1, jint op2) {
-  return op1 <<  op2;
+  return op1 << (op2 & 0x1f);
 }
 
 inline jint BytecodeInterpreter::VMintShr(jint op1, jint op2) {
-  return op1 >>  op2; // QQ op2 & 0x1f??
+  return op1 >> (op2 & 0x1f);
 }
 
 inline jint BytecodeInterpreter::VMintSub(jint op1, jint op2) {
   return op1 - op2;
 }
 
-inline jint BytecodeInterpreter::VMintUshr(jint op1, jint op2) {
-  return ((juint) op1) >> op2; // QQ op2 & 0x1f??
+inline juint BytecodeInterpreter::VMintUshr(jint op1, jint op2) {
+  return ((juint) op1) >> (op2 & 0x1f);
 }
 
 inline jint BytecodeInterpreter::VMintXor(jint op1, jint op2) {
--- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -409,7 +409,7 @@
   LIR_Opr lock      = FrameMap::G1_opr;
   LIR_Opr hdr       = FrameMap::G3_opr;
   LIR_Opr obj_temp  = FrameMap::G4_opr;
-  monitor_exit(obj_temp, lock, hdr, x->monitor_no());
+  monitor_exit(obj_temp, lock, hdr, LIR_OprFact::illegalOpr, x->monitor_no());
 }
 
 
--- a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1031,3 +1031,7 @@
 #undef __
 
 #define __ masm->
+
+const char *Runtime1::pd_name_for_address(address entry) {
+  return "<unknown function>";
+}
--- a/hotspot/src/cpu/sparc/vm/interpreterRT_sparc.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/interpreterRT_sparc.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -56,14 +56,18 @@
 }
 
 
-#ifdef _LP64
 void InterpreterRuntime::SignatureHandlerGenerator::pass_float() {
   Argument  jni_arg(jni_offset(), false);
+#ifdef _LP64
   FloatRegister  Rtmp = F0;
   __ ldf(FloatRegisterImpl::S, Llocals, Interpreter::local_offset_in_bytes(offset()), Rtmp);
   __ store_float_argument(Rtmp, jni_arg);
+#else
+  Register     Rtmp = O0;
+  __ ld(Llocals, Interpreter::local_offset_in_bytes(offset()), Rtmp);
+  __ store_argument(Rtmp, jni_arg);
+#endif
 }
-#endif
 
 
 void InterpreterRuntime::SignatureHandlerGenerator::pass_double() {
@@ -185,6 +189,13 @@
     _from -= 2*Interpreter::stackElementSize;
     add_signature( non_float );
   }
+
+  virtual void pass_float() {
+    *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
+    _from -= Interpreter::stackElementSize;
+    add_signature( non_float );
+  }
+
 #endif // _LP64
 
   virtual void add_signature( intptr_t sig_type ) {
--- a/hotspot/src/cpu/sparc/vm/javaFrameAnchor_sparc.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/javaFrameAnchor_sparc.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -76,6 +76,8 @@
 
   void set_last_Java_sp(intptr_t* sp)            { _last_Java_sp = sp; }
 
+  address last_Java_pc(void)                     { return _last_Java_pc; }
+
   // These are only used by friends
 private:
 
--- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1007,9 +1007,9 @@
         __ brx(Assembler::lessEqualUnsigned, false, Assembler::pt, (*NOLp));
       __ delayed()->cmp(to_from, byte_count);
       if (NOLp == NULL)
-        __ brx(Assembler::greaterEqual, false, Assembler::pt, no_overlap_target);
+        __ brx(Assembler::greaterEqualUnsigned, false, Assembler::pt, no_overlap_target);
       else
-        __ brx(Assembler::greaterEqual, false, Assembler::pt, (*NOLp));
+        __ brx(Assembler::greaterEqualUnsigned, false, Assembler::pt, (*NOLp));
       __ delayed()->nop();
   }
 
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -3236,12 +3236,14 @@
   __ get_2_byte_integer_at_bcp(1, Rscratch, Roffset, InterpreterMacroAssembler::Unsigned);
   __ get_cpool_and_tags(Rscratch, G3_scratch);
   // make sure the class we're about to instantiate has been resolved
+  // This is done before loading instanceKlass to be consistent with the order
+  // how Constant Pool is updated (see constantPoolOopDesc::klass_at_put)
   __ add(G3_scratch, typeArrayOopDesc::header_size(T_BYTE) * wordSize, G3_scratch);
   __ ldub(G3_scratch, Roffset, G3_scratch);
   __ cmp(G3_scratch, JVM_CONSTANT_Class);
   __ br(Assembler::notEqual, false, Assembler::pn, slow_case);
   __ delayed()->sll(Roffset, LogBytesPerWord, Roffset);
-
+  // get instanceKlass
   //__ sll(Roffset, LogBytesPerWord, Roffset);        // executed in delay slot
   __ add(Roffset, sizeof(constantPoolOopDesc), Roffset);
   __ ld_ptr(Rscratch, Roffset, RinstanceKlass);
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -7151,7 +7151,7 @@
   subptr(t1, typeArrayOopDesc::header_size(T_INT));
   addptr(t1, (int32_t)ThreadLocalAllocBuffer::alignment_reserve());
   shlptr(t1, log2_intptr(HeapWordSize/sizeof(jint)));
-  movptr(Address(top, arrayOopDesc::length_offset_in_bytes()), t1);
+  movl(Address(top, arrayOopDesc::length_offset_in_bytes()), t1);
   // set klass to intArrayKlass
   // dubious reloc why not an oop reloc?
   movptr(t1, ExternalAddress((address) Universe::intArrayKlassObj_addr()));
@@ -7568,21 +7568,27 @@
 
   // Scan RCX words at [RDI] for an occurrence of RAX.
   // Set NZ/Z based on last compare.
+  // Z flag value will not be set by 'repne' if RCX == 0 since 'repne' does
+  // not change flags (only scas instruction which is repeated sets flags).
+  // Set Z = 0 (not equal) before 'repne' to indicate that class was not found.
 #ifdef _LP64
   // This part is tricky, as values in supers array could be 32 or 64 bit wide
   // and we store values in objArrays always encoded, thus we need to encode
   // the value of rax before repne.  Note that rax is dead after the repne.
   if (UseCompressedOops) {
-    encode_heap_oop_not_null(rax);
+    encode_heap_oop_not_null(rax); // Changes flags.
     // The superclass is never null; it would be a basic system error if a null
     // pointer were to sneak in here.  Note that we have already loaded the
     // Klass::super_check_offset from the super_klass in the fast path,
     // so if there is a null in that register, we are already in the afterlife.
+    testl(rax,rax); // Set Z = 0
     repne_scanl();
   } else
 #endif // _LP64
+  {
+    testptr(rax,rax); // Set Z = 0
     repne_scan();
-
+  }
   // Unspill the temp. registers:
   if (pushed_rdi)  pop(rdi);
   if (pushed_rcx)  pop(rcx);
@@ -8257,30 +8263,35 @@
   }
 }
 
+#ifdef ASSERT
+void MacroAssembler::verify_heapbase(const char* msg) {
+  assert (UseCompressedOops, "should be compressed");
+  assert (Universe::heap() != NULL, "java heap should be initialized");
+  if (CheckCompressedOops) {
+    Label ok;
+    push(rscratch1); // cmpptr trashes rscratch1
+    cmpptr(r12_heapbase, ExternalAddress((address)Universe::narrow_oop_base_addr()));
+    jcc(Assembler::equal, ok);
+    stop(msg);
+    bind(ok);
+    pop(rscratch1);
+  }
+}
+#endif
+
 // Algorithm must match oop.inline.hpp encode_heap_oop.
 void MacroAssembler::encode_heap_oop(Register r) {
-  assert (UseCompressedOops, "should be compressed");
-  assert (Universe::heap() != NULL, "java heap should be initialized");
+#ifdef ASSERT
+  verify_heapbase("MacroAssembler::encode_heap_oop: heap base corrupted?");
+#endif
+  verify_oop(r, "broken oop in encode_heap_oop");
   if (Universe::narrow_oop_base() == NULL) {
-    verify_oop(r, "broken oop in encode_heap_oop");
     if (Universe::narrow_oop_shift() != 0) {
       assert (LogMinObjAlignmentInBytes == Universe::narrow_oop_shift(), "decode alg wrong");
       shrq(r, LogMinObjAlignmentInBytes);
     }
     return;
   }
-#ifdef ASSERT
-  if (CheckCompressedOops) {
-    Label ok;
-    push(rscratch1); // cmpptr trashes rscratch1
-    cmpptr(r12_heapbase, ExternalAddress((address)Universe::narrow_oop_base_addr()));
-    jcc(Assembler::equal, ok);
-    stop("MacroAssembler::encode_heap_oop: heap base corrupted?");
-    bind(ok);
-    pop(rscratch1);
-  }
-#endif
-  verify_oop(r, "broken oop in encode_heap_oop");
   testq(r, r);
   cmovq(Assembler::equal, r, r12_heapbase);
   subq(r, r12_heapbase);
@@ -8288,9 +8299,8 @@
 }
 
 void MacroAssembler::encode_heap_oop_not_null(Register r) {
-  assert (UseCompressedOops, "should be compressed");
-  assert (Universe::heap() != NULL, "java heap should be initialized");
 #ifdef ASSERT
+  verify_heapbase("MacroAssembler::encode_heap_oop_not_null: heap base corrupted?");
   if (CheckCompressedOops) {
     Label ok;
     testq(r, r);
@@ -8310,9 +8320,8 @@
 }
 
 void MacroAssembler::encode_heap_oop_not_null(Register dst, Register src) {
-  assert (UseCompressedOops, "should be compressed");
-  assert (Universe::heap() != NULL, "java heap should be initialized");
 #ifdef ASSERT
+  verify_heapbase("MacroAssembler::encode_heap_oop_not_null2: heap base corrupted?");
   if (CheckCompressedOops) {
     Label ok;
     testq(src, src);
@@ -8335,40 +8344,21 @@
 }
 
 void  MacroAssembler::decode_heap_oop(Register r) {
-  assert (UseCompressedOops, "should be compressed");
-  assert (Universe::heap() != NULL, "java heap should be initialized");
+#ifdef ASSERT
+  verify_heapbase("MacroAssembler::decode_heap_oop: heap base corrupted?");
+#endif
   if (Universe::narrow_oop_base() == NULL) {
     if (Universe::narrow_oop_shift() != 0) {
       assert (LogMinObjAlignmentInBytes == Universe::narrow_oop_shift(), "decode alg wrong");
       shlq(r, LogMinObjAlignmentInBytes);
     }
-    verify_oop(r, "broken oop in decode_heap_oop");
-    return;
-  }
-#ifdef ASSERT
-  if (CheckCompressedOops) {
-    Label ok;
-    push(rscratch1);
-    cmpptr(r12_heapbase,
-           ExternalAddress((address)Universe::narrow_oop_base_addr()));
-    jcc(Assembler::equal, ok);
-    stop("MacroAssembler::decode_heap_oop: heap base corrupted?");
-    bind(ok);
-    pop(rscratch1);
-  }
-#endif
-
-  Label done;
-  shlq(r, LogMinObjAlignmentInBytes);
-  jccb(Assembler::equal, done);
-  addq(r, r12_heapbase);
-#if 0
-   // alternate decoding probably a wash.
-   testq(r, r);
-   jccb(Assembler::equal, done);
-   leaq(r, Address(r12_heapbase, r, Address::times_8, 0));
-#endif
-  bind(done);
+  } else {
+    Label done;
+    shlq(r, LogMinObjAlignmentInBytes);
+    jccb(Assembler::equal, done);
+    addq(r, r12_heapbase);
+    bind(done);
+  }
   verify_oop(r, "broken oop in decode_heap_oop");
 }
 
@@ -8410,9 +8400,11 @@
         addq(dst, r12_heapbase);
       }
     }
-  } else if (dst != src) {
+  } else {
     assert (Universe::narrow_oop_base() == NULL, "sanity");
-    movq(dst, src);
+    if (dst != src) {
+      movq(dst, src);
+    }
   }
 }
 
--- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1714,6 +1714,9 @@
 
   // if heap base register is used - reinit it with the correct value
   void reinit_heapbase();
+
+  DEBUG_ONLY(void verify_heapbase(const char* msg);)
+
 #endif // _LP64
 
   // Int division/remainder for Java
--- a/hotspot/src/cpu/x86/vm/bytecodeInterpreter_x86.inline.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/bytecodeInterpreter_x86.inline.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -236,11 +236,11 @@
 }
 
 inline jint BytecodeInterpreter::VMintShl(jint op1, jint op2) {
-  return op1 <<  op2;
+  return op1 << op2;
 }
 
 inline jint BytecodeInterpreter::VMintShr(jint op1, jint op2) {
-  return op1 >>  op2; // QQ op2 & 0x1f??
+  return op1 >> (op2 & 0x1f);
 }
 
 inline jint BytecodeInterpreter::VMintSub(jint op1, jint op2) {
@@ -248,7 +248,7 @@
 }
 
 inline jint BytecodeInterpreter::VMintUshr(jint op1, jint op2) {
-  return ((juint) op1) >> op2; // QQ op2 & 0x1f??
+  return ((juint) op1) >> (op2 & 0x1f);
 }
 
 inline jint BytecodeInterpreter::VMintXor(jint op1, jint op2) {
--- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -349,7 +349,7 @@
   LIR_Opr lock = new_register(T_INT);
   LIR_Opr obj_temp = new_register(T_INT);
   set_no_result(x);
-  monitor_exit(obj_temp, lock, syncTempOpr(), x->monitor_no());
+  monitor_exit(obj_temp, lock, syncTempOpr(), LIR_OprFact::illegalOpr, x->monitor_no());
 }
 
 
--- a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1779,3 +1779,7 @@
 }
 
 #undef __
+
+const char *Runtime1::pd_name_for_address(address entry) {
+  return "<unknown function>";
+}
--- a/hotspot/src/cpu/x86/vm/frame_x86.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -575,8 +575,8 @@
 
 BasicType frame::interpreter_frame_result(oop* oop_result, jvalue* value_result) {
 #ifdef CC_INTERP
-  // Needed for JVMTI. The result should always be in the interpreterState object
-  assert(false, "NYI");
+  // Needed for JVMTI. The result should always be in the
+  // interpreterState object
   interpreterState istate = get_interpreterState();
 #endif // CC_INTERP
   assert(is_interpreted_frame(), "interpreted frame expected");
--- a/hotspot/src/cpu/x86/vm/interpreterRT_x86_32.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/interpreterRT_x86_32.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -34,6 +34,10 @@
   move(offset(), jni_offset() + 1);
 }
 
+void InterpreterRuntime::SignatureHandlerGenerator::pass_float() {
+  move(offset(), jni_offset() + 1);
+}
+
 void InterpreterRuntime::SignatureHandlerGenerator::pass_long() {
    move(offset(), jni_offset() + 2);
    move(offset() + 1, jni_offset() + 1);
@@ -91,6 +95,11 @@
     _from -= Interpreter::stackElementSize;
   }
 
+  virtual void pass_float() {
+    *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
+    _from -= Interpreter::stackElementSize;
+  }
+
   virtual void pass_long() {
     _to[0] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
     _to[1] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(0));
--- a/hotspot/src/cpu/x86/vm/javaFrameAnchor_x86.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/javaFrameAnchor_x86.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -66,6 +66,8 @@
 
   intptr_t* last_Java_sp(void) const             { return _last_Java_sp; }
 
+  address last_Java_pc(void)                     { return _last_Java_pc; }
+
 private:
 
   static ByteSize last_Java_fp_offset()          { return byte_offset_of(JavaFrameAnchor, _last_Java_fp); }
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -3112,22 +3112,25 @@
   transition(vtos, atos);
   __ get_unsigned_2_byte_index_at_bcp(rdx, 1);
   Label slow_case;
+  Label slow_case_no_pop;
   Label done;
   Label initialize_header;
   Label initialize_object;  // including clearing the fields
   Label allocate_shared;
 
   __ get_cpool_and_tags(rcx, rax);
+
+  // Make sure the class we're about to instantiate has been resolved.
+  // This is done before loading instanceKlass to be consistent with the order
+  // how Constant Pool is updated (see constantPoolOopDesc::klass_at_put)
+  const int tags_offset = typeArrayOopDesc::header_size(T_BYTE) * wordSize;
+  __ cmpb(Address(rax, rdx, Address::times_1, tags_offset), JVM_CONSTANT_Class);
+  __ jcc(Assembler::notEqual, slow_case_no_pop);
+
   // get instanceKlass
   __ movptr(rcx, Address(rcx, rdx, Address::times_ptr, sizeof(constantPoolOopDesc)));
   __ push(rcx);  // save the contexts of klass for initializing the header
 
-  // make sure the class we're about to instantiate has been resolved.
-  // Note: slow_case does a pop of stack, which is why we loaded class/pushed above
-  const int tags_offset = typeArrayOopDesc::header_size(T_BYTE) * wordSize;
-  __ cmpb(Address(rax, rdx, Address::times_1, tags_offset), JVM_CONSTANT_Class);
-  __ jcc(Assembler::notEqual, slow_case);
-
   // make sure klass is initialized & doesn't have finalizer
   // make sure klass is fully initialized
   __ cmpl(Address(rcx, instanceKlass::init_state_offset_in_bytes() + sizeof(oopDesc)), instanceKlass::fully_initialized);
@@ -3255,6 +3258,7 @@
   // slow case
   __ bind(slow_case);
   __ pop(rcx);   // restore stack pointer to what it was when we came in.
+  __ bind(slow_case_no_pop);
   __ get_constant_pool(rax);
   __ get_unsigned_2_byte_index_at_bcp(rdx, 1);
   call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::_new), rax, rdx);
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -3126,18 +3126,18 @@
   Label allocate_shared;
 
   __ get_cpool_and_tags(rsi, rax);
-  // get instanceKlass
-  __ movptr(rsi, Address(rsi, rdx,
-                         Address::times_8, sizeof(constantPoolOopDesc)));
-
-  // make sure the class we're about to instantiate has been
-  // resolved. Note: slow_case does a pop of stack, which is why we
-  // loaded class/pushed above
+  // Make sure the class we're about to instantiate has been resolved.
+  // This is done before loading instanceKlass to be consistent with the order
+  // how Constant Pool is updated (see constantPoolOopDesc::klass_at_put)
   const int tags_offset = typeArrayOopDesc::header_size(T_BYTE) * wordSize;
   __ cmpb(Address(rax, rdx, Address::times_1, tags_offset),
           JVM_CONSTANT_Class);
   __ jcc(Assembler::notEqual, slow_case);
 
+  // get instanceKlass
+  __ movptr(rsi, Address(rsi, rdx,
+            Address::times_8, sizeof(constantPoolOopDesc)));
+
   // make sure klass is initialized & doesn't have finalizer
   // make sure klass is fully initialized
   __ cmpl(Address(rsi,
--- a/hotspot/src/cpu/zero/vm/disassembler_zero.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/cpu/zero/vm/disassembler_zero.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007 Red Hat, Inc.
+ * Copyright 2007, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,13 +23,10 @@
  *
  */
 
-// The disassembler prints out zero code annotated
-// with Java specific information.
-
   static int pd_instruction_alignment() {
-    ShouldNotCallThis();
+    return 1;
   }
 
   static const char* pd_cpu_opts() {
-    ShouldNotCallThis();
+    return "";
   }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+// Set the default values for platform dependent flags used by the
+// Shark compiler.  See globals.hpp for details of what they do.
+
+define_pd_global(bool,     BackgroundCompilation,        true );
+define_pd_global(bool,     UseTLAB,                      true );
+define_pd_global(bool,     ResizeTLAB,                   true );
+define_pd_global(bool,     InlineIntrinsics,             false);
+define_pd_global(bool,     PreferInterpreterNativeStubs, false);
+define_pd_global(bool,     ProfileTraps,                 false);
+define_pd_global(bool,     UseOnStackReplacement,        true );
+define_pd_global(bool,     TieredCompilation,            false);
+
+define_pd_global(intx,     CompileThreshold,             1500);
+define_pd_global(intx,     Tier2CompileThreshold,        1500);
+define_pd_global(intx,     Tier3CompileThreshold,        2500);
+define_pd_global(intx,     Tier4CompileThreshold,        4500);
+
+define_pd_global(intx,     BackEdgeThreshold,            100000);
+define_pd_global(intx,     Tier2BackEdgeThreshold,       100000);
+define_pd_global(intx,     Tier3BackEdgeThreshold,       100000);
+define_pd_global(intx,     Tier4BackEdgeThreshold,       100000);
+
+define_pd_global(intx,     OnStackReplacePercentage,     933  );
+define_pd_global(intx,     FreqInlineSize,               325  );
+define_pd_global(intx,     InlineSmallCode,              1000 );
+define_pd_global(intx,     NewRatio,                     12   );
+define_pd_global(intx,     NewSizeThreadIncrease,        4*K  );
+define_pd_global(intx,     InitialCodeCacheSize,         160*K);
+define_pd_global(intx,     ReservedCodeCacheSize,        32*M );
+define_pd_global(bool,     ProfileInterpreter,           false);
+define_pd_global(intx,     CodeCacheExpansionSize,       32*K );
+define_pd_global(uintx,    CodeCacheMinBlockLength,      1    );
+define_pd_global(uintx,    PermSize,                     12*M );
+define_pd_global(uintx,    MaxPermSize,                  64*M );
+define_pd_global(bool,     NeverActAsServerClassMachine, true );
+define_pd_global(uint64_t, MaxRAM,                       1ULL*G);
+define_pd_global(bool,     CICompileOSR,                 true );
--- a/hotspot/src/os/linux/launcher/java_md.c	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/os/linux/launcher/java_md.c	Fri Aug 20 14:48:10 2010 -0400
@@ -79,6 +79,10 @@
 #    define ARCH "i386"
 #  elif defined(__sparc)
 #    define ARCH "sparc"
+#  elif defined(arm)
+#    define ARCH "arm"
+#  elif defined(PPC)
+#    define ARCH "ppc"
 #  endif
 
 #endif /* _LP64 */
--- a/hotspot/src/os/linux/vm/attachListener_linux.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/os/linux/vm/attachListener_linux.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -32,11 +32,15 @@
 #include <sys/un.h>
 #include <sys/stat.h>
 
+#ifndef UNIX_PATH_MAX
+#define UNIX_PATH_MAX   sizeof(((struct sockaddr_un *)0)->sun_path)
+#endif
+
 // The attach mechanism on Linux uses a UNIX domain socket. An attach listener
 // thread is created at startup or is created on-demand via a signal from
 // the client tool. The attach listener creates a socket and binds it to a file
 // in the filesystem. The attach listener then acts as a simple (single-
-// threaded) server - tt waits for a client to connect, reads the request,
+// threaded) server - it waits for a client to connect, reads the request,
 // executes it, and returns the response to the client via the socket
 // connection.
 //
@@ -54,7 +58,7 @@
 class LinuxAttachListener: AllStatic {
  private:
   // the path to which we bind the UNIX domain socket
-  static char _path[PATH_MAX+1];
+  static char _path[UNIX_PATH_MAX];
   static bool _has_path;
 
   // the file descriptor for the listening socket
@@ -64,8 +68,8 @@
     if (path == NULL) {
       _has_path = false;
     } else {
-      strncpy(_path, path, PATH_MAX);
-      _path[PATH_MAX] = '\0';
+      strncpy(_path, path, UNIX_PATH_MAX);
+      _path[UNIX_PATH_MAX-1] = '\0';
       _has_path = true;
     }
   }
@@ -113,7 +117,7 @@
 };
 
 // statics
-char LinuxAttachListener::_path[PATH_MAX+1];
+char LinuxAttachListener::_path[UNIX_PATH_MAX];
 bool LinuxAttachListener::_has_path;
 int LinuxAttachListener::_listener = -1;
 
@@ -163,54 +167,53 @@
 // Initialization - create a listener socket and bind it to a file
 
 int LinuxAttachListener::init() {
-  char path[PATH_MAX+1];        // socket file
-  int listener;                 // listener socket (file descriptor)
+  char path[UNIX_PATH_MAX];          // socket file
+  char initial_path[UNIX_PATH_MAX];  // socket file during setup
+  int listener;                      // listener socket (file descriptor)
 
   // register function to cleanup
   ::atexit(listener_cleanup);
 
+  int n = snprintf(path, UNIX_PATH_MAX, "%s/.java_pid%d",
+                   os::get_temp_directory(), os::current_process_id());
+  if (n <= (int)UNIX_PATH_MAX) {
+    n = snprintf(initial_path, UNIX_PATH_MAX, "%s.tmp", path);
+  }
+  if (n > (int)UNIX_PATH_MAX) {
+    return -1;
+  }
+
   // create the listener socket
   listener = ::socket(PF_UNIX, SOCK_STREAM, 0);
   if (listener == -1) {
     return -1;
   }
 
-  int res = -1;
+  // bind socket
   struct sockaddr_un addr;
   addr.sun_family = AF_UNIX;
-
-  // FIXME: Prior to b39 the tool-side API expected to find the well
-  // known file in the working directory. To allow this libjvm.so work with
-  // a pre-b39 SDK we create it in the working directory if
-  // +StartAttachListener is used is used. All unit tests for this feature
-  // currently used this flag. Once b39 SDK has been promoted we can remove
-  // this code.
-  if (StartAttachListener) {
-    sprintf(path, ".java_pid%d", os::current_process_id());
-    strcpy(addr.sun_path, path);
-    ::unlink(path);
-    res = ::bind(listener, (struct sockaddr*)&addr, sizeof(addr));
-  }
-  if (res == -1) {
-    snprintf(path, PATH_MAX+1, "%s/.java_pid%d",
-             os::get_temp_directory(), os::current_process_id());
-    strcpy(addr.sun_path, path);
-    ::unlink(path);
-    res = ::bind(listener, (struct sockaddr*)&addr, sizeof(addr));
-  }
+  strcpy(addr.sun_path, initial_path);
+  ::unlink(initial_path);
+  int res = ::bind(listener, (struct sockaddr*)&addr, sizeof(addr));
   if (res == -1) {
     RESTARTABLE(::close(listener), res);
     return -1;
   }
-  set_path(path);
 
-  // put in listen mode and set permission
-  if ((::listen(listener, 5) == -1) || (::chmod(path, S_IREAD|S_IWRITE) == -1)) {
+  // put in listen mode, set permissions, and rename into place
+  res = ::listen(listener, 5);
+  if (res == 0) {
+      RESTARTABLE(::chmod(initial_path, S_IREAD|S_IWRITE), res);
+      if (res == 0) {
+          res = ::rename(initial_path, path);
+      }
+  }
+  if (res == -1) {
     RESTARTABLE(::close(listener), res);
-    ::unlink(path);
-    set_path(NULL);
+    ::unlink(initial_path);
     return -1;
   }
+  set_path(path);
   set_listener(listener);
 
   return 0;
--- a/hotspot/src/os/linux/vm/globals_linux.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/os/linux/vm/globals_linux.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -29,9 +29,10 @@
   product(bool, UseOprofile, false,                                 \
         "enable support for Oprofile profiler")                     \
                                                                     \
-  product(bool, UseLinuxPosixThreadCPUClocks, false,                \
-          "enable fast Linux Posix clocks where available")         \
-
+  product(bool, UseLinuxPosixThreadCPUClocks, true,                 \
+          "enable fast Linux Posix clocks where available")
+// NB: The default value of UseLinuxPosixThreadCPUClocks may be
+// overridden in Arguments::parse_each_vm_init_arg.
 
 //
 // Defines Linux-specific default values. The flags are available on all
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -30,6 +30,8 @@
 // put OS-includes here
 # include <sys/types.h>
 # include <sys/mman.h>
+# include <sys/stat.h>
+# include <sys/select.h>
 # include <pthread.h>
 # include <signal.h>
 # include <errno.h>
@@ -188,6 +190,10 @@
 static char cpu_arch[] = "i386";
 #elif defined(AMD64)
 static char cpu_arch[] = "amd64";
+#elif defined(ARM)
+static char cpu_arch[] = "arm";
+#elif defined(PPC)
+static char cpu_arch[] = "ppc";
 #elif defined(SPARC)
 #  ifdef _LP64
 static char cpu_arch[] = "sparcv9";
@@ -1137,8 +1143,8 @@
     long it_real;
     uintptr_t start;
     uintptr_t vsize;
-    uintptr_t rss;
-    unsigned long rsslim;
+    intptr_t rss;
+    uintptr_t rsslim;
     uintptr_t scodes;
     uintptr_t ecode;
     int i;
@@ -1168,12 +1174,12 @@
         // Skip blank chars
         do s++; while (isspace(*s));
 
-        /*                                     1   1   1   1   1   1   1   1   1   1   2   2   2   2   2   2   2   2   2 */
-        /*              3  4  5  6  7  8   9   0   1   2   3   4   5   6   7   8   9   0   1   2   3   4   5   6   7   8 */
-        i = sscanf(s, "%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld "
-                   UINTX_FORMAT UINTX_FORMAT UINTX_FORMAT
-                   " %lu "
-                   UINTX_FORMAT UINTX_FORMAT UINTX_FORMAT,
+#define _UFM UINTX_FORMAT
+#define _DFM INTX_FORMAT
+
+        /*                                     1   1   1   1   1   1   1   1   1   1   2   2    2    2    2    2    2    2    2 */
+        /*              3  4  5  6  7  8   9   0   1   2   3   4   5   6   7   8   9   0   1    2    3    4    5    6    7    8 */
+        i = sscanf(s, "%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld " _UFM _UFM _DFM _UFM _UFM _UFM _UFM,
              &state,          /* 3  %c  */
              &ppid,           /* 4  %d  */
              &pgrp,           /* 5  %d  */
@@ -1193,15 +1199,18 @@
              &nice,           /* 19 %ld  */
              &junk,           /* 20 %ld  */
              &it_real,        /* 21 %ld  */
-             &start,          /* 22 UINTX_FORMAT  */
-             &vsize,          /* 23 UINTX_FORMAT  */
-             &rss,            /* 24 UINTX_FORMAT  */
-             &rsslim,         /* 25 %lu  */
-             &scodes,         /* 26 UINTX_FORMAT  */
-             &ecode,          /* 27 UINTX_FORMAT  */
-             &stack_start);   /* 28 UINTX_FORMAT  */
+             &start,          /* 22 UINTX_FORMAT */
+             &vsize,          /* 23 UINTX_FORMAT */
+             &rss,            /* 24 INTX_FORMAT  */
+             &rsslim,         /* 25 UINTX_FORMAT */
+             &scodes,         /* 26 UINTX_FORMAT */
+             &ecode,          /* 27 UINTX_FORMAT */
+             &stack_start);   /* 28 UINTX_FORMAT */
       }
 
+#undef _UFM
+#undef _DFM
+
       if (i != 28 - 2) {
          assert(false, "Bad conversion from /proc/self/stat");
          // product mode - assume we are the initial thread, good luck in the
@@ -1336,14 +1345,16 @@
 
 #if defined(IA32) || defined(AMD64)
 #define SYS_clock_getres IA32_ONLY(266)  AMD64_ONLY(229)
+#define sys_clock_getres(x,y)  ::syscall(SYS_clock_getres, x, y)
 #else
-#error Value of SYS_clock_getres not known on this platform
+#warning "SYS_clock_getres not defined for this platform, disabling fast_thread_cpu_time"
+#define sys_clock_getres(x,y)  -1
 #endif
 
+#else
+#define sys_clock_getres(x,y)  ::syscall(SYS_clock_getres, x, y)
 #endif
 
-#define sys_clock_getres(x,y)  ::syscall(SYS_clock_getres, x, y)
-
 void os::Linux::fast_thread_clock_init() {
   if (!UseLinuxPosixThreadCPUClocks) {
     return;
@@ -1905,7 +1916,9 @@
       !_print_ascii_file("/etc/SuSE-release", st) &&
       !_print_ascii_file("/etc/turbolinux-release", st) &&
       !_print_ascii_file("/etc/gentoo-release", st) &&
-      !_print_ascii_file("/etc/debian_version", st)) {
+      !_print_ascii_file("/etc/debian_version", st) &&
+      !_print_ascii_file("/etc/ltib-release", st) &&
+      !_print_ascii_file("/etc/angstrom-version", st)) {
       st->print("Linux");
   }
   st->cr();
@@ -1971,6 +1984,11 @@
   os::loadavg(loadavg, 3);
   st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
   st->cr();
+
+  // meminfo
+  st->print("\n/proc/meminfo:\n");
+  _print_ascii_file("/proc/meminfo", st);
+  st->cr();
 }
 
 void os::print_memory_info(outputStream* st) {
@@ -2097,7 +2115,8 @@
                 CAST_FROM_FN_PTR(address, os::jvm_path),
                 dli_fname, sizeof(dli_fname), NULL);
   assert(ret != 0, "cannot locate libjvm");
-  if (realpath(dli_fname, buf) == NULL)
+  char *rp = realpath(dli_fname, buf);
+  if (rp == NULL)
     return;
 
   if (strcmp(Arguments::sun_java_launcher(), "gamma") == 0) {
@@ -2125,7 +2144,8 @@
         assert(strstr(p, "/libjvm") == p, "invalid library name");
         p = strstr(p, "_g") ? "_g" : "";
 
-        if (realpath(java_home_var, buf) == NULL)
+        rp = realpath(java_home_var, buf);
+        if (rp == NULL)
           return;
 
         // determine if this is a legacy image or modules image
@@ -2147,7 +2167,8 @@
           snprintf(buf + len, buflen-len, "/hotspot/libjvm%s.so", p);
         } else {
           // Go back to path of .so
-          if (realpath(dli_fname, buf) == NULL)
+          rp = realpath(dli_fname, buf);
+          if (rp == NULL)
             return;
         }
       }
@@ -2508,9 +2529,9 @@
 unsigned long* os::Linux::_numa_all_nodes;
 
 bool os::uncommit_memory(char* addr, size_t size) {
-  return ::mmap(addr, size, PROT_NONE,
-                MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0)
-    != MAP_FAILED;
+  uintptr_t res = (uintptr_t) ::mmap(addr, size, PROT_NONE,
+                MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0);
+  return res  != (uintptr_t) MAP_FAILED;
 }
 
 // Linux uses a growable mapping for the stack, and if the mapping for
@@ -2718,7 +2739,8 @@
     // the processor.
 
 #ifndef ZERO
-    _large_page_size = IA32_ONLY(4 * M) AMD64_ONLY(2 * M) IA64_ONLY(256 * M) SPARC_ONLY(4 * M);
+    _large_page_size = IA32_ONLY(4 * M) AMD64_ONLY(2 * M) IA64_ONLY(256 * M) SPARC_ONLY(4 * M)
+                       ARM_ONLY(2 * M) PPC_ONLY(4 * M);
 #endif // ZERO
 
     FILE *fp = fopen("/proc/meminfo", "r");
@@ -3981,6 +4003,9 @@
   return JNI_OK;
 }
 
+// this is called at the end of vm_initialization
+void os::init_3(void) { }
+
 // Mark the polling page as unreadable
 void os::make_polling_page_unreadable(void) {
   if( !guard_memory((char*)_polling_page, Linux::page_size()) )
@@ -4061,7 +4086,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 // debug support
 
-#ifndef PRODUCT
 static address same_page(address x, address y) {
   int page_bits = -os::vm_page_size();
   if ((intptr_t(x) & page_bits) == (intptr_t(y) & page_bits))
@@ -4072,26 +4096,26 @@
     return (address)(intptr_t(y) & page_bits);
 }
 
-bool os::find(address addr) {
+bool os::find(address addr, outputStream* st) {
   Dl_info dlinfo;
   memset(&dlinfo, 0, sizeof(dlinfo));
   if (dladdr(addr, &dlinfo)) {
-    tty->print(PTR_FORMAT ": ", addr);
+    st->print(PTR_FORMAT ": ", addr);
     if (dlinfo.dli_sname != NULL) {
-      tty->print("%s+%#x", dlinfo.dli_sname,
+      st->print("%s+%#x", dlinfo.dli_sname,
                  addr - (intptr_t)dlinfo.dli_saddr);
     } else if (dlinfo.dli_fname) {
-      tty->print("<offset %#x>", addr - (intptr_t)dlinfo.dli_fbase);
+      st->print("<offset %#x>", addr - (intptr_t)dlinfo.dli_fbase);
     } else {
-      tty->print("<absolute address>");
+      st->print("<absolute address>");
     }
     if (dlinfo.dli_fname) {
-      tty->print(" in %s", dlinfo.dli_fname);
+      st->print(" in %s", dlinfo.dli_fname);
     }
     if (dlinfo.dli_fbase) {
-      tty->print(" at " PTR_FORMAT, dlinfo.dli_fbase);
+      st->print(" at " PTR_FORMAT, dlinfo.dli_fbase);
     }
-    tty->cr();
+    st->cr();
 
     if (Verbose) {
       // decode some bytes around the PC
@@ -4104,15 +4128,13 @@
       if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr
           && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin)
         end = (address) dlinfo2.dli_saddr;
-      Disassembler::decode(begin, end);
+      Disassembler::decode(begin, end, st);
     }
     return true;
   }
   return false;
 }
 
-#endif
-
 ////////////////////////////////////////////////////////////////////////////////
 // misc
 
@@ -4321,6 +4343,7 @@
   int count;
   long sys_time, user_time;
   char string[64];
+  char cdummy;
   int idummy;
   long ldummy;
   FILE *fp;
@@ -4381,11 +4404,11 @@
   // Skip blank chars
   do s++; while (isspace(*s));
 
-  count = sscanf(s,"%*c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu",
-                 &idummy, &idummy, &idummy, &idummy, &idummy,
+  count = sscanf(s,"%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu",
+                 &cdummy, &idummy, &idummy, &idummy, &idummy, &idummy,
                  &ldummy, &ldummy, &ldummy, &ldummy, &ldummy,
                  &user_time, &sys_time);
-  if ( count != 12 ) return -1;
+  if ( count != 13 ) return -1;
   if (user_sys_cpu_time) {
     return ((jlong)sys_time + (jlong)user_time) * (1000000000 / clock_tics_per_sec);
   } else {
@@ -4980,3 +5003,43 @@
     }
   }
 }
+
+// is_headless_jre()
+//
+// Test for the existence of libmawt in motif21 or xawt directories
+// in order to report if we are running in a headless jre
+//
+bool os::is_headless_jre() {
+    struct stat statbuf;
+    char buf[MAXPATHLEN];
+    char libmawtpath[MAXPATHLEN];
+    const char *xawtstr  = "/xawt/libmawt.so";
+    const char *motifstr = "/motif21/libmawt.so";
+    char *p;
+
+    // Get path to libjvm.so
+    os::jvm_path(buf, sizeof(buf));
+
+    // Get rid of libjvm.so
+    p = strrchr(buf, '/');
+    if (p == NULL) return false;
+    else *p = '\0';
+
+    // Get rid of client or server
+    p = strrchr(buf, '/');
+    if (p == NULL) return false;
+    else *p = '\0';
+
+    // check xawt/libmawt.so
+    strcpy(libmawtpath, buf);
+    strcat(libmawtpath, xawtstr);
+    if (::stat(libmawtpath, &statbuf) == 0) return false;
+
+    // check motif21/libmawt.so
+    strcpy(libmawtpath, buf);
+    strcat(libmawtpath, motifstr);
+    if (::stat(libmawtpath, &statbuf) == 0) return false;
+
+    return true;
+}
+
--- a/hotspot/src/os/solaris/vm/attachListener_solaris.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/os/solaris/vm/attachListener_solaris.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -364,6 +364,7 @@
 // Create the door
 int SolarisAttachListener::create_door() {
   char door_path[PATH_MAX+1];
+  char initial_path[PATH_MAX+1];
   int fd, res;
 
   // register exit function
@@ -375,36 +376,46 @@
     return -1;
   }
 
+  // create initial file to attach door descriptor
   snprintf(door_path, sizeof(door_path), "%s/.java_pid%d",
            os::get_temp_directory(), os::current_process_id());
-  RESTARTABLE(::creat(door_path, S_IRUSR | S_IWUSR), fd);
-
+  snprintf(initial_path, sizeof(initial_path), "%s.tmp", door_path);
+  RESTARTABLE(::creat(initial_path, S_IRUSR | S_IWUSR), fd);
   if (fd == -1) {
-    debug_only(warning("attempt to create %s failed", door_path));
+    debug_only(warning("attempt to create %s failed", initial_path));
+    ::door_revoke(dd);
     return -1;
   }
   assert(fd >= 0, "bad file descriptor");
-  set_door_path(door_path);
   RESTARTABLE(::close(fd), res);
 
   // attach the door descriptor to the file
-  if ((res = ::fattach(dd, door_path)) == -1) {
+  if ((res = ::fattach(dd, initial_path)) == -1) {
     // if busy then detach and try again
     if (errno == EBUSY) {
-      ::fdetach(door_path);
-      res = ::fattach(dd, door_path);
+      ::fdetach(initial_path);
+      res = ::fattach(dd, initial_path);
     }
     if (res == -1) {
       ::door_revoke(dd);
       dd = -1;
     }
   }
+
+  // rename file so that clients can attach
+  if (dd >= 0) {
+    if (::rename(initial_path, door_path) == -1) {
+        RESTARTABLE(::close(dd), res);
+        ::fdetach(initial_path);
+        dd = -1;
+    }
+  }
   if (dd >= 0) {
     set_door_descriptor(dd);
+    set_door_path(door_path);
   } else {
-    // unable to create door or attach it to the file
-    ::unlink(door_path);
-    set_door_path(NULL);
+    // unable to create door, attach it to file, or rename file into place
+    ::unlink(initial_path);
     return -1;
   }
 
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1839,8 +1839,8 @@
 
   // Quietly truncate on buffer overflow.  Should be an error.
   if (pnamelen + strlen(fname) + 10 > (size_t) buflen) {
-      *buffer = '\0';
-      return;
+    *buffer = '\0';
+    return;
   }
 
   if (pnamelen == 0) {
@@ -2051,7 +2051,8 @@
     {EM_SPARC32PLUS, EM_SPARC,   ELFCLASS32, ELFDATA2MSB, (char*)"Sparc 32"},
     {EM_SPARCV9,     EM_SPARCV9, ELFCLASS64, ELFDATA2MSB, (char*)"Sparc v9 64"},
     {EM_PPC,         EM_PPC,     ELFCLASS32, ELFDATA2MSB, (char*)"Power PC 32"},
-    {EM_PPC64,       EM_PPC64,   ELFCLASS64, ELFDATA2MSB, (char*)"Power PC 64"}
+    {EM_PPC64,       EM_PPC64,   ELFCLASS64, ELFDATA2MSB, (char*)"Power PC 64"},
+    {EM_ARM,         EM_ARM,     ELFCLASS32, ELFDATA2LSB, (char*)"ARM 32"}
   };
 
   #if  (defined IA32)
@@ -2068,9 +2069,11 @@
     static  Elf32_Half running_arch_code=EM_PPC64;
   #elif  (defined __powerpc__)
     static  Elf32_Half running_arch_code=EM_PPC;
+  #elif (defined ARM)
+    static  Elf32_Half running_arch_code=EM_ARM;
   #else
     #error Method os::dll_load requires that one of following is defined:\
-         IA32, AMD64, IA64, __sparc, __powerpc__
+         IA32, AMD64, IA64, __sparc, __powerpc__, ARM, ARM
   #endif
 
   // Identify compatability class for VM's architecture and library's architecture
@@ -3149,7 +3152,8 @@
   // ISM is only recommended on old Solaris where there is no MPSS support.
   // Simply choose a conservative value as default.
   *page_size = LargePageSizeInBytes ? LargePageSizeInBytes :
-               SPARC_ONLY(4 * M) IA32_ONLY(4 * M) AMD64_ONLY(2 * M);
+               SPARC_ONLY(4 * M) IA32_ONLY(4 * M) AMD64_ONLY(2 * M)
+               ARM_ONLY(2 * M);
 
   // ISM is available on all supported Solaris versions
   return true;
@@ -5007,6 +5011,9 @@
   return JNI_OK;
 }
 
+void os::init_3(void) {
+  return;
+}
 
 // Mark the polling page as unreadable
 void os::make_polling_page_unreadable(void) {
@@ -5412,7 +5419,6 @@
 }
 
 //---------------------------------------------------------------------------------
-#ifndef PRODUCT
 
 static address same_page(address x, address y) {
   intptr_t page_bits = -os::vm_page_size();
@@ -5424,28 +5430,28 @@
     return (address)(intptr_t(y) & page_bits);
 }
 
-bool os::find(address addr) {
+bool os::find(address addr, outputStream* st) {
   Dl_info dlinfo;
   memset(&dlinfo, 0, sizeof(dlinfo));
   if (dladdr(addr, &dlinfo)) {
 #ifdef _LP64
-    tty->print("0x%016lx: ", addr);
+    st->print("0x%016lx: ", addr);
 #else
-    tty->print("0x%08x: ", addr);
+    st->print("0x%08x: ", addr);
 #endif
     if (dlinfo.dli_sname != NULL)
-      tty->print("%s+%#lx", dlinfo.dli_sname, addr-(intptr_t)dlinfo.dli_saddr);
+      st->print("%s+%#lx", dlinfo.dli_sname, addr-(intptr_t)dlinfo.dli_saddr);
     else if (dlinfo.dli_fname)
-      tty->print("<offset %#lx>", addr-(intptr_t)dlinfo.dli_fbase);
+      st->print("<offset %#lx>", addr-(intptr_t)dlinfo.dli_fbase);
     else
-      tty->print("<absolute address>");
-    if (dlinfo.dli_fname)  tty->print(" in %s", dlinfo.dli_fname);
+      st->print("<absolute address>");
+    if (dlinfo.dli_fname)  st->print(" in %s", dlinfo.dli_fname);
 #ifdef _LP64
-    if (dlinfo.dli_fbase)  tty->print(" at 0x%016lx", dlinfo.dli_fbase);
+    if (dlinfo.dli_fbase)  st->print(" at 0x%016lx", dlinfo.dli_fbase);
 #else
-    if (dlinfo.dli_fbase)  tty->print(" at 0x%08x", dlinfo.dli_fbase);
+    if (dlinfo.dli_fbase)  st->print(" at 0x%08x", dlinfo.dli_fbase);
 #endif
-    tty->cr();
+    st->cr();
 
     if (Verbose) {
       // decode some bytes around the PC
@@ -5458,16 +5464,13 @@
       if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr
           && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin)
         end = (address) dlinfo2.dli_saddr;
-      Disassembler::decode(begin, end);
+      Disassembler::decode(begin, end, st);
     }
     return true;
   }
   return false;
 }
 
-#endif
-
-
 // Following function has been added to support HotSparc's libjvm.so running
 // under Solaris production JDK 1.2.2 / 1.3.0.  These came from
 // src/solaris/hpi/native_threads in the EVM codebase.
@@ -5910,7 +5913,6 @@
   if (jt->handle_special_suspend_equivalent_condition()) {
     jt->java_suspend_self();
   }
-
   OrderAccess::fence();
 }
 
@@ -5997,3 +5999,44 @@
     }
   }
 }
+
+// is_headless_jre()
+//
+// Test for the existence of libmawt in motif21 or xawt directories
+// in order to report if we are running in a headless jre
+//
+bool os::is_headless_jre() {
+    struct stat statbuf;
+    char buf[MAXPATHLEN];
+    char libmawtpath[MAXPATHLEN];
+    const char *xawtstr  = "/xawt/libmawt.so";
+    const char *motifstr = "/motif21/libmawt.so";
+    char *p;
+
+    // Get path to libjvm.so
+    os::jvm_path(buf, sizeof(buf));
+
+    // Get rid of libjvm.so
+    p = strrchr(buf, '/');
+    if (p == NULL) return false;
+    else *p = '\0';
+
+    // Get rid of client or server
+    p = strrchr(buf, '/');
+    if (p == NULL) return false;
+    else *p = '\0';
+
+    // check xawt/libmawt.so
+    strcpy(libmawtpath, buf);
+    strcat(libmawtpath, xawtstr);
+    if (::stat(libmawtpath, &statbuf) == 0) return false;
+
+    // check motif21/libmawt.so
+    strcpy(libmawtpath, buf);
+    strcat(libmawtpath, motifstr);
+    if (::stat(libmawtpath, &statbuf) == 0) return false;
+
+    return true;
+}
+
+
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -3444,6 +3444,9 @@
   return JNI_OK;
 }
 
+void os::init_3(void) {
+  return;
+}
 
 // Mark the polling page as unreadable
 void os::make_polling_page_unreadable(void) {
@@ -4105,12 +4108,10 @@
 }
 
 
-#ifndef PRODUCT
-bool os::find(address addr) {
+bool os::find(address addr, outputStream* st) {
   // Nothing yet
   return false;
 }
-#endif
 
 LONG WINAPI os::win32::serialize_fault_filter(struct _EXCEPTION_POINTERS* e) {
   DWORD exception_code = e->ExceptionRecord->ExceptionCode;
@@ -4164,3 +4165,8 @@
     }
     return 0;
 }
+
+
+// We don't build a headless jre for Windows
+bool os::is_headless_jre() { return false; }
+
--- a/hotspot/src/os_cpu/linux_sparc/vm/thread_linux_sparc.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/os_cpu/linux_sparc/vm/thread_linux_sparc.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -105,3 +105,6 @@
   // nothing else to try
   return false;
 }
+
+void JavaThread::cache_global_variables() { }
+
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -718,6 +718,11 @@
 
   ucontext_t *uc = (ucontext_t*)context;
   st->print_cr("Registers:");
+
+  // this is horrendously verbose but the layout of the registers in the
+  // context does not match how we defined our abstract Register set, so
+  // we can't just iterate through the gregs area
+
 #ifdef AMD64
   st->print(  "RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]);
   st->print(", RBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBX]);
@@ -745,6 +750,63 @@
   st->print(", ERR=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ERR]);
   st->cr();
   st->print("  TRAPNO=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_TRAPNO]);
+
+  st->cr();
+  st->cr();
+
+  st->print_cr("Register to memory mapping:");
+  st->cr();
+
+  // this is only for the "general purpose" registers
+
+  st->print_cr("RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]);
+  print_location(st, uc->uc_mcontext.gregs[REG_RAX]);
+  st->cr();
+  st->print_cr("RBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBX]);
+  print_location(st, uc->uc_mcontext.gregs[REG_RBX]);
+  st->cr();
+  st->print_cr("RCX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RCX]);
+  print_location(st, uc->uc_mcontext.gregs[REG_RCX]);
+  st->cr();
+  st->print_cr("RDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDX]);
+  print_location(st, uc->uc_mcontext.gregs[REG_RDX]);
+  st->cr();
+  st->print_cr("RSP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSP]);
+  print_location(st, uc->uc_mcontext.gregs[REG_RSP]);
+  st->cr();
+  st->print_cr("RBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBP]);
+  print_location(st, uc->uc_mcontext.gregs[REG_RBP]);
+  st->cr();
+  st->print_cr("RSI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSI]);
+  print_location(st, uc->uc_mcontext.gregs[REG_RSI]);
+  st->cr();
+  st->print_cr("RDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDI]);
+  print_location(st, uc->uc_mcontext.gregs[REG_RDI]);
+  st->cr();
+  st->print_cr("R8 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R8]);
+  print_location(st, uc->uc_mcontext.gregs[REG_R8]);
+  st->cr();
+  st->print_cr("R9 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R9]);
+  print_location(st, uc->uc_mcontext.gregs[REG_R9]);
+  st->cr();
+  st->print_cr("R10=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R10]);
+  print_location(st, uc->uc_mcontext.gregs[REG_R10]);
+  st->cr();
+  st->print_cr("R11=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R11]);
+  print_location(st, uc->uc_mcontext.gregs[REG_R11]);
+  st->cr();
+  st->print_cr("R12=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R12]);
+  print_location(st, uc->uc_mcontext.gregs[REG_R12]);
+  st->cr();
+  st->print_cr("R13=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R13]);
+  print_location(st, uc->uc_mcontext.gregs[REG_R13]);
+  st->cr();
+  st->print_cr("R14=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R14]);
+  print_location(st, uc->uc_mcontext.gregs[REG_R14]);
+  st->cr();
+  st->print_cr("R15=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R15]);
+  print_location(st, uc->uc_mcontext.gregs[REG_R15]);
+
 #else
   st->print(  "EAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EAX]);
   st->print(", EBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBX]);
@@ -759,6 +821,39 @@
   st->print(  "EIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EIP]);
   st->print(", CR2=" INTPTR_FORMAT, uc->uc_mcontext.cr2);
   st->print(", EFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EFL]);
+
+  st->cr();
+  st->cr();
+
+  st->print_cr("Register to memory mapping:");
+  st->cr();
+
+  // this is only for the "general purpose" registers
+
+  st->print_cr("EAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EAX]);
+  print_location(st, uc->uc_mcontext.gregs[REG_EAX]);
+  st->cr();
+  st->print_cr("EBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBX]);
+  print_location(st, uc->uc_mcontext.gregs[REG_EBX]);
+  st->cr();
+  st->print_cr("ECX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ECX]);
+  print_location(st, uc->uc_mcontext.gregs[REG_ECX]);
+  st->cr();
+  st->print_cr("EDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EDX]);
+  print_location(st, uc->uc_mcontext.gregs[REG_EDX]);
+  st->cr();
+  st->print_cr("ESP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ESP]);
+  print_location(st, uc->uc_mcontext.gregs[REG_ESP]);
+  st->cr();
+  st->print_cr("EBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBP]);
+  print_location(st, uc->uc_mcontext.gregs[REG_EBP]);
+  st->cr();
+  st->print_cr("ESI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ESI]);
+  print_location(st, uc->uc_mcontext.gregs[REG_ESI]);
+  st->cr();
+  st->print_cr("EDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EDI]);
+  print_location(st, uc->uc_mcontext.gregs[REG_EDI]);
+
 #endif // AMD64
   st->cr();
   st->cr();
--- a/hotspot/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -79,3 +79,6 @@
   // nothing else to try
   return false;
 }
+
+void JavaThread::cache_global_variables() { }
+
--- a/hotspot/src/os_cpu/linux_zero/vm/thread_linux_zero.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/os_cpu/linux_zero/vm/thread_linux_zero.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -24,3 +24,5 @@
  */
 
 // This file is intentionally empty
+
+void JavaThread::cache_global_variables() { }
--- a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -587,6 +587,61 @@
   st->print_cr(" PC=" INTPTR_FORMAT " nPC=" INTPTR_FORMAT,
             uc->uc_mcontext.gregs[REG_PC],
             uc->uc_mcontext.gregs[REG_nPC]);
+
+  st->cr();
+  st->cr();
+
+  st->print_cr("Register to memory mapping:");
+  st->cr();
+
+  // this is only for the "general purpose" registers
+
+  st->print_cr("O0=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O0]);
+  print_location(st, uc->uc_mcontext.gregs[REG_O0]);
+  st->cr();
+  st->print_cr("O1=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O1]);
+  print_location(st, uc->uc_mcontext.gregs[REG_O1]);
+  st->cr();
+  st->print_cr("O2=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O2]);
+  print_location(st, uc->uc_mcontext.gregs[REG_O2]);
+  st->cr();
+  st->print_cr("O3=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O3]);
+  print_location(st, uc->uc_mcontext.gregs[REG_O3]);
+  st->cr();
+  st->print_cr("O4=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O4]);
+  print_location(st, uc->uc_mcontext.gregs[REG_O4]);
+  st->cr();
+  st->print_cr("O5=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O5]);
+  print_location(st, uc->uc_mcontext.gregs[REG_O5]);
+  st->cr();
+  st->print_cr("O6=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O6]);
+  print_location(st, uc->uc_mcontext.gregs[REG_O6]);
+  st->cr();
+  st->print_cr("O7=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O7]);
+  print_location(st, uc->uc_mcontext.gregs[REG_O7]);
+  st->cr();
+
+  st->print_cr("G1=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G1]);
+  print_location(st, uc->uc_mcontext.gregs[REG_G1]);
+  st->cr();
+  st->print_cr("G2=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G2]);
+  print_location(st, uc->uc_mcontext.gregs[REG_G2]);
+  st->cr();
+  st->print_cr("G3=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G3]);
+  print_location(st, uc->uc_mcontext.gregs[REG_G3]);
+  st->cr();
+  st->print_cr("G4=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G4]);
+  print_location(st, uc->uc_mcontext.gregs[REG_G4]);
+  st->cr();
+  st->print_cr("G5=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G5]);
+  print_location(st, uc->uc_mcontext.gregs[REG_G5]);
+  st->cr();
+  st->print_cr("G6=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G6]);
+  print_location(st, uc->uc_mcontext.gregs[REG_G6]);
+  st->cr();
+  st->print_cr("G7=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G7]);
+  print_location(st, uc->uc_mcontext.gregs[REG_G7]);
+
   st->cr();
   st->cr();
 
--- a/hotspot/src/os_cpu/solaris_sparc/vm/thread_solaris_sparc.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/thread_solaris_sparc.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -140,3 +140,6 @@
   *fr_addr = ret_frame;
   return true;
 }
+
+void JavaThread::cache_global_variables() { }
+
--- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -719,6 +719,11 @@
 
   ucontext_t *uc = (ucontext_t*)context;
   st->print_cr("Registers:");
+
+  // this is horrendously verbose but the layout of the registers in the
+  // context does not match how we defined our abstract Register set, so
+  // we can't just iterate through the gregs area
+
 #ifdef AMD64
   st->print(  "RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]);
   st->print(", RBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBX]);
@@ -742,6 +747,63 @@
   st->cr();
   st->print(  "RIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RIP]);
   st->print(", RFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RFL]);
+
+  st->cr();
+  st->cr();
+
+  st->print_cr("Register to memory mapping:");
+  st->cr();
+
+  // this is only for the "general purpose" registers
+
+  st->print_cr("RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]);
+  print_location(st, uc->uc_mcontext.gregs[REG_RAX]);
+  st->cr();
+  st->print_cr("RBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBX]);
+  print_location(st, uc->uc_mcontext.gregs[REG_RBX]);
+  st->cr();
+  st->print_cr("RCX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RCX]);
+  print_location(st, uc->uc_mcontext.gregs[REG_RCX]);
+  st->cr();
+  st->print_cr("RDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDX]);
+  print_location(st, uc->uc_mcontext.gregs[REG_RDX]);
+  st->cr();
+  st->print_cr("RSP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSP]);
+  print_location(st, uc->uc_mcontext.gregs[REG_RSP]);
+  st->cr();
+  st->print_cr("RBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBP]);
+  print_location(st, uc->uc_mcontext.gregs[REG_RSP]);
+  st->cr();
+  st->print_cr("RSI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSI]);
+  print_location(st, uc->uc_mcontext.gregs[REG_RSI]);
+  st->cr();
+  st->print_cr("RDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDI]);
+  print_location(st, uc->uc_mcontext.gregs[REG_RDI]);
+  st->cr();
+  st->print_cr("R8 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R8]);
+  print_location(st, uc->uc_mcontext.gregs[REG_R8]);
+  st->cr();
+  st->print_cr("R9 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R9]);
+  print_location(st, uc->uc_mcontext.gregs[REG_R9]);
+  st->cr();
+  st->print_cr("R10=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R10]);
+  print_location(st, uc->uc_mcontext.gregs[REG_R10]);
+  st->cr();
+  st->print_cr("R11=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R11]);
+  print_location(st, uc->uc_mcontext.gregs[REG_R11]);
+  st->cr();
+  st->print_cr("R12=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R12]);
+  print_location(st, uc->uc_mcontext.gregs[REG_R12]);
+  st->cr();
+  st->print_cr("R13=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R13]);
+  print_location(st, uc->uc_mcontext.gregs[REG_R13]);
+  st->cr();
+  st->print_cr("R14=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R14]);
+  print_location(st, uc->uc_mcontext.gregs[REG_R14]);
+  st->cr();
+  st->print_cr("R15=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R15]);
+  print_location(st, uc->uc_mcontext.gregs[REG_R15]);
+
 #else
   st->print(  "EAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EAX]);
   st->print(", EBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EBX]);
@@ -755,6 +817,39 @@
   st->cr();
   st->print(  "EIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EIP]);
   st->print(", EFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EFL]);
+
+  st->cr();
+  st->cr();
+
+  st->print_cr("Register to memory mapping:");
+  st->cr();
+
+  // this is only for the "general purpose" registers
+
+  st->print_cr("EAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EAX]);
+  print_location(st, uc->uc_mcontext.gregs[EAX]);
+  st->cr();
+  st->print_cr("EBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EBX]);
+  print_location(st, uc->uc_mcontext.gregs[EBX]);
+  st->cr();
+  st->print_cr("ECX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[ECX]);
+  print_location(st, uc->uc_mcontext.gregs[ECX]);
+  st->cr();
+  st->print_cr("EDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EDX]);
+  print_location(st, uc->uc_mcontext.gregs[EDX]);
+  st->cr();
+  st->print_cr("ESP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[UESP]);
+  print_location(st, uc->uc_mcontext.gregs[UESP]);
+  st->cr();
+  st->print_cr("EBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EBP]);
+  print_location(st, uc->uc_mcontext.gregs[EBP]);
+  st->cr();
+  st->print_cr("ESI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[ESI]);
+  print_location(st, uc->uc_mcontext.gregs[ESI]);
+  st->cr();
+  st->print_cr("EDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EDI]);
+  print_location(st, uc->uc_mcontext.gregs[EDI]);
+
 #endif // AMD64
   st->cr();
   st->cr();
@@ -773,6 +868,7 @@
   print_hex_dump(st, pc - 16, pc + 16, sizeof(char));
 }
 
+
 #ifdef AMD64
 void os::Solaris::init_thread_fpu_state(void) {
   // Nothing to do
--- a/hotspot/src/os_cpu/solaris_x86/vm/thread_solaris_x86.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/os_cpu/solaris_x86/vm/thread_solaris_x86.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -82,3 +82,6 @@
   return true;
 
 }
+
+void JavaThread::cache_global_variables() { }
+
--- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -377,18 +377,84 @@
 
   st->print_cr("Registers:");
 #ifdef AMD64
-  st->print(  "EAX=" INTPTR_FORMAT, uc->Rax);
-  st->print(", EBX=" INTPTR_FORMAT, uc->Rbx);
-  st->print(", ECX=" INTPTR_FORMAT, uc->Rcx);
-  st->print(", EDX=" INTPTR_FORMAT, uc->Rdx);
+  st->print(  "RAX=" INTPTR_FORMAT, uc->Rax);
+  st->print(", RBX=" INTPTR_FORMAT, uc->Rbx);
+  st->print(", RCX=" INTPTR_FORMAT, uc->Rcx);
+  st->print(", RDX=" INTPTR_FORMAT, uc->Rdx);
+  st->cr();
+  st->print(  "RSP=" INTPTR_FORMAT, uc->Rsp);
+  st->print(", RBP=" INTPTR_FORMAT, uc->Rbp);
+  st->print(", RSI=" INTPTR_FORMAT, uc->Rsi);
+  st->print(", RDI=" INTPTR_FORMAT, uc->Rdi);
+  st->cr();
+  st->print(  "R8=" INTPTR_FORMAT,  uc->R8);
+  st->print(", R9=" INTPTR_FORMAT,  uc->R9);
+  st->print(", R10=" INTPTR_FORMAT, uc->R10);
+  st->print(", R11=" INTPTR_FORMAT, uc->R11);
+  st->cr();
+  st->print(  "R12=" INTPTR_FORMAT, uc->R12);
+  st->print(", R13=" INTPTR_FORMAT, uc->R13);
+  st->print(", R14=" INTPTR_FORMAT, uc->R14);
+  st->print(", R15=" INTPTR_FORMAT, uc->R15);
+  st->cr();
+  st->print(  "RIP=" INTPTR_FORMAT, uc->Rip);
+  st->print(", EFLAGS=" INTPTR_FORMAT, uc->EFlags);
+
+  st->cr();
+  st->cr();
+
+  st->print_cr("Register to memory mapping:");
+  st->cr();
+
+  // this is only for the "general purpose" registers
+
+  st->print_cr("RAX=" INTPTR_FORMAT, uc->Rax);
+  print_location(st, uc->Rax);
+  st->cr();
+  st->print_cr("RBX=" INTPTR_FORMAT, uc->Rbx);
+  print_location(st, uc->Rbx);
   st->cr();
-  st->print(  "ESP=" INTPTR_FORMAT, uc->Rsp);
-  st->print(", EBP=" INTPTR_FORMAT, uc->Rbp);
-  st->print(", ESI=" INTPTR_FORMAT, uc->Rsi);
-  st->print(", EDI=" INTPTR_FORMAT, uc->Rdi);
+  st->print_cr("RCX=" INTPTR_FORMAT, uc->Rcx);
+  print_location(st, uc->Rcx);
+  st->cr();
+  st->print_cr("RDX=" INTPTR_FORMAT, uc->Rdx);
+  print_location(st, uc->Rdx);
+  st->cr();
+  st->print_cr("RSP=" INTPTR_FORMAT, uc->Rsp);
+  print_location(st, uc->Rsp);
+  st->cr();
+  st->print_cr("RBP=" INTPTR_FORMAT, uc->Rbp);
+  print_location(st, uc->Rbp);
+  st->cr();
+  st->print_cr("RSI=" INTPTR_FORMAT, uc->Rsi);
+  print_location(st, uc->Rsi);
+  st->cr();
+  st->print_cr("RDI=" INTPTR_FORMAT, uc->Rdi);
+  print_location(st, uc->Rdi);
+  st->cr();
+  st->print_cr("R8 =" INTPTR_FORMAT, uc->R8);
+  print_location(st, uc->R8);
   st->cr();
-  st->print(  "EIP=" INTPTR_FORMAT, uc->Rip);
-  st->print(", EFLAGS=" INTPTR_FORMAT, uc->EFlags);
+  st->print_cr("R9 =" INTPTR_FORMAT, uc->R9);
+  print_location(st, uc->R9);
+  st->cr();
+  st->print_cr("R10=" INTPTR_FORMAT, uc->R10);
+  print_location(st, uc->R10);
+  st->cr();
+  st->print_cr("R11=" INTPTR_FORMAT, uc->R11);
+  print_location(st, uc->R11);
+  st->cr();
+  st->print_cr("R12=" INTPTR_FORMAT, uc->R12);
+  print_location(st, uc->R12);
+  st->cr();
+  st->print_cr("R13=" INTPTR_FORMAT, uc->R13);
+  print_location(st, uc->R13);
+  st->cr();
+  st->print_cr("R14=" INTPTR_FORMAT, uc->R14);
+  print_location(st, uc->R14);
+  st->cr();
+  st->print_cr("R15=" INTPTR_FORMAT, uc->R15);
+  print_location(st, uc->R15);
 #else
   st->print(  "EAX=" INTPTR_FORMAT, uc->Eax);
   st->print(", EBX=" INTPTR_FORMAT, uc->Ebx);
@@ -402,6 +468,38 @@
   st->cr();
   st->print(  "EIP=" INTPTR_FORMAT, uc->Eip);
   st->print(", EFLAGS=" INTPTR_FORMAT, uc->EFlags);
+
+  st->cr();
+  st->cr();
+
+  st->print_cr("Register to memory mapping:");
+  st->cr();
+
+  // this is only for the "general purpose" registers
+
+  st->print_cr("EAX=" INTPTR_FORMAT, uc->Eax);
+  print_location(st, uc->Eax);
+  st->cr();
+  st->print_cr("EBX=" INTPTR_FORMAT, uc->Ebx);
+  print_location(st, uc->Ebx);
+  st->cr();
+  st->print_cr("ECX=" INTPTR_FORMAT, uc->Ecx);
+  print_location(st, uc->Ecx);
+  st->cr();
+  st->print_cr("EDX=" INTPTR_FORMAT, uc->Edx);
+  print_location(st, uc->Edx);
+  st->cr();
+  st->print_cr("ESP=" INTPTR_FORMAT, uc->Esp);
+  print_location(st, uc->Esp);
+  st->cr();
+  st->print_cr("EBP=" INTPTR_FORMAT, uc->Ebp);
+  print_location(st, uc->Ebp);
+  st->cr();
+  st->print_cr("ESI=" INTPTR_FORMAT, uc->Esi);
+  print_location(st, uc->Esi);
+  st->cr();
+  st->print_cr("EDI=" INTPTR_FORMAT, uc->Edi);
+  print_location(st, uc->Edi);
 #endif // AMD64
   st->cr();
   st->cr();
--- a/hotspot/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -84,3 +84,6 @@
   // nothing else to try
   return false;
 }
+
+void JavaThread::cache_global_variables() { }
+
--- a/hotspot/src/share/vm/asm/codeBuffer.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/asm/codeBuffer.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -128,7 +128,11 @@
   delete _overflow_arena;
 
 #ifdef ASSERT
+  // Save allocation type to execute assert in ~ResourceObj()
+  // which is called after this destructor.
+  ResourceObj::allocation_type at = _default_oop_recorder.get_allocation_type();
   Copy::fill_to_bytes(this, sizeof(*this), badResourceValue);
+  ResourceObj::set_allocation_type((address)(&_default_oop_recorder), at);
 #endif
 }
 
--- a/hotspot/src/share/vm/asm/codeBuffer.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/asm/codeBuffer.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -102,7 +102,7 @@
     _locs_point    = NULL;
     _locs_own      = false;
     _frozen        = false;
-    debug_only(_index = -1);
+    debug_only(_index = (char)-1);
     debug_only(_outer = (CodeBuffer*)badAddress);
   }
 
@@ -278,7 +278,7 @@
   // special case during expansion which is handled internally.  This
   // is done to guarantee proper cleanup of resources.
   void* operator new(size_t size) { return ResourceObj::operator new(size); }
-  void  operator delete(void* p)  {        ResourceObj::operator delete(p); }
+  void  operator delete(void* p)  { ShouldNotCallThis(); }
 
  public:
   typedef int csize_t;  // code size type; would be size_t except for history
--- a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -448,6 +448,10 @@
     _obj(obj), _info(info), _stub(stub) {
   }
 
+  void set_obj(LIR_Opr obj) {
+    _obj = obj;
+  }
+
   virtual void emit_code(LIR_Assembler* e);
   virtual CodeEmitInfo* info() const             { return _info; }
   virtual bool is_exception_throw_stub() const   { return true; }
--- a/hotspot/src/share/vm/c1/c1_Compilation.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_Compilation.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -220,11 +220,13 @@
   code_offsets->set_value(CodeOffsets::Deopt, assembler->emit_deopt_handler());
   CHECK_BAILOUT();
 
-  // Generate code for MethodHandle deopt handler.  We can use the
-  // same code as for the normal deopt handler, we just need a
-  // different entry point address.
-  code_offsets->set_value(CodeOffsets::DeoptMH, assembler->emit_deopt_handler());
-  CHECK_BAILOUT();
+  // Emit the MethodHandle deopt handler code (if required).
+  if (has_method_handle_invokes()) {
+    // We can use the same code as for the normal deopt handler, we
+    // just need a different entry point address.
+    code_offsets->set_value(CodeOffsets::DeoptMH, assembler->emit_deopt_handler());
+    CHECK_BAILOUT();
+  }
 
   // Emit the handler to remove the activation from the stack and
   // dispatch to the caller.
@@ -446,6 +448,7 @@
 , _has_exception_handlers(false)
 , _has_fpu_code(true)   // pessimistic assumption
 , _has_unsafe_access(false)
+, _has_method_handle_invokes(false)
 , _bailout_msg(NULL)
 , _exception_info_list(NULL)
 , _allocator(NULL)
--- a/hotspot/src/share/vm/c1/c1_Compilation.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_Compilation.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -69,6 +69,7 @@
   bool               _has_exception_handlers;
   bool               _has_fpu_code;
   bool               _has_unsafe_access;
+  bool               _has_method_handle_invokes;  // True if this method has MethodHandle invokes.
   const char*        _bailout_msg;
   ExceptionInfoList* _exception_info_list;
   ExceptionHandlerTable _exception_handler_table;
@@ -147,6 +148,10 @@
   // Statistics gathering
   void notice_inlined_method(ciMethod* method);
 
+  // JSR 292
+  bool     has_method_handle_invokes() const { return _has_method_handle_invokes;     }
+  void set_has_method_handle_invokes(bool z) {        _has_method_handle_invokes = z; }
+
   DebugInformationRecorder* debug_info_recorder() const; // = _env->debug_info();
   Dependencies* dependency_recorder() const; // = _env->dependencies()
   ImplicitExceptionTable* implicit_exception_table()     { return &_implicit_exception_table; }
@@ -168,10 +173,19 @@
   const char* bailout_msg() const                { return _bailout_msg; }
 
   static int desired_max_code_buffer_size() {
+#ifndef PPC
     return (int) NMethodSizeLimit;  // default 256K or 512K
+#else
+    // conditional branches on PPC are restricted to 16 bit signed
+    return MAX2((unsigned int)NMethodSizeLimit,32*K);
+#endif
   }
   static int desired_max_constant_size() {
+#ifndef PPC
     return (int) NMethodSizeLimit / 10;  // about 25K
+#else
+    return (MAX2((unsigned int)NMethodSizeLimit, 32*K)) / 10;
+#endif
   }
 
   static void setup_code_buffer(CodeBuffer* cb, int call_stub_estimate);
--- a/hotspot/src/share/vm/c1/c1_FrameMap.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_FrameMap.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -90,7 +90,7 @@
 
   if (outgoing) {
     // update the space reserved for arguments.
-    update_reserved_argument_area_size(out_preserve);
+    update_reserved_argument_area_size(out_preserve * BytesPerWord);
   }
   return new CallingConvention(args, out_preserve);
 }
@@ -138,7 +138,7 @@
   }
   assert(args->length() == signature->length(), "size mismatch");
   out_preserve += SharedRuntime::out_preserve_stack_slots();
-  update_reserved_argument_area_size(out_preserve);
+  update_reserved_argument_area_size(out_preserve * BytesPerWord);
   return new CallingConvention(args, out_preserve);
 }
 
--- a/hotspot/src/share/vm/c1/c1_FrameMap.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_FrameMap.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -154,7 +154,6 @@
   static LIR_Opr method_handle_invoke_SP_save_opr();
 
   static BasicTypeArray*     signature_type_array_for(const ciMethod* method);
-  static BasicTypeArray*     signature_type_array_for(const char * signature);
 
   // for outgoing calls, these also update the reserved area to
   // include space for arguments and any ABI area.
--- a/hotspot/src/share/vm/c1/c1_LIR.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIR.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -50,8 +50,7 @@
 
 #endif // X86
 
-
-#ifdef SPARC
+#if defined(SPARC) || defined(PPC)
 
 FloatRegister LIR_OprDesc::as_float_reg() const {
   return FrameMap::nr2floatreg(fpu_regnr());
@@ -63,6 +62,19 @@
 
 #endif
 
+#ifdef ARM
+
+FloatRegister LIR_OprDesc::as_float_reg() const {
+  return as_FloatRegister(fpu_regnr());
+}
+
+FloatRegister LIR_OprDesc::as_double_reg() const {
+  return as_FloatRegister(fpu_regnrLo());
+}
+
+#endif
+
+
 LIR_Opr LIR_OprFact::illegalOpr = LIR_OprFact::illegal();
 
 LIR_Opr LIR_OprFact::value_type(ValueType* type) {
@@ -119,10 +131,14 @@
 
 #ifndef PRODUCT
 void LIR_Address::verify() const {
-#ifdef SPARC
-  assert(scale() == times_1, "Scaled addressing mode not available on SPARC and should not be used");
+#if defined(SPARC) || defined(PPC)
+  assert(scale() == times_1, "Scaled addressing mode not available on SPARC/PPC and should not be used");
   assert(disp() == 0 || index()->is_illegal(), "can't have both");
 #endif
+#ifdef ARM
+  assert(disp() == 0 || index()->is_illegal(), "can't have both");
+  assert(-4096 < disp() && disp() < 4096, "architecture constraint");
+#endif
 #ifdef _LP64
   assert(base()->is_cpu_register(), "wrong base operand");
   assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand");
@@ -173,13 +189,22 @@
   if (!is_pointer() && !is_illegal()) {
     switch (as_BasicType(type_field())) {
     case T_LONG:
-      assert((kind_field() == cpu_register || kind_field() == stack_value) && size_field() == double_size, "must match");
+      assert((kind_field() == cpu_register || kind_field() == stack_value) &&
+             size_field() == double_size, "must match");
       break;
     case T_FLOAT:
-      assert((kind_field() == fpu_register || kind_field() == stack_value) && size_field() == single_size, "must match");
+      // FP return values can be also in CPU registers on ARM and PPC (softfp ABI)
+      assert((kind_field() == fpu_register || kind_field() == stack_value
+             ARM_ONLY(|| kind_field() == cpu_register)
+             PPC_ONLY(|| kind_field() == cpu_register) ) &&
+             size_field() == single_size, "must match");
       break;
     case T_DOUBLE:
-      assert((kind_field() == fpu_register || kind_field() == stack_value) && size_field() == double_size, "must match");
+      // FP return values can be also in CPU registers on ARM and PPC (softfp ABI)
+      assert((kind_field() == fpu_register || kind_field() == stack_value
+             ARM_ONLY(|| kind_field() == cpu_register)
+             PPC_ONLY(|| kind_field() == cpu_register) ) &&
+             size_field() == double_size, "must match");
       break;
     case T_BOOLEAN:
     case T_CHAR:
@@ -188,7 +213,8 @@
     case T_INT:
     case T_OBJECT:
     case T_ARRAY:
-      assert((kind_field() == cpu_register || kind_field() == stack_value) && size_field() == single_size, "must match");
+      assert((kind_field() == cpu_register || kind_field() == stack_value) &&
+             size_field() == single_size, "must match");
       break;
 
     case T_ILLEGAL:
@@ -503,6 +529,10 @@
       assert(opConvert->_info == NULL, "must be");
       if (opConvert->_opr->is_valid())       do_input(opConvert->_opr);
       if (opConvert->_result->is_valid())    do_output(opConvert->_result);
+#ifdef PPC
+      if (opConvert->_tmp1->is_valid())      do_temp(opConvert->_tmp1);
+      if (opConvert->_tmp2->is_valid())      do_temp(opConvert->_tmp2);
+#endif
       do_stub(opConvert->_stub);
 
       break;
@@ -530,7 +560,9 @@
       LIR_OpAllocObj* opAllocObj = (LIR_OpAllocObj*)op;
 
       if (opAllocObj->_info)                     do_info(opAllocObj->_info);
-      if (opAllocObj->_opr->is_valid())          do_input(opAllocObj->_opr);
+      if (opAllocObj->_opr->is_valid()) {        do_input(opAllocObj->_opr);
+                                                 do_temp(opAllocObj->_opr);
+                                        }
       if (opAllocObj->_tmp1->is_valid())         do_temp(opAllocObj->_tmp1);
       if (opAllocObj->_tmp2->is_valid())         do_temp(opAllocObj->_tmp2);
       if (opAllocObj->_tmp3->is_valid())         do_temp(opAllocObj->_tmp3);
@@ -826,10 +858,16 @@
       assert(op->as_OpCompareAndSwap() != NULL, "must be");
       LIR_OpCompareAndSwap* opCompareAndSwap = (LIR_OpCompareAndSwap*)op;
 
+      assert(opCompareAndSwap->_addr->is_valid(),      "used");
+      assert(opCompareAndSwap->_cmp_value->is_valid(), "used");
+      assert(opCompareAndSwap->_new_value->is_valid(), "used");
       if (opCompareAndSwap->_info)                    do_info(opCompareAndSwap->_info);
-      if (opCompareAndSwap->_addr->is_valid())        do_input(opCompareAndSwap->_addr);
-      if (opCompareAndSwap->_cmp_value->is_valid())   do_input(opCompareAndSwap->_cmp_value);
-      if (opCompareAndSwap->_new_value->is_valid())   do_input(opCompareAndSwap->_new_value);
+                                                      do_input(opCompareAndSwap->_addr);
+                                                      do_temp(opCompareAndSwap->_addr);
+                                                      do_input(opCompareAndSwap->_cmp_value);
+                                                      do_temp(opCompareAndSwap->_cmp_value);
+                                                      do_input(opCompareAndSwap->_new_value);
+                                                      do_temp(opCompareAndSwap->_new_value);
       if (opCompareAndSwap->_tmp1->is_valid())        do_temp(opCompareAndSwap->_tmp1);
       if (opCompareAndSwap->_tmp2->is_valid())        do_temp(opCompareAndSwap->_tmp2);
       if (opCompareAndSwap->_result->is_valid())      do_output(opCompareAndSwap->_result);
@@ -1303,13 +1341,13 @@
                     info));
 }
 
-void LIR_List::unlock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, CodeStub* stub) {
+void LIR_List::unlock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub) {
   append(new LIR_OpLock(
                     lir_unlock,
                     hdr,
                     obj,
                     lock,
-                    LIR_OprFact::illegalOpr,
+                    scratch,
                     stub,
                     NULL));
 }
@@ -1342,22 +1380,19 @@
 }
 
 
-void LIR_List::cas_long(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value, LIR_Opr t1, LIR_Opr t2) {
-  // Compare and swap produces condition code "zero" if contents_of(addr) == cmp_value,
-  // implying successful swap of new_value into addr
-  append(new LIR_OpCompareAndSwap(lir_cas_long, addr, cmp_value, new_value, t1, t2));
+void LIR_List::cas_long(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
+                        LIR_Opr t1, LIR_Opr t2, LIR_Opr result) {
+  append(new LIR_OpCompareAndSwap(lir_cas_long, addr, cmp_value, new_value, t1, t2, result));
 }
 
-void LIR_List::cas_obj(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value, LIR_Opr t1, LIR_Opr t2) {
-  // Compare and swap produces condition code "zero" if contents_of(addr) == cmp_value,
-  // implying successful swap of new_value into addr
-  append(new LIR_OpCompareAndSwap(lir_cas_obj, addr, cmp_value, new_value, t1, t2));
+void LIR_List::cas_obj(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
+                       LIR_Opr t1, LIR_Opr t2, LIR_Opr result) {
+  append(new LIR_OpCompareAndSwap(lir_cas_obj, addr, cmp_value, new_value, t1, t2, result));
 }
 
-void LIR_List::cas_int(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value, LIR_Opr t1, LIR_Opr t2) {
-  // Compare and swap produces condition code "zero" if contents_of(addr) == cmp_value,
-  // implying successful swap of new_value into addr
-  append(new LIR_OpCompareAndSwap(lir_cas_int, addr, cmp_value, new_value, t1, t2));
+void LIR_List::cas_int(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
+                       LIR_Opr t1, LIR_Opr t2, LIR_Opr result) {
+  append(new LIR_OpCompareAndSwap(lir_cas_int, addr, cmp_value, new_value, t1, t2, result));
 }
 
 
@@ -1400,6 +1435,11 @@
     out->print("fpu%d", fpu_regnr());
   } else if (is_double_fpu()) {
     out->print("fpu%d", fpu_regnrLo());
+#elif defined(ARM)
+  } else if (is_single_fpu()) {
+    out->print("s%d", fpu_regnr());
+  } else if (is_double_fpu()) {
+    out->print("d%d", fpu_regnrLo() >> 1);
 #else
   } else if (is_single_fpu()) {
     out->print(as_float_reg()->name());
@@ -1756,6 +1796,12 @@
   print_bytecode(out, bytecode());
   in_opr()->print(out);                  out->print(" ");
   result_opr()->print(out);              out->print(" ");
+#ifdef PPC
+  if(tmp1()->is_valid()) {
+    tmp1()->print(out); out->print(" ");
+    tmp2()->print(out); out->print(" ");
+  }
+#endif
 }
 
 void LIR_OpConvert::print_bytecode(outputStream* out, Bytecodes::Code code) {
--- a/hotspot/src/share/vm/c1/c1_LIR.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIR.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -432,8 +432,7 @@
   // for compatibility with RInfo
   int fpu () const                                  { return lo_reg_half(); }
 #endif // X86
-
-#ifdef SPARC
+#if defined(SPARC) || defined(ARM) || defined(PPC)
   FloatRegister as_float_reg   () const;
   FloatRegister as_double_reg  () const;
 #endif
@@ -519,14 +518,14 @@
      , _type(type)
      , _disp(0) { verify(); }
 
-#ifdef X86
+#if defined(X86) || defined(ARM)
   LIR_Address(LIR_Opr base, LIR_Opr index, Scale scale, intx disp, BasicType type):
        _base(base)
      , _index(index)
      , _scale(scale)
      , _type(type)
      , _disp(disp) { verify(); }
-#endif // X86
+#endif // X86 || ARM
 
   LIR_Opr base()  const                          { return _base;  }
   LIR_Opr index() const                          { return _index; }
@@ -566,7 +565,11 @@
                                                                              LIR_OprDesc::float_type           |
                                                                              LIR_OprDesc::fpu_register         |
                                                                              LIR_OprDesc::single_size); }
-
+#if defined(ARM)
+  static LIR_Opr double_fpu(int reg1, int reg2)    { return (LIR_Opr)((reg1 << LIR_OprDesc::reg1_shift) | (reg2 << LIR_OprDesc::reg2_shift) | LIR_OprDesc::double_type | LIR_OprDesc::fpu_register | LIR_OprDesc::double_size); }
+  static LIR_Opr single_softfp(int reg)            { return (LIR_Opr)((reg  << LIR_OprDesc::reg1_shift) |                                     LIR_OprDesc::float_type  | LIR_OprDesc::cpu_register | LIR_OprDesc::single_size); }
+  static LIR_Opr double_softfp(int reg1, int reg2) { return (LIR_Opr)((reg1 << LIR_OprDesc::reg1_shift) | (reg2 << LIR_OprDesc::reg2_shift) | LIR_OprDesc::double_type | LIR_OprDesc::cpu_register | LIR_OprDesc::double_size); }
+#endif
 #ifdef SPARC
   static LIR_Opr double_fpu(int reg1, int reg2) { return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) |
                                                                              (reg2 << LIR_OprDesc::reg2_shift) |
@@ -593,7 +596,22 @@
                                                                              LIR_OprDesc::double_size          |
                                                                              LIR_OprDesc::is_xmm_mask); }
 #endif // X86
-
+#ifdef PPC
+  static LIR_Opr double_fpu(int reg)            { return (LIR_Opr)(intptr_t)((reg  << LIR_OprDesc::reg1_shift) |
+                                                                             (reg  << LIR_OprDesc::reg2_shift) |
+                                                                             LIR_OprDesc::double_type          |
+                                                                             LIR_OprDesc::fpu_register         |
+                                                                             LIR_OprDesc::double_size); }
+  static LIR_Opr single_softfp(int reg)            { return (LIR_Opr)((reg  << LIR_OprDesc::reg1_shift)        |
+                                                                             LIR_OprDesc::float_type           |
+                                                                             LIR_OprDesc::cpu_register         |
+                                                                             LIR_OprDesc::single_size); }
+  static LIR_Opr double_softfp(int reg1, int reg2) { return (LIR_Opr)((reg2 << LIR_OprDesc::reg1_shift)        |
+                                                                             (reg1 << LIR_OprDesc::reg2_shift) |
+                                                                             LIR_OprDesc::double_type          |
+                                                                             LIR_OprDesc::cpu_register         |
+                                                                             LIR_OprDesc::double_size); }
+#endif // PPC
 
   static LIR_Opr virtual_register(int index, BasicType type) {
     LIR_Opr res;
@@ -623,6 +641,22 @@
                                   LIR_OprDesc::virtual_mask);
         break;
 
+#ifdef __SOFTFP__
+      case T_FLOAT:
+        res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
+                                  LIR_OprDesc::float_type  |
+                                  LIR_OprDesc::cpu_register |
+                                  LIR_OprDesc::single_size |
+                                  LIR_OprDesc::virtual_mask);
+        break;
+      case T_DOUBLE:
+        res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
+                                  LIR_OprDesc::double_type |
+                                  LIR_OprDesc::cpu_register |
+                                  LIR_OprDesc::double_size |
+                                  LIR_OprDesc::virtual_mask);
+        break;
+#else // __SOFTFP__
       case T_FLOAT:
         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
                                   LIR_OprDesc::float_type           |
@@ -638,7 +672,7 @@
                                             LIR_OprDesc::double_size           |
                                             LIR_OprDesc::virtual_mask);
         break;
-
+#endif // __SOFTFP__
       default:       ShouldNotReachHere(); res = illegalOpr;
     }
 
@@ -650,11 +684,18 @@
 
     // old-style calculation; check if old and new method are equal
     LIR_OprDesc::OprType t = as_OprType(type);
+#ifdef __SOFTFP__
+    LIR_Opr old_res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
+                               t |
+                               LIR_OprDesc::cpu_register |
+                               LIR_OprDesc::size_for(type) | LIR_OprDesc::virtual_mask);
+#else // __SOFTFP__
     LIR_Opr old_res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) | t |
                                           ((type == T_FLOAT || type == T_DOUBLE) ?  LIR_OprDesc::fpu_register : LIR_OprDesc::cpu_register) |
                                LIR_OprDesc::size_for(type) | LIR_OprDesc::virtual_mask);
     assert(res == old_res, "old and new method not equal");
-#endif
+#endif // __SOFTFP__
+#endif // ASSERT
 
     return res;
   }
@@ -1306,15 +1347,37 @@
  private:
    Bytecodes::Code _bytecode;
    ConversionStub* _stub;
+#ifdef PPC
+  LIR_Opr _tmp1;
+  LIR_Opr _tmp2;
+#endif
 
  public:
    LIR_OpConvert(Bytecodes::Code code, LIR_Opr opr, LIR_Opr result, ConversionStub* stub)
      : LIR_Op1(lir_convert, opr, result)
      , _stub(stub)
+#ifdef PPC
+     , _tmp1(LIR_OprDesc::illegalOpr())
+     , _tmp2(LIR_OprDesc::illegalOpr())
+#endif
      , _bytecode(code)                           {}
 
+#ifdef PPC
+   LIR_OpConvert(Bytecodes::Code code, LIR_Opr opr, LIR_Opr result, ConversionStub* stub
+                 ,LIR_Opr tmp1, LIR_Opr tmp2)
+     : LIR_Op1(lir_convert, opr, result)
+     , _stub(stub)
+     , _tmp1(tmp1)
+     , _tmp2(tmp2)
+     , _bytecode(code)                           {}
+#endif
+
   Bytecodes::Code bytecode() const               { return _bytecode; }
   ConversionStub* stub() const                   { return _stub; }
+#ifdef PPC
+  LIR_Opr tmp1() const                           { return _tmp1; }
+  LIR_Opr tmp2() const                           { return _tmp2; }
+#endif
 
   virtual void emit_code(LIR_Assembler* masm);
   virtual LIR_OpConvert* as_OpConvert() { return this; }
@@ -1502,6 +1565,9 @@
   LIR_Condition condition() const  {
     assert(code() == lir_cmp || code() == lir_cmove, "only valid for cmp and cmove"); return _condition;
   }
+  void set_condition(LIR_Condition condition) {
+    assert(code() == lir_cmp || code() == lir_cmove, "only valid for cmp and cmove");  _condition = condition;
+  }
 
   void set_fpu_stack_size(int size)              { _fpu_stack_size = size; }
   int  fpu_stack_size() const                    { return _fpu_stack_size; }
@@ -1650,8 +1716,9 @@
   LIR_Opr _tmp2;
 
  public:
-  LIR_OpCompareAndSwap(LIR_Code code, LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value, LIR_Opr t1, LIR_Opr t2)
-    : LIR_Op(code, LIR_OprFact::illegalOpr, NULL)  // no result, no info
+  LIR_OpCompareAndSwap(LIR_Code code, LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
+                       LIR_Opr t1, LIR_Opr t2, LIR_Opr result)
+    : LIR_Op(code, result, NULL)  // no result, no info
     , _addr(addr)
     , _cmp_value(cmp_value)
     , _new_value(new_value)
@@ -1832,6 +1899,9 @@
 
   void safepoint(LIR_Opr tmp, CodeEmitInfo* info)  { append(new LIR_Op1(lir_safepoint, tmp, info)); }
 
+#ifdef PPC
+  void convert(Bytecodes::Code code, LIR_Opr left, LIR_Opr dst, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_OpConvert(code, left, dst, NULL, tmp1, tmp2)); }
+#endif
   void convert(Bytecodes::Code code, LIR_Opr left, LIR_Opr dst, ConversionStub* stub = NULL/*, bool is_32bit = false*/) { append(new LIR_OpConvert(code, left, dst, stub)); }
 
   void logical_and (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_and,  left, right, dst)); }
@@ -1867,9 +1937,12 @@
     append(new LIR_Op2(lir_cmove, condition, src1, src2, dst));
   }
 
-  void cas_long(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value, LIR_Opr t1, LIR_Opr t2);
-  void cas_obj(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value, LIR_Opr t1, LIR_Opr t2);
-  void cas_int(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value, LIR_Opr t1, LIR_Opr t2);
+  void cas_long(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
+                LIR_Opr t1, LIR_Opr t2, LIR_Opr result = LIR_OprFact::illegalOpr);
+  void cas_obj(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
+               LIR_Opr t1, LIR_Opr t2, LIR_Opr result = LIR_OprFact::illegalOpr);
+  void cas_int(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
+               LIR_Opr t1, LIR_Opr t2, LIR_Opr result = LIR_OprFact::illegalOpr);
 
   void abs (LIR_Opr from, LIR_Opr to, LIR_Opr tmp)                { append(new LIR_Op2(lir_abs , from, tmp, to)); }
   void sqrt(LIR_Opr from, LIR_Opr to, LIR_Opr tmp)                { append(new LIR_Op2(lir_sqrt, from, tmp, to)); }
@@ -1950,7 +2023,7 @@
   }
 
   void load_stack_address_monitor(int monitor_ix, LIR_Opr dst)  { append(new LIR_Op1(lir_monaddr, LIR_OprFact::intConst(monitor_ix), dst)); }
-  void unlock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, CodeStub* stub);
+  void unlock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub);
   void lock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub, CodeEmitInfo* info);
 
   void set_24bit_fpu()                                               { append(new LIR_Op0(lir_24bit_FPU )); }
--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -438,6 +438,12 @@
   default: ShouldNotReachHere();
   }
 
+  // JSR 292
+  // Record if this method has MethodHandle invokes.
+  if (op->is_method_handle_invoke()) {
+    compilation()->set_has_method_handle_invokes(true);
+  }
+
 #if defined(X86) && defined(TIERED)
   // C2 leave fpu stack dirty clean it
   if (UseSSE < 2) {
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -31,6 +31,12 @@
 #define __ gen()->lir()->
 #endif
 
+// TODO: ARM - Use some recognizable constant which still fits architectural constraints
+#ifdef ARM
+#define PATCHED_ADDR  (204)
+#else
+#define PATCHED_ADDR  (max_jint)
+#endif
 
 void PhiResolverState::reset(int max_vregs) {
   // Initialize array sizes
@@ -225,13 +231,13 @@
 void LIRItem::load_item_force(LIR_Opr reg) {
   LIR_Opr r = result();
   if (r != reg) {
+#if !defined(ARM) && !defined(E500V2)
     if (r->type() != reg->type()) {
       // moves between different types need an intervening spill slot
-      LIR_Opr tmp = _gen->force_to_spill(r, reg->type());
-      __ move(tmp, reg);
-    } else {
-      __ move(r, reg);
+      r = _gen->force_to_spill(r, reg->type());
     }
+#endif
+    __ move(r, reg);
     _result = reg;
   }
 }
@@ -628,14 +634,14 @@
 }
 
 
-void LIRGenerator::monitor_exit(LIR_Opr object, LIR_Opr lock, LIR_Opr new_hdr, int monitor_no) {
+void LIRGenerator::monitor_exit(LIR_Opr object, LIR_Opr lock, LIR_Opr new_hdr, LIR_Opr scratch, int monitor_no) {
   if (!GenerateSynchronizationCode) return;
   // setup registers
   LIR_Opr hdr = lock;
   lock = new_hdr;
   CodeStub* slow_path = new MonitorExitStub(lock, UseFastLocking, monitor_no);
   __ load_stack_address_monitor(monitor_no, lock);
-  __ unlock_object(hdr, object, lock, slow_path);
+  __ unlock_object(hdr, object, lock, scratch, slow_path);
 }
 
 
@@ -1400,6 +1406,25 @@
   }
   assert(addr->is_register(), "must be a register at this point");
 
+#ifdef ARM
+  // TODO: ARM - move to platform-dependent code
+  LIR_Opr tmp = FrameMap::R14_opr;
+  if (VM_Version::supports_movw()) {
+    __ move((LIR_Opr)card_table_base, tmp);
+  } else {
+    __ move(new LIR_Address(FrameMap::Rthread_opr, in_bytes(JavaThread::card_table_base_offset()), T_ADDRESS), tmp);
+  }
+
+  CardTableModRefBS* ct = (CardTableModRefBS*)_bs;
+  LIR_Address *card_addr = new LIR_Address(tmp, addr, (LIR_Address::Scale) -CardTableModRefBS::card_shift, 0, T_BYTE);
+  if(((int)ct->byte_map_base & 0xff) == 0) {
+    __ move(tmp, card_addr);
+  } else {
+    LIR_Opr tmp_zero = new_register(T_INT);
+    __ move(LIR_OprFact::intConst(0), tmp_zero);
+    __ move(tmp_zero, card_addr);
+  }
+#else // ARM
   LIR_Opr tmp = new_pointer_register();
   if (TwoOperandLIRForm) {
     __ move(addr, tmp);
@@ -1415,6 +1440,7 @@
               new LIR_Address(tmp, load_constant(card_table_base),
                               T_BYTE));
   }
+#endif // ARM
 }
 
 
@@ -1507,7 +1533,7 @@
     // generate_address to try to be smart about emitting the -1.
     // Otherwise the patching code won't know how to find the
     // instruction to patch.
-    address = new LIR_Address(object.result(), max_jint, field_type);
+    address = new LIR_Address(object.result(), PATCHED_ADDR, field_type);
   } else {
     address = generate_address(object.result(), x->offset(), field_type);
   }
@@ -1584,7 +1610,7 @@
     // generate_address to try to be smart about emitting the -1.
     // Otherwise the patching code won't know how to find the
     // instruction to patch.
-    address = new LIR_Address(object.result(), max_jint, field_type);
+    address = new LIR_Address(object.result(), PATCHED_ADDR, field_type);
   } else {
     address = generate_address(object.result(), x->offset(), field_type);
   }
@@ -1844,6 +1870,8 @@
     }
 #endif
     addr = new LIR_Address(base_op, index_op, LIR_Address::Scale(log2_scale), 0, dst_type);
+#elif defined(ARM)
+    addr = generate_address(base_op, index_op, log2_scale, 0, dst_type);
 #else
     if (index_op->is_illegal() || log2_scale == 0) {
 #ifdef _LP64
@@ -1916,6 +1944,7 @@
       __ convert(Bytecodes::_i2l, idx.result(), index_op);
     } else {
 #endif
+      // TODO: ARM also allows embedded shift in the address
       __ move(idx.result(), index_op);
 #ifdef _LP64
     }
@@ -2204,7 +2233,10 @@
     // Assign new location to Local instruction for this local
     Local* local = x->state()->local_at(java_index)->as_Local();
     assert(local != NULL, "Locals for incoming arguments must have been created");
+#ifndef __SOFTFP__
+    // The java calling convention passes double as long and float as int.
     assert(as_ValueType(t)->tag() == local->type()->tag(), "check");
+#endif // __SOFTFP__
     local->set_operand(dest);
     _instruction_for_operand.at_put_grow(dest->vreg_number(), local, NULL);
     java_index += type2size[t];
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -314,7 +314,7 @@
   void logic_op   (Bytecodes::Code code, LIR_Opr dst_reg, LIR_Opr left, LIR_Opr right);
 
   void monitor_enter (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no, CodeEmitInfo* info_for_exception, CodeEmitInfo* info);
-  void monitor_exit  (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, int monitor_no);
+  void monitor_exit  (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no);
 
   void new_instance    (LIR_Opr  dst, ciInstanceKlass* klass, LIR_Opr  scratch1, LIR_Opr  scratch2, LIR_Opr  scratch3,  LIR_Opr scratch4, LIR_Opr  klass_reg, CodeEmitInfo* info);
 
@@ -338,6 +338,9 @@
   }
   LIR_Address* emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr, BasicType type, bool needs_card_mark);
 
+  // the helper for generate_address
+  void add_large_constant(LIR_Opr src, int c, LIR_Opr dest);
+
   // machine preferences and characteristics
   bool can_inline_as_constant(Value i) const;
   bool can_inline_as_constant(LIR_Const* c) const;
@@ -393,6 +396,10 @@
     return l;
   }
 
+#ifdef __SOFTFP__
+  void do_soft_float_compare(If *x);
+#endif // __SOFTFP__
+
   void init();
 
   SwitchRangeArray* create_lookup_ranges(TableSwitch* x);
@@ -444,6 +451,7 @@
   static LIR_Opr remOutOpr();
   static LIR_Opr shiftCountOpr();
   LIR_Opr syncTempOpr();
+  LIR_Opr atomicLockOpr();
 
   // returns a register suitable for saving the thread in a
   // call_runtime_leaf if one is needed.
--- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -169,7 +169,11 @@
 }
 
 bool LinearScan::is_virtual_cpu_interval(const Interval* i) {
+#if defined(__SOFTFP__) || defined(E500V2)
+  return i->reg_num() >= LIR_OprDesc::vreg_base;
+#else
   return i->reg_num() >= LIR_OprDesc::vreg_base && (i->type() != T_FLOAT && i->type() != T_DOUBLE);
+#endif // __SOFTFP__ or E500V2
 }
 
 bool LinearScan::is_precolored_fpu_interval(const Interval* i) {
@@ -177,7 +181,11 @@
 }
 
 bool LinearScan::is_virtual_fpu_interval(const Interval* i) {
+#if defined(__SOFTFP__) || defined(E500V2)
+  return false;
+#else
   return i->reg_num() >= LIR_OprDesc::vreg_base && (i->type() == T_FLOAT || i->type() == T_DOUBLE);
+#endif // __SOFTFP__ or E500V2
 }
 
 bool LinearScan::is_in_fpu_register(const Interval* i) {
@@ -2010,12 +2018,18 @@
         return LIR_OprFact::single_cpu_oop(assigned_reg);
       }
 
+#ifdef __SOFTFP__
+      case T_FLOAT:  // fall through
+#endif // __SOFTFP__
       case T_INT: {
         assert(assigned_reg >= pd_first_cpu_reg && assigned_reg <= pd_last_cpu_reg, "no cpu register");
         assert(interval->assigned_regHi() == any_reg, "must not have hi register");
         return LIR_OprFact::single_cpu(assigned_reg);
       }
 
+#ifdef __SOFTFP__
+      case T_DOUBLE:  // fall through
+#endif // __SOFTFP__
       case T_LONG: {
         int assigned_regHi = interval->assigned_regHi();
         assert(assigned_reg >= pd_first_cpu_reg && assigned_reg <= pd_last_cpu_reg, "no cpu register");
@@ -2033,7 +2047,7 @@
 #ifdef _LP64
         return LIR_OprFact::double_cpu(assigned_reg, assigned_reg);
 #else
-#ifdef SPARC
+#if defined(SPARC) || defined(PPC)
         return LIR_OprFact::double_cpu(assigned_regHi, assigned_reg);
 #else
         return LIR_OprFact::double_cpu(assigned_reg, assigned_regHi);
@@ -2041,6 +2055,7 @@
 #endif // LP64
       }
 
+#ifndef __SOFTFP__
       case T_FLOAT: {
 #ifdef X86
         if (UseSSE >= 1) {
@@ -2069,6 +2084,11 @@
         assert(interval->assigned_regHi() >= pd_first_fpu_reg && interval->assigned_regHi() <= pd_last_fpu_reg, "no fpu register");
         assert(assigned_reg % 2 == 0 && assigned_reg + 1 == interval->assigned_regHi(), "must be sequential and even");
         LIR_Opr result = LIR_OprFact::double_fpu(interval->assigned_regHi() - pd_first_fpu_reg, assigned_reg - pd_first_fpu_reg);
+#elif defined(ARM)
+        assert(assigned_reg >= pd_first_fpu_reg && assigned_reg <= pd_last_fpu_reg, "no fpu register");
+        assert(interval->assigned_regHi() >= pd_first_fpu_reg && interval->assigned_regHi() <= pd_last_fpu_reg, "no fpu register");
+        assert(assigned_reg % 2 == 0 && assigned_reg + 1 == interval->assigned_regHi(), "must be sequential and even");
+        LIR_Opr result = LIR_OprFact::double_fpu(assigned_reg - pd_first_fpu_reg, interval->assigned_regHi() - pd_first_fpu_reg);
 #else
         assert(assigned_reg >= pd_first_fpu_reg && assigned_reg <= pd_last_fpu_reg, "no fpu register");
         assert(interval->assigned_regHi() == any_reg, "must not have hi register (double fpu values are stored in one register on Intel)");
@@ -2076,6 +2096,7 @@
 #endif
         return result;
       }
+#endif // __SOFTFP__
 
       default: {
         ShouldNotReachHere();
@@ -2638,6 +2659,12 @@
 #ifdef SPARC
       assert(opr->fpu_regnrLo() == opr->fpu_regnrHi() + 1, "assumed in calculation (only fpu_regnrHi is used)");
 #endif
+#ifdef ARM
+      assert(opr->fpu_regnrHi() == opr->fpu_regnrLo() + 1, "assumed in calculation (only fpu_regnrLo is used)");
+#endif
+#ifdef PPC
+      assert(opr->fpu_regnrLo() == opr->fpu_regnrHi(), "assumed in calculation (only fpu_regnrHi is used)");
+#endif
 
       VMReg rname_first = frame_map()->fpu_regname(opr->fpu_regnrHi());
 #ifdef _LP64
@@ -6135,6 +6162,17 @@
             assert(prev_op->as_OpBranch() != NULL, "branch must be of type LIR_OpBranch");
             LIR_OpBranch* prev_branch = (LIR_OpBranch*)prev_op;
 
+            LIR_Op2* prev_cmp = NULL;
+
+            for(int j = instructions->length() - 3; j >= 0 && prev_cmp == NULL; j--) {
+              prev_op = instructions->at(j);
+              if(prev_op->code() == lir_cmp) {
+                assert(prev_op->as_Op2() != NULL, "branch must be of type LIR_Op2");
+                prev_cmp = (LIR_Op2*)prev_op;
+                assert(prev_branch->cond() == prev_cmp->condition(), "should be the same");
+              }
+            }
+            assert(prev_cmp != NULL, "should have found comp instruction for branch");
             if (prev_branch->block() == code->at(i + 1) && prev_branch->info() == NULL) {
 
               TRACE_LINEAR_SCAN(3, tty->print_cr("Negating conditional branch and deleting unconditional branch at end of block B%d", block->block_id()));
@@ -6142,6 +6180,7 @@
               // eliminate a conditional branch to the immediate successor
               prev_branch->change_block(last_branch->block());
               prev_branch->negate_cond();
+              prev_cmp->set_condition(prev_branch->cond());
               instructions->truncate(instructions->length() - 1);
             }
           }
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -144,7 +144,7 @@
 #ifndef TIERED
     case counter_overflow_id: // Not generated outside the tiered world
 #endif
-#ifdef SPARC
+#if defined(SPARC) || defined(PPC)
     case handle_exception_nofpu_id:  // Unused on sparc
 #endif
       break;
@@ -240,7 +240,8 @@
 
 #undef FUNCTION_CASE
 
-  return "<unknown function>";
+  // Soft float adds more runtime names.
+  return pd_name_for_address(entry);
 }
 
 
@@ -896,7 +897,10 @@
           } else {
             // patch the instruction <move reg, klass>
             NativeMovConstReg* n_copy = nativeMovConstReg_at(copy_buff);
-            assert(n_copy->data() == 0, "illegal init value");
+
+            assert(n_copy->data() == 0 ||
+                   n_copy->data() == (int)Universe::non_oop_word(),
+                   "illegal init value");
             assert(load_klass() != NULL, "klass not set");
             n_copy->set_data((intx) (load_klass()));
 
@@ -904,7 +908,7 @@
               Disassembler::decode(copy_buff, copy_buff + *byte_count, tty);
             }
 
-#ifdef SPARC
+#if defined(SPARC) || defined(PPC)
             // Update the oop location in the nmethod with the proper
             // oop.  When the code was generated, a NULL was stuffed
             // in the oop table and that table needs to be update to
@@ -934,6 +938,14 @@
         if (do_patch) {
           // replace instructions
           // first replace the tail, then the call
+#ifdef ARM
+          if(stub_id == Runtime1::load_klass_patching_id && !VM_Version::supports_movw()) {
+            copy_buff -= *byte_count;
+            NativeMovConstReg* n_copy2 = nativeMovConstReg_at(copy_buff);
+            n_copy2->set_data((intx) (load_klass()), instr_pc);
+          }
+#endif
+
           for (int i = NativeCall::instruction_size; i < *byte_count; i++) {
             address ptr = copy_buff + i;
             int a_byte = (*ptr) & 0xFF;
@@ -961,6 +973,12 @@
             relocInfo::change_reloc_info_for_address(&iter2, (address) instr_pc2,
                                                      relocInfo::none, relocInfo::oop_type);
 #endif
+#ifdef PPC
+          { address instr_pc2 = instr_pc + NativeMovConstReg::lo_offset;
+            RelocIterator iter2(nm, instr_pc2, instr_pc2 + 1);
+            relocInfo::change_reloc_info_for_address(&iter2, (address) instr_pc2, relocInfo::none, relocInfo::oop_type);
+          }
+#endif
           }
 
         } else {
--- a/hotspot/src/share/vm/c1/c1_Runtime1.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -159,6 +159,9 @@
   static const char* name_for (StubID id);
   static const char* name_for_address(address entry);
 
+  // platform might add runtime names.
+  static const char* pd_name_for_address(address entry);
+
   // method tracing
   static void trace_block_entry(jint block_id);
 
--- a/hotspot/src/share/vm/ci/ciEnv.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -728,8 +728,8 @@
   }
 
   // Get the invoker methodOop from the constant pool.
-  intptr_t f2_value = cpool->cache()->main_entry_at(index)->f2();
-  methodOop signature_invoker = methodOop(f2_value);
+  oop f1_value = cpool->cache()->main_entry_at(index)->f1();
+  methodOop signature_invoker = methodOop(f1_value);
   assert(signature_invoker != NULL && signature_invoker->is_method() && signature_invoker->is_method_handle_invoke(),
          "correct result from LinkResolver::resolve_invokedynamic");
 
--- a/hotspot/src/share/vm/ci/ciField.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/ci/ciField.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -339,7 +339,7 @@
   if (_type != NULL) _type->print_name();
   else               tty->print("(reference)");
   tty->print(" is_constant=%s", bool_to_str(_is_constant));
-  if (_is_constant) {
+  if (_is_constant && is_static()) {
     tty->print(" constant_value=");
     _constant_value.print();
   }
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -403,8 +403,9 @@
     instanceKlass* ik = get_instanceKlass();
     int max_n_fields = ik->fields()->length()/instanceKlass::next_offset;
 
+    Arena* arena = curEnv->arena();
     _non_static_fields =
-      new (curEnv->arena()) GrowableArray<ciField*>(max_n_fields);
+      new (arena) GrowableArray<ciField*>(arena, max_n_fields, 0, NULL);
     NonStaticFieldFiller filler(curEnv, _non_static_fields);
     ik->do_nonstatic_fields(&filler);
   }
--- a/hotspot/src/share/vm/ci/ciMethod.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -55,10 +55,10 @@
   _exception_handlers = NULL;
   _liveness           = NULL;
   _method_blocks = NULL;
-#ifdef COMPILER2
+#if defined(COMPILER2) || defined(SHARK)
   _flow               = NULL;
   _bcea               = NULL;
-#endif // COMPILER2
+#endif // COMPILER2 || SHARK
 
   ciEnv *env = CURRENT_ENV;
   if (env->jvmti_can_hotswap_or_post_breakpoint() && _is_compilable) {
@@ -123,10 +123,10 @@
   _can_be_statically_bound = false;
   _method_blocks = NULL;
   _method_data = NULL;
-#ifdef COMPILER2
+#if defined(COMPILER2) || defined(SHARK)
   _flow = NULL;
   _bcea = NULL;
-#endif // COMPILER2
+#endif // COMPILER2 || SHARK
 }
 
 
@@ -229,6 +229,20 @@
 }
 
 
+#ifdef SHARK
+// ------------------------------------------------------------------
+// ciMethod::itable_index
+//
+// Get the position of this method's entry in the itable, if any.
+int ciMethod::itable_index() {
+  check_is_loaded();
+  assert(holder()->is_linked(), "must be linked");
+  VM_ENTRY_MARK;
+  return klassItable::compute_itable_index(get_methodOop());
+}
+#endif // SHARK
+
+
 // ------------------------------------------------------------------
 // ciMethod::native_entry
 //
@@ -294,34 +308,34 @@
 // ------------------------------------------------------------------
 // ciMethod::get_flow_analysis
 ciTypeFlow* ciMethod::get_flow_analysis() {
-#ifdef COMPILER2
+#if defined(COMPILER2) || defined(SHARK)
   if (_flow == NULL) {
     ciEnv* env = CURRENT_ENV;
     _flow = new (env->arena()) ciTypeFlow(env, this);
     _flow->do_flow();
   }
   return _flow;
-#else // COMPILER2
+#else // COMPILER2 || SHARK
   ShouldNotReachHere();
   return NULL;
-#endif // COMPILER2
+#endif // COMPILER2 || SHARK
 }
 
 
 // ------------------------------------------------------------------
 // ciMethod::get_osr_flow_analysis
 ciTypeFlow* ciMethod::get_osr_flow_analysis(int osr_bci) {
-#ifdef COMPILER2
+#if defined(COMPILER2) || defined(SHARK)
   // OSR entry points are always place after a call bytecode of some sort
   assert(osr_bci >= 0, "must supply valid OSR entry point");
   ciEnv* env = CURRENT_ENV;
   ciTypeFlow* flow = new (env->arena()) ciTypeFlow(env, this, osr_bci);
   flow->do_flow();
   return flow;
-#else // COMPILER2
+#else // COMPILER2 || SHARK
   ShouldNotReachHere();
   return NULL;
-#endif // COMPILER2
+#endif // COMPILER2 || SHARK
 }
 
 // ------------------------------------------------------------------
@@ -694,30 +708,21 @@
 // ------------------------------------------------------------------
 // ciMethod::is_method_handle_invoke
 //
-// Return true if the method is a MethodHandle target.
+// Return true if the method is an instance of one of the two
+// signature-polymorphic MethodHandle methods, invokeExact or invokeGeneric.
 bool ciMethod::is_method_handle_invoke() const {
-  bool flag = (holder()->name() == ciSymbol::java_dyn_MethodHandle() &&
-               methodOopDesc::is_method_handle_invoke_name(name()->sid()));
-#ifdef ASSERT
-  if (is_loaded()) {
-    bool flag2 = ((flags().as_int() & JVM_MH_INVOKE_BITS) == JVM_MH_INVOKE_BITS);
-    {
-      VM_ENTRY_MARK;
-      bool flag3 = get_methodOop()->is_method_handle_invoke();
-      assert(flag2 == flag3, "consistent");
-      assert(flag  == flag3, "consistent");
-    }
-  }
-#endif //ASSERT
-  return flag;
+  if (!is_loaded())  return false;
+  VM_ENTRY_MARK;
+  return get_methodOop()->is_method_handle_invoke();
 }
 
 // ------------------------------------------------------------------
 // ciMethod::is_method_handle_adapter
 //
 // Return true if the method is a generated MethodHandle adapter.
+// These are built by MethodHandleCompiler.
 bool ciMethod::is_method_handle_adapter() const {
-  check_is_loaded();
+  if (!is_loaded())  return false;
   VM_ENTRY_MARK;
   return get_methodOop()->is_method_handle_adapter();
 }
--- a/hotspot/src/share/vm/ci/ciMethod.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/ci/ciMethod.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -70,7 +70,7 @@
 
   // Optional liveness analyzer.
   MethodLiveness* _liveness;
-#ifdef COMPILER2
+#if defined(COMPILER2) || defined(SHARK)
   ciTypeFlow*         _flow;
   BCEscapeAnalyzer*   _bcea;
 #endif
@@ -141,6 +141,9 @@
 
   // Runtime information.
   int           vtable_index();
+#ifdef SHARK
+  int           itable_index();
+#endif // SHARK
   address       native_entry();
   address       interpreter_entry();
 
--- a/hotspot/src/share/vm/ci/ciMethodBlocks.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/ci/ciMethodBlocks.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -252,7 +252,7 @@
                           _arena(arena), _num_blocks(0), _code_size(meth->code_size()) {
   int block_estimate = _code_size / 8;
 
-  _blocks =  new(_arena) GrowableArray<ciBlock *>(block_estimate);
+  _blocks =  new(_arena) GrowableArray<ciBlock *>(_arena, block_estimate, 0, NULL);
   int b2bsize = _code_size * sizeof(ciBlock **);
   _bci_to_block = (ciBlock **) arena->Amalloc(b2bsize);
   Copy::zero_to_words((HeapWord*) _bci_to_block, b2bsize / sizeof(HeapWord));
--- a/hotspot/src/share/vm/ci/ciTypeFlow.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/ci/ciTypeFlow.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -2591,7 +2591,7 @@
                                StateVector* temp_vector,
                                JsrSet* temp_set) {
   int dft_len = 100;
-  GrowableArray<Block*> stk(arena(), dft_len, 0, NULL);
+  GrowableArray<Block*> stk(dft_len);
 
   ciBlock* dummy = _methodBlocks->make_dummy_block();
   JsrSet* root_set = new JsrSet(NULL, 0);
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -62,6 +62,7 @@
   ClassFileStream cfs1 = *cfs0;
   ClassFileStream* cfs = &cfs1;
 #ifdef ASSERT
+  assert(cfs->allocated_on_stack(),"should be local");
   u1* old_current = cfs0->current();
 #endif
 
@@ -122,7 +123,7 @@
         if (!EnableMethodHandles ||
             _major_version < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
           classfile_parse_error(
-            (!EnableInvokeDynamic ?
+            (!EnableMethodHandles ?
              "This JVM does not support constant tag %u in class file %s" :
              "Class file version does not support constant tag %u in class file %s"),
             tag, CHECK);
@@ -140,6 +141,22 @@
           ShouldNotReachHere();
         }
         break;
+      case JVM_CONSTANT_InvokeDynamic :
+        {
+          if (!EnableInvokeDynamic ||
+              _major_version < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
+            classfile_parse_error(
+              (!EnableInvokeDynamic ?
+               "This JVM does not support constant tag %u in class file %s" :
+               "Class file version does not support constant tag %u in class file %s"),
+              tag, CHECK);
+          }
+          cfs->guarantee_more(5, CHECK);  // bsm_index, name_and_type_index, tag/access_flags
+          u2 bootstrap_method_index = cfs->get_u2_fast();
+          u2 name_and_type_index = cfs->get_u2_fast();
+          cp->invoke_dynamic_at_put(index, bootstrap_method_index, name_and_type_index);
+        }
+        break;
       case JVM_CONSTANT_Integer :
         {
           cfs->guarantee_more(5, CHECK);  // bytes, tag/access_flags
@@ -414,6 +431,24 @@
               ref_index, CHECK_(nullHandle));
         }
         break;
+      case JVM_CONSTANT_InvokeDynamic :
+        {
+          int bootstrap_method_ref_index = cp->invoke_dynamic_bootstrap_method_ref_index_at(index);
+          int name_and_type_ref_index = cp->invoke_dynamic_name_and_type_ref_index_at(index);
+          check_property((bootstrap_method_ref_index == 0 && AllowTransitionalJSR292)
+                         ||
+                         (valid_cp_range(bootstrap_method_ref_index, length) &&
+                          cp->tag_at(bootstrap_method_ref_index).is_method_handle()),
+                         "Invalid constant pool index %u in class file %s",
+                         bootstrap_method_ref_index,
+                         CHECK_(nullHandle));
+          check_property(valid_cp_range(name_and_type_ref_index, length) &&
+                         cp->tag_at(name_and_type_ref_index).is_name_and_type(),
+                         "Invalid constant pool index %u in class file %s",
+                         name_and_type_ref_index,
+                         CHECK_(nullHandle));
+          break;
+        }
       default:
         fatal(err_msg("bad constant pool tag value %u",
                       cp->tag_at(index).value()));
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -2507,6 +2507,10 @@
                                                 int caller_bci,
                                                 TRAPS) {
   Handle empty;
+  guarantee(bootstrap_method.not_null() &&
+            java_dyn_MethodHandle::is_instance(bootstrap_method()),
+            "caller must supply a valid BSM");
+
   Handle caller_mname = MethodHandles::new_MemberName(CHECK_(empty));
   MethodHandles::init_MemberName(caller_mname(), caller_method());
 
@@ -2537,20 +2541,61 @@
   return call_site_oop;
 }
 
-Handle SystemDictionary::find_bootstrap_method(KlassHandle caller, TRAPS) {
+Handle SystemDictionary::find_bootstrap_method(methodHandle caller_method, int caller_bci,
+                                               int cache_index, TRAPS) {
   Handle empty;
-  if (!caller->oop_is_instance())  return empty;
-
-  instanceKlassHandle ik(THREAD, caller());
-
-  oop boot_method_oop = ik->bootstrap_method();
-  if (boot_method_oop != NULL) {
+
+  constantPoolHandle pool;
+  {
+    klassOop caller = caller_method->method_holder();
+    if (!Klass::cast(caller)->oop_is_instance())  return empty;
+    pool = constantPoolHandle(THREAD, instanceKlass::cast(caller)->constants());
+  }
+
+  int constant_pool_index = pool->cache()->entry_at(cache_index)->constant_pool_index();
+  constantTag tag = pool->tag_at(constant_pool_index);
+
+  if (tag.is_invoke_dynamic()) {
+    // JVM_CONSTANT_InvokeDynamic is an ordered pair of [bootm, name&type]
+    // The bootm, being a JVM_CONSTANT_MethodHandle, has its own cache entry.
+    int bsm_index = pool->invoke_dynamic_bootstrap_method_ref_index_at(constant_pool_index);
+    if (bsm_index != 0) {
+      int bsm_index_in_cache = pool->cache()->entry_at(cache_index)->bootstrap_method_index_in_cache();
+      DEBUG_ONLY(int bsm_index_2 = pool->cache()->entry_at(bsm_index_in_cache)->constant_pool_index());
+      assert(bsm_index == bsm_index_2, "BSM constant lifted to cache");
+      if (TraceMethodHandles) {
+        tty->print_cr("resolving bootstrap method for "PTR_FORMAT" at %d at cache[%d]CP[%d]...",
+                      (intptr_t) caller_method(), caller_bci, cache_index, constant_pool_index);
+      }
+      oop bsm_oop = pool->resolve_cached_constant_at(bsm_index_in_cache, CHECK_(empty));
+      if (TraceMethodHandles) {
+        tty->print_cr("bootstrap method for "PTR_FORMAT" at %d retrieved as "PTR_FORMAT":",
+                      (intptr_t) caller_method(), caller_bci, (intptr_t) bsm_oop);
+      }
+      assert(bsm_oop->is_oop()
+             && java_dyn_MethodHandle::is_instance(bsm_oop), "must be sane");
+      return Handle(THREAD, bsm_oop);
+    }
+    // else null BSM; fall through
+  } else if (tag.is_name_and_type()) {
+    // JSR 292 EDR does not have JVM_CONSTANT_InvokeDynamic
+    // a bare name&type defaults its BSM to null, so fall through...
+  } else {
+    ShouldNotReachHere();  // verifier does not allow this
+  }
+
+  // Fall through to pick up the per-class bootstrap method.
+  // This mechanism may go away in the PFD.
+  assert(AllowTransitionalJSR292, "else the verifier should have stopped us already");
+  oop bsm_oop = instanceKlass::cast(caller_method->method_holder())->bootstrap_method();
+  if (bsm_oop != NULL) {
     if (TraceMethodHandles) {
-      tty->print_cr("bootstrap method for "PTR_FORMAT" cached as "PTR_FORMAT":", ik(), boot_method_oop);
+      tty->print_cr("bootstrap method for "PTR_FORMAT" registered as "PTR_FORMAT":",
+                    (intptr_t) caller_method(), (intptr_t) bsm_oop);
     }
-    assert(boot_method_oop->is_oop()
-           && java_dyn_MethodHandle::is_instance(boot_method_oop), "must be sane");
-    return Handle(THREAD, boot_method_oop);
+    assert(bsm_oop->is_oop()
+           && java_dyn_MethodHandle::is_instance(bsm_oop), "must be sane");
+    return Handle(THREAD, bsm_oop);
   }
 
   return empty;
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -492,7 +492,10 @@
                                           TRAPS);
 
   // coordinate with Java about bootstrap methods
-  static Handle    find_bootstrap_method(KlassHandle caller, TRAPS);
+  static Handle    find_bootstrap_method(methodHandle caller_method,
+                                         int caller_bci,  // N.B. must be an invokedynamic
+                                         int cache_index, // must be corresponding main_entry
+                                         TRAPS);
 
   // Utility for printing loader "name" as part of tracing constraints
   static const char* loader_name(oop loader) {
--- a/hotspot/src/share/vm/classfile/verificationType.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/classfile/verificationType.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -70,7 +70,9 @@
   } else if (is_array() && from.is_array()) {
     VerificationType comp_this = get_component(CHECK_false);
     VerificationType comp_from = from.get_component(CHECK_false);
-    return comp_this.is_assignable_from(comp_from, context, CHECK_false);
+    if (!comp_this.is_bogus() && !comp_from.is_bogus()) {
+      return comp_this.is_assignable_from(comp_from, context, CHECK_false);
+    }
   }
   return false;
 }
@@ -98,7 +100,7 @@
         CHECK_(VerificationType::bogus_type()));
       return VerificationType::reference_type(component);
     default:
-      ShouldNotReachHere();
+      // Met an invalid type signature, e.g. [X
       return VerificationType::bogus_type();
   }
 }
--- a/hotspot/src/share/vm/classfile/verifier.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/classfile/verifier.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1847,12 +1847,8 @@
   if (type == VerificationType::uninitialized_this_type()) {
     // The method must be an <init> method of either this class, or one of its
     // superclasses
-    klassOop oop = current_class()();
-    Klass* klass = oop->klass_part();
-    while (klass != NULL && ref_class_type.name() != klass->name()) {
-      klass = klass->super()->klass_part();
-    }
-    if (klass == NULL) {
+    if (ref_class_type.name() != current_class()->name() &&
+        !name_in_supers(ref_class_type.name(), current_class())) {
       verify_error(bci, "Bad <init> method call");
       return;
     }
@@ -1913,7 +1909,8 @@
   unsigned int types = (opcode == Bytecodes::_invokeinterface
                                 ? 1 << JVM_CONSTANT_InterfaceMethodref
                       : opcode == Bytecodes::_invokedynamic
-                                ? 1 << JVM_CONSTANT_NameAndType
+                                ? (1 << JVM_CONSTANT_NameAndType
+                                  |1 << JVM_CONSTANT_InvokeDynamic)
                                 : 1 << JVM_CONSTANT_Methodref);
   verify_cp_type(index, cp, types, CHECK_VERIFY(this));
 
--- a/hotspot/src/share/vm/code/codeBlob.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/code/codeBlob.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -202,6 +202,11 @@
 //----------------------------------------------------------------------------------------------------
 // Implementation of AdapterBlob
 
+AdapterBlob::AdapterBlob(int size, CodeBuffer* cb) :
+  BufferBlob("I2C/C2I adapters", size, cb) {
+  CodeCache::commit(this);
+}
+
 AdapterBlob* AdapterBlob::create(CodeBuffer* cb) {
   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 
@@ -210,7 +215,6 @@
   {
     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     blob = new (size) AdapterBlob(size, cb);
-    CodeCache::commit(blob);
   }
   // Track memory usage statistic after releasing CodeCache_lock
   MemoryService::track_code_cache_memory_usage();
@@ -560,72 +564,53 @@
   ShouldNotReachHere();
 }
 
-#ifndef PRODUCT
-
-void CodeBlob::print() const {
-  tty->print_cr("[CodeBlob (" INTPTR_FORMAT ")]", this);
-  tty->print_cr("Framesize: %d", _frame_size);
+void CodeBlob::print_on(outputStream* st) const {
+  st->print_cr("[CodeBlob (" INTPTR_FORMAT ")]", this);
+  st->print_cr("Framesize: %d", _frame_size);
 }
 
-
 void CodeBlob::print_value_on(outputStream* st) const {
   st->print_cr("[CodeBlob]");
 }
 
-#endif
-
 void BufferBlob::verify() {
   // unimplemented
 }
 
-#ifndef PRODUCT
-
-void BufferBlob::print() const {
-  CodeBlob::print();
-  print_value_on(tty);
+void BufferBlob::print_on(outputStream* st) const {
+  CodeBlob::print_on(st);
+  print_value_on(st);
 }
 
-
 void BufferBlob::print_value_on(outputStream* st) const {
   st->print_cr("BufferBlob (" INTPTR_FORMAT  ") used for %s", this, name());
 }
 
-
-#endif
-
 void RuntimeStub::verify() {
   // unimplemented
 }
 
-#ifndef PRODUCT
-
-void RuntimeStub::print() const {
-  CodeBlob::print();
-  tty->print("Runtime Stub (" INTPTR_FORMAT "): ", this);
-  tty->print_cr(name());
-  Disassembler::decode((CodeBlob*)this);
+void RuntimeStub::print_on(outputStream* st) const {
+  CodeBlob::print_on(st);
+  st->print("Runtime Stub (" INTPTR_FORMAT "): ", this);
+  st->print_cr(name());
+  Disassembler::decode((CodeBlob*)this, st);
 }
 
-
 void RuntimeStub::print_value_on(outputStream* st) const {
   st->print("RuntimeStub (" INTPTR_FORMAT "): ", this); st->print(name());
 }
 
-#endif
-
 void SingletonBlob::verify() {
   // unimplemented
 }
 
-#ifndef PRODUCT
-
-void SingletonBlob::print() const {
-  CodeBlob::print();
-  tty->print_cr(name());
-  Disassembler::decode((CodeBlob*)this);
+void SingletonBlob::print_on(outputStream* st) const {
+  CodeBlob::print_on(st);
+  st->print_cr(name());
+  Disassembler::decode((CodeBlob*)this, st);
 }
 
-
 void SingletonBlob::print_value_on(outputStream* st) const {
   st->print_cr(name());
 }
@@ -633,5 +618,3 @@
 void DeoptimizationBlob::print_value_on(outputStream* st) const {
   st->print_cr("Deoptimization (frame not available)");
 }
-
-#endif // PRODUCT
--- a/hotspot/src/share/vm/code/codeBlob.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/code/codeBlob.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -163,8 +163,9 @@
 
   // Debugging
   virtual void verify();
-  virtual void print() const                     PRODUCT_RETURN;
-  virtual void print_value_on(outputStream* st) const PRODUCT_RETURN;
+  void print() const                             { print_on(tty); }
+  virtual void print_on(outputStream* st) const;
+  virtual void print_value_on(outputStream* st) const;
 
   // Print the comment associated with offset on stream, if there is one
   virtual void print_block_comment(outputStream* stream, address block_begin) {
@@ -209,8 +210,8 @@
   bool is_alive() const                          { return true; }
 
   void verify();
-  void print() const                             PRODUCT_RETURN;
-  void print_value_on(outputStream* st) const    PRODUCT_RETURN;
+  void print_on(outputStream* st) const;
+  void print_value_on(outputStream* st) const;
 };
 
 
@@ -219,8 +220,7 @@
 
 class AdapterBlob: public BufferBlob {
 private:
-  AdapterBlob(int size)                 : BufferBlob("I2C/C2I adapters", size) {}
-  AdapterBlob(int size, CodeBuffer* cb) : BufferBlob("I2C/C2I adapters", size, cb) {}
+  AdapterBlob(int size, CodeBuffer* cb);
 
 public:
   // Creation
@@ -293,8 +293,8 @@
   bool is_alive() const                          { return true; }
 
   void verify();
-  void print() const                             PRODUCT_RETURN;
-  void print_value_on(outputStream* st) const    PRODUCT_RETURN;
+  void print_on(outputStream* st) const;
+  void print_value_on(outputStream* st) const;
 };
 
 
@@ -318,8 +318,8 @@
    bool is_alive() const                         { return true; }
 
    void verify(); // does nothing
-   void print() const                            PRODUCT_RETURN;
-   void print_value_on(outputStream* st) const   PRODUCT_RETURN;
+   void print_on(outputStream* st) const;
+   void print_value_on(outputStream* st) const;
 };
 
 
@@ -374,7 +374,7 @@
   void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ }
 
   // Printing
-  void print_value_on(outputStream* st) const PRODUCT_RETURN;
+  void print_value_on(outputStream* st) const;
 
   address unpack() const                         { return instructions_begin() + _unpack_offset;           }
   address unpack_with_exception() const          { return instructions_begin() + _unpack_with_exception;   }
--- a/hotspot/src/share/vm/code/nmethod.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -65,6 +65,11 @@
   if (is_native_method()) return false;
   return compiler()->is_c2();
 }
+bool nmethod::is_compiled_by_shark() const {
+  if (is_native_method()) return false;
+  assert(compiler() != NULL, "must be");
+  return compiler()->is_shark();
+}
 
 
 
@@ -1353,6 +1358,10 @@
     CodeCache::remove_saved_code(this);
   }
 
+#ifdef SHARK
+  ((SharkCompiler *) compiler())->free_compiled_method(instructions_begin());
+#endif // SHARK
+
   ((CodeBlob*)(this))->flush();
 
   CodeCache::free(this);
@@ -1769,6 +1778,7 @@
 // Method that knows how to preserve outgoing arguments at call. This method must be
 // called with a frame corresponding to a Java invoke
 void nmethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) {
+#ifndef SHARK
   if (!method()->is_native()) {
     SimpleScopeDesc ssd(this, fr.pc());
     Bytecode_invoke* call = Bytecode_invoke_at(ssd.method(), ssd.bci());
@@ -1776,6 +1786,7 @@
     symbolOop signature = call->signature();
     fr.oops_compiled_arguments_do(signature, has_receiver, reg_map, f);
   }
+#endif // !SHARK
 }
 
 
@@ -2279,6 +2290,8 @@
     tty->print("(c1) ");
   } else if (is_compiled_by_c2()) {
     tty->print("(c2) ");
+  } else if (is_compiled_by_shark()) {
+    tty->print("(shark) ");
   } else {
     tty->print("(nm) ");
   }
@@ -2472,8 +2485,12 @@
   if (block_begin == exception_begin())         stream->print_cr("[Exception Handler]");
   if (block_begin == stub_begin())              stream->print_cr("[Stub Code]");
   if (block_begin == deopt_handler_begin())     stream->print_cr("[Deopt Handler Code]");
-  if (block_begin == deopt_mh_handler_begin())  stream->print_cr("[Deopt MH Handler Code]");
+
+  if (has_method_handle_invokes())
+    if (block_begin == deopt_mh_handler_begin())  stream->print_cr("[Deopt MH Handler Code]");
+
   if (block_begin == consts_begin())            stream->print_cr("[Constants]");
+
   if (block_begin == entry_point()) {
     methodHandle m = method();
     if (m.not_null()) {
--- a/hotspot/src/share/vm/code/nmethod.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/code/nmethod.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -329,6 +329,7 @@
 
   bool is_compiled_by_c1() const;
   bool is_compiled_by_c2() const;
+  bool is_compiled_by_shark() const;
 
   // boundaries for different parts
   address code_begin            () const          { return _entry_point; }
@@ -606,6 +607,8 @@
   void print_nul_chk_table()                      PRODUCT_RETURN;
   void print_nmethod(bool print_code);
 
+  // need to re-define this from CodeBlob else the overload hides it
+  virtual void print_on(outputStream* st) const { CodeBlob::print_on(st); }
   void print_on(outputStream* st, const char* title) const;
 
   // Logging
--- a/hotspot/src/share/vm/code/vtableStubs.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/code/vtableStubs.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -67,8 +67,8 @@
 }
 
 
-void VtableStub::print() {
-  tty->print("vtable stub (index = %d, receiver_location = %d, code = [" INTPTR_FORMAT ", " INTPTR_FORMAT "[)",
+void VtableStub::print_on(outputStream* st) const {
+  st->print("vtable stub (index = %d, receiver_location = %d, code = [" INTPTR_FORMAT ", " INTPTR_FORMAT "[)",
              index(), receiver_location(), code_begin(), code_end());
 }
 
--- a/hotspot/src/share/vm/code/vtableStubs.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/code/vtableStubs.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -86,7 +86,9 @@
   bool is_abstract_method_error(address epc)     { return epc == code_begin()+_ame_offset; }
   bool is_null_pointer_exception(address epc)    { return epc == code_begin()+_npe_offset; }
 
-  void print();
+  void print_on(outputStream* st) const;
+  void print() const                             { print_on(tty); }
+
 };
 
 
--- a/hotspot/src/share/vm/compiler/abstractCompiler.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/compiler/abstractCompiler.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,18 +45,26 @@
   // Missing feature tests
   virtual bool supports_native()                 { return true; }
   virtual bool supports_osr   ()                 { return true; }
-#if defined(TIERED) || ( !defined(COMPILER1) && !defined(COMPILER2))
+#if defined(TIERED) || ( !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK))
   virtual bool is_c1   ()                        { return false; }
   virtual bool is_c2   ()                        { return false; }
+  virtual bool is_shark()                        { return false; }
 #else
 #ifdef COMPILER1
   bool is_c1   ()                                { return true; }
   bool is_c2   ()                                { return false; }
+  bool is_shark()                                { return false; }
 #endif // COMPILER1
 #ifdef COMPILER2
   bool is_c1   ()                                { return false; }
   bool is_c2   ()                                { return true; }
+  bool is_shark()                                { return false; }
 #endif // COMPILER2
+#ifdef SHARK
+  bool is_c1   ()                                { return false; }
+  bool is_c2   ()                                { return false; }
+  bool is_shark()                                { return true; }
+#endif // SHARK
 #endif // TIERED
 
   // Customization
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -568,6 +568,14 @@
 #endif
 #endif // COMPILER2
 
+#ifdef SHARK
+#if defined(COMPILER1) || defined(COMPILER2)
+#error "Can't use COMPILER1 or COMPILER2 with shark"
+#endif
+  _compilers[0] = new SharkCompiler();
+  _compilers[1] = _compilers[0];
+#endif
+
   // Initialize the CompileTask free list
   _task_free_list = NULL;
 
--- a/hotspot/src/share/vm/compiler/disassembler.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/compiler/disassembler.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -371,7 +371,7 @@
 address decode_env::decode_instructions(address start, address end) {
   _start = start; _end = end;
 
-  assert((((intptr_t)start | (intptr_t)end) % Disassembler::pd_instruction_alignment() == 0), "misaligned insn addr");
+  assert(((((intptr_t)start | (intptr_t)end) % Disassembler::pd_instruction_alignment()) == 0), "misaligned insn addr");
 
   const int show_bytes = false; // for disassembler debugging
 
@@ -423,8 +423,14 @@
   env.output()->print_cr("Decoding compiled method " INTPTR_FORMAT ":", nm);
   env.output()->print_cr("Code:");
 
+#ifdef SHARK
+  SharkEntry* entry = (SharkEntry *) nm->instructions_begin();
+  unsigned char* p = entry->code_start();
+  unsigned char* end = entry->code_limit();
+#else
   unsigned char* p = nm->instructions_begin();
   unsigned char* end = nm->instructions_end();
+#endif // SHARK
 
   // If there has been profiling, print the buckets.
   if (FlatProfiler::bucket_start_for(p) != NULL) {
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -664,19 +664,14 @@
         return;
       }
 
-      // XXX use a global constant instead of 64!
-      typedef struct OopTaskQueuePadded {
-        OopTaskQueue work_queue;
-        char pad[64 - sizeof(OopTaskQueue)];  // prevent false sharing
-      } OopTaskQueuePadded;
-
+      typedef Padded<OopTaskQueue> PaddedOopTaskQueue;
       for (i = 0; i < num_queues; i++) {
-        OopTaskQueuePadded *q_padded = new OopTaskQueuePadded();
-        if (q_padded == NULL) {
+        PaddedOopTaskQueue *q = new PaddedOopTaskQueue();
+        if (q == NULL) {
           warning("work_queue allocation failure.");
           return;
         }
-        _task_queues->register_queue(i, &q_padded->work_queue);
+        _task_queues->register_queue(i, q);
       }
       for (i = 0; i < num_queues; i++) {
         _task_queues->queue(i)->initialize();
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -234,6 +234,11 @@
   GenCollectedHeap* gch = GenCollectedHeap::heap();
   if (_gc_cause != GCCause::_gc_locker &&
       gch->total_full_collections_completed() <= _full_gc_count_before) {
+    // maybe we should change the condition to test _gc_cause ==
+    // GCCause::_java_lang_system_gc, instead of
+    // _gc_cause != GCCause::_gc_locker
+    assert(_gc_cause == GCCause::_java_lang_system_gc,
+           "the only way to get here if this was a System.gc()-induced GC");
     assert(ExplicitGCInvokesConcurrent, "Error");
     // Now, wait for witnessing concurrent gc cycle to complete,
     // but do so in native mode, because we want to lock the
--- a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -158,13 +158,18 @@
   // The line below is the worst bit of C++ hackery I've ever written
   // (Detlefs, 11/23).  You should think of it as equivalent to
   // "_regions(100, true)": initialize the growable array and inform it
-  // that it should allocate its elem array(s) on the C heap.  The first
-  // argument, however, is actually a comma expression (new-expr, 100).
-  // The purpose of the new_expr is to inform the growable array that it
-  // is *already* allocated on the C heap: it uses the placement syntax to
-  // keep it from actually doing any allocation.
-  _markedRegions((ResourceObj::operator new (sizeof(GrowableArray<HeapRegion*>),
-                                             (void*)&_markedRegions,
+  // that it should allocate its elem array(s) on the C heap.
+  //
+  // The first argument, however, is actually a comma expression
+  // (set_allocation_type(this, C_HEAP), 100). The purpose of the
+  // set_allocation_type() call is to replace the default allocation
+  // type for embedded objects STACK_OR_EMBEDDED with C_HEAP. It will
+  // allow to pass the assert in GenericGrowableArray() which checks
+  // that a growable array object must be on C heap if elements are.
+  //
+  // Note: containing object is allocated on C heap since it is CHeapObj.
+  //
+  _markedRegions((ResourceObj::set_allocation_type((address)&_markedRegions,
                                              ResourceObj::C_HEAP),
                   100),
                  true),
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -271,21 +271,16 @@
     if (cas_res == prev_epoch_entry) {
       // We successfully updated the card num value in the epoch entry
       count_ptr->_count = 0; // initialize counter for new card num
+      jbyte* old_card_ptr = card_num_2_ptr(old_card_num);
 
       // Even though the region containg the card at old_card_num was not
       // in the young list when old_card_num was recorded in the epoch
       // cache it could have been added to the free list and subsequently
-      // added to the young list in the intervening time. If the evicted
-      // card is in a young region just return the card_ptr and the evicted
-      // card will not be cleaned. See CR 6817995.
-
-      jbyte* old_card_ptr = card_num_2_ptr(old_card_num);
-      if (is_young_card(old_card_ptr)) {
-        *count = 0;
-        // We can defer the processing of card_ptr
-        *defer = true;
-        return card_ptr;
-      }
+      // added to the young list in the intervening time. See CR 6817995.
+      // We do not deal with this case here - it will be handled in
+      // HeapRegion::oops_on_card_seq_iterate_careful after it has been
+      // determined that the region containing the card has been allocated
+      // to, and it's safe to check the young type of the region.
 
       // We do not want to defer processing of card_ptr in this case
       // (we need to refine old_card_ptr and card_ptr)
@@ -301,22 +296,22 @@
   jbyte* cached_ptr = add_card_count(card_ptr, &count, defer);
   assert(cached_ptr != NULL, "bad cached card ptr");
 
-  if (is_young_card(cached_ptr)) {
-    // The region containing cached_ptr has been freed during a clean up
-    // pause, reallocated, and tagged as young.
-    assert(cached_ptr != card_ptr, "shouldn't be");
+  // We've just inserted a card pointer into the card count cache
+  // and got back the card that we just inserted or (evicted) the
+  // previous contents of that count slot.
 
-    // We've just inserted a new old-gen card pointer into the card count
-    // cache and evicted the previous contents of that count slot.
-    // The evicted card pointer has been determined to be in a young region
-    // and so cannot be the newly inserted card pointer (that will be
-    // in an old region).
-    // The count for newly inserted card will be set to zero during the
-    // insertion, so we don't want to defer the cleaning of the newly
-    // inserted card pointer.
-    assert(*defer == false, "deferring non-hot card");
-    return NULL;
-  }
+  // The card we got back could be in a young region. When the
+  // returned card (if evicted) was originally inserted, we had
+  // determined that its containing region was not young. However
+  // it is possible for the region to be freed during a cleanup
+  // pause, then reallocated and tagged as young which will result
+  // in the returned card residing in a young region.
+  //
+  // We do not deal with this case here - the change from non-young
+  // to young could be observed at any time - it will be handled in
+  // HeapRegion::oops_on_card_seq_iterate_careful after it has been
+  // determined that the region containing the card has been allocated
+  // to.
 
   // The card pointer we obtained from card count cache is not hot
   // so do not store it in the cache; return it for immediate
@@ -325,7 +320,7 @@
     return cached_ptr;
   }
 
-  // Otherwise, the pointer we got from the _card_counts is hot.
+  // Otherwise, the pointer we got from the _card_counts cache is hot.
   jbyte* res = NULL;
   MutexLockerEx x(HotCardCache_lock, Mutex::_no_safepoint_check_flag);
   if (_n_hot == _hot_cache_size) {
@@ -338,17 +333,8 @@
   if (_hot_cache_idx == _hot_cache_size) _hot_cache_idx = 0;
   _n_hot++;
 
-  if (res != NULL) {
-    // Even though the region containg res was not in the young list
-    // when it was recorded in the hot cache it could have been added
-    // to the free list and subsequently added to the young list in
-    // the intervening time. If res is in a young region, return NULL
-    // so that res is not cleaned. See CR 6817995.
-
-    if (is_young_card(res)) {
-      res = NULL;
-    }
-  }
+  // The card obtained from the hot card cache could be in a young
+  // region. See above on how this can happen.
 
   return res;
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -266,6 +266,12 @@
       _cm->clearNextBitmap();
       _sts.leave();
     }
+
+    // Update the number of full collections that have been
+    // completed. This will also notify the FullGCCount_lock in case a
+    // Java thread is waiting for a full GC to happen (e.g., it
+    // called System.gc() with +ExplicitGCInvokesConcurrent).
+    g1->increment_full_collections_completed(true /* outer */);
   }
   assert(_should_terminate, "just checking");
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -638,6 +638,11 @@
 
     // Now retry the allocation.
     if (_cur_alloc_region != NULL) {
+      if (allocated_young_region != NULL) {
+        // We need to ensure that the store to top does not
+        // float above the setting of the young type.
+        OrderAccess::storestore();
+      }
       res = _cur_alloc_region->allocate(word_size);
     }
   }
@@ -809,7 +814,8 @@
   }
 };
 
-void G1CollectedHeap::do_collection(bool full, bool clear_all_soft_refs,
+void G1CollectedHeap::do_collection(bool explicit_gc,
+                                    bool clear_all_soft_refs,
                                     size_t word_size) {
   if (GC_locker::check_active_before_gc()) {
     return; // GC is disabled (e.g. JNI GetXXXCritical operation)
@@ -821,10 +827,6 @@
     Universe::print_heap_before_gc();
   }
 
-  if (full && DisableExplicitGC) {
-    return;
-  }
-
   assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
   assert(Thread::current() == VMThread::vm_thread(), "should be in vm thread");
 
@@ -837,9 +839,11 @@
     IsGCActiveMark x;
 
     // Timing
+    bool system_gc = (gc_cause() == GCCause::_java_lang_system_gc);
+    assert(!system_gc || explicit_gc, "invariant");
     gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
-    TraceTime t(full ? "Full GC (System.gc())" : "Full GC",
+    TraceTime t(system_gc ? "Full GC (System.gc())" : "Full GC",
                 PrintGC, true, gclog_or_tty);
 
     TraceMemoryManagerStats tms(true /* fullGC */);
@@ -944,7 +948,7 @@
     heap_region_iterate(&rs_clear);
 
     // Resize the heap if necessary.
-    resize_if_necessary_after_full_collection(full ? 0 : word_size);
+    resize_if_necessary_after_full_collection(explicit_gc ? 0 : word_size);
 
     if (_cg1r->use_cache()) {
       _cg1r->clear_and_record_card_counts();
@@ -1009,13 +1013,18 @@
             "young list should be empty at this point");
   }
 
+  // Update the number of full collections that have been completed.
+  increment_full_collections_completed(false /* outer */);
+
   if (PrintHeapAtGC) {
     Universe::print_heap_after_gc();
   }
 }
 
 void G1CollectedHeap::do_full_collection(bool clear_all_soft_refs) {
-  do_collection(true, clear_all_soft_refs, 0);
+  do_collection(true,                /* explicit_gc */
+                clear_all_soft_refs,
+                0                    /* word_size */);
 }
 
 // This code is mostly copied from TenuredGeneration.
@@ -1331,6 +1340,7 @@
   _young_list(new YoungList(this)),
   _gc_time_stamp(0),
   _surviving_young_words(NULL),
+  _full_collections_completed(0),
   _in_cset_fast_test(NULL),
   _in_cset_fast_test_base(NULL),
   _dirty_cards_region_list(NULL) {
@@ -1689,6 +1699,51 @@
   return car->free();
 }
 
+bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) {
+  return
+    ((cause == GCCause::_gc_locker           && GCLockerInvokesConcurrent) ||
+     (cause == GCCause::_java_lang_system_gc && ExplicitGCInvokesConcurrent));
+}
+
+void G1CollectedHeap::increment_full_collections_completed(bool outer) {
+  MonitorLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
+
+  // We have already incremented _total_full_collections at the start
+  // of the GC, so total_full_collections() represents how many full
+  // collections have been started.
+  unsigned int full_collections_started = total_full_collections();
+
+  // Given that this method is called at the end of a Full GC or of a
+  // concurrent cycle, and those can be nested (i.e., a Full GC can
+  // interrupt a concurrent cycle), the number of full collections
+  // completed should be either one (in the case where there was no
+  // nesting) or two (when a Full GC interrupted a concurrent cycle)
+  // behind the number of full collections started.
+
+  // This is the case for the inner caller, i.e. a Full GC.
+  assert(outer ||
+         (full_collections_started == _full_collections_completed + 1) ||
+         (full_collections_started == _full_collections_completed + 2),
+         err_msg("for inner caller: full_collections_started = %u "
+                 "is inconsistent with _full_collections_completed = %u",
+                 full_collections_started, _full_collections_completed));
+
+  // This is the case for the outer caller, i.e. the concurrent cycle.
+  assert(!outer ||
+         (full_collections_started == _full_collections_completed + 1),
+         err_msg("for outer caller: full_collections_started = %u "
+                 "is inconsistent with _full_collections_completed = %u",
+                 full_collections_started, _full_collections_completed));
+
+  _full_collections_completed += 1;
+
+  // This notify_all() will ensure that a thread that called
+  // System.gc() with (with ExplicitGCInvokesConcurrent set or not)
+  // and it's waiting for a full GC to finish will be woken up. It is
+  // waiting in VM_G1IncCollectionPause::doit_epilogue().
+  FullGCCount_lock->notify_all();
+}
+
 void G1CollectedHeap::collect_as_vm_thread(GCCause::Cause cause) {
   assert(Thread::current()->is_VM_thread(), "Precondition#1");
   assert(Heap_lock->is_locked(), "Precondition#2");
@@ -1709,25 +1764,41 @@
   // The caller doesn't have the Heap_lock
   assert(!Heap_lock->owned_by_self(), "this thread should not own the Heap_lock");
 
-  int gc_count_before;
+  unsigned int gc_count_before;
+  unsigned int full_gc_count_before;
   {
     MutexLocker ml(Heap_lock);
     // Read the GC count while holding the Heap_lock
     gc_count_before = SharedHeap::heap()->total_collections();
+    full_gc_count_before = SharedHeap::heap()->total_full_collections();
 
     // Don't want to do a GC until cleanup is completed.
     wait_for_cleanup_complete();
-  } // We give up heap lock; VMThread::execute gets it back below
-  switch (cause) {
-    case GCCause::_scavenge_alot: {
-      // Do an incremental pause, which might sometimes be abandoned.
-      VM_G1IncCollectionPause op(gc_count_before, cause);
+
+    // We give up heap lock; VMThread::execute gets it back below
+  }
+
+  if (should_do_concurrent_full_gc(cause)) {
+    // Schedule an initial-mark evacuation pause that will start a
+    // concurrent cycle.
+    VM_G1IncCollectionPause op(gc_count_before,
+                               true, /* should_initiate_conc_mark */
+                               g1_policy()->max_pause_time_ms(),
+                               cause);
+    VMThread::execute(&op);
+  } else {
+    if (cause == GCCause::_gc_locker
+        DEBUG_ONLY(|| cause == GCCause::_scavenge_alot)) {
+
+      // Schedule a standard evacuation pause.
+      VM_G1IncCollectionPause op(gc_count_before,
+                                 false, /* should_initiate_conc_mark */
+                                 g1_policy()->max_pause_time_ms(),
+                                 cause);
       VMThread::execute(&op);
-      break;
-    }
-    default: {
-      // In all other cases, we currently do a full gc.
-      VM_G1CollectFull op(gc_count_before, cause);
+    } else {
+      // Schedule a Full GC.
+      VM_G1CollectFull op(gc_count_before, full_gc_count_before, cause);
       VMThread::execute(&op);
     }
   }
@@ -1989,6 +2060,11 @@
 
 void G1CollectedHeap::collection_set_iterate_from(HeapRegion* r,
                                                   HeapRegionClosure *cl) {
+  if (r == NULL) {
+    // The CSet is empty so there's nothing to do.
+    return;
+  }
+
   assert(r->in_collection_set(),
          "Start region must be a member of the collection set.");
   HeapRegion* cur = r;
@@ -2481,11 +2557,13 @@
 }
 
 void G1CollectedHeap::do_collection_pause() {
+  assert(Heap_lock->owned_by_self(), "we assume we'reholding the Heap_lock");
+
   // Read the GC count while holding the Heap_lock
   // we need to do this _before_ wait_for_cleanup_complete(), to
   // ensure that we do not give up the heap lock and potentially
   // pick up the wrong count
-  int gc_count_before = SharedHeap::heap()->total_collections();
+  unsigned int gc_count_before = SharedHeap::heap()->total_collections();
 
   // Don't want to do a GC pause while cleanup is being completed!
   wait_for_cleanup_complete();
@@ -2493,7 +2571,10 @@
   g1_policy()->record_stop_world_start();
   {
     MutexUnlocker mu(Heap_lock);  // give up heap lock, execute gets it back
-    VM_G1IncCollectionPause op(gc_count_before);
+    VM_G1IncCollectionPause op(gc_count_before,
+                               false, /* should_initiate_conc_mark */
+                               g1_policy()->max_pause_time_ms(),
+                               GCCause::_g1_inc_collection_pause);
     VMThread::execute(&op);
   }
 }
@@ -2612,7 +2693,7 @@
 };
 
 void
-G1CollectedHeap::do_collection_pause_at_safepoint() {
+G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
   if (GC_locker::check_active_before_gc()) {
     return; // GC is disabled (e.g. JNI GetXXXCritical operation)
   }
@@ -2637,8 +2718,12 @@
       else
         strcat(verbose_str, "(partial)");
     }
-    if (g1_policy()->during_initial_mark_pause())
+    if (g1_policy()->during_initial_mark_pause()) {
       strcat(verbose_str, " (initial-mark)");
+      // We are about to start a marking cycle, so we increment the
+      // full collection counter.
+      increment_total_full_collections();
+    }
 
     // if PrintGCDetails is on, we'll print long statistics information
     // in the collector policy code, so let's not print this as the output
@@ -2661,7 +2746,6 @@
              "young list should be well formed");
     }
 
-    bool abandoned = false;
     { // Call to jvmpi::post_class_unload_events must occur outside of active GC
       IsGCActiveMark x;
 
@@ -2743,7 +2827,7 @@
 
       // Now choose the CS. We may abandon a pause if we find no
       // region that will fit in the MMU pause.
-      bool abandoned = g1_policy()->choose_collection_set();
+      bool abandoned = g1_policy()->choose_collection_set(target_pause_time_ms);
 
       // Nothing to do if we were unable to choose a collection set.
       if (!abandoned) {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -277,6 +277,18 @@
   void update_surviving_young_words(size_t* surv_young_words);
   void cleanup_surviving_young_words();
 
+  // It decides whether an explicit GC should start a concurrent cycle
+  // instead of doing a STW GC. Currently, a concurrent cycle is
+  // explicitly started if:
+  // (a) cause == _gc_locker and +GCLockerInvokesConcurrent, or
+  // (b) cause == _java_lang_system_gc and +ExplicitGCInvokesConcurrent.
+  bool should_do_concurrent_full_gc(GCCause::Cause cause);
+
+  // Keeps track of how many "full collections" (i.e., Full GCs or
+  // concurrent cycles) we have completed. The number of them we have
+  // started is maintained in _total_full_collections in CollectedHeap.
+  volatile unsigned int _full_collections_completed;
+
 protected:
 
   // Returns "true" iff none of the gc alloc regions have any allocations
@@ -356,13 +368,14 @@
   // GC pause.
   void  retire_alloc_region(HeapRegion* alloc_region, bool par);
 
-  // Helper function for two callbacks below.
-  // "full", if true, indicates that the GC is for a System.gc() request,
-  // and should collect the entire heap.  If "clear_all_soft_refs" is true,
-  // all soft references are cleared during the GC.  If "full" is false,
-  // "word_size" describes the allocation that the GC should
-  // attempt (at least) to satisfy.
-  void do_collection(bool full, bool clear_all_soft_refs,
+  // - if explicit_gc is true, the GC is for a System.gc() or a heap
+  // inspection request and should collect the entire heap
+  // - if clear_all_soft_refs is true, all soft references are cleared
+  // during the GC
+  // - if explicit_gc is false, word_size describes the allocation that
+  // the GC should attempt (at least) to satisfy
+  void do_collection(bool explicit_gc,
+                     bool clear_all_soft_refs,
                      size_t word_size);
 
   // Callback from VM_G1CollectFull operation.
@@ -431,6 +444,26 @@
         _in_cset_fast_test_length * sizeof(bool));
   }
 
+  // This is called at the end of either a concurrent cycle or a Full
+  // GC to update the number of full collections completed. Those two
+  // can happen in a nested fashion, i.e., we start a concurrent
+  // cycle, a Full GC happens half-way through it which ends first,
+  // and then the cycle notices that a Full GC happened and ends
+  // too. The outer parameter is a boolean to help us do a bit tighter
+  // consistency checking in the method. If outer is false, the caller
+  // is the inner caller in the nesting (i.e., the Full GC). If outer
+  // is true, the caller is the outer caller in this nesting (i.e.,
+  // the concurrent cycle). Further nesting is not currently
+  // supported. The end of the this call also notifies the
+  // FullGCCount_lock in case a Java thread is waiting for a full GC
+  // to happen (e.g., it called System.gc() with
+  // +ExplicitGCInvokesConcurrent).
+  void increment_full_collections_completed(bool outer);
+
+  unsigned int full_collections_completed() {
+    return _full_collections_completed;
+  }
+
 protected:
 
   // Shrink the garbage-first heap by at most the given size (in bytes!).
@@ -444,7 +477,7 @@
 
   // The guts of the incremental collection pause, executed by the vm
   // thread.
-  virtual void do_collection_pause_at_safepoint();
+  virtual void do_collection_pause_at_safepoint(double target_pause_time_ms);
 
   // Actually do the work of evacuating the collection set.
   virtual void evacuate_collection_set();
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -154,7 +154,6 @@
   _known_garbage_bytes(0),
 
   _young_gc_eff_seq(new TruncatedSeq(TruncatedSeqLength)),
-  _target_pause_time_ms(-1.0),
 
    _recent_prev_end_times_for_all_gcs_sec(new TruncatedSeq(NumPrevPausesForHeuristics)),
 
@@ -1635,8 +1634,6 @@
   double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0;
   adjust_concurrent_refinement(update_rs_time, update_rs_processed_buffers, update_rs_time_goal_ms);
   // </NEW PREDICTION>
-
-  _target_pause_time_ms = -1.0;
 }
 
 // <NEW PREDICTION>
@@ -2366,7 +2363,6 @@
     if (reached_target_length) {
       assert( young_list_length > 0 && _g1->young_list()->length() > 0,
               "invariant" );
-      _target_pause_time_ms = max_pause_time_ms;
       return true;
     }
   } else {
@@ -2398,6 +2394,17 @@
 }
 #endif
 
+bool
+G1CollectorPolicy::force_initial_mark_if_outside_cycle() {
+  bool during_cycle = _g1->concurrent_mark()->cmThread()->during_cycle();
+  if (!during_cycle) {
+    set_initiate_conc_mark_if_possible();
+    return true;
+  } else {
+    return false;
+  }
+}
+
 void
 G1CollectorPolicy::decide_on_conc_mark_initiation() {
   // We are about to decide on whether this pause will be an
@@ -2864,7 +2871,8 @@
 #endif // !PRODUCT
 
 bool
-G1CollectorPolicy_BestRegionsFirst::choose_collection_set() {
+G1CollectorPolicy_BestRegionsFirst::choose_collection_set(
+                                                  double target_pause_time_ms) {
   // Set this here - in case we're not doing young collections.
   double non_young_start_time_sec = os::elapsedTime();
 
@@ -2877,26 +2885,19 @@
 
   start_recording_regions();
 
-  guarantee(_target_pause_time_ms > -1.0
-            NOT_PRODUCT(|| Universe::heap()->gc_cause() == GCCause::_scavenge_alot),
-            "_target_pause_time_ms should have been set!");
-#ifndef PRODUCT
-  if (_target_pause_time_ms <= -1.0) {
-    assert(ScavengeALot && Universe::heap()->gc_cause() == GCCause::_scavenge_alot, "Error");
-    _target_pause_time_ms = _mmu_tracker->max_gc_time() * 1000.0;
-  }
-#endif
-  assert(_collection_set == NULL, "Precondition");
+  guarantee(target_pause_time_ms > 0.0,
+            err_msg("target_pause_time_ms = %1.6lf should be positive",
+                    target_pause_time_ms));
+  guarantee(_collection_set == NULL, "Precondition");
 
   double base_time_ms = predict_base_elapsed_time_ms(_pending_cards);
   double predicted_pause_time_ms = base_time_ms;
 
-  double target_time_ms = _target_pause_time_ms;
-  double time_remaining_ms = target_time_ms - base_time_ms;
+  double time_remaining_ms = target_pause_time_ms - base_time_ms;
 
   // the 10% and 50% values are arbitrary...
-  if (time_remaining_ms < 0.10*target_time_ms) {
-    time_remaining_ms = 0.50 * target_time_ms;
+  if (time_remaining_ms < 0.10 * target_pause_time_ms) {
+    time_remaining_ms = 0.50 * target_pause_time_ms;
     _within_target = false;
   } else {
     _within_target = true;
@@ -3059,7 +3060,18 @@
   _recorded_non_young_cset_choice_time_ms =
     (non_young_end_time_sec - non_young_start_time_sec) * 1000.0;
 
-  return abandon_collection;
+  // Here we are supposed to return whether the pause should be
+  // abandoned or not (i.e., whether the collection set is empty or
+  // not). However, this introduces a subtle issue when a pause is
+  // initiated explicitly with System.gc() and
+  // +ExplicitGCInvokesConcurrent (see Comment #2 in CR 6944166), it's
+  // supposed to start a marking cycle, and it's abandoned. So, by
+  // returning false here we are telling the caller never to consider
+  // a pause to be abandoned. We'll actually remove all the code
+  // associated with abandoned pauses as part of CR 6963209, but we are
+  // just disabling them this way for the moment to avoid increasing
+  // further the amount of changes for CR 6944166.
+  return false;
 }
 
 void G1CollectorPolicy_BestRegionsFirst::record_full_collection_end() {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -199,8 +199,6 @@
   size_t _young_cset_length;
   bool   _last_young_gc_full;
 
-  double _target_pause_time_ms;
-
   unsigned              _full_young_pause_num;
   unsigned              _partial_young_pause_num;
 
@@ -526,6 +524,10 @@
     return _mmu_tracker;
   }
 
+  double max_pause_time_ms() {
+    return _mmu_tracker->max_gc_time() * 1000.0;
+  }
+
   double predict_init_time_ms() {
     return get_new_prediction(_concurrent_mark_init_times_ms);
   }
@@ -1008,7 +1010,7 @@
   // Choose a new collection set.  Marks the chosen regions as being
   // "in_collection_set", and links them together.  The head and number of
   // the collection set are available via access methods.
-  virtual bool choose_collection_set() = 0;
+  virtual bool choose_collection_set(double target_pause_time_ms) = 0;
 
   // The head of the list (via "next_in_collection_set()") representing the
   // current collection set.
@@ -1077,6 +1079,12 @@
   void set_during_initial_mark_pause()  { _during_initial_mark_pause = true;  }
   void clear_during_initial_mark_pause(){ _during_initial_mark_pause = false; }
 
+  // This sets the initiate_conc_mark_if_possible() flag to start a
+  // new cycle, as long as we are not already in one. It's best if it
+  // is called during a safepoint when the test whether a cycle is in
+  // progress or not is stable.
+  bool force_initial_mark_if_outside_cycle();
+
   // This is called at the very beginning of an evacuation pause (it
   // has to be the first thing that the pause does). If
   // initiate_conc_mark_if_possible() is true, and the concurrent
@@ -1259,7 +1267,7 @@
   // If the estimated is less then desirable, resize if possible.
   void expand_if_possible(size_t numRegions);
 
-  virtual bool choose_collection_set();
+  virtual bool choose_collection_set(double target_pause_time_ms);
   virtual void record_collection_pause_start(double start_time_sec,
                                              size_t start_used);
   virtual void record_concurrent_mark_cleanup_end(size_t freed_bytes,
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -676,9 +676,27 @@
   // We must complete this write before we do any of the reads below.
   OrderAccess::storeload();
   // And process it, being careful of unallocated portions of TLAB's.
+
+  // The region for the current card may be a young region. The
+  // current card may have been a card that was evicted from the
+  // card cache. When the card was inserted into the cache, we had
+  // determined that its region was non-young. While in the cache,
+  // the region may have been freed during a cleanup pause, reallocated
+  // and tagged as young.
+  //
+  // We wish to filter out cards for such a region but the current
+  // thread, if we're running conucrrently, may "see" the young type
+  // change at any time (so an earlier "is_young" check may pass or
+  // fail arbitrarily). We tell the iteration code to perform this
+  // filtering when it has been determined that there has been an actual
+  // allocation in this region and making it safe to check the young type.
+  bool filter_young = true;
+
   HeapWord* stop_point =
     r->oops_on_card_seq_iterate_careful(dirtyRegion,
-                                        &filter_then_update_rs_oop_cl);
+                                        &filter_then_update_rs_oop_cl,
+                                        filter_young);
+
   // If stop_point is non-null, then we encountered an unallocated region
   // (perhaps the unfilled portion of a TLAB.)  For now, we'll dirty the
   // card and re-enqueue: if we put off the card until a GC pause, then the
@@ -789,8 +807,14 @@
       if (r == NULL) {
         assert(_g1->is_in_permanent(start), "Or else where?");
       } else {
-        guarantee(!r->is_young(), "It was evicted in the current minor cycle.");
-        // Process card pointer we get back from the hot card cache
+        // Checking whether the region we got back from the cache
+        // is young here is inappropriate. The region could have been
+        // freed, reallocated and tagged as young while in the cache.
+        // Hence we could see its young type change at any time.
+        //
+        // Process card pointer we get back from the hot card cache. This
+        // will check whether the region containing the card is young
+        // _after_ checking that the region has been allocated from.
         concurrentRefineOneCard_impl(res, worker_i);
       }
     }
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -658,7 +658,8 @@
 HeapWord*
 HeapRegion::
 oops_on_card_seq_iterate_careful(MemRegion mr,
-                                     FilterOutOfRegionClosure* cl) {
+                                 FilterOutOfRegionClosure* cl,
+                                 bool filter_young) {
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 
   // If we're within a stop-world GC, then we might look at a card in a
@@ -672,6 +673,16 @@
   if (mr.is_empty()) return NULL;
   // Otherwise, find the obj that extends onto mr.start().
 
+  // The intersection of the incoming mr (for the card) and the
+  // allocated part of the region is non-empty. This implies that
+  // we have actually allocated into this region. The code in
+  // G1CollectedHeap.cpp that allocates a new region sets the
+  // is_young tag on the region before allocating. Thus we
+  // safely know if this region is young.
+  if (is_young() && filter_young) {
+    return NULL;
+  }
+
   // We used to use "block_start_careful" here.  But we're actually happy
   // to update the BOT while we do this...
   HeapWord* cur = block_start(mr.start());
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -252,7 +252,7 @@
                                 // survivor
   };
 
-  YoungType _young_type;
+  volatile YoungType _young_type;
   int  _young_index_in_cset;
   SurvRateGroup* _surv_rate_group;
   int  _age_index;
@@ -726,9 +726,12 @@
   HeapWord*
   object_iterate_mem_careful(MemRegion mr, ObjectClosure* cl);
 
+  // In this version - if filter_young is true and the region
+  // is a young region then we skip the iteration.
   HeapWord*
   oops_on_card_seq_iterate_careful(MemRegion mr,
-                                   FilterOutOfRegionClosure* cl);
+                                   FilterOutOfRegionClosure* cl,
+                                   bool filter_young);
 
   // The region "mr" is entirely in "this", and starts and ends at block
   // boundaries. The caller declares that all the contained blocks are
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -42,14 +42,19 @@
   // The line below is the worst bit of C++ hackery I've ever written
   // (Detlefs, 11/23).  You should think of it as equivalent to
   // "_regions(100, true)": initialize the growable array and inform it
-  // that it should allocate its elem array(s) on the C heap.  The first
-  // argument, however, is actually a comma expression (new-expr, 100).
-  // The purpose of the new_expr is to inform the growable array that it
-  // is *already* allocated on the C heap: it uses the placement syntax to
-  // keep it from actually doing any allocation.
-  _regions((ResourceObj::operator new (sizeof(GrowableArray<HeapRegion*>),
-                                       (void*)&_regions,
-                                       ResourceObj::C_HEAP),
+  // that it should allocate its elem array(s) on the C heap.
+  //
+  // The first argument, however, is actually a comma expression
+  // (set_allocation_type(this, C_HEAP), 100). The purpose of the
+  // set_allocation_type() call is to replace the default allocation
+  // type for embedded objects STACK_OR_EMBEDDED with C_HEAP. It will
+  // allow to pass the assert in GenericGrowableArray() which checks
+  // that a growable array object must be on C heap if elements are.
+  //
+  // Note: containing object is allocated on C heap since it is CHeapObj.
+  //
+  _regions((ResourceObj::set_allocation_type((address)&_regions,
+                                             ResourceObj::C_HEAP),
             (int)max_size),
            true),
   _next_rr_candidate(0),
--- a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -42,8 +42,65 @@
 void VM_G1IncCollectionPause::doit() {
   JvmtiGCForAllocationMarker jgcm;
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
+  assert(!_should_initiate_conc_mark ||
+  ((_gc_cause == GCCause::_gc_locker && GCLockerInvokesConcurrent) ||
+   (_gc_cause == GCCause::_java_lang_system_gc && ExplicitGCInvokesConcurrent)),
+         "only a GC locker or a System.gc() induced GC should start a cycle");
+
   GCCauseSetter x(g1h, _gc_cause);
-  g1h->do_collection_pause_at_safepoint();
+  if (_should_initiate_conc_mark) {
+    // It's safer to read full_collections_completed() here, given
+    // that noone else will be updating it concurrently. Since we'll
+    // only need it if we're initiating a marking cycle, no point in
+    // setting it earlier.
+    _full_collections_completed_before = g1h->full_collections_completed();
+
+    // At this point we are supposed to start a concurrent cycle. We
+    // will do so if one is not already in progress.
+    bool res = g1h->g1_policy()->force_initial_mark_if_outside_cycle();
+  }
+  g1h->do_collection_pause_at_safepoint(_target_pause_time_ms);
+}
+
+void VM_G1IncCollectionPause::doit_epilogue() {
+  VM_GC_Operation::doit_epilogue();
+
+  // If the pause was initiated by a System.gc() and
+  // +ExplicitGCInvokesConcurrent, we have to wait here for the cycle
+  // that just started (or maybe one that was already in progress) to
+  // finish.
+  if (_gc_cause == GCCause::_java_lang_system_gc &&
+      _should_initiate_conc_mark) {
+    assert(ExplicitGCInvokesConcurrent,
+           "the only way to be here is if ExplicitGCInvokesConcurrent is set");
+
+    G1CollectedHeap* g1h = G1CollectedHeap::heap();
+
+    // In the doit() method we saved g1h->full_collections_completed()
+    // in the _full_collections_completed_before field. We have to
+    // wait until we observe that g1h->full_collections_completed()
+    // has increased by at least one. This can happen if a) we started
+    // a cycle and it completes, b) a cycle already in progress
+    // completes, or c) a Full GC happens.
+
+    // If the condition has already been reached, there's no point in
+    // actually taking the lock and doing the wait.
+    if (g1h->full_collections_completed() <=
+                                          _full_collections_completed_before) {
+      // The following is largely copied from CMS
+
+      Thread* thr = Thread::current();
+      assert(thr->is_Java_thread(), "invariant");
+      JavaThread* jt = (JavaThread*)thr;
+      ThreadToNativeFromVM native(jt);
+
+      MutexLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
+      while (g1h->full_collections_completed() <=
+                                          _full_collections_completed_before) {
+        FullGCCount_lock->wait(Mutex::_no_safepoint_check_flag);
+      }
+    }
+  }
 }
 
 void VM_CGC_Operation::doit() {
--- a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -31,13 +31,12 @@
 //   - VM_G1PopRegionCollectionPause
 
 class VM_G1CollectFull: public VM_GC_Operation {
- private:
  public:
-  VM_G1CollectFull(int gc_count_before,
-                   GCCause::Cause gc_cause)
-    : VM_GC_Operation(gc_count_before)
-  {
-    _gc_cause = gc_cause;
+  VM_G1CollectFull(unsigned int gc_count_before,
+                   unsigned int full_gc_count_before,
+                   GCCause::Cause cause)
+    : VM_GC_Operation(gc_count_before, full_gc_count_before) {
+    _gc_cause = cause;
   }
   ~VM_G1CollectFull() {}
   virtual VMOp_Type type() const { return VMOp_G1CollectFull; }
@@ -67,12 +66,28 @@
 };
 
 class VM_G1IncCollectionPause: public VM_GC_Operation {
- public:
-  VM_G1IncCollectionPause(int gc_count_before,
-                          GCCause::Cause gc_cause = GCCause::_g1_inc_collection_pause) :
-    VM_GC_Operation(gc_count_before) { _gc_cause = gc_cause; }
+private:
+  bool _should_initiate_conc_mark;
+  double _target_pause_time_ms;
+  unsigned int _full_collections_completed_before;
+public:
+  VM_G1IncCollectionPause(unsigned int   gc_count_before,
+                          bool           should_initiate_conc_mark,
+                          double         target_pause_time_ms,
+                          GCCause::Cause cause)
+    : VM_GC_Operation(gc_count_before),
+      _full_collections_completed_before(0),
+      _should_initiate_conc_mark(should_initiate_conc_mark),
+      _target_pause_time_ms(target_pause_time_ms) {
+    guarantee(target_pause_time_ms > 0.0,
+              err_msg("target_pause_time_ms = %1.6lf should be positive",
+                      target_pause_time_ms));
+
+    _gc_cause = cause;
+  }
   virtual VMOp_Type type() const { return VMOp_G1IncCollectionPause; }
   virtual void doit();
+  virtual void doit_epilogue();
   virtual const char* name() const {
     return "garbage-first incremental collection pause";
   }
--- a/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1	Fri Aug 20 14:48:10 2010 -0400
@@ -367,4 +367,6 @@
 
 vm_operations_g1.cpp			vm_operations_g1.hpp
 vm_operations_g1.cpp                    g1CollectedHeap.inline.hpp
+vm_operations_g1.cpp                    g1CollectorPolicy.hpp
+vm_operations_g1.cpp                    interfaceSupport.hpp
 vm_operations_g1.cpp                    isGCActiveMark.hpp
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -539,10 +539,9 @@
   guarantee(_task_queues != NULL, "task_queues allocation failure.");
 
   for (uint i1 = 0; i1 < ParallelGCThreads; i1++) {
-    ObjToScanQueuePadded *q_padded = new ObjToScanQueuePadded();
-    guarantee(q_padded != NULL, "work_queue Allocation failure.");
-
-    _task_queues->register_queue(i1, &q_padded->work_queue);
+    ObjToScanQueue *q = new ObjToScanQueue();
+    guarantee(q != NULL, "work_queue Allocation failure.");
+    _task_queues->register_queue(i1, q);
   }
 
   for (uint i2 = 0; i2 < ParallelGCThreads; i2++)
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,8 +33,8 @@
 // but they must be here to allow ParScanClosure::do_oop_work to be defined
 // in genOopClosures.inline.hpp.
 
-typedef OopTaskQueue       ObjToScanQueue;
-typedef OopTaskQueueSet    ObjToScanQueueSet;
+typedef Padded<OopTaskQueue> ObjToScanQueue;
+typedef GenericTaskQueueSet<ObjToScanQueue> ObjToScanQueueSet;
 
 // Enable this to get push/pop/steal stats.
 const int PAR_STATS_ENABLED = 0;
@@ -304,12 +304,6 @@
   friend class ParEvacuateFollowersClosure;
 
  private:
-  // XXX use a global constant instead of 64!
-  struct ObjToScanQueuePadded {
-        ObjToScanQueue work_queue;
-        char pad[64 - sizeof(ObjToScanQueue)];  // prevent false sharing
-  };
-
   // The per-worker-thread work queues
   ObjToScanQueueSet* _task_queues;
 
--- a/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -26,7 +26,8 @@
 
 class ParScanThreadState;
 class ParNewGeneration;
-typedef OopTaskQueueSet ObjToScanQueueSet;
+typedef Padded<OopTaskQueue> ObjToScanQueue;
+typedef GenericTaskQueueSet<ObjToScanQueue> ObjToScanQueueSet;
 class ParallelTaskTerminator;
 
 class ParScanClosure: public OopsInGenClosure {
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -90,10 +90,7 @@
 }
 
 void PSPromotionManager::post_scavenge() {
-#if PS_PM_STATS
-  print_stats();
-#endif // PS_PM_STATS
-
+  TASKQUEUE_STATS_ONLY(if (PrintGCDetails && ParallelGCVerbose) print_stats());
   for (uint i = 0; i < ParallelGCThreads + 1; i++) {
     PSPromotionManager* manager = manager_array(i);
     if (UseDepthFirstScavengeOrder) {
@@ -105,37 +102,58 @@
   }
 }
 
-#if PS_PM_STATS
-
+#if TASKQUEUE_STATS
 void
-PSPromotionManager::print_stats(uint i) {
-  tty->print_cr("---- GC Worker %2d Stats", i);
-  tty->print_cr("    total pushes            %8d", _total_pushes);
-  tty->print_cr("    masked pushes           %8d", _masked_pushes);
-  tty->print_cr("    overflow pushes         %8d", _overflow_pushes);
-  tty->print_cr("    max overflow length     %8d", _max_overflow_length);
-  tty->print_cr("");
-  tty->print_cr("    arrays chunked          %8d", _arrays_chunked);
-  tty->print_cr("    array chunks processed  %8d", _array_chunks_processed);
-  tty->print_cr("");
-  tty->print_cr("    total steals            %8d", _total_steals);
-  tty->print_cr("    masked steals           %8d", _masked_steals);
-  tty->print_cr("");
+PSPromotionManager::print_taskqueue_stats(uint i) const {
+  const TaskQueueStats& stats = depth_first() ?
+    _claimed_stack_depth.stats : _claimed_stack_breadth.stats;
+  tty->print("%3u ", i);
+  stats.print();
+  tty->cr();
 }
 
 void
+PSPromotionManager::print_local_stats(uint i) const {
+  #define FMT " " SIZE_FORMAT_W(10)
+  tty->print_cr("%3u" FMT FMT FMT FMT, i, _masked_pushes, _masked_steals,
+                _arrays_chunked, _array_chunks_processed);
+  #undef FMT
+}
+
+static const char* const pm_stats_hdr[] = {
+  "    --------masked-------     arrays      array",
+  "thr       push      steal    chunked     chunks",
+  "--- ---------- ---------- ---------- ----------"
+};
+
+void
 PSPromotionManager::print_stats() {
-  tty->print_cr("== GC Tasks Stats (%s), GC %3d",
-                (UseDepthFirstScavengeOrder) ? "Depth-First" : "Breadth-First",
+  const bool df = UseDepthFirstScavengeOrder;
+  tty->print_cr("== GC Task Stats (%s-First), GC %3d", df ? "Depth" : "Breadth",
                 Universe::heap()->total_collections());
 
-  for (uint i = 0; i < ParallelGCThreads+1; ++i) {
-    PSPromotionManager* manager = manager_array(i);
-    manager->print_stats(i);
+  tty->print("thr "); TaskQueueStats::print_header(1); tty->cr();
+  tty->print("--- "); TaskQueueStats::print_header(2); tty->cr();
+  for (uint i = 0; i < ParallelGCThreads + 1; ++i) {
+    manager_array(i)->print_taskqueue_stats(i);
+  }
+
+  const uint hlines = sizeof(pm_stats_hdr) / sizeof(pm_stats_hdr[0]);
+  for (uint i = 0; i < hlines; ++i) tty->print_cr(pm_stats_hdr[i]);
+  for (uint i = 0; i < ParallelGCThreads + 1; ++i) {
+    manager_array(i)->print_local_stats(i);
   }
 }
 
-#endif // PS_PM_STATS
+void
+PSPromotionManager::reset_stats() {
+  TaskQueueStats& stats = depth_first() ?
+    claimed_stack_depth()->stats : claimed_stack_breadth()->stats;
+  stats.reset();
+  _masked_pushes = _masked_steals = 0;
+  _arrays_chunked = _array_chunks_processed = 0;
+}
+#endif // TASKQUEUE_STATS
 
 PSPromotionManager::PSPromotionManager() {
   ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
@@ -189,16 +207,7 @@
 
   _prefetch_queue.clear();
 
-#if PS_PM_STATS
-  _total_pushes = 0;
-  _masked_pushes = 0;
-  _overflow_pushes = 0;
-  _max_overflow_length = 0;
-  _arrays_chunked = 0;
-  _array_chunks_processed = 0;
-  _total_steals = 0;
-  _masked_steals = 0;
-#endif // PS_PM_STATS
+  TASKQUEUE_STATS_ONLY(reset_stats());
 }
 
 
@@ -423,14 +432,9 @@
             new_obj->is_objArray() &&
             PSChunkLargeArrays) {
           // we'll chunk it
-#if PS_PM_STATS
-          ++_arrays_chunked;
-#endif // PS_PM_STATS
           oop* const masked_o = mask_chunked_array_oop(o);
           push_depth(masked_o);
-#if PS_PM_STATS
-          ++_masked_pushes;
-#endif // PS_PM_STATS
+          TASKQUEUE_STATS_ONLY(++_arrays_chunked; ++_masked_pushes);
         } else {
           // we'll just push its contents
           new_obj->push_contents(this);
@@ -494,9 +498,7 @@
   assert(old->is_objArray(), "invariant");
   assert(old->is_forwarded(), "invariant");
 
-#if PS_PM_STATS
-  ++_array_chunks_processed;
-#endif // PS_PM_STATS
+  TASKQUEUE_STATS_ONLY(++_array_chunks_processed);
 
   oop const obj = old->forwardee();
 
@@ -508,9 +510,7 @@
     assert(start > 0, "invariant");
     arrayOop(old)->set_length(start);
     push_depth(mask_chunked_array_oop(old));
-#if PS_PM_STATS
-    ++_masked_pushes;
-#endif // PS_PM_STATS
+    TASKQUEUE_STATS_ONLY(++_masked_pushes);
   } else {
     // this is the final chunk for this array
     start = 0;
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -42,8 +42,6 @@
 class PSOldGen;
 class ParCompactionManager;
 
-#define PS_PM_STATS         0
-
 class PSPromotionManager : public CHeapObj {
   friend class PSScavenge;
   friend class PSRefProcTaskExecutor;
@@ -54,22 +52,18 @@
   static PSOldGen*                    _old_gen;
   static MutableSpace*                _young_space;
 
-#if PS_PM_STATS
-  uint                                _total_pushes;
-  uint                                _masked_pushes;
-
-  uint                                _overflow_pushes;
-  uint                                _max_overflow_length;
+#if TASKQUEUE_STATS
+  size_t                              _masked_pushes;
+  size_t                              _masked_steals;
+  size_t                              _arrays_chunked;
+  size_t                              _array_chunks_processed;
 
-  uint                                _arrays_chunked;
-  uint                                _array_chunks_processed;
+  void print_taskqueue_stats(uint i) const;
+  void print_local_stats(uint i) const;
+  static void print_stats();
 
-  uint                                _total_steals;
-  uint                                _masked_steals;
-
-  void print_stats(uint i);
-  static void print_stats();
-#endif // PS_PM_STATS
+  void reset_stats();
+#endif // TASKQUEUE_STATS
 
   PSYoungPromotionLAB                 _young_lab;
   PSOldPromotionLAB                   _old_lab;
@@ -143,42 +137,12 @@
 
   template <class T> void push_depth(T* p) {
     assert(depth_first(), "pre-condition");
-
-#if PS_PM_STATS
-    ++_total_pushes;
-    int stack_length = claimed_stack_depth()->overflow_stack()->length();
-#endif // PS_PM_STATS
-
     claimed_stack_depth()->push(p);
-
-#if PS_PM_STATS
-    if (claimed_stack_depth()->overflow_stack()->length() != stack_length) {
-      ++_overflow_pushes;
-      if ((uint)stack_length + 1 > _max_overflow_length) {
-        _max_overflow_length = (uint)stack_length + 1;
-      }
-    }
-#endif // PS_PM_STATS
   }
 
   void push_breadth(oop o) {
     assert(!depth_first(), "pre-condition");
-
-#if PS_PM_STATS
-    ++_total_pushes;
-    int stack_length = claimed_stack_breadth()->overflow_stack()->length();
-#endif // PS_PM_STATS
-
     claimed_stack_breadth()->push(o);
-
-#if PS_PM_STATS
-    if (claimed_stack_breadth()->overflow_stack()->length() != stack_length) {
-      ++_overflow_pushes;
-      if ((uint)stack_length + 1 > _max_overflow_length) {
-        _max_overflow_length = (uint)stack_length + 1;
-      }
-    }
-#endif // PS_PM_STATS
   }
 
  protected:
@@ -256,12 +220,5 @@
   template <class T> inline void claim_or_forward_depth(T* p);
   template <class T> inline void claim_or_forward_breadth(T* p);
 
-#if PS_PM_STATS
-  void increment_steals(oop* p = NULL) {
-    _total_steals += 1;
-    if (p != NULL && is_oop_masked(p)) {
-      _masked_steals += 1;
-    }
-  }
-#endif // PS_PM_STATS
+  TASKQUEUE_STATS_ONLY(inline void record_steal(StarTask& p);)
 };
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -124,3 +124,11 @@
     }
   }
 }
+
+#if TASKQUEUE_STATS
+void PSPromotionManager::record_steal(StarTask& p) {
+  if (is_oop_masked(p)) {
+    ++_masked_steals;
+  }
+}
+#endif // TASKQUEUE_STATS
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -148,9 +148,7 @@
     while(true) {
       StarTask p;
       if (PSPromotionManager::steal_depth(which, &random_seed, p)) {
-#if PS_PM_STATS
-        pm->increment_steals(p);
-#endif // PS_PM_STATS
+        TASKQUEUE_STATS_ONLY(pm->record_steal(p));
         pm->process_popped_location_depth(p);
         pm->drain_stacks_depth(true);
       } else {
@@ -163,9 +161,6 @@
     while(true) {
       oop obj;
       if (PSPromotionManager::steal_breadth(which, &random_seed, obj)) {
-#if PS_PM_STATS
-        pm->increment_steals();
-#endif // PS_PM_STATS
         obj->copy_contents(pm);
         pm->drain_stacks_breadth(true);
       } else {
--- a/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -86,9 +86,7 @@
 
     _gc_locked = false;
 
-    if (full) {
-      _full_gc_count_before = full_gc_count_before;
-    }
+    _full_gc_count_before = full_gc_count_before;
     // In ParallelScavengeHeap::mem_allocate() collections can be
     // executed within a loop and _all_soft_refs_clear can be set
     // true after they have been cleared by a collection and another
--- a/hotspot/src/share/vm/gc_interface/gcCause.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/gc_interface/gcCause.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -78,6 +78,9 @@
     case _old_generation_too_full_to_scavenge:
       return "Old Generation Too Full To Scavenge";
 
+    case _g1_inc_collection_pause:
+      return "G1 Evacuation Pause";
+
     case _last_ditch_collection:
       return "Last ditch collection";
 
--- a/hotspot/src/share/vm/includeDB_compiler1	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/includeDB_compiler1	Fri Aug 20 14:48:10 2010 -0400
@@ -252,6 +252,7 @@
 c1_LIRGenerator.cpp                     ciInstance.hpp
 c1_LIRGenerator.cpp                     heapRegion.hpp
 c1_LIRGenerator.cpp                     sharedRuntime.hpp
+c1_LIRGenerator.cpp                     stubRoutines.hpp
 
 c1_LIRGenerator.hpp                     c1_Instruction.hpp
 c1_LIRGenerator.hpp                     c1_LIR.hpp
@@ -270,6 +271,8 @@
 c1_LIRGenerator_<arch>.cpp             ciTypeArrayKlass.hpp
 c1_LIRGenerator_<arch>.cpp             sharedRuntime.hpp
 c1_LIRGenerator_<arch>.cpp             vmreg_<arch>.inline.hpp
+c1_LIRGenerator_<arch>.cpp             stubRoutines.hpp
+
 
 c1_LinearScan.cpp                       bitMap.inline.hpp
 c1_LinearScan.cpp                       c1_CFGPrinter.hpp
@@ -413,6 +416,7 @@
 compileBroker.cpp                       c1_Compiler.hpp
 
 frame_<arch>.cpp                        c1_Runtime1.hpp
+frame_<arch>.cpp                        vframeArray.hpp
 
 globals.cpp                             c1_globals.hpp
 
--- a/hotspot/src/share/vm/includeDB_compiler2	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/includeDB_compiler2	Fri Aug 20 14:48:10 2010 -0400
@@ -911,6 +911,7 @@
 reg_split.cpp                           addnode.hpp
 reg_split.cpp                           allocation.inline.hpp
 reg_split.cpp                           callnode.hpp
+reg_split.cpp                           c2compiler.hpp
 reg_split.cpp                           cfgnode.hpp
 reg_split.cpp                           chaitin.hpp
 reg_split.cpp                           loopnode.hpp
--- a/hotspot/src/share/vm/includeDB_core	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/includeDB_core	Fri Aug 20 14:48:10 2010 -0400
@@ -284,6 +284,7 @@
 atomic_<os_arch>.inline.hpp             atomic.hpp
 atomic_<os_arch>.inline.hpp             os.hpp
 atomic_<os_arch>.inline.hpp             vm_version_<arch>.hpp
+atomic_<os_arch>.inline.hpp             orderAccess_<os_arch>.inline.hpp
 
 // attachListener is jck optional, put cpp deps in includeDB_features
 
@@ -1734,6 +1735,7 @@
 genCollectedHeap.cpp                    space.hpp
 genCollectedHeap.cpp                    symbolTable.hpp
 genCollectedHeap.cpp                    systemDictionary.hpp
+genCollectedHeap.cpp                    vmError.hpp
 genCollectedHeap.cpp                    vmGCOperations.hpp
 genCollectedHeap.cpp                    vmSymbols.hpp
 genCollectedHeap.cpp                    vmThread.hpp
@@ -3230,6 +3232,7 @@
 os.cpp                                  events.hpp
 os.cpp                                  frame.inline.hpp
 os.cpp                                  hpi.hpp
+os.cpp					icBuffer.hpp
 os.cpp                                  interfaceSupport.hpp
 os.cpp                                  interpreter.hpp
 os.cpp                                  java.hpp
@@ -3241,6 +3244,7 @@
 os.cpp                                  oop.inline.hpp
 os.cpp                                  os.hpp
 os.cpp                                  os_<os_family>.inline.hpp
+os.cpp	                                privilegedStack.hpp
 os.cpp                                  stubRoutines.hpp
 os.cpp                                  systemDictionary.hpp
 os.cpp                                  threadService.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/includeDB_shark	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,371 @@
+//
+// Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+// Copyright 2008, 2009, 2010 Red Hat, Inc.
+// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+//
+// This code is free software; you can redistribute 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.
+//
+//
+
+// NOTE: DO NOT CHANGE THIS COPYRIGHT TO NEW STYLE - IT WILL BREAK makeDeps!
+
+ciMethod.cpp                            ciTypeFlow.hpp
+ciMethod.cpp                            methodOop.hpp
+
+ciTypeFlow.cpp                          allocation.inline.hpp
+ciTypeFlow.cpp                          bytecode.hpp
+ciTypeFlow.cpp                          bytecodes.hpp
+ciTypeFlow.cpp                          ciConstant.hpp
+ciTypeFlow.cpp                          ciField.hpp
+ciTypeFlow.cpp                          ciMethod.hpp
+ciTypeFlow.cpp                          ciMethodData.hpp
+ciTypeFlow.cpp                          ciObjArrayKlass.hpp
+ciTypeFlow.cpp                          ciStreams.hpp
+ciTypeFlow.cpp                          ciTypeArrayKlass.hpp
+ciTypeFlow.cpp                          ciTypeFlow.hpp
+ciTypeFlow.cpp                          compileLog.hpp
+ciTypeFlow.cpp                          deoptimization.hpp
+ciTypeFlow.cpp                          growableArray.hpp
+ciTypeFlow.cpp                          shark_globals.hpp
+
+ciTypeFlow.hpp                          ciEnv.hpp
+ciTypeFlow.hpp                          ciKlass.hpp
+ciTypeFlow.hpp                          ciMethodBlocks.hpp
+
+cppInterpreter_<arch>.cpp               shark_globals.hpp
+
+compileBroker.cpp                       sharkCompiler.hpp
+
+disassembler.cpp                        sharkEntry.hpp
+
+globals.hpp                             shark_globals_<arch>.hpp
+
+globals.cpp                             shark_globals.hpp
+
+llvmValue.hpp                           llvmHeaders.hpp
+llvmValue.hpp                           sharkContext.hpp
+llvmValue.hpp                           sharkType.hpp
+
+nmethod.cpp                             sharkCompiler.hpp
+
+sharedRuntime_<arch>.cpp                compileBroker.hpp
+sharedRuntime_<arch>.cpp                sharkCompiler.hpp
+
+shark_globals.cpp                       shark_globals.hpp
+
+shark_globals.hpp                       shark_globals_<arch>.hpp
+shark_globals.hpp                       globals.hpp
+
+sharkBlock.cpp                          debug.hpp
+sharkBlock.cpp                          bytecodes.hpp
+sharkBlock.cpp                          llvmHeaders.hpp
+sharkBlock.cpp                          llvmValue.hpp
+sharkBlock.cpp                          shark_globals.hpp
+sharkBlock.cpp                          sharkBlock.hpp
+sharkBlock.cpp                          sharkBuilder.hpp
+sharkBlock.cpp                          sharkConstant.hpp
+sharkBlock.cpp                          sharkState.hpp
+sharkBlock.cpp                          sharkValue.hpp
+
+sharkBlock.hpp                          allocation.hpp
+sharkBlock.hpp                          ciMethod.hpp
+sharkBlock.hpp                          ciStreams.hpp
+sharkBlock.hpp                          debug.hpp
+sharkBlock.hpp                          llvmHeaders.hpp
+sharkBlock.hpp                          sharkBuilder.hpp
+sharkBlock.hpp                          sharkConstant.hpp
+sharkBlock.hpp                          sharkInvariants.hpp
+sharkBlock.hpp                          sharkState.hpp
+sharkBlock.hpp                          sharkValue.hpp
+
+sharkBuilder.cpp                        ciMethod.hpp
+sharkBuilder.cpp                        debug.hpp
+sharkBuilder.cpp                        llvmHeaders.hpp
+sharkBuilder.cpp                        llvmValue.hpp
+sharkBuilder.cpp                        methodOop.hpp
+sharkBuilder.cpp                        os.hpp
+sharkBuilder.cpp                        resourceArea.hpp
+sharkBuilder.cpp                        llvmHeaders.hpp
+sharkBuilder.cpp                        sharkBuilder.hpp
+sharkBuilder.cpp                        sharkContext.hpp
+sharkBuilder.cpp                        sharkRuntime.hpp
+sharkBuilder.cpp                        synchronizer.hpp
+sharkBuilder.cpp                        thread.hpp
+
+sharkBuilder.hpp                        barrierSet.hpp
+sharkBuilder.hpp                        cardTableModRefBS.hpp
+sharkBuilder.hpp                        ciType.hpp
+sharkBuilder.hpp                        debug.hpp
+sharkBuilder.hpp                        llvmHeaders.hpp
+sharkBuilder.hpp                        llvmValue.hpp
+sharkBuilder.hpp                        sizes.hpp
+sharkBuilder.hpp                        sharkCodeBuffer.hpp
+sharkBuilder.hpp                        sharkType.hpp
+sharkBuilder.hpp                        sharkValue.hpp
+sharkBuilder.hpp                        sharkEntry.hpp
+
+sharkCacheDecache.cpp                   ciMethod.hpp
+sharkCacheDecache.cpp                   debugInfoRec.hpp
+sharkCacheDecache.cpp                   llvmValue.hpp
+sharkCacheDecache.cpp                   sharkBuilder.hpp
+sharkCacheDecache.cpp                   sharkCacheDecache.hpp
+sharkCacheDecache.cpp                   sharkFunction.hpp
+sharkCacheDecache.cpp                   sharkState.hpp
+
+sharkCacheDecache.hpp                   ciMethod.hpp
+sharkCacheDecache.hpp                   debugInfoRec.hpp
+sharkCacheDecache.hpp                   sharkBuilder.hpp
+sharkCacheDecache.hpp                   sharkFunction.hpp
+sharkCacheDecache.hpp                   sharkStateScanner.hpp
+
+sharkCodeBuffer.hpp                     allocation.hpp
+sharkCodeBuffer.hpp                     codeBuffer.hpp
+sharkCodeBuffer.hpp                     llvmHeaders.hpp
+
+sharkCompiler.cpp                       abstractCompiler.hpp
+sharkCompiler.cpp                       ciEnv.hpp
+sharkCompiler.cpp                       ciMethod.hpp
+sharkCompiler.cpp                       debug.hpp
+sharkCompiler.cpp                       debugInfoRec.hpp
+sharkCompiler.cpp                       dependencies.hpp
+sharkCompiler.cpp                       exceptionHandlerTable.hpp
+sharkCompiler.cpp                       llvmHeaders.hpp
+sharkCompiler.cpp                       oopMap.hpp
+sharkCompiler.cpp                       oopRecorder.hpp
+sharkCompiler.cpp                       shark_globals.hpp
+sharkCompiler.cpp                       sharkBuilder.hpp
+sharkCompiler.cpp                       sharkCodeBuffer.hpp
+sharkCompiler.cpp                       sharkCompiler.hpp
+sharkCompiler.cpp                       sharkContext.hpp
+sharkCompiler.cpp                       sharkEntry.hpp
+sharkCompiler.cpp                       sharkFunction.hpp
+sharkCompiler.cpp                       sharkMemoryManager.hpp
+sharkCompiler.cpp                       sharkNativeWrapper.hpp
+
+sharkCompiler.hpp                       abstractCompiler.hpp
+sharkCompiler.hpp                       ciEnv.hpp
+sharkCompiler.hpp                       ciMethod.hpp
+sharkCompiler.hpp                       compileBroker.hpp
+sharkCompiler.hpp                       llvmHeaders.hpp
+sharkCompiler.hpp                       sharkMemoryManager.hpp
+
+sharkContext.cpp                        arrayOop.hpp
+sharkContext.cpp                        globalDefinitions.hpp
+sharkContext.cpp                        llvmHeaders.hpp
+sharkContext.cpp                        oop.hpp
+sharkContext.cpp                        sharkContext.hpp
+
+sharkContext.hpp                        llvmHeaders.hpp
+sharkContext.hpp                        sharkCompiler.hpp
+
+sharkConstant.cpp                       ciInstance.hpp
+sharkConstant.cpp                       ciStreams.hpp
+sharkConstant.cpp                       sharkBuilder.hpp
+sharkConstant.cpp                       sharkConstant.hpp
+sharkConstant.cpp                       sharkValue.hpp
+
+sharkConstant.hpp                       allocation.hpp
+sharkConstant.hpp                       ciStreams.hpp
+sharkConstant.hpp                       sharkBuilder.hpp
+sharkConstant.hpp                       sharkValue.hpp
+
+sharkEntry.hpp                          llvmHeaders.hpp
+
+sharkFunction.cpp                       allocation.hpp
+sharkFunction.cpp                       ciTypeFlow.hpp
+sharkFunction.cpp                       debug.hpp
+sharkFunction.cpp                       llvmHeaders.hpp
+sharkFunction.cpp                       llvmValue.hpp
+sharkFunction.cpp                       shark_globals.hpp
+sharkFunction.cpp                       sharkBuilder.hpp
+sharkFunction.cpp                       sharkEntry.hpp
+sharkFunction.cpp                       sharkFunction.hpp
+sharkFunction.cpp                       sharkState.hpp
+sharkFunction.cpp                       sharkTopLevelBlock.hpp
+
+sharkFunction.hpp                       allocation.hpp
+sharkFunction.hpp                       ciEnv.hpp
+sharkFunction.hpp                       ciStreams.hpp
+sharkFunction.hpp                       ciTypeFlow.hpp
+sharkFunction.hpp                       llvmHeaders.hpp
+sharkFunction.hpp                       llvmValue.hpp
+sharkFunction.hpp                       sharkBuilder.hpp
+sharkFunction.hpp                       sharkContext.hpp
+sharkFunction.hpp                       sharkInvariants.hpp
+sharkFunction.hpp                       sharkStack.hpp
+
+sharkInliner.cpp                        allocation.hpp
+sharkInliner.cpp                        bytecodes.hpp
+sharkInliner.cpp                        ciField.hpp
+sharkInliner.cpp                        ciMethod.hpp
+sharkInliner.cpp                        ciStreams.hpp
+sharkInliner.cpp                        shark_globals.hpp
+sharkInliner.cpp                        sharkBlock.hpp
+sharkInliner.cpp                        sharkConstant.hpp
+sharkInliner.cpp                        sharkInliner.hpp
+sharkInliner.cpp                        sharkIntrinsics.hpp
+sharkInliner.cpp                        sharkState.hpp
+sharkInliner.cpp                        sharkValue.hpp
+
+sharkInliner.hpp                        allocation.hpp
+sharkInliner.hpp                        ciMethod.hpp
+sharkInliner.hpp                        llvmHeaders.hpp
+sharkInliner.hpp                        sharkState.hpp
+
+sharkIntrinsics.cpp                     ciMethod.hpp
+sharkIntrinsics.cpp                     llvmHeaders.hpp
+sharkIntrinsics.cpp                     shark_globals.hpp
+sharkIntrinsics.cpp                     sharkIntrinsics.hpp
+sharkIntrinsics.cpp                     sharkState.hpp
+sharkIntrinsics.cpp                     sharkValue.hpp
+
+sharkIntrinsics.hpp                     allocation.hpp
+sharkIntrinsics.hpp                     ciMethod.hpp
+sharkIntrinsics.hpp                     llvmHeaders.hpp
+sharkIntrinsics.hpp                     sharkState.hpp
+
+sharkInvariants.cpp                     sharkInvariants.hpp
+
+sharkInvariants.hpp                     allocation.hpp
+sharkInvariants.hpp                     ciEnv.hpp
+sharkInvariants.hpp                     ciMethod.hpp
+sharkInvariants.hpp                     ciInstanceKlass.hpp
+sharkInvariants.hpp                     ciTypeFlow.hpp
+sharkInvariants.hpp                     debugInfoRec.hpp
+sharkInvariants.hpp                     dependencies.hpp
+sharkInvariants.hpp                     llvmHeaders.hpp
+sharkInvariants.hpp                     sharkBuilder.hpp
+
+sharkMemoryManager.hpp                  llvmHeaders.hpp
+sharkMemoryManager.hpp                  sharkEntry.hpp
+
+sharkMemoryManager.cpp                  llvmHeaders.hpp
+sharkMemoryManager.cpp                  sharkEntry.hpp
+sharkMemoryManager.cpp                  sharkMemoryManager.hpp
+
+sharkNativeWrapper.cpp                  llvmHeaders.hpp
+sharkNativeWrapper.cpp                  sharkNativeWrapper.hpp
+sharkNativeWrapper.cpp                  sharkType.hpp
+
+sharkNativeWrapper.hpp                  handles.hpp
+sharkNativeWrapper.hpp                  llvmHeaders.hpp
+sharkNativeWrapper.hpp                  sharkBuilder.hpp
+sharkNativeWrapper.hpp                  sharkContext.hpp
+sharkNativeWrapper.hpp                  sharkInvariants.hpp
+sharkNativeWrapper.hpp                  sharkStack.hpp
+
+sharkRuntime.cpp                        biasedLocking.hpp
+sharkRuntime.cpp                        deoptimization.hpp
+sharkRuntime.cpp                        llvmHeaders.hpp
+sharkRuntime.cpp                        klassOop.hpp
+sharkRuntime.cpp                        sharkRuntime.hpp
+sharkRuntime.cpp                        stack_<arch>.inline.hpp
+sharkRuntime.cpp                        thread.hpp
+
+sharkRuntime.hpp                        allocation.hpp
+sharkRuntime.hpp                        llvmHeaders.hpp
+sharkRuntime.hpp                        llvmValue.hpp
+sharkRuntime.hpp                        klassOop.hpp
+sharkRuntime.hpp                        thread.hpp
+
+sharkStack.cpp                          llvmHeaders.hpp
+sharkStack.cpp                          sharkFunction.hpp
+sharkStack.cpp                          sharkNativeWrapper.hpp
+sharkStack.cpp                          sharkStack.hpp
+sharkStack.cpp                          sharkType.hpp
+
+sharkStack.hpp                          llvmHeaders.hpp
+sharkStack.hpp                          sharkInvariants.hpp
+sharkStack.hpp                          sharkType.hpp
+
+sharkState.cpp                          allocation.hpp
+sharkState.cpp                          ciType.hpp
+sharkState.cpp                          ciTypeFlow.hpp
+sharkState.cpp                          sharkBuilder.hpp
+sharkState.cpp                          sharkCacheDecache.hpp
+sharkState.cpp                          sharkState.hpp
+sharkState.cpp                          sharkTopLevelBlock.hpp
+sharkState.cpp                          sharkType.hpp
+sharkState.cpp                          sharkValue.hpp
+
+sharkState.hpp                          allocation.hpp
+sharkState.hpp                          ciMethod.hpp
+sharkState.hpp                          llvmHeaders.hpp
+sharkState.hpp                          sharkBuilder.hpp
+sharkState.hpp                          sharkInvariants.hpp
+sharkState.hpp                          sharkValue.hpp
+
+sharkStateScanner.cpp                   sharkState.hpp
+sharkStateScanner.cpp                   sharkStateScanner.hpp
+
+sharkStateScanner.hpp                   allocation.hpp
+sharkStateScanner.hpp                   llvmHeaders.hpp
+sharkStateScanner.hpp                   sharkFunction.hpp
+sharkStateScanner.hpp                   sharkInvariants.hpp
+
+sharkTopLevelBlock.cpp                  allocation.hpp
+sharkTopLevelBlock.cpp                  bytecodes.hpp
+sharkTopLevelBlock.cpp                  ciField.hpp
+sharkTopLevelBlock.cpp                  ciInstance.hpp
+sharkTopLevelBlock.cpp                  ciObjArrayKlass.hpp
+sharkTopLevelBlock.cpp                  ciStreams.hpp
+sharkTopLevelBlock.cpp                  ciType.hpp
+sharkTopLevelBlock.cpp                  ciTypeFlow.hpp
+sharkTopLevelBlock.cpp                  debug.hpp
+sharkTopLevelBlock.cpp                  deoptimization.hpp
+sharkTopLevelBlock.cpp                  llvmHeaders.hpp
+sharkTopLevelBlock.cpp                  llvmValue.hpp
+sharkTopLevelBlock.cpp                  shark_globals.hpp
+sharkTopLevelBlock.cpp                  sharkCacheDecache.hpp
+sharkTopLevelBlock.cpp                  sharkTopLevelBlock.hpp
+sharkTopLevelBlock.cpp                  sharkBuilder.hpp
+sharkTopLevelBlock.cpp                  sharkConstant.hpp
+sharkTopLevelBlock.cpp                  sharkInliner.hpp
+sharkTopLevelBlock.cpp                  sharkState.hpp
+sharkTopLevelBlock.cpp                  sharkValue.hpp
+
+sharkTopLevelBlock.hpp                  allocation.hpp
+sharkTopLevelBlock.hpp                  bytecodes.hpp
+sharkTopLevelBlock.hpp                  ciStreams.hpp
+sharkTopLevelBlock.hpp                  ciType.hpp
+sharkTopLevelBlock.hpp                  ciTypeFlow.hpp
+sharkTopLevelBlock.hpp                  llvmHeaders.hpp
+sharkTopLevelBlock.hpp                  sharkBlock.hpp
+sharkTopLevelBlock.hpp                  sharkBuilder.hpp
+sharkTopLevelBlock.hpp                  sharkFunction.hpp
+sharkTopLevelBlock.hpp                  sharkState.hpp
+sharkTopLevelBlock.hpp                  sharkValue.hpp
+
+sharkType.hpp                           allocation.hpp
+sharkType.hpp                           ciType.hpp
+sharkType.hpp                           globalDefinitions.hpp
+sharkType.hpp                           llvmHeaders.hpp
+sharkType.hpp                           sharkContext.hpp
+
+sharkValue.cpp                          ciType.hpp
+sharkValue.cpp                          llvmHeaders.hpp
+sharkValue.cpp                          llvmValue.hpp
+sharkValue.cpp                          sharkBuilder.hpp
+sharkValue.cpp                          sharkValue.hpp
+
+sharkValue.hpp                          allocation.hpp
+sharkValue.hpp                          ciType.hpp
+sharkValue.hpp                          llvmHeaders.hpp
+sharkValue.hpp                          llvmValue.hpp
+sharkValue.hpp                          sharkType.hpp
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -339,7 +339,8 @@
 #define CHECK_NULL(obj_)                                                 \
     if ((obj_) == NULL) {                                                \
         VM_JAVA_ERROR(vmSymbols::java_lang_NullPointerException(), "");  \
-    }
+    }                                                                    \
+    VERIFY_OOP(obj_)
 
 #define VMdoubleConstZero() 0.0
 #define VMdoubleConstOne() 1.0
@@ -509,7 +510,7 @@
 
 /* 0xB0 */ &&opc_areturn,     &&opc_return,         &&opc_getstatic,    &&opc_putstatic,
 /* 0xB4 */ &&opc_getfield,    &&opc_putfield,       &&opc_invokevirtual,&&opc_invokespecial,
-/* 0xB8 */ &&opc_invokestatic,&&opc_invokeinterface,NULL,               &&opc_new,
+/* 0xB8 */ &&opc_invokestatic,&&opc_invokeinterface,&&opc_default,      &&opc_new,
 /* 0xBC */ &&opc_newarray,    &&opc_anewarray,      &&opc_arraylength,  &&opc_athrow,
 
 /* 0xC0 */ &&opc_checkcast,   &&opc_instanceof,     &&opc_monitorenter, &&opc_monitorexit,
@@ -539,6 +540,7 @@
   // this will trigger a VERIFY_OOP on entry
   if (istate->msg() != initialize && ! METHOD->is_static()) {
     oop rcvr = LOCALS_OBJECT(0);
+    VERIFY_OOP(rcvr);
   }
 #endif
 // #define HACK
@@ -547,7 +549,7 @@
 #endif // HACK
 
   /* QQQ this should be a stack method so we don't know actual direction */
-  assert(istate->msg() == initialize ||
+  guarantee(istate->msg() == initialize ||
          topOfStack >= istate->stack_limit() &&
          topOfStack < istate->stack_base(),
          "Stack top out of range");
@@ -613,6 +615,7 @@
             rcvr = METHOD->constants()->pool_holder()->klass_part()->java_mirror();
           } else {
             rcvr = LOCALS_OBJECT(0);
+            VERIFY_OOP(rcvr);
           }
           // The initial monitor is ours for the taking
           BasicObjectLock* mon = &istate->monitor_base()[-1];
@@ -735,6 +738,7 @@
     case popping_frame: {
       // returned from a java call to pop the frame, restart the call
       // clear the message so we don't confuse ourselves later
+      ShouldNotReachHere();  // we don't return this.
       assert(THREAD->pop_frame_in_process(), "wrong frame pop state");
       istate->set_msg(no_request);
       THREAD->clr_pop_frame_in_process();
@@ -801,6 +805,7 @@
       // continue locking now that we have a monitor to use
       // we expect to find newly allocated monitor at the "top" of the monitor stack.
       oop lockee = STACK_OBJECT(-1);
+      VERIFY_OOP(lockee);
       // derefing's lockee ought to provoke implicit null check
       // find a free monitor
       BasicObjectLock* entry = (BasicObjectLock*) istate->stack_base();
@@ -911,6 +916,7 @@
           /* load from local variable */
 
       CASE(_aload):
+          VERIFY_OOP(LOCALS_OBJECT(pc[1]));
           SET_STACK_OBJECT(LOCALS_OBJECT(pc[1]), 0);
           UPDATE_PC_AND_TOS_AND_CONTINUE(2, 1);
 
@@ -930,6 +936,7 @@
 #undef  OPC_LOAD_n
 #define OPC_LOAD_n(num)                                                 \
       CASE(_aload_##num):                                               \
+          VERIFY_OOP(LOCALS_OBJECT(num));                               \
           SET_STACK_OBJECT(LOCALS_OBJECT(num), 0);                      \
           UPDATE_PC_AND_TOS_AND_CONTINUE(1, 1);                         \
                                                                         \
@@ -975,6 +982,7 @@
           opcode = pc[1];
           switch(opcode) {
               case Bytecodes::_aload:
+                  VERIFY_OOP(LOCALS_OBJECT(reg));
                   SET_STACK_OBJECT(LOCALS_OBJECT(reg), 0);
                   UPDATE_PC_AND_TOS_AND_CONTINUE(4, 1);
 
@@ -1099,7 +1107,7 @@
       CASE(_i##opcname):                                                \
           if (test && (STACK_INT(-1) == 0)) {                           \
               VM_JAVA_ERROR(vmSymbols::java_lang_ArithmeticException(), \
-                            "/ by int zero");                           \
+                            "/ by zero");                               \
           }                                                             \
           SET_STACK_INT(VMint##opname(STACK_INT(-2),                    \
                                       STACK_INT(-1)),                   \
@@ -1277,7 +1285,12 @@
           jfloat f;
           jdouble r;
           f = STACK_FLOAT(-1);
+#ifdef IA64
+          // IA64 gcc bug
+          r = ( f == 0.0f ) ? (jdouble) f : (jdouble) f + ia64_double_zero;
+#else
           r = (jdouble) f;
+#endif
           MORE_STACK(-1); // POP
           SET_STACK_DOUBLE(r, 1);
           UPDATE_PC_AND_TOS_AND_CONTINUE(1, 2);
@@ -1471,6 +1484,7 @@
       CASE(_return_register_finalizer): {
 
           oop rcvr = LOCALS_OBJECT(0);
+          VERIFY_OOP(rcvr);
           if (rcvr->klass()->klass_part()->has_finalizer()) {
             CALL_VM(InterpreterRuntime::register_finalizer(THREAD, rcvr), handle_exception);
           }
@@ -1561,6 +1575,7 @@
        */
       CASE(_aastore): {
           oop rhsObject = STACK_OBJECT(-1);
+          VERIFY_OOP(rhsObject);
           ARRAY_INTRO( -3);
           // arrObj, index are set
           if (rhsObject != NULL) {
@@ -1703,6 +1718,7 @@
                 obj = (oop)NULL;
               } else {
                 obj = (oop) STACK_OBJECT(-1);
+                VERIFY_OOP(obj);
               }
               CALL_VM(InterpreterRuntime::post_field_access(THREAD,
                                           obj,
@@ -1728,6 +1744,7 @@
           int field_offset = cache->f2();
           if (cache->is_volatile()) {
             if (tos_type == atos) {
+              VERIFY_OOP(obj->obj_field_acquire(field_offset));
               SET_STACK_OBJECT(obj->obj_field_acquire(field_offset), -1);
             } else if (tos_type == itos) {
               SET_STACK_INT(obj->int_field_acquire(field_offset), -1);
@@ -1748,6 +1765,7 @@
             }
           } else {
             if (tos_type == atos) {
+              VERIFY_OOP(obj->obj_field(field_offset));
               SET_STACK_OBJECT(obj->obj_field(field_offset), -1);
             } else if (tos_type == itos) {
               SET_STACK_INT(obj->int_field(field_offset), -1);
@@ -1799,6 +1817,7 @@
                 } else {
                   obj = (oop) STACK_OBJECT(-2);
                 }
+                VERIFY_OOP(obj);
               }
 
               CALL_VM(InterpreterRuntime::post_field_modification(THREAD,
@@ -1837,6 +1856,7 @@
             if (tos_type == itos) {
               obj->release_int_field_put(field_offset, STACK_INT(-1));
             } else if (tos_type == atos) {
+              VERIFY_OOP(STACK_OBJECT(-1));
               obj->release_obj_field_put(field_offset, STACK_OBJECT(-1));
               OrderAccess::release_store(&BYTE_MAP_BASE[(uintptr_t)obj >> CardTableModRefBS::card_shift], 0);
             } else if (tos_type == btos) {
@@ -1857,6 +1877,7 @@
             if (tos_type == itos) {
               obj->int_field_put(field_offset, STACK_INT(-1));
             } else if (tos_type == atos) {
+              VERIFY_OOP(STACK_OBJECT(-1));
               obj->obj_field_put(field_offset, STACK_OBJECT(-1));
               OrderAccess::release_store(&BYTE_MAP_BASE[(uintptr_t)obj >> CardTableModRefBS::card_shift], 0);
             } else if (tos_type == btos) {
@@ -1961,6 +1982,7 @@
       }
       CASE(_checkcast):
           if (STACK_OBJECT(-1) != NULL) {
+            VERIFY_OOP(STACK_OBJECT(-1));
             u2 index = Bytes::get_Java_u2(pc+1);
             if (ProfileInterpreter) {
               // needs Profile_checkcast QQQ
@@ -1999,6 +2021,7 @@
           if (STACK_OBJECT(-1) == NULL) {
             SET_STACK_INT(0, -1);
           } else {
+            VERIFY_OOP(STACK_OBJECT(-1));
             u2 index = Bytes::get_Java_u2(pc+1);
             // Constant pool may have actual klass or unresolved klass. If it is
             // unresolved we must resolve it
@@ -2044,10 +2067,12 @@
             break;
 
           case JVM_CONSTANT_String:
+            VERIFY_OOP(constants->resolved_string_at(index));
             SET_STACK_OBJECT(constants->resolved_string_at(index), 0);
             break;
 
           case JVM_CONSTANT_Class:
+            VERIFY_OOP(constants->resolved_klass_at(index)->klass_part()->java_mirror());
             SET_STACK_OBJECT(constants->resolved_klass_at(index)->klass_part()->java_mirror(), 0);
             break;
 
@@ -2059,17 +2084,6 @@
             THREAD->set_vm_result(NULL);
             break;
 
-#if 0
-          CASE(_fast_igetfield):
-          CASE(_fastagetfield):
-          CASE(_fast_aload_0):
-          CASE(_fast_iaccess_0):
-          CASE(__fast_aaccess_0):
-          CASE(_fast_linearswitch):
-          CASE(_fast_binaryswitch):
-            fatal("unsupported fast bytecode");
-#endif
-
           default:  ShouldNotReachHere();
           }
           UPDATE_PC_AND_TOS_AND_CONTINUE(incr, 1);
@@ -2122,6 +2136,7 @@
             // get receiver
             int parms = cache->parameter_size();
             // Same comments as invokevirtual apply here
+            VERIFY_OOP(STACK_OBJECT(-parms));
             instanceKlass* rcvrKlass = (instanceKlass*)
                                  STACK_OBJECT(-parms)->klass()->klass_part();
             callee = (methodOop) rcvrKlass->start_of_vtable()[ cache->f2()];
@@ -2205,6 +2220,7 @@
               // this fails with an assert
               // instanceKlass* rcvrKlass = instanceKlass::cast(STACK_OBJECT(-parms)->klass());
               // but this works
+              VERIFY_OOP(STACK_OBJECT(-parms));
               instanceKlass* rcvrKlass = (instanceKlass*) STACK_OBJECT(-parms)->klass()->klass_part();
               /*
                 Executing this code in java.lang.String:
@@ -2651,14 +2667,14 @@
                                 LOCALS_SLOT(METHOD->size_of_parameters() - 1));
         THREAD->set_popframe_condition_bit(JavaThread::popframe_force_deopt_reexecution_bit);
       }
-      UPDATE_PC_AND_RETURN(1);
-    } else {
-      // Normal return
-      // Advance the pc and return to frame manager
-      istate->set_msg(return_from_method);
-      istate->set_return_kind((Bytecodes::Code)opcode);
-      UPDATE_PC_AND_RETURN(1);
+      THREAD->clr_pop_frame_in_process();
     }
+
+    // Normal return
+    // Advance the pc and return to frame manager
+    istate->set_msg(return_from_method);
+    istate->set_return_kind((Bytecodes::Code)opcode);
+    UPDATE_PC_AND_RETURN(1);
   } /* handle_return: */
 
 // This is really a fatal error return
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -440,7 +440,7 @@
  * iushr, ishl, and ishr bytecodes, respectively.
  */
 
-static jint VMintUshr(jint op, jint num);
+static juint VMintUshr(jint op, jint num);
 static jint VMintShl (jint op, jint num);
 static jint VMintShr (jint op, jint num);
 
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -27,14 +27,11 @@
 #ifdef CC_INTERP
 
 #ifdef ASSERT
-extern "C" { typedef void (*verify_oop_fn_t)(oop, const char *);};
-#define VERIFY_OOP(o) \
-        /*{ verify_oop_fn_t verify_oop_entry = \
-            *StubRoutines::verify_oop_subroutine_entry_address(); \
-          if (verify_oop_entry) { \
-             (*verify_oop_entry)((o), "Not an oop!"); \
-          } \
-        }*/
+#define VERIFY_OOP(o_) \
+      if (VerifyOops) { \
+        assert((oop(o_))->is_oop_or_null(), "Not an oop!"); \
+        StubRoutines::_verify_oop_count++;  \
+      }
 #else
 #define VERIFY_OOP(o)
 #endif
--- a/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -328,24 +328,35 @@
   constantPoolOop constants = method()->constants();
   constantTag tag = constants->tag_at(i);
 
-  int nt_index = -1;
+  bool has_klass = true;
 
   switch (tag.value()) {
   case JVM_CONSTANT_InterfaceMethodref:
   case JVM_CONSTANT_Methodref:
   case JVM_CONSTANT_Fieldref:
+    break;
   case JVM_CONSTANT_NameAndType:
+  case JVM_CONSTANT_InvokeDynamic:
+    has_klass = false;
     break;
   default:
     st->print_cr(" bad tag=%d at %d", tag.value(), i);
     return;
   }
 
-  symbolOop klass = constants->klass_name_at(constants->uncached_klass_ref_index_at(i));
   symbolOop name = constants->uncached_name_ref_at(i);
   symbolOop signature = constants->uncached_signature_ref_at(i);
   const char* sep = (tag.is_field() ? "/" : "");
-  st->print_cr(" %d <%s.%s%s%s> ", i, klass->as_C_string(), name->as_C_string(), sep, signature->as_C_string());
+  if (has_klass) {
+    symbolOop klass = constants->klass_name_at(constants->uncached_klass_ref_index_at(i));
+    st->print_cr(" %d <%s.%s%s%s> ", i, klass->as_C_string(), name->as_C_string(), sep, signature->as_C_string());
+  } else {
+    if (tag.is_invoke_dynamic()) {
+      int bsm = constants->invoke_dynamic_bootstrap_method_ref_index_at(i);
+      st->print(" bsm=%d", bsm);
+    }
+    st->print_cr(" %d <%s%s%s>", i, name->as_C_string(), sep, signature->as_C_string());
+  }
 }
 
 
--- a/hotspot/src/share/vm/interpreter/interpreter.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/interpreter/interpreter.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -41,20 +41,20 @@
 }
 
 
-void InterpreterCodelet::print() {
+void InterpreterCodelet::print_on(outputStream* st) const {
   if (PrintInterpreter) {
-    tty->cr();
-    tty->print_cr("----------------------------------------------------------------------");
+    st->cr();
+    st->print_cr("----------------------------------------------------------------------");
   }
 
-  if (description() != NULL) tty->print("%s  ", description());
-  if (bytecode()    >= 0   ) tty->print("%d %s  ", bytecode(), Bytecodes::name(bytecode()));
-  tty->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "]  %d bytes",
+  if (description() != NULL) st->print("%s  ", description());
+  if (bytecode()    >= 0   ) st->print("%d %s  ", bytecode(), Bytecodes::name(bytecode()));
+  st->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "]  %d bytes",
                 code_begin(), code_end(), code_size());
 
   if (PrintInterpreter) {
-    tty->cr();
-    Disassembler::decode(code_begin(), code_end(), tty);
+    st->cr();
+    Disassembler::decode(code_begin(), code_end(), st);
   }
 }
 
--- a/hotspot/src/share/vm/interpreter/interpreter.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/interpreter/interpreter.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -52,7 +52,8 @@
 
   // Debugging
   void    verify();
-  void    print();
+  void    print_on(outputStream* st) const;
+  void    print() const { print_on(tty); }
 
   // Interpreter-specific initialization
   void    initialize(const char* description, Bytecodes::Code bytecode);
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -702,10 +702,6 @@
 
   methodHandle caller_method(thread, method(thread));
 
-  // first find the bootstrap method
-  KlassHandle caller_klass(thread, caller_method->method_holder());
-  Handle bootm = SystemDictionary::find_bootstrap_method(caller_klass, CHECK);
-
   constantPoolHandle pool(thread, caller_method->constants());
   pool->set_invokedynamic();    // mark header to flag active call sites
 
@@ -726,7 +722,7 @@
     CallInfo info;
     LinkResolver::resolve_invoke(info, Handle(), pool,
                                  site_index, bytecode, CHECK);
-    // The main entry corresponds to a JVM_CONSTANT_NameAndType, and serves
+    // The main entry corresponds to a JVM_CONSTANT_InvokeDynamic, and serves
     // as a common reference point for all invokedynamic call sites with
     // that exact call descriptor.  We will link it in the CP cache exactly
     // as if it were an invokevirtual of MethodHandle.invoke.
@@ -734,23 +730,30 @@
       bytecode,
       info.resolved_method(),
       info.vtable_index());
-    assert(pool->cache()->entry_at(main_index)->is_vfinal(), "f2 must be a methodOop");
   }
 
   // The method (f2 entry) of the main entry is the MH.invoke for the
   // invokedynamic target call signature.
-  intptr_t f2_value = pool->cache()->entry_at(main_index)->f2();
-  methodHandle signature_invoker(THREAD, (methodOop) f2_value);
+  oop f1_value = pool->cache()->entry_at(main_index)->f1();
+  methodHandle signature_invoker(THREAD, (methodOop) f1_value);
   assert(signature_invoker.not_null() && signature_invoker->is_method() && signature_invoker->is_method_handle_invoke(),
          "correct result from LinkResolver::resolve_invokedynamic");
 
+  Handle bootm = SystemDictionary::find_bootstrap_method(caller_method, caller_bci,
+                                                         main_index, CHECK);
+  if (bootm.is_null()) {
+    THROW_MSG(vmSymbols::java_lang_IllegalStateException(),
+              "no bootstrap method found for invokedynamic");
+  }
+
+  // Short circuit if CallSite has been bound already:
+  if (!pool->cache()->secondary_entry_at(site_index)->is_f1_null())
+    return;
+
   symbolHandle call_site_name(THREAD, pool->name_ref_at(site_index));
 
   Handle info;  // NYI: Other metadata from a new kind of CP entry.  (Annotations?)
 
-  // this is the index which gets stored on the CallSite object (as "callerPosition"):
-  int call_site_position = constantPoolCacheOopDesc::decode_secondary_index(site_index);
-
   Handle call_site
     = SystemDictionary::make_dynamic_call_site(bootm,
                                                // Callee information:
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -67,6 +67,15 @@
   set_common(resolved_klass, selected_klass, resolved_method, selected_method, vtable_index, CHECK);
 }
 
+void CallInfo::set_dynamic(methodHandle resolved_method, TRAPS) {
+  assert(resolved_method->is_method_handle_invoke(), "");
+  KlassHandle resolved_klass = SystemDictionaryHandles::MethodHandle_klass();
+  assert(resolved_klass == resolved_method->method_holder(), "");
+  int vtable_index = methodOopDesc::nonvirtual_vtable_index;
+  assert(resolved_method->vtable_index() == vtable_index, "");
+  set_common(resolved_klass, KlassHandle(), resolved_method, resolved_method, vtable_index, CHECK);
+}
+
 void CallInfo::set_common(KlassHandle resolved_klass, KlassHandle selected_klass, methodHandle resolved_method, methodHandle selected_method, int vtable_index, TRAPS) {
   assert(resolved_method->signature() == selected_method->signature(), "signatures must correspond");
   _resolved_klass  = resolved_klass;
@@ -176,9 +185,20 @@
                                           KlassHandle klass, symbolHandle name, symbolHandle signature,
                                           KlassHandle current_klass,
                                           TRAPS) {
-  if (EnableMethodHandles && MethodHandles::enabled() &&
+  if (EnableMethodHandles &&
       klass() == SystemDictionary::MethodHandle_klass() &&
       methodOopDesc::is_method_handle_invoke_name(name())) {
+    if (!MethodHandles::enabled()) {
+      // Make sure the Java part of the runtime has been booted up.
+      klassOop natives = SystemDictionary::MethodHandleNatives_klass();
+      if (natives == NULL || instanceKlass::cast(natives)->is_not_initialized()) {
+        SystemDictionary::resolve_or_fail(vmSymbolHandles::sun_dyn_MethodHandleNatives(),
+                                          Handle(),
+                                          Handle(),
+                                          true,
+                                          CHECK);
+      }
+    }
     methodOop result_oop = SystemDictionary::find_method_handle_invoke(name,
                                                                        signature,
                                                                        current_klass,
@@ -1065,7 +1085,7 @@
   if (resolved_method.is_null()) {
     THROW(vmSymbols::java_lang_InternalError());
   }
-  result.set_virtual(resolved_klass, KlassHandle(), resolved_method, resolved_method, resolved_method->vtable_index(), CHECK);
+  result.set_dynamic(resolved_method, CHECK);
 }
 
 //------------------------------------------------------------------------------------------------------------------------
--- a/hotspot/src/share/vm/interpreter/linkResolver.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/interpreter/linkResolver.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -73,6 +73,7 @@
   void         set_static(   KlassHandle resolved_klass,                             methodHandle resolved_method                                                , TRAPS);
   void         set_interface(KlassHandle resolved_klass, KlassHandle selected_klass, methodHandle resolved_method, methodHandle selected_method                  , TRAPS);
   void         set_virtual(  KlassHandle resolved_klass, KlassHandle selected_klass, methodHandle resolved_method, methodHandle selected_method, int vtable_index, TRAPS);
+  void         set_dynamic(                                                          methodHandle resolved_method,                                                 TRAPS);
   void         set_common(   KlassHandle resolved_klass, KlassHandle selected_klass, methodHandle resolved_method, methodHandle selected_method, int vtable_index, TRAPS);
 
   friend class LinkResolver;
--- a/hotspot/src/share/vm/interpreter/oopMapCache.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/interpreter/oopMapCache.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -281,9 +281,7 @@
  public:
   void pass_int()                                { /* ignore */ }
   void pass_long()                               { /* ignore */ }
-#if defined(_LP64) || defined(ZERO)
   void pass_float()                              { /* ignore */ }
-#endif
   void pass_double()                             { /* ignore */ }
   void pass_object()                             { set_one(offset()); }
 
--- a/hotspot/src/share/vm/interpreter/rewriter.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/interpreter/rewriter.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -32,14 +32,17 @@
 void Rewriter::compute_index_maps() {
   const int length  = _pool->length();
   init_cp_map(length);
+  jint tag_mask = 0;
   for (int i = 0; i < length; i++) {
     int tag = _pool->tag_at(i).value();
+    tag_mask |= (1 << tag);
     switch (tag) {
       case JVM_CONSTANT_InterfaceMethodref:
       case JVM_CONSTANT_Fieldref          : // fall through
       case JVM_CONSTANT_Methodref         : // fall through
       case JVM_CONSTANT_MethodHandle      : // fall through
       case JVM_CONSTANT_MethodType        : // fall through
+      case JVM_CONSTANT_InvokeDynamic     : // fall through
         add_cp_cache_entry(i);
         break;
     }
@@ -47,6 +50,8 @@
 
   guarantee((int)_cp_cache_map.length()-1 <= (int)((u2)-1),
             "all cp cache indexes fit in a u2");
+
+  _have_invoke_dynamic = ((tag_mask & (1 << JVM_CONSTANT_InvokeDynamic)) != 0);
 }
 
 
@@ -59,6 +64,28 @@
   constantPoolCacheOop cache =
       oopFactory::new_constantPoolCache(length, methodOopDesc::IsUnsafeConc, CHECK);
   cache->initialize(_cp_cache_map);
+
+  // Don't bother to the next pass if there is no JVM_CONSTANT_InvokeDynamic.
+  if (_have_invoke_dynamic) {
+    for (int i = 0; i < length; i++) {
+      int pool_index = cp_cache_entry_pool_index(i);
+      if (pool_index >= 0 &&
+          _pool->tag_at(pool_index).is_invoke_dynamic()) {
+        int bsm_index = _pool->invoke_dynamic_bootstrap_method_ref_index_at(pool_index);
+        if (bsm_index != 0) {
+          assert(_pool->tag_at(bsm_index).is_method_handle(), "must be a MH constant");
+          // There is a CP cache entry holding the BSM for these calls.
+          int bsm_cache_index = cp_entry_to_cp_cache(bsm_index);
+          cache->entry_at(i)->initialize_bootstrap_method_index_in_cache(bsm_cache_index);
+        } else {
+          // There is no CP cache entry holding the BSM for these calls.
+          // We will need to look for a class-global BSM, later.
+          guarantee(AllowTransitionalJSR292, "");
+        }
+      }
+    }
+  }
+
   _pool->set_cache(cache);
   cache->set_constant_pool(_pool());
 }
--- a/hotspot/src/share/vm/interpreter/rewriter.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/interpreter/rewriter.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -32,6 +32,7 @@
   objArrayHandle      _methods;
   intArray            _cp_map;
   intStack            _cp_cache_map;
+  bool                _have_invoke_dynamic;
 
   void init_cp_map(int length) {
     _cp_map.initialize(length, -1);
@@ -56,6 +57,22 @@
     return cache_index;
   }
 
+  // Access the contents of _cp_cache_map to determine CP cache layout.
+  int cp_cache_entry_pool_index(int cache_index) {
+    int cp_index = _cp_cache_map[cache_index];
+    if ((cp_index & _secondary_entry_tag) != 0)
+      return -1;
+    else
+      return cp_index;
+  }
+  int cp_cache_secondary_entry_main_index(int cache_index) {
+    int cp_index = _cp_cache_map[cache_index];
+    if ((cp_index & _secondary_entry_tag) == 0)
+      return -1;
+    else
+      return (cp_index - _secondary_entry_tag);
+  }
+
   // All the work goes in here:
   Rewriter(instanceKlassHandle klass, constantPoolHandle cpool, objArrayHandle methods, TRAPS);
 
--- a/hotspot/src/share/vm/memory/allocation.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/memory/allocation.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -43,24 +43,73 @@
   switch (type) {
    case C_HEAP:
     res = (address)AllocateHeap(size, "C_Heap: ResourceOBJ");
+    DEBUG_ONLY(set_allocation_type(res, C_HEAP);)
     break;
    case RESOURCE_AREA:
+    // new(size) sets allocation type RESOURCE_AREA.
     res = (address)operator new(size);
     break;
    default:
     ShouldNotReachHere();
   }
-  // Set allocation type in the resource object for assertion checks.
-  DEBUG_ONLY(((ResourceObj *)res)->_allocation = type;)
   return res;
 }
 
 void ResourceObj::operator delete(void* p) {
   assert(((ResourceObj *)p)->allocated_on_C_heap(),
          "delete only allowed for C_HEAP objects");
+  DEBUG_ONLY(((ResourceObj *)p)->_allocation = badHeapOopVal;)
   FreeHeap(p);
 }
 
+#ifdef ASSERT
+void ResourceObj::set_allocation_type(address res, allocation_type type) {
+    // Set allocation type in the resource object
+    uintptr_t allocation = (uintptr_t)res;
+    assert((allocation & allocation_mask) == 0, "address should be aligned to 4 bytes at least");
+    assert(type <= allocation_mask, "incorrect allocation type");
+    ((ResourceObj *)res)->_allocation = ~(allocation + type);
+}
+
+ResourceObj::allocation_type ResourceObj::get_allocation_type() const {
+    assert(~(_allocation | allocation_mask) == (uintptr_t)this, "lost resource object");
+    return (allocation_type)((~_allocation) & allocation_mask);
+}
+
+ResourceObj::ResourceObj() { // default constructor
+    if (~(_allocation | allocation_mask) != (uintptr_t)this) {
+      set_allocation_type((address)this, STACK_OR_EMBEDDED);
+    } else if (allocated_on_stack()) {
+      // For some reason we got a value which looks like an allocation on stack.
+      // Pass if it is really allocated on stack.
+      assert(Thread::current()->on_local_stack((address)this),"should be on stack");
+    } else {
+      assert(allocated_on_res_area() || allocated_on_C_heap() || allocated_on_arena(),
+             "allocation_type should be set by operator new()");
+    }
+}
+
+ResourceObj::ResourceObj(const ResourceObj& r) { // default copy constructor
+    // Used in ClassFileParser::parse_constant_pool_entries() for ClassFileStream.
+    set_allocation_type((address)this, STACK_OR_EMBEDDED);
+}
+
+ResourceObj& ResourceObj::operator=(const ResourceObj& r) { // default copy assignment
+    // Used in InlineTree::ok_to_inline() for WarmCallInfo.
+    assert(allocated_on_stack(), "copy only into local");
+    // Keep current _allocation value;
+    return *this;
+}
+
+ResourceObj::~ResourceObj() {
+    // allocated_on_C_heap() also checks that encoded (in _allocation) address == this.
+    if (!allocated_on_C_heap()) {  // ResourceObj::delete() zaps _allocation for C_heap.
+      _allocation = badHeapOopVal; // zap type
+    }
+}
+#endif // ASSERT
+
+
 void trace_heap_malloc(size_t size, const char* name, void* p) {
   // A lock is not needed here - tty uses a lock internally
   tty->print_cr("Heap malloc " INTPTR_FORMAT " %7d %s", p, size, name == NULL ? "" : name);
@@ -166,32 +215,40 @@
     _medium_pool = new ChunkPool(Chunk::medium_size + Chunk::aligned_overhead_size());
     _small_pool  = new ChunkPool(Chunk::init_size   + Chunk::aligned_overhead_size());
   }
+
+  static void clean() {
+    enum { BlocksToKeep = 5 };
+     _small_pool->free_all_but(BlocksToKeep);
+     _medium_pool->free_all_but(BlocksToKeep);
+     _large_pool->free_all_but(BlocksToKeep);
+  }
 };
 
 ChunkPool* ChunkPool::_large_pool  = NULL;
 ChunkPool* ChunkPool::_medium_pool = NULL;
 ChunkPool* ChunkPool::_small_pool  = NULL;
 
-
 void chunkpool_init() {
   ChunkPool::initialize();
 }
 
+void
+Chunk::clean_chunk_pool() {
+  ChunkPool::clean();
+}
+
 
 //--------------------------------------------------------------------------------------
 // ChunkPoolCleaner implementation
+//
 
 class ChunkPoolCleaner : public PeriodicTask {
-  enum { CleaningInterval = 5000,        // cleaning interval in ms
-         BlocksToKeep     = 5            // # of extra blocks to keep
-  };
+  enum { CleaningInterval = 5000 };      // cleaning interval in ms
 
  public:
    ChunkPoolCleaner() : PeriodicTask(CleaningInterval) {}
    void task() {
-     ChunkPool::small_pool()->free_all_but(BlocksToKeep);
-     ChunkPool::medium_pool()->free_all_but(BlocksToKeep);
-     ChunkPool::large_pool()->free_all_but(BlocksToKeep);
+     ChunkPool::clean();
    }
 };
 
--- a/hotspot/src/share/vm/memory/allocation.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/memory/allocation.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -174,9 +174,10 @@
 
   // Start the chunk_pool cleaner task
   static void start_chunk_pool_cleaner_task();
+
+  static void clean_chunk_pool();
 };
 
-
 //------------------------------Arena------------------------------------------
 // Fast allocation of memory
 class Arena: public CHeapObj {
@@ -316,32 +317,36 @@
 // use delete to deallocate.
 class ResourceObj ALLOCATION_SUPER_CLASS_SPEC {
  public:
-  enum allocation_type { UNKNOWN = 0, C_HEAP, RESOURCE_AREA, ARENA };
+  enum allocation_type { STACK_OR_EMBEDDED = 0, RESOURCE_AREA, C_HEAP, ARENA, allocation_mask = 0x3 };
+  static void set_allocation_type(address res, allocation_type type) NOT_DEBUG_RETURN;
 #ifdef ASSERT
  private:
-  allocation_type _allocation;
+  // When this object is allocated on stack the new() operator is not
+  // called but garbage on stack may look like a valid allocation_type.
+  // Store negated 'this' pointer when new() is called to distinguish cases.
+  uintptr_t _allocation;
  public:
-  bool allocated_on_C_heap()    { return _allocation == C_HEAP; }
+  allocation_type get_allocation_type() const;
+  bool allocated_on_stack()    const { return get_allocation_type() == STACK_OR_EMBEDDED; }
+  bool allocated_on_res_area() const { return get_allocation_type() == RESOURCE_AREA; }
+  bool allocated_on_C_heap()   const { return get_allocation_type() == C_HEAP; }
+  bool allocated_on_arena()    const { return get_allocation_type() == ARENA; }
+  ResourceObj(); // default construtor
+  ResourceObj(const ResourceObj& r); // default copy construtor
+  ResourceObj& operator=(const ResourceObj& r); // default copy assignment
+  ~ResourceObj();
 #endif // ASSERT
 
  public:
   void* operator new(size_t size, allocation_type type);
   void* operator new(size_t size, Arena *arena) {
       address res = (address)arena->Amalloc(size);
-      // Set allocation type in the resource object
-      DEBUG_ONLY(((ResourceObj *)res)->_allocation = ARENA;)
+      DEBUG_ONLY(set_allocation_type(res, ARENA);)
       return res;
   }
   void* operator new(size_t size) {
       address res = (address)resource_allocate_bytes(size);
-      // Set allocation type in the resource object
-      DEBUG_ONLY(((ResourceObj *)res)->_allocation = RESOURCE_AREA;)
-      return res;
-  }
-  void* operator new(size_t size, void* where, allocation_type type) {
-      void* res = where;
-      // Set allocation type in the resource object
-      DEBUG_ONLY(((ResourceObj *)res)->_allocation = type;)
+      DEBUG_ONLY(set_allocation_type(res, RESOURCE_AREA);)
       return res;
   }
   void  operator delete(void* p);
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -44,6 +44,7 @@
   friend class VMStructs;
   friend class CardTableRS;
   friend class CheckForUnmarkedOops; // Needs access to raw card bytes.
+  friend class SharkBuilder;
 #ifndef PRODUCT
   // For debugging.
   friend class GuaranteeNotModClosure;
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -941,7 +941,9 @@
             VerifyBeforeExit ||
             PrintAssembly    ||
             tty->count() != 0 ||   // already printing
-            VerifyAfterGC, "too expensive");
+            VerifyAfterGC    ||
+    VMError::fatal_error_in_progress(), "too expensive");
+
   #endif
   // This might be sped up with a cache of the last generation that
   // answered yes.
--- a/hotspot/src/share/vm/memory/generation.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/memory/generation.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -131,7 +131,9 @@
   enum SomePublicConstants {
     // Generations are GenGrain-aligned and have size that are multiples of
     // GenGrain.
-    LogOfGenGrain = 16,
+    // Note: on ARM we add 1 bit for card_table_base to be properly aligned
+    // (we expect its low byte to be zero - see implementation of post_barrier)
+    LogOfGenGrain = 16 ARM_ONLY(+1),
     GenGrain = 1 << LogOfGenGrain
   };
 
--- a/hotspot/src/share/vm/oops/arrayKlass.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/arrayKlass.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -179,8 +179,6 @@
   return JVMTI_CLASS_STATUS_ARRAY;
 }
 
-#ifndef PRODUCT
-
 // Printing
 
 void arrayKlass::oop_print_on(oop obj, outputStream* st) {
@@ -189,8 +187,6 @@
   st->print_cr(" - length: %d", arrayOop(obj)->length());
 }
 
-#endif
-
 // Verification
 
 void arrayKlass::oop_verify_on(oop obj, outputStream* st) {
--- a/hotspot/src/share/vm/oops/arrayKlass.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/arrayKlass.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -115,20 +115,15 @@
   // Return a handle.
   static void     complete_create_array_klass(arrayKlassHandle k, KlassHandle super_klass, TRAPS);
 
- public:
-   // jvm support
-   jint compute_modifier_flags(TRAPS) const;
+  // jvm support
+  jint compute_modifier_flags(TRAPS) const;
 
- public:
-   // JVMTI support
-   jint jvmti_class_status() const;
+  // JVMTI support
+  jint jvmti_class_status() const;
 
-#ifndef PRODUCT
- public:
   // Printing
   void oop_print_on(oop obj, outputStream* st);
-#endif
- public:
+
   // Verification
   void oop_verify_on(oop obj, outputStream* st);
 };
--- a/hotspot/src/share/vm/oops/arrayKlassKlass.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/arrayKlassKlass.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -151,15 +151,12 @@
 }
 #endif // SERIALGC
 
-#ifndef PRODUCT
-
 // Printing
 
 void arrayKlassKlass::oop_print_on(oop obj, outputStream* st) {
   assert(obj->is_klass(), "must be klass");
   klassKlass::oop_print_on(obj, st);
 }
-#endif //PRODUCT
 
 void arrayKlassKlass::oop_print_value_on(oop obj, outputStream* st) {
   assert(obj->is_klass(), "must be klass");
--- a/hotspot/src/share/vm/oops/arrayKlassKlass.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/arrayKlassKlass.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -55,12 +55,9 @@
   int oop_oop_iterate(oop obj, OopClosure* blk);
   int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr);
 
- public:
   // Printing
   void oop_print_value_on(oop obj, outputStream* st);
-#ifndef PRODUCT
   void oop_print_on(oop obj, outputStream* st);
-#endif //PRODUCT
 
   // Verification
   const char* internal_name() const;
--- a/hotspot/src/share/vm/oops/compiledICHolderKlass.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/compiledICHolderKlass.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -154,8 +154,6 @@
 }
 #endif // SERIALGC
 
-#ifndef PRODUCT
-
 // Printing
 
 void compiledICHolderKlass::oop_print_on(oop obj, outputStream* st) {
@@ -166,8 +164,6 @@
   st->print(" - klass:  "); c->holder_klass()->print_value_on(st); st->cr();
 }
 
-#endif //PRODUCT
-
 void compiledICHolderKlass::oop_print_value_on(oop obj, outputStream* st) {
   assert(obj->is_compiledICHolder(), "must be compiledICHolder");
   Klass::oop_print_value_on(obj, st);
--- a/hotspot/src/share/vm/oops/compiledICHolderKlass.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/compiledICHolderKlass.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -68,12 +68,9 @@
   int  oop_oop_iterate(oop obj, OopClosure* blk);
   int  oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr);
 
- public:
   // Printing
   void oop_print_value_on(oop obj, outputStream* st);
-#ifndef PRODUCT
   void oop_print_on      (oop obj, outputStream* st);
-#endif //PRODUCT
 
   // Verification
   const char* internal_name() const;
--- a/hotspot/src/share/vm/oops/constMethodKlass.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/constMethodKlass.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -197,8 +197,6 @@
 }
 #endif // SERIALGC
 
-#ifndef PRODUCT
-
 // Printing
 
 void constMethodKlass::oop_print_on(oop obj, outputStream* st) {
@@ -216,8 +214,6 @@
   }
 }
 
-#endif //PRODUCT
-
 // Short version of printing constMethodOop - just print the name of the
 // method it belongs to.
 void constMethodKlass::oop_print_value_on(oop obj, outputStream* st) {
--- a/hotspot/src/share/vm/oops/constMethodKlass.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/constMethodKlass.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -77,12 +77,9 @@
   int oop_oop_iterate(oop obj, OopClosure* blk);
   int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr);
 
- public:
   // Printing
   void oop_print_value_on(oop obj, outputStream* st);
-#ifndef PRODUCT
   void oop_print_on      (oop obj, outputStream* st);
-#endif //PRODUCT
 
   // Verify operations
   const char* internal_name() const;
--- a/hotspot/src/share/vm/oops/constantPoolKlass.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/constantPoolKlass.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -299,8 +299,6 @@
 }
 #endif // SERIALGC
 
-#ifndef PRODUCT
-
 // Printing
 
 void constantPoolKlass::oop_print_on(oop obj, outputStream* st) {
@@ -379,6 +377,10 @@
       case JVM_CONSTANT_MethodType :
         st->print("signature_index=%d", cp->method_type_index_at(index));
         break;
+      case JVM_CONSTANT_InvokeDynamic :
+        st->print("bootstrap_method_index=%d", cp->invoke_dynamic_bootstrap_method_ref_index_at(index));
+        st->print(" name_and_type_index=%d", cp->invoke_dynamic_name_and_type_ref_index_at(index));
+        break;
       default:
         ShouldNotReachHere();
         break;
@@ -388,8 +390,6 @@
   st->cr();
 }
 
-#endif
-
 void constantPoolKlass::oop_print_value_on(oop obj, outputStream* st) {
   assert(obj->is_constantPool(), "must be constantPool");
   constantPoolOop cp = constantPoolOop(obj);
--- a/hotspot/src/share/vm/oops/constantPoolKlass.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/constantPoolKlass.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -61,18 +61,13 @@
   int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr);
 
   // Allocation profiling support
-  // no idea why this is pure virtual and not in Klass ???
   juint alloc_size() const              { return _alloc_size; }
   void set_alloc_size(juint n)          { _alloc_size = n; }
 
- public:
   // Printing
   void oop_print_value_on(oop obj, outputStream* st);
-#ifndef PRODUCT
   void oop_print_on(oop obj, outputStream* st);
-#endif
 
- public:
   // Verification
   const char* internal_name() const;
   void oop_verify_on(oop obj, outputStream* st);
--- a/hotspot/src/share/vm/oops/constantPoolOop.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/constantPoolOop.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -264,10 +264,15 @@
 int constantPoolOopDesc::impl_name_and_type_ref_index_at(int which, bool uncached) {
   int i = which;
   if (!uncached && cache() != NULL) {
-    if (constantPoolCacheOopDesc::is_secondary_index(which))
+    if (constantPoolCacheOopDesc::is_secondary_index(which)) {
       // Invokedynamic indexes are always processed in native order
       // so there is no question of reading a native u2 in Java order here.
-      return cache()->main_entry_at(which)->constant_pool_index();
+      int pool_index = cache()->main_entry_at(which)->constant_pool_index();
+      if (tag_at(pool_index).is_invoke_dynamic())
+        pool_index = invoke_dynamic_name_and_type_ref_index_at(pool_index);
+      assert(tag_at(pool_index).is_name_and_type(), "");
+      return pool_index;
+    }
     // change byte-ordering and go via cache
     i = remap_instruction_operand_from_cache(which);
   } else {
@@ -830,6 +835,19 @@
     }
   } break;
 
+  case JVM_CONSTANT_InvokeDynamic:
+  {
+    int k1 = invoke_dynamic_bootstrap_method_ref_index_at(index1);
+    int k2 = cp2->invoke_dynamic_bootstrap_method_ref_index_at(index2);
+    if (k1 == k2) {
+      int i1 = invoke_dynamic_name_and_type_ref_index_at(index1);
+      int i2 = cp2->invoke_dynamic_name_and_type_ref_index_at(index2);
+      if (i1 == i2) {
+        return true;
+      }
+    }
+  } break;
+
   case JVM_CONSTANT_UnresolvedString:
   {
     symbolOop s1 = unresolved_string_at(index1);
@@ -1016,6 +1034,13 @@
     to_cp->method_handle_index_at_put(to_i, k1, k2);
   } break;
 
+  case JVM_CONSTANT_InvokeDynamic:
+  {
+    int k1 = invoke_dynamic_bootstrap_method_ref_index_at(from_i);
+    int k2 = invoke_dynamic_name_and_type_ref_index_at(from_i);
+    to_cp->invoke_dynamic_at_put(to_i, k1, k2);
+  } break;
+
   // Invalid is used as the tag for the second constant pool entry
   // occupied by JVM_CONSTANT_Double or JVM_CONSTANT_Long. It should
   // not be seen by itself.
@@ -1231,6 +1256,7 @@
     case JVM_CONSTANT_Methodref:
     case JVM_CONSTANT_InterfaceMethodref:
     case JVM_CONSTANT_NameAndType:
+    case JVM_CONSTANT_InvokeDynamic:
       return 5;
 
     case JVM_CONSTANT_Long:
@@ -1444,6 +1470,15 @@
         DBG(printf("JVM_CONSTANT_MethodType: %hd", idx1));
         break;
       }
+      case JVM_CONSTANT_InvokeDynamic: {
+        *bytes = JVM_CONSTANT_InvokeDynamic;
+        idx1 = invoke_dynamic_bootstrap_method_ref_index_at(idx);
+        idx2 = invoke_dynamic_name_and_type_ref_index_at(idx);
+        Bytes::put_Java_u2((address) (bytes+1), idx1);
+        Bytes::put_Java_u2((address) (bytes+3), idx2);
+        DBG(printf("JVM_CONSTANT_InvokeDynamic: %hd %hd", idx1, idx2));
+        break;
+      }
     }
     DBG(printf("\n"));
     bytes += ent_size;
--- a/hotspot/src/share/vm/oops/constantPoolOop.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/constantPoolOop.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -156,6 +156,11 @@
     *int_at_addr(which) = ref_index;
   }
 
+  void invoke_dynamic_at_put(int which, int bootstrap_method_index, int name_and_type_index) {
+    tag_at_put(which, JVM_CONSTANT_InvokeDynamic);
+    *int_at_addr(which) = ((jint) name_and_type_index<<16) | bootstrap_method_index;
+  }
+
   // Temporary until actual use
   void unresolved_string_at_put(int which, symbolOop s) {
     *obj_at_addr(which) = NULL;
@@ -396,6 +401,16 @@
     int sym = method_type_index_at(which);
     return symbol_at(sym);
   }
+  int invoke_dynamic_bootstrap_method_ref_index_at(int which) {
+    assert(tag_at(which).is_invoke_dynamic(), "Corrupted constant pool");
+    jint ref_index = *int_at_addr(which);
+    return extract_low_short_from_int(ref_index);
+  }
+  int invoke_dynamic_name_and_type_ref_index_at(int which) {
+    assert(tag_at(which).is_invoke_dynamic(), "Corrupted constant pool");
+    jint ref_index = *int_at_addr(which);
+    return extract_high_short_from_int(ref_index);
+  }
 
   // The following methods (name/signature/klass_ref_at, klass_ref_at_noresolve,
   // name_and_type_ref_index_at) all expect to be passed indices obtained
--- a/hotspot/src/share/vm/oops/cpCacheKlass.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/cpCacheKlass.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -248,8 +248,6 @@
 }
 #endif // SERIALGC
 
-#ifndef PRODUCT
-
 void constantPoolCacheKlass::oop_print_on(oop obj, outputStream* st) {
   assert(obj->is_constantPoolCache(), "obj must be constant pool cache");
   constantPoolCacheOop cache = (constantPoolCacheOop)obj;
@@ -259,8 +257,6 @@
   for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->print(st, i);
 }
 
-#endif
-
 void constantPoolCacheKlass::oop_print_value_on(oop obj, outputStream* st) {
   assert(obj->is_constantPoolCache(), "obj must be constant pool cache");
   constantPoolCacheOop cache = (constantPoolCacheOop)obj;
--- a/hotspot/src/share/vm/oops/cpCacheKlass.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/cpCacheKlass.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -61,14 +61,10 @@
   juint alloc_size() const              { return _alloc_size; }
   void set_alloc_size(juint n)          { _alloc_size = n; }
 
- public:
   // Printing
   void oop_print_value_on(oop obj, outputStream* st);
-#ifndef PRODUCT
   void oop_print_on(oop obj, outputStream* st);
-#endif
 
- public:
   // Verification
   const char* internal_name() const;
   void oop_verify_on(oop obj, outputStream* st);
--- a/hotspot/src/share/vm/oops/cpCacheOop.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/cpCacheOop.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -134,7 +134,7 @@
 void ConstantPoolCacheEntry::set_method(Bytecodes::Code invoke_code,
                                         methodHandle method,
                                         int vtable_index) {
-
+  assert(!is_secondary_entry(), "");
   assert(method->interpreter_entry() != NULL, "should have been set at this point");
   assert(!method->is_obsolete(),  "attempt to write obsolete method to cpCache");
   bool change_to_virtual = (invoke_code == Bytecodes::_invokeinterface);
@@ -142,7 +142,6 @@
   int byte_no = -1;
   bool needs_vfinal_flag = false;
   switch (invoke_code) {
-    case Bytecodes::_invokedynamic:
     case Bytecodes::_invokevirtual:
     case Bytecodes::_invokeinterface: {
         if (method->can_be_statically_bound()) {
@@ -155,6 +154,23 @@
         byte_no = 2;
         break;
     }
+
+    case Bytecodes::_invokedynamic:  // similar to _invokevirtual
+      if (TraceInvokeDynamic) {
+        tty->print_cr("InvokeDynamic set_method%s method="PTR_FORMAT" index=%d",
+                      (is_secondary_entry() ? " secondary" : ""),
+                      (intptr_t)method(), vtable_index);
+        method->print();
+        this->print(tty, 0);
+      }
+      assert(method->can_be_statically_bound(), "must be a MH invoker method");
+      assert(AllowTransitionalJSR292 || _f2 >= constantPoolOopDesc::CPCACHE_INDEX_TAG, "BSM index initialized");
+      set_f1(method());
+      needs_vfinal_flag = false;  // _f2 is not an oop
+      assert(!is_vfinal(), "f2 not an oop");
+      byte_no = 1;  // coordinate this with bytecode_number & is_resolved
+      break;
+
     case Bytecodes::_invokespecial:
       // Preserve the value of the vfinal flag on invokevirtual bytecode
       // which may be shared with this constant pool cache entry.
@@ -209,6 +225,7 @@
 
 
 void ConstantPoolCacheEntry::set_interface_call(methodHandle method, int index) {
+  assert(!is_secondary_entry(), "");
   klassOop interf = method->method_holder();
   assert(instanceKlass::cast(interf)->is_interface(), "must be an interface");
   set_f1(interf);
@@ -218,8 +235,23 @@
 }
 
 
+void ConstantPoolCacheEntry::initialize_bootstrap_method_index_in_cache(int bsm_cache_index) {
+  assert(!is_secondary_entry(), "only for JVM_CONSTANT_InvokeDynamic main entry");
+  assert(_f2 == 0, "initialize once");
+  assert(bsm_cache_index == (int)(u2)bsm_cache_index, "oob");
+  set_f2(bsm_cache_index + constantPoolOopDesc::CPCACHE_INDEX_TAG);
+}
+
+int ConstantPoolCacheEntry::bootstrap_method_index_in_cache() {
+  assert(!is_secondary_entry(), "only for JVM_CONSTANT_InvokeDynamic main entry");
+  intptr_t bsm_cache_index = (intptr_t) _f2 - constantPoolOopDesc::CPCACHE_INDEX_TAG;
+  assert(bsm_cache_index == (intptr_t)(u2)bsm_cache_index, "oob");
+  return (int) bsm_cache_index;
+}
+
 void ConstantPoolCacheEntry::set_dynamic_call(Handle call_site,
                                               methodHandle signature_invoker) {
+  assert(is_secondary_entry(), "");
   int param_size = signature_invoker->size_of_parameters();
   assert(param_size >= 1, "method argument size must include MH.this");
   param_size -= 1;              // do not count MH.this; it is not stacked for invokedynamic
@@ -227,7 +259,6 @@
     // racing threads might be trying to install their own favorites
     set_f1(call_site());
   }
-  //set_f2(0);
   bool is_final = true;
   assert(signature_invoker->is_final_method(), "is_final");
   set_flags(as_flags(as_TosState(signature_invoker->result_type()), is_final, false, false, false, true) | param_size);
@@ -417,14 +448,14 @@
   // print separator
   if (index == 0) tty->print_cr("                 -------------");
   // print entry
-  tty->print_cr("%3d  (%08x)  ", index, this);
+  tty->print("%3d  ("PTR_FORMAT")  ", index, (intptr_t)this);
   if (is_secondary_entry())
     tty->print_cr("[%5d|secondary]", main_entry_index());
   else
     tty->print_cr("[%02x|%02x|%5d]", bytecode_2(), bytecode_1(), constant_pool_index());
-  tty->print_cr("                 [   %08x]", (address)(oop)_f1);
-  tty->print_cr("                 [   %08x]", _f2);
-  tty->print_cr("                 [   %08x]", _flags);
+  tty->print_cr("                 [   "PTR_FORMAT"]", (intptr_t)(oop)_f1);
+  tty->print_cr("                 [   "PTR_FORMAT"]", (intptr_t)_f2);
+  tty->print_cr("                 [   "PTR_FORMAT"]", (intptr_t)_flags);
   tty->print_cr("                 -------------");
 }
 
--- a/hotspot/src/share/vm/oops/cpCacheOop.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/cpCacheOop.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -185,6 +185,10 @@
     methodHandle signature_invoker               // determines signature information
   );
 
+  // For JVM_CONSTANT_InvokeDynamic cache entries:
+  void initialize_bootstrap_method_index_in_cache(int bsm_cache_index);
+  int  bootstrap_method_index_in_cache();
+
   void set_parameter_size(int value) {
     assert(parameter_size() == 0 || parameter_size() == value,
            "size must not change");
@@ -207,6 +211,7 @@
       case Bytecodes::_getfield        :    // fall through
       case Bytecodes::_invokespecial   :    // fall through
       case Bytecodes::_invokestatic    :    // fall through
+      case Bytecodes::_invokedynamic   :    // fall through
       case Bytecodes::_invokeinterface : return 1;
       case Bytecodes::_putstatic       :    // fall through
       case Bytecodes::_putfield        :    // fall through
@@ -234,6 +239,7 @@
   Bytecodes::Code bytecode_1() const             { return Bytecodes::cast((_indices >> 16) & 0xFF); }
   Bytecodes::Code bytecode_2() const             { return Bytecodes::cast((_indices >> 24) & 0xFF); }
   volatile oop  f1() const                       { return _f1; }
+  bool is_f1_null() const                        { return (oop)_f1 == NULL; }  // classifies a CPC entry as unbound
   intx f2() const                                { return _f2; }
   int  field_index() const;
   int  parameter_size() const                    { return _flags & 0xFF; }
--- a/hotspot/src/share/vm/oops/generateOopMap.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/generateOopMap.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -2111,7 +2111,13 @@
   // We do not distinguish between different types of errors for verification
   // errors.  Let the verifier give a better message.
   const char *msg = "Illegal class file encountered. Try running with -Xverify:all";
-  error_work(msg, NULL);
+  _got_error = true;
+  // Append method name
+  char msg_buffer2[512];
+  jio_snprintf(msg_buffer2, sizeof(msg_buffer2), "%s in method %s", msg,
+               method()->name()->as_C_string());
+  _exception = Exceptions::new_exception(Thread::current(),
+                vmSymbols::java_lang_LinkageError(), msg_buffer2);
 }
 
 //
--- a/hotspot/src/share/vm/oops/klass.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/klass.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -520,8 +520,6 @@
   return 0;
 }
 
-#ifndef PRODUCT
-
 // Printing
 
 void Klass::oop_print_on(oop obj, outputStream* st) {
@@ -541,8 +539,6 @@
   st->cr();
 }
 
-#endif //PRODUCT
-
 void Klass::oop_print_value_on(oop obj, outputStream* st) {
   // print title
   ResourceMark rm;              // Cannot print in debug mode without this
--- a/hotspot/src/share/vm/oops/klass.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/klass.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -772,16 +772,12 @@
   // jvm support
   virtual jint compute_modifier_flags(TRAPS) const;
 
- public:
   // JVMTI support
   virtual jint jvmti_class_status() const;
 
- public:
   // Printing
   virtual void oop_print_value_on(oop obj, outputStream* st);
-#ifndef PRODUCT
   virtual void oop_print_on      (oop obj, outputStream* st);
-#endif //PRODUCT
 
   // Verification
   virtual const char* internal_name() const = 0;
--- a/hotspot/src/share/vm/oops/klassKlass.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/klassKlass.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -194,16 +194,12 @@
 #endif // SERIALGC
 
 
-#ifndef PRODUCT
-
 // Printing
 
 void klassKlass::oop_print_on(oop obj, outputStream* st) {
   Klass::oop_print_on(obj, st);
 }
 
-#endif //PRODUCT
-
 void klassKlass::oop_print_value_on(oop obj, outputStream* st) {
   Klass::oop_print_value_on(obj, st);
 }
--- a/hotspot/src/share/vm/oops/klassKlass.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/klassKlass.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -67,12 +67,9 @@
   juint alloc_size() const              { return _alloc_size; }
   void set_alloc_size(juint n)          { _alloc_size = n; }
 
- public:
   // Printing
   void oop_print_value_on(oop obj, outputStream* st);
-#ifndef PRODUCT
   void oop_print_on      (oop obj, outputStream* st);
-#endif //PRODUCT
 
   // Verification
   const char* internal_name() const;
--- a/hotspot/src/share/vm/oops/methodOop.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/methodOop.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -751,10 +751,14 @@
   }
 
   OrderAccess::storestore();
+#ifdef SHARK
+  mh->_from_interpreted_entry = code->instructions_begin();
+#else
   mh->_from_compiled_entry = code->verified_entry_point();
   OrderAccess::storestore();
   // Instantly compiled code can execute.
   mh->_from_interpreted_entry = mh->get_i2c_entry();
+#endif // SHARK
 
 }
 
@@ -851,9 +855,15 @@
 // MethodHandleCompiler.
 // Must be consistent with MethodHandleCompiler::get_method_oop().
 bool methodOopDesc::is_method_handle_adapter() const {
-  return (is_method_handle_invoke_name(name()) &&
-          is_synthetic() &&
-          MethodHandleCompiler::klass_is_method_handle_adapter_holder(method_holder()));
+  if (is_synthetic() &&
+      !is_native() &&   // has code from MethodHandleCompiler
+      is_method_handle_invoke_name(name()) &&
+      MethodHandleCompiler::klass_is_method_handle_adapter_holder(method_holder())) {
+    assert(!is_method_handle_invoke(), "disjoint");
+    return true;
+  } else {
+    return false;
+  }
 }
 
 methodHandle methodOopDesc::make_invoke_method(KlassHandle holder,
--- a/hotspot/src/share/vm/oops/oop.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/oops/oop.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -29,15 +29,6 @@
 
 BarrierSet* oopDesc::_bs = NULL;
 
-#ifdef PRODUCT
-void oopDesc::print_on(outputStream* st) const {}
-void oopDesc::print_address_on(outputStream* st) const {}
-char* oopDesc::print_string() { return NULL; }
-void oopDesc::print()         {}
-void oopDesc::print_address() {}
-
-#else //PRODUCT
-
 void oopDesc::print_on(outputStream* st) const {
   if (this == NULL) {
     st->print_cr("NULL");
@@ -62,10 +53,6 @@
   return st.as_string();
 }
 
-#endif // PRODUCT
-
-// The print_value functions are present in all builds, to support the disassembler.
-
 void oopDesc::print_value() {
   print_value_on(tty);
 }
@@ -83,9 +70,7 @@
     st->print("NULL");
   } else if (java_lang_String::is_instance(obj)) {
     java_lang_String::print(obj, st);
-#ifndef PRODUCT
     if (PrintOopAddress) print_address_on(st);
-#endif //PRODUCT
 #ifdef ASSERT
   } else if (!Universe::heap()->is_in(obj) || !Universe::heap()->is_in(klass())) {
     st->print("### BAD OOP %p ###", (address)obj);
--- a/hotspot/src/share/vm/opto/block.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/opto/block.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -353,7 +353,8 @@
 PhaseCFG::PhaseCFG( Arena *a, RootNode *r, Matcher &m ) :
   Phase(CFG),
   _bbs(a),
-  _root(r)
+  _root(r),
+  _node_latency(NULL)
 #ifndef PRODUCT
   , _trace_opto_pipelining(TraceOptoPipelining || C->method_has_option("TraceOptoPipelining"))
 #endif
--- a/hotspot/src/share/vm/opto/block.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/opto/block.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -374,7 +374,7 @@
   float _outer_loop_freq;       // Outmost loop frequency
 
   // Per node latency estimation, valid only during GCM
-  GrowableArray<uint> _node_latency;
+  GrowableArray<uint> *_node_latency;
 
 #ifndef PRODUCT
   bool _trace_opto_pipelining;  // tracing flag
--- a/hotspot/src/share/vm/opto/c2_globals.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/opto/c2_globals.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -281,6 +281,12 @@
   product(bool, InsertMemBarAfterArraycopy, true,                           \
           "Insert memory barrier after arraycopy call")                     \
                                                                             \
+  develop(bool, SubsumeLoads, true,                                         \
+          "Attempt to compile while subsuming loads into machine instructions.") \
+                                                                            \
+  develop(bool, StressRecompilation, false,                                 \
+          "Recompile each compiled method without subsuming loads or escape analysis.") \
+                                                                            \
   /* controls for tier 1 compilations */                                    \
                                                                             \
   develop(bool, Tier1CountInvocations, true,                                \
--- a/hotspot/src/share/vm/opto/c2compiler.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/opto/c2compiler.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -103,13 +103,14 @@
   if (!is_initialized()) {
     initialize();
   }
-  bool subsume_loads = true;
+  bool subsume_loads = SubsumeLoads;
   bool do_escape_analysis = DoEscapeAnalysis &&
     !env->jvmti_can_access_local_variables();
   while (!env->failing()) {
     // Attempt to compile while subsuming loads into machine instructions.
     Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis);
 
+
     // Check result and retry if appropriate.
     if (C.failure_reason() != NULL) {
       if (C.failure_reason_is(retry_no_subsuming_loads())) {
@@ -127,6 +128,16 @@
       // on the ciEnv via env->record_method_not_compilable().
       env->record_failure(C.failure_reason());
     }
+    if (StressRecompilation) {
+      if (subsume_loads) {
+        subsume_loads = false;
+        continue;  // retry
+      }
+      if (do_escape_analysis) {
+        do_escape_analysis = false;
+        continue;  // retry
+      }
+    }
 
     // No retry; just break the loop.
     break;
--- a/hotspot/src/share/vm/opto/chaitin.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/opto/chaitin.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -569,7 +569,7 @@
         if (trace_spilling() && lrg._def != NULL) {
           // collect defs for MultiDef printing
           if (lrg._defs == NULL) {
-            lrg._defs = new (_ifg->_arena) GrowableArray<Node*>();
+            lrg._defs = new (_ifg->_arena) GrowableArray<Node*>(_ifg->_arena, 2, 0, NULL);
             lrg._defs->append(lrg._def);
           }
           lrg._defs->append(n);
--- a/hotspot/src/share/vm/opto/compile.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/opto/compile.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -904,8 +904,8 @@
   probe_alias_cache(NULL)->_index = AliasIdxTop;
 
   _intrinsics = NULL;
-  _macro_nodes = new GrowableArray<Node*>(comp_arena(), 8,  0, NULL);
-  _predicate_opaqs = new GrowableArray<Node*>(comp_arena(), 8,  0, NULL);
+  _macro_nodes = new(comp_arena()) GrowableArray<Node*>(comp_arena(), 8,  0, NULL);
+  _predicate_opaqs = new(comp_arena()) GrowableArray<Node*>(comp_arena(), 8,  0, NULL);
   register_library_intrinsics();
 }
 
--- a/hotspot/src/share/vm/opto/gcm.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/opto/gcm.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -841,7 +841,7 @@
 #ifndef PRODUCT
   if (trace_opto_pipelining()) {
     tty->print("# latency_to_inputs: node_latency[%d] = %d for node",
-               n->_idx, _node_latency.at_grow(n->_idx));
+               n->_idx, _node_latency->at_grow(n->_idx));
     dump();
   }
 #endif
@@ -853,7 +853,7 @@
     return;
 
   uint nlen = n->len();
-  uint use_latency = _node_latency.at_grow(n->_idx);
+  uint use_latency = _node_latency->at_grow(n->_idx);
   uint use_pre_order = _bbs[n->_idx]->_pre_order;
 
   for ( uint j=0; j<nlen; j++ ) {
@@ -884,15 +884,15 @@
     uint delta_latency = n->latency(j);
     uint current_latency = delta_latency + use_latency;
 
-    if (_node_latency.at_grow(def->_idx) < current_latency) {
-      _node_latency.at_put_grow(def->_idx, current_latency);
+    if (_node_latency->at_grow(def->_idx) < current_latency) {
+      _node_latency->at_put_grow(def->_idx, current_latency);
     }
 
 #ifndef PRODUCT
     if (trace_opto_pipelining()) {
       tty->print_cr("#      %d + edge_latency(%d) == %d -> %d, node_latency[%d] = %d",
                     use_latency, j, delta_latency, current_latency, def->_idx,
-                    _node_latency.at_grow(def->_idx));
+                    _node_latency->at_grow(def->_idx));
     }
 #endif
   }
@@ -926,7 +926,7 @@
       return 0;
 
     uint nlen = use->len();
-    uint nl = _node_latency.at_grow(use->_idx);
+    uint nl = _node_latency->at_grow(use->_idx);
 
     for ( uint j=0; j<nlen; j++ ) {
       if (use->in(j) == n) {
@@ -962,7 +962,7 @@
 #ifndef PRODUCT
   if (trace_opto_pipelining()) {
     tty->print("# latency_from_outputs: node_latency[%d] = %d for node",
-               n->_idx, _node_latency.at_grow(n->_idx));
+               n->_idx, _node_latency->at_grow(n->_idx));
     dump();
   }
 #endif
@@ -975,7 +975,7 @@
     if (latency < l) latency = l;
   }
 
-  _node_latency.at_put_grow(n->_idx, latency);
+  _node_latency->at_put_grow(n->_idx, latency);
 }
 
 //------------------------------hoist_to_cheaper_block-------------------------
@@ -985,9 +985,9 @@
   const double delta = 1+PROB_UNLIKELY_MAG(4);
   Block* least       = LCA;
   double least_freq  = least->_freq;
-  uint target        = _node_latency.at_grow(self->_idx);
-  uint start_latency = _node_latency.at_grow(LCA->_nodes[0]->_idx);
-  uint end_latency   = _node_latency.at_grow(LCA->_nodes[LCA->end_idx()]->_idx);
+  uint target        = _node_latency->at_grow(self->_idx);
+  uint start_latency = _node_latency->at_grow(LCA->_nodes[0]->_idx);
+  uint end_latency   = _node_latency->at_grow(LCA->_nodes[LCA->end_idx()]->_idx);
   bool in_latency    = (target <= start_latency);
   const Block* root_block = _bbs[_root->_idx];
 
@@ -1005,7 +1005,7 @@
 #ifndef PRODUCT
   if (trace_opto_pipelining()) {
     tty->print("# Find cheaper block for latency %d: ",
-      _node_latency.at_grow(self->_idx));
+      _node_latency->at_grow(self->_idx));
     self->dump();
     tty->print_cr("#   B%d: start latency for [%4d]=%d, end latency for [%4d]=%d, freq=%g",
       LCA->_pre_order,
@@ -1032,9 +1032,9 @@
     if (mach && LCA == root_block)
       break;
 
-    uint start_lat = _node_latency.at_grow(LCA->_nodes[0]->_idx);
+    uint start_lat = _node_latency->at_grow(LCA->_nodes[0]->_idx);
     uint end_idx   = LCA->end_idx();
-    uint end_lat   = _node_latency.at_grow(LCA->_nodes[end_idx]->_idx);
+    uint end_lat   = _node_latency->at_grow(LCA->_nodes[end_idx]->_idx);
     double LCA_freq = LCA->_freq;
 #ifndef PRODUCT
     if (trace_opto_pipelining()) {
@@ -1073,7 +1073,7 @@
       tty->print_cr("#  Change latency for [%4d] from %d to %d", self->_idx, target, end_latency);
     }
 #endif
-    _node_latency.at_put_grow(self->_idx, end_latency);
+    _node_latency->at_put_grow(self->_idx, end_latency);
     partial_latency_of_defs(self);
   }
 
@@ -1255,8 +1255,7 @@
 
   // Compute the latency information (via backwards walk) for all the
   // instructions in the graph
-  GrowableArray<uint> node_latency;
-  _node_latency = node_latency;
+  _node_latency = new GrowableArray<uint>(); // resource_area allocation
 
   if( C->do_scheduling() )
     ComputeLatenciesBackwards(visited, stack);
@@ -1341,6 +1340,8 @@
     }
   }
 #endif
+  // Dead.
+  _node_latency = (GrowableArray<uint> *)0xdeadbeef;
 }
 
 
--- a/hotspot/src/share/vm/opto/lcm.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/opto/lcm.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -113,7 +113,8 @@
     if( !m->is_Mach() ) continue;
     MachNode *mach = m->as_Mach();
     was_store = false;
-    switch( mach->ideal_Opcode() ) {
+    int iop = mach->ideal_Opcode();
+    switch( iop ) {
     case Op_LoadB:
     case Op_LoadUS:
     case Op_LoadD:
@@ -155,6 +156,12 @@
     default:                    // Also check for embedded loads
       if( !mach->needs_anti_dependence_check() )
         continue;               // Not an memory op; skip it
+      if( must_clone[iop] ) {
+        // Do not move nodes which produce flags because
+        // RA will try to clone it to place near branch and
+        // it will cause recompilation, see clone_node().
+        continue;
+      }
       {
         // Check that value is used in memory address in
         // instructions with embedded load (CmpP val1,(val2+off)).
@@ -461,7 +468,7 @@
       n_choice = 1;
     }
 
-    uint n_latency = cfg->_node_latency.at_grow(n->_idx);
+    uint n_latency = cfg->_node_latency->at_grow(n->_idx);
     uint n_score   = n->req();   // Many inputs get high score to break ties
 
     // Keep best latency found
@@ -738,7 +745,7 @@
         Node     *n = _nodes[j];
         int     idx = n->_idx;
         tty->print("#   ready cnt:%3d  ", ready_cnt[idx]);
-        tty->print("latency:%3d  ", cfg->_node_latency.at_grow(idx));
+        tty->print("latency:%3d  ", cfg->_node_latency->at_grow(idx));
         tty->print("%4d: %s\n", idx, n->Name());
       }
     }
@@ -765,7 +772,7 @@
 #ifndef PRODUCT
     if (cfg->trace_opto_pipelining()) {
       tty->print("#    select %d: %s", n->_idx, n->Name());
-      tty->print(", latency:%d", cfg->_node_latency.at_grow(n->_idx));
+      tty->print(", latency:%d", cfg->_node_latency->at_grow(n->_idx));
       n->dump();
       if (Verbose) {
         tty->print("#   ready list:");
@@ -957,6 +964,8 @@
     Block *sb = _succs[i];
     // Clone the entire area; ignoring the edge fixup for now.
     for( uint j = end; j > beg; j-- ) {
+      // It is safe here to clone a node with anti_dependence
+      // since clones dominate on each path.
       Node *clone = _nodes[j-1]->clone();
       sb->_nodes.insert( 1, clone );
       bbs.map(clone->_idx,sb);
--- a/hotspot/src/share/vm/opto/macro.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/opto/macro.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -720,7 +720,7 @@
       if (basic_elem_type == T_OBJECT || basic_elem_type == T_ARRAY) {
         if (!elem_type->is_loaded()) {
           field_type = TypeInstPtr::BOTTOM;
-        } else if (field != NULL && field->is_constant()) {
+        } else if (field != NULL && field->is_constant() && field->is_static()) {
           // This can happen if the constant oop is non-perm.
           ciObject* con = field->constant_value().as_object();
           // Do not "join" in the previous type; it doesn't add value,
--- a/hotspot/src/share/vm/opto/output.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/opto/output.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -382,6 +382,10 @@
           if (min_offset_from_last_call == 0) {
             blk_size += nop_size;
           }
+        } else if (mach->ideal_Opcode() == Op_Jump) {
+          const_size += b->_num_succs; // Address table size
+          // The size is valid even for 64 bit since it is
+          // multiplied by 2*jintSize on this method exit.
         }
       }
       min_offset_from_last_call += inst_size;
--- a/hotspot/src/share/vm/opto/reg_split.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/opto/reg_split.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -271,6 +271,32 @@
   return maxlrg;
 }
 
+//------------------------------clone_node----------------------------
+// Clone node with anti dependence check.
+Node* clone_node(Node* def, Block *b, Compile* C) {
+  if (def->needs_anti_dependence_check()) {
+#ifdef ASSERT
+    if (Verbose) {
+      tty->print_cr("RA attempts to clone node with anti_dependence:");
+      def->dump(-1); tty->cr();
+      tty->print_cr("into block:");
+      b->dump();
+    }
+#endif
+    if (C->subsume_loads() == true && !C->failing()) {
+      // Retry with subsume_loads == false
+      // If this is the first failure, the sentinel string will "stick"
+      // to the Compile object, and the C2Compiler will see it and retry.
+      C->record_failure(C2Compiler::retry_no_subsuming_loads());
+    } else {
+      // Bailout without retry
+      C->record_method_not_compilable("RA Split failed: attempt to clone node with anti_dependence");
+    }
+    return 0;
+  }
+  return def->clone();
+}
+
 //------------------------------split_Rematerialize----------------------------
 // Clone a local copy of the def.
 Node *PhaseChaitin::split_Rematerialize( Node *def, Block *b, uint insidx, uint &maxlrg, GrowableArray<uint> splits, int slidx, uint *lrg2reach, Node **Reachblock, bool walkThru ) {
@@ -298,8 +324,8 @@
     }
   }
 
-  Node *spill = def->clone();
-  if (C->check_node_count(NodeLimitFudgeFactor, out_of_nodes)) {
+  Node *spill = clone_node(def, b, C);
+  if (spill == NULL || C->check_node_count(NodeLimitFudgeFactor, out_of_nodes)) {
     // Check when generating nodes
     return 0;
   }
@@ -834,13 +860,13 @@
               // The effect of this clone is to drop the node out of the block,
               // so that the allocator does not see it anymore, and therefore
               // does not attempt to assign it a register.
-              def = def->clone();
+              def = clone_node(def, b, C);
+              if (def == NULL || C->check_node_count(NodeLimitFudgeFactor, out_of_nodes)) {
+                return 0;
+              }
               _names.extend(def->_idx,0);
               _cfg._bbs.map(def->_idx,b);
               n->set_req(inpidx, def);
-              if (C->check_node_count(NodeLimitFudgeFactor, out_of_nodes)) {
-                return 0;
-              }
               continue;
             }
 
--- a/hotspot/src/share/vm/prims/jni.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/prims/jni.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -3414,6 +3414,8 @@
 
   thread->initialize_tlab();
 
+  thread->cache_global_variables();
+
   // Crucial that we do not have a safepoint check for this thread, since it has
   // not been added to the Thread list yet.
   { Threads_lock->lock_without_safepoint_check();
--- a/hotspot/src/share/vm/prims/jvm.h	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/prims/jvm.h	Fri Aug 20 14:48:10 2010 -0400
@@ -1046,7 +1046,8 @@
     JVM_CONSTANT_InterfaceMethodref,
     JVM_CONSTANT_NameAndType,
     JVM_CONSTANT_MethodHandle           = 15,  // JSR 292
-    JVM_CONSTANT_MethodType             = 16   // JSR 292
+    JVM_CONSTANT_MethodType             = 16,  // JSR 292
+    JVM_CONSTANT_InvokeDynamic          = 17  // JSR 292
 };
 
 /* JVM_CONSTANT_MethodHandle subtypes */
--- a/hotspot/src/share/vm/prims/jvmtiEnvThreadState.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiEnvThreadState.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -24,6 +24,8 @@
 #ifndef _JAVA_JVMTIENVTHREADSTATE_H_
 #define _JAVA_JVMTIENVTHREADSTATE_H_
 
+class JvmtiEnv;
+
 ///////////////////////////////////////////////////////////////
 //
 // class JvmtiFramePop
--- a/hotspot/src/share/vm/prims/methodHandleWalk.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/prims/methodHandleWalk.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -738,6 +738,12 @@
 
   // bi
   case Bytecodes::_ldc:
+    assert(Bytecodes::format_bits(op, false) == (Bytecodes::_fmt_b|Bytecodes::_fmt_has_k), "wrong bytecode format");
+    assert((char) index == index, "index does not fit in 8-bit");
+    _bytecode.push(op);
+    _bytecode.push(index);
+    break;
+
   case Bytecodes::_iload:
   case Bytecodes::_lload:
   case Bytecodes::_fload:
@@ -754,7 +760,8 @@
     _bytecode.push(index);
     break;
 
-  // bii
+  // bkk
+  case Bytecodes::_ldc_w:
   case Bytecodes::_ldc2_w:
   case Bytecodes::_checkcast:
     assert(Bytecodes::format_bits(op, false) == Bytecodes::_fmt_bkk, "wrong bytecode format");
--- a/hotspot/src/share/vm/prims/methodHandles.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -2475,6 +2475,10 @@
 
 JVM_ENTRY(void, MHI_registerBootstrap(JNIEnv *env, jobject igcls, jclass caller_jh, jobject bsm_jh)) {
   instanceKlassHandle ik = MethodHandles::resolve_instance_klass(caller_jh, THREAD);
+  if (!AllowTransitionalJSR292) {
+    THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
+              "registerBootstrapMethod is only supported in JSR 292 EDR");
+  }
   ik->link_class(CHECK);
   if (!java_dyn_MethodHandle::is_instance(JNIHandles::resolve(bsm_jh))) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "method handle");
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -2593,6 +2593,12 @@
       FLAG_IS_DEFAULT(UseVMInterruptibleIO)) {
     FLAG_SET_DEFAULT(UseVMInterruptibleIO, true);
   }
+#ifdef LINUX
+ if (JDK_Version::current().compare_major(6) <= 0 &&
+      FLAG_IS_DEFAULT(UseLinuxPosixThreadCPUClocks)) {
+    FLAG_SET_DEFAULT(UseLinuxPosixThreadCPUClocks, false);
+  }
+#endif // LINUX
   return JNI_OK;
 }
 
@@ -2659,6 +2665,28 @@
   }
 #endif
 
+  // If we are running in a headless jre, force java.awt.headless property
+  // to be true unless the property has already been set.
+  // Also allow the OS environment variable JAVA_AWT_HEADLESS to set headless state.
+  if (os::is_headless_jre()) {
+    const char* headless = Arguments::get_property("java.awt.headless");
+    if (headless == NULL) {
+      char envbuffer[128];
+      if (!os::getenv("JAVA_AWT_HEADLESS", envbuffer, sizeof(envbuffer))) {
+        if (!add_property("java.awt.headless=true")) {
+          return JNI_ENOMEM;
+        }
+      } else {
+        char buffer[256];
+        strcpy(buffer, "java.awt.headless=");
+        strcat(buffer, envbuffer);
+        if (!add_property(buffer)) {
+          return JNI_ENOMEM;
+        }
+      }
+    }
+  }
+
   if (!check_vm_args_consistency()) {
     return JNI_ERR;
   }
@@ -2979,6 +3007,14 @@
     CommandLineFlags::printFlags();
   }
 
+  // Apply CPU specific policy for the BiasedLocking
+  if (UseBiasedLocking) {
+    if (!VM_Version::use_biased_locking() &&
+        !(FLAG_IS_CMDLINE(UseBiasedLocking))) {
+      UseBiasedLocking = false;
+    }
+  }
+
   return JNI_OK;
 }
 
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -254,6 +254,7 @@
 
   }
 
+#ifndef SHARK
   // Compute the caller frame based on the sender sp of stub_frame and stored frame sizes info.
   CodeBlob* cb = stub_frame.cb();
   // Verify we have the right vframeArray
@@ -270,6 +271,10 @@
   assert(cb->is_deoptimization_stub() || cb->is_uncommon_trap_stub(), "just checking");
   Events::log("fetch unroll sp " INTPTR_FORMAT, unpack_sp);
 #endif
+#else
+  intptr_t* unpack_sp = stub_frame.sender(&dummy_map).unextended_sp();
+#endif // !SHARK
+
   // This is a guarantee instead of an assert because if vframe doesn't match
   // we will unpack the wrong deoptimized frame and wind up in strange places
   // where it will be very difficult to figure out what went wrong. Better
@@ -380,7 +385,9 @@
 
   frame_pcs[0] = deopt_sender.raw_pc();
 
+#ifndef SHARK
   assert(CodeCache::find_blob_unsafe(frame_pcs[0]) != NULL, "bad pc");
+#endif // SHARK
 
   UnrollBlock* info = new UnrollBlock(array->frame_size() * BytesPerWord,
                                       caller_adjustment * BytesPerWord,
@@ -1073,7 +1080,7 @@
 JRT_END
 
 
-#ifdef COMPILER2
+#if defined(COMPILER2) || defined(SHARK)
 void Deoptimization::load_class_by_index(constantPoolHandle constant_pool, int index, TRAPS) {
   // in case of an unresolved klass entry, load the class.
   if (constant_pool->tag_at(index).is_unresolved_klass()) {
@@ -1835,7 +1842,7 @@
     if (xtty != NULL)  xtty->tail("statistics");
   }
 }
-#else // COMPILER2
+#else // COMPILER2 || SHARK
 
 
 // Stubs for C1 only system.
@@ -1871,4 +1878,4 @@
   return buf;
 }
 
-#endif // COMPILER2
+#endif // COMPILER2 || SHARK
--- a/hotspot/src/share/vm/runtime/frame.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/frame.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -876,6 +876,7 @@
 
 #endif /* CC_INTERP */
 
+#ifndef PPC
   if (m->is_native()) {
 #ifdef CC_INTERP
     f->do_oop((oop*)&istate->_oop_temp);
@@ -883,6 +884,11 @@
     f->do_oop((oop*)( fp() + interpreter_frame_oop_temp_offset ));
 #endif /* CC_INTERP */
   }
+#else // PPC
+  if (m->is_native() && m->is_static()) {
+    f->do_oop(interpreter_frame_mirror_addr());
+  }
+#endif // PPC
 
   int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals();
 
@@ -1094,6 +1100,10 @@
     oops_entry_do(f, map);
   } else if (CodeCache::contains(pc())) {
     oops_code_blob_do(f, cf, map);
+#ifdef SHARK
+  } else if (is_fake_stub_frame()) {
+    // nothing to do
+#endif // SHARK
   } else {
     ShouldNotReachHere();
   }
--- a/hotspot/src/share/vm/runtime/frame.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/frame.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -25,6 +25,7 @@
 typedef class BytecodeInterpreter* interpreterState;
 
 class CodeBlob;
+class vframeArray;
 
 
 // A frame represents a physical stack frame (an activation).  Frames
@@ -296,6 +297,9 @@
   void interpreter_frame_set_method(methodOop method);
   methodOop* interpreter_frame_method_addr() const;
   constantPoolCacheOop* interpreter_frame_cache_addr() const;
+#ifdef PPC
+  oop* interpreter_frame_mirror_addr() const;
+#endif
 
  public:
   // Entry frames
--- a/hotspot/src/share/vm/runtime/globals.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/globals.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -181,6 +181,18 @@
   #define C2_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{C2 notproduct}", DEFAULT },
 #endif
 
+#define SHARK_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{Shark product}", DEFAULT },
+#define SHARK_PD_PRODUCT_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, "{Shark pd product}", DEFAULT },
+#define SHARK_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{Shark diagnostic}", DEFAULT },
+#ifdef PRODUCT
+  #define SHARK_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
+  #define SHARK_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     /* flag is constant */
+  #define SHARK_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
+#else
+  #define SHARK_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{Shark}", DEFAULT },
+  #define SHARK_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, "{Shark pd}", DEFAULT },
+  #define SHARK_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{Shark notproduct}", DEFAULT },
+#endif
 
 static Flag flagTable[] = {
  RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_EXPERIMENTAL_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT, RUNTIME_MANAGEABLE_FLAG_STRUCT, RUNTIME_PRODUCT_RW_FLAG_STRUCT, RUNTIME_LP64_PRODUCT_FLAG_STRUCT)
@@ -194,6 +206,9 @@
 #ifdef COMPILER2
  C2_FLAGS(C2_DEVELOP_FLAG_STRUCT, C2_PD_DEVELOP_FLAG_STRUCT, C2_PRODUCT_FLAG_STRUCT, C2_PD_PRODUCT_FLAG_STRUCT, C2_DIAGNOSTIC_FLAG_STRUCT, C2_EXPERIMENTAL_FLAG_STRUCT, C2_NOTPRODUCT_FLAG_STRUCT)
 #endif
+#ifdef SHARK
+ SHARK_FLAGS(SHARK_DEVELOP_FLAG_STRUCT, SHARK_PD_DEVELOP_FLAG_STRUCT, SHARK_PRODUCT_FLAG_STRUCT, SHARK_PD_PRODUCT_FLAG_STRUCT, SHARK_DIAGNOSTIC_FLAG_STRUCT, SHARK_NOTPRODUCT_FLAG_STRUCT)
+#endif
  {0, NULL, NULL}
 };
 
--- a/hotspot/src/share/vm/runtime/globals.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -22,7 +22,7 @@
  *
  */
 
-#if !defined(COMPILER1) && !defined(COMPILER2)
+#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK)
 define_pd_global(bool, BackgroundCompilation,        false);
 define_pd_global(bool, UseTLAB,                      false);
 define_pd_global(bool, CICompileOSR,                 false);
@@ -607,7 +607,7 @@
   notproduct(bool, PrintMallocFree, false,                                  \
           "Trace calls to C heap malloc/free allocation")                   \
                                                                             \
-  notproduct(bool, PrintOopAddress, false,                                  \
+  product(bool, PrintOopAddress, false,                                     \
           "Always print the location of the oop")                           \
                                                                             \
   notproduct(bool, VerifyCodeCacheOften, false,                             \
@@ -2442,6 +2442,10 @@
           "Call fatal if this exception is thrown.  Example: "              \
           "java -XX:AbortVMOnException=java.lang.NullPointerException Foo") \
                                                                             \
+  notproduct(ccstr, AbortVMOnExceptionMessage, NULL,                        \
+          "Call fatal if the exception pointed by AbortVMOnException "      \
+          "has this message.")                                              \
+                                                                            \
   develop(bool, DebugVtables, false,                                        \
           "add debugging code to vtable dispatch")                          \
                                                                             \
@@ -3517,6 +3521,9 @@
   experimental(bool, EnableInvokeDynamic, false,                            \
           "recognize the invokedynamic instruction")                        \
                                                                             \
+  experimental(bool, AllowTransitionalJSR292, true,                         \
+          "recognize pre-PFD formats of invokedynamic")                     \
+                                                                            \
   develop(bool, TraceInvokeDynamic, false,                                  \
           "trace internal invoke dynamic operations")                       \
                                                                             \
@@ -3551,7 +3558,6 @@
           "EINTR for I/O operations results in OS_INTRPT. The default value"\
           " of this flag is true for JDK 6 and earliers")
 
-
 /*
  *  Macros for factoring of globals
  */
--- a/hotspot/src/share/vm/runtime/java.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/java.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -378,7 +378,8 @@
   }
 
   // Terminate watcher thread - must before disenrolling any periodic task
-  WatcherThread::stop();
+  if (PeriodicTask::num_tasks() > 0)
+    WatcherThread::stop();
 
   // Print statistics gathered (profiling ...)
   if (Arguments::has_profile()) {
--- a/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -76,7 +76,6 @@
   JavaFrameAnchor()                              { clear(); }
   JavaFrameAnchor(JavaFrameAnchor *src)          { copy(src); }
 
-  address last_Java_pc(void)                     { return _last_Java_pc; }
   void set_last_Java_pc(address pc)              { _last_Java_pc = pc; }
 
   // Assembly stub generation helpers
--- a/hotspot/src/share/vm/runtime/mutexLocker.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -159,6 +159,8 @@
   def(STS_init_lock              , Mutex,   leaf,        true );
   if (UseConcMarkSweepGC) {
     def(iCMS_lock                  , Monitor, special,     true ); // CMS incremental mode start/stop notification
+  }
+  if (UseConcMarkSweepGC || UseG1GC) {
     def(FullGCCount_lock           , Monitor, leaf,        true ); // in support of ExplicitGCInvokesConcurrent
   }
   if (UseG1GC) {
--- a/hotspot/src/share/vm/runtime/os.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/os.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -735,6 +735,152 @@
   st->print_cr("elapsed time: %d seconds", (int)t);
 }
 
+// moved from debug.cpp (used to be find()) but still called from there
+// The print_pc parameter is only set by the debug code in one case
+void os::print_location(outputStream* st, intptr_t x, bool print_pc) {
+  address addr = (address)x;
+  CodeBlob* b = CodeCache::find_blob_unsafe(addr);
+  if (b != NULL) {
+    if (b->is_buffer_blob()) {
+      // the interpreter is generated into a buffer blob
+      InterpreterCodelet* i = Interpreter::codelet_containing(addr);
+      if (i != NULL) {
+        i->print_on(st);
+        return;
+      }
+      if (Interpreter::contains(addr)) {
+        st->print_cr(INTPTR_FORMAT " is pointing into interpreter code"
+                     " (not bytecode specific)", addr);
+        return;
+      }
+      //
+      if (AdapterHandlerLibrary::contains(b)) {
+        st->print_cr("Printing AdapterHandler");
+        AdapterHandlerLibrary::print_handler_on(st, b);
+      }
+      // the stubroutines are generated into a buffer blob
+      StubCodeDesc* d = StubCodeDesc::desc_for(addr);
+      if (d != NULL) {
+        d->print_on(st);
+        if (print_pc) st->cr();
+        return;
+      }
+      if (StubRoutines::contains(addr)) {
+        st->print_cr(INTPTR_FORMAT " is pointing to an (unnamed) "
+                     "stub routine", addr);
+        return;
+      }
+      // the InlineCacheBuffer is using stubs generated into a buffer blob
+      if (InlineCacheBuffer::contains(addr)) {
+        st->print_cr(INTPTR_FORMAT " is pointing into InlineCacheBuffer", addr);
+        return;
+      }
+      VtableStub* v = VtableStubs::stub_containing(addr);
+      if (v != NULL) {
+        v->print_on(st);
+        return;
+      }
+    }
+    if (print_pc && b->is_nmethod()) {
+      ResourceMark rm;
+      st->print("%#p: Compiled ", addr);
+      ((nmethod*)b)->method()->print_value_on(st);
+      st->print("  = (CodeBlob*)" INTPTR_FORMAT, b);
+      st->cr();
+      return;
+    }
+    if ( b->is_nmethod()) {
+      if (b->is_zombie()) {
+        st->print_cr(INTPTR_FORMAT " is zombie nmethod", b);
+      } else if (b->is_not_entrant()) {
+        st->print_cr(INTPTR_FORMAT " is non-entrant nmethod", b);
+      }
+    }
+    b->print_on(st);
+    return;
+  }
+
+  if (Universe::heap()->is_in(addr)) {
+    HeapWord* p = Universe::heap()->block_start(addr);
+    bool print = false;
+    // If we couldn't find it it just may mean that heap wasn't parseable
+    // See if we were just given an oop directly
+    if (p != NULL && Universe::heap()->block_is_obj(p)) {
+      print = true;
+    } else if (p == NULL && ((oopDesc*)addr)->is_oop()) {
+      p = (HeapWord*) addr;
+      print = true;
+    }
+    if (print) {
+      oop(p)->print_on(st);
+      if (p != (HeapWord*)x && oop(p)->is_constMethod() &&
+          constMethodOop(p)->contains(addr)) {
+        Thread *thread = Thread::current();
+        HandleMark hm(thread);
+        methodHandle mh (thread, constMethodOop(p)->method());
+        if (!mh->is_native()) {
+          st->print_cr("bci_from(%p) = %d; print_codes():",
+                        addr, mh->bci_from(address(x)));
+          mh->print_codes_on(st);
+        }
+      }
+      return;
+    }
+  } else {
+    if (Universe::heap()->is_in_reserved(addr)) {
+      st->print_cr(INTPTR_FORMAT " is an unallocated location "
+                   "in the heap", addr);
+      return;
+    }
+  }
+  if (JNIHandles::is_global_handle((jobject) addr)) {
+    st->print_cr(INTPTR_FORMAT " is a global jni handle", addr);
+    return;
+  }
+  if (JNIHandles::is_weak_global_handle((jobject) addr)) {
+    st->print_cr(INTPTR_FORMAT " is a weak global jni handle", addr);
+    return;
+  }
+#ifndef PRODUCT
+  // we don't keep the block list in product mode
+  if (JNIHandleBlock::any_contains((jobject) addr)) {
+    st->print_cr(INTPTR_FORMAT " is a local jni handle", addr);
+    return;
+  }
+#endif
+
+  for(JavaThread *thread = Threads::first(); thread; thread = thread->next()) {
+    // Check for privilege stack
+    if (thread->privileged_stack_top() != NULL &&
+        thread->privileged_stack_top()->contains(addr)) {
+      st->print_cr(INTPTR_FORMAT " is pointing into the privilege stack "
+                   "for thread: " INTPTR_FORMAT, addr, thread);
+      thread->print_on(st);
+      return;
+    }
+    // If the addr is a java thread print information about that.
+    if (addr == (address)thread) {
+      thread->print_on(st);
+      return;
+    }
+    // If the addr is in the stack region for this thread then report that
+    // and print thread info
+    if (thread->stack_base() >= addr &&
+        addr > (thread->stack_base() - thread->stack_size())) {
+      st->print_cr(INTPTR_FORMAT " is pointing into the stack for thread: "
+                   INTPTR_FORMAT, addr, thread);
+      thread->print_on(st);
+      return;
+    }
+
+  }
+  // Try an OS specific find
+  if (os::find(addr, st)) {
+    return;
+  }
+
+  st->print_cr(INTPTR_FORMAT " is pointing to unknown location", addr);
+}
 
 // Looks like all platforms except IA64 can use the same function to check
 // if C stack is walkable beyond current frame. The check for fp() is not
--- a/hotspot/src/share/vm/runtime/os.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/os.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -78,8 +78,10 @@
   }
 
  public:
-  static void init(void);   // Called before command line parsing
-  static jint init_2(void); // Called after command line parsing
+
+  static void init(void);                      // Called before command line parsing
+  static jint init_2(void);                    // Called after command line parsing
+  static void init_3(void);                    // Called at the end of vm init
 
   // File names are case-insensitive on windows only
   // Override me as needed
@@ -322,7 +324,8 @@
     pgc_thread,        // Parallel GC thread
     java_thread,
     compiler_thread,
-    watcher_thread
+    watcher_thread,
+    os_thread
   };
 
   static bool create_thread(Thread* thread,
@@ -451,6 +454,8 @@
   static void print_signal_handlers(outputStream* st, char* buf, size_t buflen);
   static void print_date_and_time(outputStream* st);
 
+  static void print_location(outputStream* st, intptr_t x, bool print_pc = false);
+
   // 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
@@ -480,6 +485,9 @@
   // Fills in path to jvm.dll/libjvm.so (this info used to find hpi).
   static void     jvm_path(char *buf, jint buflen);
 
+  // Returns true if we are running in a headless jre.
+  static bool     is_headless_jre();
+
   // JNI names
   static void     print_jni_name_prefix_on(outputStream* st, int args_size);
   static void     print_jni_name_suffix_on(outputStream* st, int args_size);
@@ -580,8 +588,8 @@
   // Platform dependent stuff
   #include "incls/_os_pd.hpp.incl"
 
-  // debugging support (mostly used by debug.cpp)
-  static bool find(address pc) PRODUCT_RETURN0; // OS specific function to make sense out of an address
+  // debugging support (mostly used by debug.cpp but also fatal error handler)
+  static bool find(address pc, outputStream* st = tty); // OS specific function to make sense out of an address
 
   static bool dont_yield();                     // when true, JVM_Yield() is nop
   static void print_statistics();
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -191,6 +191,121 @@
   return ((jdouble)fmod((double)x,(double)y));
 JRT_END
 
+#ifdef __SOFTFP__
+JRT_LEAF(jfloat, SharedRuntime::fadd(jfloat x, jfloat y))
+  return x + y;
+JRT_END
+
+JRT_LEAF(jfloat, SharedRuntime::fsub(jfloat x, jfloat y))
+  return x - y;
+JRT_END
+
+JRT_LEAF(jfloat, SharedRuntime::fmul(jfloat x, jfloat y))
+  return x * y;
+JRT_END
+
+JRT_LEAF(jfloat, SharedRuntime::fdiv(jfloat x, jfloat y))
+  return x / y;
+JRT_END
+
+JRT_LEAF(jdouble, SharedRuntime::dadd(jdouble x, jdouble y))
+  return x + y;
+JRT_END
+
+JRT_LEAF(jdouble, SharedRuntime::dsub(jdouble x, jdouble y))
+  return x - y;
+JRT_END
+
+JRT_LEAF(jdouble, SharedRuntime::dmul(jdouble x, jdouble y))
+  return x * y;
+JRT_END
+
+JRT_LEAF(jdouble, SharedRuntime::ddiv(jdouble x, jdouble y))
+  return x / y;
+JRT_END
+
+JRT_LEAF(jfloat, SharedRuntime::i2f(jint x))
+  return (jfloat)x;
+JRT_END
+
+JRT_LEAF(jdouble, SharedRuntime::i2d(jint x))
+  return (jdouble)x;
+JRT_END
+
+JRT_LEAF(jdouble, SharedRuntime::f2d(jfloat x))
+  return (jdouble)x;
+JRT_END
+
+JRT_LEAF(int,  SharedRuntime::fcmpl(float x, float y))
+  return x>y ? 1 : (x==y ? 0 : -1);  /* x<y or is_nan*/
+JRT_END
+
+JRT_LEAF(int,  SharedRuntime::fcmpg(float x, float y))
+  return x<y ? -1 : (x==y ? 0 : 1);  /* x>y or is_nan */
+JRT_END
+
+JRT_LEAF(int,  SharedRuntime::dcmpl(double x, double y))
+  return x>y ? 1 : (x==y ? 0 : -1); /* x<y or is_nan */
+JRT_END
+
+JRT_LEAF(int,  SharedRuntime::dcmpg(double x, double y))
+  return x<y ? -1 : (x==y ? 0 : 1);  /* x>y or is_nan */
+JRT_END
+
+// Functions to return the opposite of the aeabi functions for nan.
+JRT_LEAF(int, SharedRuntime::unordered_fcmplt(float x, float y))
+  return (x < y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0);
+JRT_END
+
+JRT_LEAF(int, SharedRuntime::unordered_dcmplt(double x, double y))
+  return (x < y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0);
+JRT_END
+
+JRT_LEAF(int, SharedRuntime::unordered_fcmple(float x, float y))
+  return (x <= y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0);
+JRT_END
+
+JRT_LEAF(int, SharedRuntime::unordered_dcmple(double x, double y))
+  return (x <= y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0);
+JRT_END
+
+JRT_LEAF(int, SharedRuntime::unordered_fcmpge(float x, float y))
+  return (x >= y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0);
+JRT_END
+
+JRT_LEAF(int, SharedRuntime::unordered_dcmpge(double x, double y))
+  return (x >= y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0);
+JRT_END
+
+JRT_LEAF(int, SharedRuntime::unordered_fcmpgt(float x, float y))
+  return (x > y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0);
+JRT_END
+
+JRT_LEAF(int, SharedRuntime::unordered_dcmpgt(double x, double y))
+  return (x > y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0);
+JRT_END
+
+// Intrinsics make gcc generate code for these.
+float  SharedRuntime::fneg(float f)   {
+  return -f;
+}
+
+double SharedRuntime::dneg(double f)  {
+  return -f;
+}
+
+#endif // __SOFTFP__
+
+#if defined(__SOFTFP__) || defined(E500V2)
+// Intrinsics make gcc generate code for these.
+double SharedRuntime::dabs(double f)  {
+  return (f <= (double)0.0) ? (double)0.0 - f : f;
+}
+
+double SharedRuntime::dsqrt(double f) {
+  return sqrt(f);
+}
+#endif
 
 JRT_LEAF(jint, SharedRuntime::f2i(jfloat  x))
   if (g_isnan(x))
@@ -2046,6 +2161,8 @@
 int AdapterHandlerTable::_hits;
 int AdapterHandlerTable::_compact;
 
+#endif
+
 class AdapterHandlerTableIterator : public StackObj {
  private:
   AdapterHandlerTable* _table;
@@ -2081,7 +2198,6 @@
     }
   }
 };
-#endif
 
 
 // ---------------------------------------------------------------------------
@@ -2619,7 +2735,6 @@
   FREE_C_HEAP_ARRAY(intptr_t,buf);
 JRT_END
 
-#ifndef PRODUCT
 bool AdapterHandlerLibrary::contains(CodeBlob* b) {
   AdapterHandlerTableIterator iter(_adapters);
   while (iter.has_next()) {
@@ -2629,21 +2744,24 @@
   return false;
 }
 
-void AdapterHandlerLibrary::print_handler(CodeBlob* b) {
+void AdapterHandlerLibrary::print_handler_on(outputStream* st, CodeBlob* b) {
   AdapterHandlerTableIterator iter(_adapters);
   while (iter.has_next()) {
     AdapterHandlerEntry* a = iter.next();
     if ( b == CodeCache::find_blob(a->get_i2c_entry()) ) {
-      tty->print("Adapter for signature: ");
-      tty->print_cr("%s i2c: " INTPTR_FORMAT " c2i: " INTPTR_FORMAT " c2iUV: " INTPTR_FORMAT,
-                    a->fingerprint()->as_string(),
-                    a->get_i2c_entry(), a->get_c2i_entry(), a->get_c2i_unverified_entry());
+      st->print("Adapter for signature: ");
+      st->print_cr("%s i2c: " INTPTR_FORMAT " c2i: " INTPTR_FORMAT " c2iUV: " INTPTR_FORMAT,
+                   a->fingerprint()->as_string(),
+                   a->get_i2c_entry(), a->get_c2i_entry(), a->get_c2i_unverified_entry());
+
       return;
     }
   }
   assert(false, "Should have found handler");
 }
 
+#ifndef PRODUCT
+
 void AdapterHandlerLibrary::print_statistics() {
   _adapters->print_statistics();
 }
--- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -78,6 +78,18 @@
   static jfloat  frem(jfloat  x, jfloat  y);
   static jdouble drem(jdouble x, jdouble y);
 
+#ifdef __SOFTFP__
+  static jfloat  fadd(jfloat x, jfloat y);
+  static jfloat  fsub(jfloat x, jfloat y);
+  static jfloat  fmul(jfloat x, jfloat y);
+  static jfloat  fdiv(jfloat x, jfloat y);
+
+  static jdouble dadd(jdouble x, jdouble y);
+  static jdouble dsub(jdouble x, jdouble y);
+  static jdouble dmul(jdouble x, jdouble y);
+  static jdouble ddiv(jdouble x, jdouble y);
+#endif // __SOFTFP__
+
   // float conversion (needs to set appropriate rounding mode)
   static jint    f2i (jfloat  x);
   static jlong   f2l (jfloat  x);
@@ -87,6 +99,12 @@
   static jfloat  l2f (jlong   x);
   static jdouble l2d (jlong   x);
 
+#ifdef __SOFTFP__
+  static jfloat  i2f (jint    x);
+  static jdouble i2d (jint    x);
+  static jdouble f2d (jfloat  x);
+#endif // __SOFTFP__
+
   // double trigonometrics and transcendentals
   static jdouble dsin(jdouble x);
   static jdouble dcos(jdouble x);
@@ -96,6 +114,32 @@
   static jdouble dexp(jdouble x);
   static jdouble dpow(jdouble x, jdouble y);
 
+#if defined(__SOFTFP__) || defined(E500V2)
+  static double dabs(double f);
+  static double dsqrt(double f);
+#endif
+
+#ifdef __SOFTFP__
+  // C++ compiler generates soft float instructions as well as passing
+  // float and double in registers.
+  static int  fcmpl(float x, float y);
+  static int  fcmpg(float x, float y);
+  static int  dcmpl(double x, double y);
+  static int  dcmpg(double x, double y);
+
+  static int unordered_fcmplt(float x, float y);
+  static int unordered_dcmplt(double x, double y);
+  static int unordered_fcmple(float x, float y);
+  static int unordered_dcmple(double x, double y);
+  static int unordered_fcmpge(float x, float y);
+  static int unordered_dcmpge(double x, double y);
+  static int unordered_fcmpgt(float x, float y);
+  static int unordered_dcmpgt(double x, double y);
+
+  static float  fneg(float f);
+  static double dneg(double f);
+#endif
+
   // exception handling across interpreter/compiler boundaries
   static address raw_exception_handler_for_return_address(JavaThread* thread, address return_address);
   static address exception_handler_for_return_address(JavaThread* thread, address return_address);
@@ -585,9 +629,7 @@
   bool compare_code(unsigned char* code, int length, int total_args_passed, BasicType* sig_bt);
 #endif
 
-#ifndef PRODUCT
   void print();
-#endif /* PRODUCT */
 };
 
 class AdapterHandlerLibrary: public AllStatic {
@@ -609,9 +651,10 @@
   static nmethod* create_dtrace_nmethod (methodHandle method);
 #endif // HAVE_DTRACE_H
 
+  static void print_handler(CodeBlob* b) { print_handler_on(tty, b); }
+  static void print_handler_on(outputStream* st, CodeBlob* b);
+  static bool contains(CodeBlob* b);
 #ifndef PRODUCT
-  static void print_handler(CodeBlob* b);
-  static bool contains(CodeBlob* b);
   static void print_statistics();
 #endif /* PRODUCT */
 
--- a/hotspot/src/share/vm/runtime/sharedRuntimeTrans.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/sharedRuntimeTrans.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -572,7 +572,11 @@
       if(hy<0) z = one/z;       /* z = (1/|x|) */
       if(hx<0) {
         if(((ix-0x3ff00000)|yisint)==0) {
+#ifdef CAN_USE_NAN_DEFINE
+          z = NAN;
+#else
           z = (z-z)/(z-z); /* (-1)**non-int is NaN */
+#endif
         } else if(yisint==1)
           z = -1.0*z;           /* (x<0)**odd = -(|x|**odd) */
       }
@@ -583,7 +587,12 @@
   n = (hx>>31)+1;
 
   /* (x<0)**(non-int) is NaN */
-  if((n|yisint)==0) return (x-x)/(x-x);
+  if((n|yisint)==0)
+#ifdef CAN_USE_NAN_DEFINE
+    return NAN;
+#else
+    return (x-x)/(x-x);
+#endif
 
   s = one; /* s (sign of result -ve**odd) = -1 else = 1 */
   if((n|(yisint-1))==0) s = -one;/* (-ve)**(odd int) */
--- a/hotspot/src/share/vm/runtime/signature.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/signature.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -275,11 +275,7 @@
 
   void do_bool  ()                     { pass_int();    _jni_offset++; _offset++;       }
   void do_char  ()                     { pass_int();    _jni_offset++; _offset++;       }
-#if defined(_LP64) || defined(ZERO)
   void do_float ()                     { pass_float();  _jni_offset++; _offset++;       }
-#else
-  void do_float ()                     { pass_int();    _jni_offset++; _offset++;       }
-#endif
 #ifdef _LP64
   void do_double()                     { pass_double(); _jni_offset++; _offset += 2;    }
 #else
@@ -306,9 +302,7 @@
   virtual void pass_int()              = 0;
   virtual void pass_long()             = 0;
   virtual void pass_object()           = 0;
-#if defined(_LP64) || defined(ZERO)
   virtual void pass_float()            = 0;
-#endif
 #ifdef _LP64
   virtual void pass_double()           = 0;
 #else
--- a/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -53,15 +53,13 @@
 }
 
 
-void StubCodeDesc::print() {
-  tty->print(group());
-  tty->print("::");
-  tty->print(name());
-  tty->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT "[ (%d bytes)", begin(), end(), size_in_bytes());
+void StubCodeDesc::print_on(outputStream* st) const {
+  st->print(group());
+  st->print("::");
+  st->print(name());
+  st->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT "[ (%d bytes)", begin(), end(), size_in_bytes());
 }
 
-
-
 // Implementation of StubCodeGenerator
 
 StubCodeGenerator::StubCodeGenerator(CodeBuffer* code) {
--- a/hotspot/src/share/vm/runtime/stubCodeGenerator.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/stubCodeGenerator.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -79,7 +79,8 @@
   address     end() const                        { return _end; }
   int         size_in_bytes() const              { return _end - _begin; }
   bool        contains(address pc) const         { return _begin <= pc && pc < _end; }
-  void        print();
+  void        print_on(outputStream* st) const;
+  void        print() const                      { print_on(tty); }
 };
 
 // The base class for all stub-generating code generators.
--- a/hotspot/src/share/vm/runtime/thread.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -807,7 +807,7 @@
 // should be revisited, and they should be removed if possible.
 
 bool Thread::is_lock_owned(address adr) const {
-  return (_stack_base >= adr && adr >= (_stack_base - _stack_size));
+  return on_local_stack(adr);
 }
 
 bool Thread::set_as_starting_thread() {
@@ -1020,7 +1020,7 @@
 // timer interrupts exists on the platform.
 
 WatcherThread* WatcherThread::_watcher_thread   = NULL;
-bool           WatcherThread::_should_terminate = false;
+volatile bool  WatcherThread::_should_terminate = false;
 
 WatcherThread::WatcherThread() : Thread() {
   assert(watcher_thread() == NULL, "we can only allocate one WatcherThread");
@@ -1052,8 +1052,26 @@
 
     // Calculate how long it'll be until the next PeriodicTask work
     // should be done, and sleep that amount of time.
-    const size_t time_to_wait = PeriodicTask::time_to_wait();
-    os::sleep(this, time_to_wait, false);
+    size_t time_to_wait = PeriodicTask::time_to_wait();
+
+    // we expect this to timeout - we only ever get unparked when
+    // we should terminate
+    {
+      OSThreadWaitState osts(this->osthread(), false /* not Object.wait() */);
+
+      jlong prev_time = os::javaTimeNanos();
+      for (;;) {
+        int res= _SleepEvent->park(time_to_wait);
+        if (res == OS_TIMEOUT || _should_terminate)
+          break;
+        // spurious wakeup of some kind
+        jlong now = os::javaTimeNanos();
+        time_to_wait -= (now - prev_time) / 1000000;
+        if (time_to_wait <= 0)
+          break;
+        prev_time = now;
+      }
+    }
 
     if (is_error_reported()) {
       // A fatal error has happened, the error handler(VMError::report_and_die)
@@ -1115,6 +1133,12 @@
   // it is ok to take late safepoints here, if needed
   MutexLocker mu(Terminator_lock);
   _should_terminate = true;
+  OrderAccess::fence();  // ensure WatcherThread sees update in main loop
+
+  Thread* watcher = watcher_thread();
+  if (watcher != NULL)
+    watcher->_SleepEvent->unpark();
+
   while(watcher_thread() != NULL) {
     // This wait should make safepoint checks, wait without a timeout,
     // and wait as a suspend-equivalent condition.
@@ -1364,6 +1388,8 @@
 
   this->create_stack_guard_pages();
 
+  this->cache_global_variables();
+
   // Thread is now sufficient initialized to be handled by the safepoint code as being
   // in the VM. Change thread state from _thread_new to _thread_in_vm
   ThreadStateTransition::transition_and_fence(this, _thread_new, _thread_in_vm);
@@ -2955,6 +2981,9 @@
     return status;
   }
 
+  // Should be done after the heap is fully created
+  main_thread->cache_global_variables();
+
   HandleMark hm;
 
   { MutexLocker mu(Threads_lock);
@@ -3230,6 +3259,9 @@
     WatcherThread::start();
   }
 
+  // Give os specific code one last chance to start
+  os::init_3();
+
   create_vm_timer.end();
   return JNI_OK;
 }
@@ -3249,12 +3281,18 @@
     char buffer[JVM_MAXPATHLEN];
     char ebuf[1024];
     const char *name = agent->name();
+    const char *msg = "Could not find agent library ";
 
     if (agent->is_absolute_path()) {
       library = hpi::dll_load(name, ebuf, sizeof ebuf);
       if (library == NULL) {
+        const char *sub_msg = " in absolute path, with error: ";
+        size_t len = strlen(msg) + strlen(name) + strlen(sub_msg) + strlen(ebuf) + 1;
+        char *buf = NEW_C_HEAP_ARRAY(char, len);
+        jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf);
         // If we can't find the agent, exit.
-        vm_exit_during_initialization("Could not find agent library in absolute path", name);
+        vm_exit_during_initialization(buf, NULL);
+        FREE_C_HEAP_ARRAY(char, buf);
       }
     } else {
       // Try to load the agent from the standard dll directory
@@ -3267,17 +3305,17 @@
         char *home  = Arguments::get_java_home();
         const char *fmt   = "%s/bin/java %s -Dkernel.background.download=false"
                       " sun.jkernel.DownloadManager -download client_jvm";
-        int length = strlen(props) + strlen(home) + strlen(fmt) + 1;
-        char *cmd = AllocateHeap(length);
+        size_t length = strlen(props) + strlen(home) + strlen(fmt) + 1;
+        char *cmd = NEW_C_HEAP_ARRAY(char, length);
         jio_snprintf(cmd, length, fmt, home, props);
         int status = os::fork_and_exec(cmd);
         FreeHeap(props);
-        FreeHeap(cmd);
         if (status == -1) {
           warning(cmd);
           vm_exit_during_initialization("fork_and_exec failed: %s",
                                          strerror(errno));
         }
+        FREE_C_HEAP_ARRAY(char, cmd);
         // when this comes back the instrument.dll should be where it belongs.
         library = hpi::dll_load(buffer, ebuf, sizeof ebuf);
       }
@@ -3287,8 +3325,13 @@
         hpi::dll_build_name(buffer, sizeof(buffer), ns, name);
         library = hpi::dll_load(buffer, ebuf, sizeof ebuf);
         if (library == NULL) {
+          const char *sub_msg = " on the library path, with error: ";
+          size_t len = strlen(msg) + strlen(name) + strlen(sub_msg) + strlen(ebuf) + 1;
+          char *buf = NEW_C_HEAP_ARRAY(char, len);
+          jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf);
           // If we can't find the agent, exit.
-          vm_exit_during_initialization("Could not find agent library on the library path or in the local directory", name);
+          vm_exit_during_initialization(buf, NULL);
+          FREE_C_HEAP_ARRAY(char, buf);
         }
       }
     }
--- a/hotspot/src/share/vm/runtime/thread.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/thread.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -410,9 +410,6 @@
   // Sweeper support
   void nmethods_do(CodeBlobClosure* cf);
 
-  // Tells if adr belong to this thread. This is used
-  // for checking if a lock is owned by the running thread.
-
   // Used by fast lock support
   virtual bool is_lock_owned(address adr) const;
 
@@ -449,6 +446,11 @@
   void    set_stack_size(size_t size)  { _stack_size = size; }
   void    record_stack_base_and_size();
 
+  bool    on_local_stack(address adr) const {
+    /* QQQ this has knowledge of direction, ought to be a stack method */
+    return (_stack_base >= adr && adr >= (_stack_base - _stack_size));
+  }
+
   int     lgrp_id() const                 { return _lgrp_id; }
   void    set_lgrp_id(int value)          { _lgrp_id = value; }
 
@@ -609,7 +611,7 @@
  private:
   static WatcherThread* _watcher_thread;
 
-  static bool _should_terminate;
+  volatile static bool _should_terminate; // updated without holding lock
  public:
   enum SomeConstants {
     delay_interval = 10                          // interrupt delay in milliseconds
@@ -839,6 +841,10 @@
     return (struct JNINativeInterface_ *)_jni_environment.functions;
   }
 
+  // This function is called at thread creation to allow
+  // platform specific thread variables to be initialized.
+  void cache_global_variables();
+
   // Executes Shutdown.shutdown()
   void invoke_shutdown_hooks();
 
--- a/hotspot/src/share/vm/runtime/vm_version.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/vm_version.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -95,7 +95,11 @@
   #define VMTYPE "Server"
 #else // TIERED
 #ifdef ZERO
+#ifdef SHARK
+  #define VMTYPE "Shark"
+#else // SHARK
   #define VMTYPE "Zero"
+#endif // SHARK
 #else // ZERO
    #define VMTYPE COMPILER1_PRESENT("Client")   \
                   COMPILER2_PRESENT("Server")
@@ -152,6 +156,8 @@
 #define CPU      IA32_ONLY("x86")                \
                  IA64_ONLY("ia64")               \
                  AMD64_ONLY("amd64")             \
+                 ARM_ONLY("arm")                 \
+                 PPC_ONLY("ppc")                 \
                  SPARC_ONLY("sparc")
 #endif // ZERO
 
--- a/hotspot/src/share/vm/runtime/vm_version.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/runtime/vm_version.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -70,6 +70,9 @@
     return _logical_processors_per_package;
   }
 
+  // ARCH specific policy for the BiasedLocking
+  static bool use_biased_locking()  { return true; }
+
   // Number of page sizes efficiently supported by the hardware.  Most chips now
   // support two sizes, thus this default implementation.  Processor-specific
   // subclasses should define new versions to hide this one as needed.  Note
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/llvmHeaders.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+#ifdef assert
+  #undef assert
+#endif
+
+#ifdef DEBUG
+  #define SHARK_DEBUG
+  #undef DEBUG
+#endif
+
+#include <llvm/Argument.h>
+#include <llvm/Constants.h>
+#include <llvm/DerivedTypes.h>
+#include <llvm/ExecutionEngine/ExecutionEngine.h>
+#include <llvm/Instructions.h>
+#include <llvm/LLVMContext.h>
+#include <llvm/Module.h>
+#if SHARK_LLVM_VERSION < 27
+#include <llvm/ModuleProvider.h>
+#endif
+#include <llvm/Support/IRBuilder.h>
+#include <llvm/System/Threading.h>
+#include <llvm/Target/TargetSelect.h>
+#include <llvm/Type.h>
+#include <llvm/ExecutionEngine/JITMemoryManager.h>
+#include <llvm/Support/CommandLine.h>
+#if SHARK_LLVM_VERSION >= 27
+#include <llvm/ExecutionEngine/JIT.h>
+#include <llvm/ADT/StringMap.h>
+#include <llvm/Support/Debug.h>
+#include <llvm/System/Host.h>
+#endif
+
+#include <map>
+
+#ifdef assert
+  #undef assert
+#endif
+
+// from hotspot/src/share/vm/utilities/debug.hpp
+#ifdef ASSERT
+#ifndef USE_REPEATED_ASSERTS
+#define assert(p, msg)                                                       \
+do {                                                                         \
+  if (!(p)) {                                                                \
+    report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", msg);       \
+    BREAKPOINT;                                                              \
+  }                                                                          \
+} while (0)
+#else // #ifndef USE_REPEATED_ASSERTS
+#define assert(p, msg)
+do {                                                                         \
+  for (int __i = 0; __i < AssertRepeat; __i++) {                             \
+    if (!(p)) {                                                              \
+      report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", msg);     \
+      BREAKPOINT;                                                            \
+    }                                                                        \
+  }                                                                          \
+} while (0)
+#endif // #ifndef USE_REPEATED_ASSERTS
+#else
+  #define assert(p, msg)
+#endif
+
+#ifdef DEBUG
+  #undef DEBUG
+#endif
+#ifdef SHARK_DEBUG
+  #define DEBUG
+  #undef SHARK_DEBUG
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/llvmValue.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+class LLVMValue : public AllStatic {
+ public:
+  static llvm::ConstantInt* jbyte_constant(jbyte value)
+  {
+    return llvm::ConstantInt::get(SharkType::jbyte_type(), value, true);
+  }
+  static llvm::ConstantInt* jint_constant(jint value)
+  {
+    return llvm::ConstantInt::get(SharkType::jint_type(), value, true);
+  }
+  static llvm::ConstantInt* jlong_constant(jlong value)
+  {
+    return llvm::ConstantInt::get(SharkType::jlong_type(), value, true);
+  }
+  static llvm::ConstantFP* jfloat_constant(jfloat value)
+  {
+    return llvm::ConstantFP::get(SharkContext::current(), llvm::APFloat(value));
+  }
+  static llvm::ConstantFP* jdouble_constant(jdouble value)
+  {
+    return llvm::ConstantFP::get(SharkContext::current(), llvm::APFloat(value));
+  }
+  static llvm::ConstantPointerNull* null()
+  {
+    return llvm::ConstantPointerNull::get(SharkType::oop_type());
+  }
+
+ public:
+  static llvm::ConstantInt* bit_constant(int value)
+  {
+    return llvm::ConstantInt::get(SharkType::bit_type(), value, false);
+  }
+  static llvm::ConstantInt* intptr_constant(intptr_t value)
+  {
+    return llvm::ConstantInt::get(SharkType::intptr_type(), value, false);
+  }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkBlock.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,1260 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkBlock.cpp.incl"
+
+using namespace llvm;
+
+void SharkBlock::parse_bytecode(int start, int limit) {
+  SharkValue *a, *b, *c, *d;
+  int i;
+
+  // Ensure the current state is initialized before we emit any code,
+  // so that any setup code for the state is at the start of the block
+  current_state();
+
+  // Parse the bytecodes
+  iter()->reset_to_bci(start);
+  while (iter()->next_bci() < limit) {
+    NOT_PRODUCT(a = b = c = d = NULL);
+    iter()->next();
+
+    if (SharkTraceBytecodes)
+      tty->print_cr("%4d: %s", bci(), Bytecodes::name(bc()));
+
+    if (has_trap() && trap_bci() == bci()) {
+      do_trap(trap_request());
+      return;
+    }
+
+    if (UseLoopSafepoints) {
+      // XXX if a lcmp is followed by an if_?? then C2 maybe-inserts
+      // the safepoint before the lcmp rather than before the if.
+      // Maybe we should do this too.  See parse2.cpp for details.
+      switch (bc()) {
+      case Bytecodes::_goto:
+      case Bytecodes::_ifnull:
+      case Bytecodes::_ifnonnull:
+      case Bytecodes::_if_acmpeq:
+      case Bytecodes::_if_acmpne:
+      case Bytecodes::_ifeq:
+      case Bytecodes::_ifne:
+      case Bytecodes::_iflt:
+      case Bytecodes::_ifle:
+      case Bytecodes::_ifgt:
+      case Bytecodes::_ifge:
+      case Bytecodes::_if_icmpeq:
+      case Bytecodes::_if_icmpne:
+      case Bytecodes::_if_icmplt:
+      case Bytecodes::_if_icmple:
+      case Bytecodes::_if_icmpgt:
+      case Bytecodes::_if_icmpge:
+        if (iter()->get_dest() <= bci())
+          maybe_add_backedge_safepoint();
+        break;
+
+      case Bytecodes::_goto_w:
+        if (iter()->get_far_dest() <= bci())
+          maybe_add_backedge_safepoint();
+        break;
+
+      case Bytecodes::_tableswitch:
+      case Bytecodes::_lookupswitch:
+        if (switch_default_dest() <= bci()) {
+          maybe_add_backedge_safepoint();
+          break;
+        }
+        int len = switch_table_length();
+        for (int i = 0; i < len; i++) {
+          if (switch_dest(i) <= bci()) {
+            maybe_add_backedge_safepoint();
+            break;
+          }
+        }
+        break;
+      }
+    }
+
+    switch (bc()) {
+    case Bytecodes::_nop:
+      break;
+
+    case Bytecodes::_aconst_null:
+      push(SharkValue::null());
+      break;
+
+    case Bytecodes::_iconst_m1:
+      push(SharkValue::jint_constant(-1));
+      break;
+    case Bytecodes::_iconst_0:
+      push(SharkValue::jint_constant(0));
+      break;
+    case Bytecodes::_iconst_1:
+      push(SharkValue::jint_constant(1));
+      break;
+    case Bytecodes::_iconst_2:
+      push(SharkValue::jint_constant(2));
+      break;
+    case Bytecodes::_iconst_3:
+      push(SharkValue::jint_constant(3));
+      break;
+    case Bytecodes::_iconst_4:
+      push(SharkValue::jint_constant(4));
+      break;
+    case Bytecodes::_iconst_5:
+      push(SharkValue::jint_constant(5));
+      break;
+
+    case Bytecodes::_lconst_0:
+      push(SharkValue::jlong_constant(0));
+      break;
+    case Bytecodes::_lconst_1:
+      push(SharkValue::jlong_constant(1));
+      break;
+
+    case Bytecodes::_fconst_0:
+      push(SharkValue::jfloat_constant(0));
+      break;
+    case Bytecodes::_fconst_1:
+      push(SharkValue::jfloat_constant(1));
+      break;
+    case Bytecodes::_fconst_2:
+      push(SharkValue::jfloat_constant(2));
+      break;
+
+    case Bytecodes::_dconst_0:
+      push(SharkValue::jdouble_constant(0));
+      break;
+    case Bytecodes::_dconst_1:
+      push(SharkValue::jdouble_constant(1));
+      break;
+
+    case Bytecodes::_bipush:
+      push(SharkValue::jint_constant(iter()->get_constant_u1()));
+      break;
+    case Bytecodes::_sipush:
+      push(SharkValue::jint_constant(iter()->get_constant_u2()));
+      break;
+
+    case Bytecodes::_ldc:
+    case Bytecodes::_ldc_w:
+    case Bytecodes::_ldc2_w:
+      push(SharkConstant::for_ldc(iter())->value(builder()));
+      break;
+
+    case Bytecodes::_iload_0:
+    case Bytecodes::_lload_0:
+    case Bytecodes::_fload_0:
+    case Bytecodes::_dload_0:
+    case Bytecodes::_aload_0:
+      push(local(0));
+      break;
+    case Bytecodes::_iload_1:
+    case Bytecodes::_lload_1:
+    case Bytecodes::_fload_1:
+    case Bytecodes::_dload_1:
+    case Bytecodes::_aload_1:
+      push(local(1));
+      break;
+    case Bytecodes::_iload_2:
+    case Bytecodes::_lload_2:
+    case Bytecodes::_fload_2:
+    case Bytecodes::_dload_2:
+    case Bytecodes::_aload_2:
+      push(local(2));
+      break;
+    case Bytecodes::_iload_3:
+    case Bytecodes::_lload_3:
+    case Bytecodes::_fload_3:
+    case Bytecodes::_dload_3:
+    case Bytecodes::_aload_3:
+      push(local(3));
+      break;
+    case Bytecodes::_iload:
+    case Bytecodes::_lload:
+    case Bytecodes::_fload:
+    case Bytecodes::_dload:
+    case Bytecodes::_aload:
+      push(local(iter()->get_index()));
+      break;
+
+    case Bytecodes::_baload:
+      do_aload(T_BYTE);
+      break;
+    case Bytecodes::_caload:
+      do_aload(T_CHAR);
+      break;
+    case Bytecodes::_saload:
+      do_aload(T_SHORT);
+      break;
+    case Bytecodes::_iaload:
+      do_aload(T_INT);
+      break;
+    case Bytecodes::_laload:
+      do_aload(T_LONG);
+      break;
+    case Bytecodes::_faload:
+      do_aload(T_FLOAT);
+      break;
+    case Bytecodes::_daload:
+      do_aload(T_DOUBLE);
+      break;
+    case Bytecodes::_aaload:
+      do_aload(T_OBJECT);
+      break;
+
+    case Bytecodes::_istore_0:
+    case Bytecodes::_lstore_0:
+    case Bytecodes::_fstore_0:
+    case Bytecodes::_dstore_0:
+    case Bytecodes::_astore_0:
+      set_local(0, pop());
+      break;
+    case Bytecodes::_istore_1:
+    case Bytecodes::_lstore_1:
+    case Bytecodes::_fstore_1:
+    case Bytecodes::_dstore_1:
+    case Bytecodes::_astore_1:
+      set_local(1, pop());
+      break;
+    case Bytecodes::_istore_2:
+    case Bytecodes::_lstore_2:
+    case Bytecodes::_fstore_2:
+    case Bytecodes::_dstore_2:
+    case Bytecodes::_astore_2:
+      set_local(2, pop());
+      break;
+    case Bytecodes::_istore_3:
+    case Bytecodes::_lstore_3:
+    case Bytecodes::_fstore_3:
+    case Bytecodes::_dstore_3:
+    case Bytecodes::_astore_3:
+      set_local(3, pop());
+      break;
+    case Bytecodes::_istore:
+    case Bytecodes::_lstore:
+    case Bytecodes::_fstore:
+    case Bytecodes::_dstore:
+    case Bytecodes::_astore:
+      set_local(iter()->get_index(), pop());
+      break;
+
+    case Bytecodes::_bastore:
+      do_astore(T_BYTE);
+      break;
+    case Bytecodes::_castore:
+      do_astore(T_CHAR);
+      break;
+    case Bytecodes::_sastore:
+      do_astore(T_SHORT);
+      break;
+    case Bytecodes::_iastore:
+      do_astore(T_INT);
+      break;
+    case Bytecodes::_lastore:
+      do_astore(T_LONG);
+      break;
+    case Bytecodes::_fastore:
+      do_astore(T_FLOAT);
+      break;
+    case Bytecodes::_dastore:
+      do_astore(T_DOUBLE);
+      break;
+    case Bytecodes::_aastore:
+      do_astore(T_OBJECT);
+      break;
+
+    case Bytecodes::_pop:
+      xpop();
+      break;
+    case Bytecodes::_pop2:
+      xpop();
+      xpop();
+      break;
+    case Bytecodes::_swap:
+      a = xpop();
+      b = xpop();
+      xpush(a);
+      xpush(b);
+      break;
+    case Bytecodes::_dup:
+      a = xpop();
+      xpush(a);
+      xpush(a);
+      break;
+    case Bytecodes::_dup_x1:
+      a = xpop();
+      b = xpop();
+      xpush(a);
+      xpush(b);
+      xpush(a);
+      break;
+    case Bytecodes::_dup_x2:
+      a = xpop();
+      b = xpop();
+      c = xpop();
+      xpush(a);
+      xpush(c);
+      xpush(b);
+      xpush(a);
+      break;
+    case Bytecodes::_dup2:
+      a = xpop();
+      b = xpop();
+      xpush(b);
+      xpush(a);
+      xpush(b);
+      xpush(a);
+      break;
+    case Bytecodes::_dup2_x1:
+      a = xpop();
+      b = xpop();
+      c = xpop();
+      xpush(b);
+      xpush(a);
+      xpush(c);
+      xpush(b);
+      xpush(a);
+      break;
+    case Bytecodes::_dup2_x2:
+      a = xpop();
+      b = xpop();
+      c = xpop();
+      d = xpop();
+      xpush(b);
+      xpush(a);
+      xpush(d);
+      xpush(c);
+      xpush(b);
+      xpush(a);
+      break;
+
+    case Bytecodes::_arraylength:
+      do_arraylength();
+      break;
+
+    case Bytecodes::_getfield:
+      do_getfield();
+      break;
+    case Bytecodes::_getstatic:
+      do_getstatic();
+      break;
+    case Bytecodes::_putfield:
+      do_putfield();
+      break;
+    case Bytecodes::_putstatic:
+      do_putstatic();
+      break;
+
+    case Bytecodes::_iadd:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateAdd(a->jint_value(), b->jint_value()), false));
+      break;
+    case Bytecodes::_isub:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateSub(a->jint_value(), b->jint_value()), false));
+      break;
+    case Bytecodes::_imul:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateMul(a->jint_value(), b->jint_value()), false));
+      break;
+    case Bytecodes::_idiv:
+      do_idiv();
+      break;
+    case Bytecodes::_irem:
+      do_irem();
+      break;
+    case Bytecodes::_ineg:
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateNeg(a->jint_value()), a->zero_checked()));
+      break;
+    case Bytecodes::_ishl:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateShl(
+          a->jint_value(),
+          builder()->CreateAnd(
+            b->jint_value(), LLVMValue::jint_constant(0x1f))), false));
+      break;
+    case Bytecodes::_ishr:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateAShr(
+          a->jint_value(),
+          builder()->CreateAnd(
+            b->jint_value(), LLVMValue::jint_constant(0x1f))), false));
+      break;
+    case Bytecodes::_iushr:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateLShr(
+          a->jint_value(),
+          builder()->CreateAnd(
+            b->jint_value(), LLVMValue::jint_constant(0x1f))), false));
+      break;
+    case Bytecodes::_iand:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateAnd(a->jint_value(), b->jint_value()), false));
+      break;
+    case Bytecodes::_ior:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateOr(a->jint_value(), b->jint_value()),
+        a->zero_checked() && b->zero_checked()));
+      break;
+    case Bytecodes::_ixor:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateXor(a->jint_value(), b->jint_value()), false));
+      break;
+
+    case Bytecodes::_ladd:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateAdd(a->jlong_value(), b->jlong_value()), false));
+      break;
+    case Bytecodes::_lsub:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateSub(a->jlong_value(), b->jlong_value()), false));
+      break;
+    case Bytecodes::_lmul:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateMul(a->jlong_value(), b->jlong_value()), false));
+      break;
+    case Bytecodes::_ldiv:
+      do_ldiv();
+      break;
+    case Bytecodes::_lrem:
+      do_lrem();
+      break;
+    case Bytecodes::_lneg:
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateNeg(a->jlong_value()), a->zero_checked()));
+      break;
+    case Bytecodes::_lshl:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateShl(
+          a->jlong_value(),
+          builder()->CreateIntCast(
+            builder()->CreateAnd(
+              b->jint_value(), LLVMValue::jint_constant(0x3f)),
+            SharkType::jlong_type(), true)), false));
+      break;
+    case Bytecodes::_lshr:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateAShr(
+          a->jlong_value(),
+          builder()->CreateIntCast(
+            builder()->CreateAnd(
+              b->jint_value(), LLVMValue::jint_constant(0x3f)),
+            SharkType::jlong_type(), true)), false));
+      break;
+    case Bytecodes::_lushr:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateLShr(
+          a->jlong_value(),
+          builder()->CreateIntCast(
+            builder()->CreateAnd(
+              b->jint_value(), LLVMValue::jint_constant(0x3f)),
+            SharkType::jlong_type(), true)), false));
+      break;
+    case Bytecodes::_land:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateAnd(a->jlong_value(), b->jlong_value()), false));
+      break;
+    case Bytecodes::_lor:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateOr(a->jlong_value(), b->jlong_value()),
+        a->zero_checked() && b->zero_checked()));
+      break;
+    case Bytecodes::_lxor:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateXor(a->jlong_value(), b->jlong_value()), false));
+      break;
+
+    case Bytecodes::_fadd:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jfloat(
+        builder()->CreateFAdd(a->jfloat_value(), b->jfloat_value())));
+      break;
+    case Bytecodes::_fsub:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jfloat(
+        builder()->CreateFSub(a->jfloat_value(), b->jfloat_value())));
+      break;
+    case Bytecodes::_fmul:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jfloat(
+        builder()->CreateFMul(a->jfloat_value(), b->jfloat_value())));
+      break;
+    case Bytecodes::_fdiv:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jfloat(
+        builder()->CreateFDiv(a->jfloat_value(), b->jfloat_value())));
+      break;
+    case Bytecodes::_frem:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jfloat(
+        builder()->CreateFRem(a->jfloat_value(), b->jfloat_value())));
+      break;
+    case Bytecodes::_fneg:
+      a = pop();
+      push(SharkValue::create_jfloat(
+        builder()->CreateFNeg(a->jfloat_value())));
+      break;
+
+    case Bytecodes::_dadd:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jdouble(
+        builder()->CreateFAdd(a->jdouble_value(), b->jdouble_value())));
+      break;
+    case Bytecodes::_dsub:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jdouble(
+        builder()->CreateFSub(a->jdouble_value(), b->jdouble_value())));
+      break;
+    case Bytecodes::_dmul:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jdouble(
+        builder()->CreateFMul(a->jdouble_value(), b->jdouble_value())));
+      break;
+    case Bytecodes::_ddiv:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jdouble(
+        builder()->CreateFDiv(a->jdouble_value(), b->jdouble_value())));
+      break;
+    case Bytecodes::_drem:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jdouble(
+        builder()->CreateFRem(a->jdouble_value(), b->jdouble_value())));
+      break;
+    case Bytecodes::_dneg:
+      a = pop();
+      push(SharkValue::create_jdouble(
+        builder()->CreateFNeg(a->jdouble_value())));
+      break;
+
+    case Bytecodes::_iinc:
+      i = iter()->get_index();
+      set_local(
+        i,
+        SharkValue::create_jint(
+          builder()->CreateAdd(
+            LLVMValue::jint_constant(iter()->get_iinc_con()),
+            local(i)->jint_value()), false));
+      break;
+
+    case Bytecodes::_lcmp:
+      do_lcmp();
+      break;
+
+    case Bytecodes::_fcmpl:
+      do_fcmp(false, false);
+      break;
+    case Bytecodes::_fcmpg:
+      do_fcmp(false, true);
+      break;
+    case Bytecodes::_dcmpl:
+      do_fcmp(true, false);
+      break;
+    case Bytecodes::_dcmpg:
+      do_fcmp(true, true);
+      break;
+
+    case Bytecodes::_i2l:
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateIntCast(
+          a->jint_value(), SharkType::jlong_type(), true), a->zero_checked()));
+      break;
+    case Bytecodes::_i2f:
+      push(SharkValue::create_jfloat(
+        builder()->CreateSIToFP(
+          pop()->jint_value(), SharkType::jfloat_type())));
+      break;
+    case Bytecodes::_i2d:
+      push(SharkValue::create_jdouble(
+        builder()->CreateSIToFP(
+          pop()->jint_value(), SharkType::jdouble_type())));
+      break;
+
+    case Bytecodes::_l2i:
+      push(SharkValue::create_jint(
+        builder()->CreateIntCast(
+          pop()->jlong_value(), SharkType::jint_type(), true), false));
+      break;
+    case Bytecodes::_l2f:
+      push(SharkValue::create_jfloat(
+        builder()->CreateSIToFP(
+          pop()->jlong_value(), SharkType::jfloat_type())));
+      break;
+    case Bytecodes::_l2d:
+      push(SharkValue::create_jdouble(
+        builder()->CreateSIToFP(
+          pop()->jlong_value(), SharkType::jdouble_type())));
+      break;
+
+    case Bytecodes::_f2i:
+      push(SharkValue::create_jint(
+        builder()->CreateCall(
+          builder()->f2i(), pop()->jfloat_value()), false));
+      break;
+    case Bytecodes::_f2l:
+      push(SharkValue::create_jlong(
+        builder()->CreateCall(
+          builder()->f2l(), pop()->jfloat_value()), false));
+      break;
+    case Bytecodes::_f2d:
+      push(SharkValue::create_jdouble(
+        builder()->CreateFPExt(
+          pop()->jfloat_value(), SharkType::jdouble_type())));
+      break;
+
+    case Bytecodes::_d2i:
+      push(SharkValue::create_jint(
+        builder()->CreateCall(
+          builder()->d2i(), pop()->jdouble_value()), false));
+      break;
+    case Bytecodes::_d2l:
+      push(SharkValue::create_jlong(
+        builder()->CreateCall(
+          builder()->d2l(), pop()->jdouble_value()), false));
+      break;
+    case Bytecodes::_d2f:
+      push(SharkValue::create_jfloat(
+        builder()->CreateFPTrunc(
+          pop()->jdouble_value(), SharkType::jfloat_type())));
+      break;
+
+    case Bytecodes::_i2b:
+      push(SharkValue::create_jint(
+        builder()->CreateAShr(
+          builder()->CreateShl(
+            pop()->jint_value(),
+            LLVMValue::jint_constant(24)),
+          LLVMValue::jint_constant(24)), false));
+      break;
+    case Bytecodes::_i2c:
+      push(SharkValue::create_jint(
+        builder()->CreateAnd(
+            pop()->jint_value(),
+            LLVMValue::jint_constant(0xffff)), false));
+      break;
+    case Bytecodes::_i2s:
+      push(SharkValue::create_jint(
+        builder()->CreateAShr(
+          builder()->CreateShl(
+            pop()->jint_value(),
+            LLVMValue::jint_constant(16)),
+          LLVMValue::jint_constant(16)), false));
+      break;
+
+    case Bytecodes::_return:
+      do_return(T_VOID);
+      break;
+    case Bytecodes::_ireturn:
+      do_return(T_INT);
+      break;
+    case Bytecodes::_lreturn:
+      do_return(T_LONG);
+      break;
+    case Bytecodes::_freturn:
+      do_return(T_FLOAT);
+      break;
+    case Bytecodes::_dreturn:
+      do_return(T_DOUBLE);
+      break;
+    case Bytecodes::_areturn:
+      do_return(T_OBJECT);
+      break;
+
+    case Bytecodes::_athrow:
+      do_athrow();
+      break;
+
+    case Bytecodes::_goto:
+    case Bytecodes::_goto_w:
+      do_goto();
+      break;
+
+    case Bytecodes::_jsr:
+    case Bytecodes::_jsr_w:
+      do_jsr();
+      break;
+
+    case Bytecodes::_ret:
+      do_ret();
+      break;
+
+    case Bytecodes::_ifnull:
+      do_if(ICmpInst::ICMP_EQ, SharkValue::null(), pop());
+      break;
+    case Bytecodes::_ifnonnull:
+      do_if(ICmpInst::ICMP_NE, SharkValue::null(), pop());
+      break;
+    case Bytecodes::_if_acmpeq:
+      b = pop();
+      a = pop();
+      do_if(ICmpInst::ICMP_EQ, b, a);
+      break;
+    case Bytecodes::_if_acmpne:
+      b = pop();
+      a = pop();
+      do_if(ICmpInst::ICMP_NE, b, a);
+      break;
+    case Bytecodes::_ifeq:
+      do_if(ICmpInst::ICMP_EQ, SharkValue::jint_constant(0), pop());
+      break;
+    case Bytecodes::_ifne:
+      do_if(ICmpInst::ICMP_NE, SharkValue::jint_constant(0), pop());
+      break;
+    case Bytecodes::_iflt:
+      do_if(ICmpInst::ICMP_SLT, SharkValue::jint_constant(0), pop());
+      break;
+    case Bytecodes::_ifle:
+      do_if(ICmpInst::ICMP_SLE, SharkValue::jint_constant(0), pop());
+      break;
+    case Bytecodes::_ifgt:
+      do_if(ICmpInst::ICMP_SGT, SharkValue::jint_constant(0), pop());
+      break;
+    case Bytecodes::_ifge:
+      do_if(ICmpInst::ICMP_SGE, SharkValue::jint_constant(0), pop());
+      break;
+    case Bytecodes::_if_icmpeq:
+      b = pop();
+      a = pop();
+      do_if(ICmpInst::ICMP_EQ, b, a);
+      break;
+    case Bytecodes::_if_icmpne:
+      b = pop();
+      a = pop();
+      do_if(ICmpInst::ICMP_NE, b, a);
+      break;
+    case Bytecodes::_if_icmplt:
+      b = pop();
+      a = pop();
+      do_if(ICmpInst::ICMP_SLT, b, a);
+      break;
+    case Bytecodes::_if_icmple:
+      b = pop();
+      a = pop();
+      do_if(ICmpInst::ICMP_SLE, b, a);
+      break;
+    case Bytecodes::_if_icmpgt:
+      b = pop();
+      a = pop();
+      do_if(ICmpInst::ICMP_SGT, b, a);
+      break;
+    case Bytecodes::_if_icmpge:
+      b = pop();
+      a = pop();
+      do_if(ICmpInst::ICMP_SGE, b, a);
+      break;
+
+    case Bytecodes::_tableswitch:
+    case Bytecodes::_lookupswitch:
+      do_switch();
+      break;
+
+    case Bytecodes::_invokestatic:
+    case Bytecodes::_invokespecial:
+    case Bytecodes::_invokevirtual:
+    case Bytecodes::_invokeinterface:
+      do_call();
+      break;
+
+    case Bytecodes::_instanceof:
+      // This is a very common construct:
+      //
+      //  if (object instanceof Klass) {
+      //    something = (Klass) object;
+      //    ...
+      //  }
+      //
+      // which gets compiled to something like this:
+      //
+      //  28: aload 9
+      //  30: instanceof <Class Klass>
+      //  33: ifeq 52
+      //  36: aload 9
+      //  38: checkcast <Class Klass>
+      //
+      // Handling both bytecodes at once allows us
+      // to eliminate the checkcast.
+      if (iter()->next_bci() < limit &&
+          (iter()->next_bc() == Bytecodes::_ifeq ||
+           iter()->next_bc() == Bytecodes::_ifne) &&
+          (!UseLoopSafepoints ||
+           iter()->next_get_dest() > iter()->next_bci())) {
+        if (maybe_do_instanceof_if()) {
+          iter()->next();
+          if (SharkTraceBytecodes)
+            tty->print_cr("%4d: %s", bci(), Bytecodes::name(bc()));
+          break;
+        }
+      }
+      // fall through
+    case Bytecodes::_checkcast:
+      do_instance_check();
+      break;
+
+    case Bytecodes::_new:
+      do_new();
+      break;
+    case Bytecodes::_newarray:
+      do_newarray();
+      break;
+    case Bytecodes::_anewarray:
+      do_anewarray();
+      break;
+    case Bytecodes::_multianewarray:
+      do_multianewarray();
+      break;
+
+    case Bytecodes::_monitorenter:
+      do_monitorenter();
+      break;
+    case Bytecodes::_monitorexit:
+      do_monitorexit();
+      break;
+
+    default:
+      ShouldNotReachHere();
+    }
+  }
+}
+
+SharkState* SharkBlock::initial_current_state() {
+  return entry_state()->copy();
+}
+
+int SharkBlock::switch_default_dest() {
+  return iter()->get_dest_table(0);
+}
+
+int SharkBlock::switch_table_length() {
+  switch(bc()) {
+  case Bytecodes::_tableswitch:
+    return iter()->get_int_table(2) - iter()->get_int_table(1) + 1;
+
+  case Bytecodes::_lookupswitch:
+    return iter()->get_int_table(1);
+
+  default:
+    ShouldNotReachHere();
+  }
+}
+
+int SharkBlock::switch_key(int i) {
+  switch(bc()) {
+  case Bytecodes::_tableswitch:
+    return iter()->get_int_table(1) + i;
+
+  case Bytecodes::_lookupswitch:
+    return iter()->get_int_table(2 + 2 * i);
+
+  default:
+    ShouldNotReachHere();
+  }
+}
+
+int SharkBlock::switch_dest(int i) {
+  switch(bc()) {
+  case Bytecodes::_tableswitch:
+    return iter()->get_dest_table(i + 3);
+
+  case Bytecodes::_lookupswitch:
+    return iter()->get_dest_table(2 + 2 * i + 1);
+
+  default:
+    ShouldNotReachHere();
+  }
+}
+
+void SharkBlock::do_div_or_rem(bool is_long, bool is_rem) {
+  SharkValue *sb = pop();
+  SharkValue *sa = pop();
+
+  check_divide_by_zero(sb);
+
+  Value *a, *b, *p, *q;
+  if (is_long) {
+    a = sa->jlong_value();
+    b = sb->jlong_value();
+    p = LLVMValue::jlong_constant(0x8000000000000000LL);
+    q = LLVMValue::jlong_constant(-1);
+  }
+  else {
+    a = sa->jint_value();
+    b = sb->jint_value();
+    p = LLVMValue::jint_constant(0x80000000);
+    q = LLVMValue::jint_constant(-1);
+  }
+
+  BasicBlock *ip           = builder()->GetBlockInsertionPoint();
+  BasicBlock *special_case = builder()->CreateBlock(ip, "special_case");
+  BasicBlock *general_case = builder()->CreateBlock(ip, "general_case");
+  BasicBlock *done         = builder()->CreateBlock(ip, "done");
+
+  builder()->CreateCondBr(
+    builder()->CreateAnd(
+      builder()->CreateICmpEQ(a, p),
+      builder()->CreateICmpEQ(b, q)),
+    special_case, general_case);
+
+  builder()->SetInsertPoint(special_case);
+  Value *special_result;
+  if (is_rem) {
+    if (is_long)
+      special_result = LLVMValue::jlong_constant(0);
+    else
+      special_result = LLVMValue::jint_constant(0);
+  }
+  else {
+    special_result = a;
+  }
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(general_case);
+  Value *general_result;
+  if (is_rem)
+    general_result = builder()->CreateSRem(a, b);
+  else
+    general_result = builder()->CreateSDiv(a, b);
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(done);
+  PHINode *result;
+  if (is_long)
+    result = builder()->CreatePHI(SharkType::jlong_type(), "result");
+  else
+    result = builder()->CreatePHI(SharkType::jint_type(), "result");
+  result->addIncoming(special_result, special_case);
+  result->addIncoming(general_result, general_case);
+
+  if (is_long)
+    push(SharkValue::create_jlong(result, false));
+  else
+    push(SharkValue::create_jint(result, false));
+}
+
+void SharkBlock::do_field_access(bool is_get, bool is_field) {
+  bool will_link;
+  ciField *field = iter()->get_field(will_link);
+  assert(will_link, "typeflow responsibility");
+  assert(is_field != field->is_static(), "mismatch");
+
+  // Pop the value off the stack where necessary
+  SharkValue *value = NULL;
+  if (!is_get)
+    value = pop();
+
+  // Find the object we're accessing, if necessary
+  Value *object = NULL;
+  if (is_field) {
+    SharkValue *value = pop();
+    check_null(value);
+    object = value->generic_value();
+  }
+  if (is_get && field->is_constant()) {
+    SharkConstant *constant = SharkConstant::for_field(iter());
+    if (constant->is_loaded())
+      value = constant->value(builder());
+  }
+  if (!is_get || value == NULL) {
+    if (!is_field)
+      object = builder()->CreateInlineOop(field->holder());
+
+    BasicType   basic_type = field->type()->basic_type();
+    const Type *stack_type = SharkType::to_stackType(basic_type);
+    const Type *field_type = SharkType::to_arrayType(basic_type);
+
+    Value *addr = builder()->CreateAddressOfStructEntry(
+      object, in_ByteSize(field->offset_in_bytes()),
+      PointerType::getUnqual(field_type),
+      "addr");
+
+    // Do the access
+    if (is_get) {
+      Value *field_value = builder()->CreateLoad(addr);
+
+      if (field_type != stack_type) {
+        field_value = builder()->CreateIntCast(
+          field_value, stack_type, basic_type != T_CHAR);
+      }
+
+      value = SharkValue::create_generic(field->type(), field_value, false);
+    }
+    else {
+      Value *field_value = value->generic_value();
+
+      if (field_type != stack_type) {
+        field_value = builder()->CreateIntCast(
+          field_value, field_type, basic_type != T_CHAR);
+      }
+
+      builder()->CreateStore(field_value, addr);
+
+      if (!field->type()->is_primitive_type())
+        builder()->CreateUpdateBarrierSet(oopDesc::bs(), addr);
+
+      if (field->is_volatile())
+        builder()->CreateMemoryBarrier(SharkBuilder::BARRIER_STORELOAD);
+    }
+  }
+
+  // Push the value onto the stack where necessary
+  if (is_get)
+    push(value);
+}
+
+void SharkBlock::do_lcmp() {
+  Value *b = pop()->jlong_value();
+  Value *a = pop()->jlong_value();
+
+  BasicBlock *ip   = builder()->GetBlockInsertionPoint();
+  BasicBlock *ne   = builder()->CreateBlock(ip, "lcmp_ne");
+  BasicBlock *lt   = builder()->CreateBlock(ip, "lcmp_lt");
+  BasicBlock *gt   = builder()->CreateBlock(ip, "lcmp_gt");
+  BasicBlock *done = builder()->CreateBlock(ip, "done");
+
+  BasicBlock *eq = builder()->GetInsertBlock();
+  builder()->CreateCondBr(builder()->CreateICmpEQ(a, b), done, ne);
+
+  builder()->SetInsertPoint(ne);
+  builder()->CreateCondBr(builder()->CreateICmpSLT(a, b), lt, gt);
+
+  builder()->SetInsertPoint(lt);
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(gt);
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(done);
+  PHINode *result = builder()->CreatePHI(SharkType::jint_type(), "result");
+  result->addIncoming(LLVMValue::jint_constant(-1), lt);
+  result->addIncoming(LLVMValue::jint_constant(0),  eq);
+  result->addIncoming(LLVMValue::jint_constant(1),  gt);
+
+  push(SharkValue::create_jint(result, false));
+}
+
+void SharkBlock::do_fcmp(bool is_double, bool unordered_is_greater) {
+  Value *a, *b;
+  if (is_double) {
+    b = pop()->jdouble_value();
+    a = pop()->jdouble_value();
+  }
+  else {
+    b = pop()->jfloat_value();
+    a = pop()->jfloat_value();
+  }
+
+  BasicBlock *ip      = builder()->GetBlockInsertionPoint();
+  BasicBlock *ordered = builder()->CreateBlock(ip, "ordered");
+  BasicBlock *ge      = builder()->CreateBlock(ip, "fcmp_ge");
+  BasicBlock *lt      = builder()->CreateBlock(ip, "fcmp_lt");
+  BasicBlock *eq      = builder()->CreateBlock(ip, "fcmp_eq");
+  BasicBlock *gt      = builder()->CreateBlock(ip, "fcmp_gt");
+  BasicBlock *done    = builder()->CreateBlock(ip, "done");
+
+  builder()->CreateCondBr(
+    builder()->CreateFCmpUNO(a, b),
+    unordered_is_greater ? gt : lt, ordered);
+
+  builder()->SetInsertPoint(ordered);
+  builder()->CreateCondBr(builder()->CreateFCmpULT(a, b), lt, ge);
+
+  builder()->SetInsertPoint(ge);
+  builder()->CreateCondBr(builder()->CreateFCmpUGT(a, b), gt, eq);
+
+  builder()->SetInsertPoint(lt);
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(gt);
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(eq);
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(done);
+  PHINode *result = builder()->CreatePHI(SharkType::jint_type(), "result");
+  result->addIncoming(LLVMValue::jint_constant(-1), lt);
+  result->addIncoming(LLVMValue::jint_constant(0),  eq);
+  result->addIncoming(LLVMValue::jint_constant(1),  gt);
+
+  push(SharkValue::create_jint(result, false));
+}
+
+void SharkBlock::emit_IR() {
+  ShouldNotCallThis();
+}
+
+SharkState* SharkBlock::entry_state() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_zero_check(SharkValue* value) {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::maybe_add_backedge_safepoint() {
+  ShouldNotCallThis();
+}
+
+bool SharkBlock::has_trap() {
+  return false;
+}
+
+int SharkBlock::trap_request() {
+  ShouldNotCallThis();
+}
+
+int SharkBlock::trap_bci() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_trap(int trap_request) {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_arraylength() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_aload(BasicType basic_type) {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_astore(BasicType basic_type) {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_return(BasicType type) {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_athrow() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_goto() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_jsr() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_ret() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_if(ICmpInst::Predicate p, SharkValue* b, SharkValue* a) {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_switch() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_call() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_instance_check() {
+  ShouldNotCallThis();
+}
+
+bool SharkBlock::maybe_do_instanceof_if() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_new() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_newarray() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_anewarray() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_multianewarray() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_monitorenter() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_monitorexit() {
+  ShouldNotCallThis();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkBlock.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,281 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+class SharkState;
+
+class SharkBlock : public SharkTargetInvariants {
+ protected:
+  SharkBlock(const SharkTargetInvariants* parent)
+    : SharkTargetInvariants(parent),
+      _iter(target()),
+      _current_state(NULL) {}
+
+  SharkBlock(const SharkCompileInvariants* parent, ciMethod* target)
+    : SharkTargetInvariants(parent, target),
+      _iter(target),
+      _current_state(NULL) {}
+
+ private:
+  ciBytecodeStream _iter;
+  SharkState*      _current_state;
+
+ public:
+  ciBytecodeStream* iter() {
+    return &_iter;
+  }
+  Bytecodes::Code bc() {
+    return iter()->cur_bc();
+  }
+  int bci() {
+    return iter()->cur_bci();
+  }
+
+  // Entry state
+ protected:
+  virtual SharkState* entry_state();
+
+  // Current state
+ private:
+  SharkState* initial_current_state();
+
+ public:
+  SharkState* current_state() {
+    if (_current_state == NULL)
+      set_current_state(initial_current_state());
+    return _current_state;
+  }
+
+ protected:
+  void set_current_state(SharkState* current_state) {
+    _current_state = current_state;
+  }
+
+  // Local variables
+ protected:
+  SharkValue* local(int index) {
+    SharkValue *value = current_state()->local(index);
+    assert(value != NULL, "shouldn't be");
+    assert(value->is_one_word() ||
+           (index + 1 < max_locals() &&
+            current_state()->local(index + 1) == NULL), "should be");
+    return value;
+  }
+  void set_local(int index, SharkValue* value) {
+    assert(value != NULL, "shouldn't be");
+    current_state()->set_local(index, value);
+    if (value->is_two_word())
+      current_state()->set_local(index + 1, NULL);
+  }
+
+  // Expression stack (raw)
+ protected:
+  void xpush(SharkValue* value) {
+    current_state()->push(value);
+  }
+  SharkValue* xpop() {
+    return current_state()->pop();
+  }
+  SharkValue* xstack(int slot) {
+    SharkValue *value = current_state()->stack(slot);
+    assert(value != NULL, "shouldn't be");
+    assert(value->is_one_word() ||
+           (slot > 0 &&
+            current_state()->stack(slot - 1) == NULL), "should be");
+    return value;
+  }
+  int xstack_depth() {
+    return current_state()->stack_depth();
+  }
+
+  // Expression stack (cooked)
+ protected:
+  void push(SharkValue* value) {
+    assert(value != NULL, "shouldn't be");
+    xpush(value);
+    if (value->is_two_word())
+      xpush(NULL);
+  }
+  SharkValue* pop() {
+    int size = current_state()->stack(0) == NULL ? 2 : 1;
+    if (size == 2)
+      xpop();
+    SharkValue *value = xpop();
+    assert(value && value->size() == size, "should be");
+    return value;
+  }
+  SharkValue* pop_result(BasicType type) {
+    SharkValue *result = pop();
+
+#ifdef ASSERT
+    switch (result->basic_type()) {
+    case T_BOOLEAN:
+    case T_BYTE:
+    case T_CHAR:
+    case T_SHORT:
+      assert(type == T_INT, "type mismatch");
+      break;
+
+    case T_ARRAY:
+      assert(type == T_OBJECT, "type mismatch");
+      break;
+
+    default:
+      assert(result->basic_type() == type, "type mismatch");
+    }
+#endif // ASSERT
+
+    return result;
+  }
+
+  // Code generation
+ public:
+  virtual void emit_IR();
+
+ protected:
+  void parse_bytecode(int start, int limit);
+
+  // Helpers
+ protected:
+  virtual void do_zero_check(SharkValue* value);
+
+  // Zero checking
+ protected:
+  void check_null(SharkValue* object) {
+    zero_check(object);
+  }
+  void check_divide_by_zero(SharkValue* value) {
+    zero_check(value);
+  }
+ private:
+  void zero_check(SharkValue* value) {
+    if (!value->zero_checked())
+      do_zero_check(value);
+  }
+
+  // Safepoints
+ protected:
+  virtual void maybe_add_backedge_safepoint();
+
+  // Traps
+ protected:
+  virtual bool has_trap();
+  virtual int  trap_request();
+  virtual int  trap_bci();
+  virtual void do_trap(int trap_request);
+
+  // arraylength
+ protected:
+  virtual void do_arraylength();
+
+  // *aload and *astore
+ protected:
+  virtual void do_aload(BasicType basic_type);
+  virtual void do_astore(BasicType basic_type);
+
+  // *div and *rem
+ private:
+  void do_idiv() {
+    do_div_or_rem(false, false);
+  }
+  void do_irem() {
+    do_div_or_rem(false, true);
+  }
+  void do_ldiv() {
+    do_div_or_rem(true, false);
+  }
+  void do_lrem() {
+    do_div_or_rem(true, true);
+  }
+  void do_div_or_rem(bool is_long, bool is_rem);
+
+  // get* and put*
+ private:
+  void do_getstatic() {
+    do_field_access(true, false);
+  }
+  void do_getfield() {
+    do_field_access(true, true);
+  }
+  void do_putstatic() {
+    do_field_access(false, false);
+  }
+  void do_putfield() {
+    do_field_access(false, true);
+  }
+  void do_field_access(bool is_get, bool is_field);
+
+  // lcmp and [fd]cmp[lg]
+ private:
+  void do_lcmp();
+  void do_fcmp(bool is_double, bool unordered_is_greater);
+
+  // *return and athrow
+ protected:
+  virtual void do_return(BasicType type);
+  virtual void do_athrow();
+
+  // goto*
+ protected:
+  virtual void do_goto();
+
+  // jsr* and ret
+ protected:
+  virtual void do_jsr();
+  virtual void do_ret();
+
+  // if*
+ protected:
+  virtual void do_if(llvm::ICmpInst::Predicate p, SharkValue* b, SharkValue* a);
+
+  // *switch
+ protected:
+  int switch_default_dest();
+  int switch_table_length();
+  int switch_key(int i);
+  int switch_dest(int i);
+
+  virtual void do_switch();
+
+  // invoke*
+ protected:
+  virtual void do_call();
+
+  // checkcast and instanceof
+ protected:
+  virtual void do_instance_check();
+  virtual bool maybe_do_instanceof_if();
+
+  // new and *newarray
+ protected:
+  virtual void do_new();
+  virtual void do_newarray();
+  virtual void do_anewarray();
+  virtual void do_multianewarray();
+
+  // monitorenter and monitorexit
+ protected:
+  virtual void do_monitorenter();
+  virtual void do_monitorexit();
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkBuilder.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,591 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkBuilder.cpp.incl"
+
+using namespace llvm;
+
+SharkBuilder::SharkBuilder(SharkCodeBuffer* code_buffer)
+  : IRBuilder<>(SharkContext::current()),
+    _code_buffer(code_buffer) {
+}
+
+// Helpers for accessing structures
+Value* SharkBuilder::CreateAddressOfStructEntry(Value*      base,
+                                                ByteSize    offset,
+                                                const Type* type,
+                                                const char* name) {
+  return CreateBitCast(CreateStructGEP(base, in_bytes(offset)), type, name);
+}
+
+LoadInst* SharkBuilder::CreateValueOfStructEntry(Value*      base,
+                                                 ByteSize    offset,
+                                                 const Type* type,
+                                                 const char* name) {
+  return CreateLoad(
+    CreateAddressOfStructEntry(
+      base, offset, PointerType::getUnqual(type)),
+    name);
+}
+
+// Helpers for accessing arrays
+
+LoadInst* SharkBuilder::CreateArrayLength(Value* arrayoop) {
+  return CreateValueOfStructEntry(
+    arrayoop, in_ByteSize(arrayOopDesc::length_offset_in_bytes()),
+    SharkType::jint_type(), "length");
+}
+
+Value* SharkBuilder::CreateArrayAddress(Value*      arrayoop,
+                                        const Type* element_type,
+                                        int         element_bytes,
+                                        ByteSize    base_offset,
+                                        Value*      index,
+                                        const char* name) {
+  Value* offset = CreateIntCast(index, SharkType::intptr_type(), false);
+  if (element_bytes != 1)
+    offset = CreateShl(
+      offset,
+      LLVMValue::intptr_constant(exact_log2(element_bytes)));
+  offset = CreateAdd(
+    LLVMValue::intptr_constant(in_bytes(base_offset)), offset);
+
+  return CreateIntToPtr(
+    CreateAdd(CreatePtrToInt(arrayoop, SharkType::intptr_type()), offset),
+    PointerType::getUnqual(element_type),
+    name);
+}
+
+Value* SharkBuilder::CreateArrayAddress(Value*      arrayoop,
+                                        BasicType   basic_type,
+                                        ByteSize    base_offset,
+                                        Value*      index,
+                                        const char* name) {
+  return CreateArrayAddress(
+    arrayoop,
+    SharkType::to_arrayType(basic_type),
+    type2aelembytes(basic_type),
+    base_offset, index, name);
+}
+
+Value* SharkBuilder::CreateArrayAddress(Value*      arrayoop,
+                                        BasicType   basic_type,
+                                        Value*      index,
+                                        const char* name) {
+  return CreateArrayAddress(
+    arrayoop, basic_type,
+    in_ByteSize(arrayOopDesc::base_offset_in_bytes(basic_type)),
+    index, name);
+}
+
+// Helpers for creating intrinsics and external functions.
+
+const Type* SharkBuilder::make_type(char type, bool void_ok) {
+  switch (type) {
+    // Primitive types
+  case 'c':
+    return SharkType::jbyte_type();
+  case 'i':
+    return SharkType::jint_type();
+  case 'l':
+    return SharkType::jlong_type();
+  case 'x':
+    return SharkType::intptr_type();
+  case 'f':
+    return SharkType::jfloat_type();
+  case 'd':
+    return SharkType::jdouble_type();
+
+    // Pointers to primitive types
+  case 'C':
+  case 'I':
+  case 'L':
+  case 'X':
+  case 'F':
+  case 'D':
+    return PointerType::getUnqual(make_type(tolower(type), false));
+
+    // VM objects
+  case 'T':
+    return SharkType::thread_type();
+  case 'M':
+    return PointerType::getUnqual(SharkType::monitor_type());
+  case 'O':
+    return SharkType::oop_type();
+
+    // Miscellaneous
+  case 'v':
+    assert(void_ok, "should be");
+    return SharkType::void_type();
+  case '1':
+    return SharkType::bit_type();
+
+  default:
+    ShouldNotReachHere();
+  }
+}
+
+const FunctionType* SharkBuilder::make_ftype(const char* params,
+                                             const char* ret) {
+  std::vector<const Type*> param_types;
+  for (const char* c = params; *c; c++)
+    param_types.push_back(make_type(*c, false));
+
+  assert(strlen(ret) == 1, "should be");
+  const Type *return_type = make_type(*ret, true);
+
+  return FunctionType::get(return_type, param_types, false);
+}
+
+// Create an object representing an intrinsic or external function by
+// referencing the symbol by name.  This is the LLVM-style approach,
+// but it cannot be used on functions within libjvm.so its symbols
+// are not exported.  Note that you cannot make this work simply by
+// exporting the symbols, as some symbols have the same names as
+// symbols in the standard libraries (eg, atan2, fabs) and would
+// obscure them were they visible.
+Value* SharkBuilder::make_function(const char* name,
+                                   const char* params,
+                                   const char* ret) {
+  return SharkContext::current().get_external(name, make_ftype(params, ret));
+}
+
+// Create an object representing an external function by inlining a
+// function pointer in the code.  This is not the LLVM way, but it's
+// the only way to access functions in libjvm.so and functions like
+// __kernel_dmb on ARM which is accessed via an absolute address.
+Value* SharkBuilder::make_function(address     func,
+                                   const char* params,
+                                   const char* ret) {
+  return CreateIntToPtr(
+    LLVMValue::intptr_constant((intptr_t) func),
+    PointerType::getUnqual(make_ftype(params, ret)));
+}
+
+// VM calls
+
+Value* SharkBuilder::find_exception_handler() {
+  return make_function(
+    (address) SharkRuntime::find_exception_handler, "TIi", "i");
+}
+
+Value* SharkBuilder::monitorenter() {
+  return make_function((address) SharkRuntime::monitorenter, "TM", "v");
+}
+
+Value* SharkBuilder::monitorexit() {
+  return make_function((address) SharkRuntime::monitorexit, "TM", "v");
+}
+
+Value* SharkBuilder::new_instance() {
+  return make_function((address) SharkRuntime::new_instance, "Ti", "v");
+}
+
+Value* SharkBuilder::newarray() {
+  return make_function((address) SharkRuntime::newarray, "Tii", "v");
+}
+
+Value* SharkBuilder::anewarray() {
+  return make_function((address) SharkRuntime::anewarray, "Tii", "v");
+}
+
+Value* SharkBuilder::multianewarray() {
+  return make_function((address) SharkRuntime::multianewarray, "TiiI", "v");
+}
+
+Value* SharkBuilder::register_finalizer() {
+  return make_function((address) SharkRuntime::register_finalizer, "TO", "v");
+}
+
+Value* SharkBuilder::safepoint() {
+  return make_function((address) SafepointSynchronize::block, "T", "v");
+}
+
+Value* SharkBuilder::throw_ArithmeticException() {
+  return make_function(
+    (address) SharkRuntime::throw_ArithmeticException, "TCi", "v");
+}
+
+Value* SharkBuilder::throw_ArrayIndexOutOfBoundsException() {
+  return make_function(
+    (address) SharkRuntime::throw_ArrayIndexOutOfBoundsException, "TCii", "v");
+}
+
+Value* SharkBuilder::throw_ClassCastException() {
+  return make_function(
+    (address) SharkRuntime::throw_ClassCastException, "TCi", "v");
+}
+
+Value* SharkBuilder::throw_NullPointerException() {
+  return make_function(
+    (address) SharkRuntime::throw_NullPointerException, "TCi", "v");
+}
+
+// High-level non-VM calls
+
+Value* SharkBuilder::f2i() {
+  return make_function((address) SharedRuntime::f2i, "f", "i");
+}
+
+Value* SharkBuilder::f2l() {
+  return make_function((address) SharedRuntime::f2l, "f", "l");
+}
+
+Value* SharkBuilder::d2i() {
+  return make_function((address) SharedRuntime::d2i, "d", "i");
+}
+
+Value* SharkBuilder::d2l() {
+  return make_function((address) SharedRuntime::d2l, "d", "l");
+}
+
+Value* SharkBuilder::is_subtype_of() {
+  return make_function((address) SharkRuntime::is_subtype_of, "OO", "c");
+}
+
+Value* SharkBuilder::current_time_millis() {
+  return make_function((address) os::javaTimeMillis, "", "l");
+}
+
+Value* SharkBuilder::sin() {
+  return make_function("llvm.sin.f64", "d", "d");
+}
+
+Value* SharkBuilder::cos() {
+  return make_function("llvm.cos.f64", "d", "d");
+}
+
+Value* SharkBuilder::tan() {
+  return make_function((address) ::tan, "d", "d");
+}
+
+Value* SharkBuilder::atan2() {
+  return make_function((address) ::atan2, "dd", "d");
+}
+
+Value* SharkBuilder::sqrt() {
+  return make_function("llvm.sqrt.f64", "d", "d");
+}
+
+Value* SharkBuilder::log() {
+  return make_function("llvm.log.f64", "d", "d");
+}
+
+Value* SharkBuilder::log10() {
+  return make_function("llvm.log10.f64", "d", "d");
+}
+
+Value* SharkBuilder::pow() {
+  return make_function("llvm.pow.f64", "dd", "d");
+}
+
+Value* SharkBuilder::exp() {
+  return make_function("llvm.exp.f64", "d", "d");
+}
+
+Value* SharkBuilder::fabs() {
+  return make_function((address) ::fabs, "d", "d");
+}
+
+Value* SharkBuilder::unsafe_field_offset_to_byte_offset() {
+  extern jlong Unsafe_field_offset_to_byte_offset(jlong field_offset);
+  return make_function((address) Unsafe_field_offset_to_byte_offset, "l", "l");
+}
+
+Value* SharkBuilder::osr_migration_end() {
+  return make_function((address) SharedRuntime::OSR_migration_end, "C", "v");
+}
+
+// Semi-VM calls
+
+Value* SharkBuilder::throw_StackOverflowError() {
+  return make_function((address) ZeroStack::handle_overflow, "T", "v");
+}
+
+Value* SharkBuilder::uncommon_trap() {
+  return make_function((address) SharkRuntime::uncommon_trap, "Ti", "i");
+}
+
+Value* SharkBuilder::deoptimized_entry_point() {
+  return make_function((address) CppInterpreter::main_loop, "iT", "v");
+}
+
+// Native-Java transition
+
+Value* SharkBuilder::check_special_condition_for_native_trans() {
+  return make_function(
+    (address) JavaThread::check_special_condition_for_native_trans,
+    "T", "v");
+}
+
+// Low-level non-VM calls
+
+// The ARM-specific code here is to work around unimplemented
+// atomic exchange and memory barrier intrinsics in LLVM.
+//
+// Delegating to external functions for these would normally
+// incur a speed penalty, but Linux on ARM is a special case
+// in that atomic operations on that platform are handled by
+// external functions anyway.  It would be *preferable* for
+// the calls to be hidden away in LLVM, but it's not hurting
+// performance so having the calls here is acceptable.
+//
+// If you are building Shark on a platform without atomic
+// exchange and/or memory barrier intrinsics then it is only
+// acceptable to mimic this approach if your platform cannot
+// perform these operations without delegating to a function.
+
+#ifdef ARM
+static jint zero_cmpxchg_int(volatile jint *ptr, jint oldval, jint newval) {
+  return Atomic::cmpxchg(newval, ptr, oldval);
+}
+#endif // ARM
+
+Value* SharkBuilder::cmpxchg_int() {
+  return make_function(
+#ifdef ARM
+    (address) zero_cmpxchg_int,
+#else
+    "llvm.atomic.cmp.swap.i32.p0i32",
+#endif // ARM
+    "Iii", "i");
+}
+
+#ifdef ARM
+static intptr_t zero_cmpxchg_ptr(volatile intptr_t* ptr,
+                                 intptr_t           oldval,
+                                 intptr_t           newval) {
+  return Atomic::cmpxchg_ptr(newval, ptr, oldval);
+}
+#endif // ARM
+
+Value* SharkBuilder::cmpxchg_ptr() {
+  return make_function(
+#ifdef ARM
+    (address) zero_cmpxchg_ptr,
+#else
+    "llvm.atomic.cmp.swap.i" LP64_ONLY("64") NOT_LP64("32") ".p0i" LP64_ONLY("64") NOT_LP64("32"),
+#endif // ARM
+    "Xxx", "x");
+}
+
+Value* SharkBuilder::frame_address() {
+  return make_function("llvm.frameaddress", "i", "C");
+}
+
+Value* SharkBuilder::memory_barrier() {
+  return make_function(
+#ifdef ARM
+    (address) 0xffff0fa0, // __kernel_dmb
+#else
+    "llvm.memory.barrier",
+#endif // ARM
+    "11111", "v");
+}
+
+Value* SharkBuilder::memset() {
+#if SHARK_LLVM_VERSION >= 28
+  // LLVM 2.8 added a fifth isVolatile field for memset
+  // introduced with LLVM r100304
+  return make_function("llvm.memset.i32", "Cciii", "v");
+#else
+  return make_function("llvm.memset.i32", "Ccii", "v");
+#endif
+}
+
+Value* SharkBuilder::unimplemented() {
+  return make_function((address) report_unimplemented, "Ci", "v");
+}
+
+Value* SharkBuilder::should_not_reach_here() {
+  return make_function((address) report_should_not_reach_here, "Ci", "v");
+}
+
+Value* SharkBuilder::dump() {
+  return make_function((address) SharkRuntime::dump, "Cx", "v");
+}
+
+// Public interface to low-level non-VM calls
+
+CallInst* SharkBuilder::CreateCmpxchgInt(Value* exchange_value,
+                                         Value* dst,
+                                         Value* compare_value) {
+  return CreateCall3(cmpxchg_int(), dst, compare_value, exchange_value);
+}
+
+CallInst* SharkBuilder::CreateCmpxchgPtr(Value* exchange_value,
+                                         Value* dst,
+                                         Value* compare_value) {
+  return CreateCall3(cmpxchg_ptr(), dst, compare_value, exchange_value);
+}
+
+CallInst* SharkBuilder::CreateGetFrameAddress() {
+  return CreateCall(frame_address(), LLVMValue::jint_constant(0));
+}
+
+CallInst *SharkBuilder::CreateMemoryBarrier(int flags) {
+  Value *args[] = {
+    LLVMValue::bit_constant((flags & BARRIER_LOADLOAD) ? 1 : 0),
+    LLVMValue::bit_constant((flags & BARRIER_LOADSTORE) ? 1 : 0),
+    LLVMValue::bit_constant((flags & BARRIER_STORELOAD) ? 1 : 0),
+    LLVMValue::bit_constant((flags & BARRIER_STORESTORE) ? 1 : 0),
+    LLVMValue::bit_constant(1)};
+
+  return CreateCall(memory_barrier(), args, args + 5);
+}
+
+CallInst* SharkBuilder::CreateMemset(Value* dst,
+                                     Value* value,
+                                     Value* len,
+                                     Value* align) {
+#if SHARK_LLVM_VERSION >= 28
+  return CreateCall5(memset(), dst, value, len, align,
+                     LLVMValue::jint_constant(0));
+#else
+  return CreateCall4(memset(), dst, value, len, align);
+#endif
+}
+
+CallInst* SharkBuilder::CreateUnimplemented(const char* file, int line) {
+  return CreateCall2(
+    unimplemented(),
+    CreateIntToPtr(
+      LLVMValue::intptr_constant((intptr_t) file),
+      PointerType::getUnqual(SharkType::jbyte_type())),
+    LLVMValue::jint_constant(line));
+}
+
+CallInst* SharkBuilder::CreateShouldNotReachHere(const char* file, int line) {
+  return CreateCall2(
+    should_not_reach_here(),
+    CreateIntToPtr(
+      LLVMValue::intptr_constant((intptr_t) file),
+      PointerType::getUnqual(SharkType::jbyte_type())),
+    LLVMValue::jint_constant(line));
+}
+
+#ifndef PRODUCT
+CallInst* SharkBuilder::CreateDump(Value* value) {
+  const char *name;
+  if (value->hasName())
+    // XXX this leaks, but it's only debug code
+    name = strdup(value->getName().str().c_str());
+  else
+    name = "unnamed_value";
+
+  if (isa<PointerType>(value->getType()))
+    value = CreatePtrToInt(value, SharkType::intptr_type());
+  else if (value->getType()->
+#if SHARK_LLVM_VERSION >= 27
+           isIntegerTy()
+#else
+           isInteger()
+#endif
+           )
+    value = CreateIntCast(value, SharkType::intptr_type(), false);
+  else
+    Unimplemented();
+
+  return CreateCall2(
+    dump(),
+    CreateIntToPtr(
+      LLVMValue::intptr_constant((intptr_t) name),
+      PointerType::getUnqual(SharkType::jbyte_type())),
+    value);
+}
+#endif // PRODUCT
+
+// HotSpot memory barriers
+
+void SharkBuilder::CreateUpdateBarrierSet(BarrierSet* bs, Value* field) {
+  if (bs->kind() != BarrierSet::CardTableModRef)
+    Unimplemented();
+
+  CreateStore(
+    LLVMValue::jbyte_constant(CardTableModRefBS::dirty_card),
+    CreateIntToPtr(
+      CreateAdd(
+        LLVMValue::intptr_constant(
+          (intptr_t) ((CardTableModRefBS *) bs)->byte_map_base),
+        CreateLShr(
+          CreatePtrToInt(field, SharkType::intptr_type()),
+          LLVMValue::intptr_constant(CardTableModRefBS::card_shift))),
+      PointerType::getUnqual(SharkType::jbyte_type())));
+}
+
+// Helpers for accessing the code buffer
+
+Value* SharkBuilder::code_buffer_address(int offset) {
+  return CreateAdd(
+    code_buffer()->base_pc(),
+    LLVMValue::intptr_constant(offset));
+}
+
+Value* SharkBuilder::CreateInlineOop(jobject object, const char* name) {
+  return CreateLoad(
+    CreateIntToPtr(
+      code_buffer_address(code_buffer()->inline_oop(object)),
+      PointerType::getUnqual(SharkType::oop_type())),
+    name);
+}
+
+Value* SharkBuilder::CreateInlineData(void*       data,
+                                      size_t      size,
+                                      const Type* type,
+                                      const char* name) {
+  return CreateIntToPtr(
+    code_buffer_address(code_buffer()->inline_data(data, size)),
+    type,
+    name);
+}
+
+// Helpers for creating basic blocks.
+
+BasicBlock* SharkBuilder::GetBlockInsertionPoint() const {
+  BasicBlock *cur = GetInsertBlock();
+
+  // BasicBlock::Create takes an insertBefore argument, so
+  // we need to find the block _after_ the current block
+  Function::iterator iter = cur->getParent()->begin();
+  Function::iterator end  = cur->getParent()->end();
+  while (iter != end) {
+    iter++;
+    if (&*iter == cur) {
+      iter++;
+      break;
+    }
+  }
+
+  if (iter == end)
+    return NULL;
+  else
+    return iter;
+}
+
+BasicBlock* SharkBuilder::CreateBlock(BasicBlock* ip, const char* name) const {
+  return BasicBlock::Create(
+    SharkContext::current(), name, GetInsertBlock()->getParent(), ip);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkBuilder.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+class SharkBuilder : public llvm::IRBuilder<> {
+  friend class SharkCompileInvariants;
+
+ public:
+  SharkBuilder(SharkCodeBuffer* code_buffer);
+
+  // The code buffer we are building into.
+ private:
+  SharkCodeBuffer* _code_buffer;
+
+ protected:
+  SharkCodeBuffer* code_buffer() const {
+    return _code_buffer;
+  }
+
+  // Helpers for accessing structures.
+ public:
+  llvm::Value* CreateAddressOfStructEntry(llvm::Value* base,
+                                          ByteSize offset,
+                                          const llvm::Type* type,
+                                          const char *name = "");
+  llvm::LoadInst* CreateValueOfStructEntry(llvm::Value* base,
+                                           ByteSize offset,
+                                           const llvm::Type* type,
+                                           const char *name = "");
+
+  // Helpers for accessing arrays.
+ public:
+  llvm::LoadInst* CreateArrayLength(llvm::Value* arrayoop);
+  llvm::Value* CreateArrayAddress(llvm::Value*      arrayoop,
+                                  const llvm::Type* element_type,
+                                  int               element_bytes,
+                                  ByteSize          base_offset,
+                                  llvm::Value*      index,
+                                  const char*       name = "");
+  llvm::Value* CreateArrayAddress(llvm::Value* arrayoop,
+                                  BasicType    basic_type,
+                                  ByteSize     base_offset,
+                                  llvm::Value* index,
+                                  const char*  name = "");
+  llvm::Value* CreateArrayAddress(llvm::Value* arrayoop,
+                                  BasicType    basic_type,
+                                  llvm::Value* index,
+                                  const char*  name = "");
+
+  // Helpers for creating intrinsics and external functions.
+ private:
+  static const llvm::Type* make_type(char type, bool void_ok);
+  static const llvm::FunctionType* make_ftype(const char* params,
+                                              const char* ret);
+  llvm::Value* make_function(const char* name,
+                             const char* params,
+                             const char* ret);
+  llvm::Value* make_function(address     func,
+                             const char* params,
+                             const char* ret);
+
+  // Intrinsics and external functions, part 1: VM calls.
+  //   These are functions declared with JRT_ENTRY and JRT_EXIT,
+  //   macros which flip the thread from _thread_in_Java to
+  //   _thread_in_vm and back.  VM calls always safepoint, and can
+  //   therefore throw exceptions.  VM calls require of setup and
+  //   teardown, and must be called with SharkTopLevelBlock::call_vm.
+ public:
+  llvm::Value* find_exception_handler();
+  llvm::Value* monitorenter();
+  llvm::Value* monitorexit();
+  llvm::Value* new_instance();
+  llvm::Value* newarray();
+  llvm::Value* anewarray();
+  llvm::Value* multianewarray();
+  llvm::Value* register_finalizer();
+  llvm::Value* safepoint();
+  llvm::Value* throw_ArithmeticException();
+  llvm::Value* throw_ArrayIndexOutOfBoundsException();
+  llvm::Value* throw_ClassCastException();
+  llvm::Value* throw_NullPointerException();
+
+  // Intrinsics and external functions, part 2: High-level non-VM calls.
+  //   These are called like normal functions.  The stack is not set
+  //   up for walking so they must not safepoint or throw exceptions,
+  //   or call anything that might.
+ public:
+  llvm::Value* f2i();
+  llvm::Value* f2l();
+  llvm::Value* d2i();
+  llvm::Value* d2l();
+  llvm::Value* is_subtype_of();
+  llvm::Value* current_time_millis();
+  llvm::Value* sin();
+  llvm::Value* cos();
+  llvm::Value* tan();
+  llvm::Value* atan2();
+  llvm::Value* sqrt();
+  llvm::Value* log();
+  llvm::Value* log10();
+  llvm::Value* pow();
+  llvm::Value* exp();
+  llvm::Value* fabs();
+  llvm::Value* unsafe_field_offset_to_byte_offset();
+  llvm::Value* osr_migration_end();
+
+  // Intrinsics and external functions, part 3: semi-VM calls.
+  //   These are special cases that do VM call stuff but are invoked
+  //   as though they were normal calls.  This is acceptable so long
+  //   as the method that calls them returns to its immediately that
+  //   the semi VM call returns.
+ public:
+  llvm::Value* throw_StackOverflowError();
+  llvm::Value* uncommon_trap();
+  llvm::Value* deoptimized_entry_point();
+
+  // Intrinsics and external functions, part 4: Native-Java transition.
+  //   This is a special case in that it is invoked during a thread
+  //   state transition.  The stack must be set up for walking, and it
+  //   may throw exceptions, but the state is _thread_in_native_trans.
+ public:
+  llvm::Value* check_special_condition_for_native_trans();
+
+  // Intrinsics and external functions, part 5: Low-level non-VM calls.
+  //   These have the same caveats as the high-level non-VM calls
+  //   above.  They are not accessed directly; rather, you should
+  //   access them via the various Create* methods below.
+ private:
+  llvm::Value* cmpxchg_int();
+  llvm::Value* cmpxchg_ptr();
+  llvm::Value* frame_address();
+  llvm::Value* memory_barrier();
+  llvm::Value* memset();
+  llvm::Value* unimplemented();
+  llvm::Value* should_not_reach_here();
+  llvm::Value* dump();
+
+  // Public interface to low-level non-VM calls.
+ public:
+  llvm::CallInst* CreateCmpxchgInt(llvm::Value* exchange_value,
+                                   llvm::Value* dst,
+                                   llvm::Value* compare_value);
+  llvm::CallInst* CreateCmpxchgPtr(llvm::Value* exchange_value,
+                                   llvm::Value* dst,
+                                   llvm::Value* compare_value);
+  llvm::CallInst* CreateGetFrameAddress();
+  llvm::CallInst* CreateMemoryBarrier(int flags);
+  llvm::CallInst* CreateMemset(llvm::Value* dst,
+                               llvm::Value* value,
+                               llvm::Value* len,
+                               llvm::Value* align);
+  llvm::CallInst* CreateUnimplemented(const char* file, int line);
+  llvm::CallInst* CreateShouldNotReachHere(const char* file, int line);
+  NOT_PRODUCT(llvm::CallInst* CreateDump(llvm::Value* value));
+
+  // Flags for CreateMemoryBarrier.
+ public:
+  enum BarrierFlags {
+    BARRIER_LOADLOAD   = 1,
+    BARRIER_LOADSTORE  = 2,
+    BARRIER_STORELOAD  = 4,
+    BARRIER_STORESTORE = 8
+  };
+
+  // HotSpot memory barriers
+ public:
+  void CreateUpdateBarrierSet(BarrierSet* bs, llvm::Value* field);
+
+  // Helpers for accessing the code buffer.
+ public:
+  llvm::Value* code_buffer_address(int offset);
+  llvm::Value* CreateInlineOop(jobject object, const char* name = "");
+  llvm::Value* CreateInlineOop(ciObject* object, const char* name = "") {
+    return CreateInlineOop(object->constant_encoding(), name);
+  }
+  llvm::Value* CreateInlineData(void*             data,
+                                size_t            size,
+                                const llvm::Type* type,
+                                const char*       name = "");
+
+  // Helpers for creating basic blocks.
+  // NB don't use unless SharkFunction::CreateBlock is unavailable.
+  // XXX these are hacky and should be removed.
+ public:
+  llvm::BasicBlock* GetBlockInsertionPoint() const;
+  llvm::BasicBlock* CreateBlock(llvm::BasicBlock* ip,
+                                const char*       name="") const;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkCacheDecache.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,259 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkCacheDecache.cpp.incl"
+
+using namespace llvm;
+
+void SharkDecacher::start_frame() {
+  // Start recording the debug information
+  _pc_offset = code_buffer()->create_unique_offset();
+  _oopmap = new OopMap(
+    oopmap_slot_munge(stack()->oopmap_frame_size()),
+    oopmap_slot_munge(arg_size()));
+  debug_info()->add_safepoint(pc_offset(), oopmap());
+}
+
+void SharkDecacher::start_stack(int stack_depth) {
+  // Create the array we'll record our stack slots in
+  _exparray = new GrowableArray<ScopeValue*>(stack_depth);
+
+  // Set the stack pointer
+  stack()->CreateStoreStackPointer(
+    builder()->CreatePtrToInt(
+      stack()->slot_addr(
+        stack()->stack_slots_offset() + max_stack() - stack_depth),
+      SharkType::intptr_type()));
+}
+
+void SharkDecacher::process_stack_slot(int          index,
+                                       SharkValue** addr,
+                                       int          offset) {
+  SharkValue *value = *addr;
+
+  // Write the value to the frame if necessary
+  if (stack_slot_needs_write(index, value)) {
+    write_value_to_frame(
+      SharkType::to_stackType(value->basic_type()),
+      value->generic_value(),
+      adjusted_offset(value, offset));
+  }
+
+  // Record the value in the oopmap if necessary
+  if (stack_slot_needs_oopmap(index, value)) {
+    oopmap()->set_oop(slot2reg(offset));
+  }
+
+  // Record the value in the debuginfo if necessary
+  if (stack_slot_needs_debuginfo(index, value)) {
+    exparray()->append(slot2lv(offset, stack_location_type(index, addr)));
+  }
+}
+
+void SharkDecacher::start_monitors(int num_monitors) {
+  // Create the array we'll record our monitors in
+  _monarray = new GrowableArray<MonitorValue*>(num_monitors);
+}
+
+void SharkDecacher::process_monitor(int index, int box_offset, int obj_offset) {
+  oopmap()->set_oop(slot2reg(obj_offset));
+
+  monarray()->append(new MonitorValue(
+    slot2lv (obj_offset, Location::oop),
+    slot2loc(box_offset, Location::normal)));
+}
+
+void SharkDecacher::process_oop_tmp_slot(Value** value, int offset) {
+  // Decache the temporary oop slot
+  if (*value) {
+    write_value_to_frame(
+      SharkType::oop_type(),
+      *value,
+      offset);
+
+    oopmap()->set_oop(slot2reg(offset));
+  }
+}
+
+void SharkDecacher::process_method_slot(Value** value, int offset) {
+  // Decache the method pointer
+  write_value_to_frame(
+    SharkType::methodOop_type(),
+    *value,
+    offset);
+
+  oopmap()->set_oop(slot2reg(offset));
+}
+
+void SharkDecacher::process_pc_slot(int offset) {
+  // Record the PC
+  builder()->CreateStore(
+    builder()->code_buffer_address(pc_offset()),
+    stack()->slot_addr(offset));
+}
+
+void SharkDecacher::start_locals() {
+  // Create the array we'll record our local variables in
+  _locarray = new GrowableArray<ScopeValue*>(max_locals());}
+
+void SharkDecacher::process_local_slot(int          index,
+                                       SharkValue** addr,
+                                       int          offset) {
+  SharkValue *value = *addr;
+
+  // Write the value to the frame if necessary
+  if (local_slot_needs_write(index, value)) {
+    write_value_to_frame(
+      SharkType::to_stackType(value->basic_type()),
+      value->generic_value(),
+      adjusted_offset(value, offset));
+  }
+
+  // Record the value in the oopmap if necessary
+  if (local_slot_needs_oopmap(index, value)) {
+    oopmap()->set_oop(slot2reg(offset));
+  }
+
+  // Record the value in the debuginfo if necessary
+  if (local_slot_needs_debuginfo(index, value)) {
+    locarray()->append(slot2lv(offset, local_location_type(index, addr)));
+  }
+}
+
+void SharkDecacher::end_frame() {
+  // Record the scope
+  debug_info()->describe_scope(
+    pc_offset(),
+    target(),
+    bci(),
+    true,
+    false,
+    false,
+    debug_info()->create_scope_values(locarray()),
+    debug_info()->create_scope_values(exparray()),
+    debug_info()->create_monitor_values(monarray()));
+
+  // Finish recording the debug information
+  debug_info()->end_safepoint(pc_offset());
+}
+
+void SharkCacher::process_stack_slot(int          index,
+                                     SharkValue** addr,
+                                     int          offset) {
+  SharkValue *value = *addr;
+
+  // Read the value from the frame if necessary
+  if (stack_slot_needs_read(index, value)) {
+    *addr = SharkValue::create_generic(
+      value->type(),
+      read_value_from_frame(
+        SharkType::to_stackType(value->basic_type()),
+        adjusted_offset(value, offset)),
+      value->zero_checked());
+  }
+}
+
+void SharkOSREntryCacher::process_monitor(int index,
+                                          int box_offset,
+                                          int obj_offset) {
+  // Copy the monitor from the OSR buffer to the frame
+  int src_offset = max_locals() + index * 2;
+  builder()->CreateStore(
+    builder()->CreateLoad(
+      CreateAddressOfOSRBufEntry(src_offset, SharkType::intptr_type())),
+    stack()->slot_addr(box_offset, SharkType::intptr_type()));
+  builder()->CreateStore(
+    builder()->CreateLoad(
+      CreateAddressOfOSRBufEntry(src_offset + 1, SharkType::oop_type())),
+    stack()->slot_addr(obj_offset, SharkType::oop_type()));
+}
+
+void SharkCacher::process_oop_tmp_slot(Value** value, int offset) {
+  // Cache the temporary oop
+  if (*value)
+    *value = read_value_from_frame(SharkType::oop_type(), offset);
+}
+
+void SharkCacher::process_method_slot(Value** value, int offset) {
+  // Cache the method pointer
+  *value = read_value_from_frame(SharkType::methodOop_type(), offset);
+}
+
+void SharkFunctionEntryCacher::process_method_slot(Value** value, int offset) {
+  // "Cache" the method pointer
+  *value = method();
+}
+
+void SharkCacher::process_local_slot(int          index,
+                                     SharkValue** addr,
+                                     int          offset) {
+  SharkValue *value = *addr;
+
+  // Read the value from the frame if necessary
+  if (local_slot_needs_read(index, value)) {
+    *addr = SharkValue::create_generic(
+      value->type(),
+      read_value_from_frame(
+        SharkType::to_stackType(value->basic_type()),
+        adjusted_offset(value, offset)),
+      value->zero_checked());
+  }
+}
+
+Value* SharkOSREntryCacher::CreateAddressOfOSRBufEntry(int         offset,
+                                                       const Type* type) {
+  Value *result = builder()->CreateStructGEP(osr_buf(), offset);
+  if (type != SharkType::intptr_type())
+    result = builder()->CreateBitCast(result, PointerType::getUnqual(type));
+  return result;
+}
+
+void SharkOSREntryCacher::process_local_slot(int          index,
+                                             SharkValue** addr,
+                                             int          offset) {
+  SharkValue *value = *addr;
+
+  // Read the value from the OSR buffer if necessary
+  if (local_slot_needs_read(index, value)) {
+    *addr = SharkValue::create_generic(
+      value->type(),
+      builder()->CreateLoad(
+        CreateAddressOfOSRBufEntry(
+          adjusted_offset(value, max_locals() - 1 - index),
+          SharkType::to_stackType(value->basic_type()))),
+      value->zero_checked());
+  }
+}
+
+void SharkDecacher::write_value_to_frame(const Type* type,
+                                         Value*      value,
+                                         int         offset) {
+  builder()->CreateStore(value, stack()->slot_addr(offset, type));
+}
+
+Value* SharkCacher::read_value_from_frame(const Type* type, int offset) {
+  return builder()->CreateLoad(stack()->slot_addr(offset, type));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkCacheDecache.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,417 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+// Class hierarchy:
+// - SharkStateScanner
+//   - SharkCacherDecacher
+//     - SharkDecacher
+//       - SharkJavaCallDecacher
+//       - SharkVMCallDecacher
+//       - SharkTrapDecacher
+//     - SharkCacher
+//       - SharkJavaCallCacher
+//       - SharkVMCallCacher
+//       - SharkFunctionEntryCacher
+//         - SharkNormalEntryCacher
+//         - SharkOSREntryCacher
+
+class SharkCacherDecacher : public SharkStateScanner {
+ protected:
+  SharkCacherDecacher(SharkFunction* function)
+    : SharkStateScanner(function) {}
+
+  // Helper
+ protected:
+  static int adjusted_offset(SharkValue* value, int offset) {
+    if (value->is_two_word())
+      offset--;
+    return offset;
+  }
+};
+
+class SharkDecacher : public SharkCacherDecacher {
+ protected:
+  SharkDecacher(SharkFunction* function, int bci)
+    : SharkCacherDecacher(function), _bci(bci) {}
+
+ private:
+  int _bci;
+
+ protected:
+  int bci() const {
+    return _bci;
+  }
+
+ private:
+  int                           _pc_offset;
+  OopMap*                       _oopmap;
+  GrowableArray<ScopeValue*>*   _exparray;
+  GrowableArray<MonitorValue*>* _monarray;
+  GrowableArray<ScopeValue*>*   _locarray;
+
+ private:
+  int pc_offset() const {
+    return _pc_offset;
+  }
+  OopMap* oopmap() const {
+    return _oopmap;
+  }
+  GrowableArray<ScopeValue*>* exparray() const {
+    return _exparray;
+  }
+  GrowableArray<MonitorValue*>* monarray() const {
+    return _monarray;
+  }
+  GrowableArray<ScopeValue*>* locarray() const {
+    return _locarray;
+  }
+
+  // Callbacks
+ protected:
+  void start_frame();
+
+  void start_stack(int stack_depth);
+  void process_stack_slot(int index, SharkValue** value, int offset);
+
+  void start_monitors(int num_monitors);
+  void process_monitor(int index, int box_offset, int obj_offset);
+
+  void process_oop_tmp_slot(llvm::Value** value, int offset);
+  void process_method_slot(llvm::Value** value, int offset);
+  void process_pc_slot(int offset);
+
+  void start_locals();
+  void process_local_slot(int index, SharkValue** value, int offset);
+
+  void end_frame();
+
+  // oopmap and debuginfo helpers
+ private:
+  static int oopmap_slot_munge(int offset) {
+    return SharkStack::oopmap_slot_munge(offset);
+  }
+  static VMReg slot2reg(int offset) {
+    return SharkStack::slot2reg(offset);
+  }
+  static Location slot2loc(int offset, Location::Type type) {
+    return Location::new_stk_loc(type, offset * wordSize);
+  }
+  static LocationValue* slot2lv(int offset, Location::Type type) {
+    return new LocationValue(slot2loc(offset, type));
+  }
+  static Location::Type location_type(SharkValue** addr, bool maybe_two_word) {
+    // low addresses this end
+    //                           Type       32-bit    64-bit
+    //   ----------------------------------------------------
+    //   stack[0]    local[3]    jobject    oop       oop
+    //   stack[1]    local[2]    NULL       normal    lng
+    //   stack[2]    local[1]    jlong      normal    invalid
+    //   stack[3]    local[0]    jint       normal    normal
+    //
+    // high addresses this end
+
+    SharkValue *value = *addr;
+    if (value) {
+      if (value->is_jobject())
+        return Location::oop;
+#ifdef _LP64
+      if (value->is_two_word())
+        return Location::invalid;
+#endif // _LP64
+      return Location::normal;
+    }
+    else {
+      if (maybe_two_word) {
+        value = *(addr - 1);
+        if (value && value->is_two_word()) {
+#ifdef _LP64
+          if (value->is_jlong())
+            return Location::lng;
+          if (value->is_jdouble())
+            return Location::dbl;
+          ShouldNotReachHere();
+#else
+          return Location::normal;
+#endif // _LP64
+        }
+      }
+      return Location::invalid;
+    }
+  }
+
+  // Stack slot helpers
+ protected:
+  virtual bool stack_slot_needs_write(int index, SharkValue* value) = 0;
+  virtual bool stack_slot_needs_oopmap(int index, SharkValue* value) = 0;
+  virtual bool stack_slot_needs_debuginfo(int index, SharkValue* value) = 0;
+
+  static Location::Type stack_location_type(int index, SharkValue** addr) {
+    return location_type(addr, *addr == NULL);
+  }
+
+  // Local slot helpers
+ protected:
+  virtual bool local_slot_needs_write(int index, SharkValue* value) = 0;
+  virtual bool local_slot_needs_oopmap(int index, SharkValue* value) = 0;
+  virtual bool local_slot_needs_debuginfo(int index, SharkValue* value) = 0;
+
+  static Location::Type local_location_type(int index, SharkValue** addr) {
+    return location_type(addr, index > 0);
+  }
+
+  // Writer helper
+ protected:
+  void write_value_to_frame(const llvm::Type* type,
+                            llvm::Value*      value,
+                            int               offset);
+};
+
+class SharkJavaCallDecacher : public SharkDecacher {
+ public:
+  SharkJavaCallDecacher(SharkFunction* function, int bci, ciMethod* callee)
+    : SharkDecacher(function, bci), _callee(callee) {}
+
+ private:
+  ciMethod* _callee;
+
+ protected:
+  ciMethod* callee() const {
+    return _callee;
+  }
+
+  // Stack slot helpers
+ protected:
+  bool stack_slot_needs_write(int index, SharkValue* value) {
+    return value && (index < callee()->arg_size() || value->is_jobject());
+  }
+  bool stack_slot_needs_oopmap(int index, SharkValue* value) {
+    return value && value->is_jobject() && index >= callee()->arg_size();
+  }
+  bool stack_slot_needs_debuginfo(int index, SharkValue* value) {
+    return index >= callee()->arg_size();
+  }
+
+  // Local slot helpers
+ protected:
+  bool local_slot_needs_write(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+  bool local_slot_needs_oopmap(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+  bool local_slot_needs_debuginfo(int index, SharkValue* value) {
+    return true;
+  }
+};
+
+class SharkVMCallDecacher : public SharkDecacher {
+ public:
+  SharkVMCallDecacher(SharkFunction* function, int bci)
+    : SharkDecacher(function, bci) {}
+
+  // Stack slot helpers
+ protected:
+  bool stack_slot_needs_write(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+  bool stack_slot_needs_oopmap(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+  bool stack_slot_needs_debuginfo(int index, SharkValue* value) {
+    return true;
+  }
+
+  // Local slot helpers
+ protected:
+  bool local_slot_needs_write(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+  bool local_slot_needs_oopmap(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+  bool local_slot_needs_debuginfo(int index, SharkValue* value) {
+    return true;
+  }
+};
+
+class SharkTrapDecacher : public SharkDecacher {
+ public:
+  SharkTrapDecacher(SharkFunction* function, int bci)
+    : SharkDecacher(function, bci) {}
+
+  // Stack slot helpers
+ protected:
+  bool stack_slot_needs_write(int index, SharkValue* value) {
+    return value != NULL;
+  }
+  bool stack_slot_needs_oopmap(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+  bool stack_slot_needs_debuginfo(int index, SharkValue* value) {
+    return true;
+  }
+
+  // Local slot helpers
+ protected:
+  bool local_slot_needs_write(int index, SharkValue* value) {
+    return value != NULL;
+  }
+  bool local_slot_needs_oopmap(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+  bool local_slot_needs_debuginfo(int index, SharkValue* value) {
+    return true;
+  }
+};
+
+class SharkCacher : public SharkCacherDecacher {
+ protected:
+  SharkCacher(SharkFunction* function)
+    : SharkCacherDecacher(function) {}
+
+  // Callbacks
+ protected:
+  void process_stack_slot(int index, SharkValue** value, int offset);
+
+  void process_oop_tmp_slot(llvm::Value** value, int offset);
+  virtual void process_method_slot(llvm::Value** value, int offset);
+
+  virtual void process_local_slot(int index, SharkValue** value, int offset);
+
+  // Stack slot helper
+ protected:
+  virtual bool stack_slot_needs_read(int index, SharkValue* value) = 0;
+
+  // Local slot helper
+ protected:
+  virtual bool local_slot_needs_read(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+
+  // Writer helper
+ protected:
+  llvm::Value* read_value_from_frame(const llvm::Type* type, int offset);
+};
+
+class SharkJavaCallCacher : public SharkCacher {
+ public:
+  SharkJavaCallCacher(SharkFunction* function, ciMethod* callee)
+    : SharkCacher(function), _callee(callee) {}
+
+ private:
+  ciMethod* _callee;
+
+ protected:
+  ciMethod* callee() const {
+    return _callee;
+  }
+
+  // Stack slot helper
+ protected:
+  bool stack_slot_needs_read(int index, SharkValue* value) {
+    return value && (index < callee()->return_type()->size() ||
+                     value->is_jobject());
+  }
+};
+
+class SharkVMCallCacher : public SharkCacher {
+ public:
+  SharkVMCallCacher(SharkFunction* function)
+    : SharkCacher(function) {}
+
+  // Stack slot helper
+ protected:
+  bool stack_slot_needs_read(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+};
+
+class SharkFunctionEntryCacher : public SharkCacher {
+ public:
+  SharkFunctionEntryCacher(SharkFunction* function, llvm::Value* method)
+    : SharkCacher(function), _method(method) {}
+
+ private:
+  llvm::Value* _method;
+
+ private:
+  llvm::Value* method() const {
+    return _method;
+  }
+
+  // Method slot callback
+ protected:
+  void process_method_slot(llvm::Value** value, int offset);
+
+  // Stack slot helper
+ protected:
+  bool stack_slot_needs_read(int index, SharkValue* value) {
+    ShouldNotReachHere(); // entry block shouldn't have stack
+  }
+
+  // Local slot helper
+ protected:
+  bool local_slot_needs_read(int index, SharkValue* value) {
+    return value != NULL;
+  }
+};
+
+class SharkNormalEntryCacher : public SharkFunctionEntryCacher {
+ public:
+  SharkNormalEntryCacher(SharkFunction* function, llvm::Value* method)
+    : SharkFunctionEntryCacher(function, method) {}
+};
+
+class SharkOSREntryCacher : public SharkFunctionEntryCacher {
+ public:
+  SharkOSREntryCacher(SharkFunction* function,
+                      llvm::Value*   method,
+                      llvm::Value*   osr_buf)
+    : SharkFunctionEntryCacher(function, method),
+      _osr_buf(
+        builder()->CreateBitCast(
+          osr_buf,
+          llvm::PointerType::getUnqual(
+            llvm::ArrayType::get(
+              SharkType::intptr_type(),
+              max_locals() + max_monitors() * 2)))) {}
+
+ private:
+  llvm::Value* _osr_buf;
+
+ private:
+  llvm::Value* osr_buf() const {
+    return _osr_buf;
+  }
+
+  // Callbacks
+ protected:
+  void process_monitor(int index, int box_offset, int obj_offset);
+  void process_local_slot(int index, SharkValue** value, int offset);
+
+  // Helper
+ private:
+  llvm::Value* CreateAddressOfOSRBufEntry(int offset, const llvm::Type* type);
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkCodeBuffer.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+class SharkCodeBuffer : public StackObj {
+ public:
+  SharkCodeBuffer(MacroAssembler* masm)
+    : _masm(masm), _base_pc(NULL) {}
+
+ private:
+  MacroAssembler* _masm;
+  llvm::Value*    _base_pc;
+
+ private:
+  MacroAssembler* masm() const {
+    return _masm;
+  }
+
+ public:
+  llvm::Value* base_pc() const {
+    return _base_pc;
+  }
+  void set_base_pc(llvm::Value* base_pc) {
+    assert(_base_pc == NULL, "only do this once");
+    _base_pc = base_pc;
+  }
+
+  // Allocate some space in the buffer and return its address.
+  // This buffer will have been relocated by the time the method
+  // is installed, so you can't inline the result in code.
+ public:
+  void* malloc(size_t size) const {
+    masm()->align(BytesPerWord);
+    void *result = masm()->pc();
+    masm()->advance(size);
+    return result;
+  }
+
+  // Create a unique offset in the buffer.
+ public:
+  int create_unique_offset() const {
+    int offset = masm()->offset();
+    masm()->advance(1);
+    return offset;
+  }
+
+  // Inline an oop into the buffer and return its offset.
+ public:
+  int inline_oop(jobject object) const {
+    masm()->align(BytesPerWord);
+    int offset = masm()->offset();
+    masm()->store_oop(object);
+    return offset;
+  }
+
+  // Inline a block of non-oop data into the buffer and return its offset.
+ public:
+  int inline_data(void *src, size_t size) const {
+    masm()->align(BytesPerWord);
+    int offset = masm()->offset();
+    void *dst = masm()->pc();
+    masm()->advance(size);
+    memcpy(dst, src, size);
+    return offset;
+  }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkCompiler.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,340 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkCompiler.cpp.incl"
+
+#include <fnmatch.h>
+
+using namespace llvm;
+
+#if SHARK_LLVM_VERSION >= 27
+namespace {
+  cl::opt<std::string>
+  MCPU("mcpu");
+
+  cl::list<std::string>
+  MAttrs("mattr",
+         cl::CommaSeparated);
+}
+#endif
+
+SharkCompiler::SharkCompiler()
+  : AbstractCompiler() {
+  // Create the lock to protect the memory manager and execution engine
+  _execution_engine_lock = new Monitor(Mutex::leaf, "SharkExecutionEngineLock");
+  MutexLocker locker(execution_engine_lock());
+
+  // Make LLVM safe for multithreading
+  if (!llvm_start_multithreaded())
+    fatal("llvm_start_multithreaded() failed");
+
+  // Initialize the native target
+  InitializeNativeTarget();
+
+  // Create the two contexts which we'll use
+  _normal_context = new SharkContext("normal");
+  _native_context = new SharkContext("native");
+
+  // Create the memory manager
+  _memory_manager = new SharkMemoryManager();
+
+#if SHARK_LLVM_VERSION >= 27
+  // Finetune LLVM for the current host CPU.
+  StringMap<bool> Features;
+  bool gotCpuFeatures = llvm::sys::getHostCPUFeatures(Features);
+  std::string cpu("-mcpu=" + llvm::sys::getHostCPUName());
+
+  std::vector<const char*> args;
+  args.push_back(""); // program name
+  args.push_back(cpu.c_str());
+
+  std::string mattr("-mattr=");
+  if(gotCpuFeatures){
+    for(StringMap<bool>::iterator I = Features.begin(),
+      E = Features.end(); I != E; ++I){
+      if(I->second){
+        std::string attr(I->first());
+        mattr+="+"+attr+",";
+      }
+    }
+    args.push_back(mattr.c_str());
+  }
+
+  args.push_back(0);  // terminator
+  cl::ParseCommandLineOptions(args.size() - 1, (char **) &args[0]);
+
+  // Create the JIT
+  std::string ErrorMsg;
+
+  EngineBuilder builder(_normal_context->module());
+  builder.setMCPU(MCPU);
+  builder.setMAttrs(MAttrs);
+  builder.setJITMemoryManager(memory_manager());
+  builder.setEngineKind(EngineKind::JIT);
+  builder.setErrorStr(&ErrorMsg);
+  _execution_engine = builder.create();
+
+  if (!execution_engine()) {
+    if (!ErrorMsg.empty())
+      printf("Error while creating Shark JIT: %s\n",ErrorMsg.c_str());
+    else
+      printf("Unknown error while creating Shark JIT\n");
+    exit(1);
+  }
+
+  execution_engine()->addModule(
+    _native_context->module());
+#else
+  _execution_engine = ExecutionEngine::createJIT(
+    _normal_context->module_provider(),
+    NULL, memory_manager(), CodeGenOpt::Default);
+  execution_engine()->addModuleProvider(
+    _native_context->module_provider());
+#endif
+
+  // All done
+  mark_initialized();
+}
+
+void SharkCompiler::initialize() {
+  ShouldNotCallThis();
+}
+
+void SharkCompiler::compile_method(ciEnv*    env,
+                                   ciMethod* target,
+                                   int       entry_bci) {
+  assert(is_initialized(), "should be");
+  ResourceMark rm;
+  const char *name = methodname(
+    target->holder()->name()->as_utf8(), target->name()->as_utf8());
+
+  // Do the typeflow analysis
+  ciTypeFlow *flow;
+  if (entry_bci == InvocationEntryBci)
+    flow = target->get_flow_analysis();
+  else
+    flow = target->get_osr_flow_analysis(entry_bci);
+  if (flow->failing())
+    return;
+  if (SharkPrintTypeflowOf != NULL) {
+    if (!fnmatch(SharkPrintTypeflowOf, name, 0))
+      flow->print_on(tty);
+  }
+
+  // Create the recorders
+  Arena arena;
+  env->set_oop_recorder(new OopRecorder(&arena));
+  OopMapSet oopmaps;
+  env->set_debug_info(new DebugInformationRecorder(env->oop_recorder()));
+  env->debug_info()->set_oopmaps(&oopmaps);
+  env->set_dependencies(new Dependencies(env));
+
+  // Create the code buffer and builder
+  CodeBuffer hscb("Shark", 256 * K, 64 * K);
+  hscb.initialize_oop_recorder(env->oop_recorder());
+  MacroAssembler *masm = new MacroAssembler(&hscb);
+  SharkCodeBuffer cb(masm);
+  SharkBuilder builder(&cb);
+
+  // Emit the entry point
+  SharkEntry *entry = (SharkEntry *) cb.malloc(sizeof(SharkEntry));
+
+  // Build the LLVM IR for the method
+  Function *function = SharkFunction::build(env, &builder, flow, name);
+
+  // Generate native code.  It's unpleasant that we have to drop into
+  // the VM to do this -- it blocks safepoints -- but I can't see any
+  // other way to handle the locking.
+  {
+    ThreadInVMfromNative tiv(JavaThread::current());
+    generate_native_code(entry, function, name);
+  }
+
+  // Install the method into the VM
+  CodeOffsets offsets;
+  offsets.set_value(CodeOffsets::Deopt, 0);
+  offsets.set_value(CodeOffsets::Exceptions, 0);
+  offsets.set_value(CodeOffsets::Verified_Entry,
+                    target->is_static() ? 0 : wordSize);
+
+  ExceptionHandlerTable handler_table;
+  ImplicitExceptionTable inc_table;
+
+  env->register_method(target,
+                       entry_bci,
+                       &offsets,
+                       0,
+                       &hscb,
+                       0,
+                       &oopmaps,
+                       &handler_table,
+                       &inc_table,
+                       this,
+                       env->comp_level(),
+                       false,
+                       false);
+}
+
+nmethod* SharkCompiler::generate_native_wrapper(MacroAssembler* masm,
+                                                methodHandle    target,
+                                                BasicType*      arg_types,
+                                                BasicType       return_type) {
+  assert(is_initialized(), "should be");
+  ResourceMark rm;
+  const char *name = methodname(
+    target->klass_name()->as_utf8(), target->name()->as_utf8());
+
+  // Create the code buffer and builder
+  SharkCodeBuffer cb(masm);
+  SharkBuilder builder(&cb);
+
+  // Emit the entry point
+  SharkEntry *entry = (SharkEntry *) cb.malloc(sizeof(SharkEntry));
+
+  // Build the LLVM IR for the method
+  SharkNativeWrapper *wrapper = SharkNativeWrapper::build(
+    &builder, target, name, arg_types, return_type);
+
+  // Generate native code
+  generate_native_code(entry, wrapper->function(), name);
+
+  // Return the nmethod for installation in the VM
+  return nmethod::new_native_nmethod(target,
+                                     masm->code(),
+                                     0,
+                                     0,
+                                     wrapper->frame_size(),
+                                     wrapper->receiver_offset(),
+                                     wrapper->lock_offset(),
+                                     wrapper->oop_maps());
+}
+
+void SharkCompiler::generate_native_code(SharkEntry* entry,
+                                         Function*   function,
+                                         const char* name) {
+  // Print the LLVM bitcode, if requested
+  if (SharkPrintBitcodeOf != NULL) {
+    if (!fnmatch(SharkPrintBitcodeOf, name, 0))
+      function->dump();
+  }
+
+  // Compile to native code
+  address code = NULL;
+  context()->add_function(function);
+  {
+    MutexLocker locker(execution_engine_lock());
+    free_queued_methods();
+
+    if (SharkPrintAsmOf != NULL) {
+#if SHARK_LLVM_VERSION >= 27
+#ifndef NDEBUG
+      if (!fnmatch(SharkPrintAsmOf, name, 0)) {
+        llvm::SetCurrentDebugType(X86_ONLY("x86-emitter") NOT_X86("jit"));
+        llvm::DebugFlag = true;
+      }
+      else {
+        llvm::SetCurrentDebugType("");
+        llvm::DebugFlag = false;
+      }
+#endif // !NDEBUG
+#else
+      // NB you need to patch LLVM with http://tinyurl.com/yf3baln for this
+      std::vector<const char*> args;
+      args.push_back(""); // program name
+      if (!fnmatch(SharkPrintAsmOf, name, 0))
+        args.push_back("-debug-only=x86-emitter");
+      else
+        args.push_back("-debug-only=none");
+      args.push_back(0);  // terminator
+      cl::ParseCommandLineOptions(args.size() - 1, (char **) &args[0]);
+#endif // SHARK_LLVM_VERSION
+    }
+    memory_manager()->set_entry_for_function(function, entry);
+    code = (address) execution_engine()->getPointerToFunction(function);
+  }
+  entry->set_entry_point(code);
+  entry->set_function(function);
+  entry->set_context(context());
+  address code_start = entry->code_start();
+  address code_limit = entry->code_limit();
+
+  // Register generated code for profiling, etc
+  if (JvmtiExport::should_post_dynamic_code_generated())
+    JvmtiExport::post_dynamic_code_generated(name, code_start, code_limit);
+
+  // Print debug information, if requested
+  if (SharkTraceInstalls) {
+    tty->print_cr(
+      " [%p-%p): %s (%d bytes code)",
+      code_start, code_limit, name, code_limit - code_start);
+  }
+}
+
+void SharkCompiler::free_compiled_method(address code) {
+  // This method may only be called when the VM is at a safepoint.
+  // All _thread_in_vm threads will be waiting for the safepoint to
+  // finish with the exception of the VM thread, so we can consider
+  // ourself the owner of the execution engine lock even though we
+  // can't actually acquire it at this time.
+  assert(Thread::current()->is_VM_thread(), "must be called by VM thread");
+  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
+
+  SharkEntry *entry = (SharkEntry *) code;
+  entry->context()->push_to_free_queue(entry->function());
+}
+
+void SharkCompiler::free_queued_methods() {
+  // The free queue is protected by the execution engine lock
+  assert(execution_engine_lock()->owned_by_self(), "should be");
+
+  while (true) {
+    Function *function = context()->pop_from_free_queue();
+    if (function == NULL)
+      break;
+
+    execution_engine()->freeMachineCodeForFunction(function);
+    function->eraseFromParent();
+  }
+}
+
+const char* SharkCompiler::methodname(const char* klass, const char* method) {
+  char *buf = NEW_RESOURCE_ARRAY(char, strlen(klass) + 2 + strlen(method) + 1);
+
+  char *dst = buf;
+  for (const char *c = klass; *c; c++) {
+    if (*c == '/')
+      *(dst++) = '.';
+    else
+      *(dst++) = *c;
+  }
+  *(dst++) = ':';
+  *(dst++) = ':';
+  for (const char *c = method; *c; c++) {
+    *(dst++) = *c;
+  }
+  *(dst++) = '\0';
+  return buf;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkCompiler.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+class SharkContext;
+
+class SharkCompiler : public AbstractCompiler {
+ public:
+  // Creation
+  SharkCompiler();
+
+  // Name of this compiler
+  const char *name()     { return "shark"; }
+
+  // Missing feature tests
+  bool supports_native() { return true; }
+  bool supports_osr()    { return true; }
+
+  // Customization
+  bool needs_adapters()  { return false; }
+  bool needs_stubs()     { return false; }
+
+  // Initialization
+  void initialize();
+
+  // Compile a normal (bytecode) method and install it in the VM
+  void compile_method(ciEnv* env, ciMethod* target, int entry_bci);
+
+  // Generate a wrapper for a native (JNI) method
+  nmethod* generate_native_wrapper(MacroAssembler* masm,
+                                   methodHandle    target,
+                                   BasicType*      arg_types,
+                                   BasicType       return_type);
+
+  // Free compiled methods (and native wrappers)
+  void free_compiled_method(address code);
+
+  // Each thread generating IR needs its own context.  The normal
+  // context is used for bytecode methods, and is protected from
+  // multiple simultaneous accesses by being restricted to the
+  // compiler thread.  The native context is used for JNI methods,
+  // and is protected from multiple simultaneous accesses by the
+  // adapter handler library lock.
+ private:
+  SharkContext* _normal_context;
+  SharkContext* _native_context;
+
+ public:
+  SharkContext* context() const {
+    if (JavaThread::current()->is_Compiler_thread()) {
+      return _normal_context;
+    }
+    else {
+      assert(AdapterHandlerLibrary_lock->owned_by_self(), "should be");
+      return _native_context;
+    }
+  }
+
+  // The LLVM execution engine is the JIT we use to generate native
+  // code.  It is thread safe, but we need to protect it with a lock
+  // of our own because otherwise LLVM's lock and HotSpot's locks
+  // interleave and deadlock.  The SharkMemoryManager is not thread
+  // safe, and is protected by the same lock as the execution engine.
+ private:
+  Monitor*               _execution_engine_lock;
+  SharkMemoryManager*    _memory_manager;
+  llvm::ExecutionEngine* _execution_engine;
+
+ private:
+  Monitor* execution_engine_lock() const {
+    return _execution_engine_lock;
+  }
+  SharkMemoryManager* memory_manager() const {
+    assert(execution_engine_lock()->owned_by_self(), "should be");
+    return _memory_manager;
+  }
+  llvm::ExecutionEngine* execution_engine() const {
+    assert(execution_engine_lock()->owned_by_self(), "should be");
+    return _execution_engine;
+  }
+
+  // Global access
+ public:
+  static SharkCompiler* compiler() {
+    AbstractCompiler *compiler =
+      CompileBroker::compiler(CompLevel_fast_compile);
+    assert(compiler->is_shark() && compiler->is_initialized(), "should be");
+    return (SharkCompiler *) compiler;
+  }
+
+  // Helpers
+ private:
+  static const char* methodname(const char* klass, const char* method);
+  void generate_native_code(SharkEntry*     entry,
+                            llvm::Function* function,
+                            const char*     name);
+  void free_queued_methods();
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkConstant.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkConstant.cpp.incl"
+
+using namespace llvm;
+
+SharkConstant* SharkConstant::for_ldc(ciBytecodeStream *iter) {
+  ciConstant constant = iter->get_constant();
+  ciType *type = NULL;
+  if (constant.basic_type() == T_OBJECT) {
+    ciEnv *env = ciEnv::current();
+    if (constant.as_object()->is_klass())
+      type = env->Class_klass();
+    else
+      type = env->String_klass();
+  }
+  return new SharkConstant(constant, type);
+}
+
+SharkConstant* SharkConstant::for_field(ciBytecodeStream *iter) {
+  bool will_link;
+  ciField *field = iter->get_field(will_link);
+  assert(will_link, "typeflow responsibility");
+
+  return new SharkConstant(field->constant_value(), field->type());
+}
+
+SharkConstant::SharkConstant(ciConstant constant, ciType *type) {
+  SharkValue *value = NULL;
+
+  switch (constant.basic_type()) {
+  case T_BOOLEAN:
+  case T_BYTE:
+  case T_CHAR:
+  case T_SHORT:
+  case T_INT:
+    value = SharkValue::jint_constant(constant.as_int());
+    break;
+
+  case T_LONG:
+    value = SharkValue::jlong_constant(constant.as_long());
+    break;
+
+  case T_FLOAT:
+    value = SharkValue::jfloat_constant(constant.as_float());
+    break;
+
+  case T_DOUBLE:
+    value = SharkValue::jdouble_constant(constant.as_double());
+    break;
+
+  case T_OBJECT:
+  case T_ARRAY:
+    break;
+
+  case T_ILLEGAL:
+    // out of memory
+    _is_loaded = false;
+    return;
+
+  default:
+    tty->print_cr("Unhandled type %s", type2name(constant.basic_type()));
+    ShouldNotReachHere();
+  }
+
+  // Handle primitive types.  We create SharkValues for these
+  // now; doing so doesn't emit any code, and it allows us to
+  // delegate a bunch of stuff to the SharkValue code.
+  if (value) {
+    _value       = value;
+    _is_loaded   = true;
+    _is_nonzero  = value->zero_checked();
+    _is_two_word = value->is_two_word();
+    return;
+  }
+
+  // Handle reference types.  This is tricky because some
+  // ciObjects are psuedo-objects that refer to oops which
+  // have yet to be created.  We need to spot the unloaded
+  // objects (which differ between ldc* and get*, thanks!)
+  ciObject *object = constant.as_object();
+  assert(type != NULL, "shouldn't be");
+  if (object->is_klass()) {
+    // The constant returned for a klass is the ciKlass
+    // for the entry, but we want the java_mirror.
+    ciKlass *klass = object->as_klass();
+    if (!klass->is_loaded()) {
+      _is_loaded = false;
+      return;
+    }
+    object = klass->java_mirror();
+  }
+  if (object->is_null_object() || !object->can_be_constant()) {
+    _is_loaded = false;
+    return;
+  }
+
+  _value       = NULL;
+  _object      = object;
+  _type        = type;
+  _is_loaded   = true;
+  _is_nonzero  = true;
+  _is_two_word = false;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkConstant.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+class SharkConstant : public ResourceObj {
+ public:
+  static SharkConstant* for_ldc(ciBytecodeStream* iter);
+  static SharkConstant* for_field(ciBytecodeStream* iter);
+
+ private:
+  SharkConstant(ciConstant constant, ciType* type);
+
+ private:
+  SharkValue* _value;
+  ciObject*   _object;
+  ciType*     _type;
+  bool        _is_loaded;
+  bool        _is_nonzero;
+  bool        _is_two_word;
+
+ public:
+  bool is_loaded() const {
+    return _is_loaded;
+  }
+  bool is_nonzero() const {
+    assert(is_loaded(), "should be");
+    return _is_nonzero;
+  }
+  bool is_two_word() const {
+    assert(is_loaded(), "should be");
+    return _is_two_word;
+  }
+
+ public:
+  SharkValue* value(SharkBuilder* builder) {
+    assert(is_loaded(), "should be");
+    if (_value == NULL) {
+      _value = SharkValue::create_generic(
+        _type, builder->CreateInlineOop(_object), _is_nonzero);
+    }
+    return _value;
+  }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkContext.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkContext.cpp.incl"
+
+using namespace llvm;
+
+SharkContext::SharkContext(const char* name)
+  : LLVMContext(),
+    _free_queue(NULL) {
+  // Create a module to build our functions into
+  _module = new Module(name, *this);
+
+  // Create basic types
+  _void_type    = Type::getVoidTy(*this);
+  _bit_type     = Type::getInt1Ty(*this);
+  _jbyte_type   = Type::getInt8Ty(*this);
+  _jshort_type  = Type::getInt16Ty(*this);
+  _jint_type    = Type::getInt32Ty(*this);
+  _jlong_type   = Type::getInt64Ty(*this);
+  _jfloat_type  = Type::getFloatTy(*this);
+  _jdouble_type = Type::getDoubleTy(*this);
+
+  // Create compound types
+  _itableOffsetEntry_type = PointerType::getUnqual(
+    ArrayType::get(jbyte_type(), itableOffsetEntry::size() * wordSize));
+
+  _klass_type = PointerType::getUnqual(
+    ArrayType::get(jbyte_type(), sizeof(Klass)));
+
+  _jniEnv_type = PointerType::getUnqual(
+    ArrayType::get(jbyte_type(), sizeof(JNIEnv)));
+
+  _jniHandleBlock_type = PointerType::getUnqual(
+    ArrayType::get(jbyte_type(), sizeof(JNIHandleBlock)));
+
+  _methodOop_type = PointerType::getUnqual(
+    ArrayType::get(jbyte_type(), sizeof(methodOopDesc)));
+
+  _monitor_type = ArrayType::get(
+    jbyte_type(), frame::interpreter_frame_monitor_size() * wordSize);
+
+  _oop_type = PointerType::getUnqual(
+    ArrayType::get(jbyte_type(), sizeof(oopDesc)));
+
+  _thread_type = PointerType::getUnqual(
+    ArrayType::get(jbyte_type(), sizeof(JavaThread)));
+
+  _zeroStack_type = PointerType::getUnqual(
+    ArrayType::get(jbyte_type(), sizeof(ZeroStack)));
+
+  std::vector<const Type*> params;
+  params.push_back(methodOop_type());
+  params.push_back(intptr_type());
+  params.push_back(thread_type());
+  _entry_point_type = FunctionType::get(jint_type(), params, false);
+
+  params.clear();
+  params.push_back(methodOop_type());
+  params.push_back(PointerType::getUnqual(jbyte_type()));
+  params.push_back(intptr_type());
+  params.push_back(thread_type());
+  _osr_entry_point_type = FunctionType::get(jint_type(), params, false);
+
+  // Create mappings
+  for (int i = 0; i < T_CONFLICT; i++) {
+    switch (i) {
+    case T_BOOLEAN:
+      _to_stackType[i] = jint_type();
+      _to_arrayType[i] = jbyte_type();
+      break;
+
+    case T_BYTE:
+      _to_stackType[i] = jint_type();
+      _to_arrayType[i] = jbyte_type();
+      break;
+
+    case T_CHAR:
+      _to_stackType[i] = jint_type();
+      _to_arrayType[i] = jshort_type();
+      break;
+
+    case T_SHORT:
+      _to_stackType[i] = jint_type();
+      _to_arrayType[i] = jshort_type();
+      break;
+
+    case T_INT:
+      _to_stackType[i] = jint_type();
+      _to_arrayType[i] = jint_type();
+      break;
+
+    case T_LONG:
+      _to_stackType[i] = jlong_type();
+      _to_arrayType[i] = jlong_type();
+      break;
+
+    case T_FLOAT:
+      _to_stackType[i] = jfloat_type();
+      _to_arrayType[i] = jfloat_type();
+      break;
+
+    case T_DOUBLE:
+      _to_stackType[i] = jdouble_type();
+      _to_arrayType[i] = jdouble_type();
+      break;
+
+    case T_OBJECT:
+    case T_ARRAY:
+      _to_stackType[i] = oop_type();
+      _to_arrayType[i] = oop_type();
+      break;
+
+    case T_ADDRESS:
+      _to_stackType[i] = intptr_type();
+      _to_arrayType[i] = NULL;
+      break;
+
+    default:
+      _to_stackType[i] = NULL;
+      _to_arrayType[i] = NULL;
+    }
+  }
+}
+
+class SharkFreeQueueItem : public CHeapObj {
+ public:
+  SharkFreeQueueItem(llvm::Function* function, SharkFreeQueueItem *next)
+    : _function(function), _next(next) {}
+
+ private:
+  llvm::Function*     _function;
+  SharkFreeQueueItem* _next;
+
+ public:
+  llvm::Function* function() const {
+    return _function;
+  }
+  SharkFreeQueueItem* next() const {
+    return _next;
+  }
+};
+
+void SharkContext::push_to_free_queue(Function* function) {
+  _free_queue = new SharkFreeQueueItem(function, _free_queue);
+}
+
+Function* SharkContext::pop_from_free_queue() {
+  if (_free_queue == NULL)
+    return NULL;
+
+  SharkFreeQueueItem *item = _free_queue;
+  Function *function = item->function();
+  _free_queue = item->next();
+  delete item;
+  return function;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkContext.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+// The LLVMContext class allows multiple instances of LLVM to operate
+// independently of each other in a multithreaded context.  We extend
+// this here to store things in Shark that are LLVMContext-specific.
+
+class SharkFreeQueueItem;
+
+class SharkContext : public llvm::LLVMContext {
+ public:
+  SharkContext(const char* name);
+
+ private:
+  llvm::Module* _module;
+
+#if SHARK_LLVM_VERSION >= 27
+ public:
+#else
+ private:
+#endif
+  llvm::Module* module() const {
+    return _module;
+  }
+
+  // Get this thread's SharkContext
+ public:
+  static SharkContext& current() {
+    return *SharkCompiler::compiler()->context();
+  }
+
+  // Module accessors
+ public:
+#if SHARK_LLVM_VERSION < 27
+  llvm::ModuleProvider* module_provider() const {
+    return new llvm::ExistingModuleProvider(module());
+  }
+#endif
+  void add_function(llvm::Function* function) const {
+    module()->getFunctionList().push_back(function);
+  }
+  llvm::Constant* get_external(const char*               name,
+                               const llvm::FunctionType* sig) {
+    return module()->getOrInsertFunction(name, sig);
+  }
+
+  // Basic types
+ private:
+  const llvm::Type*        _void_type;
+  const llvm::IntegerType* _bit_type;
+  const llvm::IntegerType* _jbyte_type;
+  const llvm::IntegerType* _jshort_type;
+  const llvm::IntegerType* _jint_type;
+  const llvm::IntegerType* _jlong_type;
+  const llvm::Type*        _jfloat_type;
+  const llvm::Type*        _jdouble_type;
+
+ public:
+  const llvm::Type* void_type() const {
+    return _void_type;
+  }
+  const llvm::IntegerType* bit_type() const {
+    return _bit_type;
+  }
+  const llvm::IntegerType* jbyte_type() const {
+    return _jbyte_type;
+  }
+  const llvm::IntegerType* jshort_type() const {
+    return _jshort_type;
+  }
+  const llvm::IntegerType* jint_type() const {
+    return _jint_type;
+  }
+  const llvm::IntegerType* jlong_type() const {
+    return _jlong_type;
+  }
+  const llvm::Type* jfloat_type() const {
+    return _jfloat_type;
+  }
+  const llvm::Type* jdouble_type() const {
+    return _jdouble_type;
+  }
+  const llvm::IntegerType* intptr_type() const {
+    return LP64_ONLY(jlong_type()) NOT_LP64(jint_type());
+  }
+
+  // Compound types
+ private:
+  const llvm::PointerType*  _itableOffsetEntry_type;
+  const llvm::PointerType*  _jniEnv_type;
+  const llvm::PointerType*  _jniHandleBlock_type;
+  const llvm::PointerType*  _klass_type;
+  const llvm::PointerType*  _methodOop_type;
+  const llvm::ArrayType*    _monitor_type;
+  const llvm::PointerType*  _oop_type;
+  const llvm::PointerType*  _thread_type;
+  const llvm::PointerType*  _zeroStack_type;
+  const llvm::FunctionType* _entry_point_type;
+  const llvm::FunctionType* _osr_entry_point_type;
+
+ public:
+  const llvm::PointerType* itableOffsetEntry_type() const {
+    return _itableOffsetEntry_type;
+  }
+  const llvm::PointerType* jniEnv_type() const {
+    return _jniEnv_type;
+  }
+  const llvm::PointerType* jniHandleBlock_type() const {
+    return _jniHandleBlock_type;
+  }
+  const llvm::PointerType* klass_type() const {
+    return _klass_type;
+  }
+  const llvm::PointerType* methodOop_type() const {
+    return _methodOop_type;
+  }
+  const llvm::ArrayType* monitor_type() const {
+    return _monitor_type;
+  }
+  const llvm::PointerType* oop_type() const {
+    return _oop_type;
+  }
+  const llvm::PointerType* thread_type() const {
+    return _thread_type;
+  }
+  const llvm::PointerType* zeroStack_type() const {
+    return _zeroStack_type;
+  }
+  const llvm::FunctionType* entry_point_type() const {
+    return _entry_point_type;
+  }
+  const llvm::FunctionType* osr_entry_point_type() const {
+    return _osr_entry_point_type;
+  }
+
+  // Mappings
+ private:
+  const llvm::Type* _to_stackType[T_CONFLICT];
+  const llvm::Type* _to_arrayType[T_CONFLICT];
+
+ private:
+  const llvm::Type* map_type(const llvm::Type* const* table,
+                             BasicType                type) const {
+    assert(type >= 0 && type < T_CONFLICT, "unhandled type");
+    const llvm::Type* result = table[type];
+    assert(type != NULL, "unhandled type");
+    return result;
+  }
+
+ public:
+  const llvm::Type* to_stackType(BasicType type) const {
+    return map_type(_to_stackType, type);
+  }
+  const llvm::Type* to_arrayType(BasicType type) const {
+    return map_type(_to_arrayType, type);
+  }
+
+  // Functions queued for freeing
+ private:
+  SharkFreeQueueItem* _free_queue;
+
+ public:
+  void push_to_free_queue(llvm::Function* function);
+  llvm::Function* pop_from_free_queue();
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkEntry.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+class SharkContext;
+
+class SharkEntry : public ZeroEntry {
+ private:
+  address         _code_limit;
+  SharkContext*   _context;
+  llvm::Function* _function;
+
+ public:
+  address code_start() const {
+    return entry_point();
+  }
+  address code_limit() const {
+    return _code_limit;
+  }
+  SharkContext* context() const {
+    return _context;
+  }
+  llvm::Function* function() const {
+    return _function;
+  }
+
+ public:
+  void set_code_limit(address code_limit) {
+    _code_limit = code_limit;
+  }
+  void set_context(SharkContext* context) {
+    _context = context;
+  }
+  void set_function(llvm::Function* function) {
+    _function = function;
+  }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkFunction.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkFunction.cpp.incl"
+
+using namespace llvm;
+
+void SharkFunction::initialize(const char *name) {
+  // Create the function
+  _function = Function::Create(
+    entry_point_type(),
+    GlobalVariable::InternalLinkage,
+    name);
+
+  // Get our arguments
+  Function::arg_iterator ai = function()->arg_begin();
+  Argument *method = ai++;
+  method->setName("method");
+  Argument *osr_buf = NULL;
+  if (is_osr()) {
+    osr_buf = ai++;
+    osr_buf->setName("osr_buf");
+  }
+  Argument *base_pc = ai++;
+  base_pc->setName("base_pc");
+  code_buffer()->set_base_pc(base_pc);
+  Argument *thread = ai++;
+  thread->setName("thread");
+  set_thread(thread);
+
+  // Create the list of blocks
+  set_block_insertion_point(NULL);
+  _blocks = NEW_RESOURCE_ARRAY(SharkTopLevelBlock*, block_count());
+  for (int i = 0; i < block_count(); i++) {
+    ciTypeFlow::Block *b = flow()->pre_order_at(i);
+
+    // Work around a bug in pre_order_at() that does not return
+    // the correct pre-ordering.  If pre_order_at() were correct
+    // this line could simply be:
+    // _blocks[i] = new SharkTopLevelBlock(this, b);
+    _blocks[b->pre_order()] = new SharkTopLevelBlock(this, b);
+  }
+
+  // Walk the tree from the start block to determine which
+  // blocks are entered and which blocks require phis
+  SharkTopLevelBlock *start_block = block(flow()->start_block_num());
+  assert(start_block->start() == flow()->start_bci(), "blocks out of order");
+  start_block->enter();
+
+  // Initialize all entered blocks
+  for (int i = 0; i < block_count(); i++) {
+    if (block(i)->entered())
+      block(i)->initialize();
+  }
+
+  // Create and push our stack frame
+  set_block_insertion_point(&function()->front());
+  builder()->SetInsertPoint(CreateBlock());
+  _stack = SharkStack::CreateBuildAndPushFrame(this, method);
+
+  // Create the entry state
+  SharkState *entry_state;
+  if (is_osr()) {
+    entry_state = new SharkOSREntryState(start_block, method, osr_buf);
+
+    // Free the OSR buffer
+    builder()->CreateCall(builder()->osr_migration_end(), osr_buf);
+  }
+  else {
+    entry_state = new SharkNormalEntryState(start_block, method);
+
+    // Lock if necessary
+    if (is_synchronized()) {
+      SharkTopLevelBlock *locker =
+        new SharkTopLevelBlock(this, start_block->ciblock());
+      locker->add_incoming(entry_state);
+
+      set_block_insertion_point(start_block->entry_block());
+      locker->acquire_method_lock();
+
+      entry_state = locker->current_state();
+    }
+  }
+
+  // Transition into the method proper
+  start_block->add_incoming(entry_state);
+  builder()->CreateBr(start_block->entry_block());
+
+  // Parse the blocks
+  for (int i = 0; i < block_count(); i++) {
+    if (!block(i)->entered())
+      continue;
+
+    if (i + 1 < block_count())
+      set_block_insertion_point(block(i + 1)->entry_block());
+    else
+      set_block_insertion_point(NULL);
+
+    block(i)->emit_IR();
+  }
+  do_deferred_zero_checks();
+}
+
+class DeferredZeroCheck : public SharkTargetInvariants {
+ public:
+  DeferredZeroCheck(SharkTopLevelBlock* block, SharkValue* value)
+    : SharkTargetInvariants(block),
+      _block(block),
+      _value(value),
+      _bci(block->bci()),
+      _state(block->current_state()->copy()),
+      _check_block(builder()->GetInsertBlock()),
+      _continue_block(function()->CreateBlock("not_zero")) {
+    builder()->SetInsertPoint(continue_block());
+  }
+
+ private:
+  SharkTopLevelBlock* _block;
+  SharkValue*         _value;
+  int                 _bci;
+  SharkState*         _state;
+  BasicBlock*         _check_block;
+  BasicBlock*         _continue_block;
+
+ public:
+  SharkTopLevelBlock* block() const {
+    return _block;
+  }
+  SharkValue* value() const {
+    return _value;
+  }
+  int bci() const {
+    return _bci;
+  }
+  SharkState* state() const {
+    return _state;
+  }
+  BasicBlock* check_block() const {
+    return _check_block;
+  }
+  BasicBlock* continue_block() const {
+    return _continue_block;
+  }
+
+ public:
+  SharkFunction* function() const {
+    return block()->function();
+  }
+
+ public:
+  void process() const {
+    builder()->SetInsertPoint(check_block());
+    block()->do_deferred_zero_check(value(), bci(), state(), continue_block());
+  }
+};
+
+void SharkFunction::add_deferred_zero_check(SharkTopLevelBlock* block,
+                                            SharkValue*         value) {
+  deferred_zero_checks()->append(new DeferredZeroCheck(block, value));
+}
+
+void SharkFunction::do_deferred_zero_checks() {
+  for (int i = 0; i < deferred_zero_checks()->length(); i++)
+    deferred_zero_checks()->at(i)->process();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkFunction.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+class SharkTopLevelBlock;
+class DeferredZeroCheck;
+
+class SharkFunction : public SharkTargetInvariants {
+ friend class SharkStackWithNormalFrame;
+
+ public:
+  static llvm::Function* build(ciEnv*        env,
+                               SharkBuilder* builder,
+                               ciTypeFlow*   flow,
+                               const char*   name) {
+    SharkFunction function(env, builder, flow, name);
+    return function.function();
+  }
+
+ private:
+  SharkFunction(ciEnv*        env,
+                SharkBuilder* builder,
+                ciTypeFlow*   flow,
+                const char*   name)
+    : SharkTargetInvariants(env, builder, flow) { initialize(name); }
+
+ private:
+  void initialize(const char* name);
+
+ private:
+  llvm::Function*                   _function;
+  SharkTopLevelBlock**              _blocks;
+  GrowableArray<DeferredZeroCheck*> _deferred_zero_checks;
+  SharkStack*                       _stack;
+
+ public:
+  llvm::Function* function() const {
+    return _function;
+  }
+  int block_count() const {
+    return flow()->block_count();
+  }
+  SharkTopLevelBlock* block(int i) const {
+    assert(i < block_count(), "should be");
+    return _blocks[i];
+  }
+  GrowableArray<DeferredZeroCheck*>* deferred_zero_checks() {
+    return &_deferred_zero_checks;
+  }
+  SharkStack* stack() const {
+    return _stack;
+  }
+
+  // On-stack replacement
+ private:
+  bool is_osr() const {
+    return flow()->is_osr_flow();
+  }
+  const llvm::FunctionType* entry_point_type() const {
+    if (is_osr())
+      return SharkType::osr_entry_point_type();
+    else
+      return SharkType::entry_point_type();
+  }
+
+  // Block management
+ private:
+  llvm::BasicBlock* _block_insertion_point;
+
+  void set_block_insertion_point(llvm::BasicBlock* block_insertion_point) {
+    _block_insertion_point = block_insertion_point;
+  }
+  llvm::BasicBlock* block_insertion_point() const {
+    return _block_insertion_point;
+  }
+
+ public:
+  llvm::BasicBlock* CreateBlock(const char* name = "") const {
+    return llvm::BasicBlock::Create(
+      SharkContext::current(), name, function(), block_insertion_point());
+  }
+
+  // Deferred zero checks
+ public:
+  void add_deferred_zero_check(SharkTopLevelBlock* block,
+                               SharkValue*         value);
+
+ private:
+  void do_deferred_zero_checks();
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkInliner.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,749 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkInliner.cpp.incl"
+
+using namespace llvm;
+
+class SharkInlineBlock : public SharkBlock {
+ public:
+  SharkInlineBlock(ciMethod* target, SharkState* state)
+    : SharkBlock(state, target),
+      _outer_state(state),
+      _entry_state(new SharkState(this)) {
+    for (int i = target->max_locals() - 1; i >= 0; i--) {
+      SharkValue *value = NULL;
+      if (i < target->arg_size())
+        value = outer_state()->pop();
+      entry_state()->set_local(i, value);
+    }
+  }
+
+ private:
+  SharkState* _outer_state;
+  SharkState* _entry_state;
+
+ private:
+  SharkState* outer_state() {
+    return _outer_state;
+  }
+  SharkState* entry_state() {
+    return _entry_state;
+  }
+
+ public:
+  void emit_IR() {
+    parse_bytecode(0, target()->code_size());
+  }
+
+ private:
+  void do_return(BasicType type) {
+    if (type != T_VOID) {
+      SharkValue *result = pop_result(type);
+      outer_state()->push(result);
+      if (result->is_two_word())
+        outer_state()->push(NULL);
+    }
+  }
+};
+
+class SharkInlinerHelper : public StackObj {
+ public:
+  SharkInlinerHelper(ciMethod* target, SharkState* entry_state)
+    : _target(target),
+      _entry_state(entry_state),
+      _iter(target) {}
+
+ private:
+  ciBytecodeStream _iter;
+  SharkState*      _entry_state;
+  ciMethod*        _target;
+
+ public:
+  ciBytecodeStream* iter() {
+    return &_iter;
+  }
+  SharkState* entry_state() const {
+    return _entry_state;
+  }
+  ciMethod* target() const {
+    return _target;
+  }
+
+ public:
+  Bytecodes::Code bc() {
+    return iter()->cur_bc();
+  }
+  int max_locals() const {
+    return target()->max_locals();
+  }
+  int max_stack() const {
+    return target()->max_stack();
+  }
+
+  // Inlinability check
+ public:
+  bool is_inlinable();
+
+ private:
+  void initialize_for_check();
+
+  bool do_getstatic() {
+    return do_field_access(true, false);
+  }
+  bool do_getfield() {
+    return do_field_access(true, true);
+  }
+  bool do_putfield() {
+    return do_field_access(false, true);
+  }
+  bool do_field_access(bool is_get, bool is_field);
+
+  // Local variables for inlinability check
+ private:
+  bool* _locals;
+
+ public:
+  bool* local_addr(int index) const {
+    assert(index >= 0 && index < max_locals(), "bad local variable index");
+    return &_locals[index];
+  }
+  bool local(int index) const {
+    return *local_addr(index);
+  }
+  void set_local(int index, bool value) {
+    *local_addr(index) = value;
+  }
+
+  // Expression stack for inlinability check
+ private:
+  bool* _stack;
+  bool* _sp;
+
+ public:
+  int stack_depth() const {
+    return _sp - _stack;
+  }
+  bool* stack_addr(int slot) const {
+    assert(slot >= 0 && slot < stack_depth(), "bad stack slot");
+    return &_sp[-(slot + 1)];
+  }
+  void push(bool value) {
+    assert(stack_depth() < max_stack(), "stack overrun");
+    *(_sp++) = value;
+  }
+  bool pop() {
+    assert(stack_depth() > 0, "stack underrun");
+    return *(--_sp);
+  }
+
+  // Methods for two-word locals
+ public:
+  void push_pair_local(int index) {
+    push(local(index));
+    push(local(index + 1));
+  }
+  void pop_pair_local(int index) {
+    set_local(index + 1, pop());
+    set_local(index, pop());
+  }
+
+  // Code generation
+ public:
+  void do_inline() {
+    (new SharkInlineBlock(target(), entry_state()))->emit_IR();
+  }
+};
+
+// Quick checks so we can bail out before doing too much
+bool SharkInliner::may_be_inlinable(ciMethod *target) {
+  // We can't inline native methods
+  if (target->is_native())
+    return false;
+
+  // Not much point inlining abstract ones, and in any
+  // case we'd need a stack frame to throw the exception
+  if (target->is_abstract())
+    return false;
+
+  // Don't inline anything huge
+  if (target->code_size() > SharkMaxInlineSize)
+    return false;
+
+  // Monitors aren't allowed without a frame to put them in
+  if (target->is_synchronized() || target->has_monitor_bytecodes())
+    return false;
+
+  // We don't do control flow
+  if (target->has_exception_handlers() || target->has_jsrs())
+    return false;
+
+  // Don't try to inline constructors, as they must
+  // eventually call Object.<init> which we can't inline.
+  // Note that this catches <clinit> too, but why would
+  // we be compiling that?
+  if (target->is_initializer())
+    return false;
+
+  // Mustn't inline Object.<init>
+  // Should be caught by the above, but just in case...
+  if (target->intrinsic_id() == vmIntrinsics::_Object_init)
+    return false;
+
+  return true;
+}
+
+// Full-on detailed check, for methods that pass the quick checks
+// Inlined methods have no stack frame, so we can't do anything
+// that would require one.  This means no safepoints (and hence
+// no loops) and no VM calls.  No VM calls means, amongst other
+// things, that no exceptions can be created, which means no null
+// checks or divide-by-zero checks are allowed.  The lack of null
+// checks in particular would eliminate practically everything,
+// but we can get around that restriction by relying on the zero-
+// check eliminator to strip the checks.  To do that, we need to
+// walk through the method, tracking which values are and are not
+// zero-checked.
+bool SharkInlinerHelper::is_inlinable() {
+  ResourceMark rm;
+  initialize_for_check();
+
+  SharkConstant *sc;
+  bool a, b, c, d;
+
+  iter()->reset_to_bci(0);
+  while (iter()->next() != ciBytecodeStream::EOBC()) {
+    switch (bc()) {
+    case Bytecodes::_nop:
+      break;
+
+    case Bytecodes::_aconst_null:
+      push(false);
+      break;
+
+    case Bytecodes::_iconst_0:
+      push(false);
+      break;
+    case Bytecodes::_iconst_m1:
+    case Bytecodes::_iconst_1:
+    case Bytecodes::_iconst_2:
+    case Bytecodes::_iconst_3:
+    case Bytecodes::_iconst_4:
+    case Bytecodes::_iconst_5:
+      push(true);
+      break;
+
+    case Bytecodes::_lconst_0:
+      push(false);
+      push(false);
+      break;
+    case Bytecodes::_lconst_1:
+      push(true);
+      push(false);
+      break;
+
+    case Bytecodes::_fconst_0:
+    case Bytecodes::_fconst_1:
+    case Bytecodes::_fconst_2:
+      push(false);
+      break;
+
+    case Bytecodes::_dconst_0:
+    case Bytecodes::_dconst_1:
+      push(false);
+      push(false);
+      break;
+
+    case Bytecodes::_bipush:
+      push(iter()->get_constant_u1() != 0);
+      break;
+    case Bytecodes::_sipush:
+      push(iter()->get_constant_u2() != 0);
+      break;
+
+    case Bytecodes::_ldc:
+    case Bytecodes::_ldc_w:
+    case Bytecodes::_ldc2_w:
+      sc = SharkConstant::for_ldc(iter());
+      if (!sc->is_loaded())
+        return false;
+      push(sc->is_nonzero());
+      if (sc->is_two_word())
+        push(false);
+      break;
+
+    case Bytecodes::_iload_0:
+    case Bytecodes::_fload_0:
+    case Bytecodes::_aload_0:
+      push(local(0));
+      break;
+    case Bytecodes::_lload_0:
+    case Bytecodes::_dload_0:
+      push_pair_local(0);
+      break;
+
+    case Bytecodes::_iload_1:
+    case Bytecodes::_fload_1:
+    case Bytecodes::_aload_1:
+      push(local(1));
+      break;
+    case Bytecodes::_lload_1:
+    case Bytecodes::_dload_1:
+      push_pair_local(1);
+      break;
+
+    case Bytecodes::_iload_2:
+    case Bytecodes::_fload_2:
+    case Bytecodes::_aload_2:
+      push(local(2));
+      break;
+    case Bytecodes::_lload_2:
+    case Bytecodes::_dload_2:
+      push_pair_local(2);
+      break;
+
+    case Bytecodes::_iload_3:
+    case Bytecodes::_fload_3:
+    case Bytecodes::_aload_3:
+      push(local(3));
+      break;
+    case Bytecodes::_lload_3:
+    case Bytecodes::_dload_3:
+      push_pair_local(3);
+      break;
+
+    case Bytecodes::_iload:
+    case Bytecodes::_fload:
+    case Bytecodes::_aload:
+      push(local(iter()->get_index()));
+      break;
+    case Bytecodes::_lload:
+    case Bytecodes::_dload:
+      push_pair_local(iter()->get_index());
+      break;
+
+    case Bytecodes::_istore_0:
+    case Bytecodes::_fstore_0:
+    case Bytecodes::_astore_0:
+      set_local(0, pop());
+      break;
+    case Bytecodes::_lstore_0:
+    case Bytecodes::_dstore_0:
+      pop_pair_local(0);
+      break;
+
+    case Bytecodes::_istore_1:
+    case Bytecodes::_fstore_1:
+    case Bytecodes::_astore_1:
+      set_local(1, pop());
+      break;
+    case Bytecodes::_lstore_1:
+    case Bytecodes::_dstore_1:
+      pop_pair_local(1);
+      break;
+
+    case Bytecodes::_istore_2:
+    case Bytecodes::_fstore_2:
+    case Bytecodes::_astore_2:
+      set_local(2, pop());
+      break;
+    case Bytecodes::_lstore_2:
+    case Bytecodes::_dstore_2:
+      pop_pair_local(2);
+      break;
+
+    case Bytecodes::_istore_3:
+    case Bytecodes::_fstore_3:
+    case Bytecodes::_astore_3:
+      set_local(3, pop());
+      break;
+    case Bytecodes::_lstore_3:
+    case Bytecodes::_dstore_3:
+      pop_pair_local(3);
+      break;
+
+    case Bytecodes::_istore:
+    case Bytecodes::_fstore:
+    case Bytecodes::_astore:
+      set_local(iter()->get_index(), pop());
+      break;
+    case Bytecodes::_lstore:
+    case Bytecodes::_dstore:
+      pop_pair_local(iter()->get_index());
+      break;
+
+    case Bytecodes::_pop:
+      pop();
+      break;
+    case Bytecodes::_pop2:
+      pop();
+      pop();
+      break;
+    case Bytecodes::_swap:
+      a = pop();
+      b = pop();
+      push(a);
+      push(b);
+      break;
+    case Bytecodes::_dup:
+      a = pop();
+      push(a);
+      push(a);
+      break;
+    case Bytecodes::_dup_x1:
+      a = pop();
+      b = pop();
+      push(a);
+      push(b);
+      push(a);
+      break;
+    case Bytecodes::_dup_x2:
+      a = pop();
+      b = pop();
+      c = pop();
+      push(a);
+      push(c);
+      push(b);
+      push(a);
+      break;
+    case Bytecodes::_dup2:
+      a = pop();
+      b = pop();
+      push(b);
+      push(a);
+      push(b);
+      push(a);
+      break;
+    case Bytecodes::_dup2_x1:
+      a = pop();
+      b = pop();
+      c = pop();
+      push(b);
+      push(a);
+      push(c);
+      push(b);
+      push(a);
+      break;
+    case Bytecodes::_dup2_x2:
+      a = pop();
+      b = pop();
+      c = pop();
+      d = pop();
+      push(b);
+      push(a);
+      push(d);
+      push(c);
+      push(b);
+      push(a);
+      break;
+
+    case Bytecodes::_getfield:
+      if (!do_getfield())
+        return false;
+      break;
+    case Bytecodes::_getstatic:
+      if (!do_getstatic())
+        return false;
+      break;
+    case Bytecodes::_putfield:
+      if (!do_putfield())
+        return false;
+      break;
+
+    case Bytecodes::_iadd:
+    case Bytecodes::_isub:
+    case Bytecodes::_imul:
+    case Bytecodes::_iand:
+    case Bytecodes::_ixor:
+    case Bytecodes::_ishl:
+    case Bytecodes::_ishr:
+    case Bytecodes::_iushr:
+      pop();
+      pop();
+      push(false);
+      break;
+    case Bytecodes::_ior:
+      a = pop();
+      b = pop();
+      push(a && b);
+      break;
+    case Bytecodes::_idiv:
+    case Bytecodes::_irem:
+      if (!pop())
+        return false;
+      pop();
+      push(false);
+      break;
+    case Bytecodes::_ineg:
+      break;
+
+    case Bytecodes::_ladd:
+    case Bytecodes::_lsub:
+    case Bytecodes::_lmul:
+    case Bytecodes::_land:
+    case Bytecodes::_lxor:
+      pop();
+      pop();
+      pop();
+      pop();
+      push(false);
+      push(false);
+      break;
+    case Bytecodes::_lor:
+      a = pop();
+      b = pop();
+      push(a && b);
+      break;
+    case Bytecodes::_ldiv:
+    case Bytecodes::_lrem:
+      pop();
+      if (!pop())
+        return false;
+      pop();
+      pop();
+      push(false);
+      push(false);
+      break;
+    case Bytecodes::_lneg:
+      break;
+    case Bytecodes::_lshl:
+    case Bytecodes::_lshr:
+    case Bytecodes::_lushr:
+      pop();
+      pop();
+      pop();
+      push(false);
+      push(false);
+      break;
+
+    case Bytecodes::_fadd:
+    case Bytecodes::_fsub:
+    case Bytecodes::_fmul:
+    case Bytecodes::_fdiv:
+    case Bytecodes::_frem:
+      pop();
+      pop();
+      push(false);
+      break;
+    case Bytecodes::_fneg:
+      break;
+
+    case Bytecodes::_dadd:
+    case Bytecodes::_dsub:
+    case Bytecodes::_dmul:
+    case Bytecodes::_ddiv:
+    case Bytecodes::_drem:
+      pop();
+      pop();
+      pop();
+      pop();
+      push(false);
+      push(false);
+      break;
+    case Bytecodes::_dneg:
+      break;
+
+    case Bytecodes::_iinc:
+      set_local(iter()->get_index(), false);
+      break;
+
+    case Bytecodes::_lcmp:
+      pop();
+      pop();
+      pop();
+      pop();
+      push(false);
+      break;
+
+    case Bytecodes::_fcmpl:
+    case Bytecodes::_fcmpg:
+      pop();
+      pop();
+      push(false);
+      break;
+
+    case Bytecodes::_dcmpl:
+    case Bytecodes::_dcmpg:
+      pop();
+      pop();
+      pop();
+      pop();
+      push(false);
+      break;
+
+    case Bytecodes::_i2l:
+      push(false);
+      break;
+    case Bytecodes::_i2f:
+      pop();
+      push(false);
+      break;
+    case Bytecodes::_i2d:
+      pop();
+      push(false);
+      push(false);
+      break;
+
+    case Bytecodes::_l2i:
+    case Bytecodes::_l2f:
+      pop();
+      pop();
+      push(false);
+      break;
+    case Bytecodes::_l2d:
+      pop();
+      pop();
+      push(false);
+      push(false);
+      break;
+
+    case Bytecodes::_f2i:
+      pop();
+      push(false);
+      break;
+    case Bytecodes::_f2l:
+    case Bytecodes::_f2d:
+      pop();
+      push(false);
+      push(false);
+      break;
+
+    case Bytecodes::_d2i:
+    case Bytecodes::_d2f:
+      pop();
+      pop();
+      push(false);
+      break;
+    case Bytecodes::_d2l:
+      pop();
+      pop();
+      push(false);
+      push(false);
+      break;
+
+    case Bytecodes::_i2b:
+    case Bytecodes::_i2c:
+    case Bytecodes::_i2s:
+      pop();
+      push(false);
+      break;
+
+    case Bytecodes::_return:
+    case Bytecodes::_ireturn:
+    case Bytecodes::_lreturn:
+    case Bytecodes::_freturn:
+    case Bytecodes::_dreturn:
+    case Bytecodes::_areturn:
+      break;
+
+    default:
+      return false;
+    }
+  }
+
+  return true;
+}
+
+void SharkInlinerHelper::initialize_for_check() {
+  _locals = NEW_RESOURCE_ARRAY(bool, max_locals());
+  _stack = NEW_RESOURCE_ARRAY(bool, max_stack());
+
+  memset(_locals, 0, max_locals() * sizeof(bool));
+  for (int i = 0; i < target()->arg_size(); i++) {
+    SharkValue *arg = entry_state()->stack(target()->arg_size() - 1 - i);
+    if (arg && arg->zero_checked())
+      set_local(i, true);
+  }
+
+  _sp = _stack;
+}
+
+bool SharkInlinerHelper::do_field_access(bool is_get, bool is_field) {
+  assert(is_get || is_field, "can't inline putstatic");
+
+  // If the holder isn't linked then there isn't a lot we can do
+  if (!target()->holder()->is_linked())
+    return false;
+
+  // Get the field
+  bool will_link;
+  ciField *field = iter()->get_field(will_link);
+  if (!will_link)
+    return false;
+
+  // If the field is mismatched then an exception needs throwing
+  if (is_field == field->is_static())
+    return false;
+
+  // Pop the value off the stack if necessary
+  if (!is_get) {
+    pop();
+    if (field->type()->is_two_word())
+      pop();
+  }
+
+  // Pop and null-check the receiver if necessary
+  if (is_field) {
+    if (!pop())
+      return false;
+  }
+
+  // Push the result if necessary
+  if (is_get) {
+    bool result_pushed = false;
+    if (field->is_constant()) {
+      SharkConstant *sc = SharkConstant::for_field(iter());
+      if (sc->is_loaded()) {
+        push(sc->is_nonzero());
+        result_pushed = true;
+      }
+    }
+
+    if (!result_pushed)
+      push(false);
+
+    if (field->type()->is_two_word())
+      push(false);
+  }
+
+  return true;
+}
+
+bool SharkInliner::attempt_inline(ciMethod *target, SharkState *state) {
+  if (SharkIntrinsics::is_intrinsic(target)) {
+    SharkIntrinsics::inline_intrinsic(target, state);
+    return true;
+  }
+
+  if (may_be_inlinable(target)) {
+    SharkInlinerHelper inliner(target, state);
+    if (inliner.is_inlinable()) {
+      inliner.do_inline();
+      return true;
+    }
+  }
+  return false;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkInliner.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+class SharkInliner : public AllStatic {
+ public:
+  static bool attempt_inline(ciMethod* target, SharkState* state);
+
+ private:
+  static bool may_be_inlinable(ciMethod* target);
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkIntrinsics.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,277 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkIntrinsics.cpp.incl"
+
+using namespace llvm;
+
+bool SharkIntrinsics::is_intrinsic(ciMethod *target) {
+  switch (target->intrinsic_id()) {
+  case vmIntrinsics::_none:
+    return false;
+
+    // java.lang.Math
+  case vmIntrinsics::_min:
+  case vmIntrinsics::_max:
+  case vmIntrinsics::_dabs:
+  case vmIntrinsics::_dsin:
+  case vmIntrinsics::_dcos:
+  case vmIntrinsics::_dtan:
+  case vmIntrinsics::_datan2:
+  case vmIntrinsics::_dsqrt:
+  case vmIntrinsics::_dlog:
+  case vmIntrinsics::_dlog10:
+  case vmIntrinsics::_dpow:
+  case vmIntrinsics::_dexp:
+    return true;
+
+    // java.lang.Object
+  case vmIntrinsics::_getClass:
+    return true;
+
+    // java.lang.System
+  case vmIntrinsics::_currentTimeMillis:
+    return true;
+
+    // java.lang.Thread
+  case vmIntrinsics::_currentThread:
+    return true;
+
+    // sun.misc.Unsafe
+  case vmIntrinsics::_compareAndSwapInt:
+    return true;
+
+  default:
+    if (SharkPerformanceWarnings) {
+      warning(
+        "unhandled intrinsic vmIntrinsic::%s",
+        vmIntrinsics::name_at(target->intrinsic_id()));
+    }
+  }
+  return false;
+}
+
+void SharkIntrinsics::inline_intrinsic(ciMethod *target, SharkState *state) {
+  SharkIntrinsics intrinsic(state, target);
+  intrinsic.do_intrinsic();
+}
+
+void SharkIntrinsics::do_intrinsic() {
+  switch (target()->intrinsic_id()) {
+    // java.lang.Math
+  case vmIntrinsics::_min:
+    do_Math_minmax(llvm::ICmpInst::ICMP_SLE);
+    break;
+  case vmIntrinsics::_max:
+    do_Math_minmax(llvm::ICmpInst::ICMP_SGE);
+    break;
+  case vmIntrinsics::_dabs:
+    do_Math_1to1(builder()->fabs());
+    break;
+  case vmIntrinsics::_dsin:
+    do_Math_1to1(builder()->sin());
+    break;
+  case vmIntrinsics::_dcos:
+    do_Math_1to1(builder()->cos());
+    break;
+  case vmIntrinsics::_dtan:
+    do_Math_1to1(builder()->tan());
+    break;
+  case vmIntrinsics::_datan2:
+    do_Math_2to1(builder()->atan2());
+    break;
+  case vmIntrinsics::_dsqrt:
+    do_Math_1to1(builder()->sqrt());
+    break;
+  case vmIntrinsics::_dlog:
+    do_Math_1to1(builder()->log());
+    break;
+  case vmIntrinsics::_dlog10:
+    do_Math_1to1(builder()->log10());
+    break;
+  case vmIntrinsics::_dpow:
+    do_Math_2to1(builder()->pow());
+    break;
+  case vmIntrinsics::_dexp:
+    do_Math_1to1(builder()->exp());
+    break;
+
+    // java.lang.Object
+  case vmIntrinsics::_getClass:
+    do_Object_getClass();
+    break;
+
+    // java.lang.System
+  case vmIntrinsics::_currentTimeMillis:
+    do_System_currentTimeMillis();
+    break;
+
+    // java.lang.Thread
+  case vmIntrinsics::_currentThread:
+    do_Thread_currentThread();
+    break;
+
+    // sun.misc.Unsafe
+  case vmIntrinsics::_compareAndSwapInt:
+    do_Unsafe_compareAndSwapInt();
+    break;
+
+  default:
+    ShouldNotReachHere();
+  }
+}
+
+void SharkIntrinsics::do_Math_minmax(ICmpInst::Predicate p) {
+  // Pop the arguments
+  SharkValue *sb = state()->pop();
+  SharkValue *sa = state()->pop();
+  Value *a = sa->jint_value();
+  Value *b = sb->jint_value();
+
+  // Perform the test
+  BasicBlock *ip       = builder()->GetBlockInsertionPoint();
+  BasicBlock *return_a = builder()->CreateBlock(ip, "return_a");
+  BasicBlock *return_b = builder()->CreateBlock(ip, "return_b");
+  BasicBlock *done     = builder()->CreateBlock(ip, "done");
+
+  builder()->CreateCondBr(builder()->CreateICmp(p, a, b), return_a, return_b);
+
+  builder()->SetInsertPoint(return_a);
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(return_b);
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(done);
+  PHINode *phi = builder()->CreatePHI(a->getType(), "result");
+  phi->addIncoming(a, return_a);
+  phi->addIncoming(b, return_b);
+
+  // Push the result
+  state()->push(
+    SharkValue::create_jint(
+      phi,
+      sa->zero_checked() && sb->zero_checked()));
+}
+
+void SharkIntrinsics::do_Math_1to1(Value *function) {
+  SharkValue *empty = state()->pop();
+  assert(empty == NULL, "should be");
+  state()->push(
+    SharkValue::create_jdouble(
+      builder()->CreateCall(
+        function, state()->pop()->jdouble_value())));
+  state()->push(NULL);
+}
+
+void SharkIntrinsics::do_Math_2to1(Value *function) {
+  SharkValue *empty = state()->pop();
+  assert(empty == NULL, "should be");
+  Value *y = state()->pop()->jdouble_value();
+  empty = state()->pop();
+  assert(empty == NULL, "should be");
+  Value *x = state()->pop()->jdouble_value();
+
+  state()->push(
+    SharkValue::create_jdouble(
+      builder()->CreateCall2(function, x, y)));
+  state()->push(NULL);
+}
+
+void SharkIntrinsics::do_Object_getClass() {
+  Value *klass = builder()->CreateValueOfStructEntry(
+    state()->pop()->jobject_value(),
+    in_ByteSize(oopDesc::klass_offset_in_bytes()),
+    SharkType::oop_type(),
+    "klass");
+
+  Value *klass_part = builder()->CreateAddressOfStructEntry(
+    klass,
+    in_ByteSize(klassOopDesc::klass_part_offset_in_bytes()),
+    SharkType::klass_type(),
+    "klass_part");
+
+  state()->push(
+    SharkValue::create_jobject(
+      builder()->CreateValueOfStructEntry(
+        klass_part,
+        in_ByteSize(Klass::java_mirror_offset_in_bytes()),
+        SharkType::oop_type(),
+        "java_mirror"),
+      true));
+}
+
+void SharkIntrinsics::do_System_currentTimeMillis() {
+  state()->push(
+    SharkValue::create_jlong(
+      builder()->CreateCall(builder()->current_time_millis()),
+      false));
+  state()->push(NULL);
+}
+
+void SharkIntrinsics::do_Thread_currentThread() {
+  state()->push(
+    SharkValue::create_jobject(
+      builder()->CreateValueOfStructEntry(
+        thread(), JavaThread::threadObj_offset(),
+        SharkType::oop_type(),
+        "threadObj"),
+      true));
+}
+
+void SharkIntrinsics::do_Unsafe_compareAndSwapInt() {
+  // Pop the arguments
+  Value *x      = state()->pop()->jint_value();
+  Value *e      = state()->pop()->jint_value();
+  SharkValue *empty = state()->pop();
+  assert(empty == NULL, "should be");
+  Value *offset = state()->pop()->jlong_value();
+  Value *object = state()->pop()->jobject_value();
+  Value *unsafe = state()->pop()->jobject_value();
+
+  // Convert the offset
+  offset = builder()->CreateCall(
+    builder()->unsafe_field_offset_to_byte_offset(),
+    offset);
+
+  // Locate the field
+  Value *addr = builder()->CreateIntToPtr(
+    builder()->CreateAdd(
+      builder()->CreatePtrToInt(object, SharkType::intptr_type()),
+      builder()->CreateIntCast(offset, SharkType::intptr_type(), true)),
+    PointerType::getUnqual(SharkType::jint_type()),
+    "addr");
+
+  // Perform the operation
+  Value *result = builder()->CreateCmpxchgInt(x, addr, e);
+
+  // Push the result
+  state()->push(
+    SharkValue::create_jint(
+      builder()->CreateIntCast(
+        builder()->CreateICmpEQ(result, e), SharkType::jint_type(), true),
+      false));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkIntrinsics.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+class SharkIntrinsics : public SharkTargetInvariants {
+ public:
+  static bool is_intrinsic(ciMethod* target);
+  static void inline_intrinsic(ciMethod* target, SharkState* state);
+
+ private:
+  SharkIntrinsics(SharkState* state, ciMethod* target)
+    : SharkTargetInvariants(state, target), _state(state) {}
+
+ private:
+  SharkState* _state;
+
+ private:
+  SharkState* state() const {
+    return _state;
+  }
+
+ private:
+  void do_intrinsic();
+
+ private:
+  void do_Math_minmax(llvm::ICmpInst::Predicate p);
+  void do_Math_1to1(llvm::Value* function);
+  void do_Math_2to1(llvm::Value* function);
+  void do_Object_getClass();
+  void do_System_currentTimeMillis();
+  void do_Thread_currentThread();
+  void do_Unsafe_compareAndSwapInt();
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkInvariants.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkInvariants.cpp.incl"
+
+int SharkTargetInvariants::count_monitors() {
+  int result = 0;
+  if (is_synchronized() || target()->has_monitor_bytecodes()) {
+    for (int i = 0; i < flow()->block_count(); i++) {
+      result = MAX2(result, flow()->pre_order_at(i)->monitor_count());
+    }
+  }
+  return result;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkInvariants.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+// Base classes used to track various values through the compilation.
+// SharkCompileInvariants is used to track values which remain the
+// same for the top-level method and any inlined methods it may have
+// (ie for the whole compilation).  SharkTargetInvariants is used to
+// track values which differ between methods.
+
+class SharkCompileInvariants : public ResourceObj {
+ protected:
+  SharkCompileInvariants(ciEnv* env, SharkBuilder* builder)
+    : _env(env),
+      _builder(builder),
+      _thread(NULL) {}
+
+  SharkCompileInvariants(const SharkCompileInvariants* parent)
+    : _env(parent->_env),
+      _builder(parent->_builder),
+      _thread(parent->_thread) {}
+
+ private:
+  ciEnv*        _env;
+  SharkBuilder* _builder;
+  llvm::Value*  _thread;
+
+  // Top-level broker for HotSpot's Compiler Interface.
+  //
+  // Its main purpose is to allow the various CI classes to access
+  // oops in the VM without having to worry about safepointing.  In
+  // addition to this it acts as a holder for various recorders and
+  // memory allocators.
+  //
+  // Accessing this directly is kind of ugly, so it's private.  Add
+  // new accessors below if you need something from it.
+ private:
+  ciEnv* env() const {
+    assert(_env != NULL, "env not available");
+    return _env;
+  }
+
+  // The SharkBuilder that is used to build LLVM IR.
+ protected:
+  SharkBuilder* builder() const {
+    return _builder;
+  }
+
+  // Pointer to this thread's JavaThread object.  This is not
+  // available until a short way into SharkFunction creation
+  // so a setter is required.  Assertions are used to enforce
+  // invariance.
+ protected:
+  llvm::Value* thread() const {
+    assert(_thread != NULL, "thread not available");
+    return _thread;
+  }
+  void set_thread(llvm::Value* thread) {
+    assert(_thread == NULL, "thread already set");
+    _thread = thread;
+  }
+
+  // Objects that handle various aspects of the compilation.
+ protected:
+  DebugInformationRecorder* debug_info() const {
+    return env()->debug_info();
+  }
+  Dependencies* dependencies() const {
+    return env()->dependencies();
+  }
+  SharkCodeBuffer* code_buffer() const {
+    return builder()->code_buffer();
+  }
+
+  // Commonly used classes
+ protected:
+  ciInstanceKlass* java_lang_Object_klass() const {
+    return env()->Object_klass();
+  }
+  ciInstanceKlass* java_lang_Throwable_klass() const {
+    return env()->Throwable_klass();
+  }
+};
+
+class SharkTargetInvariants : public SharkCompileInvariants {
+ protected:
+  SharkTargetInvariants(ciEnv* env, SharkBuilder* builder, ciTypeFlow* flow)
+    : SharkCompileInvariants(env, builder),
+      _target(flow->method()),
+      _flow(flow),
+      _max_monitors(count_monitors()) {}
+
+  SharkTargetInvariants(const SharkCompileInvariants* parent, ciMethod* target)
+    : SharkCompileInvariants(parent),
+      _target(target),
+      _flow(NULL),
+      _max_monitors(count_monitors()) {}
+
+  SharkTargetInvariants(const SharkTargetInvariants* parent)
+    : SharkCompileInvariants(parent),
+      _target(parent->_target),
+      _flow(parent->_flow),
+      _max_monitors(parent->_max_monitors) {}
+
+ private:
+  int count_monitors();
+
+ private:
+  ciMethod*   _target;
+  ciTypeFlow* _flow;
+  int         _max_monitors;
+
+  // The method being compiled.
+ protected:
+  ciMethod* target() const {
+    return _target;
+  }
+
+  // Typeflow analysis of the method being compiled.
+ protected:
+  ciTypeFlow* flow() const {
+    assert(_flow != NULL, "typeflow not available");
+    return _flow;
+  }
+
+  // Properties of the method.
+ protected:
+  int max_locals() const {
+    return target()->max_locals();
+  }
+  int max_stack() const {
+    return target()->max_stack();
+  }
+  int max_monitors() const {
+    return _max_monitors;
+  }
+  int arg_size() const {
+    return target()->arg_size();
+  }
+  bool is_static() const {
+    return target()->is_static();
+  }
+  bool is_synchronized() const {
+    return target()->is_synchronized();
+  }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkMemoryManager.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkMemoryManager.cpp.incl"
+
+using namespace llvm;
+
+void SharkMemoryManager::AllocateGOT() {
+  mm()->AllocateGOT();
+}
+
+unsigned char* SharkMemoryManager::getGOTBase() const {
+  return mm()->getGOTBase();
+}
+
+unsigned char* SharkMemoryManager::allocateStub(const GlobalValue* F,
+                                                unsigned StubSize,
+                                                unsigned Alignment) {
+  return mm()->allocateStub(F, StubSize, Alignment);
+}
+
+unsigned char* SharkMemoryManager::startFunctionBody(const Function* F,
+                                                     uintptr_t& ActualSize) {
+  return mm()->startFunctionBody(F, ActualSize);
+}
+
+void SharkMemoryManager::endFunctionBody(const Function* F,
+                                         unsigned char* FunctionStart,
+                                         unsigned char* FunctionEnd) {
+  mm()->endFunctionBody(F, FunctionStart, FunctionEnd);
+
+  SharkEntry *entry = get_entry_for_function(F);
+  if (entry != NULL)
+    entry->set_code_limit(FunctionEnd);
+}
+
+unsigned char* SharkMemoryManager::startExceptionTable(const Function* F,
+                                                       uintptr_t& ActualSize) {
+  return mm()->startExceptionTable(F, ActualSize);
+}
+
+void SharkMemoryManager::endExceptionTable(const Function* F,
+                                           unsigned char* TableStart,
+                                           unsigned char* TableEnd,
+                                           unsigned char* FrameRegister) {
+  mm()->endExceptionTable(F, TableStart, TableEnd, FrameRegister);
+}
+
+void SharkMemoryManager::setMemoryWritable() {
+  mm()->setMemoryWritable();
+}
+
+void SharkMemoryManager::setMemoryExecutable() {
+  mm()->setMemoryExecutable();
+}
+
+#if SHARK_LLVM_VERSION >= 27
+void SharkMemoryManager::deallocateExceptionTable(void *ptr) {
+  mm()->deallocateExceptionTable(ptr);
+}
+
+void SharkMemoryManager::deallocateFunctionBody(void *ptr) {
+  mm()->deallocateFunctionBody(ptr);
+}
+#else
+void SharkMemoryManager::deallocateMemForFunction(const Function* F) {
+  return mm()->deallocateMemForFunction(F);
+}
+#endif
+
+uint8_t* SharkMemoryManager::allocateGlobal(uintptr_t Size,
+                                            unsigned int Alignment) {
+  return mm()->allocateGlobal(Size, Alignment);
+}
+
+#if SHARK_LLVM_VERSION < 27
+void* SharkMemoryManager::getDlsymTable() const {
+  return mm()->getDlsymTable();
+}
+
+void SharkMemoryManager::SetDlsymTable(void *ptr) {
+  mm()->SetDlsymTable(ptr);
+}
+#endif
+
+void SharkMemoryManager::setPoisonMemory(bool poison) {
+  mm()->setPoisonMemory(poison);
+}
+
+unsigned char *SharkMemoryManager::allocateSpace(intptr_t Size,
+                                                 unsigned int Alignment) {
+  return mm()->allocateSpace(Size, Alignment);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkMemoryManager.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+// SharkMemoryManager wraps the LLVM JIT Memory Manager.  We could use
+// this to run our own memory allocation policies, but for now all we
+// use it for is figuring out where the resulting native code ended up.
+
+class SharkMemoryManager : public llvm::JITMemoryManager {
+ public:
+  SharkMemoryManager()
+    : _mm(llvm::JITMemoryManager::CreateDefaultMemManager()) {}
+
+ private:
+  llvm::JITMemoryManager* _mm;
+
+ private:
+  llvm::JITMemoryManager* mm() const {
+    return _mm;
+  }
+
+ private:
+  std::map<const llvm::Function*, SharkEntry*> _entry_map;
+
+ public:
+  void set_entry_for_function(const llvm::Function* function,
+                              SharkEntry*           entry) {
+    _entry_map[function] = entry;
+  }
+  SharkEntry* get_entry_for_function(const llvm::Function* function) {
+    return _entry_map[function];
+  }
+
+ public:
+  void AllocateGOT();
+  unsigned char* getGOTBase() const;
+  unsigned char* allocateStub(const llvm::GlobalValue* F,
+                              unsigned StubSize,
+                              unsigned Alignment);
+  unsigned char* startFunctionBody(const llvm::Function* F,
+                                   uintptr_t& ActualSize);
+  void endFunctionBody(const llvm::Function* F,
+                       unsigned char* FunctionStart,
+                       unsigned char* FunctionEnd);
+  unsigned char* startExceptionTable(const llvm::Function* F,
+                                     uintptr_t& ActualSize);
+  void endExceptionTable(const llvm::Function* F,
+                         unsigned char* TableStart,
+                         unsigned char* TableEnd,
+                         unsigned char* FrameRegister);
+#if SHARK_LLVM_VERSION < 27
+  void* getDlsymTable() const;
+  void SetDlsymTable(void *ptr);
+#endif
+  void setPoisonMemory(bool);
+  uint8_t* allocateGlobal(uintptr_t, unsigned int);
+  void setMemoryWritable();
+  void setMemoryExecutable();
+#if SHARK_LLVM_VERSION >= 27
+  void deallocateExceptionTable(void *ptr);
+  void deallocateFunctionBody(void *ptr);
+#else
+  void deallocateMemForFunction(const llvm::Function* F);
+#endif
+  unsigned char *allocateSpace(intptr_t Size,
+                               unsigned int Alignment);
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,352 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkNativeWrapper.cpp.incl"
+
+using namespace llvm;
+
+void SharkNativeWrapper::initialize(const char *name) {
+  // Create the function
+  _function = Function::Create(
+    SharkType::entry_point_type(),
+    GlobalVariable::InternalLinkage,
+    name);
+
+  // Get our arguments
+  Function::arg_iterator ai = function()->arg_begin();
+  Argument *method = ai++;
+  method->setName("method");
+  Argument *base_pc = ai++;
+  base_pc->setName("base_pc");
+  code_buffer()->set_base_pc(base_pc);
+  Argument *thread = ai++;
+  thread->setName("thread");
+  set_thread(thread);
+
+  // Create and push our stack frame
+  builder()->SetInsertPoint(CreateBlock());
+  _stack = SharkStack::CreateBuildAndPushFrame(this, method);
+  NOT_PRODUCT(method = NULL);
+
+  // Create the oopmap.  We use the one oopmap for every call site in
+  // the wrapper, which results in the odd mild inefficiency but is a
+  // damn sight easier to code.
+  OopMap *oopmap = new OopMap(
+    SharkStack::oopmap_slot_munge(stack()->oopmap_frame_size()),
+    SharkStack::oopmap_slot_munge(arg_size()));
+  oopmap->set_oop(SharkStack::slot2reg(stack()->method_slot_offset()));
+
+  // Set up the oop_tmp slot if required:
+  //  - For static methods we use it to handlize the class argument
+  //    for the call, and to protect the same during slow path locks
+  //    (if synchronized).
+  //  - For methods returning oops, we use it to protect the return
+  //    value across safepoints or slow path unlocking.
+  if (is_static() || is_returning_oop()) {
+    _oop_tmp_slot = stack()->slot_addr(
+      stack()->oop_tmp_slot_offset(),
+      SharkType::oop_type(),
+      "oop_tmp_slot");
+
+    oopmap->set_oop(SharkStack::slot2reg(stack()->oop_tmp_slot_offset()));
+  }
+
+  // Set up the monitor slot, for synchronized methods
+  if (is_synchronized()) {
+    Unimplemented();
+    _lock_slot_offset = 23;
+  }
+
+  // Start building the argument list
+  std::vector<const Type*> param_types;
+  std::vector<Value*> param_values;
+  const PointerType *box_type = PointerType::getUnqual(SharkType::oop_type());
+
+  // First argument is the JNIEnv
+  param_types.push_back(SharkType::jniEnv_type());
+  param_values.push_back(
+    builder()->CreateAddressOfStructEntry(
+      thread,
+      JavaThread::jni_environment_offset(),
+      SharkType::jniEnv_type(),
+      "jni_environment"));
+
+  // For static methods, the second argument is the class
+  if (is_static()) {
+    builder()->CreateStore(
+      builder()->CreateInlineOop(
+        JNIHandles::make_local(
+          target()->method_holder()->klass_part()->java_mirror())),
+      oop_tmp_slot());
+
+    param_types.push_back(box_type);
+    param_values.push_back(oop_tmp_slot());
+
+    _receiver_slot_offset = stack()->oop_tmp_slot_offset();
+  }
+  else if (is_returning_oop()) {
+    // The oop_tmp slot is registered in the oopmap,
+    // so we need to clear it.  This is one of the
+    // mild inefficiencies I mentioned earlier.
+    builder()->CreateStore(LLVMValue::null(), oop_tmp_slot());
+  }
+
+  // Parse the arguments
+  for (int i = 0; i < arg_size(); i++) {
+    int slot_offset = stack()->locals_slots_offset() + arg_size() - 1 - i;
+    int adjusted_offset = slot_offset;
+    BasicBlock *null, *not_null, *merge;
+    Value *box;
+    PHINode *phi;
+
+    switch (arg_type(i)) {
+    case T_VOID:
+      break;
+
+    case T_OBJECT:
+    case T_ARRAY:
+      null     = CreateBlock("null");
+      not_null = CreateBlock("not_null");
+      merge    = CreateBlock("merge");
+
+      box = stack()->slot_addr(slot_offset, SharkType::oop_type());
+      builder()->CreateCondBr(
+        builder()->CreateICmp(
+          ICmpInst::ICMP_EQ,
+          builder()->CreateLoad(box),
+          LLVMValue::null()),
+        null, not_null);
+
+      builder()->SetInsertPoint(null);
+      builder()->CreateBr(merge);
+
+      builder()->SetInsertPoint(not_null);
+      builder()->CreateBr(merge);
+
+      builder()->SetInsertPoint(merge);
+      phi = builder()->CreatePHI(box_type, "boxed_object");
+      phi->addIncoming(ConstantPointerNull::get(box_type), null);
+      phi->addIncoming(box, not_null);
+      box = phi;
+
+      param_types.push_back(box_type);
+      param_values.push_back(box);
+
+      oopmap->set_oop(SharkStack::slot2reg(slot_offset));
+
+      if (i == 0 && !is_static())
+        _receiver_slot_offset = slot_offset;
+
+      break;
+
+    case T_LONG:
+    case T_DOUBLE:
+      adjusted_offset--;
+      // fall through
+
+    default:
+      const Type *param_type = SharkType::to_stackType(arg_type(i));
+
+      param_types.push_back(param_type);
+      param_values.push_back(
+        builder()->CreateLoad(stack()->slot_addr(adjusted_offset, param_type)));
+    }
+  }
+
+  // The oopmap is now complete, and everything is written
+  // into the frame except the PC.
+  int pc_offset = code_buffer()->create_unique_offset();
+
+  _oop_maps = new OopMapSet();
+  oop_maps()->add_gc_map(pc_offset, oopmap);
+
+  builder()->CreateStore(
+    builder()->code_buffer_address(pc_offset),
+    stack()->slot_addr(stack()->pc_slot_offset()));
+
+  // Set up the Java frame anchor
+  stack()->CreateSetLastJavaFrame();
+
+  // Lock if necessary
+  if (is_synchronized())
+    Unimplemented();
+
+  // Change the thread state to _thread_in_native
+  CreateSetThreadState(_thread_in_native);
+
+  // Make the call
+  BasicType result_type = target()->result_type();
+  const Type* return_type;
+  if (result_type == T_VOID)
+    return_type = SharkType::void_type();
+  else if (is_returning_oop())
+    return_type = box_type;
+  else
+    return_type = SharkType::to_arrayType(result_type);
+  Value* native_function = builder()->CreateIntToPtr(
+     LLVMValue::intptr_constant((intptr_t) target()->native_function()),
+     PointerType::getUnqual(
+       FunctionType::get(return_type, param_types, false)));
+  Value *result = builder()->CreateCall(
+    native_function, param_values.begin(), param_values.end());
+
+  // Start the transition back to _thread_in_Java
+  CreateSetThreadState(_thread_in_native_trans);
+
+  // Make sure new state is visible in the GC thread
+  if (os::is_MP()) {
+    if (UseMembar)
+      builder()->CreateMemoryBarrier(SharkBuilder::BARRIER_STORELOAD);
+    else
+      CreateWriteMemorySerializePage();
+  }
+
+  // Handle safepoint operations, pending suspend requests,
+  // and pending asynchronous exceptions.
+  BasicBlock *check_thread = CreateBlock("check_thread");
+  BasicBlock *do_safepoint = CreateBlock("do_safepoint");
+  BasicBlock *safepointed  = CreateBlock("safepointed");
+
+  Value *global_state = builder()->CreateLoad(
+    builder()->CreateIntToPtr(
+      LLVMValue::intptr_constant(
+        (intptr_t) SafepointSynchronize::address_of_state()),
+      PointerType::getUnqual(SharkType::jint_type())),
+    "global_state");
+
+  builder()->CreateCondBr(
+    builder()->CreateICmpNE(
+      global_state,
+      LLVMValue::jint_constant(SafepointSynchronize::_not_synchronized)),
+    do_safepoint, check_thread);
+
+  builder()->SetInsertPoint(check_thread);
+  Value *thread_state = builder()->CreateValueOfStructEntry(
+    thread,
+    JavaThread::suspend_flags_offset(),
+    SharkType::jint_type(),
+    "thread_state");
+
+  builder()->CreateCondBr(
+    builder()->CreateICmpNE(
+      thread_state,
+      LLVMValue::jint_constant(0)),
+    do_safepoint, safepointed);
+
+  builder()->SetInsertPoint(do_safepoint);
+  builder()->CreateCall(
+    builder()->check_special_condition_for_native_trans(), thread);
+  builder()->CreateBr(safepointed);
+
+  // Finally we can change the thread state to _thread_in_Java
+  builder()->SetInsertPoint(safepointed);
+  CreateSetThreadState(_thread_in_Java);
+
+  // Clear the frame anchor
+  stack()->CreateResetLastJavaFrame();
+
+  // If there is a pending exception then we can just unwind and
+  // return.  It seems totally wrong that unlocking is skipped here
+  // but apparently the template interpreter does this so we do too.
+  BasicBlock *exception    = CreateBlock("exception");
+  BasicBlock *no_exception = CreateBlock("no_exception");
+
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(
+      CreateLoadPendingException(),
+      LLVMValue::null()),
+    no_exception, exception);
+
+  builder()->SetInsertPoint(exception);
+  CreateResetHandleBlock();
+  stack()->CreatePopFrame(0);
+  builder()->CreateRet(LLVMValue::jint_constant(0));
+
+  builder()->SetInsertPoint(no_exception);
+
+  // If the result was an oop then unbox it before
+  // releasing the handle it might be protected by
+  if (is_returning_oop()) {
+    BasicBlock *null     = builder()->GetInsertBlock();
+    BasicBlock *not_null = CreateBlock("not_null");
+    BasicBlock *merge    = CreateBlock("merge");
+
+    builder()->CreateCondBr(
+      builder()->CreateICmpNE(result, ConstantPointerNull::get(box_type)),
+      not_null, merge);
+
+    builder()->SetInsertPoint(not_null);
+    Value *unboxed_result = builder()->CreateLoad(result);
+    builder()->CreateBr(merge);
+
+    builder()->SetInsertPoint(merge);
+    PHINode *phi = builder()->CreatePHI(SharkType::oop_type(), "result");
+    phi->addIncoming(LLVMValue::null(), null);
+    phi->addIncoming(unboxed_result, not_null);
+    result = phi;
+  }
+
+  // Reset handle block
+  CreateResetHandleBlock();
+
+  // Unlock if necessary.
+  if (is_synchronized())
+    Unimplemented();
+
+  // Unwind and return
+  Value *result_addr = stack()->CreatePopFrame(type2size[result_type]);
+  if (result_type != T_VOID) {
+    bool needs_cast = false;
+    bool is_signed = false;
+    switch (result_type) {
+    case T_BOOLEAN:
+      result = builder()->CreateICmpNE(result, LLVMValue::jbyte_constant(0));
+      needs_cast = true;
+      break;
+
+    case T_CHAR:
+      needs_cast = true;
+      break;
+
+    case T_BYTE:
+    case T_SHORT:
+      needs_cast = true;
+      is_signed = true;
+      break;
+    }
+    if (needs_cast) {
+      result = builder()->CreateIntCast(
+        result, SharkType::to_stackType(result_type), is_signed);
+    }
+
+    builder()->CreateStore(
+      result,
+      builder()->CreateIntToPtr(
+        result_addr,
+        PointerType::getUnqual(SharkType::to_stackType(result_type))));
+  }
+  builder()->CreateRet(LLVMValue::jint_constant(0));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkNativeWrapper.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+class SharkNativeWrapper : public SharkCompileInvariants {
+  friend class SharkStackWithNativeFrame;
+
+ public:
+  static SharkNativeWrapper* build(SharkBuilder* builder,
+                                   methodHandle  target,
+                                   const char*   name,
+                                   BasicType*    arg_types,
+                                   BasicType     return_type) {
+    return new SharkNativeWrapper(builder,
+                                  target,
+                                  name,
+                                  arg_types,
+                                  return_type);
+  }
+
+ private:
+  SharkNativeWrapper(SharkBuilder* builder,
+                     methodHandle  target,
+                     const char*   name,
+                     BasicType*    arg_types,
+                     BasicType     return_type)
+    : SharkCompileInvariants(NULL, builder),
+      _target(target),
+      _arg_types(arg_types),
+      _return_type(return_type),
+      _lock_slot_offset(0) { initialize(name); }
+
+ private:
+  void initialize(const char* name);
+
+ private:
+  methodHandle    _target;
+  BasicType*      _arg_types;
+  BasicType       _return_type;
+  llvm::Function* _function;
+  SharkStack*     _stack;
+  llvm::Value*    _oop_tmp_slot;
+  OopMapSet*      _oop_maps;
+  int             _receiver_slot_offset;
+  int             _lock_slot_offset;
+
+  // The method being compiled.
+ protected:
+  methodHandle target() const {
+    return _target;
+  }
+
+  // Properties of the method.
+ protected:
+  int arg_size() const {
+    return target()->size_of_parameters();
+  }
+  BasicType arg_type(int i) const {
+    return _arg_types[i];
+  }
+  BasicType return_type() const {
+    return _return_type;
+  }
+  bool is_static() const {
+    return target()->is_static();
+  }
+  bool is_synchronized() const {
+    return target()->is_synchronized();
+  }
+  bool is_returning_oop() const {
+    return target()->is_returning_oop();
+  }
+
+  // The LLVM function we are building.
+ public:
+  llvm::Function* function() const {
+    return _function;
+  }
+
+  // The Zero stack and our frame on it.
+ protected:
+  SharkStack* stack() const {
+    return _stack;
+  }
+
+  // Temporary oop storage.
+ protected:
+  llvm::Value* oop_tmp_slot() const {
+    assert(is_static() || is_returning_oop(), "should be");
+    return _oop_tmp_slot;
+  }
+
+  // Information required by nmethod::new_native_nmethod().
+ public:
+  int frame_size() const {
+    return stack()->oopmap_frame_size();
+  }
+  ByteSize receiver_offset() const {
+    return in_ByteSize(_receiver_slot_offset * wordSize);
+  }
+  ByteSize lock_offset() const {
+    return in_ByteSize(_lock_slot_offset * wordSize);
+  }
+  OopMapSet* oop_maps() const {
+    return _oop_maps;
+  }
+
+  // Helpers.
+ private:
+  llvm::BasicBlock* CreateBlock(const char* name = "") const {
+    return llvm::BasicBlock::Create(SharkContext::current(), name, function());
+  }
+  llvm::Value* thread_state_address() const {
+    return builder()->CreateAddressOfStructEntry(
+      thread(), JavaThread::thread_state_offset(),
+      llvm::PointerType::getUnqual(SharkType::jint_type()),
+      "thread_state_address");
+  }
+  llvm::Value* pending_exception_address() const {
+    return builder()->CreateAddressOfStructEntry(
+      thread(), Thread::pending_exception_offset(),
+      llvm::PointerType::getUnqual(SharkType::oop_type()),
+      "pending_exception_address");
+  }
+  void CreateSetThreadState(JavaThreadState state) const {
+    builder()->CreateStore(
+      LLVMValue::jint_constant(state), thread_state_address());
+  }
+  void CreateWriteMemorySerializePage() const {
+    builder()->CreateStore(
+      LLVMValue::jint_constant(1),
+      builder()->CreateIntToPtr(
+        builder()->CreateAdd(
+          LLVMValue::intptr_constant(
+            (intptr_t) os::get_memory_serialize_page()),
+          builder()->CreateAnd(
+            builder()->CreateLShr(
+              builder()->CreatePtrToInt(thread(), SharkType::intptr_type()),
+              LLVMValue::intptr_constant(os::get_serialize_page_shift_count())),
+            LLVMValue::intptr_constant(os::get_serialize_page_mask()))),
+        llvm::PointerType::getUnqual(SharkType::jint_type())));
+  }
+  void CreateResetHandleBlock() const {
+    llvm::Value *active_handles = builder()->CreateValueOfStructEntry(
+      thread(),
+      JavaThread::active_handles_offset(),
+      SharkType::jniHandleBlock_type(),
+      "active_handles");
+    builder()->CreateStore(
+      LLVMValue::intptr_constant(0),
+      builder()->CreateAddressOfStructEntry(
+        active_handles,
+        in_ByteSize(JNIHandleBlock::top_offset_in_bytes()),
+        llvm::PointerType::getUnqual(SharkType::intptr_type()),
+        "top"));
+  }
+  llvm::LoadInst* CreateLoadPendingException() const {
+    return builder()->CreateLoad(
+      pending_exception_address(), "pending_exception");
+  }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkRuntime.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkRuntime.cpp.incl"
+
+using namespace llvm;
+
+JRT_ENTRY(int, SharkRuntime::find_exception_handler(JavaThread* thread,
+                                                    int*        indexes,
+                                                    int         num_indexes))
+  constantPoolHandle pool(thread, method(thread)->constants());
+  KlassHandle exc_klass(thread, ((oop) tos_at(thread, 0))->klass());
+
+  for (int i = 0; i < num_indexes; i++) {
+    klassOop tmp = pool->klass_at(indexes[i], CHECK_0);
+    KlassHandle chk_klass(thread, tmp);
+
+    if (exc_klass() == chk_klass())
+      return i;
+
+    if (exc_klass()->klass_part()->is_subtype_of(chk_klass()))
+      return i;
+  }
+
+  return -1;
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::monitorenter(JavaThread*      thread,
+                                           BasicObjectLock* lock))
+  if (PrintBiasedLockingStatistics)
+    Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
+
+  Handle object(thread, lock->obj());
+  assert(Universe::heap()->is_in_reserved_or_null(object()), "should be");
+  if (UseBiasedLocking) {
+    // Retry fast entry if bias is revoked to avoid unnecessary inflation
+    ObjectSynchronizer::fast_enter(object, lock->lock(), true, CHECK);
+  } else {
+    ObjectSynchronizer::slow_enter(object, lock->lock(), CHECK);
+  }
+  assert(Universe::heap()->is_in_reserved_or_null(lock->obj()), "should be");
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::monitorexit(JavaThread*      thread,
+                                          BasicObjectLock* lock))
+  Handle object(thread, lock->obj());
+  assert(Universe::heap()->is_in_reserved_or_null(object()), "should be");
+  if (lock == NULL || object()->is_unlocked()) {
+    THROW(vmSymbols::java_lang_IllegalMonitorStateException());
+  }
+  ObjectSynchronizer::slow_exit(object(), lock->lock(), thread);
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::new_instance(JavaThread* thread, int index))
+  klassOop k_oop = method(thread)->constants()->klass_at(index, CHECK);
+  instanceKlassHandle klass(THREAD, k_oop);
+
+  // Make sure we are not instantiating an abstract klass
+  klass->check_valid_for_instantiation(true, CHECK);
+
+  // Make sure klass is initialized
+  klass->initialize(CHECK);
+
+  // At this point the class may not be fully initialized
+  // because of recursive initialization. If it is fully
+  // initialized & has_finalized is not set, we rewrite
+  // it into its fast version (Note: no locking is needed
+  // here since this is an atomic byte write and can be
+  // done more than once).
+  //
+  // Note: In case of classes with has_finalized we don't
+  //       rewrite since that saves us an extra check in
+  //       the fast version which then would call the
+  //       slow version anyway (and do a call back into
+  //       Java).
+  //       If we have a breakpoint, then we don't rewrite
+  //       because the _breakpoint bytecode would be lost.
+  oop obj = klass->allocate_instance(CHECK);
+  thread->set_vm_result(obj);
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::newarray(JavaThread* thread,
+                                       BasicType   type,
+                                       int         size))
+  oop obj = oopFactory::new_typeArray(type, size, CHECK);
+  thread->set_vm_result(obj);
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::anewarray(JavaThread* thread,
+                                        int         index,
+                                        int         size))
+  klassOop klass = method(thread)->constants()->klass_at(index, CHECK);
+  objArrayOop obj = oopFactory::new_objArray(klass, size, CHECK);
+  thread->set_vm_result(obj);
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::multianewarray(JavaThread* thread,
+                                             int         index,
+                                             int         ndims,
+                                             int*        dims))
+  klassOop klass = method(thread)->constants()->klass_at(index, CHECK);
+  oop obj = arrayKlass::cast(klass)->multi_allocate(ndims, dims, CHECK);
+  thread->set_vm_result(obj);
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::register_finalizer(JavaThread* thread,
+                                                 oop         object))
+  assert(object->is_oop(), "should be");
+  assert(object->klass()->klass_part()->has_finalizer(), "should have");
+  instanceKlass::register_finalizer(instanceOop(object), CHECK);
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::throw_ArithmeticException(JavaThread* thread,
+                                                        const char* file,
+                                                        int         line))
+  Exceptions::_throw_msg(
+    thread, file, line,
+    vmSymbols::java_lang_ArithmeticException(),
+    "");
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::throw_ArrayIndexOutOfBoundsException(
+                                                     JavaThread* thread,
+                                                     const char* file,
+                                                     int         line,
+                                                     int         index))
+  char msg[jintAsStringSize];
+  snprintf(msg, sizeof(msg), "%d", index);
+  Exceptions::_throw_msg(
+    thread, file, line,
+    vmSymbols::java_lang_ArrayIndexOutOfBoundsException(),
+    msg);
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::throw_ClassCastException(JavaThread* thread,
+                                                       const char* file,
+                                                       int         line))
+  Exceptions::_throw_msg(
+    thread, file, line,
+    vmSymbols::java_lang_ClassCastException(),
+    "");
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::throw_NullPointerException(JavaThread* thread,
+                                                         const char* file,
+                                                         int         line))
+  Exceptions::_throw_msg(
+    thread, file, line,
+    vmSymbols::java_lang_NullPointerException(),
+    "");
+JRT_END
+
+// Non-VM calls
+// Nothing in these must ever GC!
+
+void SharkRuntime::dump(const char *name, intptr_t value) {
+  oop valueOop = (oop) value;
+  tty->print("%s = ", name);
+  if (valueOop->is_oop(true))
+    valueOop->print_on(tty);
+  else if (value >= ' ' && value <= '~')
+    tty->print("'%c' (%d)", value, value);
+  else
+    tty->print("%p", value);
+  tty->print_cr("");
+}
+
+bool SharkRuntime::is_subtype_of(klassOop check_klass, klassOop object_klass) {
+  return object_klass->klass_part()->is_subtype_of(check_klass);
+}
+
+int SharkRuntime::uncommon_trap(JavaThread* thread, int trap_request) {
+  Thread *THREAD = thread;
+
+  // In C2, uncommon_trap_blob creates a frame, so all the various
+  // deoptimization functions expect to find the frame of the method
+  // being deopted one frame down on the stack.  We create a dummy
+  // frame to mirror this.
+  FakeStubFrame *stubframe = FakeStubFrame::build(CHECK_0);
+  thread->push_zero_frame(stubframe);
+
+  // Initiate the trap
+  thread->set_last_Java_frame();
+  Deoptimization::UnrollBlock *urb =
+    Deoptimization::uncommon_trap(thread, trap_request);
+  thread->reset_last_Java_frame();
+
+  // Pop our dummy frame and the frame being deoptimized
+  thread->pop_zero_frame();
+  thread->pop_zero_frame();
+
+  // Push skeleton frames
+  int number_of_frames = urb->number_of_frames();
+  for (int i = 0; i < number_of_frames; i++) {
+    intptr_t size = urb->frame_sizes()[i];
+    InterpreterFrame *frame = InterpreterFrame::build(size, CHECK_0);
+    thread->push_zero_frame(frame);
+  }
+
+  // Push another dummy frame
+  stubframe = FakeStubFrame::build(CHECK_0);
+  thread->push_zero_frame(stubframe);
+
+  // Fill in the skeleton frames
+  thread->set_last_Java_frame();
+  Deoptimization::unpack_frames(thread, Deoptimization::Unpack_uncommon_trap);
+  thread->reset_last_Java_frame();
+
+  // Pop our dummy frame
+  thread->pop_zero_frame();
+
+  // Fall back into the interpreter
+  return number_of_frames;
+}
+
+FakeStubFrame* FakeStubFrame::build(TRAPS) {
+  ZeroStack *stack = ((JavaThread *) THREAD)->zero_stack();
+  stack->overflow_check(header_words, CHECK_NULL);
+
+  stack->push(0); // next_frame, filled in later
+  intptr_t *fp = stack->sp();
+  assert(fp - stack->sp() == next_frame_off, "should be");
+
+  stack->push(FAKE_STUB_FRAME);
+  assert(fp - stack->sp() == frame_type_off, "should be");
+
+  return (FakeStubFrame *) fp;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkRuntime.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+class SharkRuntime : public AllStatic {
+  // VM calls
+ public:
+  static int find_exception_handler(JavaThread* thread,
+                                    int*        indexes,
+                                    int         num_indexes);
+
+  static void monitorenter(JavaThread* thread, BasicObjectLock* lock);
+  static void monitorexit(JavaThread* thread, BasicObjectLock* lock);
+
+  static void new_instance(JavaThread* thread, int index);
+  static void newarray(JavaThread* thread, BasicType type, int size);
+  static void anewarray(JavaThread* thread, int index, int size);
+  static void multianewarray(JavaThread* thread,
+                             int         index,
+                             int         ndims,
+                             int*        dims);
+
+  static void register_finalizer(JavaThread* thread, oop object);
+
+  static void throw_ArithmeticException(JavaThread* thread,
+                                        const char* file,
+                                        int         line);
+  static void throw_ArrayIndexOutOfBoundsException(JavaThread* thread,
+                                                   const char* file,
+                                                   int         line,
+                                                   int         index);
+  static void throw_ClassCastException(JavaThread* thread,
+                                       const char* file,
+                                       int         line);
+  static void throw_NullPointerException(JavaThread* thread,
+                                         const char* file,
+                                         int         line);
+
+  // Helpers for VM calls
+ private:
+  static const SharkFrame* last_frame(JavaThread *thread) {
+    return thread->last_frame().zero_sharkframe();
+  }
+  static methodOop method(JavaThread *thread) {
+    return last_frame(thread)->method();
+  }
+  static address bcp(JavaThread *thread, int bci) {
+    return method(thread)->code_base() + bci;
+  }
+  static int two_byte_index(JavaThread *thread, int bci) {
+    return Bytes::get_Java_u2(bcp(thread, bci) + 1);
+  }
+  static intptr_t tos_at(JavaThread *thread, int offset) {
+    return *(thread->zero_stack()->sp() + offset);
+  }
+
+  // Non-VM calls
+ public:
+  static void dump(const char *name, intptr_t value);
+  static bool is_subtype_of(klassOop check_klass, klassOop object_klass);
+  static int uncommon_trap(JavaThread* thread, int trap_request);
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkStack.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,263 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkStack.cpp.incl"
+
+using namespace llvm;
+
+void SharkStack::initialize(Value* method) {
+  bool setup_sp_and_method = (method != NULL);
+
+  int locals_words  = max_locals();
+  int extra_locals  = locals_words - arg_size();
+  int header_words  = SharkFrame::header_words;
+  int monitor_words = max_monitors()*frame::interpreter_frame_monitor_size();
+  int stack_words   = max_stack();
+  int frame_words   = header_words + monitor_words + stack_words;
+
+  _extended_frame_size = frame_words + locals_words;
+
+  // Update the stack pointer
+  Value *stack_pointer = builder()->CreateSub(
+    CreateLoadStackPointer(),
+    LLVMValue::intptr_constant((frame_words + extra_locals) * wordSize));
+  CreateStackOverflowCheck(stack_pointer);
+  if (setup_sp_and_method)
+    CreateStoreStackPointer(stack_pointer);
+
+  // Create the frame
+  _frame = builder()->CreateIntToPtr(
+    stack_pointer,
+    PointerType::getUnqual(
+      ArrayType::get(SharkType::intptr_type(), extended_frame_size())),
+    "frame");
+  int offset = 0;
+
+  // Expression stack
+  _stack_slots_offset = offset;
+  offset += stack_words;
+
+  // Monitors
+  _monitors_slots_offset = offset;
+  offset += monitor_words;
+
+  // Temporary oop slot
+  _oop_tmp_slot_offset = offset++;
+
+  // Method pointer
+  _method_slot_offset = offset++;
+  if (setup_sp_and_method) {
+    builder()->CreateStore(
+      method, slot_addr(method_slot_offset(), SharkType::methodOop_type()));
+  }
+
+  // Unextended SP
+  builder()->CreateStore(stack_pointer, slot_addr(offset++));
+
+  // PC
+  _pc_slot_offset = offset++;
+
+  // Frame header
+  builder()->CreateStore(
+    LLVMValue::intptr_constant(ZeroFrame::SHARK_FRAME), slot_addr(offset++));
+  Value *fp = slot_addr(offset++);
+
+  // Local variables
+  _locals_slots_offset = offset;
+  offset += locals_words;
+
+  // Push the frame
+  assert(offset == extended_frame_size(), "should do");
+  builder()->CreateStore(CreateLoadFramePointer(), fp);
+  CreateStoreFramePointer(
+    builder()->CreatePtrToInt(fp, SharkType::intptr_type()));
+}
+
+// This function should match ZeroStack::overflow_check
+void SharkStack::CreateStackOverflowCheck(Value* sp) {
+  BasicBlock *zero_ok  = CreateBlock("zero_stack_ok");
+  BasicBlock *overflow = CreateBlock("stack_overflow");
+  BasicBlock *abi_ok   = CreateBlock("abi_stack_ok");
+
+  // Check the Zero stack
+  builder()->CreateCondBr(
+    builder()->CreateICmpULT(sp, stack_base()),
+    overflow, zero_ok);
+
+  // Check the ABI stack
+  builder()->SetInsertPoint(zero_ok);
+  Value *stack_top = builder()->CreateSub(
+    builder()->CreateValueOfStructEntry(
+      thread(),
+      Thread::stack_base_offset(),
+      SharkType::intptr_type(),
+      "abi_base"),
+    builder()->CreateValueOfStructEntry(
+      thread(),
+      Thread::stack_size_offset(),
+      SharkType::intptr_type(),
+      "abi_size"));
+  Value *free_stack = builder()->CreateSub(
+    builder()->CreatePtrToInt(
+      builder()->CreateGetFrameAddress(),
+      SharkType::intptr_type(),
+      "abi_sp"),
+    stack_top);
+  builder()->CreateCondBr(
+    builder()->CreateICmpULT(
+      free_stack,
+      LLVMValue::intptr_constant(StackShadowPages * os::vm_page_size())),
+    overflow, abi_ok);
+
+  // Handle overflows
+  builder()->SetInsertPoint(overflow);
+  builder()->CreateCall(builder()->throw_StackOverflowError(), thread());
+  builder()->CreateRet(LLVMValue::jint_constant(0));
+
+  builder()->SetInsertPoint(abi_ok);
+}
+
+Value* SharkStack::CreatePopFrame(int result_slots) {
+  assert(result_slots >= 0 && result_slots <= 2, "should be");
+  int locals_to_pop = max_locals() - result_slots;
+
+  Value *fp = CreateLoadFramePointer();
+  Value *sp = builder()->CreateAdd(
+    fp,
+    LLVMValue::intptr_constant((1 + locals_to_pop) * wordSize));
+
+  CreateStoreStackPointer(sp);
+  CreateStoreFramePointer(
+    builder()->CreateLoad(
+      builder()->CreateIntToPtr(
+        fp, PointerType::getUnqual(SharkType::intptr_type()))));
+
+  return sp;
+}
+
+Value* SharkStack::slot_addr(int         offset,
+                             const Type* type,
+                             const char* name) const {
+  bool needs_cast = type && type != SharkType::intptr_type();
+
+  Value* result = builder()->CreateStructGEP(
+    _frame, offset, needs_cast ? "" : name);
+
+  if (needs_cast) {
+    result = builder()->CreateBitCast(
+      result, PointerType::getUnqual(type), name);
+  }
+  return result;
+}
+
+// The bits that differentiate stacks with normal and native frames on top
+
+SharkStack* SharkStack::CreateBuildAndPushFrame(SharkFunction* function,
+                                                Value*         method) {
+  return new SharkStackWithNormalFrame(function, method);
+}
+SharkStack* SharkStack::CreateBuildAndPushFrame(SharkNativeWrapper* wrapper,
+                                                Value*              method) {
+  return new SharkStackWithNativeFrame(wrapper, method);
+}
+
+SharkStackWithNormalFrame::SharkStackWithNormalFrame(SharkFunction* function,
+                                                     Value*         method)
+  : SharkStack(function), _function(function) {
+  // For normal frames, the stack pointer and the method slot will
+  // be set during each decache, so it is not necessary to do them
+  // at the time the frame is created.  However, we set them for
+  // non-PRODUCT builds to make crash dumps easier to understand.
+  initialize(PRODUCT_ONLY(NULL) NOT_PRODUCT(method));
+}
+SharkStackWithNativeFrame::SharkStackWithNativeFrame(SharkNativeWrapper* wrp,
+                                                     Value*              method)
+  : SharkStack(wrp), _wrapper(wrp) {
+  initialize(method);
+}
+
+int SharkStackWithNormalFrame::arg_size() const {
+  return function()->arg_size();
+}
+int SharkStackWithNativeFrame::arg_size() const {
+  return wrapper()->arg_size();
+}
+
+int SharkStackWithNormalFrame::max_locals() const {
+  return function()->max_locals();
+}
+int SharkStackWithNativeFrame::max_locals() const {
+  return wrapper()->arg_size();
+}
+
+int SharkStackWithNormalFrame::max_stack() const {
+  return function()->max_stack();
+}
+int SharkStackWithNativeFrame::max_stack() const {
+  return 0;
+}
+
+int SharkStackWithNormalFrame::max_monitors() const {
+  return function()->max_monitors();
+}
+int SharkStackWithNativeFrame::max_monitors() const {
+  return wrapper()->is_synchronized() ? 1 : 0;
+}
+
+BasicBlock* SharkStackWithNormalFrame::CreateBlock(const char* name) const {
+  return function()->CreateBlock(name);
+}
+BasicBlock* SharkStackWithNativeFrame::CreateBlock(const char* name) const {
+  return wrapper()->CreateBlock(name);
+}
+
+address SharkStackWithNormalFrame::interpreter_entry_point() const {
+  return (address) CppInterpreter::normal_entry;
+}
+address SharkStackWithNativeFrame::interpreter_entry_point() const {
+  return (address) CppInterpreter::native_entry;
+}
+
+#ifndef PRODUCT
+void SharkStack::CreateAssertLastJavaSPIsNull() const {
+#ifdef ASSERT
+  BasicBlock *fail = CreateBlock("assert_failed");
+  BasicBlock *pass = CreateBlock("assert_ok");
+
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(
+      builder()->CreateLoad(last_Java_sp_addr()),
+      LLVMValue::intptr_constant(0)),
+    pass, fail);
+
+  builder()->SetInsertPoint(fail);
+  builder()->CreateShouldNotReachHere(__FILE__, __LINE__);
+  builder()->CreateUnreachable();
+
+  builder()->SetInsertPoint(pass);
+#endif // ASSERT
+}
+#endif // !PRODUCT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkStack.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,290 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+class SharkFunction;
+class SharkNativeWrapper;
+class SharkStackWithNormalFrame;
+class SharkStackWithNativeFrame;
+
+class SharkStack : public SharkCompileInvariants {
+ public:
+  static SharkStack* CreateBuildAndPushFrame(
+    SharkFunction* function, llvm::Value* method);
+  static SharkStack* CreateBuildAndPushFrame(
+    SharkNativeWrapper* wrapper, llvm::Value* method);
+
+ protected:
+  SharkStack(const SharkCompileInvariants* parent)
+    : SharkCompileInvariants(parent) {}
+
+ protected:
+  void initialize(llvm::Value* method);
+
+ protected:
+  void CreateStackOverflowCheck(llvm::Value* sp);
+
+  // Properties of the method being compiled
+ protected:
+  virtual int arg_size() const = 0;
+  virtual int max_locals() const = 0;
+  virtual int max_stack() const = 0;
+  virtual int max_monitors() const = 0;
+
+  // BasicBlock creation
+ protected:
+  virtual llvm::BasicBlock* CreateBlock(const char* name = "") const = 0;
+
+  // Interpreter entry point for bailouts
+ protected:
+  virtual address interpreter_entry_point() const = 0;
+
+  // Interface with the Zero stack
+ private:
+  llvm::Value* zero_stack() const {
+    return builder()->CreateAddressOfStructEntry(
+      thread(),
+      JavaThread::zero_stack_offset(),
+      SharkType::zeroStack_type(),
+      "zero_stack");
+  }
+  llvm::Value* stack_base() const {
+    return builder()->CreateValueOfStructEntry(
+      zero_stack(),
+      ZeroStack::base_offset(),
+      SharkType::intptr_type(),
+      "stack_base");
+  }
+  llvm::Value* stack_pointer_addr() const {
+    return builder()->CreateAddressOfStructEntry(
+      zero_stack(),
+      ZeroStack::sp_offset(),
+      llvm::PointerType::getUnqual(SharkType::intptr_type()),
+      "stack_pointer_addr");
+  }
+  llvm::Value* frame_pointer_addr() const {
+    return builder()->CreateAddressOfStructEntry(
+      thread(),
+      JavaThread::top_zero_frame_offset(),
+      llvm::PointerType::getUnqual(SharkType::intptr_type()),
+      "frame_pointer_addr");
+  }
+
+ public:
+  llvm::LoadInst* CreateLoadStackPointer(const char *name = "") {
+    return builder()->CreateLoad(stack_pointer_addr(), name);
+  }
+  llvm::StoreInst* CreateStoreStackPointer(llvm::Value* value) {
+    return builder()->CreateStore(value, stack_pointer_addr());
+  }
+  llvm::LoadInst* CreateLoadFramePointer(const char *name = "") {
+    return builder()->CreateLoad(frame_pointer_addr(), name);
+  }
+  llvm::StoreInst* CreateStoreFramePointer(llvm::Value* value) {
+    return builder()->CreateStore(value, frame_pointer_addr());
+  }
+  llvm::Value* CreatePopFrame(int result_slots);
+
+  // Interface with the frame anchor
+ private:
+  llvm::Value* last_Java_sp_addr() const {
+    return builder()->CreateAddressOfStructEntry(
+      thread(),
+      JavaThread::last_Java_sp_offset(),
+      llvm::PointerType::getUnqual(SharkType::intptr_type()),
+      "last_Java_sp_addr");
+  }
+  llvm::Value* last_Java_fp_addr() const {
+    return builder()->CreateAddressOfStructEntry(
+      thread(),
+      JavaThread::last_Java_fp_offset(),
+      llvm::PointerType::getUnqual(SharkType::intptr_type()),
+      "last_Java_fp_addr");
+  }
+
+ public:
+  void CreateSetLastJavaFrame() {
+    // Note that whenever _last_Java_sp != NULL other anchor fields
+    // must be valid.  The profiler apparently depends on this.
+    NOT_PRODUCT(CreateAssertLastJavaSPIsNull());
+    builder()->CreateStore(CreateLoadFramePointer(), last_Java_fp_addr());
+    // XXX There's last_Java_pc as well, but I don't think anything uses it
+    // Also XXX: should we fence here?  Zero doesn't...
+    builder()->CreateStore(CreateLoadStackPointer(), last_Java_sp_addr());
+    // Also also XXX: we could probably cache the sp (and the fp we know??)
+  }
+  void CreateResetLastJavaFrame() {
+    builder()->CreateStore(LLVMValue::intptr_constant(0), last_Java_sp_addr());
+  }
+
+ private:
+  void CreateAssertLastJavaSPIsNull() const PRODUCT_RETURN;
+
+  // Our method's frame
+ private:
+  llvm::Value* _frame;
+  int          _extended_frame_size;
+  int          _stack_slots_offset;
+
+ public:
+  int extended_frame_size() const {
+    return _extended_frame_size;
+  }
+  int oopmap_frame_size() const {
+    return extended_frame_size() - arg_size();
+  }
+
+  // Offsets of things in the frame
+ private:
+  int _monitors_slots_offset;
+  int _oop_tmp_slot_offset;
+  int _method_slot_offset;
+  int _pc_slot_offset;
+  int _locals_slots_offset;
+
+ public:
+  int stack_slots_offset() const {
+    return _stack_slots_offset;
+  }
+  int oop_tmp_slot_offset() const {
+    return _oop_tmp_slot_offset;
+  }
+  int method_slot_offset() const {
+    return _method_slot_offset;
+  }
+  int pc_slot_offset() const {
+    return _pc_slot_offset;
+  }
+  int locals_slots_offset() const {
+    return _locals_slots_offset;
+  }
+  int monitor_offset(int index) const {
+    assert(index >= 0 && index < max_monitors(), "invalid monitor index");
+    return _monitors_slots_offset +
+      (max_monitors() - 1 - index) * frame::interpreter_frame_monitor_size();
+  }
+  int monitor_object_offset(int index) const {
+    return monitor_offset(index) +
+      (BasicObjectLock::obj_offset_in_bytes() >> LogBytesPerWord);
+  }
+  int monitor_header_offset(int index) const {
+    return monitor_offset(index) +
+      ((BasicObjectLock::lock_offset_in_bytes() +
+        BasicLock::displaced_header_offset_in_bytes()) >> LogBytesPerWord);
+  }
+
+  // Addresses of things in the frame
+ public:
+  llvm::Value* slot_addr(int               offset,
+                         const llvm::Type* type = NULL,
+                         const char*       name = "") const;
+
+  llvm::Value* monitor_addr(int index) const {
+    return slot_addr(
+      monitor_offset(index),
+      SharkType::monitor_type(),
+      "monitor");
+  }
+  llvm::Value* monitor_object_addr(int index) const {
+    return slot_addr(
+      monitor_object_offset(index),
+      SharkType::oop_type(),
+      "object_addr");
+  }
+  llvm::Value* monitor_header_addr(int index) const {
+    return slot_addr(
+      monitor_header_offset(index),
+      SharkType::intptr_type(),
+      "displaced_header_addr");
+  }
+
+  // oopmap helpers
+ public:
+  static int oopmap_slot_munge(int offset) {
+    return offset << (LogBytesPerWord - LogBytesPerInt);
+  }
+  static VMReg slot2reg(int offset) {
+    return VMRegImpl::stack2reg(oopmap_slot_munge(offset));
+  }
+};
+
+class SharkStackWithNormalFrame : public SharkStack {
+  friend class SharkStack;
+
+ protected:
+  SharkStackWithNormalFrame(SharkFunction* function, llvm::Value* method);
+
+ private:
+  SharkFunction* _function;
+
+ private:
+  SharkFunction* function() const {
+    return _function;
+  }
+
+  // Properties of the method being compiled
+ private:
+  int arg_size() const;
+  int max_locals() const;
+  int max_stack() const;
+  int max_monitors() const;
+
+  // BasicBlock creation
+ private:
+  llvm::BasicBlock* CreateBlock(const char* name = "") const;
+
+  // Interpreter entry point for bailouts
+ private:
+  address interpreter_entry_point() const;
+};
+
+class SharkStackWithNativeFrame : public SharkStack {
+  friend class SharkStack;
+
+ protected:
+  SharkStackWithNativeFrame(SharkNativeWrapper* wrapper, llvm::Value* method);
+
+ private:
+  SharkNativeWrapper* _wrapper;
+
+ private:
+  SharkNativeWrapper* wrapper() const {
+    return _wrapper;
+  }
+
+  // Properties of the method being compiled
+ private:
+  int arg_size() const;
+  int max_locals() const;
+  int max_stack() const;
+  int max_monitors() const;
+
+  // BasicBlock creation
+ private:
+  llvm::BasicBlock* CreateBlock(const char* name = "") const;
+
+  // Interpreter entry point for bailouts
+ private:
+  address interpreter_entry_point() const;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkState.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,389 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkState.cpp.incl"
+
+using namespace llvm;
+
+void SharkState::initialize(const SharkState *state) {
+  _locals = NEW_RESOURCE_ARRAY(SharkValue*, max_locals());
+  _stack  = NEW_RESOURCE_ARRAY(SharkValue*, max_stack());
+
+  NOT_PRODUCT(memset(_locals, 23, max_locals() * sizeof(SharkValue *)));
+  NOT_PRODUCT(memset(_stack,  23, max_stack()  * sizeof(SharkValue *)));
+  _sp = _stack;
+
+  if (state) {
+    for (int i = 0; i < max_locals(); i++) {
+      SharkValue *value = state->local(i);
+      if (value)
+        value = value->clone();
+      set_local(i, value);
+    }
+
+    for (int i = state->stack_depth() - 1; i >= 0; i--) {
+      SharkValue *value = state->stack(i);
+      if (value)
+        value = value->clone();
+      push(value);
+    }
+  }
+
+  set_num_monitors(state ? state->num_monitors() : 0);
+}
+
+bool SharkState::equal_to(SharkState *other) {
+  if (target() != other->target())
+    return false;
+
+  if (method() != other->method())
+    return false;
+
+  if (oop_tmp() != other->oop_tmp())
+    return false;
+
+  if (max_locals() != other->max_locals())
+    return false;
+
+  if (stack_depth() != other->stack_depth())
+    return false;
+
+  if (num_monitors() != other->num_monitors())
+    return false;
+
+  if (has_safepointed() != other->has_safepointed())
+    return false;
+
+  // Local variables
+  for (int i = 0; i < max_locals(); i++) {
+    SharkValue *value = local(i);
+    SharkValue *other_value = other->local(i);
+
+    if (value == NULL) {
+      if (other_value != NULL)
+        return false;
+    }
+    else {
+      if (other_value == NULL)
+        return false;
+
+      if (!value->equal_to(other_value))
+        return false;
+    }
+  }
+
+  // Expression stack
+  for (int i = 0; i < stack_depth(); i++) {
+    SharkValue *value = stack(i);
+    SharkValue *other_value = other->stack(i);
+
+    if (value == NULL) {
+      if (other_value != NULL)
+        return false;
+    }
+    else {
+      if (other_value == NULL)
+        return false;
+
+      if (!value->equal_to(other_value))
+        return false;
+    }
+  }
+
+  return true;
+}
+
+void SharkState::merge(SharkState* other,
+                       BasicBlock* other_block,
+                       BasicBlock* this_block) {
+  // Method
+  Value *this_method = this->method();
+  Value *other_method = other->method();
+  if (this_method != other_method) {
+    PHINode *phi = builder()->CreatePHI(SharkType::methodOop_type(), "method");
+    phi->addIncoming(this_method, this_block);
+    phi->addIncoming(other_method, other_block);
+    set_method(phi);
+  }
+
+  // Temporary oop slot
+  Value *this_oop_tmp = this->oop_tmp();
+  Value *other_oop_tmp = other->oop_tmp();
+  if (this_oop_tmp != other_oop_tmp) {
+    assert(this_oop_tmp && other_oop_tmp, "can't merge NULL with non-NULL");
+    PHINode *phi = builder()->CreatePHI(SharkType::oop_type(), "oop_tmp");
+    phi->addIncoming(this_oop_tmp, this_block);
+    phi->addIncoming(other_oop_tmp, other_block);
+    set_oop_tmp(phi);
+  }
+
+  // Monitors
+  assert(this->num_monitors() == other->num_monitors(), "should be");
+
+  // Local variables
+  assert(this->max_locals() == other->max_locals(), "should be");
+  for (int i = 0; i < max_locals(); i++) {
+    SharkValue *this_value = this->local(i);
+    SharkValue *other_value = other->local(i);
+    assert((this_value == NULL) == (other_value == NULL), "should be");
+    if (this_value != NULL) {
+      char name[18];
+      snprintf(name, sizeof(name), "local_%d_", i);
+      set_local(i, this_value->merge(
+        builder(), other_value, other_block, this_block, name));
+    }
+  }
+
+  // Expression stack
+  assert(this->stack_depth() == other->stack_depth(), "should be");
+  for (int i = 0; i < stack_depth(); i++) {
+    SharkValue *this_value = this->stack(i);
+    SharkValue *other_value = other->stack(i);
+    assert((this_value == NULL) == (other_value == NULL), "should be");
+    if (this_value != NULL) {
+      char name[18];
+      snprintf(name, sizeof(name), "stack_%d_", i);
+      set_stack(i, this_value->merge(
+        builder(), other_value, other_block, this_block, name));
+    }
+  }
+
+  // Safepointed status
+  set_has_safepointed(this->has_safepointed() && other->has_safepointed());
+}
+
+void SharkState::replace_all(SharkValue* old_value, SharkValue* new_value) {
+  // Local variables
+  for (int i = 0; i < max_locals(); i++) {
+    if (local(i) == old_value)
+      set_local(i, new_value);
+  }
+
+  // Expression stack
+  for (int i = 0; i < stack_depth(); i++) {
+    if (stack(i) == old_value)
+      set_stack(i, new_value);
+  }
+}
+
+SharkNormalEntryState::SharkNormalEntryState(SharkTopLevelBlock* block,
+                                             Value*              method)
+  : SharkState(block) {
+  assert(!block->stack_depth_at_entry(), "entry block shouldn't have stack");
+
+  // Local variables
+  for (int i = 0; i < max_locals(); i++) {
+    ciType *type = block->local_type_at_entry(i);
+
+    SharkValue *value = NULL;
+    switch (type->basic_type()) {
+    case T_INT:
+    case T_LONG:
+    case T_FLOAT:
+    case T_DOUBLE:
+    case T_OBJECT:
+    case T_ARRAY:
+      if (i >= arg_size()) {
+        ShouldNotReachHere();
+      }
+      value = SharkValue::create_generic(type, NULL, i == 0 && !is_static());
+      break;
+
+    case ciTypeFlow::StateVector::T_NULL:
+      value = SharkValue::null();
+      break;
+
+    case ciTypeFlow::StateVector::T_BOTTOM:
+      break;
+
+    case ciTypeFlow::StateVector::T_LONG2:
+    case ciTypeFlow::StateVector::T_DOUBLE2:
+      break;
+
+    default:
+      ShouldNotReachHere();
+    }
+    set_local(i, value);
+  }
+  SharkNormalEntryCacher(block->function(), method).scan(this);
+}
+
+SharkOSREntryState::SharkOSREntryState(SharkTopLevelBlock* block,
+                                       Value*              method,
+                                       Value*              osr_buf)
+  : SharkState(block) {
+  assert(!block->stack_depth_at_entry(), "entry block shouldn't have stack");
+  set_num_monitors(block->ciblock()->monitor_count());
+
+  // Local variables
+  for (int i = 0; i < max_locals(); i++) {
+    ciType *type = block->local_type_at_entry(i);
+
+    SharkValue *value = NULL;
+    switch (type->basic_type()) {
+    case T_INT:
+    case T_LONG:
+    case T_FLOAT:
+    case T_DOUBLE:
+    case T_OBJECT:
+    case T_ARRAY:
+      value = SharkValue::create_generic(type, NULL, false);
+      break;
+
+    case ciTypeFlow::StateVector::T_NULL:
+      value = SharkValue::null();
+      break;
+
+    case ciTypeFlow::StateVector::T_BOTTOM:
+      break;
+
+    case ciTypeFlow::StateVector::T_LONG2:
+    case ciTypeFlow::StateVector::T_DOUBLE2:
+      break;
+
+    default:
+      ShouldNotReachHere();
+    }
+    set_local(i, value);
+  }
+  SharkOSREntryCacher(block->function(), method, osr_buf).scan(this);
+}
+
+SharkPHIState::SharkPHIState(SharkTopLevelBlock* block)
+  : SharkState(block), _block(block) {
+  BasicBlock *saved_insert_point = builder()->GetInsertBlock();
+  builder()->SetInsertPoint(block->entry_block());
+  char name[18];
+
+  // Method
+  set_method(builder()->CreatePHI(SharkType::methodOop_type(), "method"));
+
+  // Local variables
+  for (int i = 0; i < max_locals(); i++) {
+    ciType *type = block->local_type_at_entry(i);
+    if (type->basic_type() == (BasicType) ciTypeFlow::StateVector::T_NULL) {
+      // XXX we could do all kinds of clever stuff here
+      type = ciType::make(T_OBJECT); // XXX what about T_ARRAY?
+    }
+
+    SharkValue *value = NULL;
+    switch (type->basic_type()) {
+    case T_INT:
+    case T_LONG:
+    case T_FLOAT:
+    case T_DOUBLE:
+    case T_OBJECT:
+    case T_ARRAY:
+      snprintf(name, sizeof(name), "local_%d_", i);
+      value = SharkValue::create_phi(
+        type, builder()->CreatePHI(SharkType::to_stackType(type), name));
+      break;
+
+    case T_ADDRESS:
+      value = SharkValue::address_constant(type->as_return_address()->bci());
+      break;
+
+    case ciTypeFlow::StateVector::T_BOTTOM:
+      break;
+
+    case ciTypeFlow::StateVector::T_LONG2:
+    case ciTypeFlow::StateVector::T_DOUBLE2:
+      break;
+
+    default:
+      ShouldNotReachHere();
+    }
+    set_local(i, value);
+  }
+
+  // Expression stack
+  for (int i = 0; i < block->stack_depth_at_entry(); i++) {
+    ciType *type = block->stack_type_at_entry(i);
+    if (type->basic_type() == (BasicType) ciTypeFlow::StateVector::T_NULL) {
+      // XXX we could do all kinds of clever stuff here
+      type = ciType::make(T_OBJECT); // XXX what about T_ARRAY?
+    }
+
+    SharkValue *value = NULL;
+    switch (type->basic_type()) {
+    case T_INT:
+    case T_LONG:
+    case T_FLOAT:
+    case T_DOUBLE:
+    case T_OBJECT:
+    case T_ARRAY:
+      snprintf(name, sizeof(name), "stack_%d_", i);
+      value = SharkValue::create_phi(
+        type, builder()->CreatePHI(SharkType::to_stackType(type), name));
+      break;
+
+    case T_ADDRESS:
+      value = SharkValue::address_constant(type->as_return_address()->bci());
+      break;
+
+    case ciTypeFlow::StateVector::T_LONG2:
+    case ciTypeFlow::StateVector::T_DOUBLE2:
+      break;
+
+    default:
+      ShouldNotReachHere();
+    }
+    push(value);
+  }
+
+  // Monitors
+  set_num_monitors(block->ciblock()->monitor_count());
+
+  builder()->SetInsertPoint(saved_insert_point);
+}
+
+void SharkPHIState::add_incoming(SharkState* incoming_state) {
+  BasicBlock *predecessor = builder()->GetInsertBlock();
+
+  // Method
+  ((PHINode *) method())->addIncoming(incoming_state->method(), predecessor);
+
+  // Local variables
+  for (int i = 0; i < max_locals(); i++) {
+    if (local(i) != NULL)
+      local(i)->addIncoming(incoming_state->local(i), predecessor);
+  }
+
+  // Expression stack
+  int stack_depth = block()->stack_depth_at_entry();
+  assert(stack_depth == incoming_state->stack_depth(), "should be");
+  for (int i = 0; i < stack_depth; i++) {
+    assert((stack(i) == NULL) == (incoming_state->stack(i) == NULL), "oops");
+    if (stack(i))
+      stack(i)->addIncoming(incoming_state->stack(i), predecessor);
+  }
+
+  // Monitors
+  assert(num_monitors() == incoming_state->num_monitors(), "should be");
+
+  // Temporary oop slot
+  assert(oop_tmp() == incoming_state->oop_tmp(), "should be");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkState.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+class SharkState : public SharkTargetInvariants {
+ public:
+  SharkState(const SharkTargetInvariants* parent)
+    : SharkTargetInvariants(parent),
+      _method(NULL),
+      _oop_tmp(NULL),
+      _has_safepointed(false) { initialize(NULL); }
+
+  SharkState(const SharkState* state)
+    : SharkTargetInvariants(state),
+      _method(state->_method),
+      _oop_tmp(state->_oop_tmp),
+      _has_safepointed(state->_has_safepointed) { initialize(state); }
+
+ private:
+  void initialize(const SharkState* state);
+
+ private:
+  llvm::Value* _method;
+  SharkValue** _locals;
+  SharkValue** _stack;
+  SharkValue** _sp;
+  int          _num_monitors;
+  llvm::Value* _oop_tmp;
+  bool         _has_safepointed;
+
+  // Method
+ public:
+  llvm::Value** method_addr() {
+    return &_method;
+  }
+  llvm::Value* method() const {
+    return _method;
+  }
+ protected:
+  void set_method(llvm::Value* method) {
+    _method = method;
+  }
+
+  // Local variables
+ public:
+  SharkValue** local_addr(int index) const {
+    assert(index >= 0 && index < max_locals(), "bad local variable index");
+    return &_locals[index];
+  }
+  SharkValue* local(int index) const {
+    return *local_addr(index);
+  }
+  void set_local(int index, SharkValue* value) {
+    *local_addr(index) = value;
+  }
+
+  // Expression stack
+ public:
+  SharkValue** stack_addr(int slot) const {
+    assert(slot >= 0 && slot < stack_depth(), "bad stack slot");
+    return &_sp[-(slot + 1)];
+  }
+  SharkValue* stack(int slot) const {
+    return *stack_addr(slot);
+  }
+ protected:
+  void set_stack(int slot, SharkValue* value) {
+    *stack_addr(slot) = value;
+  }
+ public:
+  int stack_depth() const {
+    return _sp - _stack;
+  }
+  void push(SharkValue* value) {
+    assert(stack_depth() < max_stack(), "stack overrun");
+    *(_sp++) = value;
+  }
+  SharkValue* pop() {
+    assert(stack_depth() > 0, "stack underrun");
+    return *(--_sp);
+  }
+
+  // Monitors
+ public:
+  int num_monitors() const {
+    return _num_monitors;
+  }
+  void set_num_monitors(int num_monitors) {
+    _num_monitors = num_monitors;
+  }
+
+  // Temporary oop slot
+ public:
+  llvm::Value** oop_tmp_addr() {
+    return &_oop_tmp;
+  }
+  llvm::Value* oop_tmp() const {
+    return _oop_tmp;
+  }
+  void set_oop_tmp(llvm::Value* oop_tmp) {
+    _oop_tmp = oop_tmp;
+  }
+
+  // Safepointed status
+ public:
+  bool has_safepointed() const {
+    return _has_safepointed;
+  }
+  void set_has_safepointed(bool has_safepointed) {
+    _has_safepointed = has_safepointed;
+  }
+
+  // Comparison
+ public:
+  bool equal_to(SharkState* other);
+
+  // Copy and merge
+ public:
+  SharkState* copy() const {
+    return new SharkState(this);
+  }
+  void merge(SharkState*       other,
+             llvm::BasicBlock* other_block,
+             llvm::BasicBlock* this_block);
+
+  // Value replacement
+ public:
+  void replace_all(SharkValue* old_value, SharkValue* new_value);
+};
+
+class SharkTopLevelBlock;
+
+// SharkNormalEntryState objects are used to create the state
+// that the method will be entered with for a normal invocation.
+class SharkNormalEntryState : public SharkState {
+ public:
+  SharkNormalEntryState(SharkTopLevelBlock* block,
+                        llvm::Value*        method);
+};
+
+// SharkOSREntryState objects are used to create the state
+// that the method will be entered with for an OSR invocation.
+class SharkOSREntryState : public SharkState {
+ public:
+  SharkOSREntryState(SharkTopLevelBlock* block,
+                     llvm::Value*        method,
+                     llvm::Value*        osr_buf);
+};
+
+// SharkPHIState objects are used to manage the entry state
+// for blocks with more than one entry path or for blocks
+// entered from blocks that will be compiled later.
+class SharkPHIState : public SharkState {
+ public:
+  SharkPHIState(SharkTopLevelBlock* block);
+
+ private:
+  SharkTopLevelBlock* _block;
+
+ private:
+  SharkTopLevelBlock* block() const {
+    return _block;
+  }
+
+ public:
+  void add_incoming(SharkState* incoming_state);
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkStateScanner.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkStateScanner.cpp.incl"
+
+using namespace llvm;
+
+void SharkStateScanner::scan(SharkState* state) {
+  start_frame();
+
+  // Expression stack
+  stack_integrity_checks(state);
+  start_stack(state->stack_depth());
+  for (int i = state->stack_depth() - 1; i >= 0; i--) {
+    process_stack_slot(
+      i,
+      state->stack_addr(i),
+      stack()->stack_slots_offset() +
+        i + max_stack() - state->stack_depth());
+  }
+  end_stack();
+
+  // Monitors
+  start_monitors(state->num_monitors());
+  for (int i = 0; i < state->num_monitors(); i++) {
+    process_monitor(
+      i,
+      stack()->monitor_offset(i),
+      stack()->monitor_object_offset(i));
+  }
+  end_monitors();
+
+  // Frame header
+  start_frame_header();
+  process_oop_tmp_slot(
+    state->oop_tmp_addr(), stack()->oop_tmp_slot_offset());
+  process_method_slot(state->method_addr(), stack()->method_slot_offset());
+  process_pc_slot(stack()->pc_slot_offset());
+  end_frame_header();
+
+  // Local variables
+  locals_integrity_checks(state);
+  start_locals();
+  for (int i = 0; i < max_locals(); i++) {
+    process_local_slot(
+      i,
+      state->local_addr(i),
+      stack()->locals_slots_offset() + max_locals() - 1 - i);
+  }
+  end_locals();
+
+  end_frame();
+}
+
+#ifndef PRODUCT
+void SharkStateScanner::stack_integrity_checks(SharkState* state) {
+  for (int i = 0; i < state->stack_depth(); i++) {
+    if (state->stack(i)) {
+      if (state->stack(i)->is_two_word())
+        assert(state->stack(i - 1) == NULL, "should be");
+    }
+    else {
+      assert(state->stack(i + 1)->is_two_word(), "should be");
+    }
+  }
+}
+
+void SharkStateScanner::locals_integrity_checks(SharkState* state) {
+  for (int i = 0; i < max_locals(); i++) {
+    if (state->local(i)) {
+      if (state->local(i)->is_two_word())
+        assert(state->local(i + 1) == NULL, "should be");
+    }
+  }
+}
+#endif // !PRODUCT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkStateScanner.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+class SharkState;
+
+class SharkStateScanner : public SharkTargetInvariants {
+ protected:
+  SharkStateScanner(SharkFunction* function)
+    : SharkTargetInvariants(function), _stack(function->stack()) {}
+
+ private:
+  SharkStack* _stack;
+
+ protected:
+  SharkStack* stack() const {
+    return _stack;
+  }
+
+  // Scan the frame
+ public:
+  void scan(SharkState* state);
+
+  // Callbacks
+  // Note that the offsets supplied to the various process_* callbacks
+  // are specified in wordSize words from the frame's unextended_sp.
+ protected:
+  virtual void start_frame()                                                 {}
+
+  virtual void start_stack(int stack_depth)                                  {}
+  virtual void process_stack_slot(int index, SharkValue** value, int offset) {}
+  virtual void end_stack()                                                   {}
+
+  virtual void start_monitors(int num_monitors)                              {}
+  virtual void process_monitor(int index, int box_offset, int obj_offset)    {}
+  virtual void end_monitors()                                                {}
+
+  virtual void start_frame_header()                                          {}
+  virtual void process_oop_tmp_slot(llvm::Value** value, int offset)         {}
+  virtual void process_method_slot(llvm::Value** value, int offset)          {}
+  virtual void process_pc_slot(int offset)                                   {}
+  virtual void end_frame_header()                                            {}
+
+  virtual void start_locals()                                                {}
+  virtual void process_local_slot(int index, SharkValue** value, int offset) {}
+  virtual void end_locals()                                                  {}
+
+  virtual void end_frame()                                                   {}
+
+  // Integrity checks
+ private:
+  void stack_integrity_checks(SharkState* state) PRODUCT_RETURN;
+  void locals_integrity_checks(SharkState* state) PRODUCT_RETURN;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,1995 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkTopLevelBlock.cpp.incl"
+
+using namespace llvm;
+
+void SharkTopLevelBlock::scan_for_traps() {
+  // If typeflow found a trap then don't scan past it
+  int limit_bci = ciblock()->has_trap() ? ciblock()->trap_bci() : limit();
+
+  // Scan the bytecode for traps that are always hit
+  iter()->reset_to_bci(start());
+  while (iter()->next_bci() < limit_bci) {
+    iter()->next();
+
+    ciField *field;
+    ciMethod *method;
+    ciInstanceKlass *klass;
+    bool will_link;
+    bool is_field;
+
+    switch (bc()) {
+    case Bytecodes::_ldc:
+    case Bytecodes::_ldc_w:
+      if (!SharkConstant::for_ldc(iter())->is_loaded()) {
+        set_trap(
+          Deoptimization::make_trap_request(
+            Deoptimization::Reason_uninitialized,
+            Deoptimization::Action_reinterpret), bci());
+        return;
+      }
+      break;
+
+    case Bytecodes::_getfield:
+    case Bytecodes::_getstatic:
+    case Bytecodes::_putfield:
+    case Bytecodes::_putstatic:
+      field = iter()->get_field(will_link);
+      assert(will_link, "typeflow responsibility");
+      is_field = (bc() == Bytecodes::_getfield || bc() == Bytecodes::_putfield);
+
+      // If the bytecode does not match the field then bail out to
+      // the interpreter to throw an IncompatibleClassChangeError
+      if (is_field == field->is_static()) {
+        set_trap(
+          Deoptimization::make_trap_request(
+            Deoptimization::Reason_unhandled,
+            Deoptimization::Action_none), bci());
+        return;
+      }
+
+      // Bail out if we are trying to access a static variable
+      // before the class initializer has completed.
+      if (!is_field && !field->holder()->is_initialized()) {
+        if (!static_field_ok_in_clinit(field)) {
+          set_trap(
+            Deoptimization::make_trap_request(
+              Deoptimization::Reason_uninitialized,
+              Deoptimization::Action_reinterpret), bci());
+          return;
+        }
+      }
+      break;
+
+    case Bytecodes::_invokestatic:
+    case Bytecodes::_invokespecial:
+    case Bytecodes::_invokevirtual:
+    case Bytecodes::_invokeinterface:
+      method = iter()->get_method(will_link);
+      assert(will_link, "typeflow responsibility");
+
+      if (!method->holder()->is_linked()) {
+        set_trap(
+          Deoptimization::make_trap_request(
+            Deoptimization::Reason_uninitialized,
+            Deoptimization::Action_reinterpret), bci());
+          return;
+      }
+
+      if (bc() == Bytecodes::_invokevirtual) {
+        klass = ciEnv::get_instance_klass_for_declared_method_holder(
+          iter()->get_declared_method_holder());
+        if (!klass->is_linked()) {
+          set_trap(
+            Deoptimization::make_trap_request(
+              Deoptimization::Reason_uninitialized,
+              Deoptimization::Action_reinterpret), bci());
+            return;
+        }
+      }
+      break;
+
+    case Bytecodes::_new:
+      klass = iter()->get_klass(will_link)->as_instance_klass();
+      assert(will_link, "typeflow responsibility");
+
+      // Bail out if the class is unloaded
+      if (iter()->is_unresolved_klass() || !klass->is_initialized()) {
+        set_trap(
+          Deoptimization::make_trap_request(
+            Deoptimization::Reason_uninitialized,
+            Deoptimization::Action_reinterpret), bci());
+        return;
+      }
+
+      // Bail out if the class cannot be instantiated
+      if (klass->is_abstract() || klass->is_interface() ||
+          klass->name() == ciSymbol::java_lang_Class()) {
+        set_trap(
+          Deoptimization::make_trap_request(
+            Deoptimization::Reason_unhandled,
+            Deoptimization::Action_reinterpret), bci());
+        return;
+      }
+      break;
+    }
+  }
+
+  // Trap if typeflow trapped (and we didn't before)
+  if (ciblock()->has_trap()) {
+    set_trap(
+      Deoptimization::make_trap_request(
+        Deoptimization::Reason_unloaded,
+        Deoptimization::Action_reinterpret,
+        ciblock()->trap_index()), ciblock()->trap_bci());
+    return;
+  }
+}
+
+bool SharkTopLevelBlock::static_field_ok_in_clinit(ciField* field) {
+  assert(field->is_static(), "should be");
+
+  // This code is lifted pretty much verbatim from C2's
+  // Parse::static_field_ok_in_clinit() in parse3.cpp.
+  bool access_OK = false;
+  if (target()->holder()->is_subclass_of(field->holder())) {
+    if (target()->is_static()) {
+      if (target()->name() == ciSymbol::class_initializer_name()) {
+        // It's OK to access static fields from the class initializer
+        access_OK = true;
+      }
+    }
+    else {
+      if (target()->name() == ciSymbol::object_initializer_name()) {
+        // It's also OK to access static fields inside a constructor,
+        // because any thread calling the constructor must first have
+        // synchronized on the class by executing a "new" bytecode.
+        access_OK = true;
+      }
+    }
+  }
+  return access_OK;
+}
+
+SharkState* SharkTopLevelBlock::entry_state() {
+  if (_entry_state == NULL) {
+    assert(needs_phis(), "should do");
+    _entry_state = new SharkPHIState(this);
+  }
+  return _entry_state;
+}
+
+void SharkTopLevelBlock::add_incoming(SharkState* incoming_state) {
+  if (needs_phis()) {
+    ((SharkPHIState *) entry_state())->add_incoming(incoming_state);
+  }
+  else if (_entry_state == NULL) {
+    _entry_state = incoming_state;
+  }
+  else {
+    assert(entry_state()->equal_to(incoming_state), "should be");
+  }
+}
+
+void SharkTopLevelBlock::enter(SharkTopLevelBlock* predecessor,
+                               bool is_exception) {
+  // This block requires phis:
+  //  - if it is entered more than once
+  //  - if it is an exception handler, because in which
+  //    case we assume it's entered more than once.
+  //  - if the predecessor will be compiled after this
+  //    block, in which case we can't simple propagate
+  //    the state forward.
+  if (!needs_phis() &&
+      (entered() ||
+       is_exception ||
+       (predecessor && predecessor->index() >= index())))
+    _needs_phis = true;
+
+  // Recurse into the tree
+  if (!entered()) {
+    _entered = true;
+
+    scan_for_traps();
+    if (!has_trap()) {
+      for (int i = 0; i < num_successors(); i++) {
+        successor(i)->enter(this, false);
+      }
+    }
+    compute_exceptions();
+    for (int i = 0; i < num_exceptions(); i++) {
+      SharkTopLevelBlock *handler = exception(i);
+      if (handler)
+        handler->enter(this, true);
+    }
+  }
+}
+
+void SharkTopLevelBlock::initialize() {
+  char name[28];
+  snprintf(name, sizeof(name),
+           "bci_%d%s",
+           start(), is_backedge_copy() ? "_backedge_copy" : "");
+  _entry_block = function()->CreateBlock(name);
+}
+
+void SharkTopLevelBlock::decache_for_Java_call(ciMethod *callee) {
+  SharkJavaCallDecacher(function(), bci(), callee).scan(current_state());
+  for (int i = 0; i < callee->arg_size(); i++)
+    xpop();
+}
+
+void SharkTopLevelBlock::cache_after_Java_call(ciMethod *callee) {
+  if (callee->return_type()->size()) {
+    ciType *type;
+    switch (callee->return_type()->basic_type()) {
+    case T_BOOLEAN:
+    case T_BYTE:
+    case T_CHAR:
+    case T_SHORT:
+      type = ciType::make(T_INT);
+      break;
+
+    default:
+      type = callee->return_type();
+    }
+
+    push(SharkValue::create_generic(type, NULL, false));
+  }
+  SharkJavaCallCacher(function(), callee).scan(current_state());
+}
+
+void SharkTopLevelBlock::decache_for_VM_call() {
+  SharkVMCallDecacher(function(), bci()).scan(current_state());
+}
+
+void SharkTopLevelBlock::cache_after_VM_call() {
+  SharkVMCallCacher(function()).scan(current_state());
+}
+
+void SharkTopLevelBlock::decache_for_trap() {
+  SharkTrapDecacher(function(), bci()).scan(current_state());
+}
+
+void SharkTopLevelBlock::emit_IR() {
+  builder()->SetInsertPoint(entry_block());
+
+  // Parse the bytecode
+  parse_bytecode(start(), limit());
+
+  // If this block falls through to the next then it won't have been
+  // terminated by a bytecode and we have to add the branch ourselves
+  if (falls_through() && !has_trap())
+    do_branch(ciTypeFlow::FALL_THROUGH);
+}
+
+SharkTopLevelBlock* SharkTopLevelBlock::bci_successor(int bci) const {
+  // XXX now with Linear Search Technology (tm)
+  for (int i = 0; i < num_successors(); i++) {
+    ciTypeFlow::Block *successor = ciblock()->successors()->at(i);
+    if (successor->start() == bci)
+      return function()->block(successor->pre_order());
+  }
+  ShouldNotReachHere();
+}
+
+void SharkTopLevelBlock::do_zero_check(SharkValue *value) {
+  if (value->is_phi() && value->as_phi()->all_incomers_zero_checked()) {
+    function()->add_deferred_zero_check(this, value);
+  }
+  else {
+    BasicBlock *continue_block = function()->CreateBlock("not_zero");
+    SharkState *saved_state = current_state();
+    set_current_state(saved_state->copy());
+    zero_check_value(value, continue_block);
+    builder()->SetInsertPoint(continue_block);
+    set_current_state(saved_state);
+  }
+
+  value->set_zero_checked(true);
+}
+
+void SharkTopLevelBlock::do_deferred_zero_check(SharkValue* value,
+                                                int         bci,
+                                                SharkState* saved_state,
+                                                BasicBlock* continue_block) {
+  if (value->as_phi()->all_incomers_zero_checked()) {
+    builder()->CreateBr(continue_block);
+  }
+  else {
+    iter()->force_bci(start());
+    set_current_state(saved_state);
+    zero_check_value(value, continue_block);
+  }
+}
+
+void SharkTopLevelBlock::zero_check_value(SharkValue* value,
+                                          BasicBlock* continue_block) {
+  BasicBlock *zero_block = builder()->CreateBlock(continue_block, "zero");
+
+  Value *a, *b;
+  switch (value->basic_type()) {
+  case T_BYTE:
+  case T_CHAR:
+  case T_SHORT:
+  case T_INT:
+    a = value->jint_value();
+    b = LLVMValue::jint_constant(0);
+    break;
+  case T_LONG:
+    a = value->jlong_value();
+    b = LLVMValue::jlong_constant(0);
+    break;
+  case T_OBJECT:
+  case T_ARRAY:
+    a = value->jobject_value();
+    b = LLVMValue::LLVMValue::null();
+    break;
+  default:
+    tty->print_cr("Unhandled type %s", type2name(value->basic_type()));
+    ShouldNotReachHere();
+  }
+
+  builder()->CreateCondBr(
+    builder()->CreateICmpNE(a, b), continue_block, zero_block);
+
+  builder()->SetInsertPoint(zero_block);
+  if (value->is_jobject()) {
+    call_vm(
+      builder()->throw_NullPointerException(),
+      builder()->CreateIntToPtr(
+        LLVMValue::intptr_constant((intptr_t) __FILE__),
+        PointerType::getUnqual(SharkType::jbyte_type())),
+      LLVMValue::jint_constant(__LINE__),
+      EX_CHECK_NONE);
+  }
+  else {
+    call_vm(
+      builder()->throw_ArithmeticException(),
+      builder()->CreateIntToPtr(
+        LLVMValue::intptr_constant((intptr_t) __FILE__),
+        PointerType::getUnqual(SharkType::jbyte_type())),
+      LLVMValue::jint_constant(__LINE__),
+      EX_CHECK_NONE);
+  }
+
+  Value *pending_exception = get_pending_exception();
+  clear_pending_exception();
+  handle_exception(pending_exception, EX_CHECK_FULL);
+}
+
+void SharkTopLevelBlock::check_bounds(SharkValue* array, SharkValue* index) {
+  BasicBlock *out_of_bounds = function()->CreateBlock("out_of_bounds");
+  BasicBlock *in_bounds     = function()->CreateBlock("in_bounds");
+
+  Value *length = builder()->CreateArrayLength(array->jarray_value());
+  // we use an unsigned comparison to catch negative values
+  builder()->CreateCondBr(
+    builder()->CreateICmpULT(index->jint_value(), length),
+    in_bounds, out_of_bounds);
+
+  builder()->SetInsertPoint(out_of_bounds);
+  SharkState *saved_state = current_state()->copy();
+
+  call_vm(
+    builder()->throw_ArrayIndexOutOfBoundsException(),
+    builder()->CreateIntToPtr(
+      LLVMValue::intptr_constant((intptr_t) __FILE__),
+      PointerType::getUnqual(SharkType::jbyte_type())),
+    LLVMValue::jint_constant(__LINE__),
+    index->jint_value(),
+    EX_CHECK_NONE);
+
+  Value *pending_exception = get_pending_exception();
+  clear_pending_exception();
+  handle_exception(pending_exception, EX_CHECK_FULL);
+
+  set_current_state(saved_state);
+
+  builder()->SetInsertPoint(in_bounds);
+}
+
+void SharkTopLevelBlock::check_pending_exception(int action) {
+  assert(action & EAM_CHECK, "should be");
+
+  BasicBlock *exception    = function()->CreateBlock("exception");
+  BasicBlock *no_exception = function()->CreateBlock("no_exception");
+
+  Value *pending_exception = get_pending_exception();
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(pending_exception, LLVMValue::null()),
+    no_exception, exception);
+
+  builder()->SetInsertPoint(exception);
+  SharkState *saved_state = current_state()->copy();
+  if (action & EAM_MONITOR_FUDGE) {
+    // The top monitor is marked live, but the exception was thrown
+    // while setting it up so we need to mark it dead before we enter
+    // any exception handlers as they will not expect it to be there.
+    set_num_monitors(num_monitors() - 1);
+    action ^= EAM_MONITOR_FUDGE;
+  }
+  clear_pending_exception();
+  handle_exception(pending_exception, action);
+  set_current_state(saved_state);
+
+  builder()->SetInsertPoint(no_exception);
+}
+
+void SharkTopLevelBlock::compute_exceptions() {
+  ciExceptionHandlerStream str(target(), start());
+
+  int exc_count = str.count();
+  _exc_handlers = new GrowableArray<ciExceptionHandler*>(exc_count);
+  _exceptions   = new GrowableArray<SharkTopLevelBlock*>(exc_count);
+
+  int index = 0;
+  for (; !str.is_done(); str.next()) {
+    ciExceptionHandler *handler = str.handler();
+    if (handler->handler_bci() == -1)
+      break;
+    _exc_handlers->append(handler);
+
+    // Try and get this exception's handler from typeflow.  We should
+    // do it this way always, really, except that typeflow sometimes
+    // doesn't record exceptions, even loaded ones, and sometimes it
+    // returns them with a different handler bci.  Why???
+    SharkTopLevelBlock *block = NULL;
+    ciInstanceKlass* klass;
+    if (handler->is_catch_all()) {
+      klass = java_lang_Throwable_klass();
+    }
+    else {
+      klass = handler->catch_klass();
+    }
+    for (int i = 0; i < ciblock()->exceptions()->length(); i++) {
+      if (klass == ciblock()->exc_klasses()->at(i)) {
+        block = function()->block(ciblock()->exceptions()->at(i)->pre_order());
+        if (block->start() == handler->handler_bci())
+          break;
+        else
+          block = NULL;
+      }
+    }
+
+    // If typeflow let us down then try and figure it out ourselves
+    if (block == NULL) {
+      for (int i = 0; i < function()->block_count(); i++) {
+        SharkTopLevelBlock *candidate = function()->block(i);
+        if (candidate->start() == handler->handler_bci()) {
+          if (block != NULL) {
+            NOT_PRODUCT(warning("there may be trouble ahead"));
+            block = NULL;
+            break;
+          }
+          block = candidate;
+        }
+      }
+    }
+    _exceptions->append(block);
+  }
+}
+
+void SharkTopLevelBlock::handle_exception(Value* exception, int action) {
+  if (action & EAM_HANDLE && num_exceptions() != 0) {
+    // Clear the stack and push the exception onto it
+    while (xstack_depth())
+      pop();
+    push(SharkValue::create_jobject(exception, true));
+
+    // Work out how many options we have to check
+    bool has_catch_all = exc_handler(num_exceptions() - 1)->is_catch_all();
+    int num_options = num_exceptions();
+    if (has_catch_all)
+      num_options--;
+
+    // Marshal any non-catch-all handlers
+    if (num_options > 0) {
+      bool all_loaded = true;
+      for (int i = 0; i < num_options; i++) {
+        if (!exc_handler(i)->catch_klass()->is_loaded()) {
+          all_loaded = false;
+          break;
+        }
+      }
+
+      if (all_loaded)
+        marshal_exception_fast(num_options);
+      else
+        marshal_exception_slow(num_options);
+    }
+
+    // Install the catch-all handler, if present
+    if (has_catch_all) {
+      SharkTopLevelBlock* handler = this->exception(num_options);
+      assert(handler != NULL, "catch-all handler cannot be unloaded");
+
+      builder()->CreateBr(handler->entry_block());
+      handler->add_incoming(current_state());
+      return;
+    }
+  }
+
+  // No exception handler was found; unwind and return
+  handle_return(T_VOID, exception);
+}
+
+void SharkTopLevelBlock::marshal_exception_fast(int num_options) {
+  Value *exception_klass = builder()->CreateValueOfStructEntry(
+    xstack(0)->jobject_value(),
+    in_ByteSize(oopDesc::klass_offset_in_bytes()),
+    SharkType::oop_type(),
+    "exception_klass");
+
+  for (int i = 0; i < num_options; i++) {
+    Value *check_klass =
+      builder()->CreateInlineOop(exc_handler(i)->catch_klass());
+
+    BasicBlock *not_exact   = function()->CreateBlock("not_exact");
+    BasicBlock *not_subtype = function()->CreateBlock("not_subtype");
+
+    builder()->CreateCondBr(
+      builder()->CreateICmpEQ(check_klass, exception_klass),
+      handler_for_exception(i), not_exact);
+
+    builder()->SetInsertPoint(not_exact);
+    builder()->CreateCondBr(
+      builder()->CreateICmpNE(
+        builder()->CreateCall2(
+          builder()->is_subtype_of(), check_klass, exception_klass),
+        LLVMValue::jbyte_constant(0)),
+      handler_for_exception(i), not_subtype);
+
+    builder()->SetInsertPoint(not_subtype);
+  }
+}
+
+void SharkTopLevelBlock::marshal_exception_slow(int num_options) {
+  int *indexes = NEW_RESOURCE_ARRAY(int, num_options);
+  for (int i = 0; i < num_options; i++)
+    indexes[i] = exc_handler(i)->catch_klass_index();
+
+  Value *index = call_vm(
+    builder()->find_exception_handler(),
+    builder()->CreateInlineData(
+      indexes,
+      num_options * sizeof(int),
+      PointerType::getUnqual(SharkType::jint_type())),
+    LLVMValue::jint_constant(num_options),
+    EX_CHECK_NO_CATCH);
+
+  BasicBlock *no_handler = function()->CreateBlock("no_handler");
+  SwitchInst *switchinst = builder()->CreateSwitch(
+    index, no_handler, num_options);
+
+  for (int i = 0; i < num_options; i++) {
+    switchinst->addCase(
+      LLVMValue::jint_constant(i),
+      handler_for_exception(i));
+  }
+
+  builder()->SetInsertPoint(no_handler);
+}
+
+BasicBlock* SharkTopLevelBlock::handler_for_exception(int index) {
+  SharkTopLevelBlock *successor = this->exception(index);
+  if (successor) {
+    successor->add_incoming(current_state());
+    return successor->entry_block();
+  }
+  else {
+    return make_trap(
+      exc_handler(index)->handler_bci(),
+      Deoptimization::make_trap_request(
+        Deoptimization::Reason_unhandled,
+        Deoptimization::Action_reinterpret));
+  }
+}
+
+void SharkTopLevelBlock::maybe_add_safepoint() {
+  if (current_state()->has_safepointed())
+    return;
+
+  BasicBlock *orig_block = builder()->GetInsertBlock();
+  SharkState *orig_state = current_state()->copy();
+
+  BasicBlock *do_safepoint = function()->CreateBlock("do_safepoint");
+  BasicBlock *safepointed  = function()->CreateBlock("safepointed");
+
+  Value *state = builder()->CreateLoad(
+    builder()->CreateIntToPtr(
+      LLVMValue::intptr_constant(
+        (intptr_t) SafepointSynchronize::address_of_state()),
+      PointerType::getUnqual(SharkType::jint_type())),
+    "state");
+
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(
+      state,
+      LLVMValue::jint_constant(SafepointSynchronize::_synchronizing)),
+    do_safepoint, safepointed);
+
+  builder()->SetInsertPoint(do_safepoint);
+  call_vm(builder()->safepoint(), EX_CHECK_FULL);
+  BasicBlock *safepointed_block = builder()->GetInsertBlock();
+  builder()->CreateBr(safepointed);
+
+  builder()->SetInsertPoint(safepointed);
+  current_state()->merge(orig_state, orig_block, safepointed_block);
+
+  current_state()->set_has_safepointed(true);
+}
+
+void SharkTopLevelBlock::maybe_add_backedge_safepoint() {
+  if (current_state()->has_safepointed())
+    return;
+
+  for (int i = 0; i < num_successors(); i++) {
+    if (successor(i)->can_reach(this)) {
+      maybe_add_safepoint();
+      break;
+    }
+  }
+}
+
+bool SharkTopLevelBlock::can_reach(SharkTopLevelBlock* other) {
+  for (int i = 0; i < function()->block_count(); i++)
+    function()->block(i)->_can_reach_visited = false;
+
+  return can_reach_helper(other);
+}
+
+bool SharkTopLevelBlock::can_reach_helper(SharkTopLevelBlock* other) {
+  if (this == other)
+    return true;
+
+  if (_can_reach_visited)
+    return false;
+  _can_reach_visited = true;
+
+  if (!has_trap()) {
+    for (int i = 0; i < num_successors(); i++) {
+      if (successor(i)->can_reach_helper(other))
+        return true;
+    }
+  }
+
+  for (int i = 0; i < num_exceptions(); i++) {
+    SharkTopLevelBlock *handler = exception(i);
+    if (handler && handler->can_reach_helper(other))
+      return true;
+  }
+
+  return false;
+}
+
+BasicBlock* SharkTopLevelBlock::make_trap(int trap_bci, int trap_request) {
+  BasicBlock *trap_block = function()->CreateBlock("trap");
+  BasicBlock *orig_block = builder()->GetInsertBlock();
+  builder()->SetInsertPoint(trap_block);
+
+  int orig_bci = bci();
+  iter()->force_bci(trap_bci);
+
+  do_trap(trap_request);
+
+  builder()->SetInsertPoint(orig_block);
+  iter()->force_bci(orig_bci);
+
+  return trap_block;
+}
+
+void SharkTopLevelBlock::do_trap(int trap_request) {
+  decache_for_trap();
+  builder()->CreateRet(
+    builder()->CreateCall2(
+      builder()->uncommon_trap(),
+      thread(),
+      LLVMValue::jint_constant(trap_request)));
+}
+
+void SharkTopLevelBlock::call_register_finalizer(Value *receiver) {
+  BasicBlock *orig_block = builder()->GetInsertBlock();
+  SharkState *orig_state = current_state()->copy();
+
+  BasicBlock *do_call = function()->CreateBlock("has_finalizer");
+  BasicBlock *done    = function()->CreateBlock("done");
+
+  Value *klass = builder()->CreateValueOfStructEntry(
+    receiver,
+    in_ByteSize(oopDesc::klass_offset_in_bytes()),
+    SharkType::oop_type(),
+    "klass");
+
+  Value *klass_part = builder()->CreateAddressOfStructEntry(
+    klass,
+    in_ByteSize(klassOopDesc::klass_part_offset_in_bytes()),
+    SharkType::klass_type(),
+    "klass_part");
+
+  Value *access_flags = builder()->CreateValueOfStructEntry(
+    klass_part,
+    in_ByteSize(Klass::access_flags_offset_in_bytes()),
+    SharkType::jint_type(),
+    "access_flags");
+
+  builder()->CreateCondBr(
+    builder()->CreateICmpNE(
+      builder()->CreateAnd(
+        access_flags,
+        LLVMValue::jint_constant(JVM_ACC_HAS_FINALIZER)),
+      LLVMValue::jint_constant(0)),
+    do_call, done);
+
+  builder()->SetInsertPoint(do_call);
+  call_vm(builder()->register_finalizer(), receiver, EX_CHECK_FULL);
+  BasicBlock *branch_block = builder()->GetInsertBlock();
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(done);
+  current_state()->merge(orig_state, orig_block, branch_block);
+}
+
+void SharkTopLevelBlock::handle_return(BasicType type, Value* exception) {
+  assert (exception == NULL || type == T_VOID, "exception OR result, please");
+
+  if (num_monitors()) {
+    // Protect our exception across possible monitor release decaches
+    if (exception)
+      set_oop_tmp(exception);
+
+    // We don't need to check for exceptions thrown here.  If
+    // we're returning a value then we just carry on as normal:
+    // the caller will see the pending exception and handle it.
+    // If we're returning with an exception then that exception
+    // takes priority and the release_lock one will be ignored.
+    while (num_monitors())
+      release_lock(EX_CHECK_NONE);
+
+    // Reload the exception we're throwing
+    if (exception)
+      exception = get_oop_tmp();
+  }
+
+  if (exception) {
+    builder()->CreateStore(exception, pending_exception_address());
+  }
+
+  Value *result_addr = stack()->CreatePopFrame(type2size[type]);
+  if (type != T_VOID) {
+    builder()->CreateStore(
+      pop_result(type)->generic_value(),
+      builder()->CreateIntToPtr(
+        result_addr,
+        PointerType::getUnqual(SharkType::to_stackType(type))));
+  }
+
+  builder()->CreateRet(LLVMValue::jint_constant(0));
+}
+
+void SharkTopLevelBlock::do_arraylength() {
+  SharkValue *array = pop();
+  check_null(array);
+  Value *length = builder()->CreateArrayLength(array->jarray_value());
+  push(SharkValue::create_jint(length, false));
+}
+
+void SharkTopLevelBlock::do_aload(BasicType basic_type) {
+  SharkValue *index = pop();
+  SharkValue *array = pop();
+
+  check_null(array);
+  check_bounds(array, index);
+
+  Value *value = builder()->CreateLoad(
+    builder()->CreateArrayAddress(
+      array->jarray_value(), basic_type, index->jint_value()));
+
+  const Type *stack_type = SharkType::to_stackType(basic_type);
+  if (value->getType() != stack_type)
+    value = builder()->CreateIntCast(value, stack_type, basic_type != T_CHAR);
+
+  switch (basic_type) {
+  case T_BYTE:
+  case T_CHAR:
+  case T_SHORT:
+  case T_INT:
+    push(SharkValue::create_jint(value, false));
+    break;
+
+  case T_LONG:
+    push(SharkValue::create_jlong(value, false));
+    break;
+
+  case T_FLOAT:
+    push(SharkValue::create_jfloat(value));
+    break;
+
+  case T_DOUBLE:
+    push(SharkValue::create_jdouble(value));
+    break;
+
+  case T_OBJECT:
+    // You might expect that array->type()->is_array_klass() would
+    // always be true, but it isn't.  If ciTypeFlow detects that a
+    // value is always null then that value becomes an untyped null
+    // object.  Shark doesn't presently support this, so a generic
+    // T_OBJECT is created.  In this case we guess the type using
+    // the BasicType we were supplied.  In reality the generated
+    // code will never be used, as the null value will be caught
+    // by the above null pointer check.
+    // http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=324
+    push(
+      SharkValue::create_generic(
+        array->type()->is_array_klass() ?
+          ((ciArrayKlass *) array->type())->element_type() :
+          ciType::make(basic_type),
+        value, false));
+    break;
+
+  default:
+    tty->print_cr("Unhandled type %s", type2name(basic_type));
+    ShouldNotReachHere();
+  }
+}
+
+void SharkTopLevelBlock::do_astore(BasicType basic_type) {
+  SharkValue *svalue = pop();
+  SharkValue *index  = pop();
+  SharkValue *array  = pop();
+
+  check_null(array);
+  check_bounds(array, index);
+
+  Value *value;
+  switch (basic_type) {
+  case T_BYTE:
+  case T_CHAR:
+  case T_SHORT:
+  case T_INT:
+    value = svalue->jint_value();
+    break;
+
+  case T_LONG:
+    value = svalue->jlong_value();
+    break;
+
+  case T_FLOAT:
+    value = svalue->jfloat_value();
+    break;
+
+  case T_DOUBLE:
+    value = svalue->jdouble_value();
+    break;
+
+  case T_OBJECT:
+    value = svalue->jobject_value();
+    // XXX assignability check
+    break;
+
+  default:
+    tty->print_cr("Unhandled type %s", type2name(basic_type));
+    ShouldNotReachHere();
+  }
+
+  const Type *array_type = SharkType::to_arrayType(basic_type);
+  if (value->getType() != array_type)
+    value = builder()->CreateIntCast(value, array_type, basic_type != T_CHAR);
+
+  Value *addr = builder()->CreateArrayAddress(
+    array->jarray_value(), basic_type, index->jint_value(), "addr");
+
+  builder()->CreateStore(value, addr);
+
+  if (basic_type == T_OBJECT) // XXX or T_ARRAY?
+    builder()->CreateUpdateBarrierSet(oopDesc::bs(), addr);
+}
+
+void SharkTopLevelBlock::do_return(BasicType type) {
+  if (target()->intrinsic_id() == vmIntrinsics::_Object_init)
+    call_register_finalizer(local(0)->jobject_value());
+  maybe_add_safepoint();
+  handle_return(type, NULL);
+}
+
+void SharkTopLevelBlock::do_athrow() {
+  SharkValue *exception = pop();
+  check_null(exception);
+  handle_exception(exception->jobject_value(), EX_CHECK_FULL);
+}
+
+void SharkTopLevelBlock::do_goto() {
+  do_branch(ciTypeFlow::GOTO_TARGET);
+}
+
+void SharkTopLevelBlock::do_jsr() {
+  push(SharkValue::address_constant(iter()->next_bci()));
+  do_branch(ciTypeFlow::GOTO_TARGET);
+}
+
+void SharkTopLevelBlock::do_ret() {
+  assert(local(iter()->get_index())->address_value() ==
+         successor(ciTypeFlow::GOTO_TARGET)->start(), "should be");
+  do_branch(ciTypeFlow::GOTO_TARGET);
+}
+
+// All propagation of state from one block to the next (via
+// dest->add_incoming) is handled by these methods:
+//   do_branch
+//   do_if_helper
+//   do_switch
+//   handle_exception
+
+void SharkTopLevelBlock::do_branch(int successor_index) {
+  SharkTopLevelBlock *dest = successor(successor_index);
+  builder()->CreateBr(dest->entry_block());
+  dest->add_incoming(current_state());
+}
+
+void SharkTopLevelBlock::do_if(ICmpInst::Predicate p,
+                               SharkValue*         b,
+                               SharkValue*         a) {
+  Value *llvm_a, *llvm_b;
+  if (a->is_jobject()) {
+    llvm_a = a->intptr_value(builder());
+    llvm_b = b->intptr_value(builder());
+  }
+  else {
+    llvm_a = a->jint_value();
+    llvm_b = b->jint_value();
+  }
+  do_if_helper(p, llvm_b, llvm_a, current_state(), current_state());
+}
+
+void SharkTopLevelBlock::do_if_helper(ICmpInst::Predicate p,
+                                      Value*              b,
+                                      Value*              a,
+                                      SharkState*         if_taken_state,
+                                      SharkState*         not_taken_state) {
+  SharkTopLevelBlock *if_taken  = successor(ciTypeFlow::IF_TAKEN);
+  SharkTopLevelBlock *not_taken = successor(ciTypeFlow::IF_NOT_TAKEN);
+
+  builder()->CreateCondBr(
+    builder()->CreateICmp(p, a, b),
+    if_taken->entry_block(), not_taken->entry_block());
+
+  if_taken->add_incoming(if_taken_state);
+  not_taken->add_incoming(not_taken_state);
+}
+
+void SharkTopLevelBlock::do_switch() {
+  int len = switch_table_length();
+
+  SharkTopLevelBlock *dest_block = successor(ciTypeFlow::SWITCH_DEFAULT);
+  SwitchInst *switchinst = builder()->CreateSwitch(
+    pop()->jint_value(), dest_block->entry_block(), len);
+  dest_block->add_incoming(current_state());
+
+  for (int i = 0; i < len; i++) {
+    int dest_bci = switch_dest(i);
+    if (dest_bci != switch_default_dest()) {
+      dest_block = bci_successor(dest_bci);
+      switchinst->addCase(
+        LLVMValue::jint_constant(switch_key(i)),
+        dest_block->entry_block());
+      dest_block->add_incoming(current_state());
+    }
+  }
+}
+
+ciMethod* SharkTopLevelBlock::improve_virtual_call(ciMethod*   caller,
+                                              ciInstanceKlass* klass,
+                                              ciMethod*        dest_method,
+                                              ciType*          receiver_type) {
+  // If the method is obviously final then we are already done
+  if (dest_method->can_be_statically_bound())
+    return dest_method;
+
+  // Array methods are all inherited from Object and are monomorphic
+  if (receiver_type->is_array_klass() &&
+      dest_method->holder() == java_lang_Object_klass())
+    return dest_method;
+
+#ifdef SHARK_CAN_DEOPTIMIZE_ANYWHERE
+  // This code can replace a virtual call with a direct call if this
+  // class is the only one in the entire set of loaded classes that
+  // implements this method.  This makes the compiled code dependent
+  // on other classes that implement the method not being loaded, a
+  // condition which is enforced by the dependency tracker.  If the
+  // dependency tracker determines a method has become invalid it
+  // will mark it for recompilation, causing running copies to be
+  // deoptimized.  Shark currently can't deoptimize arbitrarily like
+  // that, so this optimization cannot be used.
+  // http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=481
+
+  // All other interesting cases are instance classes
+  if (!receiver_type->is_instance_klass())
+    return NULL;
+
+  // Attempt to improve the receiver
+  ciInstanceKlass* actual_receiver = klass;
+  ciInstanceKlass *improved_receiver = receiver_type->as_instance_klass();
+  if (improved_receiver->is_loaded() &&
+      improved_receiver->is_initialized() &&
+      !improved_receiver->is_interface() &&
+      improved_receiver->is_subtype_of(actual_receiver)) {
+    actual_receiver = improved_receiver;
+  }
+
+  // Attempt to find a monomorphic target for this call using
+  // class heirachy analysis.
+  ciInstanceKlass *calling_klass = caller->holder();
+  ciMethod* monomorphic_target =
+    dest_method->find_monomorphic_target(calling_klass, klass, actual_receiver);
+  if (monomorphic_target != NULL) {
+    assert(!monomorphic_target->is_abstract(), "shouldn't be");
+
+    // Opto has a bunch of type checking here that I don't
+    // understand.  It's to inhibit casting in one direction,
+    // possibly because objects in Opto can have inexact
+    // types, but I can't even tell which direction it
+    // doesn't like.  For now I'm going to block *any* cast.
+    if (monomorphic_target != dest_method) {
+      if (SharkPerformanceWarnings) {
+        warning("found monomorphic target, but inhibited cast:");
+        tty->print("  dest_method = ");
+        dest_method->print_short_name(tty);
+        tty->cr();
+        tty->print("  monomorphic_target = ");
+        monomorphic_target->print_short_name(tty);
+        tty->cr();
+      }
+      monomorphic_target = NULL;
+    }
+  }
+
+  // Replace the virtual call with a direct one.  This makes
+  // us dependent on that target method not getting overridden
+  // by dynamic class loading.
+  if (monomorphic_target != NULL) {
+    dependencies()->assert_unique_concrete_method(
+      actual_receiver, monomorphic_target);
+    return monomorphic_target;
+  }
+
+  // Because Opto distinguishes exact types from inexact ones
+  // it can perform a further optimization to replace calls
+  // with non-monomorphic targets if the receiver has an exact
+  // type.  We don't mark types this way, so we can't do this.
+
+#endif // SHARK_CAN_DEOPTIMIZE_ANYWHERE
+
+  return NULL;
+}
+
+Value *SharkTopLevelBlock::get_direct_callee(ciMethod* method) {
+  return builder()->CreateBitCast(
+    builder()->CreateInlineOop(method),
+    SharkType::methodOop_type(),
+    "callee");
+}
+
+Value *SharkTopLevelBlock::get_virtual_callee(SharkValue* receiver,
+                                              int vtable_index) {
+  Value *klass = builder()->CreateValueOfStructEntry(
+    receiver->jobject_value(),
+    in_ByteSize(oopDesc::klass_offset_in_bytes()),
+    SharkType::oop_type(),
+    "klass");
+
+  return builder()->CreateLoad(
+    builder()->CreateArrayAddress(
+      klass,
+      SharkType::methodOop_type(),
+      vtableEntry::size() * wordSize,
+      in_ByteSize(instanceKlass::vtable_start_offset() * wordSize),
+      LLVMValue::intptr_constant(vtable_index)),
+    "callee");
+}
+
+Value* SharkTopLevelBlock::get_interface_callee(SharkValue *receiver,
+                                                ciMethod*   method) {
+  BasicBlock *loop       = function()->CreateBlock("loop");
+  BasicBlock *got_null   = function()->CreateBlock("got_null");
+  BasicBlock *not_null   = function()->CreateBlock("not_null");
+  BasicBlock *next       = function()->CreateBlock("next");
+  BasicBlock *got_entry  = function()->CreateBlock("got_entry");
+
+  // Locate the receiver's itable
+  Value *object_klass = builder()->CreateValueOfStructEntry(
+    receiver->jobject_value(), in_ByteSize(oopDesc::klass_offset_in_bytes()),
+    SharkType::oop_type(),
+    "object_klass");
+
+  Value *vtable_start = builder()->CreateAdd(
+    builder()->CreatePtrToInt(object_klass, SharkType::intptr_type()),
+    LLVMValue::intptr_constant(
+      instanceKlass::vtable_start_offset() * HeapWordSize),
+    "vtable_start");
+
+  Value *vtable_length = builder()->CreateValueOfStructEntry(
+    object_klass,
+    in_ByteSize(instanceKlass::vtable_length_offset() * HeapWordSize),
+    SharkType::jint_type(),
+    "vtable_length");
+  vtable_length =
+    builder()->CreateIntCast(vtable_length, SharkType::intptr_type(), false);
+
+  bool needs_aligning = HeapWordsPerLong > 1;
+  Value *itable_start = builder()->CreateAdd(
+    vtable_start,
+    builder()->CreateShl(
+      vtable_length,
+      LLVMValue::intptr_constant(exact_log2(vtableEntry::size() * wordSize))),
+    needs_aligning ? "" : "itable_start");
+  if (needs_aligning) {
+    itable_start = builder()->CreateAnd(
+      builder()->CreateAdd(
+        itable_start, LLVMValue::intptr_constant(BytesPerLong - 1)),
+      LLVMValue::intptr_constant(~(BytesPerLong - 1)),
+      "itable_start");
+  }
+
+  // Locate this interface's entry in the table
+  Value *iklass = builder()->CreateInlineOop(method->holder());
+  BasicBlock *loop_entry = builder()->GetInsertBlock();
+  builder()->CreateBr(loop);
+  builder()->SetInsertPoint(loop);
+  PHINode *itable_entry_addr = builder()->CreatePHI(
+    SharkType::intptr_type(), "itable_entry_addr");
+  itable_entry_addr->addIncoming(itable_start, loop_entry);
+
+  Value *itable_entry = builder()->CreateIntToPtr(
+    itable_entry_addr, SharkType::itableOffsetEntry_type(), "itable_entry");
+
+  Value *itable_iklass = builder()->CreateValueOfStructEntry(
+    itable_entry,
+    in_ByteSize(itableOffsetEntry::interface_offset_in_bytes()),
+    SharkType::oop_type(),
+    "itable_iklass");
+
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(itable_iklass, LLVMValue::null()),
+    got_null, not_null);
+
+  // A null entry means that the class doesn't implement the
+  // interface, and wasn't the same as the class checked when
+  // the interface was resolved.
+  builder()->SetInsertPoint(got_null);
+  builder()->CreateUnimplemented(__FILE__, __LINE__);
+  builder()->CreateUnreachable();
+
+  builder()->SetInsertPoint(not_null);
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(itable_iklass, iklass),
+    got_entry, next);
+
+  builder()->SetInsertPoint(next);
+  Value *next_entry = builder()->CreateAdd(
+    itable_entry_addr,
+    LLVMValue::intptr_constant(itableOffsetEntry::size() * wordSize));
+  builder()->CreateBr(loop);
+  itable_entry_addr->addIncoming(next_entry, next);
+
+  // Locate the method pointer
+  builder()->SetInsertPoint(got_entry);
+  Value *offset = builder()->CreateValueOfStructEntry(
+    itable_entry,
+    in_ByteSize(itableOffsetEntry::offset_offset_in_bytes()),
+    SharkType::jint_type(),
+    "offset");
+  offset =
+    builder()->CreateIntCast(offset, SharkType::intptr_type(), false);
+
+  return builder()->CreateLoad(
+    builder()->CreateIntToPtr(
+      builder()->CreateAdd(
+        builder()->CreateAdd(
+          builder()->CreateAdd(
+            builder()->CreatePtrToInt(
+              object_klass, SharkType::intptr_type()),
+            offset),
+          LLVMValue::intptr_constant(
+            method->itable_index() * itableMethodEntry::size() * wordSize)),
+        LLVMValue::intptr_constant(
+          itableMethodEntry::method_offset_in_bytes())),
+      PointerType::getUnqual(SharkType::methodOop_type())),
+    "callee");
+}
+
+void SharkTopLevelBlock::do_call() {
+  // Set frequently used booleans
+  bool is_static = bc() == Bytecodes::_invokestatic;
+  bool is_virtual = bc() == Bytecodes::_invokevirtual;
+  bool is_interface = bc() == Bytecodes::_invokeinterface;
+
+  // Find the method being called
+  bool will_link;
+  ciMethod *dest_method = iter()->get_method(will_link);
+  assert(will_link, "typeflow responsibility");
+  assert(dest_method->is_static() == is_static, "must match bc");
+
+  // Find the class of the method being called.  Note
+  // that the superclass check in the second assertion
+  // is to cope with a hole in the spec that allows for
+  // invokeinterface instructions where the resolved
+  // method is a virtual method in java.lang.Object.
+  // javac doesn't generate code like that, but there's
+  // no reason a compliant Java compiler might not.
+  ciInstanceKlass *holder_klass  = dest_method->holder();
+  assert(holder_klass->is_loaded(), "scan_for_traps responsibility");
+  assert(holder_klass->is_interface() ||
+         holder_klass->super() == NULL ||
+         !is_interface, "must match bc");
+  ciKlass *holder = iter()->get_declared_method_holder();
+  ciInstanceKlass *klass =
+    ciEnv::get_instance_klass_for_declared_method_holder(holder);
+
+  // Find the receiver in the stack.  We do this before
+  // trying to inline because the inliner can only use
+  // zero-checked values, not being able to perform the
+  // check itself.
+  SharkValue *receiver = NULL;
+  if (!is_static) {
+    receiver = xstack(dest_method->arg_size() - 1);
+    check_null(receiver);
+  }
+
+  // Try to improve non-direct calls
+  bool call_is_virtual = is_virtual || is_interface;
+  ciMethod *call_method = dest_method;
+  if (call_is_virtual) {
+    ciMethod *optimized_method = improve_virtual_call(
+      target(), klass, dest_method, receiver->type());
+    if (optimized_method) {
+      call_method = optimized_method;
+      call_is_virtual = false;
+    }
+  }
+
+  // Try to inline the call
+  if (!call_is_virtual) {
+    if (SharkInliner::attempt_inline(call_method, current_state()))
+      return;
+  }
+
+  // Find the method we are calling
+  Value *callee;
+  if (call_is_virtual) {
+    if (is_virtual) {
+      assert(klass->is_linked(), "scan_for_traps responsibility");
+      int vtable_index = call_method->resolve_vtable_index(
+        target()->holder(), klass);
+      assert(vtable_index >= 0, "should be");
+      callee = get_virtual_callee(receiver, vtable_index);
+    }
+    else {
+      assert(is_interface, "should be");
+      callee = get_interface_callee(receiver, call_method);
+    }
+  }
+  else {
+    callee = get_direct_callee(call_method);
+  }
+
+  // Load the SharkEntry from the callee
+  Value *base_pc = builder()->CreateValueOfStructEntry(
+    callee, methodOopDesc::from_interpreted_offset(),
+    SharkType::intptr_type(),
+    "base_pc");
+
+  // Load the entry point from the SharkEntry
+  Value *entry_point = builder()->CreateLoad(
+    builder()->CreateIntToPtr(
+      builder()->CreateAdd(
+        base_pc,
+        LLVMValue::intptr_constant(in_bytes(ZeroEntry::entry_point_offset()))),
+      PointerType::getUnqual(
+        PointerType::getUnqual(SharkType::entry_point_type()))),
+    "entry_point");
+
+  // Make the call
+  decache_for_Java_call(call_method);
+  Value *deoptimized_frames = builder()->CreateCall3(
+    entry_point, callee, base_pc, thread());
+
+  // If the callee got deoptimized then reexecute in the interpreter
+  BasicBlock *reexecute      = function()->CreateBlock("reexecute");
+  BasicBlock *call_completed = function()->CreateBlock("call_completed");
+  builder()->CreateCondBr(
+    builder()->CreateICmpNE(deoptimized_frames, LLVMValue::jint_constant(0)),
+    reexecute, call_completed);
+
+  builder()->SetInsertPoint(reexecute);
+  builder()->CreateCall2(
+    builder()->deoptimized_entry_point(),
+    builder()->CreateSub(deoptimized_frames, LLVMValue::jint_constant(1)),
+    thread());
+  builder()->CreateBr(call_completed);
+
+  // Cache after the call
+  builder()->SetInsertPoint(call_completed);
+  cache_after_Java_call(call_method);
+
+  // Check for pending exceptions
+  check_pending_exception(EX_CHECK_FULL);
+
+  // Mark that a safepoint check has occurred
+  current_state()->set_has_safepointed(true);
+}
+
+bool SharkTopLevelBlock::static_subtype_check(ciKlass* check_klass,
+                                              ciKlass* object_klass) {
+  // If the class we're checking against is java.lang.Object
+  // then this is a no brainer.  Apparently this can happen
+  // in reflective code...
+  if (check_klass == java_lang_Object_klass())
+    return true;
+
+  // Perform a subtype check.  NB in opto's code for this
+  // (GraphKit::static_subtype_check) it says that static
+  // interface types cannot be trusted, and if opto can't
+  // trust them then I assume we can't either.
+  if (object_klass->is_loaded() && !object_klass->is_interface()) {
+    if (object_klass == check_klass)
+      return true;
+
+    if (check_klass->is_loaded() && object_klass->is_subtype_of(check_klass))
+      return true;
+  }
+
+  return false;
+}
+
+void SharkTopLevelBlock::do_instance_check() {
+  // Get the class we're checking against
+  bool will_link;
+  ciKlass *check_klass = iter()->get_klass(will_link);
+
+  // Get the class of the object we're checking
+  ciKlass *object_klass = xstack(0)->type()->as_klass();
+
+  // Can we optimize this check away?
+  if (static_subtype_check(check_klass, object_klass)) {
+    if (bc() == Bytecodes::_instanceof) {
+      pop();
+      push(SharkValue::jint_constant(1));
+    }
+    return;
+  }
+
+  // Need to check this one at runtime
+  if (will_link)
+    do_full_instance_check(check_klass);
+  else
+    do_trapping_instance_check(check_klass);
+}
+
+bool SharkTopLevelBlock::maybe_do_instanceof_if() {
+  // Get the class we're checking against
+  bool will_link;
+  ciKlass *check_klass = iter()->get_klass(will_link);
+
+  // If the class is unloaded then the instanceof
+  // cannot possibly succeed.
+  if (!will_link)
+    return false;
+
+  // Keep a copy of the object we're checking
+  SharkValue *old_object = xstack(0);
+
+  // Get the class of the object we're checking
+  ciKlass *object_klass = old_object->type()->as_klass();
+
+  // If the instanceof can be optimized away at compile time
+  // then any subsequent checkcasts will be too so we handle
+  // it normally.
+  if (static_subtype_check(check_klass, object_klass))
+    return false;
+
+  // Perform the instance check
+  do_full_instance_check(check_klass);
+  Value *result = pop()->jint_value();
+
+  // Create the casted object
+  SharkValue *new_object = SharkValue::create_generic(
+    check_klass, old_object->jobject_value(), old_object->zero_checked());
+
+  // Create two copies of the current state, one with the
+  // original object and one with all instances of the
+  // original object replaced with the new, casted object.
+  SharkState *new_state = current_state();
+  SharkState *old_state = new_state->copy();
+  new_state->replace_all(old_object, new_object);
+
+  // Perform the check-and-branch
+  switch (iter()->next_bc()) {
+  case Bytecodes::_ifeq:
+    // branch if not an instance
+    do_if_helper(
+      ICmpInst::ICMP_EQ,
+      LLVMValue::jint_constant(0), result,
+      old_state, new_state);
+    break;
+
+  case Bytecodes::_ifne:
+    // branch if an instance
+    do_if_helper(
+      ICmpInst::ICMP_NE,
+      LLVMValue::jint_constant(0), result,
+      new_state, old_state);
+    break;
+
+  default:
+    ShouldNotReachHere();
+  }
+
+  return true;
+}
+
+void SharkTopLevelBlock::do_full_instance_check(ciKlass* klass) {
+  BasicBlock *not_null      = function()->CreateBlock("not_null");
+  BasicBlock *subtype_check = function()->CreateBlock("subtype_check");
+  BasicBlock *is_instance   = function()->CreateBlock("is_instance");
+  BasicBlock *not_instance  = function()->CreateBlock("not_instance");
+  BasicBlock *merge1        = function()->CreateBlock("merge1");
+  BasicBlock *merge2        = function()->CreateBlock("merge2");
+
+  enum InstanceCheckStates {
+    IC_IS_NULL,
+    IC_IS_INSTANCE,
+    IC_NOT_INSTANCE,
+  };
+
+  // Pop the object off the stack
+  Value *object = pop()->jobject_value();
+
+  // Null objects aren't instances of anything
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(object, LLVMValue::null()),
+    merge2, not_null);
+  BasicBlock *null_block = builder()->GetInsertBlock();
+
+  // Get the class we're checking against
+  builder()->SetInsertPoint(not_null);
+  Value *check_klass = builder()->CreateInlineOop(klass);
+
+  // Get the class of the object being tested
+  Value *object_klass = builder()->CreateValueOfStructEntry(
+    object, in_ByteSize(oopDesc::klass_offset_in_bytes()),
+    SharkType::oop_type(),
+    "object_klass");
+
+  // Perform the check
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(check_klass, object_klass),
+    is_instance, subtype_check);
+
+  builder()->SetInsertPoint(subtype_check);
+  builder()->CreateCondBr(
+    builder()->CreateICmpNE(
+      builder()->CreateCall2(
+        builder()->is_subtype_of(), check_klass, object_klass),
+      LLVMValue::jbyte_constant(0)),
+    is_instance, not_instance);
+
+  builder()->SetInsertPoint(is_instance);
+  builder()->CreateBr(merge1);
+
+  builder()->SetInsertPoint(not_instance);
+  builder()->CreateBr(merge1);
+
+  // First merge
+  builder()->SetInsertPoint(merge1);
+  PHINode *nonnull_result = builder()->CreatePHI(
+    SharkType::jint_type(), "nonnull_result");
+  nonnull_result->addIncoming(
+    LLVMValue::jint_constant(IC_IS_INSTANCE), is_instance);
+  nonnull_result->addIncoming(
+    LLVMValue::jint_constant(IC_NOT_INSTANCE), not_instance);
+  BasicBlock *nonnull_block = builder()->GetInsertBlock();
+  builder()->CreateBr(merge2);
+
+  // Second merge
+  builder()->SetInsertPoint(merge2);
+  PHINode *result = builder()->CreatePHI(
+    SharkType::jint_type(), "result");
+  result->addIncoming(LLVMValue::jint_constant(IC_IS_NULL), null_block);
+  result->addIncoming(nonnull_result, nonnull_block);
+
+  // Handle the result
+  if (bc() == Bytecodes::_checkcast) {
+    BasicBlock *failure = function()->CreateBlock("failure");
+    BasicBlock *success = function()->CreateBlock("success");
+
+    builder()->CreateCondBr(
+      builder()->CreateICmpNE(
+        result, LLVMValue::jint_constant(IC_NOT_INSTANCE)),
+      success, failure);
+
+    builder()->SetInsertPoint(failure);
+    SharkState *saved_state = current_state()->copy();
+
+    call_vm(
+      builder()->throw_ClassCastException(),
+      builder()->CreateIntToPtr(
+        LLVMValue::intptr_constant((intptr_t) __FILE__),
+        PointerType::getUnqual(SharkType::jbyte_type())),
+      LLVMValue::jint_constant(__LINE__),
+      EX_CHECK_NONE);
+
+    Value *pending_exception = get_pending_exception();
+    clear_pending_exception();
+    handle_exception(pending_exception, EX_CHECK_FULL);
+
+    set_current_state(saved_state);
+    builder()->SetInsertPoint(success);
+    push(SharkValue::create_generic(klass, object, false));
+  }
+  else {
+    push(
+      SharkValue::create_jint(
+        builder()->CreateIntCast(
+          builder()->CreateICmpEQ(
+            result, LLVMValue::jint_constant(IC_IS_INSTANCE)),
+          SharkType::jint_type(), false), false));
+  }
+}
+
+void SharkTopLevelBlock::do_trapping_instance_check(ciKlass* klass) {
+  BasicBlock *not_null = function()->CreateBlock("not_null");
+  BasicBlock *is_null  = function()->CreateBlock("null");
+
+  // Leave the object on the stack so it's there if we trap
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(xstack(0)->jobject_value(), LLVMValue::null()),
+    is_null, not_null);
+  SharkState *saved_state = current_state()->copy();
+
+  // If it's not null then we need to trap
+  builder()->SetInsertPoint(not_null);
+  set_current_state(saved_state->copy());
+  do_trap(
+    Deoptimization::make_trap_request(
+      Deoptimization::Reason_uninitialized,
+      Deoptimization::Action_reinterpret));
+
+  // If it's null then we're ok
+  builder()->SetInsertPoint(is_null);
+  set_current_state(saved_state);
+  if (bc() == Bytecodes::_checkcast) {
+    push(SharkValue::create_generic(klass, pop()->jobject_value(), false));
+  }
+  else {
+    pop();
+    push(SharkValue::jint_constant(0));
+  }
+}
+
+void SharkTopLevelBlock::do_new() {
+  bool will_link;
+  ciInstanceKlass* klass = iter()->get_klass(will_link)->as_instance_klass();
+  assert(will_link, "typeflow responsibility");
+
+  BasicBlock *got_tlab            = NULL;
+  BasicBlock *heap_alloc          = NULL;
+  BasicBlock *retry               = NULL;
+  BasicBlock *got_heap            = NULL;
+  BasicBlock *initialize          = NULL;
+  BasicBlock *got_fast            = NULL;
+  BasicBlock *slow_alloc_and_init = NULL;
+  BasicBlock *got_slow            = NULL;
+  BasicBlock *push_object         = NULL;
+
+  SharkState *fast_state = NULL;
+
+  Value *tlab_object = NULL;
+  Value *heap_object = NULL;
+  Value *fast_object = NULL;
+  Value *slow_object = NULL;
+  Value *object      = NULL;
+
+  // The fast path
+  if (!Klass::layout_helper_needs_slow_path(klass->layout_helper())) {
+    if (UseTLAB) {
+      got_tlab          = function()->CreateBlock("got_tlab");
+      heap_alloc        = function()->CreateBlock("heap_alloc");
+    }
+    retry               = function()->CreateBlock("retry");
+    got_heap            = function()->CreateBlock("got_heap");
+    initialize          = function()->CreateBlock("initialize");
+    slow_alloc_and_init = function()->CreateBlock("slow_alloc_and_init");
+    push_object         = function()->CreateBlock("push_object");
+
+    size_t size_in_bytes = klass->size_helper() << LogHeapWordSize;
+
+    // Thread local allocation
+    if (UseTLAB) {
+      Value *top_addr = builder()->CreateAddressOfStructEntry(
+        thread(), Thread::tlab_top_offset(),
+        PointerType::getUnqual(SharkType::intptr_type()),
+        "top_addr");
+
+      Value *end = builder()->CreateValueOfStructEntry(
+        thread(), Thread::tlab_end_offset(),
+        SharkType::intptr_type(),
+        "end");
+
+      Value *old_top = builder()->CreateLoad(top_addr, "old_top");
+      Value *new_top = builder()->CreateAdd(
+        old_top, LLVMValue::intptr_constant(size_in_bytes));
+
+      builder()->CreateCondBr(
+        builder()->CreateICmpULE(new_top, end),
+        got_tlab, heap_alloc);
+
+      builder()->SetInsertPoint(got_tlab);
+      tlab_object = builder()->CreateIntToPtr(
+        old_top, SharkType::oop_type(), "tlab_object");
+
+      builder()->CreateStore(new_top, top_addr);
+      builder()->CreateBr(initialize);
+
+      builder()->SetInsertPoint(heap_alloc);
+    }
+
+    // Heap allocation
+    Value *top_addr = builder()->CreateIntToPtr(
+        LLVMValue::intptr_constant((intptr_t) Universe::heap()->top_addr()),
+      PointerType::getUnqual(SharkType::intptr_type()),
+      "top_addr");
+
+    Value *end = builder()->CreateLoad(
+      builder()->CreateIntToPtr(
+        LLVMValue::intptr_constant((intptr_t) Universe::heap()->end_addr()),
+        PointerType::getUnqual(SharkType::intptr_type())),
+      "end");
+
+    builder()->CreateBr(retry);
+    builder()->SetInsertPoint(retry);
+
+    Value *old_top = builder()->CreateLoad(top_addr, "top");
+    Value *new_top = builder()->CreateAdd(
+      old_top, LLVMValue::intptr_constant(size_in_bytes));
+
+    builder()->CreateCondBr(
+      builder()->CreateICmpULE(new_top, end),
+      got_heap, slow_alloc_and_init);
+
+    builder()->SetInsertPoint(got_heap);
+    heap_object = builder()->CreateIntToPtr(
+      old_top, SharkType::oop_type(), "heap_object");
+
+    Value *check = builder()->CreateCmpxchgPtr(new_top, top_addr, old_top);
+    builder()->CreateCondBr(
+      builder()->CreateICmpEQ(old_top, check),
+      initialize, retry);
+
+    // Initialize the object
+    builder()->SetInsertPoint(initialize);
+    if (tlab_object) {
+      PHINode *phi = builder()->CreatePHI(
+        SharkType::oop_type(), "fast_object");
+      phi->addIncoming(tlab_object, got_tlab);
+      phi->addIncoming(heap_object, got_heap);
+      fast_object = phi;
+    }
+    else {
+      fast_object = heap_object;
+    }
+
+    builder()->CreateMemset(
+      builder()->CreateBitCast(
+        fast_object, PointerType::getUnqual(SharkType::jbyte_type())),
+      LLVMValue::jbyte_constant(0),
+      LLVMValue::jint_constant(size_in_bytes),
+      LLVMValue::jint_constant(HeapWordSize));
+
+    Value *mark_addr = builder()->CreateAddressOfStructEntry(
+      fast_object, in_ByteSize(oopDesc::mark_offset_in_bytes()),
+      PointerType::getUnqual(SharkType::intptr_type()),
+      "mark_addr");
+
+    Value *klass_addr = builder()->CreateAddressOfStructEntry(
+      fast_object, in_ByteSize(oopDesc::klass_offset_in_bytes()),
+      PointerType::getUnqual(SharkType::oop_type()),
+      "klass_addr");
+
+    // Set the mark
+    intptr_t mark;
+    if (UseBiasedLocking) {
+      Unimplemented();
+    }
+    else {
+      mark = (intptr_t) markOopDesc::prototype();
+    }
+    builder()->CreateStore(LLVMValue::intptr_constant(mark), mark_addr);
+
+    // Set the class
+    Value *rtklass = builder()->CreateInlineOop(klass);
+    builder()->CreateStore(rtklass, klass_addr);
+    got_fast = builder()->GetInsertBlock();
+
+    builder()->CreateBr(push_object);
+    builder()->SetInsertPoint(slow_alloc_and_init);
+    fast_state = current_state()->copy();
+  }
+
+  // The slow path
+  call_vm(
+    builder()->new_instance(),
+    LLVMValue::jint_constant(iter()->get_klass_index()),
+    EX_CHECK_FULL);
+  slow_object = get_vm_result();
+  got_slow = builder()->GetInsertBlock();
+
+  // Push the object
+  if (push_object) {
+    builder()->CreateBr(push_object);
+    builder()->SetInsertPoint(push_object);
+  }
+  if (fast_object) {
+    PHINode *phi = builder()->CreatePHI(SharkType::oop_type(), "object");
+    phi->addIncoming(fast_object, got_fast);
+    phi->addIncoming(slow_object, got_slow);
+    object = phi;
+    current_state()->merge(fast_state, got_fast, got_slow);
+  }
+  else {
+    object = slow_object;
+  }
+
+  push(SharkValue::create_jobject(object, true));
+}
+
+void SharkTopLevelBlock::do_newarray() {
+  BasicType type = (BasicType) iter()->get_index();
+
+  call_vm(
+    builder()->newarray(),
+    LLVMValue::jint_constant(type),
+    pop()->jint_value(),
+    EX_CHECK_FULL);
+
+  ciArrayKlass *array_klass = ciArrayKlass::make(ciType::make(type));
+  push(SharkValue::create_generic(array_klass, get_vm_result(), true));
+}
+
+void SharkTopLevelBlock::do_anewarray() {
+  bool will_link;
+  ciKlass *klass = iter()->get_klass(will_link);
+  assert(will_link, "typeflow responsibility");
+
+  ciObjArrayKlass *array_klass = ciObjArrayKlass::make(klass);
+  if (!array_klass->is_loaded()) {
+    Unimplemented();
+  }
+
+  call_vm(
+    builder()->anewarray(),
+    LLVMValue::jint_constant(iter()->get_klass_index()),
+    pop()->jint_value(),
+    EX_CHECK_FULL);
+
+  push(SharkValue::create_generic(array_klass, get_vm_result(), true));
+}
+
+void SharkTopLevelBlock::do_multianewarray() {
+  bool will_link;
+  ciArrayKlass *array_klass = iter()->get_klass(will_link)->as_array_klass();
+  assert(will_link, "typeflow responsibility");
+
+  // The dimensions are stack values, so we use their slots for the
+  // dimensions array.  Note that we are storing them in the reverse
+  // of normal stack order.
+  int ndims = iter()->get_dimensions();
+
+  Value *dimensions = stack()->slot_addr(
+    stack()->stack_slots_offset() + max_stack() - xstack_depth(),
+    ArrayType::get(SharkType::jint_type(), ndims),
+    "dimensions");
+
+  for (int i = 0; i < ndims; i++) {
+    builder()->CreateStore(
+      xstack(ndims - 1 - i)->jint_value(),
+      builder()->CreateStructGEP(dimensions, i));
+  }
+
+  call_vm(
+    builder()->multianewarray(),
+    LLVMValue::jint_constant(iter()->get_klass_index()),
+    LLVMValue::jint_constant(ndims),
+    builder()->CreateStructGEP(dimensions, 0),
+    EX_CHECK_FULL);
+
+  // Now we can pop the dimensions off the stack
+  for (int i = 0; i < ndims; i++)
+    pop();
+
+  push(SharkValue::create_generic(array_klass, get_vm_result(), true));
+}
+
+void SharkTopLevelBlock::acquire_method_lock() {
+  Value *lockee;
+  if (target()->is_static())
+    lockee = builder()->CreateInlineOop(target()->holder()->java_mirror());
+  else
+    lockee = local(0)->jobject_value();
+
+  iter()->force_bci(start()); // for the decache in acquire_lock
+  acquire_lock(lockee, EX_CHECK_NO_CATCH);
+}
+
+void SharkTopLevelBlock::do_monitorenter() {
+  SharkValue *lockee = pop();
+  check_null(lockee);
+  acquire_lock(lockee->jobject_value(), EX_CHECK_FULL);
+}
+
+void SharkTopLevelBlock::do_monitorexit() {
+  pop(); // don't need this (monitors are block structured)
+  release_lock(EX_CHECK_NO_CATCH);
+}
+
+void SharkTopLevelBlock::acquire_lock(Value *lockee, int exception_action) {
+  BasicBlock *try_recursive = function()->CreateBlock("try_recursive");
+  BasicBlock *got_recursive = function()->CreateBlock("got_recursive");
+  BasicBlock *not_recursive = function()->CreateBlock("not_recursive");
+  BasicBlock *acquired_fast = function()->CreateBlock("acquired_fast");
+  BasicBlock *lock_acquired = function()->CreateBlock("lock_acquired");
+
+  int monitor = num_monitors();
+  Value *monitor_addr        = stack()->monitor_addr(monitor);
+  Value *monitor_object_addr = stack()->monitor_object_addr(monitor);
+  Value *monitor_header_addr = stack()->monitor_header_addr(monitor);
+
+  // Store the object and mark the slot as live
+  builder()->CreateStore(lockee, monitor_object_addr);
+  set_num_monitors(monitor + 1);
+
+  // Try a simple lock
+  Value *mark_addr = builder()->CreateAddressOfStructEntry(
+    lockee, in_ByteSize(oopDesc::mark_offset_in_bytes()),
+    PointerType::getUnqual(SharkType::intptr_type()),
+    "mark_addr");
+
+  Value *mark = builder()->CreateLoad(mark_addr, "mark");
+  Value *disp = builder()->CreateOr(
+    mark, LLVMValue::intptr_constant(markOopDesc::unlocked_value), "disp");
+  builder()->CreateStore(disp, monitor_header_addr);
+
+  Value *lock = builder()->CreatePtrToInt(
+    monitor_header_addr, SharkType::intptr_type());
+  Value *check = builder()->CreateCmpxchgPtr(lock, mark_addr, disp);
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(disp, check),
+    acquired_fast, try_recursive);
+
+  // Locking failed, but maybe this thread already owns it
+  builder()->SetInsertPoint(try_recursive);
+  Value *addr = builder()->CreateAnd(
+    disp,
+    LLVMValue::intptr_constant(~markOopDesc::lock_mask_in_place));
+
+  // NB we use the entire stack, but JavaThread::is_lock_owned()
+  // uses a more limited range.  I don't think it hurts though...
+  Value *stack_limit = builder()->CreateValueOfStructEntry(
+    thread(), Thread::stack_base_offset(),
+    SharkType::intptr_type(),
+    "stack_limit");
+
+  assert(sizeof(size_t) == sizeof(intptr_t), "should be");
+  Value *stack_size = builder()->CreateValueOfStructEntry(
+    thread(), Thread::stack_size_offset(),
+    SharkType::intptr_type(),
+    "stack_size");
+
+  Value *stack_start =
+    builder()->CreateSub(stack_limit, stack_size, "stack_start");
+
+  builder()->CreateCondBr(
+    builder()->CreateAnd(
+      builder()->CreateICmpUGE(addr, stack_start),
+      builder()->CreateICmpULT(addr, stack_limit)),
+    got_recursive, not_recursive);
+
+  builder()->SetInsertPoint(got_recursive);
+  builder()->CreateStore(LLVMValue::intptr_constant(0), monitor_header_addr);
+  builder()->CreateBr(acquired_fast);
+
+  // Create an edge for the state merge
+  builder()->SetInsertPoint(acquired_fast);
+  SharkState *fast_state = current_state()->copy();
+  builder()->CreateBr(lock_acquired);
+
+  // It's not a recursive case so we need to drop into the runtime
+  builder()->SetInsertPoint(not_recursive);
+  call_vm(
+    builder()->monitorenter(), monitor_addr,
+    exception_action | EAM_MONITOR_FUDGE);
+  BasicBlock *acquired_slow = builder()->GetInsertBlock();
+  builder()->CreateBr(lock_acquired);
+
+  // All done
+  builder()->SetInsertPoint(lock_acquired);
+  current_state()->merge(fast_state, acquired_fast, acquired_slow);
+}
+
+void SharkTopLevelBlock::release_lock(int exception_action) {
+  BasicBlock *not_recursive = function()->CreateBlock("not_recursive");
+  BasicBlock *released_fast = function()->CreateBlock("released_fast");
+  BasicBlock *slow_path     = function()->CreateBlock("slow_path");
+  BasicBlock *lock_released = function()->CreateBlock("lock_released");
+
+  int monitor = num_monitors() - 1;
+  Value *monitor_addr        = stack()->monitor_addr(monitor);
+  Value *monitor_object_addr = stack()->monitor_object_addr(monitor);
+  Value *monitor_header_addr = stack()->monitor_header_addr(monitor);
+
+  // If it is recursive then we're already done
+  Value *disp = builder()->CreateLoad(monitor_header_addr);
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(disp, LLVMValue::intptr_constant(0)),
+    released_fast, not_recursive);
+
+  // Try a simple unlock
+  builder()->SetInsertPoint(not_recursive);
+
+  Value *lock = builder()->CreatePtrToInt(
+    monitor_header_addr, SharkType::intptr_type());
+
+  Value *lockee = builder()->CreateLoad(monitor_object_addr);
+
+  Value *mark_addr = builder()->CreateAddressOfStructEntry(
+    lockee, in_ByteSize(oopDesc::mark_offset_in_bytes()),
+    PointerType::getUnqual(SharkType::intptr_type()),
+    "mark_addr");
+
+  Value *check = builder()->CreateCmpxchgPtr(disp, mark_addr, lock);
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(lock, check),
+    released_fast, slow_path);
+
+  // Create an edge for the state merge
+  builder()->SetInsertPoint(released_fast);
+  SharkState *fast_state = current_state()->copy();
+  builder()->CreateBr(lock_released);
+
+  // Need to drop into the runtime to release this one
+  builder()->SetInsertPoint(slow_path);
+  call_vm(builder()->monitorexit(), monitor_addr, exception_action);
+  BasicBlock *released_slow = builder()->GetInsertBlock();
+  builder()->CreateBr(lock_released);
+
+  // All done
+  builder()->SetInsertPoint(lock_released);
+  current_state()->merge(fast_state, released_fast, released_slow);
+
+  // The object slot is now dead
+  set_num_monitors(monitor);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,430 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+class SharkTopLevelBlock : public SharkBlock {
+ public:
+  SharkTopLevelBlock(SharkFunction* function, ciTypeFlow::Block* ciblock)
+    : SharkBlock(function),
+      _function(function),
+      _ciblock(ciblock),
+      _entered(false),
+      _has_trap(false),
+      _needs_phis(false),
+      _entry_state(NULL),
+      _entry_block(NULL) {}
+
+ private:
+  SharkFunction*     _function;
+  ciTypeFlow::Block* _ciblock;
+
+ public:
+  SharkFunction* function() const {
+    return _function;
+  }
+  ciTypeFlow::Block* ciblock() const {
+    return _ciblock;
+  }
+
+  // Function properties
+ public:
+  SharkStack* stack() const {
+    return function()->stack();
+  }
+
+  // Typeflow properties
+ public:
+  int index() const {
+    return ciblock()->pre_order();
+  }
+  bool is_backedge_copy() const {
+    return ciblock()->is_backedge_copy();
+  }
+  int stack_depth_at_entry() const {
+    return ciblock()->stack_size();
+  }
+  ciType* local_type_at_entry(int index) const {
+    return ciblock()->local_type_at(index);
+  }
+  ciType* stack_type_at_entry(int slot) const {
+    return ciblock()->stack_type_at(slot);
+  }
+  int start() const {
+    return ciblock()->start();
+  }
+  int limit() const {
+    return ciblock()->limit();
+  }
+  bool falls_through() const {
+    return ciblock()->control() == ciBlock::fall_through_bci;
+  }
+  int num_successors() const {
+    return ciblock()->successors()->length();
+  }
+  SharkTopLevelBlock* successor(int index) const {
+    return function()->block(ciblock()->successors()->at(index)->pre_order());
+  }
+  SharkTopLevelBlock* bci_successor(int bci) const;
+
+  // Exceptions
+ private:
+  GrowableArray<ciExceptionHandler*>* _exc_handlers;
+  GrowableArray<SharkTopLevelBlock*>* _exceptions;
+
+ private:
+  void compute_exceptions();
+
+ private:
+  int num_exceptions() const {
+    return _exc_handlers->length();
+  }
+  ciExceptionHandler* exc_handler(int index) const {
+    return _exc_handlers->at(index);
+  }
+  SharkTopLevelBlock* exception(int index) const {
+    return _exceptions->at(index);
+  }
+
+  // Traps
+ private:
+  bool _has_trap;
+  int  _trap_request;
+  int  _trap_bci;
+
+  void set_trap(int trap_request, int trap_bci) {
+    assert(!has_trap(), "shouldn't have");
+    _has_trap     = true;
+    _trap_request = trap_request;
+    _trap_bci     = trap_bci;
+  }
+
+ private:
+  bool has_trap() {
+    return _has_trap;
+  }
+  int trap_request() {
+    assert(has_trap(), "should have");
+    return _trap_request;
+  }
+  int trap_bci() {
+    assert(has_trap(), "should have");
+    return _trap_bci;
+  }
+
+ private:
+  void scan_for_traps();
+
+ private:
+  bool static_field_ok_in_clinit(ciField* field);
+
+  // Entry state
+ private:
+  bool _entered;
+  bool _needs_phis;
+
+ public:
+  bool entered() const {
+    return _entered;
+  }
+  bool needs_phis() const {
+    return _needs_phis;
+  }
+
+ private:
+  void enter(SharkTopLevelBlock* predecessor, bool is_exception);
+
+ public:
+  void enter() {
+    enter(NULL, false);
+  }
+
+ private:
+  SharkState* _entry_state;
+
+ private:
+  SharkState* entry_state();
+
+ private:
+  llvm::BasicBlock* _entry_block;
+
+ public:
+  llvm::BasicBlock* entry_block() const {
+    return _entry_block;
+  }
+
+ public:
+  void initialize();
+
+ public:
+  void add_incoming(SharkState* incoming_state);
+
+  // Method
+ public:
+  llvm::Value* method() {
+    return current_state()->method();
+  }
+
+  // Temporary oop storage
+ public:
+  void set_oop_tmp(llvm::Value* value) {
+    assert(value, "value must be non-NULL (will be reset by get_oop_tmp)");
+    assert(!current_state()->oop_tmp(), "oop_tmp gets and sets must match");
+    current_state()->set_oop_tmp(value);
+  }
+  llvm::Value* get_oop_tmp() {
+    llvm::Value* value = current_state()->oop_tmp();
+    assert(value, "oop_tmp gets and sets must match");
+    current_state()->set_oop_tmp(NULL);
+    return value;
+  }
+
+  // Cache and decache
+ private:
+  void decache_for_Java_call(ciMethod* callee);
+  void cache_after_Java_call(ciMethod* callee);
+  void decache_for_VM_call();
+  void cache_after_VM_call();
+  void decache_for_trap();
+
+  // Monitors
+ private:
+  int num_monitors() {
+    return current_state()->num_monitors();
+  }
+  int set_num_monitors(int num_monitors) {
+    current_state()->set_num_monitors(num_monitors);
+  }
+
+  // Code generation
+ public:
+  void emit_IR();
+
+  // Branch helpers
+ private:
+  void do_branch(int successor_index);
+
+  // Zero checks
+ private:
+  void do_zero_check(SharkValue* value);
+  void zero_check_value(SharkValue* value, llvm::BasicBlock* continue_block);
+
+ public:
+  void do_deferred_zero_check(SharkValue*       value,
+                              int               bci,
+                              SharkState*       saved_state,
+                              llvm::BasicBlock* continue_block);
+  // Exceptions
+ private:
+  llvm::Value* pending_exception_address() const {
+    return builder()->CreateAddressOfStructEntry(
+      thread(), Thread::pending_exception_offset(),
+      llvm::PointerType::getUnqual(SharkType::oop_type()),
+      "pending_exception_addr");
+  }
+  llvm::LoadInst* get_pending_exception() const {
+    return builder()->CreateLoad(
+      pending_exception_address(), "pending_exception");
+  }
+  void clear_pending_exception() const {
+    builder()->CreateStore(LLVMValue::null(), pending_exception_address());
+  }
+ public:
+  enum ExceptionActionMask {
+    // The actual bitmasks that things test against
+    EAM_CHECK         = 1, // whether to check for pending exceptions
+    EAM_HANDLE        = 2, // whether to attempt to handle pending exceptions
+    EAM_MONITOR_FUDGE = 4, // whether the monitor count needs adjusting
+
+    // More convenient values for passing
+    EX_CHECK_NONE     = 0,
+    EX_CHECK_NO_CATCH = EAM_CHECK,
+    EX_CHECK_FULL     = EAM_CHECK | EAM_HANDLE
+  };
+  void check_pending_exception(int action);
+  void handle_exception(llvm::Value* exception, int action);
+  void marshal_exception_fast(int num_options);
+  void marshal_exception_slow(int num_options);
+  llvm::BasicBlock* handler_for_exception(int index);
+
+  // VM calls
+ private:
+  llvm::CallInst* call_vm(llvm::Value*  callee,
+                          llvm::Value** args_start,
+                          llvm::Value** args_end,
+                          int           exception_action) {
+    decache_for_VM_call();
+    stack()->CreateSetLastJavaFrame();
+    llvm::CallInst *res = builder()->CreateCall(callee, args_start, args_end);
+    stack()->CreateResetLastJavaFrame();
+    cache_after_VM_call();
+    if (exception_action & EAM_CHECK) {
+      check_pending_exception(exception_action);
+      current_state()->set_has_safepointed(true);
+    }
+    return res;
+  }
+
+ public:
+  llvm::CallInst* call_vm(llvm::Value* callee,
+                          int          exception_action) {
+    llvm::Value *args[] = {thread()};
+    return call_vm(callee, args, args + 1, exception_action);
+  }
+  llvm::CallInst* call_vm(llvm::Value* callee,
+                          llvm::Value* arg1,
+                          int          exception_action) {
+    llvm::Value *args[] = {thread(), arg1};
+    return call_vm(callee, args, args + 2, exception_action);
+  }
+  llvm::CallInst* call_vm(llvm::Value* callee,
+                          llvm::Value* arg1,
+                          llvm::Value* arg2,
+                          int          exception_action) {
+    llvm::Value *args[] = {thread(), arg1, arg2};
+    return call_vm(callee, args, args + 3, exception_action);
+  }
+  llvm::CallInst* call_vm(llvm::Value* callee,
+                          llvm::Value* arg1,
+                          llvm::Value* arg2,
+                          llvm::Value* arg3,
+                          int          exception_action) {
+    llvm::Value *args[] = {thread(), arg1, arg2, arg3};
+    return call_vm(callee, args, args + 4, exception_action);
+  }
+
+  // VM call oop return handling
+ private:
+  llvm::LoadInst* get_vm_result() const {
+    llvm::Value *addr = builder()->CreateAddressOfStructEntry(
+      thread(), JavaThread::vm_result_offset(),
+      llvm::PointerType::getUnqual(SharkType::oop_type()),
+      "vm_result_addr");
+    llvm::LoadInst *result = builder()->CreateLoad(addr, "vm_result");
+    builder()->CreateStore(LLVMValue::null(), addr);
+    return result;
+  }
+
+  // Synchronization
+ private:
+  void acquire_lock(llvm::Value* lockee, int exception_action);
+  void release_lock(int exception_action);
+
+ public:
+  void acquire_method_lock();
+
+  // Bounds checks
+ private:
+  void check_bounds(SharkValue* array, SharkValue* index);
+
+  // Safepoints
+ private:
+  void maybe_add_safepoint();
+  void maybe_add_backedge_safepoint();
+
+  // Loop safepoint removal
+ private:
+  bool _can_reach_visited;
+
+  bool can_reach(SharkTopLevelBlock* other);
+  bool can_reach_helper(SharkTopLevelBlock* other);
+
+  // Traps
+ private:
+  llvm::BasicBlock* make_trap(int trap_bci, int trap_request);
+  void do_trap(int trap_request);
+
+  // Returns
+ private:
+  void call_register_finalizer(llvm::Value* receiver);
+  void handle_return(BasicType type, llvm::Value* exception);
+
+  // arraylength
+ private:
+  void do_arraylength();
+
+  // *aload and *astore
+ private:
+  void do_aload(BasicType basic_type);
+  void do_astore(BasicType basic_type);
+
+  // *return and athrow
+ private:
+  void do_return(BasicType type);
+  void do_athrow();
+
+  // goto*
+ private:
+  void do_goto();
+
+  // jsr* and ret
+ private:
+  void do_jsr();
+  void do_ret();
+
+  // if*
+ private:
+  void do_if_helper(llvm::ICmpInst::Predicate p,
+                    llvm::Value*              b,
+                    llvm::Value*              a,
+                    SharkState*               if_taken_state,
+                    SharkState*               not_taken_state);
+  void do_if(llvm::ICmpInst::Predicate p, SharkValue* b, SharkValue* a);
+
+  // tableswitch and lookupswitch
+ private:
+  void do_switch();
+
+  // invoke*
+ private:
+  ciMethod* improve_virtual_call(ciMethod*        caller,
+                                 ciInstanceKlass* klass,
+                                 ciMethod*        dest_method,
+                                 ciType*          receiver_type);
+  llvm::Value* get_direct_callee(ciMethod* method);
+  llvm::Value* get_virtual_callee(SharkValue* receiver, int vtable_index);
+  llvm::Value* get_interface_callee(SharkValue* receiver, ciMethod* method);
+
+  void do_call();
+
+  // checkcast and instanceof
+ private:
+  bool static_subtype_check(ciKlass* check_klass, ciKlass* object_klass);
+  void do_full_instance_check(ciKlass* klass);
+  void do_trapping_instance_check(ciKlass* klass);
+
+  void do_instance_check();
+  bool maybe_do_instanceof_if();
+
+  // new and *newarray
+ private:
+  void do_new();
+  void do_newarray();
+  void do_anewarray();
+  void do_multianewarray();
+
+  // monitorenter and monitorexit
+ private:
+  void do_monitorenter();
+  void do_monitorexit();
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkType.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+class SharkType : public AllStatic {
+ private:
+  static SharkContext& context() {
+    return SharkContext::current();
+  }
+
+  // Basic types
+ public:
+  static const llvm::Type* void_type() {
+    return context().void_type();
+  }
+  static const llvm::IntegerType* bit_type() {
+    return context().bit_type();
+  }
+  static const llvm::IntegerType* jbyte_type() {
+    return context().jbyte_type();
+  }
+  static const llvm::IntegerType* jshort_type() {
+    return context().jshort_type();
+  }
+  static const llvm::IntegerType* jint_type() {
+    return context().jint_type();
+  }
+  static const llvm::IntegerType* jlong_type() {
+    return context().jlong_type();
+  }
+  static const llvm::Type* jfloat_type() {
+    return context().jfloat_type();
+  }
+  static const llvm::Type* jdouble_type() {
+    return context().jdouble_type();
+  }
+  static const llvm::IntegerType* intptr_type() {
+    return context().intptr_type();
+  }
+
+  // Compound types
+ public:
+  static const llvm::PointerType* itableOffsetEntry_type() {
+    return context().itableOffsetEntry_type();
+  }
+  static const llvm::PointerType* jniEnv_type() {
+    return context().jniEnv_type();
+  }
+  static const llvm::PointerType* jniHandleBlock_type() {
+    return context().jniHandleBlock_type();
+  }
+  static const llvm::PointerType* klass_type() {
+    return context().klass_type();
+  }
+  static const llvm::PointerType* methodOop_type() {
+    return context().methodOop_type();
+  }
+  static const llvm::ArrayType* monitor_type() {
+    return context().monitor_type();
+  }
+  static const llvm::PointerType* oop_type() {
+    return context().oop_type();
+  }
+  static const llvm::PointerType* thread_type() {
+    return context().thread_type();
+  }
+  static const llvm::PointerType* zeroStack_type() {
+    return context().zeroStack_type();
+  }
+  static const llvm::FunctionType* entry_point_type() {
+    return context().entry_point_type();
+  }
+  static const llvm::FunctionType* osr_entry_point_type() {
+    return context().osr_entry_point_type();
+  }
+
+  // Mappings
+ public:
+  static const llvm::Type* to_stackType(BasicType type) {
+    return context().to_stackType(type);
+  }
+  static const llvm::Type* to_stackType(ciType* type) {
+    return to_stackType(type->basic_type());
+  }
+  static const llvm::Type* to_arrayType(BasicType type) {
+    return context().to_arrayType(type);
+  }
+  static const llvm::Type* to_arrayType(ciType* type) {
+    return to_arrayType(type->basic_type());
+  }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkValue.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,260 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkValue.cpp.incl"
+
+using namespace llvm;
+
+// Cloning
+
+SharkValue* SharkNormalValue::clone() const {
+  return SharkValue::create_generic(type(), generic_value(), zero_checked());
+}
+SharkValue* SharkPHIValue::clone() const {
+  return SharkValue::create_phi(type(), (PHINode *) generic_value(), this);
+}
+SharkValue* SharkAddressValue::clone() const {
+  return SharkValue::address_constant(address_value());
+}
+
+// Casting
+
+bool SharkValue::is_phi() const {
+  return false;
+}
+bool SharkPHIValue::is_phi() const {
+  return true;
+}
+SharkPHIValue* SharkValue::as_phi() {
+  ShouldNotCallThis();
+}
+SharkPHIValue* SharkPHIValue::as_phi() {
+  return this;
+}
+
+// Comparison
+
+bool SharkNormalValue::equal_to(SharkValue *other) const {
+  return (this->type()          == other->type() &&
+          this->generic_value() == other->generic_value() &&
+          this->zero_checked()  == other->zero_checked());
+}
+bool SharkAddressValue::equal_to(SharkValue *other) const {
+  return (this->address_value() == other->address_value());
+}
+
+// Type access
+
+ciType* SharkValue::type() const {
+  ShouldNotCallThis();
+}
+ciType* SharkNormalValue::type() const {
+  return _type;
+}
+
+BasicType SharkNormalValue::basic_type() const {
+  return type()->basic_type();
+}
+BasicType SharkAddressValue::basic_type() const {
+  return T_ADDRESS;
+}
+
+int SharkNormalValue::size() const {
+  return type()->size();
+}
+int SharkAddressValue::size() const {
+  return 1;
+}
+
+bool SharkValue::is_jint() const {
+  return false;
+}
+bool SharkValue::is_jlong() const {
+  return false;
+}
+bool SharkValue::is_jfloat() const {
+  return false;
+}
+bool SharkValue::is_jdouble() const {
+  return false;
+}
+bool SharkValue::is_jobject() const {
+  return false;
+}
+bool SharkValue::is_jarray() const {
+  return false;
+}
+bool SharkValue::is_address() const {
+  return false;
+}
+
+bool SharkNormalValue::is_jint() const {
+  return llvm_value()->getType() == SharkType::jint_type();
+}
+bool SharkNormalValue::is_jlong() const {
+  return llvm_value()->getType() == SharkType::jlong_type();
+}
+bool SharkNormalValue::is_jfloat() const {
+  return llvm_value()->getType() == SharkType::jfloat_type();
+}
+bool SharkNormalValue::is_jdouble() const {
+  return llvm_value()->getType() == SharkType::jdouble_type();
+}
+bool SharkNormalValue::is_jobject() const {
+  return llvm_value()->getType() == SharkType::oop_type();
+}
+bool SharkNormalValue::is_jarray() const {
+  return basic_type() == T_ARRAY;
+}
+bool SharkAddressValue::is_address() const {
+  return true;
+}
+
+// Typed conversions from SharkValues
+
+Value* SharkValue::jint_value() const {
+  ShouldNotCallThis();
+}
+Value* SharkValue::jlong_value() const {
+  ShouldNotCallThis();
+}
+Value* SharkValue::jfloat_value() const {
+  ShouldNotCallThis();
+}
+Value* SharkValue::jdouble_value() const {
+  ShouldNotCallThis();
+}
+Value* SharkValue::jobject_value() const {
+  ShouldNotCallThis();
+}
+Value* SharkValue::jarray_value() const {
+  ShouldNotCallThis();
+}
+int SharkValue::address_value() const {
+  ShouldNotCallThis();
+}
+
+Value* SharkNormalValue::jint_value() const {
+  assert(is_jint(), "should be");
+  return llvm_value();
+}
+Value* SharkNormalValue::jlong_value() const {
+  assert(is_jlong(), "should be");
+  return llvm_value();
+}
+Value* SharkNormalValue::jfloat_value() const {
+  assert(is_jfloat(), "should be");
+  return llvm_value();
+}
+Value* SharkNormalValue::jdouble_value() const {
+  assert(is_jdouble(), "should be");
+  return llvm_value();
+}
+Value* SharkNormalValue::jobject_value() const {
+  assert(is_jobject(), "should be");
+  return llvm_value();
+}
+Value* SharkNormalValue::jarray_value() const {
+  // XXX assert(is_jarray(), "should be");
+  // XXX http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=324
+  assert(is_jobject(), "should be");
+  return llvm_value();
+}
+int SharkAddressValue::address_value() const {
+  return _bci;
+}
+
+// Type-losing conversions -- use with care!
+
+Value* SharkNormalValue::generic_value() const {
+  return llvm_value();
+}
+Value* SharkAddressValue::generic_value() const {
+  return LLVMValue::intptr_constant(address_value());
+}
+
+Value* SharkValue::intptr_value(SharkBuilder* builder) const {
+  ShouldNotCallThis();
+}
+Value* SharkNormalValue::intptr_value(SharkBuilder* builder) const {
+  return builder->CreatePtrToInt(jobject_value(), SharkType::intptr_type());
+}
+
+// Phi-style stuff for SharkPHIState::add_incoming
+
+void SharkValue::addIncoming(SharkValue *value, BasicBlock* block) {
+  ShouldNotCallThis();
+}
+void SharkPHIValue::addIncoming(SharkValue *value, BasicBlock* block) {
+  assert(!is_clone(), "shouldn't be");
+  ((llvm::PHINode *) generic_value())->addIncoming(
+      value->generic_value(), block);
+  if (!value->zero_checked())
+    _all_incomers_zero_checked = false;
+}
+void SharkAddressValue::addIncoming(SharkValue *value, BasicBlock* block) {
+  assert(this->equal_to(value), "should be");
+}
+
+// Phi-style stuff for SharkState::merge
+
+SharkValue* SharkNormalValue::merge(SharkBuilder* builder,
+                                    SharkValue*   other,
+                                    BasicBlock*   other_block,
+                                    BasicBlock*   this_block,
+                                    const char*   name) {
+  assert(type() == other->type(), "should be");
+  assert(zero_checked() == other->zero_checked(), "should be");
+
+  PHINode *phi = builder->CreatePHI(SharkType::to_stackType(type()), name);
+  phi->addIncoming(this->generic_value(), this_block);
+  phi->addIncoming(other->generic_value(), other_block);
+  return SharkValue::create_generic(type(), phi, zero_checked());
+}
+SharkValue* SharkAddressValue::merge(SharkBuilder* builder,
+                                     SharkValue*   other,
+                                     BasicBlock*   other_block,
+                                     BasicBlock*   this_block,
+                                     const char*   name) {
+  assert(this->equal_to(other), "should be");
+  return this;
+}
+
+// Repeated null and divide-by-zero check removal
+
+bool SharkValue::zero_checked() const {
+  ShouldNotCallThis();
+}
+void SharkValue::set_zero_checked(bool zero_checked) {
+  ShouldNotCallThis();
+}
+
+bool SharkNormalValue::zero_checked() const {
+  return _zero_checked;
+}
+void SharkNormalValue::set_zero_checked(bool zero_checked) {
+  _zero_checked = zero_checked;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/sharkValue.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,332 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+// Items on the stack and in local variables are tracked using
+// SharkValue objects.
+//
+// All SharkValues are one of two core types, SharkNormalValue
+// and SharkAddressValue, but no code outside this file should
+// ever refer to those directly.  The split is because of the
+// way JSRs are handled: the typeflow pass expands them into
+// multiple copies, so the return addresses pushed by jsr and
+// popped by ret only exist at compile time.  Having separate
+// classes for these allows us to check that our jsr handling
+// is correct, via assertions.
+//
+// There is one more type, SharkPHIValue, which is a subclass
+// of SharkNormalValue with a couple of extra methods.  Use of
+// SharkPHIValue outside of this file is acceptable, so long
+// as it is obtained via SharkValue::as_phi().
+
+class SharkBuilder;
+class SharkPHIValue;
+
+class SharkValue : public ResourceObj {
+ protected:
+  SharkValue() {}
+
+  // Cloning
+ public:
+  virtual SharkValue* clone() const = 0;
+
+  // Casting
+ public:
+  virtual bool           is_phi() const;
+  virtual SharkPHIValue* as_phi();
+
+  // Comparison
+ public:
+  virtual bool equal_to(SharkValue* other) const = 0;
+
+  // Type access
+ public:
+  virtual BasicType basic_type() const = 0;
+  virtual ciType*   type()       const;
+
+  virtual bool is_jint()    const;
+  virtual bool is_jlong()   const;
+  virtual bool is_jfloat()  const;
+  virtual bool is_jdouble() const;
+  virtual bool is_jobject() const;
+  virtual bool is_jarray()  const;
+  virtual bool is_address() const;
+
+  virtual int size() const = 0;
+
+  bool is_one_word() const {
+    return size() == 1;
+  }
+  bool is_two_word() const {
+    return size() == 2;
+  }
+
+  // Typed conversion from SharkValues
+ public:
+  virtual llvm::Value* jint_value()    const;
+  virtual llvm::Value* jlong_value()   const;
+  virtual llvm::Value* jfloat_value()  const;
+  virtual llvm::Value* jdouble_value() const;
+  virtual llvm::Value* jobject_value() const;
+  virtual llvm::Value* jarray_value()  const;
+  virtual int          address_value() const;
+
+  // Typed conversion to SharkValues
+ public:
+  static SharkValue* create_jint(llvm::Value* value, bool zero_checked) {
+    assert(value->getType() == SharkType::jint_type(), "should be");
+    return create_generic(ciType::make(T_INT), value, zero_checked);
+  }
+  static SharkValue* create_jlong(llvm::Value* value, bool zero_checked) {
+    assert(value->getType() == SharkType::jlong_type(), "should be");
+    return create_generic(ciType::make(T_LONG), value, zero_checked);
+  }
+  static SharkValue* create_jfloat(llvm::Value* value) {
+    assert(value->getType() == SharkType::jfloat_type(), "should be");
+    return create_generic(ciType::make(T_FLOAT), value, false);
+  }
+  static SharkValue* create_jdouble(llvm::Value* value) {
+    assert(value->getType() == SharkType::jdouble_type(), "should be");
+    return create_generic(ciType::make(T_DOUBLE), value, false);
+  }
+  static SharkValue* create_jobject(llvm::Value* value, bool zero_checked) {
+    assert(value->getType() == SharkType::oop_type(), "should be");
+    return create_generic(ciType::make(T_OBJECT), value, zero_checked);
+  }
+
+  // Typed conversion from constants of various types
+ public:
+  static SharkValue* jint_constant(jint value) {
+    return create_jint(LLVMValue::jint_constant(value), value != 0);
+  }
+  static SharkValue* jlong_constant(jlong value) {
+    return create_jlong(LLVMValue::jlong_constant(value), value != 0);
+  }
+  static SharkValue* jfloat_constant(jfloat value) {
+    return create_jfloat(LLVMValue::jfloat_constant(value));
+  }
+  static SharkValue* jdouble_constant(jdouble value) {
+    return create_jdouble(LLVMValue::jdouble_constant(value));
+  }
+  static SharkValue* null() {
+    return create_jobject(LLVMValue::null(), false);
+  }
+  static inline SharkValue* address_constant(int bci);
+
+  // Type-losing conversions -- use with care!
+ public:
+  virtual llvm::Value* generic_value() const = 0;
+  virtual llvm::Value* intptr_value(SharkBuilder* builder) const;
+
+  static inline SharkValue* create_generic(ciType*      type,
+                                           llvm::Value* value,
+                                           bool         zero_checked);
+  static inline SharkValue* create_phi(ciType*              type,
+                                       llvm::PHINode*       phi,
+                                       const SharkPHIValue* parent = NULL);
+
+  // Phi-style stuff
+ public:
+  virtual void addIncoming(SharkValue* value, llvm::BasicBlock* block);
+  virtual SharkValue* merge(SharkBuilder*     builder,
+                            SharkValue*       other,
+                            llvm::BasicBlock* other_block,
+                            llvm::BasicBlock* this_block,
+                            const char*       name) = 0;
+
+  // Repeated null and divide-by-zero check removal
+ public:
+  virtual bool zero_checked() const;
+  virtual void set_zero_checked(bool zero_checked);
+};
+
+class SharkNormalValue : public SharkValue {
+  friend class SharkValue;
+
+ protected:
+  SharkNormalValue(ciType* type, llvm::Value* value, bool zero_checked)
+    : _type(type), _llvm_value(value), _zero_checked(zero_checked) {}
+
+ private:
+  ciType*      _type;
+  llvm::Value* _llvm_value;
+  bool         _zero_checked;
+
+ private:
+  llvm::Value* llvm_value() const {
+    return _llvm_value;
+  }
+
+  // Cloning
+ public:
+  SharkValue* clone() const;
+
+  // Comparison
+ public:
+  bool equal_to(SharkValue* other) const;
+
+  // Type access
+ public:
+  ciType*   type()       const;
+  BasicType basic_type() const;
+  int       size()       const;
+
+ public:
+  bool is_jint()    const;
+  bool is_jlong()   const;
+  bool is_jfloat()  const;
+  bool is_jdouble() const;
+  bool is_jobject() const;
+  bool is_jarray()  const;
+
+  // Typed conversions to LLVM values
+ public:
+  llvm::Value* jint_value()    const;
+  llvm::Value* jlong_value()   const;
+  llvm::Value* jfloat_value()  const;
+  llvm::Value* jdouble_value() const;
+  llvm::Value* jobject_value() const;
+  llvm::Value* jarray_value()  const;
+
+  // Type-losing conversions, use with care
+ public:
+  llvm::Value* generic_value() const;
+  llvm::Value* intptr_value(SharkBuilder* builder) const;
+
+  // Phi-style stuff
+ public:
+  SharkValue* merge(SharkBuilder*     builder,
+                    SharkValue*       other,
+                    llvm::BasicBlock* other_block,
+                    llvm::BasicBlock* this_block,
+                    const char*       name);
+
+  // Repeated null and divide-by-zero check removal
+ public:
+  bool zero_checked() const;
+  void set_zero_checked(bool zero_checked);
+};
+
+class SharkPHIValue : public SharkNormalValue {
+  friend class SharkValue;
+
+ protected:
+  SharkPHIValue(ciType* type, llvm::PHINode* phi, const SharkPHIValue *parent)
+    : SharkNormalValue(type, phi, parent && parent->zero_checked()),
+      _parent(parent),
+      _all_incomers_zero_checked(true) {}
+
+ private:
+  const SharkPHIValue* _parent;
+  bool                 _all_incomers_zero_checked;
+
+ private:
+  const SharkPHIValue* parent() const {
+    return _parent;
+  }
+  bool is_clone() const {
+    return parent() != NULL;
+  }
+
+ public:
+  bool all_incomers_zero_checked() const {
+    if (is_clone())
+      return parent()->all_incomers_zero_checked();
+
+    return _all_incomers_zero_checked;
+  }
+
+  // Cloning
+ public:
+  SharkValue* clone() const;
+
+  // Casting
+ public:
+  bool           is_phi() const;
+  SharkPHIValue* as_phi();
+
+  // Phi-style stuff
+ public:
+  void addIncoming(SharkValue *value, llvm::BasicBlock* block);
+};
+
+class SharkAddressValue : public SharkValue {
+  friend class SharkValue;
+
+ protected:
+  SharkAddressValue(int bci)
+    : _bci(bci) {}
+
+ private:
+  int _bci;
+
+  // Cloning
+ public:
+  SharkValue* clone() const;
+
+  // Comparison
+ public:
+  bool equal_to(SharkValue* other) const;
+
+  // Type access
+ public:
+  BasicType basic_type() const;
+  int       size()       const;
+  bool      is_address() const;
+
+  // Typed conversion from SharkValues
+ public:
+  int address_value() const;
+
+  // Type-losing conversion -- use with care!
+ public:
+  llvm::Value* generic_value() const;
+
+  // Phi-style stuff
+ public:
+  void addIncoming(SharkValue *value, llvm::BasicBlock* block);
+  SharkValue* merge(SharkBuilder*     builder,
+                    SharkValue*       other,
+                    llvm::BasicBlock* other_block,
+                    llvm::BasicBlock* this_block,
+                    const char*       name);
+};
+
+// SharkValue methods that can't be declared above
+
+inline SharkValue* SharkValue::create_generic(ciType*      type,
+                                              llvm::Value* value,
+                                              bool         zero_checked) {
+  return new SharkNormalValue(type, value, zero_checked);
+}
+
+inline SharkValue* SharkValue::create_phi(ciType*              type,
+                                          llvm::PHINode*       phi,
+                                          const SharkPHIValue* parent) {
+  return new SharkPHIValue(type, phi, parent);
+}
+
+inline SharkValue* SharkValue::address_constant(int bci) {
+  return new SharkAddressValue(bci);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/shark_globals.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_shark_globals.cpp.incl"
+
+SHARK_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_NOTPRODUCT_FLAG)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/shark/shark_globals.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+#define SHARK_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct) \
+                                                                              \
+  product(intx, MaxNodeLimit, 65000,                                          \
+          "Maximum number of nodes")                                          \
+                                                                              \
+  /* inlining */                                                              \
+  product(intx, SharkMaxInlineSize, 32,                                       \
+          "Maximum bytecode size of methods to inline when using Shark")      \
+                                                                              \
+  /* compiler debugging */                                                    \
+  develop(ccstr, SharkPrintTypeflowOf, NULL,                                  \
+          "Print the typeflow of the specified method")                       \
+                                                                              \
+  diagnostic(ccstr, SharkPrintBitcodeOf, NULL,                                \
+          "Print the LLVM bitcode of the specified method")                   \
+                                                                              \
+  diagnostic(ccstr, SharkPrintAsmOf, NULL,                                    \
+          "Print the asm of the specified method")                            \
+                                                                              \
+  develop(bool, SharkTraceBytecodes, false,                                   \
+          "Trace bytecode compilation")                                       \
+                                                                              \
+  diagnostic(bool, SharkTraceInstalls, false,                                 \
+          "Trace method installation")                                        \
+                                                                              \
+  diagnostic(bool, SharkPerformanceWarnings, false,                           \
+          "Warn about things that could be made faster")                      \
+
+SHARK_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_NOTPRODUCT_FLAG)
--- a/hotspot/src/share/vm/utilities/constantTag.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/utilities/constantTag.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -91,6 +91,8 @@
       return "MethodHandle";
     case JVM_CONSTANT_MethodType :
       return "MethodType";
+    case JVM_CONSTANT_InvokeDynamic :
+      return "InvokeDynamic";
     case JVM_CONSTANT_Object :
       return "Object";
     case JVM_CONSTANT_Utf8 :
--- a/hotspot/src/share/vm/utilities/constantTag.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/utilities/constantTag.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -80,13 +80,14 @@
 
   bool is_method_type() const              { return _tag == JVM_CONSTANT_MethodType; }
   bool is_method_handle() const            { return _tag == JVM_CONSTANT_MethodHandle; }
+  bool is_invoke_dynamic() const           { return _tag == JVM_CONSTANT_InvokeDynamic; }
 
   constantTag() {
     _tag = JVM_CONSTANT_Invalid;
   }
   constantTag(jbyte tag) {
     assert((tag >= 0 && tag <= JVM_CONSTANT_NameAndType) ||
-           (tag >= JVM_CONSTANT_MethodHandle && tag <= JVM_CONSTANT_MethodType) ||
+           (tag >= JVM_CONSTANT_MethodHandle && tag <= JVM_CONSTANT_InvokeDynamic) ||
            (tag >= JVM_CONSTANT_InternalMin && tag <= JVM_CONSTANT_InternalMax), "Invalid constant tag");
     _tag = tag;
   }
--- a/hotspot/src/share/vm/utilities/debug.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/utilities/debug.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -552,140 +552,6 @@
   }
 }
 
-
-static void find(intptr_t x, bool print_pc) {
-  address addr = (address)x;
-
-  CodeBlob* b = CodeCache::find_blob_unsafe(addr);
-  if (b != NULL) {
-    if (b->is_buffer_blob()) {
-      // the interpreter is generated into a buffer blob
-      InterpreterCodelet* i = Interpreter::codelet_containing(addr);
-      if (i != NULL) {
-        i->print();
-        return;
-      }
-      if (Interpreter::contains(addr)) {
-        tty->print_cr(INTPTR_FORMAT " is pointing into interpreter code (not bytecode specific)", addr);
-        return;
-      }
-      //
-      if (AdapterHandlerLibrary::contains(b)) {
-        AdapterHandlerLibrary::print_handler(b);
-      }
-      // the stubroutines are generated into a buffer blob
-      StubCodeDesc* d = StubCodeDesc::desc_for(addr);
-      if (d != NULL) {
-        d->print();
-        if (print_pc) tty->cr();
-        return;
-      }
-      if (StubRoutines::contains(addr)) {
-        tty->print_cr(INTPTR_FORMAT " is pointing to an (unnamed) stub routine", addr);
-        return;
-      }
-      // the InlineCacheBuffer is using stubs generated into a buffer blob
-      if (InlineCacheBuffer::contains(addr)) {
-        tty->print_cr(INTPTR_FORMAT " is pointing into InlineCacheBuffer", addr);
-        return;
-      }
-      VtableStub* v = VtableStubs::stub_containing(addr);
-      if (v != NULL) {
-        v->print();
-        return;
-      }
-    }
-    if (print_pc && b->is_nmethod()) {
-      ResourceMark rm;
-      tty->print("%#p: Compiled ", addr);
-      ((nmethod*)b)->method()->print_value_on(tty);
-      tty->print("  = (CodeBlob*)" INTPTR_FORMAT, b);
-      tty->cr();
-      return;
-    }
-    if ( b->is_nmethod()) {
-      if (b->is_zombie()) {
-        tty->print_cr(INTPTR_FORMAT " is zombie nmethod", b);
-      } else if (b->is_not_entrant()) {
-        tty->print_cr(INTPTR_FORMAT " is non-entrant nmethod", b);
-      }
-    }
-    b->print();
-    return;
-  }
-
-  if (Universe::heap()->is_in(addr)) {
-    HeapWord* p = Universe::heap()->block_start(addr);
-    bool print = false;
-    // If we couldn't find it it just may mean that heap wasn't parseable
-    // See if we were just given an oop directly
-    if (p != NULL && Universe::heap()->block_is_obj(p)) {
-      print = true;
-    } else if (p == NULL && ((oopDesc*)addr)->is_oop()) {
-      p = (HeapWord*) addr;
-      print = true;
-    }
-    if (print) {
-      oop(p)->print();
-      if (p != (HeapWord*)x && oop(p)->is_constMethod() &&
-          constMethodOop(p)->contains(addr)) {
-        Thread *thread = Thread::current();
-        HandleMark hm(thread);
-        methodHandle mh (thread, constMethodOop(p)->method());
-        if (!mh->is_native()) {
-          tty->print_cr("bci_from(%p) = %d; print_codes():",
-                        addr, mh->bci_from(address(x)));
-          mh->print_codes();
-        }
-      }
-      return;
-    }
-  } else if (Universe::heap()->is_in_reserved(addr)) {
-    tty->print_cr(INTPTR_FORMAT " is an unallocated location in the heap", addr);
-    return;
-  }
-
-  if (JNIHandles::is_global_handle((jobject) addr)) {
-    tty->print_cr(INTPTR_FORMAT " is a global jni handle", addr);
-    return;
-  }
-  if (JNIHandles::is_weak_global_handle((jobject) addr)) {
-    tty->print_cr(INTPTR_FORMAT " is a weak global jni handle", addr);
-    return;
-  }
-  if (JNIHandleBlock::any_contains((jobject) addr)) {
-    tty->print_cr(INTPTR_FORMAT " is a local jni handle", addr);
-    return;
-  }
-
-  for(JavaThread *thread = Threads::first(); thread; thread = thread->next()) {
-    // Check for privilege stack
-    if (thread->privileged_stack_top() != NULL && thread->privileged_stack_top()->contains(addr)) {
-      tty->print_cr(INTPTR_FORMAT " is pointing into the privilege stack for thread: " INTPTR_FORMAT, addr, thread);
-      return;
-    }
-    // If the addr is a java thread print information about that.
-    if (addr == (address)thread) {
-       thread->print();
-       return;
-    }
-  }
-
-  // Try an OS specific find
-  if (os::find(addr)) {
-    return;
-  }
-
-  if (print_pc) {
-    tty->print_cr(INTPTR_FORMAT ": probably in C++ code; check debugger", addr);
-    Disassembler::decode(same_page(addr-40,addr),same_page(addr+40,addr));
-    return;
-  }
-
-  tty->print_cr(INTPTR_FORMAT " is pointing to unknown location", addr);
-}
-
-
 class LookForRefInGenClosure : public OopsInGenClosure {
 public:
   oop target;
@@ -767,7 +633,7 @@
 // Can we someday rename the other find to hsfind?
 extern "C" void hsfind(intptr_t x) {
   Command c("hsfind");
-  find(x, false);
+  os::print_location(tty, x, false);
 }
 
 
@@ -778,13 +644,13 @@
 
 extern "C" void find(intptr_t x) {
   Command c("find");
-  find(x, false);
+  os::print_location(tty, x, false);
 }
 
 
 extern "C" void findpc(intptr_t x) {
   Command c("findpc");
-  find(x, true);
+  os::print_location(tty, x, true);
 }
 
 
--- a/hotspot/src/share/vm/utilities/exceptions.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/utilities/exceptions.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -117,7 +117,7 @@
                   (address)h_exception(), file, line, thread);
   }
   // for AbortVMOnException flag
-  NOT_PRODUCT(Exceptions::debug_check_abort(h_exception));
+  NOT_PRODUCT(Exceptions::debug_check_abort(h_exception, message));
 
   // Check for special boot-strapping/vm-thread handling
   if (special_exception(thread, file, line, h_exception)) return;
@@ -375,17 +375,26 @@
 
 #ifndef PRODUCT
 // caller frees value_string if necessary
-void Exceptions::debug_check_abort(const char *value_string) {
+void Exceptions::debug_check_abort(const char *value_string, const char* message) {
   if (AbortVMOnException != NULL && value_string != NULL &&
       strstr(value_string, AbortVMOnException)) {
-    fatal(err_msg("Saw %s, aborting", value_string));
+    if (AbortVMOnExceptionMessage == NULL || message == NULL ||
+        strcmp(message, AbortVMOnExceptionMessage) == 0) {
+      fatal(err_msg("Saw %s, aborting", value_string));
+    }
   }
 }
 
-void Exceptions::debug_check_abort(Handle exception) {
+void Exceptions::debug_check_abort(Handle exception, const char* message) {
   if (AbortVMOnException != NULL) {
     ResourceMark rm;
-    debug_check_abort(instanceKlass::cast(exception()->klass())->external_name());
+    if (message == NULL && exception->is_a(SystemDictionary::Throwable_klass())) {
+      oop msg = java_lang_Throwable::message(exception);
+      if (msg != NULL) {
+        message = java_lang_String::as_utf8_string(msg);
+      }
+    }
+    debug_check_abort(instanceKlass::cast(exception()->klass())->external_name(), message);
   }
 }
 #endif
--- a/hotspot/src/share/vm/utilities/exceptions.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/utilities/exceptions.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -143,8 +143,8 @@
   static void throw_stack_overflow_exception(Thread* thread, const char* file, int line);
 
   // for AbortVMOnException flag
-  NOT_PRODUCT(static void debug_check_abort(Handle exception);)
-  NOT_PRODUCT(static void debug_check_abort(const char *value_string);)
+  NOT_PRODUCT(static void debug_check_abort(Handle exception, const char* message = NULL);)
+  NOT_PRODUCT(static void debug_check_abort(const char *value_string, const char* message = NULL);)
 };
 
 
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -345,6 +345,35 @@
   return align_size_up(offset, HeapWordsPerLong);
 }
 
+// The expected size in bytes of a cache line, used to pad data structures.
+#define DEFAULT_CACHE_LINE_SIZE 64
+
+// Bytes needed to pad type to avoid cache-line sharing; alignment should be the
+// expected cache line size (a power of two).  The first addend avoids sharing
+// when the start address is not a multiple of alignment; the second maintains
+// alignment of starting addresses that happen to be a multiple.
+#define PADDING_SIZE(type, alignment)                           \
+  ((alignment) + align_size_up_(sizeof(type), alignment))
+
+// Templates to create a subclass padded to avoid cache line sharing.  These are
+// effective only when applied to derived-most (leaf) classes.
+
+// When no args are passed to the base ctor.
+template <class T, size_t alignment = DEFAULT_CACHE_LINE_SIZE>
+class Padded: public T {
+private:
+  char _pad_buf_[PADDING_SIZE(T, alignment)];
+};
+
+// When either 0 or 1 args may be passed to the base ctor.
+template <class T, typename Arg1T, size_t alignment = DEFAULT_CACHE_LINE_SIZE>
+class Padded01: public T {
+public:
+  Padded01(): T() { }
+  Padded01(Arg1T arg1): T(arg1) { }
+private:
+  char _pad_buf_[PADDING_SIZE(T, alignment)];
+};
 
 //----------------------------------------------------------------------------------------------------
 // Utility macros for compilers
--- a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -216,8 +216,16 @@
 
 #define DEBUG_EXCEPTION ::abort();
 
+#ifdef ARM
+#ifdef SOLARIS
+#define BREAKPOINT __asm__ volatile (".long 0xe1200070")
+#else
+#define BREAKPOINT __asm__ volatile (".long 0xe7f001f0")
+#endif
+#else
 extern "C" void breakpoint();
 #define BREAKPOINT ::breakpoint()
+#endif
 
 // checking for nanness
 #ifdef SOLARIS
@@ -235,6 +243,12 @@
 #error "missing platform-specific definition here"
 #endif
 
+// GCC 4.3 does not allow 0.0/0.0 to produce a NAN value
+#if (__GNUC__ == 4) && (__GNUC_MINOR__ > 2)
+#define CAN_USE_NAN_DEFINE 1
+#endif
+
+
 // Checking for finiteness
 
 inline int g_isfinite(jfloat  f)                 { return finite(f); }
--- a/hotspot/src/share/vm/utilities/growableArray.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/utilities/growableArray.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -97,7 +97,10 @@
     assert(_len >= 0 && _len <= _max, "initial_len too big");
     _arena = (c_heap ? (Arena*)1 : NULL);
     set_nesting();
-    assert(!c_heap || allocated_on_C_heap(), "growable array must be on C heap if elements are");
+    assert(!on_C_heap() || allocated_on_C_heap(), "growable array must be on C heap if elements are");
+    assert(!on_stack() ||
+           (allocated_on_res_area() || allocated_on_stack()),
+           "growable array must be on stack if elements are not on arena and not on C heap");
   }
 
   // This GA will use the given arena for storage.
@@ -108,6 +111,10 @@
     assert(_len >= 0 && _len <= _max, "initial_len too big");
     _arena = arena;
     assert(on_arena(), "arena has taken on reserved value 0 or 1");
+    // Relax next assert to allow object allocation on resource area,
+    // on stack or embedded into an other object.
+    assert(allocated_on_arena() || allocated_on_stack(),
+           "growable array must be on arena or on stack if elements are on arena");
   }
 
   void* raw_allocate(int elementSize);
--- a/hotspot/src/share/vm/utilities/macros.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/utilities/macros.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -151,9 +151,11 @@
 #if defined(IA32) || defined(AMD64)
 #define X86
 #define X86_ONLY(code) code
+#define NOT_X86(code)
 #else
 #undef X86
 #define X86_ONLY(code)
+#define NOT_X86(code) code
 #endif
 
 #ifdef IA32
@@ -188,4 +190,37 @@
 #define NOT_SPARC(code) code
 #endif
 
+#ifdef PPC
+#define PPC_ONLY(code) code
+#define NOT_PPC(code)
+#else
+#define PPC_ONLY(code)
+#define NOT_PPC(code) code
+#endif
+
+#ifdef E500V2
+#define E500V2_ONLY(code) code
+#define NOT_E500V2(code)
+#else
+#define E500V2_ONLY(code)
+#define NOT_E500V2(code) code
+#endif
+
+
+#ifdef ARM
+#define ARM_ONLY(code) code
+#define NOT_ARM(code)
+#else
+#define ARM_ONLY(code)
+#define NOT_ARM(code) code
+#endif
+
+#ifdef JAVASE_EMBEDDED
+#define EMBEDDED_ONLY(code) code
+#define NOT_EMBEDDED(code)
+#else
+#define EMBEDDED_ONLY(code)
+#define NOT_EMBEDDED(code) code
+#endif
+
 #define define_pd_global(type, name, value) const type pd_##name = value;
--- a/hotspot/src/share/vm/utilities/taskqueue.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/utilities/taskqueue.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -31,6 +31,48 @@
 uint ParallelTaskTerminator::_total_peeks = 0;
 #endif
 
+#if TASKQUEUE_STATS
+const char * const TaskQueueStats::_names[last_stat_id] = {
+  "qpush", "qpop", "qpop-s", "qattempt", "qsteal", "opush", "omax"
+};
+
+void TaskQueueStats::print_header(unsigned int line, outputStream* const stream,
+                                  unsigned int width)
+{
+  // Use a width w: 1 <= w <= max_width
+  const unsigned int max_width = 40;
+  const unsigned int w = MAX2(MIN2(width, max_width), 1U);
+
+  if (line == 0) { // spaces equal in width to the header
+    const unsigned int hdr_width = w * last_stat_id + last_stat_id - 1;
+    stream->print("%*s", hdr_width, " ");
+  } else if (line == 1) { // labels
+    stream->print("%*s", w, _names[0]);
+    for (unsigned int i = 1; i < last_stat_id; ++i) {
+      stream->print(" %*s", w, _names[i]);
+    }
+  } else if (line == 2) { // dashed lines
+    char dashes[max_width + 1];
+    memset(dashes, '-', w);
+    dashes[w] = '\0';
+    stream->print("%s", dashes);
+    for (unsigned int i = 1; i < last_stat_id; ++i) {
+      stream->print(" %s", dashes);
+    }
+  }
+}
+
+void TaskQueueStats::print(outputStream* stream, unsigned int width) const
+{
+  #define FMT SIZE_FORMAT_W(*)
+  stream->print(FMT, width, _stats[0]);
+  for (unsigned int i = 1; i < last_stat_id; ++i) {
+    stream->print(" " FMT, width, _stats[i]);
+  }
+  #undef FMT
+}
+#endif // TASKQUEUE_STATS
+
 int TaskQueueSetSuper::randomParkAndMiller(int *seed0) {
   const int a =      16807;
   const int m = 2147483647;
--- a/hotspot/src/share/vm/utilities/taskqueue.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/utilities/taskqueue.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -22,6 +22,72 @@
  *
  */
 
+// Simple TaskQueue stats that are collected by default in debug builds.
+
+#if !defined(TASKQUEUE_STATS) && defined(ASSERT)
+#define TASKQUEUE_STATS 1
+#elif !defined(TASKQUEUE_STATS)
+#define TASKQUEUE_STATS 0
+#endif
+
+#if TASKQUEUE_STATS
+#define TASKQUEUE_STATS_ONLY(code) code
+#else
+#define TASKQUEUE_STATS_ONLY(code)
+#endif // TASKQUEUE_STATS
+
+#if TASKQUEUE_STATS
+class TaskQueueStats {
+public:
+  enum StatId {
+    push,             // number of taskqueue pushes
+    pop,              // number of taskqueue pops
+    pop_slow,         // subset of taskqueue pops that were done slow-path
+    steal_attempt,    // number of taskqueue steal attempts
+    steal,            // number of taskqueue steals
+    overflow,         // number of overflow pushes
+    overflow_max_len, // max length of overflow stack
+    last_stat_id
+  };
+
+public:
+  inline TaskQueueStats()       { reset(); }
+
+  inline void record_push()     { ++_stats[push]; }
+  inline void record_pop()      { ++_stats[pop]; }
+  inline void record_pop_slow() { record_pop(); ++_stats[pop_slow]; }
+  inline void record_steal(bool success);
+  inline void record_overflow(size_t new_length);
+
+  inline size_t get(StatId id) const { return _stats[id]; }
+  inline const size_t* get() const   { return _stats; }
+
+  inline void reset();
+
+  static void print_header(unsigned int line, outputStream* const stream = tty,
+                           unsigned int width = 10);
+  void print(outputStream* const stream = tty, unsigned int width = 10) const;
+
+private:
+  size_t                    _stats[last_stat_id];
+  static const char * const _names[last_stat_id];
+};
+
+void TaskQueueStats::record_steal(bool success) {
+  ++_stats[steal_attempt];
+  if (success) ++_stats[steal];
+}
+
+void TaskQueueStats::record_overflow(size_t new_len) {
+  ++_stats[overflow];
+  if (new_len > _stats[overflow_max_len]) _stats[overflow_max_len] = new_len;
+}
+
+void TaskQueueStats::reset() {
+  memset(_stats, 0, sizeof(_stats));
+}
+#endif // TASKQUEUE_STATS
+
 template <unsigned int N>
 class TaskQueueSuper: public CHeapObj {
 protected:
@@ -135,6 +201,8 @@
 
   // Total size of queue.
   static const uint total_size() { return N; }
+
+  TASKQUEUE_STATS_ONLY(TaskQueueStats stats;)
 };
 
 template<class E, unsigned int N = TASKQUEUE_SIZE>
@@ -152,6 +220,7 @@
 public:
   using TaskQueueSuper<N>::max_elems;
   using TaskQueueSuper<N>::size;
+  TASKQUEUE_STATS_ONLY(using TaskQueueSuper<N>::stats;)
 
 private:
   // Slow paths for push, pop_local.  (pop_global has no fast path.)
@@ -224,14 +293,14 @@
     // g++ complains if the volatile result of the assignment is unused.
     const_cast<E&>(_elems[localBot] = t);
     OrderAccess::release_store(&_bottom, increment_index(localBot));
+    TASKQUEUE_STATS_ONLY(stats.record_push());
     return true;
   }
   return false;
 }
 
 template<class E, unsigned int N>
-bool GenericTaskQueue<E, N>::
-pop_local_slow(uint localBot, Age oldAge) {
+bool GenericTaskQueue<E, N>::pop_local_slow(uint localBot, Age oldAge) {
   // This queue was observed to contain exactly one element; either this
   // thread will claim it, or a competing "pop_global".  In either case,
   // the queue will be logically empty afterwards.  Create a new Age value
@@ -251,6 +320,7 @@
     if (tempAge == oldAge) {
       // We win.
       assert(dirty_size(localBot, _age.top()) != N - 1, "sanity");
+      TASKQUEUE_STATS_ONLY(stats.record_pop_slow());
       return true;
     }
   }
@@ -306,6 +376,8 @@
   typedef GrowableArray<E>       overflow_t;
   typedef GenericTaskQueue<E, N> taskqueue_t;
 
+  TASKQUEUE_STATS_ONLY(using taskqueue_t::stats;)
+
   OverflowTaskQueue();
   ~OverflowTaskQueue();
   void initialize();
@@ -356,6 +428,7 @@
 {
   if (!taskqueue_t::push(t)) {
     overflow_stack()->push(t);
+    TASKQUEUE_STATS_ONLY(stats.record_overflow(overflow_stack()->length()));
   }
   return true;
 }
@@ -424,9 +497,13 @@
 
 template<class T> bool
 GenericTaskQueueSet<T>::steal(uint queue_num, int* seed, E& t) {
-  for (uint i = 0; i < 2 * _n; i++)
-    if (steal_best_of_2(queue_num, seed, t))
+  for (uint i = 0; i < 2 * _n; i++) {
+    if (steal_best_of_2(queue_num, seed, t)) {
+      TASKQUEUE_STATS_ONLY(queue(queue_num)->stats.record_steal(true));
       return true;
+    }
+  }
+  TASKQUEUE_STATS_ONLY(queue(queue_num)->stats.record_steal(false));
   return false;
 }
 
@@ -574,6 +651,7 @@
     // g++ complains if the volatile result of the assignment is unused.
     const_cast<E&>(_elems[localBot] = t);
     OrderAccess::release_store(&_bottom, increment_index(localBot));
+    TASKQUEUE_STATS_ONLY(stats.record_push());
     return true;
   } else {
     return push_slow(t, dirty_n_elems);
@@ -603,6 +681,7 @@
   idx_t tp = _age.top();    // XXX
   if (size(localBot, tp) > 0) {
     assert(dirty_size(localBot, tp) != N - 1, "sanity");
+    TASKQUEUE_STATS_ONLY(stats.record_pop());
     return true;
   } else {
     // Otherwise, the queue contained exactly one element; we take the slow
--- a/hotspot/src/share/vm/utilities/vmError.cpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/utilities/vmError.cpp	Fri Aug 20 14:48:10 2010 -0400
@@ -479,8 +479,8 @@
 
        if (fr.sp()) {
          st->print(",  sp=" PTR_FORMAT, fr.sp());
-         st->print(",  free space=%" INTPTR_FORMAT "k",
-                     ((intptr_t)fr.sp() - (intptr_t)stack_bottom) >> 10);
+         size_t free_stack_size = pointer_delta(fr.sp(), stack_bottom, 1024);
+         st->print(",  free space=" SIZE_FORMAT "k", free_stack_size);
        }
 
        st->cr();
@@ -687,16 +687,13 @@
 # undef END
 }
 
+VMError* volatile VMError::first_error = NULL;
+volatile jlong VMError::first_error_tid = -1;
 
 void VMError::report_and_die() {
   // Don't allocate large buffer on stack
   static char buffer[O_BUFLEN];
 
-  // First error, and its thread id. We must be able to handle native thread,
-  // so use thread id instead of Thread* to identify thread.
-  static VMError* first_error;
-  static jlong    first_error_tid;
-
   // An error could happen before tty is initialized or after it has been
   // destroyed. Here we use a very simple unbuffered fdStream for printing.
   // Only out.print_raw() and out.print_raw_cr() should be used, as other
--- a/hotspot/src/share/vm/utilities/vmError.hpp	Thu Aug 12 23:21:17 2010 -0700
+++ b/hotspot/src/share/vm/utilities/vmError.hpp	Fri Aug 20 14:48:10 2010 -0400
@@ -57,6 +57,10 @@
   int          _current_step;
   const char * _current_step_info;
   int          _verbose;
+  // First error, and its thread id. We must be able to handle native thread,
+  // so use thread id instead of Thread* to identify thread.
+  static VMError* volatile first_error;
+  static volatile jlong    first_error_tid;
 
   // used by reporting about OOM
   size_t       _size;
@@ -108,4 +112,7 @@
   // returns original handler for signal, if it was resetted, or NULL if
   // signal was not changed by error reporter
   static address get_resetted_sighandler(int sig);
+
+  // check to see if fatal error reporting is in progress
+  static bool fatal_error_in_progress() { return first_error != NULL; }
 };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/6973329/Test.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 6973329
+ * @summary C2 with Zero based COOP produces code with broken anti-dependency on x86
+ *
+ * @run main/othervm -Xbatch -Xcomp -XX:CompileOnly=Test Test
+ */
+
+class A {
+  A next;
+  int n;
+
+  public int get_n() {
+    return n+1;
+  }
+}
+public class Test {
+
+  A a;
+
+  void test (A new_next) {
+    A prev_next = a.next;
+    a.next = new_next;
+    if (prev_next == null) {
+      a.n = a.get_n();
+    }
+  }
+
+  public static void main(String args[]) {
+    Test t = new Test();
+    t.a = new A();
+    t.a.n = 1;
+    t.test(new A());
+    if (t.a.n != 2) {
+      System.out.println("Wrong value: " + t.a.n + " expected: 2");
+      System.exit(97);
+    }
+  }
+}
+
--- a/jaxp/.hgtags	Thu Aug 12 23:21:17 2010 -0700
+++ b/jaxp/.hgtags	Fri Aug 20 14:48:10 2010 -0400
@@ -77,3 +77,7 @@
 d524be5ef62e8b8cb890c59a5d2c19ef0ab50d45 jdk7-b100
 17f62a566a2020fd908e77106ed885e0c4e7c14d jdk7-b101
 15573625af97d01c4e24549041cba7584da7fe88 jdk7-b102
+b7722e8788644507c10bb69a137de422d0300b24 jdk7-b103
+d42c4acb6424a094bdafe2ad9c8c1c7ca7fb7b7e jdk7-b104
+3233b9a4c12ef2663a356d08bb141c02736c7f49 jdk7-b105
+5ba8469212a6cab95ca652eea414b753be7d245a jdk7-b106
--- a/jaxws/.hgtags	Thu Aug 12 23:21:17 2010 -0700
+++ b/jaxws/.hgtags	Fri Aug 20 14:48:10 2010 -0400
@@ -77,3 +77,7 @@
 bd26d0ce0c3cb43e58a8e2770cc03f26d96ffe5c jdk7-b100
 b55ce274490082712f5e002b38d2eed505ca863d jdk7-b101
 d8580443d1815d68e0035a0560634e50fa899288 jdk7-b102
+267386d6b923f724309cab855a555e2d86a15c8f jdk7-b103
+bbc4cce6c20aeca4862804a6e8315a2350d43633 jdk7-b104
+39eb4f3031f4a985664cace00fca3bd1eab1e0aa jdk7-b105
+bc45ccc5bcca6cbe4ea433e279d4a93b06ab38c6 jdk7-b106
--- a/jdk/.hgtags	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/.hgtags	Fri Aug 20 14:48:10 2010 -0400
@@ -78,3 +78,6 @@
 d58354a69011f3d3354765fa3167567c4c4a9612 jdk7-b101
 13029a61b16bec06535d4f0aa98229b358684128 jdk7-b102
 6488b70a23cc6dc4b7e00809bc503c2884bafb28 jdk7-b103
+1a92820132a0221c5bdedd42d0888c57ce4cbb34 jdk7-b104
+3b0abcb512807bb6f6d27755bc50103211bde6ee jdk7-b105
+b91ef6b60f4e19bf4592c6dd594c9bac62487519 jdk7-b106
--- a/jdk/make/common/Release.gmk	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/make/common/Release.gmk	Fri Aug 20 14:48:10 2010 -0400
@@ -571,6 +571,16 @@
 	$(ECHO) "META-INF/services/com.sun.tools.xjc.Plugin" >> $@
 	$(ECHO) "com/sun/tools/" >> $@
 	$(ECHO) "sun/jvmstat/" >> $@
+	$(ECHO) "sun/nio/cs/ext/" >> $@
+	$(ECHO) "sun/awt/HKSCS.class" >> $@
+	$(ECHO) "sun/awt/motif/X11GB2312$Decoder.class" >> $@
+	$(ECHO) "sun/awt/motif/X11GB2312$Encoder.class" >> $@
+	$(ECHO) "sun/awt/motif/X11GB2312.class" >> $@
+	$(ECHO) "sun/awt/motif/X11GBK$Encoder.class" >> $@
+	$(ECHO) "sun/awt/motif/X11GBK.class" >> $@
+	$(ECHO) "sun/awt/motif/X11KSC5601$Decoder.class" >> $@
+	$(ECHO) "sun/awt/motif/X11KSC5601$Encoder.class" >> $@
+	$(ECHO) "sun/awt/motif/X11KSC5601.class" >> $@
 	$(ECHO) "sun/rmi/rmic/" >> $@
 	$(ECHO) "sun/tools/asm/" >> $@
 	$(ECHO) "sun/tools/java/" >> $@
--- a/jdk/make/common/shared/Defs-versions.gmk	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/make/common/shared/Defs-versions.gmk	Fri Aug 20 14:48:10 2010 -0400
@@ -191,7 +191,7 @@
 
 # Generic
 REQUIRED_ANT_VER          = 1.6.3
-REQUIRED_BOOT_VER         = 1.5
+REQUIRED_BOOT_VER         = 1.6
 REQUIRED_FREETYPE_VERSION = 2.3.0
 REQUIRED_MAKE_VER         = 3.78
 REQUIRED_UNZIP_VER        = 5.12
--- a/jdk/make/docs/Makefile	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/make/docs/Makefile	Fri Aug 20 14:48:10 2010 -0400
@@ -47,9 +47,9 @@
 
 # Url to devdocs page
 #   Was: http://java.sun.com/javase/6/webnotes/devdocs-vs-specs.html
-DEV_DOCS_URL-5 = http://java.sun.com/j2se/1.5.0/docs
-DEV_DOCS_URL-6 = http://download.oracle.com/docs/cd/E17409_01/javase/6/docs
-DEV_DOCS_URL-7 = http://download.oracle.com/docs/cd/E17409_01/javase/7/docs
+DEV_DOCS_URL-5 = http://java.sun.com/j2se/1.5.0/docs/index.html
+DEV_DOCS_URL-6 = http://download.oracle.com/javase/6/docs/index.html
+DEV_DOCS_URL-7 = http://download.oracle.com/javase/7/docs/index.html
 DEV_DOCS_URL = $(DEV_DOCS_URL-$(JDK_MINOR_VERSION))
 
 # Url to Java Language Spec
@@ -84,6 +84,11 @@
                   $(SHARE_SRC)/../solaris/classes \
 	          $(SHARE_SRC)/../windows/classes \
 		  $(SHARE_SRC)/doc/stub
+
+# List of directories that actually exist
+ALL_EXISTING_SOURCE_DIRS := $(wildcard $(ALL_SOURCE_DIRS))
+
+# List with classpath separator between them
 EMPTY:=
 SPACE:= $(EMPTY) $(EMPTY)
 RELEASEDOCS_SOURCEPATH = \
@@ -240,7 +245,8 @@
 # Default target is same as docs target, create core api and all others it can
 #
 
-all docs: coredocs otherdocs
+all: docs
+docs: coredocs otherdocs
 
 #################################################################
 # Production Targets -- USE THESE TARGETS WHEN:
@@ -1178,9 +1184,9 @@
 #
 # Get a cache of all the directories
 
-$(DIRECTORY_CACHE): $(ALL_SOURCE_DIRS)
+$(DIRECTORY_CACHE): $(ALL_EXISTING_SOURCE_DIRS)
 	$(prep-target)
-	@for cp in $(ALL_SOURCE_DIRS) ; do 		\
+	@for cp in $(ALL_EXISTING_SOURCE_DIRS) ; do 	\
 	  $(ECHO) "$(FIND) $${cp} -type f >> $@"; 	\
 	  $(FIND) $${cp} -type f >> $@; 		\
 	done
--- a/jdk/make/java/nio/mapfile-linux	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/make/java/nio/mapfile-linux	Fri Aug 20 14:48:10 2010 -0400
@@ -119,6 +119,7 @@
                 Java_sun_nio_ch_ServerSocketChannelImpl_accept0;
                 Java_sun_nio_ch_ServerSocketChannelImpl_initIDs;
                 Java_sun_nio_ch_SocketChannelImpl_checkConnect;
+		Java_sun_nio_ch_SocketChannelImpl_sendOutOfBandData;
 		Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_accept0;
 		Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_initIDs;
 		Java_sun_nio_ch_UnixAsynchronousSocketChannelImpl_checkConnect;
--- a/jdk/make/java/nio/mapfile-solaris	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/make/java/nio/mapfile-solaris	Fri Aug 20 14:48:10 2010 -0400
@@ -106,6 +106,7 @@
                 Java_sun_nio_ch_ServerSocketChannelImpl_accept0;
                 Java_sun_nio_ch_ServerSocketChannelImpl_initIDs;
                 Java_sun_nio_ch_SocketChannelImpl_checkConnect;
+		Java_sun_nio_ch_SocketChannelImpl_sendOutOfBandData;
 		Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_accept0;
 		Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_initIDs;
 		Java_sun_nio_ch_UnixAsynchronousSocketChannelImpl_checkConnect;
--- a/jdk/make/sun/nio/cs/Makefile	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/make/sun/nio/cs/Makefile	Fri Aug 20 14:48:10 2010 -0400
@@ -58,6 +58,25 @@
 FILES_genout_extcs = $(FILES_gen_extcs:%.java=$(GENSRCDIR)/%.java)
 
 #
+# These sun.awt charsets use sun/nio/cs/ext charsets that only exist
+# in JDK7 charsets.jar, which causes problem when build the symbol
+# table for rt.jar in Release.gmk. They are now removed from the
+# rt.jar when building jdk/jre image (in Release.gmk), so add them
+# into charsets.jar here
+#
+ifeq ($(PLATFORM), windows)
+FILES_src += \
+	sun/awt/HKSCS.java
+else
+# Solaris/Linux
+FILES_src += \
+	sun/awt/HKSCS.java \
+	sun/awt/motif/X11GB2312.java \
+	sun/awt/motif/X11GBK.java \
+	sun/awt/motif/X11KSC5601.java
+endif # PLATFORM
+
+#
 # Rules
 #
 include $(BUILDDIR)/common/Classes.gmk
--- a/jdk/src/share/classes/com/sun/jndi/dns/DnsContextFactory.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/com/sun/jndi/dns/DnsContextFactory.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -132,7 +132,7 @@
             throw new ConfigurationException("DNS pseudo-URL required");
         }
 
-        List servers = new ArrayList();
+        List<String> servers = new ArrayList<>();
 
         for (int i = 0; i < urls.length; i++) {
             String server = urls[i].getHost();
@@ -142,7 +142,7 @@
                 // No server or port given, so look to underlying platform.
                 // ResolverConfiguration does some limited caching, so the
                 // following is reasonably efficient even if called rapid-fire.
-                List platformServers =
+                List<String> platformServers =
                     ResolverConfiguration.open().nameservers();
                 if (!platformServers.isEmpty()) {
                     servers.addAll(platformServers);
@@ -157,8 +157,7 @@
                         ? server
                         : server + ":" + port);
         }
-        return (String[]) servers.toArray(
-                                        new String[servers.size()]);
+        return servers.toArray(new String[servers.size()]);
     }
 
     /*
--- a/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -658,6 +658,11 @@
             }
         }
         if (nparent) {
+            LdapRequest ldr = pendingRequests;
+            while (ldr != null) {
+                ldr.notify();
+                ldr = ldr.next;
+            }
             parent.processConnectionClosure();
         }
     }
--- a/jdk/src/share/classes/com/sun/jndi/ldap/Filter.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/Filter.java	Fri Aug 20 14:48:10 2010 -0400
@@ -803,8 +803,7 @@
     //
     ////////////////////////////////////////////////////////////////////////////
 
-    // private static final boolean dbg = false;
-    private static final boolean dbg = true;
+    private static final boolean dbg = false;
     private static int dbgIndent = 0;
 
     private static void dprint(String msg) {
--- a/jdk/src/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java	Fri Aug 20 14:48:10 2010 -0400
@@ -81,7 +81,7 @@
         }
 
         RMIClientSocketFactory socketFactory =
-                (RMIClientSocketFactory) env.get(SOCKET_FACTORY);
+                (RMIClientSocketFactory) environment.get(SOCKET_FACTORY);
         registry = getRegistry(host, port, socketFactory);
         this.host = host;
         this.port = port;
--- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources.java	Fri Aug 20 14:48:10 2010 -0400
@@ -45,7 +45,7 @@
      * @return the contents of this <code>ResourceBundle</code>.
      */
     public Object[][] getContents() {
-        return new Object[][] {
+        Object[][] temp = new Object[][] {
         // NOTE: The value strings in this file containing "{0}" are
         //       processed by the java.text.MessageFormat class.  Any
         //       single quotes appearing in these strings need to be
@@ -449,5 +449,7 @@
              "For command help type ''help'' at {0} prompt"},
         // END OF MATERIAL TO LOCALIZE
         };
+
+        return temp;
     }
 }
--- a/jdk/src/share/classes/java/lang/AutoCloseable.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/java/lang/AutoCloseable.java	Fri Aug 20 14:48:10 2010 -0400
@@ -41,6 +41,13 @@
      * be declared to throw more specific exceptions (or no exception
      * at all, if the close cannot fail).
      *
+     * <p>Note that unlike the {@link java.io.Closeable#close close}
+     * method of {@link java.io.Closeable}, this {@code close} method
+     * is <em>not</em> required to be idempotent.  In other words,
+     * calling this {@code close} method more than once may have some
+     * visible side effect, unlike {@code Closeable.close} which is
+     * required to have no effect if called more than once.
+     *
      * @throws Exception if this resource cannot be closed
      */
     void close() throws Exception;
--- a/jdk/src/share/classes/java/lang/Throwable.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/java/lang/Throwable.java	Fri Aug 20 14:48:10 2010 -0400
@@ -28,12 +28,12 @@
 import  java.util.*;
 
 /**
- * The <code>Throwable</code> class is the superclass of all errors and
+ * The {@code Throwable} class is the superclass of all errors and
  * exceptions in the Java language. Only objects that are instances of this
  * class (or one of its subclasses) are thrown by the Java Virtual Machine or
- * can be thrown by the Java <code>throw</code> statement. Similarly, only
+ * can be thrown by the Java {@code throw} statement. Similarly, only
  * this class or one of its subclasses can be the argument type in a
- * <code>catch</code> clause.
+ * {@code catch} clause.
  *
  * For the purposes of compile-time checking of exceptions, {@code
  * Throwable} and any subclass of {@code Throwable} that is not also a
@@ -73,11 +73,11 @@
  * permit the method to throw the cause directly.  For example, suppose
  * a persistent collection conforms to the {@link java.util.Collection
  * Collection} interface, and that its persistence is implemented atop
- * <tt>java.io</tt>.  Suppose the internals of the <tt>add</tt> method
+ * {@code java.io}.  Suppose the internals of the {@code add} method
  * can throw an {@link java.io.IOException IOException}.  The implementation
- * can communicate the details of the <tt>IOException</tt> to its caller
- * while conforming to the <tt>Collection</tt> interface by wrapping the
- * <tt>IOException</tt> in an appropriate unchecked exception.  (The
+ * can communicate the details of the {@code IOException} to its caller
+ * while conforming to the {@code Collection} interface by wrapping the
+ * {@code IOException} in an appropriate unchecked exception.  (The
  * specification for the persistent collection should indicate that it is
  * capable of throwing such exceptions.)
  *
@@ -86,7 +86,7 @@
  * {@link #initCause(Throwable)} method.  New throwable classes that
  * wish to allow causes to be associated with them should provide constructors
  * that take a cause and delegate (perhaps indirectly) to one of the
- * <tt>Throwable</tt> constructors that takes a cause.  For example:
+ * {@code Throwable} constructors that takes a cause.  For example:
  * <pre>
  *     try {
  *         lowLevelOp();
@@ -94,10 +94,10 @@
  *         throw new HighLevelException(le);  // Chaining-aware constructor
  *     }
  * </pre>
- * Because the <tt>initCause</tt> method is public, it allows a cause to be
+ * Because the {@code initCause} method is public, it allows a cause to be
  * associated with any throwable, even a "legacy throwable" whose
  * implementation predates the addition of the exception chaining mechanism to
- * <tt>Throwable</tt>. For example:
+ * {@code Throwable}. For example:
  * <pre>
  *     try {
  *         lowLevelOp();
@@ -121,28 +121,28 @@
  * use the standard exception chaining mechanism, while continuing to
  * implement their "legacy" chaining mechanisms for compatibility.
  *
- * <p>Further, as of release 1.4, many general purpose <tt>Throwable</tt>
+ * <p>Further, as of release 1.4, many general purpose {@code Throwable}
  * classes (for example {@link Exception}, {@link RuntimeException},
  * {@link Error}) have been retrofitted with constructors that take
  * a cause.  This was not strictly necessary, due to the existence of the
- * <tt>initCause</tt> method, but it is more convenient and expressive to
+ * {@code initCause} method, but it is more convenient and expressive to
  * delegate to a constructor that takes a cause.
  *
- * <p>By convention, class <code>Throwable</code> and its subclasses have two
+ * <p>By convention, class {@code Throwable} and its subclasses have two
  * constructors, one that takes no arguments and one that takes a
- * <code>String</code> argument that can be used to produce a detail message.
+ * {@code String} argument that can be used to produce a detail message.
  * Further, those subclasses that might likely have a cause associated with
  * them should have two more constructors, one that takes a
- * <code>Throwable</code> (the cause), and one that takes a
- * <code>String</code> (the detail message) and a <code>Throwable</code> (the
+ * {@code Throwable} (the cause), and one that takes a
+ * {@code String} (the detail message) and a {@code Throwable} (the
  * cause).
  *
  * <p>Also introduced in release 1.4 is the {@link #getStackTrace()} method,
  * which allows programmatic access to the stack trace information that was
  * previously available only in text form, via the various forms of the
  * {@link #printStackTrace()} method.  This information has been added to the
- * <i>serialized representation</i> of this class so <tt>getStackTrace</tt>
- * and <tt>printStackTrace</tt> will operate properly on a throwable that
+ * <i>serialized representation</i> of this class so {@code getStackTrace}
+ * and {@code printStackTrace} will operate properly on a throwable that
  * was obtained by deserialization.
  *
  * @author  unascribed
@@ -162,7 +162,7 @@
 
     /**
      * Specific details about the Throwable.  For example, for
-     * <tt>FileNotFoundException</tt>, this contains the name of
+     * {@code FileNotFoundException}, this contains the name of
      * the file that could not be found.
      *
      * @serial
@@ -212,7 +212,7 @@
     private static final String SUPPRESSED_CAPTION = "Suppressed: ";
 
     /**
-     * Constructs a new throwable with <code>null</code> as its detail message.
+     * Constructs a new throwable with {@code null} as its detail message.
      * The cause is not initialized, and may subsequently be initialized by a
      * call to {@link #initCause}.
      *
@@ -242,7 +242,7 @@
     /**
      * Constructs a new throwable with the specified detail message and
      * cause.  <p>Note that the detail message associated with
-     * <code>cause</code> is <i>not</i> automatically incorporated in
+     * {@code cause} is <i>not</i> automatically incorporated in
      * this throwable's detail message.
      *
      * <p>The {@link #fillInStackTrace()} method is called to initialize
@@ -251,7 +251,7 @@
      * @param  message the detail message (which is saved for later retrieval
      *         by the {@link #getMessage()} method).
      * @param  cause the cause (which is saved for later retrieval by the
-     *         {@link #getCause()} method).  (A <tt>null</tt> value is
+     *         {@link #getCause()} method).  (A {@code null} value is
      *         permitted, and indicates that the cause is nonexistent or
      *         unknown.)
      * @since  1.4
@@ -264,8 +264,8 @@
 
     /**
      * Constructs a new throwable with the specified cause and a detail
-     * message of <tt>(cause==null ? null : cause.toString())</tt> (which
-     * typically contains the class and detail message of <tt>cause</tt>).
+     * message of {@code (cause==null ? null : cause.toString())} (which
+     * typically contains the class and detail message of {@code cause}).
      * This constructor is useful for throwables that are little more than
      * wrappers for other throwables (for example, {@link
      * java.security.PrivilegedActionException}).
@@ -274,7 +274,7 @@
      * the stack trace data in the newly created throwable.
      *
      * @param  cause the cause (which is saved for later retrieval by the
-     *         {@link #getCause()} method).  (A <tt>null</tt> value is
+     *         {@link #getCause()} method).  (A {@code null} value is
      *         permitted, and indicates that the cause is nonexistent or
      *         unknown.)
      * @since  1.4
@@ -288,8 +288,8 @@
     /**
      * Returns the detail message string of this throwable.
      *
-     * @return  the detail message string of this <tt>Throwable</tt> instance
-     *          (which may be <tt>null</tt>).
+     * @return  the detail message string of this {@code Throwable} instance
+     *          (which may be {@code null}).
      */
     public String getMessage() {
         return detailMessage;
@@ -300,7 +300,7 @@
      * Subclasses may override this method in order to produce a
      * locale-specific message.  For subclasses that do not override this
      * method, the default implementation returns the same result as
-     * <code>getMessage()</code>.
+     * {@code getMessage()}.
      *
      * @return  The localized description of this throwable.
      * @since   JDK1.1
@@ -310,22 +310,22 @@
     }
 
     /**
-     * Returns the cause of this throwable or <code>null</code> if the
+     * Returns the cause of this throwable or {@code null} if the
      * cause is nonexistent or unknown.  (The cause is the throwable that
      * caused this throwable to get thrown.)
      *
      * <p>This implementation returns the cause that was supplied via one of
-     * the constructors requiring a <tt>Throwable</tt>, or that was set after
+     * the constructors requiring a {@code Throwable}, or that was set after
      * creation with the {@link #initCause(Throwable)} method.  While it is
      * typically unnecessary to override this method, a subclass can override
      * it to return a cause set by some other means.  This is appropriate for
      * a "legacy chained throwable" that predates the addition of chained
-     * exceptions to <tt>Throwable</tt>.  Note that it is <i>not</i>
-     * necessary to override any of the <tt>PrintStackTrace</tt> methods,
-     * all of which invoke the <tt>getCause</tt> method to determine the
+     * exceptions to {@code Throwable}.  Note that it is <i>not</i>
+     * necessary to override any of the {@code PrintStackTrace} methods,
+     * all of which invoke the {@code getCause} method to determine the
      * cause of a throwable.
      *
-     * @return  the cause of this throwable or <code>null</code> if the
+     * @return  the cause of this throwable or {@code null} if the
      *          cause is nonexistent or unknown.
      * @since 1.4
      */
@@ -345,11 +345,11 @@
      * even once.
      *
      * @param  cause the cause (which is saved for later retrieval by the
-     *         {@link #getCause()} method).  (A <tt>null</tt> value is
+     *         {@link #getCause()} method).  (A {@code null} value is
      *         permitted, and indicates that the cause is nonexistent or
      *         unknown.)
-     * @return  a reference to this <code>Throwable</code> instance.
-     * @throws IllegalArgumentException if <code>cause</code> is this
+     * @return  a reference to this {@code Throwable} instance.
+     * @throws IllegalArgumentException if {@code cause} is this
      *         throwable.  (A throwable cannot be its own cause.)
      * @throws IllegalStateException if this throwable was
      *         created with {@link #Throwable(Throwable)} or
@@ -375,7 +375,7 @@
      * <li> the result of invoking this object's {@link #getLocalizedMessage}
      *      method
      * </ul>
-     * If <tt>getLocalizedMessage</tt> returns <tt>null</tt>, then just
+     * If {@code getLocalizedMessage} returns {@code null}, then just
      * the class name is returned.
      *
      * @return a string representation of this throwable.
@@ -389,8 +389,8 @@
     /**
      * Prints this throwable and its backtrace to the
      * standard error stream. This method prints a stack trace for this
-     * <code>Throwable</code> object on the error output stream that is
-     * the value of the field <code>System.err</code>. The first line of
+     * {@code Throwable} object on the error output stream that is
+     * the value of the field {@code System.err}. The first line of
      * output contains the result of the {@link #toString()} method for
      * this object.  Remaining lines represent data previously recorded by
      * the method {@link #fillInStackTrace()}. The format of this
@@ -435,7 +435,7 @@
      *         at Junk.c(Junk.java:21)
      *         ... 3 more
      * </pre>
-     * Note the presence of lines containing the characters <tt>"..."</tt>.
+     * Note the presence of lines containing the characters {@code "..."}.
      * These lines indicate that the remainder of the stack trace for this
      * exception matches the indicated number of frames from the bottom of the
      * stack trace of the exception that was caused by this exception (the
@@ -542,14 +542,17 @@
     /**
      * Prints this throwable and its backtrace to the specified print stream.
      *
-     * @param s <code>PrintStream</code> to use for output
+     * @param s {@code PrintStream} to use for output
      */
     public void printStackTrace(PrintStream s) {
         printStackTrace(new WrappedPrintStream(s));
     }
 
     private void printStackTrace(PrintStreamOrWriter s) {
-        Set<Throwable> dejaVu = new HashSet<Throwable>();
+        // Guard against malicious overrides of Throwable.equals by
+        // using a Set with identity equality semantics.
+        Set<Throwable> dejaVu =
+            Collections.newSetFromMap(new IdentityHashMap<Throwable, Boolean>());
         dejaVu.add(this);
 
         synchronized (s.lock()) {
@@ -616,7 +619,7 @@
      * Prints this throwable and its backtrace to the specified
      * print writer.
      *
-     * @param s <code>PrintWriter</code> to use for output
+     * @param s {@code PrintWriter} to use for output
      * @since   JDK1.1
      */
     public void printStackTrace(PrintWriter s) {
@@ -669,10 +672,10 @@
 
     /**
      * Fills in the execution stack trace. This method records within this
-     * <code>Throwable</code> object information about the current state of
+     * {@code Throwable} object information about the current state of
      * the stack frames for the current thread.
      *
-     * @return  a reference to this <code>Throwable</code> instance.
+     * @return  a reference to this {@code Throwable} instance.
      * @see     java.lang.Throwable#printStackTrace()
      */
     public synchronized native Throwable fillInStackTrace();
@@ -694,7 +697,7 @@
      * this throwable is permitted to return a zero-length array from this
      * method.  Generally speaking, the array returned by this method will
      * contain one element for every frame that would be printed by
-     * <tt>printStackTrace</tt>.
+     * {@code printStackTrace}.
      *
      * @return an array of stack trace elements representing the stack trace
      *         pertaining to this throwable.
@@ -727,14 +730,14 @@
      * read from a serialization stream.
      *
      * @param   stackTrace the stack trace elements to be associated with
-     * this <code>Throwable</code>.  The specified array is copied by this
+     * this {@code Throwable}.  The specified array is copied by this
      * call; changes in the specified array after the method invocation
-     * returns will have no affect on this <code>Throwable</code>'s stack
+     * returns will have no affect on this {@code Throwable}'s stack
      * trace.
      *
-     * @throws NullPointerException if <code>stackTrace</code> is
-     *         <code>null</code>, or if any of the elements of
-     *         <code>stackTrace</code> are <code>null</code>
+     * @throws NullPointerException if {@code stackTrace} is
+     *         {@code null}, or if any of the elements of
+     *         {@code stackTrace} are {@code null}
      *
      * @since  1.4
      */
@@ -761,8 +764,8 @@
      * package-protection for use by SharedSecrets.
      *
      * @param index index of the element to return.
-     * @throws IndexOutOfBoundsException if <tt>index &lt; 0 ||
-     *         index &gt;= getStackTraceDepth() </tt>
+     * @throws IndexOutOfBoundsException if {@code index < 0 ||
+     *         index >= getStackTraceDepth() }
      */
     native StackTraceElement getStackTraceElement(int index);
 
@@ -794,14 +797,27 @@
      * were suppressed, typically by the automatic resource management
      * statement, in order to deliver this exception.
      *
+     * <p>Note that when one exception {@linkplain
+     * #initCause(Throwable) causes} another exception, the first
+     * exception is usually caught and then the second exception is
+     * thrown in response.  In contrast, when one exception suppresses
+     * another, two exceptions are thrown in sibling code blocks, such
+     * as in a {@code try} block and in its {@code finally} block, and
+     * control flow can only continue with one exception so the second
+     * is recorded as a suppressed exception of the first.
+     *
      * @param exception the exception to be added to the list of
      *        suppressed exceptions
      * @throws NullPointerException if {@code exception} is null
+     * @throws IllegalArgumentException if {@code exception} is this
+     *         throwable; a throwable cannot suppress itself.
      * @since 1.7
      */
     public synchronized void addSuppressedException(Throwable exception) {
         if (exception == null)
             throw new NullPointerException(NULL_CAUSE_MESSAGE);
+        if (exception == this)
+            throw new IllegalArgumentException("Self-suppression not permitted");
 
         if (suppressedExceptions.size() == 0)
             suppressedExceptions = new ArrayList<Throwable>();
--- a/jdk/src/share/classes/java/nio/Bits.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/java/nio/Bits.java	Fri Aug 20 14:48:10 2010 -0400
@@ -596,6 +596,9 @@
         return pageSize;
     }
 
+    static int pageCount(long size) {
+        return (int)(size + (long)pageSize() - 1L) / pageSize();
+    }
 
     private static boolean unaligned;
     private static boolean unalignedKnown = false;
--- a/jdk/src/share/classes/java/nio/MappedByteBuffer.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/java/nio/MappedByteBuffer.java	Fri Aug 20 14:48:10 2010 -0400
@@ -25,6 +25,8 @@
 
 package java.nio;
 
+import sun.misc.Unsafe;
+
 
 /**
  * A direct byte buffer whose content is a memory-mapped region of a file.
@@ -93,6 +95,22 @@
             throw new UnsupportedOperationException();
     }
 
+    // Returns the distance (in bytes) of the buffer from the page aligned address
+    // of the mapping. Computed each time to avoid storing in every direct buffer.
+    private long mappingOffset() {
+        int ps = Bits.pageSize();
+        long offset = address % ps;
+        return (offset >= 0) ? offset : (ps + offset);
+    }
+
+    private long mappingAddress(long mappingOffset) {
+        return address - mappingOffset;
+    }
+
+    private long mappingLength(long mappingOffset) {
+        return (long)capacity() + mappingOffset;
+    }
+
     /**
      * Tells whether or not this buffer's content is resident in physical
      * memory.
@@ -115,7 +133,9 @@
         checkMapped();
         if ((address == 0) || (capacity() == 0))
             return true;
-        return isLoaded0(((DirectByteBuffer)this).address(), capacity());
+        long offset = mappingOffset();
+        long length = mappingLength(offset);
+        return isLoaded0(mappingAddress(offset), length, Bits.pageCount(length));
     }
 
     /**
@@ -132,7 +152,20 @@
         checkMapped();
         if ((address == 0) || (capacity() == 0))
             return this;
-        load0(((DirectByteBuffer)this).address(), capacity(), Bits.pageSize());
+        long offset = mappingOffset();
+        long length = mappingLength(offset);
+        load0(mappingAddress(offset), length);
+
+        // touch each page
+        Unsafe unsafe = Unsafe.getUnsafe();
+        int ps = Bits.pageSize();
+        int count = Bits.pageCount(length);
+        long a = mappingAddress(offset);
+        for (int i=0; i<count; i++) {
+            unsafe.getByte(a);
+            a += ps;
+        }
+
         return this;
     }
 
@@ -156,14 +189,15 @@
      */
     public final MappedByteBuffer force() {
         checkMapped();
-        if ((address == 0) || (capacity() == 0))
-            return this;
-        force0(((DirectByteBuffer)this).address(), capacity());
+        if ((address != 0) && (capacity() != 0)) {
+            long offset = mappingOffset();
+            force0(mappingAddress(offset), mappingLength(offset));
+        }
         return this;
     }
 
-    private native boolean isLoaded0(long address, long length);
-    private native int load0(long address, long length, int pageSize);
+    private native boolean isLoaded0(long address, long length, int pageCount);
+    private native void load0(long address, long length);
     private native void force0(long address, long length);
 
 }
--- a/jdk/src/share/classes/java/security/cert/X509CRL.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/java/security/cert/X509CRL.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -387,7 +387,7 @@
 
     /**
      * Gets the signature algorithm name for the CRL
-     * signature algorithm. An example is the string "SHA-1/DSA".
+     * signature algorithm. An example is the string "SHA256withRSA".
      * The ASN.1 definition for this is:
      * <pre>
      * signatureAlgorithm   AlgorithmIdentifier<p>
--- a/jdk/src/share/classes/java/security/cert/X509Certificate.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/java/security/cert/X509Certificate.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -352,7 +352,7 @@
 
     /**
      * Gets the signature algorithm name for the certificate
-     * signature algorithm. An example is the string "SHA-1/DSA".
+     * signature algorithm. An example is the string "SHA256withRSA".
      * The ASN.1 definition for this is:
      * <pre>
      * signatureAlgorithm   AlgorithmIdentifier<p>
--- a/jdk/src/share/classes/java/util/LinkedList.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/java/util/LinkedList.java	Fri Aug 20 14:48:10 2010 -0400
@@ -26,18 +26,9 @@
 package java.util;
 
 /**
- * Linked list implementation of the {@code List} interface.  Implements all
- * optional list operations, and permits all elements (including
- * {@code null}).  In addition to implementing the {@code List} interface,
- * the {@code LinkedList} class provides uniformly named methods to
- * {@code get}, {@code remove} and {@code insert} an element at the
- * beginning and end of the list.  These operations allow linked lists to be
- * used as a stack, {@linkplain Queue queue}, or {@linkplain Deque
- * double-ended queue}.
- *
- * <p>The class implements the {@code Deque} interface, providing
- * first-in-first-out queue operations for {@code add},
- * {@code poll}, along with other stack and deque operations.
+ * Linked list implementation of the {@link List} and {@link Deque} interfaces.
+ * Implements all optional operations, and permits all elements (including
+ * {@code null}).
  *
  * <p>All of the operations perform as could be expected for a doubly-linked
  * list.  Operations that index into the list will traverse the list from
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -113,7 +113,6 @@
             previewPanelHolder.setBorder(new TitledBorder(previewString));
         }
         previewPanelHolder.setInheritsPopupMenu(true);
-        chooser.add(previewPanelHolder, BorderLayout.SOUTH);
 
         installPreviewPanel();
         chooser.applyComponentOrientation(c.getComponentOrientation());
@@ -126,13 +125,9 @@
 
         uninstallDefaultChoosers();
         uninstallListeners();
+        uninstallPreviewPanel();
         uninstallDefaults();
 
-        previewPanelHolder.remove(previewPanel);
-        if (previewPanel instanceof UIResource) {
-            chooser.setPreviewPanel(null);
-        }
-
         previewPanelHolder = null;
         previewPanel = null;
         defaultChoosers = null;
@@ -143,29 +138,37 @@
     }
 
     protected void installPreviewPanel() {
-        if (previewPanel != null) {
-            previewPanelHolder.remove(previewPanel);
-            previewPanel.removeMouseListener(getHandler());
+        JComponent previewPanel = this.chooser.getPreviewPanel();
+        if (previewPanel == null) {
+            previewPanel = ColorChooserComponentFactory.getPreviewPanel();
         }
-
-        previewPanel = chooser.getPreviewPanel();
-        Dimension layoutSize = new Dimension(); // fix for bug 4759306
-        if (previewPanel != null) {
-            layoutSize = new BorderLayout().minimumLayoutSize(previewPanel);
-            if ((previewPanelHolder != null) && (chooser != null) &&
-            (layoutSize.getWidth() + layoutSize.getHeight() == 0)) {
-              chooser.remove(previewPanelHolder);
-              return;
+        else {
+            Dimension size = new BorderLayout().minimumLayoutSize(previewPanel);
+            if ((size.width == 0) && (size.height == 0)) {
+                previewPanel = null;
             }
         }
-        if (previewPanel == null || previewPanel instanceof UIResource) {
-          previewPanel = ColorChooserComponentFactory.getPreviewPanel(); // get from table?
-            chooser.setPreviewPanel(previewPanel);
+        this.previewPanel = previewPanel;
+        if (previewPanel != null) {
+            chooser.add(previewPanelHolder, BorderLayout.SOUTH);
+            previewPanel.setForeground(chooser.getColor());
+            previewPanelHolder.add(previewPanel);
+            previewPanel.addMouseListener(getHandler());
+            previewPanel.setInheritsPopupMenu(true);
         }
-        previewPanel.setForeground(chooser.getColor());
-        previewPanelHolder.add(previewPanel);
-        previewPanel.addMouseListener(getHandler());
-        previewPanel.setInheritsPopupMenu(true);
+    }
+
+    /**
+     * Removes installed preview panel from the UI delegate.
+     *
+     * @since 1.7
+     */
+    protected void uninstallPreviewPanel() {
+        if (this.previewPanel != null) {
+            this.previewPanel.removeMouseListener(getHandler());
+            this.previewPanelHolder.remove(this.previewPanel);
+        }
+        this.chooser.remove(this.previewPanelHolder);
     }
 
     protected void installDefaults() {
@@ -209,7 +212,6 @@
         chooser.removePropertyChangeListener( propertyChangeListener );
         chooser.getSelectionModel().removeChangeListener(previewListener);
         previewListener = null;
-        previewPanel.removeMouseListener(getHandler());
     }
 
     private void selectionChanged(ColorSelectionModel model) {
@@ -312,9 +314,8 @@
                 }
             }
             else if (prop == JColorChooser.PREVIEW_PANEL_PROPERTY) {
-                if (evt.getNewValue() != previewPanel) {
-                    installPreviewPanel();
-                }
+                uninstallPreviewPanel();
+                installPreviewPanel();
             }
             else if (prop == JColorChooser.SELECTION_MODEL_PROPERTY) {
                 ColorSelectionModel oldModel = (ColorSelectionModel) evt.getOldValue();
@@ -352,5 +353,4 @@
             super("color");
         }
     }
-
 }
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java	Fri Aug 20 14:48:10 2010 -0400
@@ -202,8 +202,8 @@
      * Implementation of ComboPopup.show().
      */
     public void show() {
+        comboBox.firePopupMenuWillBecomeVisible();
         setListSelection(comboBox.getSelectedIndex());
-
         Point location = getPopupLocation();
         show( comboBox, location.x, location.y );
     }
@@ -344,7 +344,8 @@
 
     protected void firePopupMenuWillBecomeVisible() {
         super.firePopupMenuWillBecomeVisible();
-        comboBox.firePopupMenuWillBecomeVisible();
+        // comboBox.firePopupMenuWillBecomeVisible() is called from BasicComboPopup.show() method
+        // to let the user change the popup menu from the PopupMenuListener.popupMenuWillBecomeVisible()
     }
 
     protected void firePopupMenuWillBecomeInvisible() {
--- a/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java	Fri Aug 20 14:48:10 2010 -0400
@@ -570,7 +570,9 @@
             direction = -1;
         }
 
-        if (getOverwriteMode() && rh.text != null) {
+        if (getOverwriteMode() && rh.text != null &&
+            getFormattedTextField().getSelectedText() == null)
+        {
             rh.length = Math.min(Math.max(rh.length, rh.text.length()),
                                  rh.fb.getDocument().getLength() - rh.offset);
         }
--- a/jdk/src/share/classes/javax/swing/text/InternationalFormatter.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/text/InternationalFormatter.java	Fri Aug 20 14:48:10 2010 -0400
@@ -622,18 +622,8 @@
 
     /**
      * Overriden in an attempt to honor the literals.
-     * <p>
-     * If we do
-     * not allow invalid values and are in overwrite mode, this does the
-     * following for each character in the replacement range:
-     * <ol>
-     *   <li>If the character is a literal, add it to the string to replace
-     *       with.  If there is text to insert and it doesn't match the
-     *       literal, then insert the literal in the the middle of the insert
-     *       text.  This allows you to either paste in literals or not and
-     *       get the same behavior.
-     *   <li>If there is no text to insert, replace it with ' '.
-     * </ol>
+     * <p>If we do not allow invalid values and are in overwrite mode, this
+     * {@code rh.length} is corrected as to preserve trailing literals.
      * If not in overwrite mode, and there is text to insert it is
      * inserted at the next non literal index going forward.  If there
      * is only text to remove, it is removed from the next non literal
@@ -643,61 +633,27 @@
         if (!getAllowsInvalid()) {
             String text = rh.text;
             int tl = (text != null) ? text.length() : 0;
+            JTextComponent c = getFormattedTextField();
 
-            if (tl == 0 && rh.length == 1 && getFormattedTextField().
-                              getSelectionStart() != rh.offset) {
+            if (tl == 0 && rh.length == 1 && c.getSelectionStart() != rh.offset) {
                 // Backspace, adjust to actually delete next non-literal.
                 rh.offset = getNextNonliteralIndex(rh.offset, -1);
-            }
-            if (getOverwriteMode()) {
-                StringBuffer replace = null;
+            } else if (getOverwriteMode()) {
+                int pos = rh.offset;
+                int textPos = pos;
+                boolean overflown = false;
 
-                for (int counter = 0, textIndex = 0,
-                         max = Math.max(tl, rh.length); counter < max;
-                         counter++) {
-                    if (isLiteral(rh.offset + counter)) {
-                        if (replace != null) {
-                            replace.append(getLiteral(rh.offset +
-                                                      counter));
-                        }
-                        if (textIndex < tl && text.charAt(textIndex) ==
-                                      getLiteral(rh.offset + counter)) {
-                            textIndex++;
-                        }
-                        else if (textIndex == 0) {
-                            rh.offset++;
-                            rh.length--;
-                            counter--;
-                            max--;
-                        }
-                        else if (replace == null) {
-                            replace = new StringBuffer(max);
-                            replace.append(text.substring(0, textIndex));
-                            replace.append(getLiteral(rh.offset +
-                                                      counter));
-                        }
+                for (int i = 0; i < rh.length; i++) {
+                    while (isLiteral(pos)) pos++;
+                    if (pos >= string.length()) {
+                        pos = textPos;
+                        overflown = true;
+                        break;
                     }
-                    else if (textIndex < tl) {
-                        if (replace != null) {
-                            replace.append(text.charAt(textIndex));
-                        }
-                        textIndex++;
-                    }
-                    else {
-                        // Nothing to replace it with, assume ' '
-                        if (replace == null) {
-                            replace = new StringBuffer(max);
-                            if (textIndex > 0) {
-                                replace.append(text.substring(0, textIndex));
-                            }
-                        }
-                        if (replace != null) {
-                            replace.append(' ');
-                        }
-                    }
+                    textPos = ++pos;
                 }
-                if (replace != null) {
-                    rh.text = replace.toString();
+                if (overflown || c.getSelectedText() == null) {
+                    rh.length = pos - rh.offset;
                 }
             }
             else if (tl > 0) {
--- a/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer.java	Fri Aug 20 14:48:10 2010 -0400
@@ -29,7 +29,7 @@
 public class MsgAppletViewer extends ListResourceBundle {
 
     public Object[][] getContents() {
-        return new Object[][] {
+        Object[][] temp = new Object[][] {
             {"textframe.button.dismiss", "Dismiss"},
             {"appletviewer.tool.title", "Applet Viewer: {0}"},
             {"appletviewer.menu.applet", "Applet"},
@@ -197,5 +197,7 @@
             {"appletsecurityexception.checkread.unknown", "unknown class loader type. unable to check for checking read {0}"},
             {"appletsecurityexception.checkconnect.unknown", "unknown class loader type. unable to check for checking connect"},
         };
+
+        return temp;
     }
 }
--- a/jdk/src/share/classes/sun/net/dns/ResolverConfiguration.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/net/dns/ResolverConfiguration.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -26,7 +26,6 @@
 package sun.net.dns;
 
 import java.util.List;
-import java.io.IOException;
 
 /**
  * The configuration of the client resolver.
@@ -68,7 +67,7 @@
      *
      * @return list of domain names
      */
-    public abstract List searchlist();
+    public abstract List<String> searchlist();
 
     /**
      * Returns a list of name servers used for host name lookup.
@@ -78,7 +77,7 @@
      *
      * @return list of the name servers
      */
-    public abstract List nameservers();
+    public abstract List<String> nameservers();
 
 
     /**
--- a/jdk/src/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -45,20 +45,21 @@
 public final class DNSNameService implements NameService {
 
     // List of domains specified by property
-    private LinkedList domainList = null;
+    private LinkedList<String> domainList = null;
 
     // JNDI-DNS URL for name servers specified via property
     private String nameProviderUrl = null;
 
     // Per-thread soft cache of the last temporary context
-    private static ThreadLocal contextRef = new ThreadLocal();
+    private static ThreadLocal<SoftReference<ThreadContext>> contextRef =
+            new ThreadLocal<>();
 
     // Simple class to encapsulate the temporary context
     private static class ThreadContext {
         private DirContext dirCtxt;
-        private List nsList;
+        private List<String> nsList;
 
-        public ThreadContext(DirContext dirCtxt, List nsList) {
+        public ThreadContext(DirContext dirCtxt, List<String> nsList) {
             this.dirCtxt = dirCtxt;
             this.nsList = nsList;
         }
@@ -67,16 +68,16 @@
             return dirCtxt;
         }
 
-        public List nameservers() {
+        public List<String> nameservers() {
             return nsList;
         }
     }
 
     // Returns a per-thread DirContext
     private DirContext getTemporaryContext() throws NamingException {
-        SoftReference ref = (SoftReference)contextRef.get();
+        SoftReference<ThreadContext> ref = contextRef.get();
         ThreadContext thrCtxt = null;
-        List nsList = null;
+        List<String> nsList = null;
 
         // if no property specified we need to obtain the list of servers
         //
@@ -87,7 +88,7 @@
         // specified then we need to check if the DNS configuration
         // has changed.
         //
-        if ((ref != null) && ((thrCtxt = (ThreadContext)ref.get()) != null)) {
+        if ((ref != null) && ((thrCtxt = ref.get()) != null)) {
             if (nameProviderUrl == null) {
                 if (!thrCtxt.nameservers().equals(nsList)) {
                     // DNS configuration has changed
@@ -98,7 +99,7 @@
 
         // new thread context needs to be created
         if (thrCtxt == null) {
-            final Hashtable<String,Object> env = new Hashtable<String,Object>();
+            final Hashtable<String,Object> env = new Hashtable<>();
             env.put("java.naming.factory.initial",
                     "com.sun.jndi.dns.DnsContextFactory");
 
@@ -119,10 +120,9 @@
             //
             DirContext dirCtxt;
             try {
-                dirCtxt = (DirContext)
-                    java.security.AccessController.doPrivileged(
-                        new java.security.PrivilegedExceptionAction() {
-                            public Object run() throws NamingException {
+                dirCtxt = java.security.AccessController.doPrivileged(
+                        new java.security.PrivilegedExceptionAction<DirContext>() {
+                            public DirContext run() throws NamingException {
                                 // Create the DNS context using NamingManager rather than using
                                 // the initial context constructor. This avoids having the initial
                                 // context constructor call itself.
@@ -130,7 +130,7 @@
                                 if (!(ctx instanceof DirContext)) {
                                     return null; // cannot create a DNS context
                                 }
-                                return ctx;
+                                return (DirContext)ctx;
                             }
                     });
             } catch (java.security.PrivilegedActionException pae) {
@@ -161,18 +161,18 @@
      *
      * @throws  UnknownHostException if lookup fails or other error.
      */
-    private ArrayList resolve(final DirContext ctx, final String name, final String[] ids,
-                              int depth) throws UnknownHostException
+    private ArrayList<String> resolve(final DirContext ctx, final String name,
+                                      final String[] ids, int depth)
+            throws UnknownHostException
     {
-        ArrayList results = new ArrayList();
+        ArrayList<String> results = new ArrayList<>();
         Attributes attrs;
 
         // do the query
         try {
-            attrs = (Attributes)
-                java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedExceptionAction() {
-                        public Object run() throws NamingException {
+            attrs = java.security.AccessController.doPrivileged(
+                    new java.security.PrivilegedExceptionAction<Attributes>() {
+                        public Attributes run() throws NamingException {
                             return ctx.getAttributes(name, ids);
                         }
                 });
@@ -181,7 +181,7 @@
         }
 
         // non-requested type returned so enumeration is empty
-        NamingEnumeration ne = attrs.getAll();
+        NamingEnumeration<? extends Attribute> ne = attrs.getAll();
         if (!ne.hasMoreElements()) {
             throw new UnknownHostException("DNS record not found");
         }
@@ -190,7 +190,7 @@
         UnknownHostException uhe = null;
         try {
             while (ne.hasMoreElements()) {
-                Attribute attr = (Attribute)ne.next();
+                Attribute attr = ne.next();
                 String attrID = attr.getID();
 
                 for (NamingEnumeration e = attr.getAll(); e.hasMoreElements();) {
@@ -251,13 +251,12 @@
             // no property specified so check host DNS resolver configured
             // with at least one nameserver in dotted notation.
             //
-            List nsList = ResolverConfiguration.open().nameservers();
-            if (nsList.size() == 0)
+            List<String> nsList = ResolverConfiguration.open().nameservers();
+            if (nsList.isEmpty()) {
                 throw new RuntimeException("no nameservers provided");
+            }
             boolean found = false;
-            Iterator i = nsList.iterator();
-            while (i.hasNext()) {
-                String addr = (String)i.next();
+            for (String addr: nsList) {
                 if (IPAddressUtil.isIPv4LiteralAddress(addr) ||
                     IPAddressUtil.isIPv6LiteralAddress(addr)) {
                     found = true;
@@ -308,8 +307,8 @@
         // suffix if the list has one entry.
 
         if (results == null) {
-            List searchList = null;
-            Iterator i;
+            List<String> searchList = null;
+            Iterator<String> i;
             boolean usingSearchList = false;
 
             if (domainList != null) {
@@ -324,7 +323,7 @@
 
             // iterator through each domain suffix
             while (i.hasNext()) {
-                String parentDomain = (String)i.next();
+                String parentDomain = i.next();
                 int start = 0;
                 while ((start = parentDomain.indexOf(".")) != -1
                        && start < parentDomain.length() -1) {
@@ -407,7 +406,7 @@
             String literalip = "";
             String[] ids = { "PTR" };
             DirContext ctx;
-            ArrayList results = null;
+            ArrayList<String> results = null;
             try {
                 ctx = getTemporaryContext();
             } catch (NamingException nx) {
@@ -420,7 +419,7 @@
                 literalip += "IN-ADDR.ARPA.";
 
                 results = resolve(ctx, literalip, ids, 0);
-                host = (String)results.get(0);
+                host = results.get(0);
             } else if (addr.length == 16) { // IPv6 Address
                 /**
                  * Because RFC 3152 changed the root domain name for reverse
@@ -437,7 +436,7 @@
 
                 try {
                     results = resolve(ctx, ip6lit, ids, 0);
-                    host = (String)results.get(0);
+                    host = results.get(0);
                 } catch (UnknownHostException e) {
                     host = null;
                 }
@@ -445,7 +444,7 @@
                     // IP6.ARPA lookup failed, let's try the older IP6.INT
                     ip6lit = literalip + "IP6.INT.";
                     results = resolve(ctx, ip6lit, ids, 0);
-                    host = (String)results.get(0);
+                    host = results.get(0);
                 }
             }
         } catch (Exception e) {
@@ -478,11 +477,10 @@
      * @return String containing the JNDI-DNS provider URL
      *         corresponding to the supplied List of nameservers.
      */
-    private static String createProviderURL(List nsList) {
-        Iterator i = nsList.iterator();
+    private static String createProviderURL(List<String> nsList) {
         StringBuffer sb = new StringBuffer();
-        while (i.hasNext()) {
-            appendIfLiteralAddress((String)i.next(), sb);
+        for (String s: nsList) {
+            appendIfLiteralAddress(s, sb);
         }
         return sb.toString();
     }
--- a/jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java	Fri Aug 20 14:48:10 2010 -0400
@@ -336,7 +336,12 @@
     }
 
     public void sendUrgentData(int data) throws IOException {
-        throw new SocketException("Urgent data not supported");
+        synchronized (sc.blockingLock()) {
+            if (!sc.isBlocking())
+                throw new IllegalBlockingModeException();
+            int n = sc.sendOutOfBandData((byte)data);
+            assert n == 1;
+        }
     }
 
     public void setOOBInline(boolean on) throws SocketException {
--- a/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java	Fri Aug 20 14:48:10 2010 -0400
@@ -498,6 +498,36 @@
         return write0(Util.subsequence(srcs, offset, length));
     }
 
+    // package-private
+    int sendOutOfBandData(byte b) throws IOException {
+        synchronized (writeLock) {
+            ensureWriteOpen();
+            int n = 0;
+            try {
+                begin();
+                synchronized (stateLock) {
+                    if (!isOpen())
+                        return 0;
+                    writerThread = NativeThread.current();
+                }
+                for (;;) {
+                    n = sendOutOfBandData(fd, b);
+                    if ((n == IOStatus.INTERRUPTED) && isOpen())
+                        continue;
+                    return IOStatus.normalize(n);
+                }
+            } finally {
+                writerCleanup();
+                end((n > 0) || (n == IOStatus.UNAVAILABLE));
+                synchronized (stateLock) {
+                    if ((n <= 0) && (!isOutputOpen))
+                        throw new AsynchronousCloseException();
+                }
+                assert IOStatus.check(n);
+            }
+        }
+    }
+
     protected void implConfigureBlocking(boolean block) throws IOException {
         IOUtil.configureBlocking(fd, block);
     }
@@ -957,6 +987,9 @@
                                            boolean block, boolean ready)
         throws IOException;
 
+    private static native int sendOutOfBandData(FileDescriptor fd, byte data)
+        throws IOException;
+
     static {
         Util.load();
         nd = new SocketDispatcher();
--- a/jdk/src/share/classes/sun/security/krb5/Config.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/Config.java	Fri Aug 20 14:48:10 2010 -0400
@@ -42,6 +42,8 @@
 import java.util.StringTokenizer;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
+import java.util.List;
+import sun.net.dns.ResolverConfiguration;
 import sun.security.krb5.internal.crypto.EType;
 import sun.security.krb5.internal.ktab.*;
 import sun.security.krb5.internal.Krb5;
@@ -1180,6 +1182,33 @@
         }
         // get the domain realm mapping from the configuration
         String mapRealm = PrincipalName.mapHostToRealm(hostName);
+        if (mapRealm == null) {
+            // No match. Try search and/or domain in /etc/resolv.conf
+            List<String> srchlist = ResolverConfiguration.open().searchlist();
+            for (String domain: srchlist) {
+                realm = checkRealm(domain);
+                if (realm != null) {
+                    break;
+                }
+            }
+        } else {
+            realm = checkRealm(mapRealm);
+        }
+        if (realm == null) {
+            throw new KrbException(Krb5.KRB_ERR_GENERIC,
+                                "Unable to locate Kerberos realm");
+        }
+        return realm;
+    }
+
+    /**
+     * Check if the provided realm is the correct realm
+     * @return the realm if correct, or null otherwise
+     */
+    private static String checkRealm(String mapRealm) {
+        if (DEBUG) {
+            System.out.println("getRealmFromDNS: trying " + mapRealm);
+        }
         String[] records = null;
         String newRealm = mapRealm;
         while ((records == null) && (newRealm != null)) {
@@ -1188,23 +1217,14 @@
             newRealm = Realm.parseRealmComponent(newRealm);
             // if no DNS TXT records found, try again using sub-realm
         }
-        if (records == null) {
-            // no DNS TXT records
-            throw new KrbException(Krb5.KRB_ERR_GENERIC,
-                                "Unable to locate Kerberos realm");
-        }
-        boolean found = false;
-        for (int i = 0; i < records.length; i++) {
-            if (records[i].equals(mapRealm)) {
-                found = true;
-                realm = records[i];
+        if (records != null) {
+            for (int i = 0; i < records.length; i++) {
+                if (records[i].equalsIgnoreCase(mapRealm)) {
+                    return records[i];
+                }
             }
         }
-        if (found == false) {
-            throw new KrbException(Krb5.KRB_ERR_GENERIC,
-                                "Unable to locate Kerberos realm");
-        }
-        return realm;
+        return null;
     }
 
     /**
@@ -1218,10 +1238,16 @@
         String kdcs = null;
         String[] srvs = null;
         // locate DNS SRV record using UDP
-        srvs = KrbServiceLocator.getKerberosService(realm, "_udp.");
+        if (DEBUG) {
+            System.out.println("getKDCFromDNS using UDP");
+        }
+        srvs = KrbServiceLocator.getKerberosService(realm, "_udp");
         if (srvs == null) {
             // locate DNS SRV record using TCP
-            srvs = KrbServiceLocator.getKerberosService(realm, "_tcp.");
+            if (DEBUG) {
+                System.out.println("getKDCFromDNS using UDP");
+            }
+            srvs = KrbServiceLocator.getKerberosService(realm, "_tcp");
         }
         if (srvs == null) {
             // no DNS SRV records
--- a/jdk/src/share/classes/sun/security/krb5/Credentials.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/Credentials.java	Fri Aug 20 14:48:10 2010 -0400
@@ -36,6 +36,7 @@
 import sun.security.krb5.internal.crypto.EType;
 import java.io.IOException;
 import java.util.Date;
+import java.util.Locale;
 import java.net.InetAddress;
 
 /**
@@ -287,7 +288,7 @@
             // The default ticket cache on Windows is not a file.
             String os = java.security.AccessController.doPrivileged(
                         new sun.security.action.GetPropertyAction("os.name"));
-            if (os.toUpperCase().startsWith("WINDOWS")) {
+            if (os.toUpperCase(Locale.ENGLISH).startsWith("WINDOWS")) {
                 Credentials creds = acquireDefaultCreds();
                 if (creds == null) {
                     if (DEBUG) {
--- a/jdk/src/share/classes/sun/security/pkcs/PKCS9Attribute.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs/PKCS9Attribute.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -28,6 +28,7 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.security.cert.CertificateException;
+import java.util.Locale;
 import java.util.Date;
 import java.util.Hashtable;
 import sun.security.x509.CertificateExtensions;
@@ -742,7 +743,7 @@
      * the name.
      */
     public static ObjectIdentifier getOID(String name) {
-        return NAME_OID_TABLE.get(name.toLowerCase());
+        return NAME_OID_TABLE.get(name.toLowerCase(Locale.ENGLISH));
     }
 
     /**
--- a/jdk/src/share/classes/sun/security/pkcs11/P11Cipher.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11Cipher.java	Fri Aug 20 14:48:10 2010 -0400
@@ -26,6 +26,7 @@
 
 import java.nio.ByteBuffer;
 import java.util.Arrays;
+import java.util.Locale;
 
 import java.security.*;
 import java.security.spec.*;
@@ -201,7 +202,7 @@
     }
 
     private int parseMode(String mode) throws NoSuchAlgorithmException {
-        mode = mode.toUpperCase();
+        mode = mode.toUpperCase(Locale.ENGLISH);
         int result;
         if (mode.equals("ECB")) {
             result = MODE_ECB;
@@ -222,7 +223,7 @@
             throws NoSuchPaddingException {
         paddingObj = null;
         padBuffer = null;
-        padding = padding.toUpperCase();
+        padding = padding.toUpperCase(Locale.ENGLISH);
         if (padding.equals("NOPADDING")) {
             paddingType = PAD_NONE;
         } else if (padding.equals("PKCS5PADDING")) {
--- a/jdk/src/share/classes/sun/security/pkcs11/P11RSACipher.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11RSACipher.java	Fri Aug 20 14:48:10 2010 -0400
@@ -29,6 +29,8 @@
 import java.security.spec.AlgorithmParameterSpec;
 import java.security.spec.*;
 
+import java.util.Locale;
+
 import javax.crypto.*;
 import javax.crypto.spec.*;
 
@@ -110,7 +112,7 @@
 
     protected void engineSetPadding(String padding)
             throws NoSuchPaddingException {
-        String lowerPadding = padding.toLowerCase();
+        String lowerPadding = padding.toLowerCase(Locale.ENGLISH);
         if (lowerPadding.equals("pkcs1Padding")) {
             // empty
         } else {
--- a/jdk/src/share/classes/sun/security/provider/certpath/URICertStore.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/security/provider/certpath/URICertStore.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -52,6 +52,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.Locale;
 import sun.security.x509.AccessDescription;
 import sun.security.x509.GeneralNameInterface;
 import sun.security.x509.URIName;
@@ -162,7 +163,7 @@
         }
         this.uri = ((URICertStoreParameters) params).uri;
         // if ldap URI, use an LDAPCertStore to fetch certs and CRLs
-        if (uri.getScheme().toLowerCase().equals("ldap")) {
+        if (uri.getScheme().toLowerCase(Locale.ENGLISH).equals("ldap")) {
             if (LDAP.helper() == null)
                 throw new NoSuchAlgorithmException("LDAP not present");
             ldap = true;
--- a/jdk/src/share/classes/sun/security/util/Debug.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/security/util/Debug.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 import java.math.BigInteger;
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
+import java.util.Locale;
 
 /**
  * A utility class for debuging.
@@ -262,7 +263,7 @@
             source = left;
 
             // convert the rest to lower-case characters
-            target.append(source.toString().toLowerCase());
+            target.append(source.toString().toLowerCase(Locale.ENGLISH));
 
             return target.toString();
         }
--- a/jdk/src/share/classes/sun/security/util/DerOutputStream.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/security/util/DerOutputStream.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -25,17 +25,16 @@
 
 package sun.security.util;
 
-import java.io.FilterOutputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.OutputStream;
 import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.TimeZone;
-import java.util.Vector;
 import java.util.Comparator;
 import java.util.Arrays;
 import java.math.BigInteger;
+import java.util.Locale;
 
 
 /**
@@ -501,7 +500,7 @@
             pattern = "yyyyMMddHHmmss'Z'";
         }
 
-        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
+        SimpleDateFormat sdf = new SimpleDateFormat(pattern, Locale.US);
         sdf.setTimeZone(tz);
         byte[] time = (sdf.format(d)).getBytes("ISO-8859-1");
 
--- a/jdk/src/share/classes/sun/security/x509/AVA.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/security/x509/AVA.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -1227,7 +1227,7 @@
         (String keyword, int standard, Map<String, String> extraKeywordMap)
             throws IOException {
 
-        keyword = keyword.toUpperCase();
+        keyword = keyword.toUpperCase(Locale.ENGLISH);
         if (standard == AVA.RFC2253) {
             if (keyword.startsWith(" ") || keyword.endsWith(" ")) {
                 throw new IOException("Invalid leading or trailing space " +
--- a/jdk/src/share/classes/sun/security/x509/AlgorithmId.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/security/x509/AlgorithmId.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -553,9 +553,10 @@
                 for (Enumeration<Object> enum_ = provs[i].keys();
                      enum_.hasMoreElements(); ) {
                     String alias = (String)enum_.nextElement();
+                    String upperCaseAlias = alias.toUpperCase(Locale.ENGLISH);
                     int index;
-                    if (alias.toUpperCase().startsWith("ALG.ALIAS") &&
-                        (index=alias.toUpperCase().indexOf("OID.", 0)) != -1) {
+                    if (upperCaseAlias.startsWith("ALG.ALIAS") &&
+                            (index=upperCaseAlias.indexOf("OID.", 0)) != -1) {
                         index += "OID.".length();
                         if (index == alias.length()) {
                             // invalid alias entry
@@ -565,19 +566,26 @@
                             oidTable = new HashMap<String,ObjectIdentifier>();
                         }
                         oidString = alias.substring(index);
-                        String stdAlgName
-                            = provs[i].getProperty(alias).toUpperCase();
-                        if (oidTable.get(stdAlgName) == null) {
+                        String stdAlgName = provs[i].getProperty(alias);
+                        if (stdAlgName != null) {
+                            stdAlgName = stdAlgName.toUpperCase(Locale.ENGLISH);
+                        }
+                        if (stdAlgName != null &&
+                                oidTable.get(stdAlgName) == null) {
                             oidTable.put(stdAlgName,
                                          new ObjectIdentifier(oidString));
                         }
                     }
                 }
             }
+
+            if (oidTable == null) {
+                oidTable = new HashMap<String,ObjectIdentifier>(1);
+            }
             initOidTable = true;
         }
 
-        return oidTable.get(name.toUpperCase());
+        return oidTable.get(name.toUpperCase(Locale.ENGLISH));
     }
 
     private static ObjectIdentifier oid(int ... values) {
--- a/jdk/src/share/classes/sun/security/x509/DNSName.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/security/x509/DNSName.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -26,6 +26,7 @@
 package sun.security.x509;
 
 import java.io.IOException;
+import java.util.Locale;
 
 import sun.security.util.*;
 
@@ -198,8 +199,9 @@
         else if (inputName.getType() != NAME_DNS)
             constraintType = NAME_DIFF_TYPE;
         else {
-            String inName = (((DNSName)inputName).getName()).toLowerCase();
-            String thisName = name.toLowerCase();
+            String inName =
+                (((DNSName)inputName).getName()).toLowerCase(Locale.ENGLISH);
+            String thisName = name.toLowerCase(Locale.ENGLISH);
             if (inName.equals(thisName))
                 constraintType = NAME_MATCH;
             else if (thisName.endsWith(inName)) {
--- a/jdk/src/share/classes/sun/security/x509/RFC822Name.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/security/x509/RFC822Name.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -26,6 +26,7 @@
 package sun.security.x509;
 
 import java.io.IOException;
+import java.util.Locale;
 
 import sun.security.util.*;
 
@@ -187,8 +188,9 @@
             constraintType = NAME_DIFF_TYPE;
         } else {
             //RFC2459 specifies that case is not significant in RFC822Names
-            String inName = (((RFC822Name)inputName).getName()).toLowerCase();
-            String thisName = name.toLowerCase();
+            String inName =
+                (((RFC822Name)inputName).getName()).toLowerCase(Locale.ENGLISH);
+            String thisName = name.toLowerCase(Locale.ENGLISH);
             if (inName.equals(thisName)) {
                 constraintType = NAME_MATCH;
             } else if (thisName.endsWith(inName)) {
--- a/jdk/src/share/classes/sun/tools/jconsole/resources/JConsoleResources.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/tools/jconsole/resources/JConsoleResources.java	Fri Aug 20 14:48:10 2010 -0400
@@ -46,8 +46,6 @@
  */
 public class JConsoleResources extends ListResourceBundle {
 
-    private static final String cr = System.getProperty("line.separator");
-
     /**
      * Returns the contents of this <code>ResourceBundle</code>.
      *
@@ -56,8 +54,8 @@
      * @return the contents of this <code>ResourceBundle</code>.
      */
     protected Object[][] getContents0() {
-        return new Object[][] {
-        // NOTE 1: The value strings in this file containing "{0}" are
+        Object[][] temp = new Object[][] {
+                // NOTE 1: The value strings in this file containing "{0}" are
         //         processed by the java.text.MessageFormat class.  Any
         //         single quotes appearing in these strings need to be
         //         doubled up.
@@ -98,7 +96,7 @@
         {"Attributes","Attributes"},
         {"Blank", "Blank"},
         {"BlockedCount WaitedCount",
-             "Total blocked: {0}  Total waited: {1}" + cr},
+             "Total blocked: {0}  Total waited: {1}\n"},
         {"Boot class path","Boot class path"},
         {"BorderedComponent.moreOrLessButton.toolTip", "Toggle to show more or less information"},
         {"CPU Usage","CPU Usage"},
@@ -271,21 +269,21 @@
         {"Minimize All.mnemonic", 'M'},
         {"Minus Version", "This is {0} version {1}"},
         {"Monitor locked",
-             "   - locked {0}" + cr},
+             "   - locked {0}\n"},
         {"Motif","Motif"},
         {"Name Build and Mode","{0} (build {1}, {2})"},
         {"Name and Build","{0} (build {1})"},
         {"Name","Name"},
         {"Name: ","Name: "},
         {"Name State",
-             "Name: {0}" + cr +
-             "State: {1}" + cr},
+             "Name: {0}\n" +
+             "State: {1}\n"},
         {"Name State LockName",
-             "Name: {0}" + cr +
-             "State: {1} on {2}" + cr},
+             "Name: {0}\n" +
+             "State: {1} on {2}\n"},
         {"Name State LockName LockOwner",
-             "Name: {0}" + cr +
-             "State: {1} on {2} owned by: {3}" + cr},
+             "Name: {0}\n" +
+             "State: {1} on {2} owned by: {3}\n"},
         {"New Connection...", "New Connection..."},
         {"New Connection....mnemonic", 'N'},
         {"New value applied","New value applied"},
@@ -351,7 +349,7 @@
         {"Size Mb","{0} Mb"},
         {"Source","Source"},
         {"Stack trace",
-             cr + "Stack trace: " + cr},
+              "\nStack trace: \n"},
         {"Success:","Success:"},
         // Note: SummaryTab.headerDateTimeFormat can be one the following:
         // 1. A combination of two styles for date and time, using the
@@ -433,22 +431,27 @@
         {"plot", "plot"},
         {"visualize","visualize"},
         {"zz usage text",
-             "Usage: {0} [ -interval=n ] [ -notile ] [ -pluginpath <path> ] [ -version ] [ connection ... ]" + cr +
-             cr +
-             "  -interval   Set the update interval to n seconds (default is 4 seconds)" + cr +
-             "  -notile     Do not tile windows initially (for two or more connections)" + cr +
-             "  -pluginpath Specify the path that jconsole uses to look up the plugins" + cr +
-             "  -version    Print program version" + cr +
-             cr +
-             "  connection = pid || host:port || JMX URL (service:jmx:<protocol>://...)" + cr +
-             "  pid         The process id of a target process" + cr +
-             "  host        A remote host name or IP address" + cr +
-             "  port        The port number for the remote connection" + cr +
-             cr +
-             "  -J          Specify the input arguments to the Java virtual machine" + cr +
+             "Usage: {0} [ -interval=n ] [ -notile ] [ -pluginpath <path> ] [ -version ] [ connection ... ]\n\n" +
+             "  -interval   Set the update interval to n seconds (default is 4 seconds)\n" +
+             "  -notile     Do not tile windows initially (for two or more connections)\n" +
+             "  -pluginpath Specify the path that jconsole uses to look up the plugins\n\n" +
+             "  -version    Print program version\n" +
+             "  connection = pid || host:port || JMX URL (service:jmx:<protocol>://...)\n" +
+             "  pid         The process id of a target process\n" +
+             "  host        A remote host name or IP address\n" +
+             "  port        The port number for the remote connection\n\n" +
+             "  -J          Specify the input arguments to the Java virtual machine\n" +
              "              on which jconsole is running"},
         // END OF MATERIAL TO LOCALIZE
         };
+
+        String ls = System.getProperty("line.separator");
+        for(int i=0;i<temp.length;i++) {
+            temp[i][1] = temp[i][1].toString().replaceAll("\n",ls);
+        }
+
+        return temp;
+
     }
 
     public synchronized Object[][] getContents() {
--- a/jdk/src/share/classes/sun/tools/native2ascii/resources/MsgNative2ascii.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/share/classes/sun/tools/native2ascii/resources/MsgNative2ascii.java	Fri Aug 20 14:48:10 2010 -0400
@@ -30,12 +30,14 @@
 public class MsgNative2ascii extends ListResourceBundle {
 
     public Object[][] getContents() {
-        return new Object[][] {
+        Object[][] temp = new Object[][] {
         {"err.bad.arg", "-encoding requires argument"},
         {"err.cannot.read",  "{0} could not be read."},
         {"err.cannot.write", "{0} could not be written."},
         {"usage", "Usage: native2ascii" +
          " [-reverse] [-encoding encoding] [inputfile [outputfile]]"},
         };
+
+        return temp;
     }
 }
--- a/jdk/src/solaris/classes/sun/net/dns/ResolverConfigurationImpl.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/solaris/classes/sun/net/dns/ResolverConfigurationImpl.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -56,8 +56,11 @@
     // Parse /etc/resolv.conf to get the values for a particular
     // keyword.
     //
-    private LinkedList resolvconf(String keyword, int maxperkeyword, int maxkeywords) {
-        LinkedList ll = new LinkedList();
+    private LinkedList<String> resolvconf(String keyword,
+                                          int maxperkeyword,
+                                          int maxkeywords)
+    {
+        LinkedList<String> ll = new LinkedList<>();
 
         try {
             BufferedReader in =
@@ -99,8 +102,8 @@
         return ll;
     }
 
-    private LinkedList searchlist;
-    private LinkedList nameservers;
+    private LinkedList<String> searchlist;
+    private LinkedList<String> nameservers;
 
 
     // Load DNS configuration from OS
@@ -118,9 +121,9 @@
 
         // get the name servers from /etc/resolv.conf
         nameservers =
-            (LinkedList)java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
-                    public Object run() {
+            java.security.AccessController.doPrivileged(
+                new java.security.PrivilegedAction<LinkedList<String>>() {
+                    public LinkedList<String> run() {
                         // typically MAXNS is 3 but we've picked 5 here
                         // to allow for additional servers if required.
                         return resolvconf("nameserver", 1, 5);
@@ -137,15 +140,15 @@
 
     // obtain search list or local domain
 
-    private LinkedList getSearchList() {
+    private LinkedList<String> getSearchList() {
 
-        LinkedList sl;
+        LinkedList<String> sl;
 
         // first try the search keyword in /etc/resolv.conf
 
-        sl = (LinkedList)java.security.AccessController.doPrivileged(
-                 new java.security.PrivilegedAction() {
-                    public Object run() {
+        sl = java.security.AccessController.doPrivileged(
+                 new java.security.PrivilegedAction<LinkedList<String>>() {
+                    public LinkedList<String> run() {
                         LinkedList ll;
 
                         // first try search keyword (max 6 domains)
@@ -177,10 +180,10 @@
 
         // try domain keyword in /etc/resolv.conf
 
-        sl = (LinkedList)java.security.AccessController.doPrivileged(
-                 new java.security.PrivilegedAction() {
-                    public Object run() {
-                        LinkedList ll;
+        sl = java.security.AccessController.doPrivileged(
+                 new java.security.PrivilegedAction<LinkedList<String>>() {
+                    public LinkedList<String> run() {
+                        LinkedList<String> ll;
 
                         ll = resolvconf("domain", 1, 1);
                         if (ll.size() > 0) {
@@ -197,7 +200,7 @@
         // no local domain so try fallback (RPC) domain or
         // hostname
 
-        sl = new LinkedList();
+        sl = new LinkedList<>();
         String domain = fallbackDomain0();
         if (domain != null && domain.length() > 0) {
             sl.add(domain);
@@ -213,7 +216,7 @@
         opts = new OptionsImpl();
     }
 
-    public List searchlist() {
+    public List<String> searchlist() {
         synchronized (lock) {
             loadConfig();
 
@@ -222,7 +225,7 @@
         }
     }
 
-    public List nameservers() {
+    public List<String> nameservers() {
         synchronized (lock) {
             loadConfig();
 
--- a/jdk/src/solaris/native/java/net/NetworkInterface.c	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/solaris/native/java/net/NetworkInterface.c	Fri Aug 20 14:48:10 2010 -0400
@@ -131,7 +131,7 @@
 static short   getSubnet(JNIEnv *env, int sock, const char *ifname);
 static int     getIndex(int sock, const char *ifname);
 
-static int     getFlags(JNIEnv *env, int sock, const char *ifname);
+static int     getFlags(int sock, const char *ifname);
 static int     getMacAddress(JNIEnv *env, int sock,  const char* ifname, const struct in_addr* addr, unsigned char *buf);
 static int     getMTU(JNIEnv *env, int sock, const char *ifname);
 
@@ -550,7 +550,7 @@
 
     name_utf = (*env)->GetStringUTFChars(env, name, &isCopy);
 
-    ret = getFlags(env, sock, name_utf);
+    ret = getFlags(sock, name_utf);
 
     close(sock);
     (*env)->ReleaseStringUTFChars(env, name, name_utf);
@@ -753,19 +753,27 @@
      * If IPv6 is available then enumerate IPv6 addresses.
      */
 #ifdef AF_INET6
-        sock =  openSocket(env, AF_INET6);
-        if (sock < 0 && (*env)->ExceptionOccurred(env)) {
-            freeif(ifs);
-            return NULL;
-        }
+
+        /* User can disable ipv6 expicitly by -Djava.net.preferIPv4Stack=true,
+         * so we have to call ipv6_available()
+         */
+        if (ipv6_available()) {
 
-        ifs = enumIPv6Interfaces(env, sock, ifs);
-        close(sock);
+           sock =  openSocket(env, AF_INET6);
+           if (sock < 0 && (*env)->ExceptionOccurred(env)) {
+               freeif(ifs);
+               return NULL;
+           }
 
-        if ((*env)->ExceptionOccurred(env)) {
-            freeif(ifs);
-            return NULL;
-        }
+           ifs = enumIPv6Interfaces(env, sock, ifs);
+           close(sock);
+
+           if ((*env)->ExceptionOccurred(env)) {
+              freeif(ifs);
+              return NULL;
+           }
+
+       }
 #endif
 
     return ifs;
@@ -877,7 +885,7 @@
        * the 'parent' interface with the new records.
        */
         *name_colonP = 0;
-        if (getFlags(env,sock,name) < 0) {
+        if (getFlags(sock, name) < 0) {
             // failed to access parent interface do not create parent.
             // We are a virtual interface with no parent.
             isVirtual = 1;
@@ -1249,7 +1257,7 @@
     return  if2.ifr_mtu;
 }
 
-static int getFlags(JNIEnv *env, int sock, const char *ifname) {
+static int getFlags(int sock, const char *ifname) {
   struct ifreq if2;
   int ret = -1;
 
@@ -1625,13 +1633,12 @@
 }
 
 
-static int getFlags(JNIEnv *env, int sock, const char *ifname) {
+static int getFlags(int sock, const char *ifname) {
      struct   lifreq lifr;
      memset((caddr_t)&lifr, 0, sizeof(lifr));
      strcpy((caddr_t)&(lifr.lifr_name), ifname);
 
      if (ioctl(sock, SIOCGLIFFLAGS, (char *)&lifr) < 0) {
-         NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "IOCTL SIOCGLIFFLAGS failed");
          return -1;
      }
 
--- a/jdk/src/solaris/native/java/nio/MappedByteBuffer.c	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/solaris/native/java/nio/MappedByteBuffer.c	Fri Aug 20 14:48:10 2010 -0400
@@ -32,14 +32,11 @@
 #include <stddef.h>
 #include <stdlib.h>
 
-
 JNIEXPORT jboolean JNICALL
-Java_java_nio_MappedByteBuffer_isLoaded0(JNIEnv *env, jobject obj,
-                                        jlong address, jlong len)
+Java_java_nio_MappedByteBuffer_isLoaded0(JNIEnv *env, jobject obj, jlong address,
+                                         jlong len, jint numPages)
 {
     jboolean loaded = JNI_TRUE;
-    jint pageSize = sysconf(_SC_PAGESIZE);
-    jint numPages = (len + pageSize - 1) / pageSize;
     int result = 0;
     int i = 0;
     void *a = (void *) jlong_to_ptr(address);
@@ -55,9 +52,9 @@
     }
 
     result = mincore(a, (size_t)len, vec);
-    if (result != 0) {
+    if (result == -1) {
+        JNU_ThrowIOExceptionWithLastError(env, "mincore failed");
         free(vec);
-        JNU_ThrowIOExceptionWithLastError(env, "mincore failed");
         return JNI_FALSE;
     }
 
@@ -72,23 +69,15 @@
 }
 
 
-JNIEXPORT jint JNICALL
+JNIEXPORT void JNICALL
 Java_java_nio_MappedByteBuffer_load0(JNIEnv *env, jobject obj, jlong address,
-                                     jlong len, jint pageSize)
+                                     jlong len)
 {
-    int pageIncrement = pageSize / sizeof(int);
-    int numPages = (len + pageSize - 1) / pageSize;
-    int *ptr = (int *)jlong_to_ptr(address);
-    int i = 0;
-    int j = 0;
-    int result = madvise((caddr_t)ptr, len, MADV_WILLNEED);
-
-    /* touch every page */
-    for (i=0; i<numPages; i++) {
-        j += *((volatile int *)ptr);
-        ptr += pageIncrement;
+    char *a = (char *)jlong_to_ptr(address);
+    int result = madvise((caddr_t)a, (size_t)len, MADV_WILLNEED);
+    if (result == -1) {
+        JNU_ThrowIOExceptionWithLastError(env, "madvise failed");
     }
-    return j;
 }
 
 
@@ -96,13 +85,9 @@
 Java_java_nio_MappedByteBuffer_force0(JNIEnv *env, jobject obj, jlong address,
                                       jlong len)
 {
-    jlong pageSize = sysconf(_SC_PAGESIZE);
-    unsigned long lAddress = address;
-
-    jlong offset = lAddress % pageSize;
-    void *a = (void *) jlong_to_ptr(lAddress - offset);
-    int result = msync(a, (size_t)(len + offset), MS_SYNC);
-    if (result != 0) {
+    void* a = (void *)jlong_to_ptr(address);
+    int result = msync(a, (size_t)len, MS_SYNC);
+    if (result == -1) {
         JNU_ThrowIOExceptionWithLastError(env, "msync failed");
     }
 }
--- a/jdk/src/solaris/native/sun/nio/ch/SocketChannelImpl.c	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/solaris/native/sun/nio/ch/SocketChannelImpl.c	Fri Aug 20 14:48:10 2010 -0400
@@ -84,3 +84,11 @@
     }
     return 0;
 }
+
+JNIEXPORT jint JNICALL
+Java_sun_nio_ch_SocketChannelImpl_sendOutOfBandData(JNIEnv* env, jclass this,
+                                                    jobject fdo, jbyte b)
+{
+    int n = send(fdval(env, fdo), (const void*)&b, 1, MSG_OOB);
+    return convertReturnVal(env, n, JNI_FALSE);
+}
--- a/jdk/src/windows/classes/sun/net/dns/ResolverConfigurationImpl.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/windows/classes/sun/net/dns/ResolverConfigurationImpl.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -28,7 +28,6 @@
 import java.util.List;
 import java.util.LinkedList;
 import java.util.StringTokenizer;
-import java.io.IOException;
 
 /*
  * An implementation of sun.net.ResolverConfiguration for Windows.
@@ -63,8 +62,8 @@
 
     // Parse string that consists of token delimited by space or commas
     // and return LinkedHashMap
-    private LinkedList stringToList(String str) {
-        LinkedList ll = new LinkedList();
+    private LinkedList<String> stringToList(String str) {
+        LinkedList<String> ll = new LinkedList<>();
 
         // comma and space are valid delimites
         StringTokenizer st = new StringTokenizer(str, ", ");
@@ -112,7 +111,7 @@
         opts = new OptionsImpl();
     }
 
-    public List searchlist() {
+    public List<String> searchlist() {
         synchronized (lock) {
             loadConfig();
 
@@ -121,7 +120,7 @@
         }
     }
 
-    public List nameservers() {
+    public List<String> nameservers() {
         synchronized (lock) {
             loadConfig();
 
--- a/jdk/src/windows/native/java/nio/MappedByteBuffer.c	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/windows/native/java/nio/MappedByteBuffer.c	Fri Aug 20 14:48:10 2010 -0400
@@ -31,8 +31,8 @@
 #include <stdlib.h>
 
 JNIEXPORT jboolean JNICALL
-Java_java_nio_MappedByteBuffer_isLoaded0(JNIEnv *env, jobject obj,
-                                        jlong address, jlong len)
+Java_java_nio_MappedByteBuffer_isLoaded0(JNIEnv *env, jobject obj, jlong address,
+                                         jlong len, jint numPages)
 {
     jboolean loaded = JNI_FALSE;
     /* Information not available?
@@ -43,22 +43,11 @@
     return loaded;
 }
 
-JNIEXPORT jint JNICALL
+JNIEXPORT void JNICALL
 Java_java_nio_MappedByteBuffer_load0(JNIEnv *env, jobject obj, jlong address,
-                                     jlong len, jint pageSize)
+                                     jlong len)
 {
-    int *ptr = (int *) jlong_to_ptr(address);
-    int pageIncrement = pageSize / sizeof(int);
-    jlong numPages = (len + pageSize - 1) / pageSize;
-    int i = 0;
-    int j = 0;
-
-    /* touch every page */
-    for (i=0; i<numPages; i++) {
-        j += *((volatile int *)ptr);
-        ptr += pageIncrement;
-    }
-    return j;
+    // no madvise available
 }
 
 JNIEXPORT void JNICALL
--- a/jdk/src/windows/native/sun/nio/ch/SocketChannelImpl.c	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/windows/native/sun/nio/ch/SocketChannelImpl.c	Fri Aug 20 14:48:10 2010 -0400
@@ -139,3 +139,16 @@
 
     return 0;
 }
+
+JNIEXPORT jint JNICALL
+Java_sun_nio_ch_SocketChannelImpl_sendOutOfBandData(JNIEnv* env, jclass this,
+                                                    jobject fdo, jbyte b)
+{
+    int n = send(fdval(env, fdo), (const char*)&b, 1, MSG_OOB);
+    if (n == SOCKET_ERROR) {
+        handleSocketError(env, WSAGetLastError());
+        return IOS_THROWN;
+    } else {
+        return n;
+    }
+}
--- a/jdk/src/windows/native/sun/windows/awt.h	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/src/windows/native/sun/windows/awt.h	Fri Aug 20 14:48:10 2010 -0400
@@ -310,24 +310,32 @@
  * Class to encapsulate the extraction of the java string contents
  * into a buffer and the cleanup of the buffer
  */
- class JavaStringBuffer
+class JavaStringBuffer
 {
 protected:
     LPWSTR m_pStr;
     jsize  m_dwSize;
+    LPWSTR getNonEmptyString() {
+        return (NULL==m_pStr)
+                ? L""
+                : m_pStr;
+    }
 
 public:
     JavaStringBuffer(jsize cbTCharCount) {
         m_dwSize = cbTCharCount;
-        m_pStr = (LPWSTR)safe_Malloc( (m_dwSize+1)*sizeof(WCHAR) );
+        m_pStr = (0 == m_dwSize)
+            ? NULL
+            : (LPWSTR)safe_Malloc( (m_dwSize+1)*sizeof(WCHAR) );
     }
 
     JavaStringBuffer(JNIEnv *env, jstring text) {
-        if (NULL == text) {
-            m_pStr = L"";
-            m_dwSize = 0;
+        m_dwSize = (NULL == text)
+            ? 0
+            : env->GetStringLength(text);
+        if (0 == m_dwSize) {
+            m_pStr = NULL;
         } else {
-            m_dwSize = env->GetStringLength(text);
             m_pStr = (LPWSTR)safe_Malloc( (m_dwSize+1)*sizeof(WCHAR) );
             env->GetStringRegion(text, 0, m_dwSize, reinterpret_cast<jchar *>(m_pStr));
             m_pStr[m_dwSize] = 0;
@@ -341,12 +349,16 @@
 
     void Resize(jsize cbTCharCount) {
         m_dwSize = cbTCharCount;
+        //It is ok to have non-null terminated string here.
+        //The function is used only for space reservation in staff buffer for
+        //followed data copying process. And that is the reason why we ignore
+        //the special case m_dwSize==0 here.
         m_pStr = (LPWSTR)safe_Realloc(m_pStr, (m_dwSize+1)*sizeof(WCHAR) );
     }
     //we are in UNICODE now, so LPWSTR:=:LPTSTR
-    operator LPWSTR() { return m_pStr; }
-    operator LPARAM() { return (LPARAM)m_pStr; }
-    void *GetData() { return (void *)m_pStr; }
+    operator LPWSTR() { return getNonEmptyString(); }
+    operator LPARAM() { return (LPARAM)getNonEmptyString(); }
+    void *GetData() { return (void *)getNonEmptyString(); }
     jsize  GetSize() { return m_dwSize; }
 };
 
--- a/jdk/test/ProblemList.txt	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/ProblemList.txt	Fri Aug 20 14:48:10 2010 -0400
@@ -366,139 +366,6 @@
 
 # jdk_net
 
-# Suspect many of these tests auffer from using fixed ports, no concrete 
-#   evidence.
-
-# Times out on Windows X64
-sun/net/www/http/KeepAliveStream/KeepAliveStreamCloseWithWrongContentLength.java generic-all
-
-# Dies on Solaris 10 sparc and sparcv9, Linux  -ea -esa with 
-#   Interrupted or IO exception, maybe writing to non-unique named file?
-com/sun/net/httpserver/bugs/B6373555.java			generic-all
-
-# Fails on OpenSolaris, times out
-java/net/MulticastSocket/SetOutgoingIf.java			generic-all
-
-# Timed out on Solaris 10 X86.
-com/sun/net/httpserver/Test3.java				generic-all
-
-# Exception in test on windows
-com/sun/net/httpserver/bugs/B6373555.java		 	windows-all
-
-# One of these pollutes the samevm on Linux, too many open files, kills jtreg
-com/sun/net/httpserver/bugs/B6339483.java			generic-all
-com/sun/net/httpserver/bugs/B6341616.java			generic-all
-
-# Suspects in cascading samevm problem, solaris 11 i586 (needs othervm?)
-#   Suspect use of setHttps*()?
-com/sun/net/httpserver/SelCacheTest.java			generic-all
-com/sun/net/httpserver/Test1.java				generic-all
-com/sun/net/httpserver/Test12.java				generic-all
-com/sun/net/httpserver/Test13.java				generic-all
-com/sun/net/httpserver/Test6a.java				generic-all
-com/sun/net/httpserver/Test7a.java				generic-all
-com/sun/net/httpserver/Test8a.java				generic-all
-com/sun/net/httpserver/Test9.java				generic-all
-com/sun/net/httpserver/Test9a.java				generic-all
-
-# 10,000 connections, fails on Linux and makes tests&jtreg fail with samevm
-com/sun/net/httpserver/bugs/B6361557.java			generic-all
-
-# Address already in use with samevm? Always? Solaris sparc, probably ports
-java/net/Authenticator/B4933582.sh				generic-all
-java/net/DatagramSocket/SendSize.java				generic-all
-
-# Solaris 11: exception wrong address???
-java/net/Inet6Address/B6558853.java				generic-all
-
-# Not closing stream on file i6a1, windows samevm problem
-java/net/Inet6Address/serialize/Serialize.java			generic-all
-
-# Linux x64 fails "network unreachable"?
-java/net/ipv6tests/TcpTest.java 			 	generic-all
-
-# Linux i586, fails with unexpected output
-java/net/MulticastSocket/NoLoopbackPackets.java 	 	linux-i586
-
-# Address already in use
-java/net/DatagramSocket/DatagramTimeout.java			generic-all
-
-# Fails on windows, takes too long and fails
-#   Solaris 10 sparcv9, samevm, java.lang.Exception: Takes too long. Dead lock
-java/net/Socket/DeadlockTest.java				generic-all
-
-# Linux i586 address already in use or connection error, samevm issues
-java/net/Socket/AccurateTimeout.java			 	generic-all
-java/net/Socket/asyncClose/BrokenPipe.java		 	generic-all
-java/net/Socket/CloseAvailable.java			 	generic-all
-
-# Linux X64 address already in use, samevm issues
-java/net/Socket/LingerTest.java 			 	generic-all
-java/net/Socket/LinkLocal.java				 	generic-all
-java/net/Socket/NullHost.java				 	generic-all
-java/net/Socket/ProxyCons.java				 	generic-all
-java/net/Socket/ReadTimeout.java			 	generic-all
-
-# Linux X64 address already in use, samevm issues
-java/net/Socket/SetReceiveBufferSize.java		 	generic-all
-
-# Linux i586 address already in use or connection error, samevm issues
-java/net/Socket/setReuseAddress/Basic.java		 	generic-all
-java/net/Socket/setReuseAddress/Restart.java		 	generic-all
-
-# Linux X64 address already in use, samevm issues
-java/net/Socket/SetSoLinger.java			 	generic-all
-
-# Address already in use, windows samevm
-java/net/Socket/Timeout.java					generic-all
-
-# Linux X64 address already in use, samevm issues
-java/net/Socket/ShutdownBoth.java			 	generic-all
-java/net/Socket/SoTimeout.java				 	generic-all
-java/net/Socket/TestClose.java				 	generic-all
-java/net/Socket/UrgentDataTest.java			 	generic-all
-java/net/SocketInputStream/SocketClosedException.java	 	generic-all
-java/net/SocketInputStream/SocketTimeout.java		 	generic-all
-
-# Linux i586, address already in use or timeout, samevm issues
-java/net/URLConnection/DisconnectAfterEOF.java		 	generic-all
-java/net/URLConnection/HandleContentTypeWithAttrs.java	 	generic-all
-java/net/URLConnection/Responses.java			 	generic-all
-java/net/URLConnection/TimeoutTest.java 		 	generic-all
-java/net/URLConnection/ZeroContentLength.java		 	generic-all
-
-# Solaris 11 i586 fails with samevm, not sure why
-java/net/ResponseCache/B6181108.java				generic-all
-java/net/ResponseCache/ResponseCacheTest.java			generic-all
-java/net/URL/GetContent.java					generic-all
-java/net/URLConnection/HttpContinueStackOverflow.java		generic-all
-java/net/URLConnection/Redirect307Test.java			generic-all
-java/net/URLConnection/RedirectLimit.java			generic-all
-java/net/URLConnection/ResendPostBody.java			generic-all
-java/net/URL/OpenStream.java					generic-all
-java/net/URLClassLoader/ClassLoad.java				generic-all
-java/net/URLConnection/SetIfModifiedSince.java			generic-all
-java/net/URLConnection/URLConnectionHeaders.java		generic-all
-
-# Linux i586 Connection refused or address already in use, samevm issues
-sun/net/ftp/B6427768.java				 	generic-all
-sun/net/ftp/FtpGetContent.java				 	generic-all
-sun/net/ftp/FtpURL.java 				 	generic-all
-
-# Failed on solaris 10 i586, Exception: should have gotten HttpRetryException?
-sun/net/www/http/ChunkedOutputStream/Test.java			generic-all
-
-# Trouble cleaning up threads in samevm mode on solaris 11 i586
-sun/net/www/http/HttpClient/ProxyTest.java			generic-all
-sun/net/www/http/ChunkedInputStream/ChunkedEncodingTest.java	generic-all
-sun/net/www/http/ChunkedInputStream/ChunkedEncodingWithProgressMonitorTest.java	generic-all
-sun/net/www/http/HttpClient/B6726695.java			generic-all
-sun/net/www/http/HttpClient/MultiThreadTest.java		generic-all
-sun/net/www/http/KeepAliveCache/KeepAliveTimerThread.java	generic-all
-
-# Connection refused, windows samevm
-sun/net/www/protocol/http/DigestTest.java			generic-all
-
 ############################################################################
 
 # jdk_io
--- a/jdk/test/com/sun/jdi/ShellScaffold.sh	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/com/sun/jdi/ShellScaffold.sh	Fri Aug 20 14:48:10 2010 -0400
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 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
@@ -141,7 +141,10 @@
 cleanup()
 {
     if [ -r "$failFile" ] ; then
-        cat $failFile  >& 2
+        ls -l "$failFile" >&2
+        echo "<cleanup:_begin_failFile_contents>" >&2
+        cat "$failFile" >&2
+        echo "<cleanup:_end_failFile_contents>" >&2
     fi
 
     # Kill all processes that have our special
@@ -337,6 +340,10 @@
     failFile=$tmpFileDir/testFailed
     debuggeepidFile=$tmpFileDir/debuggeepid
     rm -f $failFile $debuggeepidFile
+    if [ -f "$failFile" ]; then
+        echo "ERROR: unable to delete existing failFile:" >&2
+        ls -l "$failFile" >&2
+    fi
 
     if [ -z "$pkg" ] ; then
         pkgSlash=
@@ -524,6 +531,10 @@
         # See 6562090. Maybe there is a way that the exit
         # can cause jdb to not get the quit.
         sleep 5
+
+        # The exit code value here doesn't matter since this function
+        # is called as part of a pipeline and it is not the last command
+        # in the pipeline.
         exit 1
     fi
     
@@ -938,6 +949,10 @@
     done
 
     if [ -r "$failFile" ] ; then
+        ls -l "$failFile" >&2
+        echo "<waitForFinish:_begin_failFile_contents>" >&2
+        cat "$failFile" >&2
+        echo "<waitForFinish:_end_failFile_contents>" >&2
         exit 1
     fi
 }
@@ -946,33 +961,45 @@
 # $3 is the number of lines to search (from the end)
 grepForString()
 {
-    # See bug 6220903.  Sometimes the jdb '> ' prompt chars
-    # get inserted into the string we are searching for 
-    # so ignore those chars.
     if [ -z "$3" ] ; then
         theCmd=cat
     else
         theCmd="tail -$3"
     fi
+
     case "$2" in 
-      *\>*)
-        # Target string contains a > so we better
-        # not ignore it
+    *\>*)
+        # Target string contains a '>' so we better not ignore it
         $theCmd $1 | $grep -s "$2"  > $devnull 2>&1
-        return $?
+        stat="$?"
         ;;
+    *)
+        # Target string does not contain a '>'.
+        # NOTE:  if $1 does not end with a new line, piping it to sed
+        # doesn't include the chars on the last line.  Detect this
+        # case, and add a new line.
+        theFile="$1"
+        if [ `tail -1 "$theFile" | wc -l | sed -e 's@ @@g'` = 0 ] ; then
+            # The target file doesn't end with a new line so we have
+            # add one to a copy of the target file so the sed command
+            # below can filter that last line.
+            cp "$theFile" "$theFile.tmp"
+            theFile="$theFile.tmp"
+            echo >> "$theFile"
+        fi
+
+        # See bug 6220903. Sometimes the jdb prompt chars ('> ') can
+        # get interleaved in the target file which can keep us from
+        # matching the target string.
+        $theCmd "$theFile" | sed -e 's@> @@g' -e 's@>@@g' \
+            | $grep -s "$2" > $devnull 2>&1
+        stat=$?
+        if [ "$theFile" != "$1" ]; then
+            # remove the copy of the target file
+            rm -f "$theFile"
+        fi
+        unset theFile
     esac
-    # Target string does not contain a >.
-    # Ignore > and '> ' in the file.
-    # NOTE:  if $1 does not end with a new line, piping it to sed doesn't include the
-    # chars on the last line.  Detect this case, and add a new line.
-    cp $1 $1.tmp
-    if [ `tail -1 $1.tmp | wc -l | sed -e 's@ @@g'` = 0 ] ; then
-        echo >> $1.tmp
-    fi
-    $theCmd $1.tmp | sed -e 's@> @@g' -e 's@>@@g' | $grep -s "$2" > $devnull 2>&1
-    stat=$?
-    rm -f $1.tmp
     return $stat
 }
 
@@ -1037,6 +1064,11 @@
         echo
         echo "--Done: test passed"
         exit 0
+    else
+        ls -l "$failFile" >&2
+        echo "<pass:_begin_failFile_contents>" >&2
+        cat "$failFile" >&2
+        echo "<pass:_end_failFile_contents>" >&2
     fi
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jndi/rmi/registry/RegistryContext/ContextWithNullProperties.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6676075
+ * @summary RegistryContext (com.sun.jndi.url.rmi.rmiURLContext) coding problem
+ */
+
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+
+import com.sun.jndi.rmi.registry.*;
+
+public class ContextWithNullProperties {
+
+    public static void main(String[] args) throws Exception {
+
+        // Create registry on port 1099 if one is not already running.
+        try {
+            LocateRegistry.createRegistry(1099);
+        } catch (RemoteException e) {
+        }
+
+        System.out.println("Connecting to the default Registry...");
+        // Connect to the default Registry.
+        // Pass null as the JNDI environment properties (see final argument)
+        RegistryContext ctx = new RegistryContext(null, -1, null);
+    }
+}
--- a/jdk/test/com/sun/net/httpserver/Test1.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/com/sun/net/httpserver/Test1.java	Fri Aug 20 14:48:10 2010 -0400
@@ -24,17 +24,15 @@
 /**
  * @test
  * @bug 6270015
+ * @run main/othervm Test1
  * @summary  Light weight HTTP server
  */
 
 import com.sun.net.httpserver.*;
 
-import java.util.*;
 import java.util.concurrent.*;
 import java.io.*;
 import java.net.*;
-import java.security.*;
-import java.security.cert.*;
 import javax.net.ssl.*;
 
 /* basic http/s connectivity test
--- a/jdk/test/com/sun/net/httpserver/Test11.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/com/sun/net/httpserver/Test11.java	Fri Aug 20 14:48:10 2010 -0400
@@ -28,7 +28,6 @@
  */
 
 import java.net.*;
-import java.util.*;
 import java.util.concurrent.*;
 import java.io.*;
 import com.sun.net.httpserver.*;
@@ -52,22 +51,25 @@
 
     public static void main (String[] args) throws Exception {
         System.out.print ("Test 11: ");
-        HttpServer server = HttpServer.create (new InetSocketAddress(0), 0);
-        HttpContext ctx = server.createContext (
-            "/foo/bar/", new Handler ()
-        );
-        ExecutorService s =  Executors.newCachedThreadPool();
-        server.setExecutor (s);
-        server.start ();
-        URL url = new URL ("http://localhost:" + server.getAddress().getPort()+
-                "/Foo/bar/test.html");
-        HttpURLConnection urlc = (HttpURLConnection)url.openConnection();
-        int r = urlc.getResponseCode();
-        System.out.println ("OK");
-        s.shutdown();
-        server.stop(5);
-        if (r == 200) {
-            throw new RuntimeException ("wrong response received");
+        HttpServer server = HttpServer.create(new InetSocketAddress(0), 0);
+        ExecutorService s = Executors.newCachedThreadPool();
+        try {
+            HttpContext ctx = server.createContext (
+                "/foo/bar/", new Handler ()
+            );
+            s =  Executors.newCachedThreadPool();
+            server.start ();
+            URL url = new URL ("http://localhost:" + server.getAddress().getPort()+
+                    "/Foo/bar/test.html");
+            HttpURLConnection urlc = (HttpURLConnection)url.openConnection();
+            int r = urlc.getResponseCode();
+            if (r == 200) {
+                throw new RuntimeException ("wrong response received");
+            }
+            System.out.println ("OK");
+        } finally {
+            s.shutdown();
+            server.stop(2);
         }
     }
 }
--- a/jdk/test/com/sun/net/httpserver/Test12.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/com/sun/net/httpserver/Test12.java	Fri Aug 20 14:48:10 2010 -0400
@@ -24,17 +24,15 @@
 /**
  * @test
  * @bug 6270015
+ * @run main/othervm Test12
  * @summary  Light weight HTTP server
  */
 
 import com.sun.net.httpserver.*;
 
-import java.util.*;
 import java.util.concurrent.*;
 import java.io.*;
 import java.net.*;
-import java.security.*;
-import java.security.cert.*;
 import javax.net.ssl.*;
 
 /* basic http/s connectivity test
--- a/jdk/test/com/sun/net/httpserver/Test13.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/com/sun/net/httpserver/Test13.java	Fri Aug 20 14:48:10 2010 -0400
@@ -24,17 +24,16 @@
 /**
  * @test
  * @bug 6270015
+ * @run main/othervm Test13
  * @summary  Light weight HTTP server
  */
 
 import com.sun.net.httpserver.*;
 
-import java.util.*;
 import java.util.concurrent.*;
 import java.io.*;
 import java.net.*;
-import java.security.*;
-import java.security.cert.*;
+
 import javax.net.ssl.*;
 
 /* basic http/s connectivity test
--- a/jdk/test/com/sun/net/httpserver/Test6a.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/com/sun/net/httpserver/Test6a.java	Fri Aug 20 14:48:10 2010 -0400
@@ -24,17 +24,15 @@
 /**
  * @test
  * @bug 6270015
+ * @run main/othervm Test6a
  * @summary  Light weight HTTP server
  */
 
 import com.sun.net.httpserver.*;
 
-import java.util.*;
 import java.util.concurrent.*;
 import java.io.*;
 import java.net.*;
-import java.security.*;
-import javax.security.auth.callback.*;
 import javax.net.ssl.*;
 
 /**
--- a/jdk/test/com/sun/net/httpserver/Test7a.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/com/sun/net/httpserver/Test7a.java	Fri Aug 20 14:48:10 2010 -0400
@@ -24,18 +24,15 @@
 /**
  * @test
  * @bug 6270015
+ * @run main/othervm Test7a
  * @summary  Light weight HTTP server
  */
 
 import com.sun.net.httpserver.*;
 
-import java.util.*;
 import java.util.concurrent.*;
-import java.util.logging.*;
 import java.io.*;
 import java.net.*;
-import java.security.*;
-import javax.security.auth.callback.*;
 import javax.net.ssl.*;
 
 /**
--- a/jdk/test/com/sun/net/httpserver/Test8a.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/com/sun/net/httpserver/Test8a.java	Fri Aug 20 14:48:10 2010 -0400
@@ -24,18 +24,15 @@
 /**
  * @test
  * @bug 6270015
+ * @run main/othervm Test8a
  * @summary  Light weight HTTP server
  */
 
 import com.sun.net.httpserver.*;
 
-import java.util.*;
 import java.util.concurrent.*;
-import java.util.logging.*;
 import java.io.*;
 import java.net.*;
-import java.security.*;
-import javax.security.auth.callback.*;
 import javax.net.ssl.*;
 
 /**
@@ -50,46 +47,50 @@
         //h.setLevel (Level.INFO);
         //log.addHandler (h);
         //log.setLevel (Level.INFO);
-        Handler handler = new Handler();
-        InetSocketAddress addr = new InetSocketAddress (0);
-        HttpsServer server = HttpsServer.create (addr, 0);
-        HttpContext ctx = server.createContext ("/test", handler);
-        ExecutorService executor = Executors.newCachedThreadPool();
-        SSLContext ssl = new SimpleSSLContext(System.getProperty("test.src")).get();
-        server.setHttpsConfigurator(new HttpsConfigurator (ssl));
-        server.setExecutor (executor);
-        server.start ();
+        HttpsServer server = null;
+        ExecutorService executor = null;
+        try {
+            Handler handler = new Handler();
+            InetSocketAddress addr = new InetSocketAddress (0);
+            server = HttpsServer.create (addr, 0);
+            HttpContext ctx = server.createContext ("/test", handler);
+            executor = Executors.newCachedThreadPool();
+            SSLContext ssl = new SimpleSSLContext(System.getProperty("test.src")).get();
+            server.setHttpsConfigurator(new HttpsConfigurator (ssl));
+            server.setExecutor (executor);
+            server.start ();
 
-        URL url = new URL ("https://localhost:"+server.getAddress().getPort()+"/test/foo.html");
-        System.out.print ("Test8a: " );
-        HttpsURLConnection urlc = (HttpsURLConnection)url.openConnection ();
-        urlc.setDoOutput (true);
-        urlc.setRequestMethod ("POST");
-        urlc.setHostnameVerifier (new DummyVerifier());
-        urlc.setSSLSocketFactory (ssl.getSocketFactory());
-        OutputStream os = new BufferedOutputStream (urlc.getOutputStream(), 8000);
-        for (int i=0; i<SIZE; i++) {
-            os.write (i % 250);
+            URL url = new URL ("https://localhost:"+server.getAddress().getPort()+"/test/foo.html");
+            System.out.print ("Test8a: " );
+            HttpsURLConnection urlc = (HttpsURLConnection)url.openConnection ();
+            urlc.setDoOutput (true);
+            urlc.setRequestMethod ("POST");
+            urlc.setHostnameVerifier (new DummyVerifier());
+            urlc.setSSLSocketFactory (ssl.getSocketFactory());
+            OutputStream os = new BufferedOutputStream (urlc.getOutputStream(), 8000);
+            for (int i=0; i<SIZE; i++) {
+                os.write (i % 250);
+            }
+            os.close();
+            int resp = urlc.getResponseCode();
+            if (resp != 200) {
+                throw new RuntimeException ("test failed response code");
+            }
+            InputStream is = urlc.getInputStream ();
+            for (int i=0; i<SIZE; i++) {
+                int f = is.read();
+                if (f != (i % 250)) {
+                    System.out.println ("Setting error(" +f +")("+i+")" );
+                    error = true;
+                    break;
+                }
+            }
+            is.close();
+        } finally {
+            delay();
+            if (server != null) server.stop(2);
+            if (executor != null) executor.shutdown();
         }
-        os.close();
-        int resp = urlc.getResponseCode();
-        if (resp != 200) {
-            throw new RuntimeException ("test failed response code");
-        }
-        InputStream is = urlc.getInputStream ();
-        for (int i=0; i<SIZE; i++) {
-            int f = is.read();
-            if (f != (i % 250)) {
-                System.out.println ("Setting error(" +f +")("+i+")" );
-                error = true;
-                break;
-            }
-        }
-        is.close();
-
-        delay();
-        server.stop(2);
-        executor.shutdown();
         if (error) {
             throw new RuntimeException ("test failed error");
         }
--- a/jdk/test/com/sun/net/httpserver/Test9.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/com/sun/net/httpserver/Test9.java	Fri Aug 20 14:48:10 2010 -0400
@@ -24,17 +24,15 @@
 /**
  * @test
  * @bug 6270015
+ * @run main/othervm Test9
  * @summary  Light weight HTTP server
  */
 
 import com.sun.net.httpserver.*;
 
-import java.util.*;
 import java.util.concurrent.*;
 import java.io.*;
 import java.net.*;
-import java.security.*;
-import java.security.cert.*;
 import javax.net.ssl.*;
 
 /* Same as Test1 but requests run in parallel.
--- a/jdk/test/com/sun/net/httpserver/Test9a.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/com/sun/net/httpserver/Test9a.java	Fri Aug 20 14:48:10 2010 -0400
@@ -24,17 +24,15 @@
 /**
  * @test
  * @bug 6270015
+ * @run main/othervm Test9a
  * @summary  Light weight HTTP server
  */
 
 import com.sun.net.httpserver.*;
 
-import java.util.*;
 import java.util.concurrent.*;
 import java.io.*;
 import java.net.*;
-import java.security.*;
-import java.security.cert.*;
 import javax.net.ssl.*;
 
 /* Same as Test1 but requests run in parallel.
--- a/jdk/test/com/sun/net/httpserver/bugs/B6361557.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/com/sun/net/httpserver/bugs/B6361557.java	Fri Aug 20 14:48:10 2010 -0400
@@ -24,6 +24,7 @@
 /**
  * @test
  * @bug 6361557
+ * @run main/othervm B6361557
  * @summary  Lightweight HTTP server quickly runs out of file descriptors on Linux
  */
 
@@ -35,12 +36,9 @@
 import java.nio.*;
 import java.nio.channels.*;
 import java.net.*;
-import java.security.*;
-import java.security.cert.*;
-import javax.net.ssl.*;
 
 /**
- * The test simply opens 10,000 separate connections
+ * The test simply opens 1,000 separate connections
  * and invokes one http request on each. The client does
  * not close any sockets until after they are closed
  * by the server. This verifies the basic ability
@@ -49,6 +47,7 @@
 public class B6361557 {
 
     public static boolean error = false;
+    static final int NUM = 1000;
 
     static class Handler implements HttpHandler {
         int invocation = 1;
@@ -65,6 +64,9 @@
         }
     }
 
+    final static String request = "GET /test/foo.html HTTP/1.1\r\nContent-length: 0\r\n\r\n";
+    final static ByteBuffer requestBuf = ByteBuffer.allocate(64).put(request.getBytes());
+
     public static void main (String[] args) throws Exception {
         Handler handler = new Handler();
         InetSocketAddress addr = new InetSocketAddress (0);
@@ -75,49 +77,72 @@
         server.setExecutor (executor);
         server.start ();
 
-        final int NUM = 10000;
-        ByteBuffer buf = ByteBuffer.allocate (4096);
         InetSocketAddress destaddr = new InetSocketAddress (
                 "127.0.0.1", server.getAddress().getPort()
         );
         System.out.println ("destaddr " + destaddr);
 
         Selector selector = Selector.open ();
-        int i = 0;
+        int requests = 0;
+        int responses = 0;
         while (true) {
-            i ++;
             int selres = selector.select (1);
             Set<SelectionKey> selkeys = selector.selectedKeys();
             for (SelectionKey key : selkeys) {
                 if (key.isReadable()) {
                     SocketChannel chan = (SocketChannel)key.channel();
-                    buf.clear();
+                    ByteBuffer buf = (ByteBuffer)key.attachment();
                     try {
-                        int x = chan.read (buf);
-                        if (x == -1) {
+                        int x = chan.read(buf);
+                        if (x == -1 || responseComplete(buf)) {
+                            key.attach(null);
                             chan.close();
+                            responses++;
                         }
                     } catch (IOException e) {}
                 }
             }
-            if (i< NUM) {
-                SocketChannel schan = SocketChannel.open (destaddr);
-                String cmd = "GET /test/foo.html HTTP/1.1\r\nContent-length: 0\r\n\r\n";
-                buf.rewind ();
-                buf.put (cmd.getBytes());
-                buf.flip();
+            if (requests < NUM) {
+                SocketChannel schan = SocketChannel.open(destaddr);
+                requestBuf.rewind();
                 int c = 0;
-                while (buf.remaining() > 0) {
-                    c += schan.write (buf);
+                while (requestBuf.remaining() > 0) {
+                    c += schan.write(requestBuf);
                 }
-                schan.configureBlocking (false);
-                schan.register (selector, SelectionKey.OP_READ, null);
-            } else {
+                schan.configureBlocking(false);
+                schan.register(selector, SelectionKey.OP_READ, ByteBuffer.allocate(100));
+                requests++;
+            }
+            if (responses == NUM) {
                 System.out.println ("Finished clients");
-                server.stop (1);
-                executor.shutdown ();
-                return;
+                break;
             }
         }
+        server.stop (1);
+        selector.close();
+        executor.shutdown ();
+
+    }
+
+    /* Look for CR LF CR LF */
+    static boolean responseComplete(ByteBuffer buf) {
+        int pos = buf.position();
+        buf.flip();
+        byte[] lookingFor = new byte[] {'\r', '\n', '\r', '\n' };
+        int lookingForCount = 0;
+        while (buf.hasRemaining()) {
+            byte b = buf.get();
+            if (b == lookingFor[lookingForCount]) {
+                lookingForCount++;
+                if (lookingForCount == 4) {
+                    return true;
+                }
+            } else {
+                lookingForCount = 0;
+            }
+        }
+        buf.position(pos);
+        buf.limit(buf.capacity());
+        return false;
     }
 }
--- a/jdk/test/com/sun/net/httpserver/bugs/B6373555.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/com/sun/net/httpserver/bugs/B6373555.java	Fri Aug 20 14:48:10 2010 -0400
@@ -46,7 +46,7 @@
     private static Object lock;
     static HttpServer httpServer;
     static ExecutorService pool, execs;
-    static int NUM = 4000;
+    static int NUM = 1000;
 
     public static void main(String[] args) throws Exception {
         try {
@@ -125,7 +125,7 @@
                 }
             }
             catch(Exception e) {
-                //e.printStackTrace();
+                e.printStackTrace();
                 System.out.print (".");
                 error = true;
             }
--- a/jdk/test/java/beans/XMLEncoder/Test4631471.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/beans/XMLEncoder/Test4631471.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4631471
+ * @bug 4631471 6972468
  * @summary Tests DefaultTreeModel encoding
  * @author Sergey Malenkov, Mark Davidson
  */
@@ -37,6 +37,12 @@
 
 public abstract class Test4631471 extends AbstractTest {
     public static void main(String[] args) throws Exception {
+        main();
+        System.setSecurityManager(new SecurityManager());
+        main();
+    }
+
+    private static void main() throws Exception {
         // the DefaultMutableTreeNode will archive correctly
         new Test4631471() {
             protected Object getObject() {
--- a/jdk/test/java/beans/XMLEncoder/Test4903007.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/beans/XMLEncoder/Test4903007.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4903007
+ * @bug 4903007 6972468
  * @summary Tests encoding of container with boxes and BoxLayout
  * @author Sergey Malenkov, Mark Davidson
  */
@@ -36,7 +36,7 @@
 
 public class Test4903007 extends AbstractTest<JPanel> {
     public static void main(String[] args) throws Exception {
-        new Test4903007().test(false); // TODO: could not encode with security manager
+        new Test4903007().test(true);
     }
 
     protected JPanel getObject() {
--- a/jdk/test/java/beans/XMLEncoder/javax_swing_JLayeredPane.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/beans/XMLEncoder/javax_swing_JLayeredPane.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 5023552
+ * @bug 5023552 6972468
  * @summary Tests JLayeredPane encoding
  * @author Sergey Malenkov
  */
@@ -35,7 +35,7 @@
 
 public final class javax_swing_JLayeredPane extends AbstractTest<JLayeredPane> {
     public static void main(String[] args) {
-        new javax_swing_JLayeredPane().test(false); // TODO: could not encode with security manager
+        new javax_swing_JLayeredPane().test(true);
     }
 
     private static void init(JLayeredPane pane, int layer, int x, int y, int w, int h, Color color) {
--- a/jdk/test/java/lang/Throwable/SuppressedExceptions.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/lang/Throwable/SuppressedExceptions.java	Fri Aug 20 14:48:10 2010 -0400
@@ -26,7 +26,7 @@
 
 /*
  * @test
- * @bug     6911258 6962571
+ * @bug     6911258 6962571 6963622
  * @summary Basic tests of suppressed exceptions
  * @author  Joseph D. Darcy
  */
@@ -35,11 +35,22 @@
     private static String message = "Bad suppressed exception information";
 
     public static void main(String... args) throws Exception {
+        noSelfSuppression();
         basicSupressionTest();
         serializationTest();
         selfReference();
     }
 
+    private static void noSelfSuppression() {
+        Throwable throwable = new Throwable();
+        try {
+            throwable.addSuppressedException(throwable);
+            throw new RuntimeException("IllegalArgumentException for self-suppresion not thrown.");
+        } catch (IllegalArgumentException iae) {
+            ; // Expected
+        }
+    }
+
     private static void basicSupressionTest() {
         Throwable throwable = new Throwable();
         RuntimeException suppressed = new RuntimeException("A suppressed exception.");
@@ -156,9 +167,8 @@
 
         throwable1.printStackTrace();
 
-
-        throwable1.addSuppressedException(throwable1);
         throwable1.addSuppressedException(throwable2);
+        throwable2.addSuppressedException(throwable1);
 
         throwable1.printStackTrace();
     }
--- a/jdk/test/java/net/DatagramSocket/DatagramTimeout.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/DatagramSocket/DatagramTimeout.java	Fri Aug 20 14:48:10 2010 -0400
@@ -27,25 +27,25 @@
  * @summary  test to see if timeout hangs
  * @run main/timeout=15 DatagramTimeout
  */
-import java.net.*;
-import java.io.*;
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+import java.net.SocketTimeoutException;
 
 public class DatagramTimeout {
-
-    public static ServerSocket sock;
-
     public static void main(String[] args) throws Exception {
         boolean success = false;
+        DatagramSocket sock = new DatagramSocket();
+
         try {
-            DatagramSocket sock;
             DatagramPacket p;
             byte[] buffer = new byte[50];
             p = new DatagramPacket(buffer, buffer.length);
-            sock = new DatagramSocket(2333);
             sock.setSoTimeout(2);
             sock.receive(p);
         } catch (SocketTimeoutException e) {
             success = true;
+        } finally {
+            sock.close();
         }
         if (!success)
             throw new RuntimeException("Socket timeout failure.");
--- a/jdk/test/java/net/DatagramSocket/SendSize.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/DatagramSocket/SendSize.java	Fri Aug 20 14:48:10 2010 -0400
@@ -32,35 +32,26 @@
  * @author Benjamin Renaud
  */
 
-import java.io.*;
-import java.net.*;
-import java.util.*;
+import java.io.IOException;
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+import java.net.InetAddress;
 
 public class SendSize {
-
-    static final int clientPort = 8989;
-    static final int serverPort = 9999;
     static final int bufferLength = 512;
     static final int packetLength = 256;
 
     public static void main(String[] args) throws Exception {
-        new ServerThread().start();
-        new ClientThread().start();
+        DatagramSocket serverSocket = new DatagramSocket();
+        new ServerThread(serverSocket).start();
+        new ClientThread(serverSocket.getLocalPort()).start();
     }
 
-
     static class ServerThread extends Thread {
-
-        int port;
         DatagramSocket server;
 
-        ServerThread(int port) throws IOException {
-            this.port = port;
-            this.server = new DatagramSocket(port);
-        }
-
-        ServerThread() throws IOException {
-            this(SendSize.serverPort);
+        ServerThread(DatagramSocket server) {
+            this.server = server;
         }
 
         public void run() {
@@ -85,33 +76,22 @@
             } catch (Exception e) {
                 e.printStackTrace();
                 throw new RuntimeException("caugth: " + e);
+            } finally {
+                if (server != null) { server.close(); }
             }
         }
     }
 
     static class ClientThread extends Thread {
 
-        int port;
         int serverPort;
-        int bufferLength;
-        int packetLength;
-
         DatagramSocket client;
         InetAddress host;
 
-        ClientThread(int port, int serverPort,
-                     int bufferLength, int packetLength) throws IOException {
-            this.port = port;
+        ClientThread(int serverPort)throws IOException {
             this.serverPort = serverPort;
             this.host = InetAddress.getLocalHost();
-            this.bufferLength = bufferLength;
-            this.packetLength = packetLength;
-            this.client = new DatagramSocket(port, host);
-        }
-
-        ClientThread() throws IOException {
-            this(SendSize.clientPort, SendSize.serverPort,
-                 SendSize.bufferLength, SendSize.packetLength);
+            this.client = new DatagramSocket();
         }
 
         public void run() {
@@ -129,6 +109,8 @@
             } catch (Exception e) {
                 e.printStackTrace();
                 throw new RuntimeException("caught: " + e);
+            } finally {
+                if (client != null) { client.close(); }
             }
         }
     }
--- a/jdk/test/java/net/Inet6Address/B6558853.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/Inet6Address/B6558853.java	Fri Aug 20 14:48:10 2010 -0400
@@ -43,6 +43,9 @@
         InetAddress dest = null;
         while (l.hasMoreElements() && dest == null) {
             NetworkInterface nif = l.nextElement();
+            if (!nif.isUp())
+                continue;
+
             for (InterfaceAddress a : nif.getInterfaceAddresses()) {
                 if (a.getAddress() instanceof Inet6Address) {
                     Inet6Address a6 = (Inet6Address) a.getAddress();
@@ -53,6 +56,7 @@
                 }
             }
         }
+        System.out.println("Using " + dest);
         if (dest != null) {
             B6558853 test = new B6558853(dest, port);
             Thread thread = new Thread(test);
--- a/jdk/test/java/net/Inet6Address/serialize/Serialize.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/Inet6Address/serialize/Serialize.java	Fri Aug 20 14:48:10 2010 -0400
@@ -72,6 +72,7 @@
          File file = new File (System.getProperty("test.src"), "serial1.4.2.ser");
          ois = new ObjectInputStream(new FileInputStream(file));
          nobj = (Inet6Address) ois.readObject();
+         ois.close();
          if (!nobj.equals (InetAddress.getByName ("::1"))) {
             throw new RuntimeException ("old ::1 not deserialized right");
          }
@@ -90,6 +91,8 @@
              nobj = (Inet6Address) ois.readObject();
          } catch (NullPointerException e) {
              throw new RuntimeException("6656849 Not fixed: NullPointer when deserializing");
+         } finally {
+             ois.close();
          }
          System.out.println(nobj);
          System.out.println("All tests passed");
@@ -102,6 +105,7 @@
 
          ObjectInputStream ois = new ObjectInputStream(new FileInputStream("i6a1.ser"));
          Inet6Address nobj = (Inet6Address) ois.readObject();
+         ois.close();
 
          if (nobj.equals(obj)) {
              return true;
--- a/jdk/test/java/net/InetAddress/CheckJNI.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/InetAddress/CheckJNI.java	Fri Aug 20 14:48:10 2010 -0400
@@ -56,6 +56,8 @@
 
         while (ifs.hasMoreElements()) {
             NetworkInterface nif = (NetworkInterface)ifs.nextElement();
+            if (!nif.isUp())
+                continue;
             Enumeration addrs = nif.getInetAddresses();
             while (addrs.hasMoreElements()) {
                 InetAddress addr = (InetAddress) addrs.nextElement();
--- a/jdk/test/java/net/MulticastSocket/SetOutgoingIf.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/MulticastSocket/SetOutgoingIf.java	Fri Aug 20 14:48:10 2010 -0400
@@ -76,6 +76,10 @@
 
                 // now determine what (if any) type of addresses are assigned to this interface
                 for (InetAddress addr : Collections.list(nic.getInetAddresses())) {
+                    if (addr.isAnyLocalAddress())
+                        continue;
+
+                    System.out.println("    addr " + addr);
                     if (addr instanceof Inet4Address) {
                         netIf.ipv4Address(true);
                     } else if (addr instanceof Inet6Address) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/NetworkInterface/IPv4Only.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug   6964714
+ * @run main/othervm IPv4Only
+ * @summary Test the networkinterface listing with java.net.preferIPv4Stack=true.
+ */
+
+
+import java.net.*;
+import java.util.*;
+
+
+public class IPv4Only {
+    public static void main(String[] args) throws Exception {
+        System.setProperty("java.net.preferIPv4Stack","true");
+
+        Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces();
+        while (nifs.hasMoreElements()) {
+            NetworkInterface nif = nifs.nextElement();
+            Enumeration<InetAddress> addrs = nif.getInetAddresses();
+            while (addrs.hasMoreElements()) {
+               InetAddress hostAddr = addrs.nextElement();
+               if ( hostAddr instanceof Inet6Address ){
+                    throw new RuntimeException( "NetworkInterfaceV6List failed - found v6 address " + hostAddr.getHostAddress() );
+               }
+            }
+        }
+    }
+}
--- a/jdk/test/java/net/ResponseCache/B6181108.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/ResponseCache/B6181108.java	Fri Aug 20 14:48:10 2010 -0400
@@ -67,9 +67,10 @@
             out.flush();
 
             s.close();
-            ss.close();
         } catch (Exception e) {
             e.printStackTrace();
+        } finally {
+            try { ss.close(); } catch (IOException unused) {}
         }
     }
 
@@ -100,6 +101,7 @@
         URLConnection urlc = url.openConnection();
         int i = ((HttpURLConnection)(urlc)).getResponseCode();
         System.out.println ("response code = " + i);
+        ResponseCache.setDefault(null);
     }
 
     public static void main(String args[]) throws Exception {
--- a/jdk/test/java/net/ResponseCache/ResponseCacheTest.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/ResponseCache/ResponseCacheTest.java	Fri Aug 20 14:48:10 2010 -0400
@@ -30,7 +30,6 @@
 import java.net.*;
 import java.util.*;
 import java.io.*;
-import java.nio.*;
 import sun.net.www.ParseUtil;
 import javax.net.ssl.*;
 
@@ -43,11 +42,16 @@
     static URL url1;
     static URL url2;
     static String FNPrefix, OutFNPrefix;
+    static List<Closeable> streams = new ArrayList<>();
+    static List<File> files = new ArrayList<>();
+
     /*
      * Our "http" server to return a 404 */
     public void run() {
+        Socket s = null;
+        FileInputStream fis = null;
         try {
-            Socket s = ss.accept();
+            s = ss.accept();
 
             InputStream is = s.getInputStream ();
             BufferedReader r = new BufferedReader(new InputStreamReader(is));
@@ -68,7 +72,7 @@
             out.print("Content-Length: "+file2.length()+"\r\n");
             out.print("Connection: close\r\n");
             out.print("\r\n");
-            FileInputStream fis = new FileInputStream(file2);
+            fis = new FileInputStream(file2);
             byte[] buf = new byte[(int)file2.length()];
             int len;
             while ((len = fis.read(buf)) != -1) {
@@ -81,6 +85,10 @@
             ss.close();
         } catch (Exception e) {
             e.printStackTrace();
+        } finally {
+            try { ss.close(); } catch (IOException unused) {}
+            try { s.close(); } catch (IOException unused) {}
+            try { fis.close(); } catch (IOException unused) {}
         }
     }
 static class NameVerifier implements HostnameVerifier {
@@ -144,11 +152,14 @@
         // assert (headers1 == headers2 && file1 == file2.2)
         File file1 = new File(OutFNPrefix+"file1");
         File file2 = new File(OutFNPrefix+"file2.2");
+        files.add(file1);
+        files.add(file2);
         System.out.println("headers1"+headers1+"\nheaders2="+headers2);
         if (!headers1.equals(headers2) || file1.length() != file2.length()) {
             throw new RuntimeException("test failed");
         }
     }
+
     public static void main(String args[]) throws Exception {
         try {
             ResponseCache.setDefault(new MyResponseCache());
@@ -157,6 +168,12 @@
             new ResponseCacheTest();
         } finally{
             ResponseCache.setDefault(null);
+            for (Closeable c: streams) {
+                try { c.close(); } catch (IOException unused) {}
+            }
+            for (File f: files) {
+                f.delete();
+            }
         }
     }
 
@@ -184,6 +201,7 @@
         public MyCacheResponse(String filename) {
             try {
                 fis = new FileInputStream(new File(filename));
+                streams.add(fis);
                 ObjectInputStream ois = new ObjectInputStream(fis);
                 headers = (Map<String,List<String>>)ois.readObject();
             } catch (Exception ex) {
@@ -206,6 +224,8 @@
             try {
                 File file = new File(filename);
                 fos = new FileOutputStream(file);
+                streams.add(fos);
+                files.add(file);
                 ObjectOutputStream oos = new ObjectOutputStream(fos);
                 oos.writeObject(rspHeaders);
             } catch (Exception ex) {
--- a/jdk/test/java/net/ResponseCache/getResponseCode.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/ResponseCache/getResponseCode.java	Fri Aug 20 14:48:10 2010 -0400
@@ -39,6 +39,7 @@
 public class getResponseCode {
     static URL url;
     static String FNPrefix;
+    static List<Closeable> resources = new ArrayList<>();
 
     getResponseCode() throws Exception {
         url = new URL("http://localhost/file1.cache");
@@ -57,6 +58,9 @@
             new getResponseCode();
         } finally{
             ResponseCache.setDefault(null);
+            for (Closeable c : resources) {
+                try { c.close(); } catch (IOException unused) {}
+            }
         }
     }
 
@@ -77,6 +81,7 @@
         public MyResponse(String filename) {
             try {
                 fis = new FileInputStream(new File(filename));
+                resources.add(fis);
                 headers = (Map<String,List<String>>)new ObjectInputStream(fis).readObject();
             } catch (Exception ex) {
                 throw new RuntimeException(ex.getMessage());
--- a/jdk/test/java/net/Socket/AccurateTimeout.java	Thu Aug 12 23:21:17 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* @test
- * @bug 4512028
- * @summary Check the tolerance on read timeouts.
- */
-import java.net.*;
-import java.io.*;
-
-public class AccurateTimeout {
-
-    static final int TOLERANCE = 100;
-
-    static boolean skipTest() {
-        String os = System.getProperty("os.name");
-        if (os.equals("Windows 95") ||
-            os.equals("Windows 98") ||
-            os.equals("Windows Me")) {
-
-            System.out.println("Due to an OS bug timeout tolerance cannot be tested on this OS");
-            return true;
-        }
-        return false;
-    }
-
-    public static void main(String args[]) throws Exception {
-
-        if (skipTest()) {
-            return;
-        }
-
-        int failures = 0;
-        int timeout;
-
-        System.out.println("");
-        System.out.println("Testing Socket.getInputStream().read() ...");
-        System.out.println("");
-
-        ServerSocket ss = new ServerSocket(0);
-        Socket s1 = new Socket(InetAddress.getLocalHost(), ss.getLocalPort());
-        Socket s2 = ss.accept();
-
-        InputStream in = s1.getInputStream();
-
-        timeout = 100;
-        while (timeout < 2500) {
-            s1.setSoTimeout(timeout);
-
-            long startTime = System.currentTimeMillis();
-            try {
-                in.read();
-            } catch (SocketTimeoutException e) {
-            }
-            long actual = System.currentTimeMillis() - startTime;
-
-            System.out.print("excepted: " + timeout + " actual: " + actual);
-
-            if (Math.abs(actual-timeout) > TOLERANCE) {
-                System.out.print(" *** FAIL: outside tolerance");
-                failures++;
-            } else {
-                System.out.print(" PASS.");
-            }
-
-            System.out.println("");
-            timeout += 200;
-        }
-
-        s1.close();
-        s2.close();
-        ss.close();
-
-
-        // ----------
-
-
-        System.out.println("");
-        System.out.println("Testing DatagramSocket.receive ...");
-        System.out.println("");
-
-        byte b[] = new byte[8];
-        DatagramPacket p = new DatagramPacket(b, b.length);
-
-        DatagramSocket ds = new DatagramSocket();
-
-        timeout = 100;
-        while (timeout < 2500) {
-            ds.setSoTimeout(timeout);
-
-            long startTime = System.currentTimeMillis();
-            try {
-                ds.receive(p);
-            } catch (SocketTimeoutException e) {
-            }
-            long actual = System.currentTimeMillis() - startTime;
-
-            System.out.print("excepted: " + timeout + " actual: " + actual);
-
-            if (Math.abs(actual-timeout) > TOLERANCE) {
-                System.out.print(" *** FAIL: outside tolerance");
-                failures++;
-            } else {
-                System.out.print(" PASS.");
-            }
-
-            System.out.println("");
-            timeout += 200;
-        }
-
-        ds.close();
-
-        System.out.println("");
-
-        // ---------
-
-        if (failures > 0) {
-            throw new Exception("Test failed: " + failures +
-                " test(s) outside tolerance");
-        }
-
-    }
-
-}
--- a/jdk/test/java/net/Socket/CloseAvailable.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/Socket/CloseAvailable.java	Fri Aug 20 14:48:10 2010 -0400
@@ -47,6 +47,7 @@
         t.start();
 
         Socket  soc = ss.accept();
+        ss.close();
 
         DataInputStream is = new DataInputStream(soc.getInputStream());
         is.close();
@@ -64,7 +65,7 @@
     public void run() {
         try {
             Socket s = new Socket(addr, port);
-
+            s.close();
         } catch (Exception e) {
             e.printStackTrace();
         }
--- a/jdk/test/java/net/Socket/DeadlockTest.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/Socket/DeadlockTest.java	Fri Aug 20 14:48:10 2010 -0400
@@ -33,29 +33,32 @@
 
 public class DeadlockTest {
     public static void main(String [] argv) throws Exception {
+        ServerSocket ss = new ServerSocket(0);
+        Socket clientSocket = new Socket();
 
-        // Start the server thread
-        Thread s1 = new Thread(new ServerThread());
-        s1.start();
+        try {
+            // Start the server thread
+            Thread s1 = new Thread(new ServerThread(ss));
+            s1.start();
 
-        // Sleep to make sure s1 has created a server socket
-        Thread.sleep(1000);
+            // Start the client thread
+            ClientThread ct = new ClientThread(clientSocket, ss.getLocalPort());
+            Thread c1 = new Thread(ct);
+            c1.start();
 
-        // Start the client thread
-        ClientThread ct = new ClientThread();
-        Thread c1 = new Thread(ct);
-        c1.start();
-
-        // Wait for the client thread to finish
-        c1.join(40000);
+            // Wait for the client thread to finish
+            c1.join(20000);
 
-        // If timeout, we assume there is a deadlock
-        if (c1.isAlive() == true) {
-            // Close the socket to force the server thread
-            // terminate too
-            s1.stop();
-            ct.getSock().close();
-            throw new Exception("Takes too long. Dead lock");
+            // If timeout, we assume there is a deadlock
+            if (c1.isAlive() == true) {
+                // Close the socket to force the server thread
+                // terminate too
+                s1.stop();
+                throw new Exception("Takes too long. Dead lock");
+            }
+        } finally {
+            ss.close();
+            clientSocket.close();
         }
     }
 }
@@ -71,8 +74,8 @@
 
     Socket sock;
 
-    public ServerThread() throws Exception {
-
+    public ServerThread(ServerSocket serverSocket) throws Exception {
+        this.server = serverSocket;
     }
 
     public void ping(int cnt) {
@@ -85,7 +88,6 @@
 
         try {
             if (Thread.currentThread().getName().startsWith("child") == false) {
-                server = new ServerSocket(4711);
                 sock  = server.accept();
 
                 new Thread(this, "child").start();
@@ -107,6 +109,7 @@
             }
 
         } catch (Throwable e) {
+            System.out.println(e);
             // If anything goes wrong, just quit.
         }
 
@@ -141,10 +144,11 @@
 
     Socket sock;
 
-    public ClientThread() throws Exception {
+    public ClientThread(Socket sock, int serverPort) throws Exception {
         try {
-            System.out.println("About to create a socket");
-            sock = new Socket(InetAddress.getLocalHost().getHostName(), 4711);
+            System.out.println("About to connect the client socket");
+            this.sock = sock;
+            this.sock.connect(new InetSocketAddress("localhost", serverPort));
             System.out.println("connected");
 
             out = new ObjectOutputStream(sock.getOutputStream());
@@ -156,10 +160,6 @@
         }
     }
 
-    public Socket getSock() {
-        return sock;
-    }
-
     private int cnt = 1;
 
     public void run() {
@@ -213,6 +213,7 @@
             System.out.println("write message done " + cnt++);
         } catch (IOException ioe) {
             // Ignore the exception
+            System.out.println(ioe);
         }
      }
 }
--- a/jdk/test/java/net/Socket/LingerTest.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/Socket/LingerTest.java	Fri Aug 20 14:48:10 2010 -0400
@@ -81,7 +81,7 @@
         public void run() {
             System.out.println ("Another starts");
             try {
-                Thread.currentThread().sleep(delay);
+                Thread.sleep(delay);
                 Socket s = new Socket("localhost", port);
                 synchronized (this) {
                     connected = true;
@@ -105,7 +105,6 @@
         Socket s1 = new Socket("localhost", ss.getLocalPort());
         Socket s2 = ss.accept();
 
-
         // setup conditions for untransmitted data and lengthy
             // linger interval
             s1.setSendBufferSize(128*1024);
@@ -122,14 +121,15 @@
         thr.start();
 
         // give sender time to queue the data
-            Thread.currentThread().sleep(1000);
+            Thread.sleep(1000);
 
         // close the socket asynchronously
             (new Thread(new Closer(s1))).start();
 
         // give another time to run
-            Thread.currentThread().sleep(10000);
+            Thread.sleep(10000);
 
+        ss.close();
         // check that another is done
             if (!another.connected()) {
             throw new RuntimeException("Another thread is blocked");
--- a/jdk/test/java/net/Socket/LinkLocal.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/Socket/LinkLocal.java	Fri Aug 20 14:48:10 2010 -0400
@@ -58,11 +58,10 @@
         } catch (SocketException e) {
             failed++;
             System.out.println("Test failed: " + e);
+        } finally {
+            s.close();
+            ss.close();
         }
-
-        // clean up
-        s.close();
-        ss.close();
     }
 
     static void UdpTest(InetAddress ia, boolean connected) throws Exception {
@@ -93,16 +92,16 @@
             ds1.send(p);
             System.out.println("Packet has been sent.");
 
-            ds2.setSoTimeout(1000);
+            ds2.setSoTimeout(5000);
             ds2.receive(p);
             System.out.println("Test passed - packet received.");
         } catch (SocketException e) {
             failed++;
             System.out.println("Test failed: " + e);
+        } finally {
+            ds1.close();
+            ds2.close();
         }
-
-        ds1.close();
-        ds2.close();
     }
 
     static void TestAddress(InetAddress ia) throws Exception {
@@ -138,6 +137,9 @@
             Enumeration nifs = NetworkInterface.getNetworkInterfaces();
             while (nifs.hasMoreElements()) {
                 NetworkInterface ni = (NetworkInterface)nifs.nextElement();
+                if (!ni.isUp())
+                    continue;
+
                 Enumeration addrs = ni.getInetAddresses();
                 while (addrs.hasMoreElements()) {
                     InetAddress addr = (InetAddress)addrs.nextElement();
--- a/jdk/test/java/net/Socket/ProxyCons.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/Socket/ProxyCons.java	Fri Aug 20 14:48:10 2010 -0400
@@ -39,6 +39,7 @@
         public void run () {
             try {
                 Socket s = server.accept ();
+                s.close();
                 while (!finished ()) {
                     Thread.sleep (500);
                 }
@@ -58,10 +59,9 @@
     public ProxyCons() {
     }
 
-    void test() {
+    void test() throws Exception {
+        ServerSocket ss = new ServerSocket(0);
         try {
-            ServerSocket ss = new ServerSocket();
-            ss.bind(new InetSocketAddress(0));
             Server s = new Server(ss);
             s.start();
             Socket sock = new Socket(Proxy.NO_PROXY);
@@ -70,10 +70,12 @@
             sock.close();
         } catch (java.io.IOException e) {
             throw new RuntimeException(e);
+        } finally {
+            ss.close();
         }
     }
 
-    public static void main(String[] args) {
+    public static void main(String[] args) throws Exception {
         ProxyCons c = new ProxyCons();
         c.test();
     }
--- a/jdk/test/java/net/Socket/ReadTimeout.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/Socket/ReadTimeout.java	Fri Aug 20 14:48:10 2010 -0400
@@ -44,7 +44,7 @@
     sin = InetAddress.getLocalHost();
     srv = new ServerSocket(port);
     port = srv.getLocalPort();
-    soc = new Socket(sin, port, true);
+    soc = new Socket(sin, port);
     soc1 = srv.accept();
     soc.setSoTimeout(tout);
 
@@ -53,10 +53,10 @@
       os = soc1.getOutputStream();
       is.read();
     } catch(InterruptedIOException e) {
+    } finally {
+        soc.close();
+        soc1.close();
+        srv.close();
     }
-
-    soc.close();
-    soc1.close();
-    srv.close();
   }
 }
--- a/jdk/test/java/net/Socket/SetReceiveBufferSize.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/Socket/SetReceiveBufferSize.java	Fri Aug 20 14:48:10 2010 -0400
@@ -32,29 +32,14 @@
 import java.net.ServerSocket;
 
 public class SetReceiveBufferSize {
-    class Server extends Thread {
-        private ServerSocket ss;
-        public Server(ServerSocket ss) {
-            this.ss = ss;
-        }
-
-        public void run() {
-            try {
-                ss.accept();
-            } catch (Exception e) {
-            }
-        }
-    }
-
     public static void main(String[] args) throws Exception {
         SetReceiveBufferSize s = new SetReceiveBufferSize();
     }
 
     public SetReceiveBufferSize() throws Exception {
         ServerSocket ss = new ServerSocket(0);
-        Server serv = new Server(ss);
-        serv.start();
         Socket s = new Socket("localhost", ss.getLocalPort());
+        Socket accepted = ss.accept();
         try {
             s.setReceiveBufferSize(0);
         } catch (IllegalArgumentException e) {
@@ -62,6 +47,8 @@
         } catch (Exception ex) {
         } finally {
             ss.close();
+            s.close();
+            accepted.close();
         }
         throw new RuntimeException("IllegalArgumentException not thrown!");
     }
--- a/jdk/test/java/net/Socket/SetSoLinger.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/Socket/SetSoLinger.java	Fri Aug 20 14:48:10 2010 -0400
@@ -30,36 +30,24 @@
 
 import java.net.*;
 
-public class SetSoLinger implements Runnable {
-    static ServerSocket ss;
-    static InetAddress addr;
-    static int port;
+public class SetSoLinger {
+    static final int LINGER = 65546;
 
     public static void main(String args[]) throws Exception {
-        boolean      error = true;
-        int          linger = 65546;
-        int          value = 0;
-        addr = InetAddress.getLocalHost();
-        ss = new ServerSocket(0);
-        port = ss.getLocalPort();
+        int value;
+        InetAddress addr = InetAddress.getLocalHost();
+        ServerSocket ss = new ServerSocket(0);
+        int port = ss.getLocalPort();
 
-        Thread t = new Thread(new SetSoLinger());
-        t.start();
+        Socket s = new Socket(addr, port);
         Socket soc = ss.accept();
-        soc.setSoLinger(true, linger);
+        soc.setSoLinger(true, LINGER);
         value = soc.getSoLinger();
         soc.close();
+        s.close();
+        ss.close();
 
         if(value != 65535)
             throw new RuntimeException("Failed. Value not properly reduced.");
     }
-
-    public void run() {
-        try {
-            Socket s = new Socket(addr, port);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
 }
--- a/jdk/test/java/net/Socket/ShutdownBoth.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/Socket/ShutdownBoth.java	Fri Aug 20 14:48:10 2010 -0400
@@ -36,12 +36,14 @@
         Socket s1 = new Socket(ss.getInetAddress(), ss.getLocalPort());
         Socket s2 = ss.accept();
 
-        s1.shutdownInput();
-        s1.shutdownOutput();            // failed b55
-
-        s1.close();
-        s2.close();
-        ss.close();
+        try {
+            s1.shutdownInput();
+            s1.shutdownOutput();            // failed b55
+        } finally {
+            s1.close();
+            s2.close();
+            ss.close();
+        }
     }
 
 }
--- a/jdk/test/java/net/Socket/SoTimeout.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/Socket/SoTimeout.java	Fri Aug 20 14:48:10 2010 -0400
@@ -52,9 +52,10 @@
         t.start();
 
         Socket s = serverSocket.accept();
+        serverSocket.close();
 
-        // set a 1 second timeout on the socket
-        s.setSoTimeout(1000);
+        // set a 5 second timeout on the socket
+        s.setSoTimeout(5000);
 
         s.getInputStream().read(b, 0, b.length);
         s.close();
@@ -64,7 +65,7 @@
         // this sequence should complete fairly quickly and if it
         // takes something resembling the the SoTimeout value then
         // we are probably incorrectly blocking and not waking up
-        if (waited > 500) {
+        if (waited > 2000) {
             throw new Exception("shouldn't take " + waited + " to complete");
         }
     }
--- a/jdk/test/java/net/Socket/Timeout.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/Socket/Timeout.java	Fri Aug 20 14:48:10 2010 -0400
@@ -31,18 +31,16 @@
 import java.io.*;
 
 public class Timeout {
-
-    public static ServerSocket sock;
-
     public static void main(String[] args) throws Exception {
         boolean success = false;
+        ServerSocket sock = new ServerSocket(0);
         try {
-            ServerSocket sock;
-            sock = new ServerSocket(2333);
             sock.setSoTimeout(2);
             sock.accept();
         } catch (InterruptedIOException e) {
             success = true;
+        } finally {
+            sock.close();
         }
         if (!success)
             throw new RuntimeException("Socket timeout failure.");
--- a/jdk/test/java/net/Socket/UrgentDataTest.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/Socket/UrgentDataTest.java	Fri Aug 20 14:48:10 2010 -0400
@@ -90,63 +90,64 @@
     }
 
     public void run () throws Exception {
-        if (isClient) {
-            client = new Socket (clHost, clPort);
-            clis = client.getInputStream();
-            clos = client.getOutputStream();
-            client.setOOBInline (true);
-            if (client.getOOBInline() != true) {
-                throw new RuntimeException ("Setting OOBINLINE failed");
-            }
-        }
-        if (isServer) {
-            server = listener.accept ();
-            sis = server.getInputStream();
-            sos = server.getOutputStream();
-        }
-        if (isClient) {
-            clos.write ("Hello".getBytes ());
-            client.sendUrgentData (100);
-            clos.write ("world".getBytes ());
-        }
-        // read Hello world from server (during which oob byte must have been dropped)
-        String s = "Helloworld";
-        if (isServer) {
-            for (int y=0; y<s.length(); y++) {
-                int c = sis.read ();
-                if (c != (int)s.charAt (y)) {
-                    throw new RuntimeException ("Unexpected character read");
+        try {
+            if (isClient) {
+                client = new Socket (clHost, clPort);
+                clis = client.getInputStream();
+                clos = client.getOutputStream();
+                client.setOOBInline (true);
+                if (client.getOOBInline() != true) {
+                    throw new RuntimeException ("Setting OOBINLINE failed");
                 }
             }
-            // Do the same from server to client
-            sos.write ("Hello".getBytes ());
-            server.sendUrgentData (101);
-            sos.write ("World".getBytes ());
-        }
-        if (isClient) {
-            // read Hello world from client (during which oob byte must have been read)
-            s="Hello";
-            for (int y=0; y<s.length(); y++) {
-                int c = clis.read ();
-                if (c != (int)s.charAt (y)) {
-                    throw new RuntimeException ("Unexpected character read");
+            if (isServer) {
+                server = listener.accept ();
+                sis = server.getInputStream();
+                sos = server.getOutputStream();
+            }
+            if (isClient) {
+                clos.write ("Hello".getBytes ());
+                client.sendUrgentData (100);
+                clos.write ("world".getBytes ());
+            }
+            // read Hello world from server (during which oob byte must have been dropped)
+            String s = "Helloworld";
+            if (isServer) {
+                for (int y=0; y<s.length(); y++) {
+                    int c = sis.read ();
+                    if (c != (int)s.charAt (y)) {
+                        throw new RuntimeException ("Unexpected character read");
+                    }
+                }
+                // Do the same from server to client
+                sos.write ("Hello".getBytes ());
+                server.sendUrgentData (101);
+                sos.write ("World".getBytes ());
+            }
+            if (isClient) {
+                // read Hello world from client (during which oob byte must have been read)
+                s="Hello";
+                for (int y=0; y<s.length(); y++) {
+                    int c = clis.read ();
+                    if (c != (int)s.charAt (y)) {
+                        throw new RuntimeException ("Unexpected character read");
+                    }
+                }
+                if (clis.read() != 101) {
+                    throw new RuntimeException ("OOB byte not received");
+                }
+                s="World";
+                for (int y=0; y<s.length(); y++) {
+                    int c = clis.read ();
+                    if (c != (int)s.charAt (y)) {
+                        throw new RuntimeException ("Unexpected character read");
+                    }
                 }
             }
-            if (clis.read() != 101) {
-                throw new RuntimeException ("OOB byte not received");
-            }
-            s="World";
-            for (int y=0; y<s.length(); y++) {
-                int c = clis.read ();
-                if (c != (int)s.charAt (y)) {
-                    throw new RuntimeException ("Unexpected character read");
-                }
-            }
+        } finally {
+            if (listener != null) listener.close();
+            if (client != null) client.close ();
+            if (server != null) server.close ();
         }
-
-        if (isClient)
-            client.close ();
-        if (isServer)
-            server.close ();
     }
 }
--- a/jdk/test/java/net/Socket/asyncClose/BrokenPipe.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/Socket/asyncClose/BrokenPipe.java	Fri Aug 20 14:48:10 2010 -0400
@@ -61,7 +61,6 @@
         try {
             client.getOutputStream().write(new byte[1000000]);
         } catch (IOException ioe) {
-
             /*
              * Check that the exception text doesn't indicate the
              * socket is closed. In tiger we should be able to
@@ -71,8 +70,9 @@
             if (text.toLowerCase().indexOf("closed") >= 0) {
                 throw ioe;
             }
+        } finally {
+            server.close();
         }
-        server.close();
     }
 
 }
--- a/jdk/test/java/net/Socket/setReuseAddress/Restart.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/Socket/setReuseAddress/Restart.java	Fri Aug 20 14:48:10 2010 -0400
@@ -39,27 +39,28 @@
      */
 
     public static void main(String args[]) throws Exception {
-
-        InetSocketAddress isa = new InetSocketAddress(0);
-        ServerSocket ss = new ServerSocket();
-        ss.bind(isa);
+        ServerSocket ss = new ServerSocket(0);
+        Socket s1 = null, s2 = null;
+        try {
+            int port = ss.getLocalPort();
 
-        int port = ss.getLocalPort();
+            s1 = new Socket(InetAddress.getLocalHost(), port);
+            s2 = ss.accept();
 
-        Socket s1 = new Socket(InetAddress.getLocalHost(), port);
-        Socket s2 = ss.accept();
+            // close server socket and the accepted connection
+            ss.close();
+            s2.close();
 
-        // close server socket and the accepted connection
-        ss.close();
-        s2.close();
-
-        boolean failed = false;
+            ss = new ServerSocket();
+            ss.bind( new InetSocketAddress(port) );
+            ss.close();
 
-        ss = new ServerSocket();
-        ss.bind( new InetSocketAddress(port) );
-        ss.close();
-
-        // close the client socket
-        s1.close();
+            // close the client socket
+            s1.close();
+        } finally {
+            if (ss != null) ss.close();
+            if (s1 != null) s1.close();
+            if (s2 != null) s2.close();
+        }
     }
 }
--- a/jdk/test/java/net/SocketInputStream/SocketClosedException.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/SocketInputStream/SocketClosedException.java	Fri Aug 20 14:48:10 2010 -0400
@@ -32,68 +32,37 @@
 import java.net.*;
 
 public class SocketClosedException {
+    static void doServerSide() throws Exception {
+        try {
+            Socket socket = serverSocket.accept();
 
-    /*
-     * Is the server ready to serve?
-     */
-    volatile static boolean serverReady = false;
+            OutputStream os = socket.getOutputStream();
 
-    /*
-     * Define the server side of the test.
-     *
-     * If the server prematurely exits, serverReady will be set to true
-     * to avoid infinite hangs.
-     */
-    static void doServerSide() throws Exception {
-        ServerSocket serverSocket = new ServerSocket(serverPort);
-        serverPort = serverSocket.getLocalPort();
-
-        /*
-         * Signal Client, we're ready for a connect.
-         */
-        serverReady = true;
-
-        Socket socket = serverSocket.accept();
-
-        InputStream is = socket.getInputStream();
-        OutputStream os = socket.getOutputStream();
-
-        os.write(85);
-        os.flush();
-        socket.close();
+            os.write(85);
+            os.flush();
+            socket.close();
+        } finally {
+            serverSocket.close();
+        }
     }
 
-    /*
-     * Define the client side of the test.
-     *
-     * If the server prematurely exits, serverReady will be set to true
-     * to avoid infinite hangs.
-     */
-    static void doClientSide() throws Exception {
+    static void doClientSide(int port) throws Exception {
+        Socket socket = new Socket("localhost", port);
+        InputStream is = socket.getInputStream();
 
-        /*
-         * Wait for server to get started.
-         */
-        while (!serverReady) {
-            Thread.sleep(5000);
-        }
-
-        Socket socket = new Socket("localhost", serverPort);
-        InputStream is = socket.getInputStream();
-        OutputStream os = socket.getOutputStream();
-
-        int read = is.read();
+        is.read();
         socket.close();
-        read = is.read();
+        is.read();
     }
 
-    static int serverPort = 0;
+    static ServerSocket serverSocket;
     static Exception serverException = null;
 
     public static void main(String[] args) throws Exception {
+        serverSocket = new ServerSocket(0);
         startServer();
         try {
-            doClientSide();
+            doClientSide(serverSocket.getLocalPort());
         } catch (SocketException e) {
             if (!e.getMessage().equalsIgnoreCase("Socket closed")) {
                 throw new Exception("Received a wrong exception message: " +
@@ -108,21 +77,14 @@
     }
 
     static void startServer() {
-        Thread serverThread = new Thread() {
+        (new Thread() {
             public void run() {
                 try {
                     doServerSide();
                 } catch (Exception e) {
-                    /*
-                     * server thread just died.
-                     * Release the client, if not active already...
-                     */
-                    System.err.println("Server died...");
-                    serverReady = true;
-                    serverException = e;
+                    e.printStackTrace();
                 }
             }
-        };
-        serverThread.start();
+        }).start();
     }
 }
--- a/jdk/test/java/net/SocketInputStream/SocketTimeout.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/SocketInputStream/SocketTimeout.java	Fri Aug 20 14:48:10 2010 -0400
@@ -31,26 +31,24 @@
 import java.io.*;
 
 public class SocketTimeout  {
+    static final int TIMEOUT = 1000;
+
     public static void main(String args[]) throws Exception {
-    InetAddress  sin = null;
+    InetAddress  sin = InetAddress.getLocalHost();
     Socket       soc = null,soc1 = null;
     InputStream  is = null;
-    OutputStream os = null;
     ServerSocket srv = null;
     int          port = 0;
-    int          tout = 1000;
 
-    sin = InetAddress.getLocalHost();
-    srv = new ServerSocket(port);
+    srv = new ServerSocket(0);
     port = srv.getLocalPort();
     soc = new Socket(sin, port);
     soc1 = srv.accept();
-    soc.setSoTimeout(tout);
-    srv.setSoTimeout(tout);
+    soc.setSoTimeout(TIMEOUT);
+    srv.setSoTimeout(TIMEOUT);
 
     try {
       is = soc.getInputStream();
-      os = soc1.getOutputStream();
       is.read();
     } catch(InterruptedIOException e) {
         try {
@@ -59,6 +57,9 @@
         } catch(NoClassDefFoundError e1) {
             throw new Exception ("SocketTimeoutException: not found");
         }
+    } finally {
+        soc.close();
+        soc1.close();
     }
 
     // now check accept
@@ -72,12 +73,14 @@
         } catch(NoClassDefFoundError e1) {
             throw new Exception ("SocketTimeoutException: not found");
         }
+    } finally {
+        srv.close();
     }
 
     // Now check DatagramSocket.receive()
 
     DatagramSocket dg = new DatagramSocket ();
-    dg.setSoTimeout (tout);
+    dg.setSoTimeout (TIMEOUT);
 
     try {
       dg.receive (new DatagramPacket (new byte [64], 64));
@@ -88,11 +91,8 @@
         } catch(NoClassDefFoundError e1) {
             throw new Exception ("SocketTimeoutException: not found");
         }
+    } finally {
+        dg.close();
     }
-
-    soc.close();
-    soc1.close();
-    srv.close();
-    dg.close();
   }
 }
--- a/jdk/test/java/net/URL/GetContent.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/URL/GetContent.java	Fri Aug 20 14:48:10 2010 -0400
@@ -53,11 +53,13 @@
 
             // wait for client to read response - otherwise http
             // client get error and re-establish connection
-            Thread.currentThread().sleep(2000);
+            Thread.sleep(2000);
 
             s.close();
         } catch (Exception e) {
             e.printStackTrace();
+        } finally {
+            try { ss.close(); } catch (IOException unused) {}
         }
      }
 
@@ -81,8 +83,6 @@
              error = false;
          }
 
-         ss.close();
-
          if (error)
              throw new RuntimeException("No IOException generated.");
      }
--- a/jdk/test/java/net/URLClassLoader/ClassLoad.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/URLClassLoader/ClassLoad.java	Fri Aug 20 14:48:10 2010 -0400
@@ -27,20 +27,45 @@
  * @summary Test for FileNotFoundException when loading bogus class
  */
 
-import java.net.*;
-import java.io.*;
+import java.io.InputStream;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.URL;
+import java.net.URLClassLoader;
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpServer;
 
 public class ClassLoad {
      public static void main(String[] args) throws Exception {
          boolean error = true;
+
+         // Start a dummy server to return 404
+         HttpServer server = HttpServer.create(new InetSocketAddress(0), 0);
+         HttpHandler handler = new HttpHandler() {
+             public void handle(HttpExchange t) throws IOException {
+                 InputStream is = t.getRequestBody();
+                 while (is.read() != -1);
+                 t.sendResponseHeaders (404, -1);
+                 t.close();
+             }
+         };
+         server.createContext("/", handler);
+         server.start();
+
+         // Client request
          try {
-             URL url = new URL(args.length >= 1 ? args[0] : "http://jini.east/");
+             URL url = new URL("http://localhost:" + server.getAddress().getPort());
              String name = args.length >= 2 ? args[1] : "foo.bar.Baz";
              ClassLoader loader = new URLClassLoader(new URL[] { url });
+             System.out.println(url);
              Class c = loader.loadClass(name);
              System.out.println("Loaded class \"" + c.getName() + "\".");
          } catch (ClassNotFoundException ex) {
+             System.out.println(ex);
              error = false;
+         } finally {
+             server.stop(0);
          }
          if (error)
              throw new RuntimeException("No ClassNotFoundException generated");
--- a/jdk/test/java/net/URLConnection/DisconnectAfterEOF.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/URLConnection/DisconnectAfterEOF.java	Fri Aug 20 14:48:10 2010 -0400
@@ -56,7 +56,6 @@
                 int cl = -1;
                 int remaining = -1;
                 StringBuffer sb = new StringBuffer();
-                Random r = new Random();
                 boolean close = false;
 
                 boolean inBody = false;
@@ -239,8 +238,6 @@
     }
 
     public static void main(String args[]) throws Exception {
-        Random r = new Random();
-
         // start server
         ServerSocket ss = new ServerSocket(0);
         Server svr = new Server(ss);
@@ -273,7 +270,7 @@
         URLConnection uc1 = doRequest(uri);
         doResponse(uc1);
 
-        Thread.currentThread().sleep(2000);
+        Thread.sleep(2000);
 
         URLConnection uc2 = doRequest(uri);
 
--- a/jdk/test/java/net/URLConnection/HandleContentTypeWithAttrs.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/URLConnection/HandleContentTypeWithAttrs.java	Fri Aug 20 14:48:10 2010 -0400
@@ -111,9 +111,8 @@
             } catch(Exception e) {
                 System.out.print("Server failure\n");
                 e.printStackTrace();
-                try {
-                    serverSocket.close();
-                } catch(IOException e2) {}
+            } finally {
+                try { serverSocket.close(); } catch(IOException unused) {}
             }
         } else {
             try {
@@ -127,10 +126,9 @@
             } catch(Exception e) {
                 // System.out.print("Service handler failure\n");
                 // e.printStackTrace();
+            } finally {
+                try { close(); }  catch(IOException unused) {}
             }
-            try {
-                close();
-            } catch(IOException e2) {}
         }
     }
 
--- a/jdk/test/java/net/URLConnection/HttpContinueStackOverflow.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/URLConnection/HttpContinueStackOverflow.java	Fri Aug 20 14:48:10 2010 -0400
@@ -30,7 +30,7 @@
  */
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
+import java.io.IOException;
 import java.io.PrintStream;
 import java.net.ServerSocket;
 import java.net.Socket;
@@ -41,61 +41,56 @@
 
     static class Server implements Runnable {
         int port;
+        ServerSocket serverSock ;
 
-        Server(int port) {
-            this.port = port;
+        Server() throws IOException {
+            serverSock = new ServerSocket(0);
+        }
+
+        int getLocalPort() {
+            return serverSock.getLocalPort();
         }
 
         public void run() {
+            Socket sock = null;
             try {
-                /* bind to port and wait for connection */
-                ServerSocket serverSock = new ServerSocket(     port );
                 serverSock.setSoTimeout(10000);
-                Socket sock = serverSock.accept();
+                sock = serverSock.accept();
 
                 /* setup streams and read http request */
                 BufferedReader in = new BufferedReader(
                     new InputStreamReader(sock.getInputStream()));
                 PrintStream out = new PrintStream( sock.getOutputStream() );
-                String request = in.readLine();
+                in.readLine();
 
                 /* send continue followed by invalid response */
                 out.println("HTTP/1.1 100 Continue\r");
                 out.println("\r");
                 out.println("junk junk junk");
                 out.flush();
-
-                sock.close();
             } catch (Exception e) {
                 e.printStackTrace();
+            } finally {
+                try { serverSock.close(); } catch (IOException unused) {}
+                try { sock.close(); } catch (IOException unused) {}
             }
         }
     }
 
-    HttpContinueStackOverflow(int port) throws Exception {
+    HttpContinueStackOverflow() throws Exception {
         /* create the server */
-        Server s = new Server(port);
-        Thread thr = new Thread(s);
-        thr.start();
-
-        /* wait for server to bind to port */
-        try {
-            Thread.currentThread().sleep(2000);
-        } catch (Exception e) { }
+        Server s = new Server();
+        (new Thread(s)).start();
 
         /* connect to server, connect to server and get response code */
-        URL url = new URL("http", "localhost", port, "anything.html");
+        URL url = new URL("http", "localhost", s.getLocalPort(), "anything.html");
         HttpURLConnection conn = (HttpURLConnection)url.openConnection();
-        int respCode = conn.getResponseCode();
+        conn.getResponseCode();
         System.out.println("TEST PASSED");
     }
 
     public static void main(String args[]) throws Exception {
-        int port = 4090;
-        if (args.length > 0) {
-            port = Integer.parseInt(args[0]);
-        }
         System.out.println("Testing 100-Continue");
-        new HttpContinueStackOverflow(port);
+        new HttpContinueStackOverflow();
     }
 }
--- a/jdk/test/java/net/URLConnection/Redirect307Test.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/URLConnection/Redirect307Test.java	Fri Aug 20 14:48:10 2010 -0400
@@ -37,11 +37,11 @@
     OutputStream os;
     int port;
 
-    String reply1 = "HTTP/1.1 307 Temporary Redirect\r\n" +
+    String reply1Part1 = "HTTP/1.1 307 Temporary Redirect\r\n" +
         "Date: Mon, 15 Jan 2001 12:18:21 GMT\r\n" +
         "Server: Apache/1.3.14 (Unix)\r\n" +
         "Location: http://localhost:";
-    String reply2 = "/redirected.html\r\n" +
+    String reply1Part2 = "/redirected.html\r\n" +
         "Connection: close\r\n" +
         "Content-Type: text/html; charset=iso-8859-1\r\n\r\n" +
         "<html>Hello</html>";
@@ -49,9 +49,10 @@
     RedirServer (ServerSocket y) {
         s = y;
         port = s.getLocalPort();
+        System.out.println("Server created listening on " + port);
     }
 
-    String reply3 = "HTTP/1.1 200 Ok\r\n" +
+    String reply2 = "HTTP/1.1 200 Ok\r\n" +
         "Date: Mon, 15 Jan 2001 12:18:21 GMT\r\n" +
         "Server: Apache/1.3.14 (Unix)\r\n" +
         "Connection: close\r\n" +
@@ -64,16 +65,24 @@
             is = s1.getInputStream ();
             os = s1.getOutputStream ();
             is.read ();
-            String reply = reply1 + port + reply2;
+            String reply = reply1Part1 + port + reply1Part2;
             os.write (reply.getBytes());
+            os.close();
             /* wait for redirected connection */
             s.setSoTimeout (5000);
             s1 = s.accept ();
+            is = s1.getInputStream ();
             os = s1.getOutputStream ();
-            os.write (reply3.getBytes());
+            is.read();
+            os.write (reply2.getBytes());
+            os.close();
         }
         catch (Exception e) {
             /* Just need thread to terminate */
+            System.out.println("Server: caught " + e);
+            e.printStackTrace();
+        } finally {
+            try { s.close(); } catch (IOException unused) {}
         }
     }
 };
@@ -84,10 +93,7 @@
     public static final int DELAY = 10;
 
     public static void main(String[] args) throws Exception {
-        int nLoops = 1;
-        int nSize = 10;
-        int port, n =0;
-        byte b[] = new byte[nSize];
+        int port;
         RedirServer server;
         ServerSocket sock;
 
@@ -119,7 +125,8 @@
             }
         }
         catch(IOException e) {
-            throw new RuntimeException ("Exception caught");
+            e.printStackTrace();
+            throw new RuntimeException ("Exception caught + " + e);
         }
     }
 }
--- a/jdk/test/java/net/URLConnection/RedirectLimit.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/URLConnection/RedirectLimit.java	Fri Aug 20 14:48:10 2010 -0400
@@ -76,15 +76,19 @@
                 is.read ();
                 String reply = reply1 + port + "/redirect" + i + reply2;
                 os.write (reply.getBytes());
+                os.close();
             }
             s1 = s.accept ();
             is = s1.getInputStream ();
             os = s1.getOutputStream ();
             is.read ();
             os.write (reply3.getBytes());
+            os.close();
         }
         catch (Exception e) {
             /* Just need thread to terminate */
+        } finally {
+            try { s.close(); } catch (IOException unused) {}
         }
     }
 };
--- a/jdk/test/java/net/URLConnection/ResendPostBody.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/URLConnection/ResendPostBody.java	Fri Aug 20 14:48:10 2010 -0400
@@ -109,8 +109,11 @@
                 while (!finished()) {
                     Thread.sleep (1000);
                 }
+                out.close();
             } catch (Exception e) {
                 System.err.println ("Server Exception: " + e);
+            } finally {
+                try { server.close(); } catch (IOException unused) {}
             }
         }
     }
@@ -134,7 +137,7 @@
 
     public void execute () throws Exception {
 
-     byte b[] = "X=ABCDEFGHZZZ".getBytes();
+        byte b[] = "X=ABCDEFGHZZZ".getBytes();
 
         ss = new ServerSocket (0);
         server = new Server (ss);
@@ -163,8 +166,9 @@
         /* Read the response */
 
         int resp = conURL.getResponseCode ();
+        server.setFinished (true);
+
         if (resp != 200)
             throw new RuntimeException ("Response code was not 200: " + resp);
-      server.setFinished (true);
   }
 }
--- a/jdk/test/java/net/URLConnection/SetIfModifiedSince.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/URLConnection/SetIfModifiedSince.java	Fri Aug 20 14:48:10 2010 -0400
@@ -23,7 +23,7 @@
 
 /* @test
  * @bug 4397096
- * @run main SetIfModifiedSince
+ * @run main/othervm SetIfModifiedSince
  * @summary setIfModifiedSince() of HttpURLConnection sets invalid date of default locale
  */
 
--- a/jdk/test/java/net/URLConnection/TimeoutTest.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/URLConnection/TimeoutTest.java	Fri Aug 20 14:48:10 2010 -0400
@@ -43,8 +43,9 @@
             try {
                 Socket s = server.accept ();
                 while (!finished ()) {
-                    Thread.sleep (2000);
+                    Thread.sleep (1000);
                 }
+                s.close();
             } catch (Exception e) {
             }
         }
@@ -70,9 +71,12 @@
             URL url = new URL ("http://127.0.0.1:"+ss.getLocalPort());
             URLConnection urlc = url.openConnection ();
             InputStream is = urlc.getInputStream ();
+            throw new RuntimeException("Should have received timeout");
         } catch (SocketTimeoutException e) {
-            s.done ();
             return;
+        } finally {
+            s.done();
+            ss.close();
         }
     }
 }
--- a/jdk/test/java/net/URLConnection/URLConnectionHeaders.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/URLConnection/URLConnectionHeaders.java	Fri Aug 20 14:48:10 2010 -0400
@@ -70,8 +70,10 @@
                 w.newLine();
                 w.flush();
                 s.close ();
-                srv.close (); // or else the HTTPURLConnection will retry
-            } catch (IOException e) { e.printStackTrace();}
+            } catch (IOException e) { e.printStackTrace();
+            } finally {
+                try { srv.close(); } catch (IOException unused) {}
+            }
         }
     }
 
--- a/jdk/test/java/net/URLConnection/ZeroContentLength.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/URLConnection/ZeroContentLength.java	Fri Aug 20 14:48:10 2010 -0400
@@ -58,6 +58,14 @@
         contentLength = cl;
     }
 
+    static synchronized String getResponse() {
+        return response;
+    }
+
+    static synchronized int getContentLength() {
+        return contentLength;
+    }
+
     /*
      * Worker thread to service single connection - can service
      * multiple http requests on same connection.
@@ -71,25 +79,44 @@
             this.id = id;
         }
 
+        final int CR = '\r';
+        final int LF = '\n';
+
         public void run() {
             try {
 
                 s.setSoTimeout(2000);
-                int max = 100;
+                int max = 20; // there should only be 20 connections
+                InputStream in = new BufferedInputStream(s.getInputStream());
 
                 for (;;) {
-
-                    // read entire request from client
-                    byte b[] = new byte[100];
-                    InputStream in = s.getInputStream();
-                    int n, total=0;
+                    // read entire request from client, until CR LF CR LF
+                    int c, total=0;
 
                     try {
-                        do {
-                            n = in.read(b);
-                            if (n > 0) total += n;
-                        } while (n > 0);
-                    } catch (SocketTimeoutException e) { }
+                        while ((c = in.read()) > 0) {
+                            total++;
+                            if (c == CR) {
+                                if ((c = in.read()) > 0) {
+                                    total++;
+                                    if (c == LF) {
+                                        if ((c = in.read()) > 0) {
+                                            total++;
+                                            if (c == CR) {
+                                                if ((c = in.read()) > 0) {
+                                                    total++;
+                                                    if (c == LF) {
+                                                        break;
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+
+                        }
+                    } catch (SocketTimeoutException e) {}
 
                     debug("worker " + id +
                         ": Read request from client " +
@@ -105,19 +132,20 @@
                                         new BufferedOutputStream(
                                                 s.getOutputStream() ));
 
-                    out.print("HTTP/1.1 " + response + "\r\n");
-                    if (contentLength >= 0) {
-                        out.print("Content-Length: " + contentLength +
+                    out.print("HTTP/1.1 " + getResponse() + "\r\n");
+                    int clen = getContentLength();
+                    if (clen >= 0) {
+                        out.print("Content-Length: " + clen +
                                     "\r\n");
                     }
                     out.print("\r\n");
-                    for (int i=0; i<contentLength; i++) {
+                    for (int i=0; i<clen; i++) {
                         out.write( (byte)'.' );
                     }
                     out.flush();
 
                     debug("worked " + id +
-                        ": Sent response to client, length: " + contentLength);
+                        ": Sent response to client, length: " + clen);
 
                     if (--max == 0) {
                         s.close();
--- a/jdk/test/java/net/ipv6tests/B6521014.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/ipv6tests/B6521014.java	Fri Aug 20 14:48:10 2010 -0400
@@ -58,6 +58,8 @@
         Enumeration e = NetworkInterface.getNetworkInterfaces();
         while (e.hasMoreElements()) {
             NetworkInterface ifc = (NetworkInterface) e.nextElement();
+            if (!ifc.isUp())
+                continue;
             Enumeration addrs = ifc.getInetAddresses();
             while (addrs.hasMoreElements()) {
                 InetAddress a = (InetAddress)addrs.nextElement();
--- a/jdk/test/java/net/ipv6tests/TcpTest.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/ipv6tests/TcpTest.java	Fri Aug 20 14:48:10 2010 -0400
@@ -38,7 +38,6 @@
     static InetAddress ia4any;
     static InetAddress ia6any;
     static Inet6Address ia6addr;
-    static InetAddress ia6bad; /* a global 6to4 IPv6 address, which cant be connected to */
     static Inet4Address ia4addr;
 
     static {
@@ -47,14 +46,6 @@
         try {
             ia4any = InetAddress.getByName ("0.0.0.0");
             ia6any = InetAddress.getByName ("::0");
-            if (ia6addr != null) {
-                int scope = ia6addr.getScopeId();
-                if (scope != 0) {
-                    ia6bad = InetAddress.getByName ("fe80::1:2:3:4:5:6%"+scope);
-                }
-            } else {
-                ia6bad = InetAddress.getByName ("fe80::1:2:3:4:5:6");
-            }
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -69,7 +60,6 @@
         dprintln ("Local Addresses");
         dprintln (ia4addr.toString());
         dprintln (ia6addr.toString());
-        dprintln ("Bad address: " + ia6bad);
         test1 (0);
         test1 (5100);
         test2();
@@ -224,19 +214,6 @@
         c1.close (); c2.close();
         s1.close (); s2.close();
 
-        /* check if connect() timesout when connecting to unknown dest. */
-
-        c1 = new Socket();
-        t1 = System.currentTimeMillis();
-        InetSocketAddress ad1 = new InetSocketAddress (ia6bad, 2500);
-        try {
-            c1.connect (ad1, 5000);
-            throw new RuntimeException ("timeout exception was expected");
-        } catch (SocketTimeoutException e) {
-            t1 = System.currentTimeMillis() - t1;
-            checkTime (t1, 5000);
-        } catch (NoRouteToHostException e1) {
-        }
         System.out.println ("Test3: OK");
     }
 
--- a/jdk/test/java/net/ipv6tests/Tests.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/net/ipv6tests/Tests.java	Fri Aug 20 14:48:10 2010 -0400
@@ -134,11 +134,11 @@
         }
     }
 
-    /* check the time got is within 20% of the time expected */
+    /* check the time got is within 50% of the time expected */
     public static void checkTime (long got, long expected) {
         dprintln ("checkTime: got " + got + " expected " + expected);
-        long upper = expected + (expected / 5);
-        long lower = expected - (expected / 5);
+        long upper = expected + (expected / 2);
+        long lower = expected - (expected / 2);
         if (got > upper || got < lower) {
             throw new RuntimeException ("checkTime failed: got " + got + " expected " + expected);
         }
--- a/jdk/test/java/nio/MappedByteBuffer/Basic.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/nio/MappedByteBuffer/Basic.java	Fri Aug 20 14:48:10 2010 -0400
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 4462336
+ * @bug 4462336 6799037
  * @summary Simple MappedByteBuffer tests
  * @run main/othervm Basic
  */
@@ -52,6 +52,12 @@
         mbb.force();
         if (!mbb.isReadOnly())
             throw new RuntimeException("Incorrect isReadOnly");
+
+        // repeat with unaligned position in file
+        mbb = fc.map(FileChannel.MapMode.READ_ONLY, 1, 10);
+        mbb.load();
+        mbb.isLoaded();
+        mbb.force();
         fc.close();
         fis.close();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/MappedByteBuffer/Truncate.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 6934977
+ * @summary Test MappedByteBuffer operations after mapped bye buffer becomes
+ *   inaccessible
+ * @run main/othervm Truncate
+ */
+
+import java.io.*;
+import java.nio.*;
+import java.nio.channels.*;
+import java.util.concurrent.Callable;
+
+public class Truncate {
+
+    static final long INITIAL_FILE_SIZE   = 32000L;
+    static final long TRUNCATED_FILE_SIZE =   512L;
+
+    public static void main(String[] args) throws Exception {
+        File blah = File.createTempFile("blah", null);
+        blah.deleteOnExit();
+
+        final FileChannel fc = new RandomAccessFile(blah, "rw").getChannel();
+        fc.position(INITIAL_FILE_SIZE).write(ByteBuffer.wrap("THE END".getBytes()));
+        final MappedByteBuffer mbb =
+            fc.map(FileChannel.MapMode.READ_WRITE, 0, fc.size());
+        boolean truncated;
+        try {
+            fc.truncate(TRUNCATED_FILE_SIZE);
+            truncated = true;
+        } catch (IOException ioe) {
+            // probably on Windows where a file cannot be truncated when
+            // there is a file mapping.
+            truncated = false;
+        }
+        if (truncated) {
+            // Test 1: access region that is no longer accessible
+            execute(new Callable<Void>() {
+                public Void call() {
+                    mbb.get((int)TRUNCATED_FILE_SIZE + 1);
+                    mbb.put((int)TRUNCATED_FILE_SIZE + 2, (byte)123);
+                    return null;
+                }
+            });
+            // Test 2: load buffer into memory
+            execute(new Callable<Void>() {
+                public Void call() throws IOException {
+                    mbb.load();
+                    return null;
+                }
+            });
+        }
+        fc.close();
+    }
+
+    // Runs the given task in its own thread. If operating correcting the
+    // the thread will terminate with an InternalError as the mapped buffer
+    // is inaccessible.
+    static void execute(final Callable<?> c) {
+        Runnable r = new Runnable() {
+            public void run() {
+                try {
+                    Object ignore = c.call();
+                } catch (Exception ignore) {
+                }
+            }
+        };
+        Thread t = new Thread(r);
+        t.start();
+        try { t.join(); } catch (InterruptedException ignore) { }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/channels/SocketChannel/OutOfBand.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @summary Test socket adapter sendUrgentData method
+ * @bug 6963907
+ */
+
+import java.net.*;
+import java.nio.ByteBuffer;
+import java.nio.channels.*;
+import java.io.IOException;
+import java.util.Random;
+
+public class OutOfBand {
+
+    private static final Random rand = new Random();
+
+    public static void main(String[] args) throws Exception {
+        ServerSocketChannel ssc = null;
+        SocketChannel sc1 = null;
+        SocketChannel sc2 = null;
+
+        try {
+
+            // establish loopback connection
+            ssc = ServerSocketChannel.open().bind(new InetSocketAddress(0));
+            InetAddress lh = InetAddress.getLocalHost();
+            SocketAddress remote =
+                new InetSocketAddress(lh, ssc.socket().getLocalPort());
+            sc1 = SocketChannel.open(remote);
+            sc2 = ssc.accept();
+
+            // enable SO_OOBLINE on server side
+            sc2.socket().setOOBInline(true);
+
+            // run tests
+            test1(sc1, sc2);
+            test2(sc1, sc2);
+            test3(sc1, sc2);
+            test4(sc1);
+
+        } finally {
+            if (sc1 != null) sc1.close();
+            if (sc2 != null) sc2.close();
+            if (ssc != null) ssc.close();
+        }
+    }
+
+    /**
+     * Basic test to check that OOB/TCP urgent byte is received.
+     */
+    static void test1(SocketChannel client, SocketChannel server)
+        throws Exception
+    {
+        assert server.socket().getOOBInline();
+        ByteBuffer bb = ByteBuffer.allocate(100);
+        for (int i=0; i<1000; i++) {
+            int b1 = -127 + rand.nextInt(384);
+            client.socket().sendUrgentData(b1);
+
+            bb.clear();
+            if (server.read(bb) != 1)
+                throw new RuntimeException("One byte expected");
+            bb.flip();
+            byte b2 = bb.get();
+            if ((byte)b1 != b2)
+                throw new RuntimeException("Unexpected byte");
+        }
+    }
+
+    /**
+     * Basic test to check that OOB/TCP urgent byte is received, maybe with
+     * OOB mark changing.
+     */
+    static void test2(final SocketChannel client, SocketChannel server)
+        throws Exception
+    {
+        assert server.socket().getOOBInline();
+        Runnable sender = new Runnable() {
+            public void run() {
+                try {
+                    for (int i=0; i<256; i++)
+                        client.socket().sendUrgentData(i);
+                } catch (IOException ioe) {
+                    ioe.printStackTrace();
+                }
+            }
+        };
+        Thread thr = new Thread(sender);
+        thr.start();
+
+        ByteBuffer bb = ByteBuffer.allocate(256);
+        while (bb.hasRemaining()) {
+            if (server.read(bb) < 0)
+                throw new RuntimeException("Unexpected EOF");
+        }
+        bb.flip();
+        byte expect = 0;
+        while (bb.hasRemaining()) {
+            if (bb.get() != expect)
+                throw new RuntimeException("Unexpected byte");
+            expect++;
+        }
+
+        thr.join();
+    }
+
+    /**
+     * Test that is close to some real world examples where an urgent byte is
+     * used to "cancel" a long running query or transaction on the server.
+     */
+    static void test3(SocketChannel client, final SocketChannel server)
+        throws Exception
+    {
+        final int STOP = rand.nextInt(256);
+
+        assert server.socket().getOOBInline();
+        Runnable reader = new Runnable() {
+            public void run() {
+                ByteBuffer bb = ByteBuffer.allocate(100);
+                try {
+                    int n = server.read(bb);
+                    if (n != 1) {
+                        String msg = (n < 0) ? "Unexpected EOF" :
+                                               "One byte expected";
+                        throw new RuntimeException(msg);
+                    }
+                    bb.flip();
+                    if (bb.get() != (byte)STOP)
+                        throw new RuntimeException("Unexpected byte");
+                    bb.flip();
+                    server.write(bb);
+                } catch (IOException ioe) {
+                    ioe.printStackTrace();
+                }
+
+            }
+        };
+
+        Thread thr = new Thread(reader);
+        thr.start();
+
+        // "stop" server
+        client.socket().sendUrgentData(STOP);
+
+        // wait for server reply
+        ByteBuffer bb = ByteBuffer.allocate(100);
+        int n = client.read(bb);
+        if (n != 1)
+            throw new RuntimeException("Unexpected number of bytes");
+        bb.flip();
+        if (bb.get() != (byte)STOP)
+            throw new RuntimeException("Unexpected reply");
+
+        thr.join();
+    }
+
+    static void test4(SocketChannel sc) throws IOException {
+        boolean blocking = sc.isBlocking();
+        sc.configureBlocking(false);
+        try {
+            sc.socket().sendUrgentData(0);
+            throw new RuntimeException("IllegalBlockingModeException expected");
+        } catch (IllegalBlockingModeException x) {
+            // expected
+        } finally {
+            sc.configureBlocking(blocking);
+        }
+    }
+}
--- a/jdk/test/java/util/logging/AnonLoggerWeakRefLeak.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/util/logging/AnonLoggerWeakRefLeak.java	Fri Aug 20 14:48:10 2010 -0400
@@ -23,24 +23,32 @@
 
 import java.util.logging.*;
 
-public class AnonLoggerWeakRefLeak {
-    public static int DEFAULT_LOOP_TIME = 60;  // time is in seconds
+public class AnonLoggerWeakRefLeak extends SimpleApplication {
+    // The test driver script will allow this program to run until we
+    // reach DEFAULT_LOOP_TIME or a decrease in instance counts is
+    // observed. For this particular WeakReference leak, the count
+    // was always observed to be increasing so if we get a decreasing
+    // count, then the leak is fixed in the bits being tested.
+    // Two minutes has been enough time to observe a decrease in
+    // fixed bits on overloaded systems, but the test will likely
+    // finish more quickly.
+    public static int DEFAULT_LOOP_TIME = 120;  // time is in seconds
 
-    public static void main(String[] args) {
+    // execute the AnonLoggerWeakRefLeak app work
+    public void doMyAppWork(String[] args) throws Exception {
         int loop_time = 0;
         int max_loop_time = DEFAULT_LOOP_TIME;
 
-        if (args.length == 0) {
+        // args[0] is the port-file
+        if (args.length < 2) {
             System.out.println("INFO: using default time of "
                 + max_loop_time + " seconds.");
         } else {
             try {
-                max_loop_time = Integer.parseInt(args[0]);
+                max_loop_time = Integer.parseInt(args[1]);
             } catch (NumberFormatException nfe) {
-                System.err.println("Error: '" + args[0]
+                throw new RuntimeException("Error: '" + args[1]
                     + "': is not a valid seconds value.");
-                System.err.println("Usage: AnonLoggerWeakRefLeak [seconds]");
-                System.exit(1);
             }
         }
 
@@ -73,4 +81,12 @@
 
         System.out.println("INFO: final loop count = " + count);
     }
+
+    public static void main(String[] args) throws Exception {
+        AnonLoggerWeakRefLeak myApp = new AnonLoggerWeakRefLeak();
+
+        SimpleApplication.setMyApp(myApp);
+
+        SimpleApplication.main(args);
+    }
 }
--- a/jdk/test/java/util/logging/AnonLoggerWeakRefLeak.sh	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/util/logging/AnonLoggerWeakRefLeak.sh	Fri Aug 20 14:48:10 2010 -0400
@@ -1,3 +1,5 @@
+#!/bin/sh
+
 #
 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -23,76 +25,24 @@
 
 # @test
 # @bug 6942989
-# @ignore until 6964018 is fixed
 # @summary Check for WeakReference leak in anonymous Logger objects
 # @author Daniel D. Daugherty
 #
-# @run build AnonLoggerWeakRefLeak
-# @run shell/timeout=180 AnonLoggerWeakRefLeak.sh
+# @library ../../../sun/tools/common
+# @build SimpleApplication ShutdownSimpleApplication
+# @build AnonLoggerWeakRefLeak
+# @run shell/timeout=240 AnonLoggerWeakRefLeak.sh
 
-# The timeout is: 2 minutes for infrastructure and 1 minute for the test
+# The timeout is: 2 minutes for infrastructure and 2 minutes for the test
 #
 
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
+. ${TESTSRC}/../../../sun/tools/common/CommonSetup.sh
+. ${TESTSRC}/../../../sun/tools/common/ApplicationSetup.sh
 
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-JAVA="${TESTJAVA}"/bin/java
-JMAP="${TESTJAVA}"/bin/jmap
-JPS="${TESTJAVA}"/bin/jps
-
-set -eu
 
 TEST_NAME="AnonLoggerWeakRefLeak"
 TARGET_CLASS="java\.lang\.ref\.WeakReference"
 
-is_cygwin=false
-is_mks=false
-is_windows=false
-
-case `uname -s` in
-CYGWIN*)
-    is_cygwin=true
-    is_windows=true
-    ;;
-Windows_*)
-    is_mks=true
-    is_windows=true
-    ;;
-*)
-    ;;
-esac
-
-
-# wrapper for grep
-#
-grep_cmd() {
-    set +e
-    if $is_windows; then
-        # need dos2unix to get rid of CTRL-M chars from java output
-        dos2unix | grep "$@"
-        status="$?"
-    else
-        grep "$@"
-        status="$?"
-    fi
-    set -e
-}
-
 
 # MAIN begins here
 #
@@ -105,62 +55,64 @@
 # see if this version of jmap supports the '-histo:live' option
 jmap_option="-histo:live"
 set +e
-"${JMAP}" "$jmap_option" 0 > "$TEST_NAME.jmap" 2>&1
-grep '^Usage: ' "$TEST_NAME.jmap" > /dev/null 2>&1
+"${JMAP}" 2>&1 | grep ':live' > /dev/null 2>&1
 status="$?"
 set -e
-if [ "$status" = 0 ]; then
-    echo "INFO: switching jmap option from '$jmap_option'\c"
-    jmap_option="-histo"
-    echo " to '$jmap_option'."
+if [ "$status" != 0 ]; then
+    # usage message doesn't show ':live' option
+
+    if $isWindows; then
+        # If SA isn't present, then jmap gives a different usage message
+        # that doesn't show the ':live' option. However, that's a bug that
+        # is covered by 6971851 so we try using the option just to be sure.
+        # For some reason, this problem has only been seen on OpenJDK6 on
+        # Windows. Not sure why.
+        set +e
+        # Note: Don't copy this code to try probing process 0 on Linux; it
+        # will kill the process group in strange ways.
+        "${JMAP}" "$jmap_option" 0 2>&1 | grep 'Usage' > /dev/null 2>&1
+        status="$?"
+        set -e
+        if [ "$status" = 0 ]; then
+            # Usage message generated so flag the problem.
+            status=1
+        else
+            # No usage message so clear the flag.
+            status=0
+        fi
+    fi
+
+    if [ "$status" != 0 ]; then
+        echo "ERROR: 'jmap $jmap_option' is not supported so this test"
+        echo "ERROR: cannot work reliably. Aborting!"
+        exit 2
+    fi
 fi
 
-"${JAVA}" ${TESTVMOPTS} -classpath "${TESTCLASSES}" \
-    "$TEST_NAME" $seconds > "$TEST_NAME.log" 2>&1 &
-test_pid="$!"
-echo "INFO: starting $TEST_NAME as pid = $test_pid"
-
-# wait for test program to get going
-count=0
-while [ "$count" -lt 30 ]; do
-    sleep 2
-    grep_cmd '^INFO: call count = 0$' < "$TEST_NAME.log" > /dev/null 2>&1
-    if [ "$status" = 0 ]; then
-        break
-    fi
-    count=`expr $count + 1`
-done
+# Start application and use TEST_NAME.port for coordination
+startApplication "$TEST_NAME" "$TEST_NAME.port" $seconds
 
-if [ "$count" -ge 30 ]; then
-    echo "ERROR: $TEST_NAME failed to get going." >&2
-    echo "INFO: killing $test_pid"
-    kill "$test_pid"
-    exit 1
-elif [ "$count" -gt 1 ]; then
-    echo "INFO: $TEST_NAME took $count loops to start."
-fi
-
-if $is_cygwin; then
-    # We need the Windows pid for jmap and not the Cygwin pid.
-    # Note: '\t' works on Cygwin, but doesn't seem to work on Solaris.
-    jmap_pid=`"${JPS}"| grep_cmd "[ \t]$TEST_NAME$" | sed 's/[ \t].*//'`
-    if [ -z "$jmap_pid" ]; then
-        echo "FAIL: jps could not map Cygwin pid to Windows pid." >&2
-        echo "INFO: killing $test_pid"
-        kill "$test_pid"
-        exit 2
-    fi
-    echo "INFO: pid = $test_pid maps to Windows pid = $jmap_pid"
-else
-    jmap_pid="$test_pid"
-fi
+finished_early=false
 
 decreasing_cnt=0
 increasing_cnt=0
 loop_cnt=0
 prev_instance_cnt=0
 
+MAX_JMAP_TRY_CNT=10
+jmap_retry_cnt=0
+loop_cnt_on_retry=0
+
 while true; do
+    # see if the target process has finished its run and bail if it has
+    set +e
+    grep "^INFO: final loop count = " "$appOutput" > /dev/null 2>&1
+    status="$?"
+    set -e
+    if [ "$status" = 0 ]; then
+        break
+    fi
+
     # Output format for 'jmap -histo' in JDK1.5.0:
     #
     #     <#bytes> <#instances> <class_name>
@@ -170,38 +122,70 @@
     #     <num>: <#instances> <#bytes> <class_name>
     #
     set +e
-    "${JMAP}" "$jmap_option" "$jmap_pid" > "$TEST_NAME.jmap" 2>&1
+    "${JMAP}" "$jmap_option" "$appJavaPid" > "$TEST_NAME.jmap" 2>&1
     status="$?"
     set -e
 
     if [ "$status" != 0 ]; then
         echo "INFO: jmap exited with exit code = $status"
-        if [ "$loop_cnt" = 0 ]; then
-            echo "INFO: on the first iteration so no samples were taken."
-            echo "INFO: start of jmap output:"
-            cat "$TEST_NAME.jmap"
-            echo "INFO: end of jmap output."
+
+        # There are intermittent jmap failures; see 6498448.
+        #
+        # So far the following have been observed in a jmap call
+        # that was not in a race with target process termination:
+        #
+        # (Solaris specific, 2nd sample)
+        # <pid>: Unable to open door: target process not responding or HotSpot VM not loaded
+        # The -F option can be used when the target process is not responding
+        #
+        # (on Solaris so far)
+        # java.io.IOException
+        #
+        # (on Solaris so far, 1st sample)
+        # <pid>: Permission denied
+        #
+        sed 's/^/INFO: /' "$TEST_NAME.jmap"
+
+        if [ "$loop_cnt" = "$loop_cnt_on_retry" ]; then
+            # loop count hasn't changed
+            jmap_retry_cnt=`expr $jmap_retry_cnt + 1`
+        else
+            # loop count has changed so remember it
+            jmap_retry_cnt=1
+            loop_cnt_on_retry="$loop_cnt"
+        fi
+
+        # This is '-ge' because we have the original attempt plus
+        # MAX_JMAP_TRY_CNT - 1 retries.
+        if [ "$jmap_retry_cnt" -ge "$MAX_JMAP_TRY_CNT" ]; then
+            echo "INFO: jmap failed $MAX_JMAP_TRY_CNT times in a row" \
+                "without making any progress."
             echo "FAIL: jmap is unable to take any samples." >&2
-            echo "INFO: killing $test_pid"
-            kill "$test_pid"
+            killApplication
             exit 2
         fi
-        echo "INFO: The likely reason is that $TEST_NAME has finished running."
-        break
+
+        # short delay and try again
+        # Note: sleep 1 didn't help with "<pid>: Permission denied"
+        sleep 2
+        echo "INFO: retrying jmap (retry=$jmap_retry_cnt, loop=$loop_cnt)."
+        continue
     fi
 
-    instance_cnt=`grep_cmd "[ 	]$TARGET_CLASS$" \
-        < "$TEST_NAME.jmap" \
+    set +e
+    instance_cnt=`grep "${PATTERN_WS}${TARGET_CLASS}${PATTERN_EOL}" \
+        "$TEST_NAME.jmap" \
         | sed '
             # strip leading whitespace; does nothing in JDK1.5.0
-            s/^[ 	][ 	]*//
+            s/^'"${PATTERN_WS}${PATTERN_WS}"'*//
             # strip <#bytes> in JDK1.5.0; does nothing otherwise
-            s/^[1-9][0-9]*[ 	][ 	]*//
+            s/^[1-9][0-9]*'"${PATTERN_WS}${PATTERN_WS}"'*//
             # strip <num>: field; does nothing in JDK1.5.0
-            s/^[1-9][0-9]*:[ 	][ 	]*//
+            s/^[1-9][0-9]*:'"${PATTERN_WS}${PATTERN_WS}"'*//
             # strip <class_name> field
-            s/[ 	].*//
+            s/'"${PATTERN_WS}"'.*//
             '`
+    set -e
     if [ -z "$instance_cnt" ]; then
         echo "INFO: instance count is unexpectedly empty"
         if [ "$loop_cnt" = 0 ]; then
@@ -211,8 +195,7 @@
             cat "$TEST_NAME.jmap"
             echo "INFO: end of jmap output."
             echo "FAIL: cannot find the instance count value." >&2
-            echo "INFO: killing $test_pid"
-            kill "$test_pid"
+            killApplication
             exit 2
         fi
     else
@@ -221,7 +204,17 @@
         if [ "$instance_cnt" -gt "$prev_instance_cnt" ]; then
             increasing_cnt=`expr $increasing_cnt + 1`
         else
+            # actually decreasing or the same
             decreasing_cnt=`expr $decreasing_cnt + 1`
+
+            # For this particular WeakReference leak, the count was
+            # always observed to be increasing so if we get a decreasing
+            # or the same count, then the leak is fixed in the bits
+            # being tested.
+            echo "INFO: finishing early due to non-increasing instance count."
+            finished_early=true
+            killApplication
+            break
         fi
         prev_instance_cnt="$instance_cnt"
     fi
@@ -232,8 +225,22 @@
     loop_cnt=`expr $loop_cnt + 1`
 done
 
+if [ $finished_early = false ]; then
+    stopApplication "$TEST_NAME.port"
+    waitForApplication
+fi
+
+echo "INFO: $TEST_NAME has finished running."
 echo "INFO: increasing_cnt = $increasing_cnt"
 echo "INFO: decreasing_cnt = $decreasing_cnt"
+if [ "$jmap_retry_cnt" -gt 0 ]; then
+    echo "INFO: jmap_retry_cnt = $jmap_retry_cnt (in $loop_cnt iterations)"
+fi
+
+if [ "$loop_cnt" = 0 ]; then
+    echo "FAIL: jmap is unable to take any samples." >&2
+    exit 2
+fi
 
 echo "INFO: The instance count of" `eval echo $TARGET_CLASS` "objects"
 if [ "$decreasing_cnt" = 0 ]; then
@@ -242,6 +249,6 @@
     exit 2
 fi
 
-echo "INFO: is both increasing and decreasing."
+echo "INFO: is not always increasing."
 echo "PASS: This indicates that there is not a memory leak."
 exit 0
--- a/jdk/test/java/util/logging/LoggerWeakRefLeak.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/util/logging/LoggerWeakRefLeak.java	Fri Aug 20 14:48:10 2010 -0400
@@ -23,27 +23,32 @@
 
 import java.util.logging.*;
 
-public class LoggerWeakRefLeak {
-    // AnonLoggerWeakRefLeak checks for one weak reference leak.
-    // LoggerWeakRefLeak checks for two weak reference leaks so
-    // this test runs twice as long, by default.
+public class LoggerWeakRefLeak extends SimpleApplication {
+    // The test driver script will allow this program to run until we
+    // reach DEFAULT_LOOP_TIME or a decrease in instance counts is
+    // observed. For these particular WeakReference leaks, the count
+    // was always observed to be increasing so if we get a decreasing
+    // count, then the leaks are fixed in the bits being tested.
+    // Two minutes has been enough time to observe a decrease in
+    // fixed bits on overloaded systems, but the test will likely
+    // finish more quickly.
     public static int DEFAULT_LOOP_TIME = 120;  // time is in seconds
 
-    public static void main(String[] args) {
+    // execute the LoggerWeakRefLeak app work
+    public void doMyAppWork(String[] args) throws Exception {
         int loop_time = 0;
         int max_loop_time = DEFAULT_LOOP_TIME;
 
-        if (args.length == 0) {
+        // args[0] is the port-file
+        if (args.length < 2) {
             System.out.println("INFO: using default time of "
                 + max_loop_time + " seconds.");
         } else {
             try {
-                max_loop_time = Integer.parseInt(args[0]);
+                max_loop_time = Integer.parseInt(args[1]);
             } catch (NumberFormatException nfe) {
-                System.err.println("Error: '" + args[0]
+                throw new RuntimeException("Error: '" + args[1]
                     + "': is not a valid seconds value.");
-                System.err.println("Usage: LoggerWeakRefLeak [seconds]");
-                System.exit(1);
             }
         }
 
@@ -86,4 +91,12 @@
 
         System.out.println("INFO: final loop count = " + count);
     }
+
+    public static void main(String[] args) throws Exception {
+        AnonLoggerWeakRefLeak myApp = new AnonLoggerWeakRefLeak();
+
+        SimpleApplication.setMyApp(myApp);
+
+        SimpleApplication.main(args);
+    }
 }
--- a/jdk/test/java/util/logging/LoggerWeakRefLeak.sh	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/java/util/logging/LoggerWeakRefLeak.sh	Fri Aug 20 14:48:10 2010 -0400
@@ -1,3 +1,5 @@
+#!/bin/sh
+
 #
 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -23,76 +25,24 @@
 
 # @test
 # @bug 6942989
-# @ignore until 6964018 is fixed
 # @summary Check for WeakReference leak in Logger objects
 # @author Daniel D. Daugherty
 #
-# @run build LoggerWeakRefLeak
+# @library ../../../sun/tools/common
+# @build SimpleApplication ShutdownSimpleApplication
+# @build LoggerWeakRefLeak
 # @run shell/timeout=240 LoggerWeakRefLeak.sh
 
-# The timeout is: 2 minutes for infrastructure and 1 minute for the test
+# The timeout is: 2 minutes for infrastructure and 2 minutes for the test
 #
 
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
+. ${TESTSRC}/../../../sun/tools/common/CommonSetup.sh
+. ${TESTSRC}/../../../sun/tools/common/ApplicationSetup.sh
 
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-JAVA="${TESTJAVA}"/bin/java
-JMAP="${TESTJAVA}"/bin/jmap
-JPS="${TESTJAVA}"/bin/jps
-
-set -eu
 
 TEST_NAME="LoggerWeakRefLeak"
 TARGET_CLASS="java\.lang\.ref\.WeakReference"
 
-is_cygwin=false
-is_mks=false
-is_windows=false
-
-case `uname -s` in
-CYGWIN*)
-    is_cygwin=true
-    is_windows=true
-    ;;
-Windows_*)
-    is_mks=true
-    is_windows=true
-    ;;
-*)
-    ;;
-esac
-
-
-# wrapper for grep
-#
-grep_cmd() {
-    set +e
-    if $is_windows; then
-        # need dos2unix to get rid of CTRL-M chars from java output
-        dos2unix | grep "$@"
-        status="$?"
-    else
-        grep "$@"
-        status="$?"
-    fi
-    set -e
-}
-
 
 # MAIN begins here
 #
@@ -105,62 +55,64 @@
 # see if this version of jmap supports the '-histo:live' option
 jmap_option="-histo:live"
 set +e
-"${JMAP}" "$jmap_option" 0 > "$TEST_NAME.jmap" 2>&1
-grep '^Usage: ' "$TEST_NAME.jmap" > /dev/null 2>&1
+"${JMAP}" 2>&1 | grep ':live' > /dev/null 2>&1
 status="$?"
 set -e
-if [ "$status" = 0 ]; then
-    echo "INFO: switching jmap option from '$jmap_option'\c"
-    jmap_option="-histo"
-    echo " to '$jmap_option'."
+if [ "$status" != 0 ]; then
+    # usage message doesn't show ':live' option
+
+    if $isWindows; then
+        # If SA isn't present, then jmap gives a different usage message
+        # that doesn't show the ':live' option. However, that's a bug that
+        # is covered by 6971851 so we try using the option just to be sure.
+        # For some reason, this problem has only been seen on OpenJDK6 on
+        # Windows. Not sure why.
+        set +e
+        # Note: Don't copy this code to try probing process 0 on Linux; it
+        # will kill the process group in strange ways.
+        "${JMAP}" "$jmap_option" 0 2>&1 | grep 'Usage' > /dev/null 2>&1
+        status="$?"
+        set -e
+        if [ "$status" = 0 ]; then
+            # Usage message generated so flag the problem.
+            status=1
+        else
+            # No usage message so clear the flag.
+            status=0
+        fi
+    fi
+
+    if [ "$status" != 0 ]; then
+        echo "ERROR: 'jmap $jmap_option' is not supported so this test"
+        echo "ERROR: cannot work reliably. Aborting!"
+        exit 2
+    fi
 fi
 
-"${JAVA}" ${TESTVMOPTS} -classpath "${TESTCLASSES}" \
-    "$TEST_NAME" $seconds > "$TEST_NAME.log" 2>&1 &
-test_pid="$!"
-echo "INFO: starting $TEST_NAME as pid = $test_pid"
-
-# wait for test program to get going
-count=0
-while [ "$count" -lt 30 ]; do
-    sleep 2
-    grep_cmd '^INFO: call count = 0$' < "$TEST_NAME.log" > /dev/null 2>&1
-    if [ "$status" = 0 ]; then
-        break
-    fi
-    count=`expr $count + 1`
-done
+# Start application and use TEST_NAME.port for coordination
+startApplication "$TEST_NAME" "$TEST_NAME.port" $seconds
 
-if [ "$count" -ge 30 ]; then
-    echo "ERROR: $TEST_NAME failed to get going." >&2
-    echo "INFO: killing $test_pid"
-    kill "$test_pid"
-    exit 1
-elif [ "$count" -gt 1 ]; then
-    echo "INFO: $TEST_NAME took $count loops to start."
-fi
-
-if $is_cygwin; then
-    # We need the Windows pid for jmap and not the Cygwin pid.
-    # Note: '\t' works on Cygwin, but doesn't seem to work on Solaris.
-    jmap_pid=`"${JPS}"| grep_cmd "[ \t]$TEST_NAME$" | sed 's/[ \t].*//'`
-    if [ -z "$jmap_pid" ]; then
-        echo "FAIL: jps could not map Cygwin pid to Windows pid." >&2
-        echo "INFO: killing $test_pid"
-        kill "$test_pid"
-        exit 2
-    fi
-    echo "INFO: pid = $test_pid maps to Windows pid = $jmap_pid"
-else
-    jmap_pid="$test_pid"
-fi
+finished_early=false
 
 decreasing_cnt=0
 increasing_cnt=0
 loop_cnt=0
 prev_instance_cnt=0
 
+MAX_JMAP_TRY_CNT=10
+jmap_retry_cnt=0
+loop_cnt_on_retry=0
+
 while true; do
+    # see if the target process has finished its run and bail if it has
+    set +e
+    grep "^INFO: final loop count = " "$appOutput" > /dev/null 2>&1
+    status="$?"
+    set -e
+    if [ "$status" = 0 ]; then
+        break
+    fi
+
     # Output format for 'jmap -histo' in JDK1.5.0:
     #
     #     <#bytes> <#instances> <class_name>
@@ -170,38 +122,70 @@
     #     <num>: <#instances> <#bytes> <class_name>
     #
     set +e
-    "${JMAP}" "$jmap_option" "$jmap_pid" > "$TEST_NAME.jmap" 2>&1
+    "${JMAP}" "$jmap_option" "$appJavaPid" > "$TEST_NAME.jmap" 2>&1
     status="$?"
     set -e
 
     if [ "$status" != 0 ]; then
         echo "INFO: jmap exited with exit code = $status"
-        if [ "$loop_cnt" = 0 ]; then
-            echo "INFO: on the first iteration so no samples were taken."
-            echo "INFO: start of jmap output:"
-            cat "$TEST_NAME.jmap"
-            echo "INFO: end of jmap output."
+
+        # There are intermittent jmap failures; see 6498448.
+        #
+        # So far the following have been observed in a jmap call
+        # that was not in a race with target process termination:
+        #
+        # (Solaris specific, 2nd sample)
+        # <pid>: Unable to open door: target process not responding or HotSpot VM not loaded
+        # The -F option can be used when the target process is not responding
+        #
+        # (on Solaris so far)
+        # java.io.IOException
+        #
+        # (on Solaris so far, 1st sample)
+        # <pid>: Permission denied
+        #
+        sed 's/^/INFO: /' "$TEST_NAME.jmap"
+
+        if [ "$loop_cnt" = "$loop_cnt_on_retry" ]; then
+            # loop count hasn't changed
+            jmap_retry_cnt=`expr $jmap_retry_cnt + 1`
+        else
+            # loop count has changed so remember it
+            jmap_retry_cnt=1
+            loop_cnt_on_retry="$loop_cnt"
+        fi
+
+        # This is '-ge' because we have the original attempt plus
+        # MAX_JMAP_TRY_CNT - 1 retries.
+        if [ "$jmap_retry_cnt" -ge "$MAX_JMAP_TRY_CNT" ]; then
+            echo "INFO: jmap failed $MAX_JMAP_TRY_CNT times in a row" \
+                "without making any progress."
             echo "FAIL: jmap is unable to take any samples." >&2
-            echo "INFO: killing $test_pid"
-            kill "$test_pid"
+            killApplication
             exit 2
         fi
-        echo "INFO: The likely reason is that $TEST_NAME has finished running."
-        break
+
+        # short delay and try again
+        # Note: sleep 1 didn't help with "<pid>: Permission denied"
+        sleep 2
+        echo "INFO: retrying jmap (retry=$jmap_retry_cnt, loop=$loop_cnt)."
+        continue
     fi
 
-    instance_cnt=`grep_cmd "[ 	]$TARGET_CLASS$" \
-        < "$TEST_NAME.jmap" \
+    set +e
+    instance_cnt=`grep "${PATTERN_WS}${TARGET_CLASS}${PATTERN_EOL}" \
+        "$TEST_NAME.jmap" \
         | sed '
             # strip leading whitespace; does nothing in JDK1.5.0
-            s/^[ 	][ 	]*//
+            s/^'"${PATTERN_WS}${PATTERN_WS}"'*//
             # strip <#bytes> in JDK1.5.0; does nothing otherwise
-            s/^[1-9][0-9]*[ 	][ 	]*//
+            s/^[1-9][0-9]*'"${PATTERN_WS}${PATTERN_WS}"'*//
             # strip <num>: field; does nothing in JDK1.5.0
-            s/^[1-9][0-9]*:[ 	][ 	]*//
+            s/^[1-9][0-9]*:'"${PATTERN_WS}${PATTERN_WS}"'*//
             # strip <class_name> field
-            s/[ 	].*//
+            s/'"${PATTERN_WS}"'.*//
             '`
+    set -e
     if [ -z "$instance_cnt" ]; then
         echo "INFO: instance count is unexpectedly empty"
         if [ "$loop_cnt" = 0 ]; then
@@ -211,8 +195,7 @@
             cat "$TEST_NAME.jmap"
             echo "INFO: end of jmap output."
             echo "FAIL: cannot find the instance count value." >&2
-            echo "INFO: killing $test_pid"
-            kill "$test_pid"
+            killApplication
             exit 2
         fi
     else
@@ -221,7 +204,17 @@
         if [ "$instance_cnt" -gt "$prev_instance_cnt" ]; then
             increasing_cnt=`expr $increasing_cnt + 1`
         else
+            # actually decreasing or the same
             decreasing_cnt=`expr $decreasing_cnt + 1`
+
+            # For these particular WeakReference leaks, the count was
+            # always observed to be increasing so if we get a decreasing
+            # or the same count, then the leaks are fixed in the bits
+            # being tested.
+            echo "INFO: finishing early due to non-increasing instance count."
+            finished_early=true
+            killApplication
+            break
         fi
         prev_instance_cnt="$instance_cnt"
     fi
@@ -232,8 +225,22 @@
     loop_cnt=`expr $loop_cnt + 1`
 done
 
+if [ $finished_early = false ]; then
+    stopApplication "$TEST_NAME.port"
+    waitForApplication
+fi
+
+echo "INFO: $TEST_NAME has finished running."
 echo "INFO: increasing_cnt = $increasing_cnt"
 echo "INFO: decreasing_cnt = $decreasing_cnt"
+if [ "$jmap_retry_cnt" -gt 0 ]; then
+    echo "INFO: jmap_retry_cnt = $jmap_retry_cnt (in $loop_cnt iterations)"
+fi
+
+if [ "$loop_cnt" = 0 ]; then
+    echo "FAIL: jmap is unable to take any samples." >&2
+    exit 2
+fi
 
 echo "INFO: The instance count of" `eval echo $TARGET_CLASS` "objects"
 if [ "$decreasing_cnt" = 0 ]; then
@@ -242,6 +249,6 @@
     exit 2
 fi
 
-echo "INFO: is both increasing and decreasing."
+echo "INFO: is not always increasing."
 echo "PASS: This indicates that there is not a memory leak."
 exit 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JColorChooser/Test6199676.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6199676
+ * @summary Tests preview panel after L&F changing
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Component;
+import java.awt.Container;
+import javax.swing.JColorChooser;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UIManager.LookAndFeelInfo;
+
+public class Test6199676 implements Runnable {
+    public static void main(String[] args) {
+        SwingUtilities.invokeLater(new Test6199676());
+    }
+
+    private static void exit(String error) {
+        if (error != null) {
+            System.err.println(error);
+            System.exit(1);
+        }
+        else {
+            System.exit(0);
+        }
+    }
+
+    private static Component getPreview(Container container) {
+        String name = "ColorChooser.previewPanelHolder";
+        for (Component component : container.getComponents()) {
+            if (!name.equals(component.getName())) {
+                component = (component instanceof Container)
+                        ? getPreview((Container) component)
+                        : null;
+            }
+            if (component instanceof Container) {
+                container = (Container) component;
+                return 1 == container.getComponentCount()
+                        ? container.getComponent(0)
+                        : null;
+            }
+        }
+        return null;
+    }
+
+    private static boolean isShowing(Component component) {
+        return (component != null) && component.isShowing();
+    }
+
+    private int index;
+    private boolean updated;
+    private JColorChooser chooser;
+
+    public synchronized void run() {
+        if (this.chooser == null) {
+            this.chooser = new JColorChooser();
+
+            JFrame frame = new JFrame(getClass().getName());
+            frame.add(this.chooser);
+            frame.setVisible(true);
+        }
+        else if (this.updated) {
+            if (isShowing(this.chooser.getPreviewPanel())) {
+                exit("custom preview panel is showing");
+            }
+            exit(null);
+        }
+        else {
+            Component component = this.chooser.getPreviewPanel();
+            if (component == null) {
+                component = getPreview(this.chooser);
+            }
+            if (!isShowing(component)) {
+                exit("default preview panel is not showing");
+            }
+            this.updated = true;
+            this.chooser.setPreviewPanel(new JPanel());
+        }
+        LookAndFeelInfo[] infos = UIManager.getInstalledLookAndFeels();
+        LookAndFeelInfo info = infos[++this.index % infos.length];
+        try {
+            UIManager.setLookAndFeel(info.getClassName());
+        }
+        catch (Exception exception) {
+            exit("could not change L&F");
+        }
+        SwingUtilities.updateComponentTreeUI(this.chooser);
+        SwingUtilities.invokeLater(this);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JComboBox/4743225/bug4743225.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 4743225
+ * @summary Size of JComboBox list is wrong when list is populated via PopupMenuListener
+ * @author Alexander Potochkin
+ */
+
+import sun.awt.SunToolkit;
+
+import javax.accessibility.AccessibleContext;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+import javax.swing.event.PopupMenuEvent;
+import javax.swing.event.PopupMenuListener;
+import javax.swing.plaf.basic.BasicComboPopup;
+import java.awt.FlowLayout;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+
+public class bug4743225 extends JFrame {
+
+    private static JComboBox cb;
+    private static volatile boolean flag;
+
+    public bug4743225() {
+        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        setLayout(new FlowLayout());
+        cb = new JComboBox(new Object[] {"one", "two", "three"});
+        cb.addPopupMenuListener(new PopupMenuListener() {
+            public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
+                cb.addItem("Test");
+            }
+
+            public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
+            }
+
+            public void popupMenuCanceled(PopupMenuEvent e) {
+            }
+        });
+        add(cb);
+        pack();
+    }
+
+    public static BasicComboPopup getPopup() {
+        AccessibleContext c = cb.getAccessibleContext();
+        for(int i = 0; i < c.getAccessibleChildrenCount(); i ++) {
+            if (c.getAccessibleChild(i) instanceof BasicComboPopup) {
+                return (BasicComboPopup) c.getAccessibleChild(i);
+            }
+        }
+        throw new AssertionError("No BasicComboPopup found");
+    }
+
+    public static void main(String... args) throws Exception {
+
+        Robot robot = new Robot();
+        robot.setAutoDelay(20);
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                new bug4743225().setVisible(true);
+            }
+        });
+        toolkit.realSync();
+
+        // calling this method from main thread is ok
+        Point point = cb.getLocationOnScreen();
+        robot.mouseMove(point.x + 10, point.y + 10);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        toolkit.realSync();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                if(getPopup().getList().getLastVisibleIndex() == 3) {
+                    flag = true;
+                }
+            }
+        });
+
+        if (!flag) {
+            throw new RuntimeException("The ComboBox popup wasn't correctly updated");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFormattedTextField/Test6462562.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,360 @@
+/*
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+   @bug 6462562
+   @summary Tests text input into JFormattedTextField
+            with an InternationalFormatter
+   @author Peter Zhelezniakov
+   @run main Test6462562
+*/
+
+import java.awt.event.ActionEvent;
+import java.text.DateFormat;
+import java.text.NumberFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import javax.swing.Action;
+import javax.swing.JFormattedTextField;
+import javax.swing.SwingUtilities;
+import javax.swing.text.Caret;
+import javax.swing.text.DateFormatter;
+import javax.swing.text.DefaultEditorKit;
+import javax.swing.text.InternationalFormatter;
+import javax.swing.text.NumberFormatter;
+
+
+public class Test6462562
+{
+    static final String BACKSPACE = new String("backspace");
+    static final String DELETE = new String("delete");
+
+    boolean failed = false;
+
+    void test() {
+        testPercentFormat();
+        testCurrencyFormat();
+        testIntegerFormat();
+        testDateFormat();
+
+        if (failed) {
+            throw new RuntimeException("Some testcases failed, see output above");
+        }
+        System.err.println("(-;  All testcases passed  ;-)");
+    }
+
+    TestFormattedTextField create(NumberFormat format) {
+        format.setMaximumFractionDigits(0);
+        NumberFormatter fmt = new NumberFormatter(format);
+        return new TestFormattedTextField(fmt);
+    }
+
+    TestFormattedTextField create(DateFormat format) {
+        DateFormatter fmt = new DateFormatter(format);
+        return new TestFormattedTextField(fmt);
+    }
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                new Test6462562().test();
+            }
+        });
+    }
+
+    class TestFormattedTextField extends JFormattedTextField
+    {
+        final Action backspace;
+        final Action delete;
+        final Action insert;
+
+        final ActionEvent dummyEvent;
+
+        public TestFormattedTextField(InternationalFormatter fmt) {
+            super(fmt);
+            fmt.setAllowsInvalid(false);
+            fmt.setOverwriteMode(true);
+
+            backspace = getActionMap().get(DefaultEditorKit.deletePrevCharAction);
+            delete = getActionMap().get(DefaultEditorKit.deleteNextCharAction);
+            insert = getActionMap().get(DefaultEditorKit.insertContentAction);
+            dummyEvent = new ActionEvent(this, 0, null);
+        }
+
+        public boolean test(int pos, int selectionLength, String todo, Object expectedResult) {
+            Object v0 = getValue();
+
+            Caret caret = getCaret();
+            caret.setDot(pos);
+            if (selectionLength > 0) {
+                caret.moveDot(pos + selectionLength);
+            }
+
+            String desc = todo;
+            if (todo == BACKSPACE) {
+                backspace.actionPerformed(dummyEvent);
+            } else if (todo == DELETE) {
+                delete.actionPerformed(dummyEvent);
+            } else {
+                desc = "insert('" + todo + "')";
+                insert.actionPerformed(new ActionEvent(this, 0, todo));
+            }
+
+            try {
+                commitEdit();
+            } catch (ParseException e) {
+                e.printStackTrace();
+                failed = true;
+                return false;
+            }
+
+            Object v1 = getValue();
+            if (! v1.equals(expectedResult)) {
+                System.err.printf("Failure: value='%s', mark=%d, dot=%d, action=%s\n",
+                        v0, pos, pos + selectionLength, desc);
+                System.err.printf("   Result: '%s', expected: '%s'\n", v1, expectedResult);
+                failed = true;
+                return false;
+            }
+            return true;
+        }
+    }
+
+    void testPercentFormat() {
+        NumberFormat format = NumberFormat.getPercentInstance(Locale.US);
+        TestFormattedTextField ftf = create(format);
+        ftf.setValue(.34);
+
+        System.err.println("Testing NumberFormat.getPercentInstance(Locale.US)");
+
+        // test inserting individual characters
+        ftf.test(0, 0, "1", .14);
+        ftf.test(2, 0, "2", 1.42);
+        ftf.test(1, 0, "0", 1.02);
+
+        // test inserting several characters at once - e.g. from clipboard
+        ftf.test(0, 0, "1024", 10.24);
+        ftf.test(3, 0, "333", 103.33);
+        ftf.test(6, 0, "77", 10333.77);
+        ftf.test(4, 0, "99", 10399.77);
+        ftf.test(6, 0, "00", 10390.07);
+
+        // test inserting strings that contain some formatting
+        ftf.test(0, 0, "2,2", 2290.07);
+        ftf.test(2, 0, "2,2", 222.27);
+        ftf.test(4, 0, "2,2", 222.22);
+        ftf.test(6, 0, "33,33", 2222233.33);
+
+        // test delete
+        ftf.test(0, 0, DELETE, 222233.33);
+        ftf.test(10, 0, DELETE, 222233.33);
+        ftf.test(5, 0, DELETE, 22223.33);
+        ftf.test(6, 0, DELETE, 2222.33);
+
+        // test backspace
+        ftf.test(0, 0, BACKSPACE, 2222.33);
+        ftf.test(7, 0, BACKSPACE, 222.23);
+        ftf.test(4, 0, BACKSPACE, 22.23);
+        ftf.test(2, 0, BACKSPACE, 2.23);
+
+        // test replacing selection
+        ftf.test(0, 1, "555", 555.23);
+        ftf.test(4, 2, "555", 5555.55);
+        ftf.test(2, 3, "1", 551.55);
+        ftf.test(3, 2, "6", 55.65);
+        ftf.test(4, 2, "12", 556.12);
+        ftf.test(3, 4, "0", 5.5);
+        ftf.test(0, 3, "111222333444555", 1112223334445.55);
+
+        // test deleting selection
+        ftf.test(0, 2, DELETE, 12223334445.55);
+        ftf.test(0, 3, BACKSPACE, 223334445.55);
+        ftf.test(12, 2, DELETE, 2233344.45);
+        ftf.test(9, 2, BACKSPACE, 22333.44);
+        ftf.test(4, 3, DELETE, 223.44);
+        ftf.test(1, 2, BACKSPACE, 23.44);
+        ftf.test(3, 3, DELETE, .23);
+        ftf.test(1, 2, BACKSPACE, .02);
+    }
+
+    void testCurrencyFormat() {
+        NumberFormat format = NumberFormat.getCurrencyInstance(Locale.US);
+        TestFormattedTextField ftf = create(format);
+        ftf.setValue(56L);
+
+        System.err.println("Testing NumberFormat.getCurrencyInstance(Locale.US)");
+
+        // test inserting individual characters
+        ftf.test(1, 0, "1", 16L);
+        ftf.test(3, 0, "2", 162L);
+        ftf.test(2, 0, "0", 102L);
+
+        // test inserting several characters at once - e.g. from clipboard
+        ftf.test(1, 0, "1024", 1024L);
+        ftf.test(4, 0, "333", 10333L);
+        ftf.test(7, 0, "77", 1033377L);
+        ftf.test(5, 0, "99", 1039977L);
+        ftf.test(7, 0, "00", 1039007L);
+
+        // test inserting strings that contain some formatting
+        ftf.test(1, 0, "2,2", 229007L);
+        ftf.test(3, 0, "2,2", 22227L);
+        ftf.test(4, 0, "2,2", 2222L);
+        ftf.test(6, 0, "33,33", 22223333L);
+
+        // test delete
+        ftf.test(1, 0, DELETE, 2223333L);
+        ftf.test(10, 0, DELETE, 2223333L);
+        ftf.test(5, 0, DELETE, 222333L);
+        ftf.test(5, 0, DELETE, 22233L);
+
+        // test backspace
+        ftf.test(1, 0, BACKSPACE, 22233L);
+        ftf.test(7, 0, BACKSPACE, 2223L);
+        ftf.test(4, 0, BACKSPACE, 223L);
+        ftf.test(2, 0, BACKSPACE, 23L);
+
+        // test replacing selection
+        ftf.test(1, 1, "555", 5553L);
+        ftf.test(4, 2, "555", 55555L);
+        ftf.test(2, 3, "1", 5155L);
+        ftf.test(3, 2, "6", 565L);
+        ftf.test(1, 3, "111222333444555", 111222333444555L);
+
+        // test deleting selection
+        ftf.test(1, 2, DELETE, 1222333444555L);
+        ftf.test(1, 3, BACKSPACE, 22333444555L);
+        ftf.test(13, 2, DELETE, 223334445L);
+        ftf.test(10, 2, BACKSPACE, 2233344L);
+        ftf.test(4, 4, DELETE, 2244L);
+        ftf.test(1, 4, BACKSPACE, 4L);
+    }
+
+    void testIntegerFormat() {
+        NumberFormat format = NumberFormat.getIntegerInstance(Locale.US);
+        TestFormattedTextField ftf = create(format);
+        ftf.setValue(56L);
+
+        System.err.println("Testing NumberFormat.getIntegerInstance(Locale.US)");
+
+        // test inserting individual characters
+        ftf.test(0, 0, "1", 16L);
+        ftf.test(2, 0, "2", 162L);
+        ftf.test(1, 0, "0", 102L);
+
+        // test inserting several characters at once - e.g. from clipboard
+        ftf.test(0, 0, "1024", 1024L);
+        ftf.test(3, 0, "333", 10333L);
+        ftf.test(6, 0, "77", 1033377L);
+        ftf.test(4, 0, "99", 1039977L);
+        ftf.test(6, 0, "00", 1039007L);
+
+        // test inserting strings that contain some formatting
+        ftf.test(0, 0, "2,2", 229007L);
+        ftf.test(2, 0, "2,2", 22227L);
+        ftf.test(3, 0, "2,2", 2222L);
+        ftf.test(5, 0, "33,33", 22223333L);
+
+        // test delete
+        ftf.test(0, 0, DELETE, 2223333L);
+        ftf.test(9, 0, DELETE, 2223333L);
+        ftf.test(4, 0, DELETE, 222333L);
+        ftf.test(4, 0, DELETE, 22233L);
+
+        // test backspace
+        ftf.test(0, 0, BACKSPACE, 22233L);
+        ftf.test(6, 0, BACKSPACE, 2223L);
+        ftf.test(2, 0, BACKSPACE, 223L);
+        ftf.test(2, 0, BACKSPACE, 23L);
+
+        // test replacing selection
+        ftf.test(0, 1, "555", 5553L);
+        ftf.test(3, 2, "555", 55555L);
+        ftf.test(1, 3, "1", 5155L);
+        ftf.test(2, 2, "6", 565L);
+        ftf.test(0, 3, "111222333444555", 111222333444555L);
+
+        // test deleting selection
+        ftf.test(0, 2, DELETE, 1222333444555L);
+        ftf.test(0, 3, BACKSPACE, 22333444555L);
+        ftf.test(12, 2, DELETE, 223334445L);
+        ftf.test(9, 2, BACKSPACE, 2233344L);
+        ftf.test(3, 4, DELETE, 2244L);
+        ftf.test(0, 4, BACKSPACE, 4L);
+    }
+
+    Date date(DateFormat format, String spec) {
+        try {
+            return format.parse(spec);
+        } catch (ParseException e) {
+            throw new Error("Error in test");
+        }
+    }
+
+    void testDateFormat() {
+        DateFormat format = new SimpleDateFormat("MM/dd/yyyy", Locale.US);
+        TestFormattedTextField ftf = create(format);
+        ftf.setValue(date(format, "12/05/2005"));
+
+        System.err.println("Testing SimpleDateFormat(\"MM/dd/yyyy\", Locale.US)");
+
+        // test inserting individual characters
+        ftf.test(0, 0, "0", date(format, "02/05/2005"));
+        ftf.test(4, 0, "4", date(format, "02/04/2005"));
+        ftf.test(6, 0, "1", date(format, "02/04/1005"));
+        ftf.test(9, 0, "9", date(format, "02/04/1009"));
+
+        // test inserting several characters at once - e.g. from clipboard
+        ftf.test(0, 0, "11", date(format, "11/04/1009"));
+        ftf.test(3, 0, "23", date(format, "11/23/1009"));
+        ftf.test(6, 0, "191", date(format, "11/23/1919"));
+
+        // test delete
+        ftf.test(0, 0, DELETE, date(format, "01/23/1919"));
+        ftf.test(3, 0, DELETE, date(format, "01/03/1919"));
+        ftf.test(10, 0, DELETE, date(format, "01/03/1919"));
+        ftf.test(1, 0, DELETE, date(format, "12/03/1918"));
+        ftf.test(4, 0, DELETE, date(format, "11/30/1918"));
+
+        // test backspace
+        ftf.test(0, 0, BACKSPACE, date(format, "11/30/1918"));
+        ftf.test(1, 0, BACKSPACE, date(format, "01/30/1918"));
+        ftf.test(4, 0, BACKSPACE, date(format, "12/31/1917"));
+        ftf.test(10, 0, BACKSPACE, date(format, "12/31/0191"));
+        ftf.test(3, 0, BACKSPACE, date(format, "01/31/0191"));
+        ftf.test(5, 0, BACKSPACE, date(format, "01/03/0191"));
+
+        // test replacing selection
+        ftf.test(0, 1, "1", date(format, "11/03/0191"));
+        ftf.test(3, 1, "2", date(format, "11/23/0191"));
+        ftf.test(6, 2, "20", date(format, "11/23/2091"));
+
+        // test deleting selection
+        ftf.test(0, 1, BACKSPACE, date(format, "01/23/2091"));
+        ftf.test(3, 1, DELETE, date(format, "01/03/2091"));
+        ftf.test(6, 2, BACKSPACE, date(format, "01/03/0091"));
+        ftf.test(8, 1, DELETE, date(format, "01/03/0001"));
+    }
+}
--- a/jdk/test/sun/net/ftp/FtpGetContent.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/net/ftp/FtpGetContent.java	Fri Aug 20 14:48:10 2010 -0400
@@ -391,6 +391,10 @@
             done = true;
         }
 
+        synchronized boolean done() {
+            return done;
+        }
+
         synchronized public void setPortEnabled(boolean ok) {
             portEnabled = ok;
         }
@@ -431,12 +435,13 @@
         public void run() {
             try {
                 Socket client;
-                while (!done) {
+                while (!done()) {
                     client = server.accept();
                     (new FtpServerHandler(client)).start();
                 }
-                server.close();
             } catch(Exception e) {
+            } finally {
+                try { server.close(); } catch (IOException unused) {}
             }
         }
     }
@@ -463,18 +468,13 @@
                 bytesRead = stream.read(buffer);
             }
             stream.close();
-            server.terminate();
-            server.interrupt();
             if (totalBytes != filesize)
                 throw new RuntimeException("wrong file size!");
         } catch (IOException e) {
-            try {
-                server.terminate();
-                server.interrupt();
-            } catch (Exception e2) {
-            }
             throw new RuntimeException(e.getMessage());
+        } finally {
+            server.terminate();
+            server.server.close();
         }
     }
-
 }
--- a/jdk/test/sun/net/ftp/FtpURL.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/net/ftp/FtpURL.java	Fri Aug 20 14:48:10 2010 -0400
@@ -438,8 +438,9 @@
                     client = server.accept();
                     (new FtpServerHandler(client)).run();
                 }
-                server.close();
             } catch(Exception e) {
+            } finally {
+                try { server.close(); } catch (IOException unused) {}
             }
         }
     }
@@ -448,10 +449,9 @@
     }
 
     public FtpURL() throws Exception {
-        FtpServer server = null;
+        FtpServer server = new FtpServer(0);
         BufferedReader in = null;
         try {
-            server = new FtpServer(0);
             server.start();
             int port = server.getPort();
 
@@ -497,17 +497,14 @@
                 throw new RuntimeException("Incorrect filename received");
             if (! "/usr".equals(server.pwd()))
                 throw new RuntimeException("Incorrect pwd received");
-            in.close();
             // We're done!
 
         } catch (Exception e) {
-            try {
-                in.close();
-                server.terminate();
-                server.interrupt();
-            } catch(Exception ex) {
-            }
             throw new RuntimeException("FTP support error: " + e.getMessage());
+        } finally {
+            try { in.close(); } catch (IOException unused) {}
+            server.terminate();
+            server.server.close();
         }
     }
 }
--- a/jdk/test/sun/net/www/http/ChunkedInputStream/ChunkedEncodingWithProgressMonitorTest.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/net/www/http/ChunkedInputStream/ChunkedEncodingWithProgressMonitorTest.java	Fri Aug 20 14:48:10 2010 -0400
@@ -30,9 +30,7 @@
  * @summary ChunkedEncoding unit test; MeteredStream/ProgressData problem
  */
 
-import java.io.*;
 import java.net.*;
-import java.security.*;
 import java.util.BitSet;
 import sun.net.ProgressMeteringPolicy;
 import sun.net.ProgressMonitor;
@@ -42,8 +40,10 @@
 public class ChunkedEncodingWithProgressMonitorTest {
     public static void main (String[] args) throws Exception {
         ProgressMonitor.setMeteringPolicy(new MyProgressMeteringPolicy());
-        ProgressMonitor.getDefault().addProgressListener(new MyProgressListener());
+        ProgressListener listener = new MyProgressListener();
+        ProgressMonitor.getDefault().addProgressListener(listener);
         ChunkedEncodingTest.test();
+        ProgressMonitor.getDefault().removeProgressListener(listener);
 
         if (flag.cardinality() != 3) {
             throw new RuntimeException("All three methods in ProgressListener"+
--- a/jdk/test/sun/net/www/http/ChunkedOutputStream/Test.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/net/www/http/ChunkedOutputStream/Test.java	Fri Aug 20 14:48:10 2010 -0400
@@ -34,7 +34,7 @@
 
 public class Test implements HttpHandler {
 
-    static int count = 0;
+    static volatile int count = 0;
 
     static final String str1 = "Helloworld1234567890abcdefghijklmnopqrstuvwxyz"+
                                 "1234567890abcdefkjsdlkjflkjsldkfjlsdkjflkj"+
@@ -46,9 +46,9 @@
     public void handle(HttpExchange exchange) {
         String reqbody;
         try {
-            switch (count) {
-            case 0: /* test1 -- keeps conn alive */
-            case 1: /* test2 -- closes conn */
+            switch (exchange.getRequestURI().toString()) {
+            case "/test/test1": /* test1 -- keeps conn alive */
+            case "/test/test2": /* test2 -- closes conn */
                 printRequestURI(exchange);
                 reqbody = read(exchange.getRequestBody());
                 if (!reqbody.equals(str1)) {
@@ -72,7 +72,7 @@
                     resHeaders.set("Connection", "close");
                 }
                 break;
-            case 2: /* test 3 */
+            case "/test/test3": /* test 3 */
                 printRequestURI(exchange);
                 reqbody = read(exchange.getRequestBody());
 
@@ -93,19 +93,19 @@
                 exchange.sendResponseHeaders(200, reqbody.length());
                 write(exchange.getResponseBody(), reqbody);
                 break;
-            case 3: /* test 4 */
-            case 4: /* test 5 */
+            case "/test/test4": /* test 4 */
+            case "/test/test5": /* test 5 */
                 printRequestURI(exchange);
                 break;
-            case 5: /* test 6 */
+            case "/test/test6": /* test 6 */
                 printRequestURI(exchange);
                 resHeaders = exchange.getResponseHeaders() ;
                 resHeaders.set("Location", "http://foo.bar/");
                 resHeaders.set("Connection", "close");
                 exchange.sendResponseHeaders(307, 0);
                 break;
-            case 6: /* test 7 */
-            case 7: /* test 8 */
+            case "/test/test7": /* test 7 */
+            case "/test/test8": /* test 8 */
                 printRequestURI(exchange);
                 reqbody = read(exchange.getRequestBody());
                 if (reqbody != null && !"".equals(reqbody)) {
@@ -116,7 +116,7 @@
                 resHeaders.set("Connection", "close");
                 exchange.sendResponseHeaders(200, 0);
                 break;
-            case 8: /* test 9 */
+            case "/test/test9": /* test 9 */
                 printRequestURI(exchange);
                 reqbody = read(exchange.getRequestBody());
                 if (!reqbody.equals(str1)) {
@@ -134,7 +134,7 @@
                 exchange.sendResponseHeaders(200, reqbody.length());
                 write(exchange.getResponseBody(), reqbody);
                 break;
-            case 9: /* test10 */
+            case "/test/test10": /* test10 */
                 printRequestURI(exchange);
                 InputStream is = exchange.getRequestBody();
                 String s = read (is, str1.length());
@@ -158,7 +158,7 @@
                     exchange.sendResponseHeaders(200, 0);
                 }
                 break;
-            case 10: /* test11 */
+            case "/test/test11": /* test11 */
                 printRequestURI(exchange);
                 is = exchange.getRequestBody();
                 s = read (is, str1.length());
@@ -182,7 +182,7 @@
                     exchange.sendResponseHeaders(200, 0);
                 }
                 break;
-            case 11: /* test12 */
+            case "/test/test12": /* test12 */
                 printRequestURI(exchange);
                 is = exchange.getRequestBody();
 
@@ -203,8 +203,8 @@
                 }
                 break;
             }
+            count ++;
             exchange.close();
-            count ++;
         } catch (IOException e) {
             e.printStackTrace();
         }
--- a/jdk/test/sun/net/www/http/HttpClient/B6726695.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/net/www/http/HttpClient/B6726695.java	Fri Aug 20 14:48:10 2010 -0400
@@ -147,6 +147,8 @@
             serverIgnore(s);
         } catch (IOException e) {
             e.printStackTrace();
+        } finally {
+            try { server.close(); } catch (IOException unused) {}
         }
     }
 
--- a/jdk/test/sun/net/www/http/HttpClient/MultiThreadTest.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/net/www/http/HttpClient/MultiThreadTest.java	Fri Aug 20 14:48:10 2010 -0400
@@ -100,11 +100,12 @@
             }
         } catch (Exception e) {
             throw new RuntimeException (e.getMessage());
-        }
-        synchronized (threadlock) {
-            threadCounter --;
-            if (threadCounter == 0) {
-                threadlock.notifyAll();
+        } finally {
+            synchronized (threadlock) {
+                threadCounter --;
+                if (threadCounter == 0) {
+                    threadlock.notifyAll();
+                }
             }
         }
     }
--- a/jdk/test/sun/net/www/http/HttpClient/ProxyTest.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/net/www/http/HttpClient/ProxyTest.java	Fri Aug 20 14:48:10 2010 -0400
@@ -47,7 +47,7 @@
     private class HttpProxyServer extends Thread {
         private ServerSocket    server;
         private int port;
-        private boolean done = false;
+        private volatile boolean done = false;
         private String askedUrl;
 
         /**
@@ -125,12 +125,8 @@
             }
         }
 
-        public HttpProxyServer(int port) {
-            this.port = port;
-        }
-
-        public HttpProxyServer() {
-            this(0);
+        public HttpProxyServer() throws IOException {
+            server = new ServerSocket(0);
         }
 
         public int getPort() {
@@ -148,51 +144,49 @@
          */
         synchronized public void terminate() {
             done = true;
+            try { server.close(); } catch (IOException unused) {}
         }
 
         public void run() {
             try {
-                server = new ServerSocket(port);
                 Socket client;
                 while (!done) {
                     client = server.accept();
                     (new HttpProxyHandler(client)).start();
                 }
-                server.close();
             } catch (Exception e) {
+            } finally {
+                try { server.close(); } catch (IOException unused) {}
             }
         }
     }
 
-    public static void main(String[] args) {
+    public static void main(String[] args) throws Exception {
         ProxyTest test = new ProxyTest();
     }
 
-    public ProxyTest() {
+    public ProxyTest() throws Exception {
+        BufferedReader in = null;
         String testURL = "ftp://anonymous:password@myhost.mydomain/index.html";
         HttpProxyServer server = new HttpProxyServer();
         try {
-        server.start();
-        int port = 0;
-        while (port == 0) {
-            Thread.sleep(500);
-            port = server.getPort();
-        }
+            server.start();
+            int port = server.getPort();
 
-        System.setProperty("ftp.proxyHost","localhost");
-        System.setProperty("ftp.proxyPort", String.valueOf(port));
-        URL url = new URL(testURL);
-        InputStream ins = url.openStream();
-        BufferedReader in = new BufferedReader(new InputStreamReader(ins));
-        String line;
-        do {
-            line = in.readLine();
-        } while (line != null);
-        in.close();
-        server.terminate();
-        server.interrupt();
+            Proxy ftpProxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("localhost", port));
+            URL url = new URL(testURL);
+            InputStream ins = (url.openConnection(ftpProxy)).getInputStream();
+            in = new BufferedReader(new InputStreamReader(ins));
+            String line;
+            do {
+                line = in.readLine();
+            } while (line != null);
+            in.close();
         } catch (Exception e) {
             e.printStackTrace();
+        } finally {
+            server.terminate();
+            try { in.close(); } catch (IOException unused) {}
         }
         /*
          * If the URLs don't match, we've got a bug!
--- a/jdk/test/sun/net/www/http/KeepAliveCache/KeepAliveTimerThread.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/net/www/http/KeepAliveCache/KeepAliveTimerThread.java	Fri Aug 20 14:48:10 2010 -0400
@@ -91,9 +91,10 @@
                 out.flush();
 
                 s.close();
-                server.close();
             } catch (Exception e) {
                 e.printStackTrace();
+            } finally {
+                try { server.close(); } catch (IOException unused) {}
             }
         }
     }
@@ -118,6 +119,8 @@
         if (grp.activeCount() > 0) {
             throw new RuntimeException("Keep-alive thread started in wrong thread group");
         }
+
+        grp.destroy();
     }
 
 }
--- a/jdk/test/sun/net/www/http/KeepAliveStream/KeepAliveStreamCloseWithWrongContentLength.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/net/www/http/KeepAliveStream/KeepAliveStreamCloseWithWrongContentLength.java	Fri Aug 20 14:48:10 2010 -0400
@@ -43,10 +43,6 @@
             srv = s;
         }
 
-        Socket getSocket () {
-            return (s);
-        }
-
         public void run() {
             try {
                 s = srv.accept ();
@@ -57,7 +53,7 @@
                     is.read();
                 }
                 OutputStreamWriter ow =
-                    new OutputStreamWriter(s.getOutputStream());
+                    new OutputStreamWriter((os = s.getOutputStream()));
                 ow.write("HTTP/1.0 200 OK\n");
 
                 // Note: The client expects 10 bytes.
@@ -71,19 +67,16 @@
                 // Note: The (buggy) server only sends 9 bytes.
                 ow.write("123456789");
                 ow.flush();
-                ow.close();
             } catch (Exception e) {
+            } finally {
+                try {if (os != null) { os.close(); }} catch (IOException e) {}
             }
         }
     }
 
-    /*
-     *
-     */
-
-    public static void main (String[] args) {
+    public static void main (String[] args) throws Exception {
+        ServerSocket serversocket = new ServerSocket (0);
         try {
-            ServerSocket serversocket = new ServerSocket (0);
             int port = serversocket.getLocalPort ();
             XServer server = new XServer (serversocket);
             server.start ();
@@ -100,11 +93,12 @@
                 }
             }
             is.close();
-            server.getSocket().close ();
         } catch (IOException e) {
             return;
         } catch (NullPointerException e) {
             throw new RuntimeException (e);
+        } finally {
+            if (serversocket != null) serversocket.close();
         }
     }
 }
--- a/jdk/test/sun/net/www/httptest/HttpServer.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/net/www/httptest/HttpServer.java	Fri Aug 20 14:48:10 2010 -0400
@@ -188,6 +188,7 @@
                             sock.configureBlocking (false);
                             sock.register (selector, SelectionKey.OP_READ);
                             nconn ++;
+                            System.out.println("SERVER: new connection. chan[" + sock + "]");
                             if (nconn == maxconn) {
                                 /* deregister */
                                 listenerKey.cancel ();
@@ -197,7 +198,9 @@
                             if (key.isReadable()) {
                                 boolean closed;
                                 SocketChannel chan = (SocketChannel) key.channel();
+                                System.out.println("SERVER: connection readable. chan[" + chan + "]");
                                 if (key.attachment() != null) {
+                                    System.out.println("Server: comsume");
                                     closed = consume (chan);
                                 } else {
                                     closed = read (chan, key);
@@ -375,6 +378,7 @@
 
         synchronized void orderlyCloseChannel (SelectionKey key) throws IOException {
             SocketChannel ch = (SocketChannel)key.channel ();
+            System.out.println("SERVER: orderlyCloseChannel chan[" + ch + "]");
             ch.socket().shutdownOutput();
             key.attach (this);
             clist.add (key);
@@ -382,6 +386,8 @@
 
         synchronized void abortiveCloseChannel (SelectionKey key) throws IOException {
             SocketChannel ch = (SocketChannel)key.channel ();
+            System.out.println("SERVER: abortiveCloseChannel chan[" + ch + "]");
+
             Socket s = ch.socket ();
             s.setSoLinger (true, 0);
             ch.close();
--- a/jdk/test/sun/net/www/protocol/http/DigestTest.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/net/www/protocol/http/DigestTest.java	Fri Aug 20 14:48:10 2010 -0400
@@ -95,10 +95,11 @@
                 os.write (reply.getBytes());
                 Thread.sleep (2000);
                 s1.close ();
-        }
-        catch (Exception e) {
+        } catch (Exception e) {
             System.out.println (e);
             e.printStackTrace();
+        } finally {
+            try { s.close(); } catch (IOException unused) {}
         }
     }
 
@@ -204,15 +205,12 @@
 
 
     public static void main(String[] args) throws Exception {
-        int nLoops = 1;
-        int nSize = 10;
-        int port, n =0;
-        byte b[] = new byte[nSize];
+        int port;
         DigestServer server;
         ServerSocket sock;
 
         try {
-            sock = new ServerSocket (5000);
+            sock = new ServerSocket (0);
             port = sock.getLocalPort ();
         }
         catch (Exception e) {
@@ -225,21 +223,18 @@
         boolean passed = false;
 
         try  {
-
             Authenticator.setDefault (new MyAuthenticator ());
             String s = "http://localhost:" + port + DigestServer.uri;
             URL url = new URL(s);
             java.net.URLConnection conURL =  url.openConnection();
 
             InputStream in = conURL.getInputStream();
-            int c;
-            while ((c = in.read ()) != -1) {
-            }
+            while (in.read () != -1) {}
             in.close ();
-        }
-        catch(ProtocolException e) {
+        } catch(ProtocolException e) {
             passed = true;
         }
+
         if (!passed) {
             throw new RuntimeException ("Expected a ProtocolException from wrong password");
         }
--- a/jdk/test/sun/security/krb5/ConfPlusProp.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/security/krb5/ConfPlusProp.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,6 +24,7 @@
  * @test
  * @bug 6857795
  * @bug 6858589
+ * @bug 6972005
  * @summary krb5.conf ignored if system properties on realm and kdc are provided
  */
 
@@ -96,7 +97,8 @@
             System.setProperty("java.security.krb5.conf", "i-am-not-a file");
             refresh();
 
-            checkDefaultRealm(null);
+            // Default realm might come from DNS
+            //checkDefaultRealm(null);
             check("R1", null);
             check("R2", null);
             check("R3", null);
--- a/jdk/test/sun/security/krb5/confplusprop.conf	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/security/krb5/confplusprop.conf	Fri Aug 20 14:48:10 2010 -0400
@@ -1,6 +1,7 @@
 [libdefaults]
 default_realm = R1
 forwardable = well
+dns_lookup_realm = false
 
 [realms]
 R1 = {
--- a/jdk/test/sun/security/krb5/confplusprop2.conf	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/security/krb5/confplusprop2.conf	Fri Aug 20 14:48:10 2010 -0400
@@ -1,3 +1,6 @@
+[libdefaults]
+dns_lookup_realm = false
+
 [realms]
 R1 = {
    kdc = k12
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/util/DerOutputStream/LocaleInTime.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6670889
+ * @summary Keystore created under Hindi Locale causing ArrayIndexOutOfBoundsException
+ * @run main/othervm -Duser.language=hi -Duser.region=IN LocaleInTime
+ */
+
+import java.util.Date;
+import sun.security.util.DerOutputStream;
+import sun.security.util.DerValue;
+
+public class LocaleInTime {
+    public static void main(String args[]) throws Exception {
+        DerOutputStream out = new DerOutputStream();
+        out.putUTCTime(new Date());
+        DerValue val = new DerValue(out.toByteArray());
+        System.out.println(val.getUTCTime());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/x509/AlgorithmId/TurkishRegion.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6867345
+ * @summary Turkish regional options cause NPE in
+ *     sun.security.x509.AlgorithmId.algOID
+ * @run main/othervm -Duser.language=tr -Duser.region=TR TurkishRegion
+ * @author Xuelei Fan
+ */
+
+import sun.security.x509.*;
+
+public class TurkishRegion {
+
+    public static void main(String[] args) throws Exception {
+        AlgorithmId algId = AlgorithmId.get("PBEWITHMD5ANDDES");
+    }
+}
--- a/jdk/test/sun/tools/common/ApplicationSetup.sh	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/tools/common/ApplicationSetup.sh	Fri Aug 20 14:48:10 2010 -0400
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -24,54 +24,187 @@
 #
 
 
-# Support function to start and stop a given application
+# Support functions to start, stop, wait for or kill a given SimpleApplication
 
-# Starts a given application as background process, usage:
-#   startApplication <class> [args...]
+# Starts a given app as background process, usage:
+#   startApplication <class> port-file [args...]
+#
+# The following variables are set:
 #
-# Waits for application to print something to indicate it is running
-# (and initialized). Output is directed to ${TESTCLASSES}/Application.out.
-# Sets $pid to be the process-id of the application.
-
+# appJavaPid  - application's Java pid
+# appOtherPid - pid associated with the app other than appJavaPid
+# appPidList  - all pids associated with the app
+# appOutput   - file containing stdout and stderr from the app
+#
+# Waits for at least one line of output from the app to indicate
+# that it is up and running.
+#
 startApplication()
 {
-  OUTPUTFILE=${TESTCLASSES}/Application.out
-  ${JAVA} $1 $2 $3 $4 $5 $6 > ${OUTPUTFILE} &
-  pid="$!"
-                                                                                                     
-  # MKS creates an intermediate shell to launch ${JAVA} so
-  # ${pid} is not the actual pid. We have put in a small sleep
-  # to give the intermediate shell process time to launch the
-  # "java" process.
-  if [ "$OS" = "Windows" ]; then
-    sleep 2
-    if [ "${isCygwin}" = "true" ] ; then
-      realpid=`ps -p ${pid} | tail -1 | awk '{print $4;}'`
-    else
-      realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6`
-    fi
-    pid=${realpid}
-  fi
-                                                                                                     
-  echo "Waiting for Application to initialize..."
-  attempts=0
+  appOutput="${TESTCLASSES}/Application.out"
+
+  ${JAVA} -classpath "${TESTCLASSES}" "$@" > "$appOutput" 2>&1 &
+  appJavaPid="$!"
+  appOtherPid=
+  appPidList="$appJavaPid"
+
+  echo "INFO: waiting for $1 to initialize..."
+  _cnt=0
   while true; do
+    # if the app doesn't start then the JavaTest/JTREG timeout will
+    # kick in so this isn't really a endless loop
     sleep 1
-    out=`tail -1 ${OUTPUTFILE}`
-    if [ ! -z "$out" ]; then
+    out=`tail -1 "$appOutput"`
+    if [ -n "$out" ]; then
+      # we got some output from the app so it's running
       break
     fi
-    attempts=`expr $attempts + 1`
-    echo "Waiting $attempts second(s) ..."
+    _cnt=`expr $_cnt + 1`
+    echo "INFO: waited $_cnt second(s) ..."
   done
+  unset _cnt
 
-  echo "Application is process $pid"
+  if $isWindows; then
+    # Windows requires special handling
+    appOtherPid="$appJavaPid"
+
+    if $isCygwin; then
+      appJavaPid=`ps -p "$appOtherPid" \
+        | sed -n '
+          # See if $appOtherPid is in PID column; there are sometimes
+          # non-blanks in column 1 (I and S observed so far)
+          /^.'"${PATTERN_WS}${PATTERN_WS}*${appOtherPid}${PATTERN_WS}"'/{
+            # strip PID column
+            s/^.'"${PATTERN_WS}${PATTERN_WS}*${appOtherPid}${PATTERN_WS}${PATTERN_WS}"'*//
+            # strip PPID column
+            s/^[1-9][0-9]*'"${PATTERN_WS}${PATTERN_WS}"'*//
+            # strip PGID column
+            s/^[1-9][0-9]*'"${PATTERN_WS}${PATTERN_WS}"'*//
+            # strip everything after WINPID column
+            s/'"${PATTERN_WS}"'.*//
+            p
+            q
+          }
+        '`
+      echo "INFO: Cygwin pid=$appOtherPid maps to Windows pid=$appJavaPid"
+    else
+      # show PID, PPID and COMM columns only
+      appJavaPid=`ps -o pid,ppid,comm \
+        | sed -n '
+          # see if appOtherPid is in either PID or PPID columns
+          /'"${PATTERN_WS}${appOtherPid}${PATTERN_WS}"'/{
+            # see if this is a java command
+            /java'"${PATTERN_EOL}"'/{
+              # strip leading white space
+              s/^'"${PATTERN_WS}${PATTERN_WS}"'*//
+              # strip everything after the first word
+              s/'"${PATTERN_WS}"'.*//
+              # print the pid and we are done
+              p
+              q
+            }
+          }
+        '`
+      echo "INFO: MKS shell pid=$appOtherPid; Java pid=$appJavaPid"
+    fi
+
+    if [ -z "$appJavaPid" ]; then
+      echo "ERROR: could not find app's Java pid." >&2
+      killApplication
+      exit 2
+    fi
+    appPidList="$appOtherPid $appJavaPid"
+  fi
+
+  echo "INFO: $1 is process $appJavaPid"
+  echo "INFO: $1 output is in $appOutput"
+}
+
+
+# Stops a simple application by invoking ShutdownSimpleApplication
+# class with a specific port-file, usage:
+#   stopApplication port-file
+#
+# Note: When this function returns, the SimpleApplication (or a subclass)
+# may still be running because the application has not yet reached the
+# shutdown check.
+#
+stopApplication()
+{
+  $JAVA -classpath "${TESTCLASSES}" ShutdownSimpleApplication $1
 }
 
-# Stops an application by invoking the given class and argument, usage:
-#   stopApplication <class> <argument>
-stopApplication()
-{
-  $JAVA -classpath "${TESTCLASSES}" $1 $2
+
+# Wait for a simple application to stop running.
+#
+waitForApplication() {
+  if [ $isWindows = false ]; then
+    # non-Windows is easy; just one process
+    echo "INFO: waiting for $appJavaPid"
+    set +e
+    wait "$appJavaPid"
+    set -e
+
+  elif $isCygwin; then
+    # Cygwin pid and not the Windows pid
+    echo "INFO: waiting for $appOtherPid"
+    set +e
+    wait "$appOtherPid"
+    set -e
+
+  else # implied isMKS
+    # MKS has intermediate shell and Java process
+    echo "INFO: waiting for $appJavaPid"
+
+    # appJavaPid can be empty if pid search in startApplication() failed
+    if [ -n "$appJavaPid" ]; then
+      # only need to wait for the Java process
+      set +e
+      wait "$appJavaPid"
+      set -e
+    fi
+  fi
 }
 
+
+# Kills a simple application by sending a SIGTERM to the appropriate
+# process(es); on Windows SIGQUIT (-9) is used.
+#
+killApplication()
+{
+  if [ $isWindows = false ]; then
+    # non-Windows is easy; just one process
+    echo "INFO: killing $appJavaPid"
+    set +e
+    kill -TERM "$appJavaPid"  # try a polite SIGTERM first
+    sleep 2
+    # send SIGQUIT (-9) just in case SIGTERM didn't do it
+    # but don't show any complaints
+    kill -QUIT "$appJavaPid" > /dev/null 2>&1
+    wait "$appJavaPid"
+    set -e
+
+  elif $isCygwin; then
+    # Cygwin pid and not the Windows pid
+    echo "INFO: killing $appOtherPid"
+    set +e
+    kill -9 "$appOtherPid"
+    wait "$appOtherPid"
+    set -e
+
+  else # implied isMKS
+    # MKS has intermediate shell and Java process
+    echo "INFO: killing $appPidList"
+    set +e
+    kill -9 $appPidList
+    set -e
+
+    # appJavaPid can be empty if pid search in startApplication() failed
+    if [ -n "$appJavaPid" ]; then
+      # only need to wait for the Java process
+      set +e
+      wait "$appJavaPid"
+      set -e
+    fi
+  fi
+}
--- a/jdk/test/sun/tools/common/CommonSetup.sh	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/tools/common/CommonSetup.sh	Fri Aug 20 14:48:10 2010 -0400
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -24,56 +24,94 @@
 #
 
 
-# Common setup for tool tests. 
+# Common setup for tool tests and other tests that use jtools.
 # Checks that TESTJAVA, TESTSRC, and TESTCLASSES environment variables are set.
-# Creates the following for use by the tool tests
-#   JAVA     java launcher
-#   JSTACK   jstack utility
-#   JMAP     jmap utility
-#   JINFO    jinfo utility
-#   JHAT     jhat utility
-#   PS       path separator (";" or ":")
-#   OS       operating system 
+#
+# Creates the following constants for use by the caller:
+#   JAVA        - java launcher
+#   JHAT        - jhat utility
+#   JINFO       - jinfo utility
+#   JMAP        - jmap utility
+#   JPS         - jps utility
+#   JSTACK      - jstack utility
+#   OS          - operating system name
+#   PATTERN_EOL - grep or sed end-of-line pattern
+#   PATTERN_WS  - grep or sed whitespace pattern
+#   PS          - path separator (";" or ":")
+#
+# Sets the following variables:
+#
+#   isCygwin  - true if environment is Cygwin
+#   isMKS     - true if environment is MKS
+#   isLinux   - true if OS is Linux
+#   isSolaris - true if OS is Solaris
+#   isWindows - true if OS is Windows
 
 
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
+if [ -z "${TESTJAVA}" ]; then
+  echo "ERROR: TESTJAVA not set.  Test cannot execute.  Failed."
   exit 1
 fi
-                                                                                                     
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
+
+if [ -z "${TESTSRC}" ]; then
+  echo "ERROR: TESTSRC not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+
+if [ -z "${TESTCLASSES}" ]; then
+  echo "ERROR: TESTCLASSES not set.  Test cannot execute.  Failed."
   exit 1
 fi
-                                                                                                     
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-                                                                                                     
+
+# only enable these after checking the expected incoming env variables
+set -eu
+
 JAVA="${TESTJAVA}/bin/java"
-JSTACK="${TESTJAVA}/bin/jstack"
+JHAT="${TESTJAVA}/bin/jhat"
+JINFO="${TESTJAVA}/bin/jinfo"
 JMAP="${TESTJAVA}/bin/jmap"
-JINFO="${TESTJAVA}/bin/jinfo"
-JHAT="${TESTJAVA}/bin/jhat"
+JPS="${TESTJAVA}/bin/jps"
+JSTACK="${TESTJAVA}/bin/jstack"
+
+isCygwin=false
+isMKS=false
+isLinux=false
+isSolaris=false
+isUnknownOS=false
+isWindows=false
 
 OS=`uname -s`
 
+# start with some UNIX like defaults
+PATTERN_EOL='$'
+# blank and tab
+PATTERN_WS='[ 	]'
+PS=":"
+
 case "$OS" in
-  Windows* )
-    PS=";"
+  CYGWIN* )
     OS="Windows"
+    PATTERN_EOL='[
]*$'
+    # blank and tab
+    PATTERN_WS='[ \t]'
+    isCygwin=true
+    isWindows=true
     ;;
-  CYGWIN* )
+  Linux )
+    OS="Linux"
+    isLinux=true
+    ;;
+  SunOS )
+    OS="Solaris"
+    isSolaris=true
+    ;;
+  Windows* )
+    OS="Windows"
+    PATTERN_EOL='[
]*$'
     PS=";"
-    OS="Windows"
-    isCygwin=true
+    isWindows=true
     ;;
   * )
-    PS=":"
+    isUnknownOS=true
     ;;
 esac
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/common/CommonTests.sh	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,314 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+
+# @test
+# @bug 6964018
+# @summary Unit test for common tools infrastructure.
+#
+# @build SimpleApplication SleeperApplication ShutdownSimpleApplication
+# @run shell CommonTests.sh
+
+. ${TESTSRC}/CommonSetup.sh
+. ${TESTSRC}/ApplicationSetup.sh
+
+# hope for the best:
+status=0
+
+
+# Test program path constants from CommonSetup.sh:
+#
+for name in JAVA JHAT JINFO JMAP JPS JSTACK; do
+    eval value=$`echo $name`
+
+    echo "INFO: $name=$value"
+    if [ -x "$value" ]; then
+        echo "INFO: '$value' is executable."
+    else
+        echo "ERROR: '$value' is not executable." >&2
+        status=1
+    fi
+done
+
+
+# Display flag values from CommonSetup.sh:
+#
+for name in isCygwin isMKS isLinux isSolaris isUnknownOS isWindows; do
+    eval value=$`echo $name`
+    echo "INFO: flag $name=$value"
+done
+
+
+# Test OS constant from CommonSetup.sh:
+#
+if [ -z "$OS" ]; then
+    echo "ERROR: OS constant cannot be empty." >&2
+    status=1
+fi
+
+
+# Display the PATTERN_EOL value:
+#
+echo "INFO: PATTERN_EOL="`echo "$PATTERN_EOL" | od -c`
+
+
+# Test PATTERN_EOL with 'grep' for a regular line.
+#
+TESTOUT="${TESTCLASSES}/testout.grep_reg_line_eol"
+set +e
+echo 'regular line' | grep "line${PATTERN_EOL}" > "$TESTOUT"
+set -e
+if [ -s "$TESTOUT" ]; then
+    echo "INFO: PATTERN_EOL works for regular line with grep."
+else
+    echo "ERROR: PATTERN_EOL does not work for regular line with grep." >&2
+    status=1
+fi
+
+
+if $isWindows; then
+    # Test PATTERN_EOL with 'grep' for a CR line.
+    #
+    TESTOUT="${TESTCLASSES}/testout.grep_cr_line_eol"
+    set +e
+    echo 'CR line
' | grep "line${PATTERN_EOL}" > "$TESTOUT"
+    set -e
+    if [ -s "$TESTOUT" ]; then
+        echo "INFO: PATTERN_EOL works for CR line with grep."
+    else
+        echo "ERROR: PATTERN_EOL does not work for CR line with grep." >&2
+        status=1
+    fi
+fi
+
+
+# Test PATTERN_EOL with 'sed' for a regular line.
+#
+TESTOUT="${TESTCLASSES}/testout.sed_reg_line_eol"
+echo 'regular line' | sed -n "/line${PATTERN_EOL}/p" > "$TESTOUT"
+if [ -s "$TESTOUT" ]; then
+    echo "INFO: PATTERN_EOL works for regular line with sed."
+else
+    echo "ERROR: PATTERN_EOL does not work for regular line with sed." >&2
+    status=1
+fi
+
+
+if $isWindows; then
+    # Test PATTERN_EOL with 'sed' for a CR line.
+    #
+    TESTOUT="${TESTCLASSES}/testout.sed_cr_line_eol"
+    echo 'CR line
' | sed -n "/line${PATTERN_EOL}/p" > "$TESTOUT"
+    if [ -s "$TESTOUT" ]; then
+        echo "INFO: PATTERN_EOL works for CR line with sed."
+    else
+        echo "ERROR: PATTERN_EOL does not work for CR line with sed." >&2
+        status=1
+    fi
+fi
+
+
+# Display the PATTERN_WS value:
+#
+echo "INFO: PATTERN_WS="`echo "$PATTERN_WS" | od -c`
+
+
+# Test PATTERN_WS with 'grep' for a blank.
+#
+TESTOUT="${TESTCLASSES}/testout.grep_blank"
+set +e
+echo 'blank: ' | grep "$PATTERN_WS" > "$TESTOUT"
+set -e
+if [ -s "$TESTOUT" ]; then
+    echo "INFO: PATTERN_WS works for blanks with grep."
+else
+    echo "ERROR: PATTERN_WS does not work for blanks with grep." >&2
+    status=1
+fi
+
+
+# Test PATTERN_WS with 'grep' for a tab.
+#
+TESTOUT="${TESTCLASSES}/testout.grep_tab"
+set +e
+echo 'tab:	' | grep "$PATTERN_WS" > "$TESTOUT"
+set -e
+if [ -s "$TESTOUT" ]; then
+    echo "INFO: PATTERN_WS works for tabs with grep."
+else
+    echo "ERROR: PATTERN_WS does not work for tabs with grep." >&2
+    status=1
+fi
+
+
+# Test PATTERN_WS with 'sed' for a blank.
+#
+TESTOUT="${TESTCLASSES}/testout.sed_blank"
+echo 'blank: ' | sed -n "/$PATTERN_WS/p" > "$TESTOUT"
+if [ -s "$TESTOUT" ]; then
+    echo "INFO: PATTERN_WS works for blanks with sed."
+else
+    echo "ERROR: PATTERN_WS does not work for blanks with sed." >&2
+    status=1
+fi
+
+
+# Test PATTERN_WS with 'sed' for a tab.
+#
+TESTOUT="${TESTCLASSES}/testout.sed_tab"
+echo 'tab:	' | sed -n "/$PATTERN_WS/p" > "$TESTOUT"
+if [ -s "$TESTOUT" ]; then
+    echo "INFO: PATTERN_WS works for tabs with sed."
+else
+    echo "ERROR: PATTERN_WS does not work for tabs with sed." >&2
+    status=1
+fi
+
+
+# Test startApplication and use PORTFILE for coordination
+# The app sleeps for 30 seconds.
+#
+PORTFILE="${TESTCLASSES}"/shutdown.port
+startApplication SleeperApplication "${PORTFILE}" 30
+
+
+# Test appJavaPid in "ps" cmd output.
+#
+TESTOUT="${TESTCLASSES}/testout.ps_app"
+set +e
+if $isCygwin; then
+    # On Cygwin, appJavaPid is the Windows pid for the Java process
+    # and appOtherPid is the Cygwin pid for the Java process.
+    ps -p "$appOtherPid" \
+        | grep "${PATTERN_WS}${appJavaPid}${PATTERN_WS}" > "$TESTOUT"
+else
+    # output only pid and comm columns to avoid mismatches
+    ps -eo pid,comm \
+        | grep "^${PATTERN_WS}*${appJavaPid}${PATTERN_WS}" > "$TESTOUT"
+fi
+set -e
+if [ -s "$TESTOUT" ]; then
+    echo "INFO: begin appJavaPid=$appJavaPid in 'ps' cmd output:"
+    cat "$TESTOUT"
+    echo "INFO: end appJavaPid=$appJavaPid in 'ps' cmd output."
+else
+    echo "ERROR: 'ps' cmd should show appJavaPid=$appJavaPid." >&2
+    status=1
+fi
+
+if [ -n "$appOtherPid" ]; then
+    # Test appOtherPid in "ps" cmd output, if we have one.
+    #
+    TESTOUT="${TESTCLASSES}/testout.ps_other"
+    set +e
+    if $isCygwin; then
+        ps -p "$appOtherPid" \
+            | grep "${PATTERN_WS}${appOtherPid}${PATTERN_WS}" > "$TESTOUT"
+    else
+        # output only pid and comm columns to avoid mismatches
+        ps -eo pid,comm \
+            | grep "^${PATTERN_WS}*${appOtherPid}${PATTERN_WS}" > "$TESTOUT"
+    fi
+    set -e
+    if [ -s "$TESTOUT" ]; then
+        echo "INFO: begin appOtherPid=$appOtherPid in 'ps' cmd output:"
+        cat "$TESTOUT"
+        echo "INFO: end appOtherPid=$appOtherPid in 'ps' cmd output."
+    else
+        echo "ERROR: 'ps' cmd should show appOtherPid=$appOtherPid." >&2
+        status=1
+    fi
+fi
+
+
+# Test stopApplication and PORTFILE for coordination
+#
+stopApplication "${PORTFILE}"
+
+
+# Test application still running after stopApplication.
+#
+# stopApplication just lets the app know that it can stop, but the
+# app might still be doing work. This test just demonstrates that
+# fact and doesn't fail if the app is already done.
+#
+TESTOUT="${TESTCLASSES}/testout.after_stop"
+set +e
+if $isCygwin; then
+    # On Cygwin, appJavaPid is the Windows pid for the Java process
+    # and appOtherPid is the Cygwin pid for the Java process.
+    ps -p "$appOtherPid" \
+        | grep "${PATTERN_WS}${appJavaPid}${PATTERN_WS}" > "$TESTOUT"
+else
+    # output only pid and comm columns to avoid mismatches
+    ps -eo pid,comm \
+        | grep "^${PATTERN_WS}*${appJavaPid}${PATTERN_WS}" > "$TESTOUT"
+fi
+set -e
+if [ -s "$TESTOUT" ]; then
+    echo "INFO: it is okay for appJavaPid=$appJavaPid to still be running" \
+        "after stopApplication() is called."
+    echo "INFO: begin 'after_stop' output:"
+    cat "$TESTOUT"
+    echo "INFO: end 'after_stop' output."
+fi
+
+
+# Test waitForApplication
+#
+# The app might already be gone so this function shouldn't generate
+# a fatal error in either call.
+#
+waitForApplication
+
+if [ $isWindows = false ]; then
+    # Windows can recycle pids quickly so we can't use this test there
+    TESTOUT="${TESTCLASSES}/testout.after_kill"
+    set +e
+    # output only pid and comm columns to avoid mismatches
+    ps -eo pid,comm \
+        | grep "^${PATTERN_WS}*${appJavaPid}${PATTERN_WS}" > "$TESTOUT"
+    set -e
+    if [ -s "$TESTOUT" ]; then
+        echo "ERROR: 'ps' cmd should not show appJavaPid." >&2
+        echo "ERROR: begin 'after_kill' output:" >&2
+        cat "$TESTOUT" >&2
+        echo "ERROR: end 'after_kill' output." >&2
+        status=1
+    else
+        echo "INFO: 'ps' cmd does not show appJavaPid after" \
+            "waitForApplication() is called."
+    fi
+fi
+
+
+# Test killApplication
+#
+# The app is already be gone so this function shouldn't generate
+# a fatal error.
+#
+killApplication
+
+exit $status
--- a/jdk/test/sun/tools/common/ShutdownSimpleApplication.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/tools/common/ShutdownSimpleApplication.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -22,10 +22,13 @@
  */
 
 /*
- *
+ * Used to shutdown SimpleApplication (or a subclass). The argument to
+ * this class is the name of a file that contains the TCP port number
+ * on which SimpleApplication (or a subclass) is listening.
  *
- * Used to shutdown SimpleApplication. The argument to this class is
- * the TCP port number where SimpleApplication is listening.
+ * Note: When this program returns, the SimpleApplication (or a subclass)
+ * may still be running because the application has not yet reached the
+ * shutdown check.
  */
 import java.net.Socket;
 import java.net.InetSocketAddress;
@@ -35,6 +38,11 @@
 public class ShutdownSimpleApplication {
     public static void main(String args[]) throws Exception {
 
+        if (args.length != 1) {
+            throw new RuntimeException("Usage: ShutdownSimpleApplication" +
+                " port-file");
+        }
+
         // read the (TCP) port number from the given file
 
         File f = new File(args[0]);
@@ -42,21 +50,27 @@
         byte b[] = new byte[8];
         int n = fis.read(b);
         if (n < 1) {
-            throw new RuntimeException("Empty file");
+            throw new RuntimeException("Empty port-file");
         }
         fis.close();
 
         String str = new String(b, 0, n, "UTF-8");
-        System.out.println("Port number of application is: " + str);
+        System.out.println("INFO: Port number of SimpleApplication: " + str);
         int port = Integer.parseInt(str);
 
         // Now connect to the port (which will shutdown application)
 
-        System.out.println("Connecting to port " + port +
-            " to shutdown Application ...");
+        System.out.println("INFO: Connecting to port " + port +
+            " to shutdown SimpleApplication ...");
+        System.out.flush();
 
         Socket s = new Socket();
         s.connect( new InetSocketAddress(port) );
         s.close();
+
+        System.out.println("INFO: done connecting to SimpleApplication.");
+        System.out.flush();
+
+        System.exit(0);
     }
 }
--- a/jdk/test/sun/tools/common/SimpleApplication.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/tools/common/SimpleApplication.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -22,10 +22,12 @@
  */
 
 /*
- *
+ * A simple application used by unit tests. The first argument to this
+ * class is the name of a file to which a TCP port number can be written.
  *
- * A simple application used for tool unit tests. It does nothing else
- * bind to a TCP port and wait for a shutdown message.
+ * By default, this class does nothing other than bind to a TCP port,
+ * write the TCP port number to a file, and wait for an incoming connection
+ * in order to complete the application shutdown protocol.
  */
 import java.net.Socket;
 import java.net.ServerSocket;
@@ -33,25 +35,86 @@
 import java.io.FileOutputStream;
 
 public class SimpleApplication {
-    public static void main(String args[]) throws Exception {
+    private static SimpleApplication myApp;      // simple app or a subclass
+    private static String            myAppName;  // simple app name
+    private static int               myPort;     // coordination port #
+    private static ServerSocket      mySS;       // coordination socket
+
+    // protected so a subclass can extend it; not public so creation is
+    // limited.
+    protected SimpleApplication() {
+        // save simple app (or subclass) name for messages
+        myAppName = getClass().getName();
+    }
+
+    // return the simple application (or a subclass)
+    final public static SimpleApplication getMyApp() {
+        return myApp;
+    }
+
+    // set the simple application (for use by a subclass)
+    final public static void setMyApp(SimpleApplication _myApp) {
+        myApp = _myApp;
+    }
+
+    // execute the application finish protocol
+    final public void doMyAppFinish(String[] args) throws Exception {
+        System.out.println("INFO: " + myAppName + " is waiting on port: " +
+            myPort);
+        System.out.flush();
+
+        // wait for test harness to connect
+        Socket s = mySS.accept();
+        s.close();
+        mySS.close();
+
+        System.out.println("INFO: " + myAppName + " is shutting down.");
+        System.out.flush();
+    }
+
+    // execute the application start protocol
+    final public void doMyAppStart(String[] args) throws Exception {
+        if (args.length < 1) {
+            throw new RuntimeException("Usage: " + myAppName +
+                " port-file [arg(s)]");
+        }
+
         // bind to a random port
-        ServerSocket ss = new ServerSocket(0);
-        int port = ss.getLocalPort();
+        mySS = new ServerSocket(0);
+        myPort = mySS.getLocalPort();
 
         // Write the port number to the given file
         File f = new File(args[0]);
         FileOutputStream fos = new FileOutputStream(f);
-        fos.write( Integer.toString(port).getBytes("UTF-8") );
+        fos.write( Integer.toString(myPort).getBytes("UTF-8") );
         fos.close();
 
-        System.out.println("Application waiting on port: " + port);
+        System.out.println("INFO: " + myAppName + " created socket on port: " +
+            myPort);
+        System.out.flush();
+    }
+
+    // execute the app work (subclass can override this)
+    public void doMyAppWork(String[] args) throws Exception {
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (myApp == null) {
+            // create myApp since a subclass hasn't done so
+            myApp = new SimpleApplication();
+        }
+
+        myApp.doMyAppStart(args);   // do the app start protocol
+
+        System.out.println("INFO: " + myAppName + " is calling doMyAppWork()");
+        System.out.flush();
+        myApp.doMyAppWork(args);    // do the app work
+        System.out.println("INFO: " + myAppName + " returned from" +
+            " doMyAppWork()");
         System.out.flush();
 
-        // wait for test harness to connect
-        Socket s = ss.accept();
-        s.close();
-        ss.close();
+        myApp.doMyAppFinish(args);  // do the app finish protocol
 
-        System.out.println("Application shutdown.");
+        System.exit(0);
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/common/SleeperApplication.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+/*
+ * An example subclass of SimpleApplication that illustrates how to
+ * override the doMyAppWork() method.
+ */
+
+public class SleeperApplication extends SimpleApplication {
+    public static int DEFAULT_SLEEP_TIME = 60;  // time is in seconds
+
+    // execute the sleeper app work
+    public void doMyAppWork(String[] args) throws Exception {
+        int sleep_time = DEFAULT_SLEEP_TIME;
+
+        // args[0] is the port-file
+        if (args.length < 2) {
+            System.out.println("INFO: using default sleep time of "
+                + sleep_time + " seconds.");
+        } else {
+            try {
+                sleep_time = Integer.parseInt(args[1]);
+            } catch (NumberFormatException nfe) {
+                throw new RuntimeException("Error: '" + args[1] +
+                    "': is not a valid seconds value.");
+            }
+        }
+
+        Thread.sleep(sleep_time * 1000);  // our "work" is to sleep
+    }
+
+    public static void main(String[] args) throws Exception {
+        SleeperApplication myApp = new SleeperApplication();
+
+        SimpleApplication.setMyApp(myApp);
+
+        SimpleApplication.main(args);
+    }
+}
--- a/jdk/test/sun/tools/jhat/ParseTest.sh	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/tools/jhat/ParseTest.sh	Fri Aug 20 14:48:10 2010 -0400
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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
@@ -32,7 +32,11 @@
 # @run shell ParseTest.sh
 
 . ${TESTSRC}/../common/CommonSetup.sh
-. ${TESTSRC}/../common/ApplicationSetup.sh
+
+# all return statuses are checked in this test
+set +e
+
+failed=0
 
 DUMPFILE="minimal.bin"
 
--- a/jdk/test/sun/tools/jinfo/Basic.sh	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/tools/jinfo/Basic.sh	Fri Aug 20 14:48:10 2010 -0400
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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
@@ -35,53 +35,57 @@
 . ${TESTSRC}/../common/CommonSetup.sh
 . ${TESTSRC}/../common/ApplicationSetup.sh
 
-# Start application (send output to shutdown.port)
+# Start application and use PORTFILE for coordination
 PORTFILE="${TESTCLASSES}"/shutdown.port
-startApplication \
-    -classpath "${TESTCLASSES}" SimpleApplication "${PORTFILE}"
+startApplication SimpleApplication "${PORTFILE}"
+
+# all return statuses are checked in this test
+set +e
 
 failed=0
 
-if [ "$OS" != "Windows" ]; then
+if [ $isWindows = false ]; then
     # -sysprops option
-    ${JINFO} -sysprops $pid
+    ${JINFO} -sysprops $appJavaPid
     if [ $? != 0 ]; then failed=1; fi
 
     # -flags option
-    ${JINFO} -flags $pid
+    ${JINFO} -flags $appJavaPid
     if [ $? != 0 ]; then failed=1; fi
 
     # no option
-    ${JINFO} $pid
+    ${JINFO} $appJavaPid
     if [ $? != 0 ]; then failed=1; fi
 
 fi
 
 
 # -flag option
-${JINFO} -flag +PrintGC $pid
+${JINFO} -flag +PrintGC $appJavaPid
 if [ $? != 0 ]; then failed=1; fi 
 
-${JINFO} -flag -PrintGC $pid
+${JINFO} -flag -PrintGC $appJavaPid
 if [ $? != 0 ]; then failed=1; fi
 
-${JINFO} -flag PrintGC $pid
+${JINFO} -flag PrintGC $appJavaPid
 if [ $? != 0 ]; then failed=1; fi
 
-if [ "$OS" = "SunOS" ]; then
+if $isSolaris; then
 
-    ${JINFO} -flag +ExtendedDTraceProbes $pid
+    ${JINFO} -flag +ExtendedDTraceProbes $appJavaPid
     if [ $? != 0 ]; then failed=1; fi
 
-    ${JINFO} -flag -ExtendedDTraceProbes $pid
+    ${JINFO} -flag -ExtendedDTraceProbes $appJavaPid
     if [ $? != 0 ]; then failed=1; fi
 
-    ${JINFO} -flag ExtendedDTraceProbes $pid
+    ${JINFO} -flag ExtendedDTraceProbes $appJavaPid
     if [ $? != 0 ]; then failed=1; fi
 
 fi
 
-stopApplication ShutdownSimpleApplication "${PORTFILE}"
+set -e
+
+stopApplication "${PORTFILE}"
+waitForApplication
 
 exit $failed
-
--- a/jdk/test/sun/tools/jmap/Basic.sh	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/tools/jmap/Basic.sh	Fri Aug 20 14:48:10 2010 -0400
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -35,24 +35,25 @@
 . ${TESTSRC}/../common/CommonSetup.sh
 . ${TESTSRC}/../common/ApplicationSetup.sh
 
-# Start application (send output to shutdown.port)
+# Start application and use PORTFILE for coordination
 PORTFILE="${TESTCLASSES}"/shutdown.port
-startApplication \
-    -classpath "${TESTCLASSES}" SimpleApplication "${PORTFILE}"
+startApplication SimpleApplication "${PORTFILE}"
+
+# all return statuses are checked in this test
+set +e
 
 failed=0
 
 # -histo[:live] option
-${JMAP} -histo $pid
+${JMAP} -histo $appJavaPid
 if [ $? != 0 ]; then failed=1; fi
 
-${JMAP} -histo:live $pid
+${JMAP} -histo:live $appJavaPid
 if [ $? != 0 ]; then failed=1; fi
 
 # -dump option
-p=`expr $pid`
-DUMPFILE="java_pid${p}.hprof"
-${JMAP} -dump:format=b,file=${DUMPFILE} $pid
+DUMPFILE="java_pid${appJavaPid}.hprof"
+${JMAP} -dump:format=b,file=${DUMPFILE} $appJavaPid
 if [ $? != 0 ]; then failed=1; fi
 
 # check that heap dump is parsable
@@ -63,7 +64,7 @@
 rm ${DUMPFILE}
 
 # -dump:live option
-${JMAP} -dump:live,format=b,file=${DUMPFILE} $pid
+${JMAP} -dump:live,format=b,file=${DUMPFILE} $appJavaPid
 if [ $? != 0 ]; then failed=1; fi
 
 # check that heap dump is parsable
@@ -71,9 +72,11 @@
 if [ $? != 0 ]; then failed=1; fi
 
 # dump file is large so remove it
-rm ${DUMPFILE}
+rm -f ${DUMPFILE}
 
-stopApplication ShutdownSimpleApplication "${PORTFILE}"
+set -e
+
+stopApplication "${PORTFILE}"
+waitForApplication
 
 exit $failed
-
--- a/jdk/test/sun/tools/jrunscript/common.sh	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/tools/jrunscript/common.sh	Fri Aug 20 14:48:10 2010 -0400
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -43,10 +43,20 @@
     Windows_*)
         PS=";"
         FS="\\"
+        # MKS diff deals with trailing CRs automatically
+        golden_diff="diff"
+        ;;
+    CYGWIN*)
+        PS=":"
+        FS="/"
+        # Cygwin diff needs to be told to ignore trailing CRs
+        golden_diff="diff --strip-trailing-cr"
         ;;
     *)
         PS=":"
         FS="/"
+        # Assume any other platform doesn't have the trailing CR stuff
+        golden_diff="diff"
         ;;
     esac
 
--- a/jdk/test/sun/tools/jrunscript/jrunscript-eTest.sh	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-eTest.sh	Fri Aug 20 14:48:10 2010 -0400
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -42,7 +42,7 @@
 rm -f jrunscript-eTest.out 2>/dev/null
 ${JRUNSCRIPT} -e "println('hello')" > jrunscript-eTest.out 2>&1
 
-diff jrunscript-eTest.out ${TESTSRC}/dash-e.out
+$golden_diff jrunscript-eTest.out ${TESTSRC}/dash-e.out
 if [ $? != 0 ]
 then
   echo "Output of jrunscript -e differ from expected output. Failed."
@@ -55,7 +55,7 @@
 rm -f jrunscript-eTest.out 2>/dev/null
 ${JRUNSCRIPT} -l js -e "println('hello')" > jrunscript-eTest.out 2>&1
 
-diff jrunscript-eTest.out ${TESTSRC}/dash-e.out
+$golden_diff jrunscript-eTest.out ${TESTSRC}/dash-e.out
 if [ $? != 0 ]
 then
   echo "Output of jrunscript -e differ from expected output. Failed."
--- a/jdk/test/sun/tools/jrunscript/jrunscript-fTest.sh	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-fTest.sh	Fri Aug 20 14:48:10 2010 -0400
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -42,7 +42,7 @@
 rm -f jrunscript-fTest.out 2>/dev/null
 ${JRUNSCRIPT} -f ${TESTSRC}/hello.js > jrunscript-fTest.out 2>&1
 
-diff jrunscript-fTest.out ${TESTSRC}/dash-f.out
+$golden_diff jrunscript-fTest.out ${TESTSRC}/dash-f.out
 if [ $? != 0 ]
 then
   echo "Output of jrunscript -f differ from expected output. Failed."
@@ -56,7 +56,7 @@
 rm -f jrunscript-fTest.out 2>/dev/null
 ${JRUNSCRIPT} -l js -f ${TESTSRC}/hello.js > jrunscript-fTest.out 2>&1
 
-diff jrunscript-fTest.out ${TESTSRC}/dash-f.out
+$golden_diff jrunscript-fTest.out ${TESTSRC}/dash-f.out
 if [ $? != 0 ]
 then
   echo "Output of jrunscript -f differ from expected output. Failed."
--- a/jdk/test/sun/tools/jrunscript/jrunscriptTest.sh	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/tools/jrunscript/jrunscriptTest.sh	Fri Aug 20 14:48:10 2010 -0400
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -49,7 +49,7 @@
 new java.lang.Runnable() { run: function() { println('I am runnable'); }}.run();
 EOF
 
-diff jrunscriptTest.out ${TESTSRC}/repl.out
+$golden_diff jrunscriptTest.out ${TESTSRC}/repl.out
 if [ $? != 0 ]
 then
   echo "Output of jrunscript session differ from expected output. Failed."
@@ -67,7 +67,7 @@
 new java.lang.Runnable() { run: function() { println('I am runnable'); }}.run();
 EOF
 
-diff jrunscriptTest.out ${TESTSRC}/repl.out
+$golden_diff jrunscriptTest.out ${TESTSRC}/repl.out
 if [ $? != 0 ]
 then
   echo "Output of jrunscript -l js differ from expected output. Failed."
--- a/jdk/test/sun/tools/jstack/Basic.sh	Thu Aug 12 23:21:17 2010 -0700
+++ b/jdk/test/sun/tools/jstack/Basic.sh	Fri Aug 20 14:48:10 2010 -0400
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -35,22 +35,26 @@
 . ${TESTSRC}/../common/CommonSetup.sh
 . ${TESTSRC}/../common/ApplicationSetup.sh
 
-# Start application (send output to shutdown.port)
+# Start application and use PORTFILE for coordination
 PORTFILE="${TESTCLASSES}"/shutdown.port
-startApplication \
-    -classpath "${TESTCLASSES}" SimpleApplication "${PORTFILE}"
+startApplication SimpleApplication "${PORTFILE}"
+
+# all return statuses are checked in this test
+set +e
 
 failed=0
 
 # normal
-$JSTACK $pid 2>&1
+$JSTACK $appJavaPid 2>&1
 if [ $? != 0 ]; then failed=1; fi
 
 # long
-$JSTACK -l $pid 2>&1
+$JSTACK -l $appJavaPid 2>&1
 if [ $? != 0 ]; then failed=1; fi
 
-stopApplication ShutdownSimpleApplication "${PORTFILE}"
+set -e
+
+stopApplication "${PORTFILE}"
+waitForApplication
  
 exit $failed
-
--- a/langtools/.hgtags	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/.hgtags	Fri Aug 20 14:48:10 2010 -0400
@@ -77,3 +77,7 @@
 d1d7595fa824925651f09b8ffcb86c9cf39807be jdk7-b100
 20a8fe72ee7b673f59c319a5222fe0eebbd92082 jdk7-b101
 ff9c0a0bf7edf637a7dac5062b920924536ed79c jdk7-b102
+bd85271c580ce4600b1b2d5598daa19d02174cf7 jdk7-b103
+fc7219517ec16b28d729d259020a25b05ffdf0b6 jdk7-b104
+aaecac256d39c7cb536e70d20ddd833fc118e43a jdk7-b105
+112fcc00659dda1a356ec75d964584e4dae0228f jdk7-b106
--- a/langtools/make/build.properties	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/make/build.properties	Fri Aug 20 14:48:10 2010 -0400
@@ -107,7 +107,8 @@
         javax/annotation/processing/ \
         javax/lang/model/ \
         javax/tools/ \
-        com/sun/source/ com/sun/tools/javac/
+        com/sun/source/ \
+        com/sun/tools/javac/
 
 javac.tests = \
         tools/javac
--- a/langtools/make/build.xml	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/make/build.xml	Fri Aug 20 14:48:10 2010 -0400
@@ -322,6 +322,35 @@
             datafile="${build.coverage.dir}/cobertura.ser"/>
     </target>
 
+    <target name="diags-examples" depends="build-javac">
+        <!-- can override the following on the command line if desired. -->
+        <property name="diags.examples.out" location="${build.dir}/diag-examples/diags-examples.html"/>
+        <mkdir dir="${build.dir}/diag-examples/classes"/>
+        <javac fork="true"
+            executable="${dist.bin.dir}/javac"
+            srcdir="test/tools/javac/diags"
+            destdir="${build.dir}/diag-examples/classes"
+            includes="Example.java,FileManager.java,HTMLWriter.java,RunExamples.java"
+            sourcepath=""
+            classpath="${dist.lib.dir}/javac.jar"
+            includeAntRuntime="no"
+            debug="${javac.debug}"
+            debuglevel="${javac.debuglevel}"/>
+        <java fork="true"
+            jvm="${target.java.home}/bin/java"
+            dir="test/tools/javac/diags"
+            classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar"
+            classname="RunExamples">
+            <arg value="-examples"/>
+            <arg value="examples"/>
+            <arg value="-o"/>
+            <arg file="${diags.examples.out}"/>
+            <arg value="-showFiles"/>
+            <arg value="-title"/>
+            <arg value="Examples of javac diagnostics"/>
+        </java>
+    </target>
+
 
     <!--
     **** Debugging/diagnostic targets.
--- a/langtools/src/share/classes/com/sun/source/tree/TryTree.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/TryTree.java	Fri Aug 20 14:48:10 2010 -0400
@@ -49,4 +49,5 @@
     BlockTree getBlock();
     List<? extends CatchTree> getCatches();
     BlockTree getFinallyBlock();
+    List<? extends Tree> getResources();
 }
--- a/langtools/src/share/classes/com/sun/source/util/TreeScanner.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/source/util/TreeScanner.java	Fri Aug 20 14:48:10 2010 -0400
@@ -209,7 +209,8 @@
     }
 
     public R visitTry(TryTree node, P p) {
-        R r = scan(node.getBlock(), p);
+        R r = scan(node.getResources(), p);
+        r = scanAndReduce(node.getBlock(), p, r);
         r = scanAndReduce(node.getCatches(), p, r);
         r = scanAndReduce(node.getFinallyBlock(), p, r);
         return r;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java	Fri Aug 20 14:48:10 2010 -0400
@@ -119,6 +119,7 @@
         this.suppressedValues = other.suppressedValues.clone();
     }
 
+    @Override
     public String toString() {
         return "Lint:[values" + values + " suppressedValues" + suppressedValues + "]";
     }
@@ -208,7 +209,12 @@
         /**
          * Warn about potentially unsafe vararg methods
          */
-        VARARGS("varargs");
+        VARARGS("varargs"),
+
+        /**
+         * Warn about arm resources
+         */
+        ARM("arm");
 
         LintCategory(String option) {
             this(option, false);
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Source.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Source.java	Fri Aug 20 14:48:10 2010 -0400
@@ -159,6 +159,9 @@
     public boolean enforceMandatoryWarnings() {
         return compareTo(JDK1_5) >= 0;
     }
+    public boolean allowTryWithResources() {
+        return compareTo(JDK1_7) >= 0;
+    }
     public boolean allowTypeAnnotations() {
         return compareTo(JDK1_7) >= 0;
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Fri Aug 20 14:48:10 2010 -0400
@@ -993,12 +993,17 @@
             return data == ElementKind.EXCEPTION_PARAMETER;
         }
 
+        public boolean isResourceVariable() {
+            return data == ElementKind.RESOURCE_VARIABLE;
+        }
+
         public Object getConstValue() {
             // TODO: Consider if getConstValue and getConstantValue can be collapsed
-            if (data == ElementKind.EXCEPTION_PARAMETER) {
+            if (data == ElementKind.EXCEPTION_PARAMETER ||
+                data == ElementKind.RESOURCE_VARIABLE) {
                 return null;
             } else if (data instanceof Callable<?>) {
-                // In this case, this is final a variable, with an as
+                // In this case, this is a final variable, with an as
                 // yet unevaluated initializer.
                 Callable<?> eval = (Callable<?>)data;
                 data = null; // to make sure we don't evaluate this twice.
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Fri Aug 20 14:48:10 2010 -0400
@@ -148,6 +148,7 @@
     public final Type inheritedType;
     public final Type proprietaryType;
     public final Type systemType;
+    public final Type autoCloseableType;
 
     /** The symbol representing the length field of an array.
      */
@@ -159,6 +160,9 @@
     /** The symbol representing the final finalize method on enums */
     public final MethodSymbol enumFinalFinalize;
 
+    /** The symbol representing the close method on TWR AutoCloseable type */
+    public final MethodSymbol autoCloseableClose;
+
     /** The predefined type that belongs to a tag.
      */
     public final Type[] typeOfTag = new Type[TypeTags.TypeTagCount];
@@ -444,6 +448,12 @@
         suppressWarningsType = enterClass("java.lang.SuppressWarnings");
         inheritedType = enterClass("java.lang.annotation.Inherited");
         systemType = enterClass("java.lang.System");
+        autoCloseableType = enterClass("java.lang.AutoCloseable");
+        autoCloseableClose = new MethodSymbol(PUBLIC,
+                             names.close,
+                             new MethodType(List.<Type>nil(), voidType,
+                                            List.of(exceptionType), methodClass),
+                             autoCloseableType.tsym);
 
         synthesizeEmptyInterfaceIfMissing(cloneableType);
         synthesizeEmptyInterfaceIfMissing(serializableType);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Aug 20 14:48:10 2010 -0400
@@ -192,7 +192,7 @@
     Type check(JCTree tree, Type owntype, int ownkind, int pkind, Type pt) {
         if (owntype.tag != ERROR && pt.tag != METHOD && pt.tag != FORALL) {
             if ((ownkind & ~pkind) == 0) {
-                owntype = chk.checkType(tree.pos(), owntype, pt);
+                owntype = chk.checkType(tree.pos(), owntype, pt, errKey);
             } else {
                 log.error(tree.pos(), "unexpected.type",
                           kindNames(pkind),
@@ -239,7 +239,11 @@
              !((base == null ||
                (base.getTag() == JCTree.IDENT && TreeInfo.name(base) == names._this)) &&
                isAssignableAsBlankFinal(v, env)))) {
-            log.error(pos, "cant.assign.val.to.final.var", v);
+            if (v.isResourceVariable()) { //TWR resource
+                log.error(pos, "twr.resource.may.not.be.assigned", v);
+            } else {
+                log.error(pos, "cant.assign.val.to.final.var", v);
+            }
         }
     }
 
@@ -372,6 +376,10 @@
      */
     Type pt;
 
+    /** Visitor argument: the error key to be generated when a type error occurs
+     */
+    String errKey;
+
     /** Visitor result: the computed type.
      */
     Type result;
@@ -385,13 +393,19 @@
      *  @param pt      The prototype visitor argument.
      */
     Type attribTree(JCTree tree, Env<AttrContext> env, int pkind, Type pt) {
+        return attribTree(tree, env, pkind, pt, "incompatible.types");
+    }
+
+    Type attribTree(JCTree tree, Env<AttrContext> env, int pkind, Type pt, String errKey) {
         Env<AttrContext> prevEnv = this.env;
         int prevPkind = this.pkind;
         Type prevPt = this.pt;
+        String prevErrKey = this.errKey;
         try {
             this.env = env;
             this.pkind = pkind;
             this.pt = pt;
+            this.errKey = errKey;
             tree.accept(this);
             if (tree == breakTree)
                 throw new BreakAttr(env);
@@ -403,6 +417,7 @@
             this.env = prevEnv;
             this.pkind = prevPkind;
             this.pt = prevPt;
+            this.errKey = prevErrKey;
         }
     }
 
@@ -412,6 +427,10 @@
         return attribTree(tree, env, VAL, pt.tag != ERROR ? pt : Type.noType);
     }
 
+    public Type attribExpr(JCTree tree, Env<AttrContext> env, Type pt, String key) {
+        return attribTree(tree, env, VAL, pt.tag != ERROR ? pt : Type.noType, key);
+    }
+
     /** Derived visitor method: attribute an expression tree with
      *  no constraints on the computed type.
      */
@@ -976,14 +995,34 @@
     }
 
     public void visitTry(JCTry tree) {
+        // Create a new local environment with a local
+        Env<AttrContext> localEnv = env.dup(tree, env.info.dup(env.info.scope.dup()));
+        boolean isTryWithResource = tree.resources.nonEmpty();
+        // Create a nested environment for attributing the try block if needed
+        Env<AttrContext> tryEnv = isTryWithResource ?
+            env.dup(tree, localEnv.info.dup(localEnv.info.scope.dup())) :
+            localEnv;
+        // Attribute resource declarations
+        for (JCTree resource : tree.resources) {
+            if (resource.getTag() == JCTree.VARDEF) {
+                attribStat(resource, tryEnv);
+                chk.checkType(resource, resource.type, syms.autoCloseableType, "twr.not.applicable.to.type");
+                VarSymbol var = (VarSymbol)TreeInfo.symbolFor(resource);
+                var.setData(ElementKind.RESOURCE_VARIABLE);
+            } else {
+                attribExpr(resource, tryEnv, syms.autoCloseableType, "twr.not.applicable.to.type");
+            }
+        }
         // Attribute body
-        attribStat(tree.body, env.dup(tree, env.info.dup()));
+        attribStat(tree.body, tryEnv);
+        if (isTryWithResource)
+            tryEnv.info.scope.leave();
 
         // Attribute catch clauses
         for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) {
             JCCatch c = l.head;
             Env<AttrContext> catchEnv =
-                env.dup(c, env.info.dup(env.info.scope.dup()));
+                localEnv.dup(c, localEnv.info.dup(localEnv.info.scope.dup()));
             Type ctype = attribStat(c.param, catchEnv);
             if (TreeInfo.isMultiCatch(c)) {
                 //check that multi-catch parameter is marked as final
@@ -1003,7 +1042,9 @@
         }
 
         // Attribute finalizer
-        if (tree.finalizer != null) attribStat(tree.finalizer, env);
+        if (tree.finalizer != null) attribStat(tree.finalizer, localEnv);
+
+        localEnv.info.scope.leave();
         result = null;
     }
 
@@ -1653,8 +1694,22 @@
             //if the type of the instance creation expression is an interface
             //skip the method resolution step (JLS 15.12.2.7). The type to be
             //inferred is of the kind <X1,X2, ... Xn>C<X1,X2, ... Xn>
-            clazztype = new ForAll(clazztype.tsym.type.allparams(),
-                    clazztype.tsym.type);
+            clazztype = new ForAll(clazztype.tsym.type.allparams(), clazztype.tsym.type) {
+                @Override
+                public List<Type> getConstraints(TypeVar tv, ConstraintKind ck) {
+                    switch (ck) {
+                        case EXTENDS: return types.getBounds(tv);
+                        default: return List.nil();
+                    }
+                }
+                @Override
+                public Type inst(List<Type> inferred, Types types) throws Infer.NoInstanceException {
+                    // check that inferred bounds conform to their bounds
+                    infer.checkWithinBounds(tvars,
+                           types.subst(tvars, tvars, inferred), Warner.noWarnings);
+                    return super.inst(inferred, types);
+                }
+            };
         } else {
             //if the type of the instance creation expression is a class type
             //apply method resolution inference (JLS 15.12.2.7). The return type
@@ -2139,6 +2194,15 @@
                 checkAssignable(tree.pos(), v, tree.selected, env);
         }
 
+        if (sitesym != null &&
+                sitesym.kind == VAR &&
+                ((VarSymbol)sitesym).isResourceVariable() &&
+                sym.kind == MTH &&
+                sym.overrides(syms.autoCloseableClose, sitesym.type.tsym, types, true) &&
+                env.info.lint.isEnabled(Lint.LintCategory.ARM)) {
+            log.warning(tree, "twr.explicit.close.call");
+        }
+
         // Disallow selecting a type from an expression
         if (isType(sym) && (sitesym==null || (sitesym.kind&(TYP|PCK)) == 0)) {
             tree.type = check(tree.selected, pt,
@@ -3061,7 +3125,8 @@
             Scope.Entry e = c.members().lookup(names.serialVersionUID);
             while (e.scope != null && e.sym.kind != VAR) e = e.next();
             if (e.scope == null) {
-                log.warning(tree.pos(), "missing.SVUID", c);
+                log.warning(Lint.LintCategory.SERIAL,
+                        tree.pos(), "missing.SVUID", c);
                 return;
             }
 
@@ -3069,15 +3134,18 @@
             VarSymbol svuid = (VarSymbol)e.sym;
             if ((svuid.flags() & (STATIC | FINAL)) !=
                 (STATIC | FINAL))
-                log.warning(TreeInfo.diagnosticPositionFor(svuid, tree), "improper.SVUID", c);
+                log.warning(Lint.LintCategory.SERIAL,
+                        TreeInfo.diagnosticPositionFor(svuid, tree), "improper.SVUID", c);
 
             // check that it is long
             else if (svuid.type.tag != TypeTags.LONG)
-                log.warning(TreeInfo.diagnosticPositionFor(svuid, tree), "long.SVUID", c);
+                log.warning(Lint.LintCategory.SERIAL,
+                        TreeInfo.diagnosticPositionFor(svuid, tree), "long.SVUID", c);
 
             // check constant
             else if (svuid.getConstValue() == null)
-                log.warning(TreeInfo.diagnosticPositionFor(svuid, tree), "constant.SVUID", c);
+                log.warning(Lint.LintCategory.SERIAL,
+                        TreeInfo.diagnosticPositionFor(svuid, tree), "constant.SVUID", c);
         }
 
     private Type capture(Type type) {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Fri Aug 20 14:48:10 2010 -0400
@@ -111,13 +111,13 @@
         boolean enforceMandatoryWarnings = source.enforceMandatoryWarnings();
 
         deprecationHandler = new MandatoryWarningHandler(log, verboseDeprecated,
-                enforceMandatoryWarnings, "deprecated");
+                enforceMandatoryWarnings, "deprecated", LintCategory.DEPRECATION);
         uncheckedHandler = new MandatoryWarningHandler(log, verboseUnchecked,
-                enforceMandatoryWarnings, "unchecked");
+                enforceMandatoryWarnings, "unchecked", LintCategory.UNCHECKED);
         unsafeVarargsHandler = new MandatoryWarningHandler(log, verboseVarargs,
-                enforceMandatoryWarnings, "varargs");
+                enforceMandatoryWarnings, "varargs", LintCategory.VARARGS);
         sunApiHandler = new MandatoryWarningHandler(log, verboseSunApi,
-                enforceMandatoryWarnings, "sunapi");
+                enforceMandatoryWarnings, "sunapi", null);
     }
 
     /** Switch: generics enabled?
@@ -209,7 +209,7 @@
 
     public void warnStatic(DiagnosticPosition pos, String msg, Object... args) {
         if (lint.isEnabled(LintCategory.STATIC))
-            log.warning(pos, msg, args);
+            log.warning(LintCategory.STATIC, pos, msg, args);
     }
 
     /**
@@ -393,6 +393,10 @@
      *  @param req        The type that was required.
      */
     Type checkType(DiagnosticPosition pos, Type found, Type req) {
+        return checkType(pos, found, req, "incompatible.types");
+    }
+
+    Type checkType(DiagnosticPosition pos, Type found, Type req, String errKey) {
         if (req.tag == ERROR)
             return req;
         if (found.tag == FORALL)
@@ -411,7 +415,7 @@
             log.error(pos, "assignment.to.extends-bound", req);
             return types.createErrorType(found);
         }
-        return typeError(pos, diags.fragment("incompatible.types"), found, req);
+        return typeError(pos, diags.fragment(errKey), found, req);
     }
 
     /** Instantiate polymorphic type to some prototype, unless
@@ -925,7 +929,8 @@
             !TreeInfo.isDiamond(tree) &&
             !env.enclClass.name.isEmpty() &&  //anonymous or intersection
             tree.type.isRaw()) {
-            log.warning(tree.pos(), "raw.class.use", tree.type, tree.type.tsym.type);
+            log.warning(Lint.LintCategory.RAW,
+                    tree.pos(), "raw.class.use", tree.type, tree.type.tsym.type);
         }
     }
 
@@ -1853,6 +1858,7 @@
                     types.isSameType(types.erasure(sym.type), types.erasure(e.sym.type)) &&
                     sym != e.sym &&
                     (sym.flags() & Flags.SYNTHETIC) != (e.sym.flags() & Flags.SYNTHETIC) &&
+                    (sym.flags() & IPROXY) == 0 && (e.sym.flags() & IPROXY) == 0 &&
                     (sym.flags() & BRIDGE) == 0 && (e.sym.flags() & BRIDGE) == 0) {
                     syntheticError(pos, (e.sym.flags() & SYNTHETIC) == 0 ? e.sym : sym);
                     return;
@@ -2151,7 +2157,8 @@
             (s.flags() & DEPRECATED) != 0 &&
             !syms.deprecatedType.isErroneous() &&
             s.attribute(syms.deprecatedType.tsym) == null) {
-            log.warning(pos, "missing.deprecated.annotation");
+            log.warning(Lint.LintCategory.DEP_ANN,
+                    pos, "missing.deprecated.annotation");
         }
     }
 
@@ -2302,7 +2309,7 @@
             int opc = ((OperatorSymbol)operator).opcode;
             if (opc == ByteCodes.idiv || opc == ByteCodes.imod
                 || opc == ByteCodes.ldiv || opc == ByteCodes.lmod) {
-                log.warning(pos, "div.zero");
+                log.warning(Lint.LintCategory.DIVZERO, pos, "div.zero");
             }
         }
     }
@@ -2312,7 +2319,7 @@
      */
     void checkEmptyIf(JCIf tree) {
         if (tree.thenpart.getTag() == JCTree.SKIP && tree.elsepart == null && lint.isEnabled(Lint.LintCategory.EMPTY))
-            log.warning(tree.thenpart.pos(), "empty.if");
+            log.warning(Lint.LintCategory.EMPTY, tree.thenpart.pos(), "empty.if");
     }
 
     /** Check that symbol is unique in given scope.
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Fri Aug 20 14:48:10 2010 -0400
@@ -28,6 +28,8 @@
 package com.sun.tools.javac.comp;
 
 import java.util.HashMap;
+import java.util.Map;
+import java.util.LinkedHashMap;
 
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.tree.*;
@@ -35,6 +37,7 @@
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 
 import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.comp.Resolve;
 import com.sun.tools.javac.tree.JCTree.*;
 
 import static com.sun.tools.javac.code.Flags.*;
@@ -185,6 +188,8 @@
     private final Types types;
     private final Check chk;
     private       TreeMaker make;
+    private final Resolve rs;
+    private Env<AttrContext> attrEnv;
     private       Lint lint;
     private final boolean allowRethrowAnalysis;
 
@@ -203,6 +208,7 @@
         types = Types.instance(context);
         chk = Check.instance(context);
         lint = Lint.instance(context);
+        rs = Resolve.instance(context);
         Source source = Source.instance(context);
         allowRethrowAnalysis = source.allowMulticatch();
     }
@@ -265,6 +271,10 @@
      */
     List<Type> caught;
 
+    /** The list of unreferenced automatic resources.
+     */
+    Map<VarSymbol, JCVariableDecl> unrefdResources;
+
     /** Set when processing a loop body the second time for DU analysis. */
     boolean loopPassTwo = false;
 
@@ -936,7 +946,8 @@
                 alive &&
                 lint.isEnabled(Lint.LintCategory.FALLTHROUGH) &&
                 c.stats.nonEmpty() && l.tail.nonEmpty())
-                log.warning(l.tail.head.pos(),
+                log.warning(Lint.LintCategory.FALLTHROUGH,
+                            l.tail.head.pos(),
                             "possible.fall-through.into.case");
         }
         if (!hasDefault) {
@@ -963,6 +974,7 @@
     public void visitTry(JCTry tree) {
         List<Type> caughtPrev = caught;
         List<Type> thrownPrev = thrown;
+        Map<VarSymbol, JCVariableDecl> unrefdResourcesPrev = unrefdResources;
         thrown = List.nil();
         for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) {
             List<JCExpression> subClauses = TreeInfo.isMultiCatch(l.head) ?
@@ -977,6 +989,38 @@
         pendingExits = new ListBuffer<PendingExit>();
         Bits initsTry = inits.dup();
         uninitsTry = uninits.dup();
+        unrefdResources = new LinkedHashMap<VarSymbol, JCVariableDecl>();
+        for (JCTree resource : tree.resources) {
+            if (resource instanceof JCVariableDecl) {
+                JCVariableDecl vdecl = (JCVariableDecl) resource;
+                visitVarDef(vdecl);
+                unrefdResources.put(vdecl.sym, vdecl);
+            } else if (resource instanceof JCExpression) {
+                scanExpr((JCExpression) resource);
+            } else {
+                throw new AssertionError(tree);  // parser error
+            }
+        }
+        for (JCTree resource : tree.resources) {
+            List<Type> closeableSupertypes = resource.type.isCompound() ?
+                types.interfaces(resource.type).prepend(types.supertype(resource.type)) :
+                List.of(resource.type);
+            for (Type sup : closeableSupertypes) {
+                if (types.asSuper(sup, syms.autoCloseableType.tsym) != null) {
+                    Symbol closeMethod = rs.resolveInternalMethod(tree,
+                            attrEnv,
+                            sup,
+                            names.close,
+                            List.<Type>nil(),
+                            List.<Type>nil());
+                    if (closeMethod.kind == MTH) {
+                        for (Type t : ((MethodSymbol)closeMethod).getThrownTypes()) {
+                            markThrown(tree.body, t);
+                        }
+                    }
+                }
+            }
+        }
         scanStat(tree.body);
         List<Type> thrownInTry = thrown;
         thrown = thrownPrev;
@@ -987,6 +1031,14 @@
         Bits uninitsEnd = uninits;
         int nextadrCatch = nextadr;
 
+        if (!unrefdResources.isEmpty() &&
+                lint.isEnabled(Lint.LintCategory.ARM)) {
+            for (Map.Entry<VarSymbol, JCVariableDecl> e : unrefdResources.entrySet()) {
+                log.warning(e.getValue().pos(),
+                            "automatic.resource.not.referenced", e.getKey());
+            }
+        }
+
         List<Type> caughtInTry = List.nil();
         for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) {
             alive = true;
@@ -1040,8 +1092,9 @@
                 thrown = chk.union(thrown, thrownPrev);
                 if (!loopPassTwo &&
                     lint.isEnabled(Lint.LintCategory.FINALLY)) {
-                    log.warning(TreeInfo.diagEndPos(tree.finalizer),
-                                "finally.cannot.complete");
+                    log.warning(Lint.LintCategory.FINALLY,
+                            TreeInfo.diagEndPos(tree.finalizer),
+                            "finally.cannot.complete");
                 }
             } else {
                 thrown = chk.union(thrown, chk.diff(thrownInTry, caughtInTry));
@@ -1070,6 +1123,7 @@
             while (exits.nonEmpty()) pendingExits.append(exits.next());
         }
         uninitsTry.andSet(uninitsTryPrev).andSet(uninits);
+        unrefdResources = unrefdResourcesPrev;
     }
 
     public void visitConditional(JCConditional tree) {
@@ -1293,8 +1347,16 @@
     }
 
     public void visitIdent(JCIdent tree) {
-        if (tree.sym.kind == VAR)
+        if (tree.sym.kind == VAR) {
             checkInit(tree.pos(), (VarSymbol)tree.sym);
+            referenced(tree.sym);
+        }
+    }
+
+    void referenced(Symbol sym) {
+        if (unrefdResources != null && unrefdResources.containsKey(sym)) {
+            unrefdResources.remove(sym);
+        }
     }
 
     public void visitTypeCast(JCTypeCast tree) {
@@ -1303,7 +1365,8 @@
             && lint.isEnabled(Lint.LintCategory.CAST)
             && types.isSameType(tree.expr.type, tree.clazz.type)
             && !(ignoreAnnotatedCasts && containsTypeAnnotation(tree.clazz))) {
-            log.warning(tree.pos(), "redundant.cast", tree.expr.type);
+            log.warning(Lint.LintCategory.CAST,
+                    tree.pos(), "redundant.cast", tree.expr.type);
         }
     }
 
@@ -1334,8 +1397,10 @@
 
     /** Perform definite assignment/unassignment analysis on a tree.
      */
-    public void analyzeTree(JCTree tree, TreeMaker make) {
+    public void analyzeTree(Env<AttrContext> env, TreeMaker make) {
         try {
+            attrEnv = env;
+            JCTree tree = env.tree;
             this.make = make;
             inits = new Bits();
             uninits = new Bits();
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Fri Aug 20 14:48:10 2010 -0400
@@ -256,7 +256,7 @@
             UndetVar uv = (UndetVar) l.head;
             TypeVar tv = (TypeVar)uv.qtype;
             ListBuffer<Type> hibounds = new ListBuffer<Type>();
-            for (Type t : that.getConstraints(tv, ConstraintKind.EXTENDS).prependList(types.getBounds(tv))) {
+            for (Type t : that.getConstraints(tv, ConstraintKind.EXTENDS)) {
                 if (!t.containsSome(that.tvars) && t.tag != BOT) {
                     hibounds.append(t);
                 }
@@ -280,7 +280,6 @@
         // check bounds
         List<Type> targs = Type.map(undetvars, getInstFun);
         targs = types.subst(targs, that.tvars, targs);
-        checkWithinBounds(that.tvars, targs, warn);
         return chk.checkType(warn.pos(), that.inst(targs, types), to);
     }
 
@@ -398,7 +397,7 @@
                         UndetVar uv = (UndetVar)t;
                         if (uv.qtype == tv) {
                             switch (ck) {
-                                case EXTENDS: return uv.hibounds;
+                                case EXTENDS: return uv.hibounds.appendList(types.subst(types.getBounds(tv), all_tvars, inferredTypes));
                                 case SUPER: return uv.lobounds;
                                 case EQUAL: return uv.inst != null ? List.of(uv.inst) : List.<Type>nil();
                             }
@@ -458,7 +457,7 @@
 
     /** check that type parameters are within their bounds.
      */
-    private void checkWithinBounds(List<Type> tvars,
+    void checkWithinBounds(List<Type> tvars,
                                    List<Type> arguments,
                                    Warner warn)
         throws InvalidInstanceException {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Fri Aug 20 14:48:10 2010 -0400
@@ -605,6 +605,23 @@
         s.enter(sym);
     }
 
+    /** Create a fresh synthetic name within a given scope - the unique name is
+     *  obtained by appending '$' chars at the end of the name until no match
+     *  is found.
+     *
+     * @param name base name
+     * @param s scope in which the name has to be unique
+     * @return fresh synthetic name
+     */
+    private Name makeSyntheticName(Name name, Scope s) {
+        do {
+            name = name.append(
+                    target.syntheticNameChar(),
+                    names.empty);
+        } while (lookupSynthetic(name, s) != null);
+        return name;
+    }
+
     /** Check whether synthetic symbols generated during lowering conflict
      *  with user-defined symbols.
      *
@@ -1299,6 +1316,11 @@
      */
     Scope proxies;
 
+    /** A scope containing all unnamed resource variables/saved
+     *  exception variables for translated TWR blocks
+     */
+    Scope twrVars;
+
     /** A stack containing the this$n field of the currently translated
      *  classes (if needed) in innermost first order.
      *  Inside a constructor, proxies and any this$n symbol are duplicated
@@ -1400,6 +1422,122 @@
         }
     }
 
+    /** Optionally replace a try statement with an automatic resource
+     *  management (ARM) block.
+     * @param tree  The try statement to inspect.
+     * @return      An ARM block, or the original try block if there are no
+     *              resources to manage.
+     */
+    JCTree makeArmTry(JCTry tree) {
+        make_at(tree.pos());
+        twrVars = twrVars.dup();
+        JCBlock armBlock = makeArmBlock(tree.resources, tree.body, 0);
+        if (tree.catchers.isEmpty() && tree.finalizer == null)
+            result = translate(armBlock);
+        else
+            result = translate(make.Try(armBlock, tree.catchers, tree.finalizer));
+        twrVars = twrVars.leave();
+        return result;
+    }
+
+    private JCBlock makeArmBlock(List<JCTree> resources, JCBlock block, int depth) {
+        if (resources.isEmpty())
+            return block;
+
+        // Add resource declaration or expression to block statements
+        ListBuffer<JCStatement> stats = new ListBuffer<JCStatement>();
+        JCTree resource = resources.head;
+        JCExpression expr = null;
+        if (resource instanceof JCVariableDecl) {
+            JCVariableDecl var = (JCVariableDecl) resource;
+            expr = make.Ident(var.sym).setType(resource.type);
+            stats.add(var);
+        } else {
+            assert resource instanceof JCExpression;
+            VarSymbol syntheticTwrVar =
+            new VarSymbol(SYNTHETIC | FINAL,
+                          makeSyntheticName(names.fromString("twrVar" +
+                                           depth), twrVars),
+                          (resource.type.tag == TypeTags.BOT) ?
+                          syms.autoCloseableType : resource.type,
+                          currentMethodSym);
+            twrVars.enter(syntheticTwrVar);
+            JCVariableDecl syntheticTwrVarDecl =
+                make.VarDef(syntheticTwrVar, (JCExpression)resource);
+            expr = (JCExpression)make.Ident(syntheticTwrVar);
+            stats.add(syntheticTwrVarDecl);
+        }
+
+        // Add primaryException declaration
+        VarSymbol primaryException =
+            new VarSymbol(SYNTHETIC,
+                          makeSyntheticName(names.fromString("primaryException" +
+                          depth), twrVars),
+                          syms.throwableType,
+                          currentMethodSym);
+        twrVars.enter(primaryException);
+        JCVariableDecl primaryExceptionTreeDecl = make.VarDef(primaryException, makeNull());
+        stats.add(primaryExceptionTreeDecl);
+
+        // Create catch clause that saves exception and then rethrows it
+        VarSymbol param =
+            new VarSymbol(FINAL|SYNTHETIC,
+                          names.fromString("t" +
+                                           target.syntheticNameChar()),
+                          syms.throwableType,
+                          currentMethodSym);
+        JCVariableDecl paramTree = make.VarDef(param, null);
+        JCStatement assign = make.Assignment(primaryException, make.Ident(param));
+        JCStatement rethrowStat = make.Throw(make.Ident(param));
+        JCBlock catchBlock = make.Block(0L, List.<JCStatement>of(assign, rethrowStat));
+        JCCatch catchClause = make.Catch(paramTree, catchBlock);
+
+        int oldPos = make.pos;
+        make.at(TreeInfo.endPos(block));
+        JCBlock finallyClause = makeArmFinallyClause(primaryException, expr);
+        make.at(oldPos);
+        JCTry outerTry = make.Try(makeArmBlock(resources.tail, block, depth + 1),
+                                  List.<JCCatch>of(catchClause),
+                                  finallyClause);
+        stats.add(outerTry);
+        return make.Block(0L, stats.toList());
+    }
+
+    private JCBlock makeArmFinallyClause(Symbol primaryException, JCExpression resource) {
+        // primaryException.addSuppressedException(catchException);
+        VarSymbol catchException =
+            new VarSymbol(0, make.paramName(2),
+                          syms.throwableType,
+                          currentMethodSym);
+        JCStatement addSuppressionStatement =
+            make.Exec(makeCall(make.Ident(primaryException),
+                               names.fromString("addSuppressedException"),
+                               List.<JCExpression>of(make.Ident(catchException))));
+
+        // try { resource.close(); } catch (e) { primaryException.addSuppressedException(e); }
+        JCBlock tryBlock =
+            make.Block(0L, List.<JCStatement>of(makeResourceCloseInvocation(resource)));
+        JCVariableDecl catchExceptionDecl = make.VarDef(catchException, null);
+        JCBlock catchBlock = make.Block(0L, List.<JCStatement>of(addSuppressionStatement));
+        List<JCCatch> catchClauses = List.<JCCatch>of(make.Catch(catchExceptionDecl, catchBlock));
+        JCTry tryTree = make.Try(tryBlock, catchClauses, null);
+
+        // if (resource != null) resourceClose;
+        JCExpression nullCheck = makeBinary(JCTree.NE,
+                                            make.Ident(primaryException),
+                                            makeNull());
+        JCIf closeIfStatement = make.If(nullCheck,
+                                        tryTree,
+                                        makeResourceCloseInvocation(resource));
+        return make.Block(0L, List.<JCStatement>of(closeIfStatement));
+    }
+
+    private JCStatement makeResourceCloseInvocation(JCExpression resource) {
+        // create resource.close() method invocation
+        JCExpression resourceClose = makeCall(resource, names.close, List.<JCExpression>nil());
+        return make.Exec(resourceClose);
+    }
+
     /** Construct a tree that represents the outer instance
      *  <C.this>. Never pick the current `this'.
      *  @param pos           The source code position to be used for the tree.
@@ -3405,6 +3543,15 @@
         result = tree;
     }
 
+    @Override
+    public void visitTry(JCTry tree) {
+        if (tree.resources.isEmpty()) {
+            super.visitTry(tree);
+        } else {
+            result = makeArmTry(tree);
+        }
+    }
+
 /**************************************************************************
  * main method
  *************************************************************************/
@@ -3430,6 +3577,7 @@
             actualSymbols = new HashMap<Symbol,Symbol>();
             freevarCache = new HashMap<ClassSymbol,List<VarSymbol>>();
             proxies = new Scope(syms.noSymbol);
+            twrVars = new Scope(syms.noSymbol);
             outerThisStack = List.nil();
             accessNums = new HashMap<Symbol,Integer>();
             accessSyms = new HashMap<Symbol,MethodSymbol[]>();
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1797,13 +1797,13 @@
                 return null;
 
             if (isOperator(name)) {
-                return diags.create(dkind, false, log.currentSource(), pos,
+                return diags.create(dkind, log.currentSource(), pos,
                         "operator.cant.be.applied", name, argtypes);
             }
             boolean hasLocation = false;
             if (!site.tsym.name.isEmpty()) {
                 if (site.tsym.kind == PCK && !site.tsym.exists()) {
-                    return diags.create(dkind, false, log.currentSource(), pos,
+                    return diags.create(dkind, log.currentSource(), pos,
                         "doesnt.exist", site.tsym);
                 }
                 hasLocation = true;
@@ -1814,13 +1814,13 @@
             Name idname = isConstructor ? site.tsym.name : name;
             String errKey = getErrorKey(kindname, typeargtypes.nonEmpty(), hasLocation);
             if (hasLocation) {
-                return diags.create(dkind, false, log.currentSource(), pos,
+                return diags.create(dkind, log.currentSource(), pos,
                         errKey, kindname, idname, //symbol kindname, name
                         typeargtypes, argtypes, //type parameters and arguments (if any)
                         typeKindName(site), site); //location kindname, type
             }
             else {
-                return diags.create(dkind, false, log.currentSource(), pos,
+                return diags.create(dkind, log.currentSource(), pos,
                         errKey, kindname, idname, //symbol kindname, name
                         typeargtypes, argtypes); //type parameters and arguments (if any)
             }
@@ -1886,12 +1886,12 @@
                 return null;
 
             if (isOperator(name)) {
-                return diags.create(dkind, false, log.currentSource(),
+                return diags.create(dkind, log.currentSource(),
                         pos, "operator.cant.be.applied", name, argtypes);
             }
             else {
                 Symbol ws = sym.asMemberOf(site, types);
-                return diags.create(dkind, false, log.currentSource(), pos,
+                return diags.create(dkind, log.currentSource(), pos,
                           "cant.apply.symbol" + (explanation != null ? ".1" : ""),
                           kindName(ws),
                           ws.name == names.init ? ws.owner.name : ws.name,
@@ -1974,18 +1974,18 @@
             else if ((sym.flags() & PUBLIC) != 0
                 || (env != null && this.site != null
                     && !isAccessible(env, this.site))) {
-                return diags.create(dkind, false, log.currentSource(),
+                return diags.create(dkind, log.currentSource(),
                         pos, "not.def.access.class.intf.cant.access",
                     sym, sym.location());
             }
             else if ((sym.flags() & (PRIVATE | PROTECTED)) != 0) {
-                return diags.create(dkind, false, log.currentSource(),
+                return diags.create(dkind, log.currentSource(),
                         pos, "report.access", sym,
                         asFlagSet(sym.flags() & (PRIVATE | PROTECTED)),
                         sym.location());
             }
             else {
-                return diags.create(dkind, false, log.currentSource(),
+                return diags.create(dkind, log.currentSource(),
                         pos, "not.def.public.cant.access", sym, sym.location());
             }
         }
@@ -2011,7 +2011,7 @@
             Symbol errSym = ((sym.kind == TYP && sym.type.tag == CLASS)
                 ? types.erasure(sym.type).tsym
                 : sym);
-            return diags.create(dkind, false, log.currentSource(), pos,
+            return diags.create(dkind, log.currentSource(), pos,
                     "non-static.cant.be.ref", kindName(sym), errSym);
         }
     }
@@ -2048,7 +2048,7 @@
             }
             Name sname = pair.sym.name;
             if (sname == names.init) sname = pair.sym.owner.name;
-            return diags.create(dkind, false, log.currentSource(),
+            return diags.create(dkind, log.currentSource(),
                       pos, "ref.ambiguous", sname,
                       kindName(pair.sym),
                       pair.sym,
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Fri Aug 20 14:48:10 2010 -0400
@@ -535,6 +535,14 @@
         result = tree;
     }
 
+    public void visitTry(JCTry tree) {
+        tree.resources = translate(tree.resources, syms.autoCloseableType);
+        tree.body = translate(tree.body);
+        tree.catchers = translateCatchers(tree.catchers);
+        tree.finalizer = translate(tree.finalizer);
+        result = tree;
+    }
+
     public void visitConditional(JCConditional tree) {
         tree.cond = translate(tree.cond, syms.booleanType);
         tree.truepart = translate(tree.truepart, erasure(tree.type));
--- a/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java	Fri Aug 20 14:48:10 2010 -0400
@@ -246,7 +246,8 @@
         private void addDirectory(File dir, boolean warn) {
             if (!dir.isDirectory()) {
                 if (warn)
-                    log.warning("dir.path.element.not.found", dir);
+                    log.warning(Lint.LintCategory.PATH,
+                            "dir.path.element.not.found", dir);
                 return;
             }
 
@@ -280,8 +281,10 @@
 
             if (! fsInfo.exists(file)) {
                 /* No such file or directory exists */
-                if (warn)
-                    log.warning("path.element.not.found", file);
+                if (warn) {
+                    log.warning(Lint.LintCategory.PATH,
+                            "path.element.not.found", file);
+                }
             } else if (fsInfo.isFile(file)) {
                 /* File is an ordinary file. */
                 if (!isArchive(file)) {
@@ -290,12 +293,16 @@
                     try {
                         ZipFile z = new ZipFile(file);
                         z.close();
-                        if (warn)
-                            log.warning("unexpected.archive.file", file);
+                        if (warn) {
+                            log.warning(Lint.LintCategory.PATH,
+                                    "unexpected.archive.file", file);
+                        }
                     } catch (IOException e) {
                         // FIXME: include e.getLocalizedMessage in warning
-                        if (warn)
-                            log.warning("invalid.archive.file", file);
+                        if (warn) {
+                            log.warning(Lint.LintCategory.PATH,
+                                    "invalid.archive.file", file);
+                        }
                         return;
                     }
                 }
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/CRTable.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/CRTable.java	Fri Aug 20 14:48:10 2010 -0400
@@ -325,6 +325,7 @@
 
         public void visitTry(JCTry tree) {
             SourceRange sr = new SourceRange(startPos(tree), endPos(tree));
+            sr.mergeWith(csp(tree.resources));
             sr.mergeWith(csp(tree.body));
             sr.mergeWith(cspCatchers(tree.catchers));
             sr.mergeWith(csp(tree.finalizer));
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri Aug 20 14:48:10 2010 -0400
@@ -2628,7 +2628,7 @@
      *  @param arg An argument for substitution into the output string.
      */
     private void printVerbose(String key, CharSequence arg) {
-        Log.printLines(log.noticeWriter, Log.getLocalizedString("verbose." + key, arg));
+        log.printNoteLines("verbose." + key, arg);
     }
 
     /** Output for "-checkclassfile" option.
@@ -2636,7 +2636,7 @@
      *  @param arg An argument for substitution into the output string.
      */
     private void printCCF(String key, Object arg) {
-        Log.printLines(log.noticeWriter, Log.getLocalizedString(key, arg));
+        log.printNoteLines(key, arg);
     }
 
 
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1604,7 +1604,7 @@
         try {
             writeClassFile(out, c);
             if (verbose)
-                log.errWriter.println(Log.getLocalizedString("verbose.wrote.file", outFile));
+                log.printErrLines("verbose.wrote.file", outFile);
             out.close();
             out = null;
         } finally {
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1105,7 +1105,7 @@
             return env;
 
         if (verboseCompilePolicy)
-            Log.printLines(log.noticeWriter, "[attribute " + env.enclClass.sym + "]");
+            printNote("[attribute " + env.enclClass.sym + "]");
         if (verbose)
             printVerbose("checking.attribution", env.enclClass.sym);
 
@@ -1174,7 +1174,7 @@
             try {
                 make.at(Position.FIRSTPOS);
                 TreeMaker localMake = make.forToplevel(env.toplevel);
-                flow.analyzeTree(env.tree, localMake);
+                flow.analyzeTree(env, localMake);
                 compileStates.put(env, CompileState.FLOW);
 
                 if (shouldStop(CompileState.FLOW))
@@ -1527,19 +1527,19 @@
      *  @param arg An argument for substitution into the output string.
      */
     protected void printVerbose(String key, Object arg) {
-        Log.printLines(log.noticeWriter, Log.getLocalizedString("verbose." + key, arg));
+        log.printNoteLines("verbose." + key, arg);
     }
 
     /** Print numbers of errors and warnings.
      */
     protected void printCount(String kind, int count) {
         if (count != 0) {
-            String text;
+            String key;
             if (count == 1)
-                text = Log.getLocalizedString("count." + kind, String.valueOf(count));
+                key = "count." + kind;
             else
-                text = Log.getLocalizedString("count." + kind + ".plural", String.valueOf(count));
-            Log.printLines(log.errWriter, text);
+                key = "count." + kind + ".plural";
+            log.printErrLines(key, String.valueOf(count));
             log.errWriter.flush();
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Aug 20 14:48:10 2010 -0400
@@ -131,6 +131,7 @@
         this.allowForeach = source.allowForeach();
         this.allowStaticImport = source.allowStaticImport();
         this.allowAnnotations = source.allowAnnotations();
+        this.allowTWR = source.allowTryWithResources();
         this.allowDiamond = source.allowDiamond();
         this.allowMulticatch = source.allowMulticatch();
         this.allowTypeAnnotations = source.allowTypeAnnotations();
@@ -186,6 +187,10 @@
      */
     boolean allowTypeAnnotations;
 
+    /** Switch: should we recognize automatic resource management?
+     */
+    boolean allowTWR;
+
     /** Switch: should we keep docComments?
      */
     boolean keepDocComments;
@@ -1151,8 +1156,12 @@
                     t = toP(F.at(pos).Select(t, ident()));
                     break;
                 case ELLIPSIS:
-                    assert this.permitTypeAnnotationsPushBack;
-                    typeAnnotationsPushedBack = annos;
+                    if (this.permitTypeAnnotationsPushBack) {
+                        this.typeAnnotationsPushedBack = annos;
+                    } else if (annos.nonEmpty()) {
+                        // Don't return here -- error recovery attempt
+                        illegal(annos.head.pos);
+                    }
                     break loop;
                 default:
                     break loop;
@@ -1842,6 +1851,7 @@
      *     | WHILE ParExpression Statement
      *     | DO Statement WHILE ParExpression ";"
      *     | TRY Block ( Catches | [Catches] FinallyPart )
+     *     | TRY "(" ResourceSpecification ")" Block [Catches] [FinallyPart]
      *     | SWITCH ParExpression "{" SwitchBlockStatementGroups "}"
      *     | SYNCHRONIZED ParExpression Block
      *     | RETURN [Expression] ";"
@@ -1912,6 +1922,13 @@
         }
         case TRY: {
             S.nextToken();
+            List<JCTree> resources = List.<JCTree>nil();
+            if (S.token() == LPAREN) {
+                checkAutomaticResourceManagement();
+                S.nextToken();
+                resources = resources();
+                accept(RPAREN);
+            }
             JCBlock body = block();
             ListBuffer<JCCatch> catchers = new ListBuffer<JCCatch>();
             JCBlock finalizer = null;
@@ -1922,9 +1939,13 @@
                     finalizer = block();
                 }
             } else {
-                log.error(pos, "try.without.catch.or.finally");
+                if (allowTWR) {
+                    if (resources.isEmpty())
+                        log.error(pos, "try.without.catch.finally.or.resource.decls");
+                } else
+                    log.error(pos, "try.without.catch.or.finally");
             }
-            return F.at(pos).Try(body, catchers.toList(), finalizer);
+            return F.at(pos).Try(resources, body, catchers.toList(), finalizer);
         }
         case SWITCH: {
             S.nextToken();
@@ -2217,7 +2238,7 @@
 
         /* A modifiers tree with no modifier tokens or annotations
          * has no text position. */
-        if ((flags & Flags.ModifierFlags) == 0 && annotations.isEmpty())
+        if ((flags & (Flags.ModifierFlags | Flags.ANNOTATION)) == 0 && annotations.isEmpty())
             pos = Position.NOPOS;
 
         JCModifiers mods = F.at(pos).Modifiers(flags, annotations.toList());
@@ -2385,6 +2406,39 @@
         return toP(F.at(pos).VarDef(mods, name, type, null));
     }
 
+    /** Resources = Resource { ";" Resources }
+     */
+    List<JCTree> resources() {
+        ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
+        defs.append(resource());
+        while (S.token() == SEMI) {
+            // All but last of multiple declarators subsume a semicolon
+            storeEnd(defs.elems.last(), S.endPos());
+            S.nextToken();
+            defs.append(resource());
+        }
+        return defs.toList();
+    }
+
+    /** Resource =
+     *    VariableModifiers Type VariableDeclaratorId = Expression
+     *  | Expression
+     */
+    JCTree resource() {
+        int pos = S.pos();
+        if (S.token() == FINAL || S.token() == MONKEYS_AT) {
+            return variableDeclaratorRest(pos, optFinal(0), parseType(),
+                                          ident(), true, null);
+        } else {
+            JCExpression t = term(EXPR | TYPE);
+            if ((lastmode & TYPE) != 0 && S.token() == IDENTIFIER)
+                return variableDeclaratorRest(pos, toP(F.at(pos).Modifiers(Flags.FINAL)), t,
+                                              ident(), true, null);
+            else
+                return t;
+        }
+    }
+
     /** CompilationUnit = [ { "@" Annotation } PACKAGE Qualident ";"] {ImportDeclaration} {TypeDeclaration}
      */
     public JCTree.JCCompilationUnit parseCompilationUnit() {
@@ -3216,6 +3270,12 @@
         if (!allowMulticatch) {
             log.error(S.pos(), "multicatch.not.supported.in.source", source.name);
             allowMulticatch = true;
-            }
+        }
+    }
+    void checkAutomaticResourceManagement() {
+        if (!allowTWR) {
+            log.error(S.pos(), "automatic.resource.management.not.supported.in.source", source.name);
+            allowTWR = true;
+        }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java	Fri Aug 20 14:48:10 2010 -0400
@@ -379,6 +379,15 @@
     }
 
     private JavaFileObject createSourceOrClassFile(boolean isSourceFile, String name) throws IOException {
+        if (lint) {
+            int periodIndex = name.lastIndexOf(".");
+            if (periodIndex != -1) {
+                String base = name.substring(periodIndex);
+                String extn = (isSourceFile ? ".java" : ".class");
+                if (base.equals(extn))
+                    log.warning("proc.suspicious.class.name", name, extn);
+            }
+        }
         checkNameAndExistence(name, isSourceFile);
         Location loc = (isSourceFile ? SOURCE_OUTPUT : CLASS_OUTPUT);
         JavaFileObject.Kind kind = (isSourceFile ?
@@ -530,11 +539,14 @@
     /**
      * Update internal state for a new round.
      */
-    public void newRound(Context context, boolean lastRound) {
+    public void newRound(Context context) {
         this.context = context;
         this.log = Log.instance(context);
+        clearRoundState();
+    }
+
+    void setLastRound(boolean lastRound) {
         this.lastRound = lastRound;
-        clearRoundState();
     }
 
     public void close() {
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacMessager.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacMessager.java	Fri Aug 20 14:48:10 2010 -0400
@@ -46,6 +46,7 @@
     Log log;
     JavacProcessingEnvironment processingEnv;
     int errorCount = 0;
+    int warningCount = 0;
 
     JavacMessager(Context context, JavacProcessingEnvironment processingEnv) {
         log = Log.instance(context);
@@ -116,10 +117,12 @@
                 break;
 
             case WARNING:
+                warningCount++;
                 log.warning(pos, "proc.messager", msg.toString());
                 break;
 
             case MANDATORY_WARNING:
+                warningCount++;
                 log.mandatoryWarning(pos, "proc.messager", msg.toString());
                 break;
 
@@ -167,6 +170,10 @@
         return errorCount;
     }
 
+    public int warningCount() {
+        return warningCount;
+    }
+
     public void newRound(Context context) {
         log = Log.instance(context);
         errorCount = 0;
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Fri Aug 20 14:48:10 2010 -0400
@@ -68,7 +68,6 @@
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.Convert;
 import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.JavacMessages;
 import com.sun.tools.javac.util.Name;
@@ -95,6 +94,7 @@
     private final boolean lint;
     private final boolean procOnly;
     private final boolean fatalErrors;
+    private final boolean werror;
     private boolean foundTypeProcessors;
 
     private final JavacFiler filer;
@@ -157,6 +157,7 @@
         procOnly = options.get("-proc:only") != null ||
             options.get("-Xprint") != null;
         fatalErrors = options.get("fatalEnterError") != null;
+        werror = options.get("-Werror") != null;
         platformAnnotations = initPlatformAnnotations();
         foundTypeProcessors = false;
 
@@ -654,9 +655,6 @@
                                      Set<TypeElement> annotationsPresent,
                                      List<ClassSymbol> topLevelClasses,
                                      List<PackageSymbol> packageInfoFiles) {
-        // Writer for -XprintRounds and -XprintProcessorInfo data
-        PrintWriter xout = context.get(Log.outKey);
-
         Map<String, TypeElement> unmatchedAnnotations =
             new HashMap<String, TypeElement>(annotationsPresent.size());
 
@@ -708,10 +706,10 @@
                 ps.removeSupportedOptions(unmatchedProcessorOptions);
 
                 if (printProcessorInfo || verbose) {
-                    xout.println(Log.getLocalizedString("x.print.processor.info",
-                                                        ps.processor.getClass().getName(),
-                                                        matchedNames.toString(),
-                                                        processingResult));
+                    log.printNoteLines("x.print.processor.info",
+                            ps.processor.getClass().getName(),
+                            matchedNames.toString(),
+                            processingResult);
                 }
 
                 if (processingResult) {
@@ -760,7 +758,7 @@
         }
 
         @Override
-         public Set<TypeElement> scan(Element e, Set<TypeElement> p) {
+        public Set<TypeElement> scan(Element e, Set<TypeElement> p) {
             for (AnnotationMirror annotationMirror :
                      elements.getAllAnnotationMirrors(e) ) {
                 Element e2 = annotationMirror.getAnnotationType().asElement();
@@ -785,6 +783,239 @@
         }
     }
 
+    /**
+     * Helper object for a single round of annotation processing.
+     */
+    class Round {
+        /** The round number. */
+        final int number;
+        /** The context for the round. */
+        final Context context;
+        /** The compiler for the round. */
+        final JavaCompiler compiler;
+        /** The log for the round. */
+        final Log log;
+
+        /** The set of annotations to be processed this round. */
+        Set<TypeElement> annotationsPresent;
+        /** The set of top level classes to be processed this round. */
+        List<ClassSymbol> topLevelClasses;
+        /** The set of package-info files to be processed this round. */
+        List<PackageSymbol> packageInfoFiles;
+
+        /** Create a round. */
+        Round(Context context, int number) {
+            this.context = context;
+            this.number = number;
+            compiler = JavaCompiler.instance(context);
+            log = Log.instance(context);
+
+            // the following is for the benefit of JavacProcessingEnvironment.getContext()
+            JavacProcessingEnvironment.this.context = context;
+
+            // the following will be populated as needed
+            annotationsPresent = new LinkedHashSet<TypeElement>();
+            topLevelClasses  = List.nil();
+            packageInfoFiles = List.nil();
+        }
+
+        /** Create the next round to be used. */
+        Round next() {
+            compiler.close(false);
+            return new Round(contextForNextRound(), number + 1);
+        }
+
+        /** Return the number of errors found so far in this round.
+         * This may include uncoverable errors, such as parse errors,
+         * and transient errors, such as missing symbols. */
+        int errorCount() {
+            return compiler.errorCount();
+        }
+
+        /** Return the number of warnings found so far in this round. */
+        int warningCount() {
+            return compiler.warningCount();
+        }
+
+        /** Return whether or not an unrecoverable error has occurred. */
+        boolean unrecoverableError() {
+            return log.unrecoverableError;
+        }
+
+        /** Find the set of annotations present in the set of top level
+         * classes and package info files to be processed this round. */
+        void findAnnotationsPresent(ComputeAnnotationSet annotationComputer) {
+            // Use annotation processing to compute the set of annotations present
+            annotationsPresent = new LinkedHashSet<TypeElement>();
+            for (ClassSymbol classSym : topLevelClasses)
+                annotationComputer.scan(classSym, annotationsPresent);
+            for (PackageSymbol pkgSym : packageInfoFiles)
+                annotationComputer.scan(pkgSym, annotationsPresent);
+        }
+
+        /**
+         * Parse the latest set of generated source files created by the filer.
+         */
+        List<JCCompilationUnit> parseNewSourceFiles()
+            throws IOException {
+            List<JavaFileObject> fileObjects = List.nil();
+            for (JavaFileObject jfo : filer.getGeneratedSourceFileObjects() ) {
+                fileObjects = fileObjects.prepend(jfo);
+            }
+
+           return compiler.parseFiles(fileObjects);
+        }
+
+        /** Enter the latest set of generated class files created by the filer. */
+        List<ClassSymbol> enterNewClassFiles() {
+            ClassReader reader = ClassReader.instance(context);
+            Names names = Names.instance(context);
+            List<ClassSymbol> list = List.nil();
+
+            for (Map.Entry<String,JavaFileObject> entry : filer.getGeneratedClasses().entrySet()) {
+                Name name = names.fromString(entry.getKey());
+                JavaFileObject file = entry.getValue();
+                if (file.getKind() != JavaFileObject.Kind.CLASS)
+                    throw new AssertionError(file);
+                ClassSymbol cs;
+                if (isPkgInfo(file, JavaFileObject.Kind.CLASS)) {
+                    Name packageName = Convert.packagePart(name);
+                    PackageSymbol p = reader.enterPackage(packageName);
+                    if (p.package_info == null)
+                        p.package_info = reader.enterClass(Convert.shortName(name), p);
+                    cs = p.package_info;
+                    if (cs.classfile == null)
+                        cs.classfile = file;
+                } else
+                    cs = reader.enterClass(name, file);
+                list = list.prepend(cs);
+            }
+            return list.reverse();
+        }
+
+        /** Enter a set of syntax trees. */
+        void enterTrees(List<JCCompilationUnit> roots) {
+            compiler.enterTrees(roots);
+        }
+
+        /** Run a processing round. */
+        void run(boolean lastRound, boolean errorStatus) {
+//            assert lastRound
+//                ? (topLevelClasses.size() == 0 && annotationsPresent.size() == 0)
+//                : (errorStatus == false);
+//
+//            printRoundInfo(topLevelClasses, annotationsPresent, lastRound);
+
+            TaskListener taskListener = context.get(TaskListener.class);
+            if (taskListener != null)
+                taskListener.started(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING_ROUND));
+
+            try {
+                if (lastRound) {
+                    printRoundInfo(List.<ClassSymbol>nil(), Collections.<TypeElement>emptySet(), lastRound);
+                    filer.setLastRound(true);
+                    Set<Element> emptyRootElements = Collections.emptySet(); // immutable
+                    RoundEnvironment renv = new JavacRoundEnvironment(true,
+                            errorStatus,
+                            emptyRootElements,
+                            JavacProcessingEnvironment.this);
+                    discoveredProcs.iterator().runContributingProcs(renv);
+                } else {
+                    printRoundInfo(topLevelClasses, annotationsPresent, lastRound);
+                    discoverAndRunProcs(context, annotationsPresent, topLevelClasses, packageInfoFiles);
+                }
+            } finally {
+                if (taskListener != null)
+                    taskListener.finished(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING_ROUND));
+            }
+        }
+
+        /** Update the processing state for the current context. */
+        // Question: should this not be part of next()?
+        // Note: Calling it from next() breaks some tests. There is an issue
+        // whether the annotationComputer is using elementUtils with the
+        // correct context.
+        void updateProcessingState() {
+            filer.newRound(context);
+            messager.newRound(context);
+
+            elementUtils.setContext(context);
+            typeUtils.setContext(context);
+        }
+
+        /** Print info about this round. */
+        private void printRoundInfo(List<ClassSymbol> topLevelClasses,
+                Set<TypeElement> annotationsPresent,
+                boolean lastRound) {
+            if (printRounds || verbose) {
+                log.printNoteLines("x.print.rounds",
+                        (!lastRound ? number : number + 1),
+                        "{" + topLevelClasses.toString(", ") + "}",
+                        annotationsPresent,
+                        lastRound);
+            }
+        }
+
+        /** Get the context for the next round of processing.
+         * Important values are propogated from round to round;
+         * other values are implicitly reset.
+         */
+        private Context contextForNextRound() {
+            Context next = new Context();
+
+            Options options = Options.instance(context);
+            assert options != null;
+            next.put(Options.optionsKey, options);
+
+            PrintWriter out = context.get(Log.outKey);
+            assert out != null;
+            next.put(Log.outKey, out);
+
+            final boolean shareNames = true;
+            if (shareNames) {
+                Names names = Names.instance(context);
+                assert names != null;
+                next.put(Names.namesKey, names);
+            }
+
+            DiagnosticListener<?> dl = context.get(DiagnosticListener.class);
+            if (dl != null)
+                next.put(DiagnosticListener.class, dl);
+
+            TaskListener tl = context.get(TaskListener.class);
+            if (tl != null)
+                next.put(TaskListener.class, tl);
+
+            JavaFileManager jfm = context.get(JavaFileManager.class);
+            assert jfm != null;
+            next.put(JavaFileManager.class, jfm);
+            if (jfm instanceof JavacFileManager) {
+                ((JavacFileManager)jfm).setContext(next);
+            }
+
+            Names names = Names.instance(context);
+            assert names != null;
+            next.put(Names.namesKey, names);
+
+            Keywords keywords = Keywords.instance(context);
+            assert(keywords != null);
+            next.put(Keywords.keywordsKey, keywords);
+
+            JavaCompiler oldCompiler = JavaCompiler.instance(context);
+            JavaCompiler nextCompiler = JavaCompiler.instance(next);
+            nextCompiler.initRound(oldCompiler);
+
+            JavacTaskImpl task = context.get(JavacTaskImpl.class);
+            if (task != null) {
+                next.put(JavacTaskImpl.class, task);
+                task.updateContext(next);
+            }
+
+            context.clear();
+            return next;
+        }
+    }
+
 
     // TODO: internal catch clauses?; catch and rethrow an annotation
     // processing error
@@ -795,61 +1026,37 @@
         throws IOException {
 
         log = Log.instance(context);
-        // Writer for -XprintRounds and -XprintProcessorInfo data
-        PrintWriter xout = context.get(Log.outKey);
-        TaskListener taskListener = context.get(TaskListener.class);
 
-        JavaCompiler compiler = JavaCompiler.instance(context);
-        compiler.todo.clear(); // free the compiler's resources
+        Round round = new Round(context, 1);
+        round.compiler.todo.clear(); // free the compiler's resources
 
-        int round = 0;
-
-        // List<JCAnnotation> annotationsPresentInSource = collector.findAnnotations(roots);
-        List<ClassSymbol> topLevelClasses = getTopLevelClasses(roots);
+        // The reverse() in the following line is to maintain behavioural
+        // compatibility with the previous revision of the code. Strictly speaking,
+        // it should not be necessary, but a javah golden file test fails without it.
+        round.topLevelClasses =
+                getTopLevelClasses(roots).prependList(classSymbols.reverse());
 
-        for (ClassSymbol classSym : classSymbols)
-            topLevelClasses = topLevelClasses.prepend(classSym);
-        List<PackageSymbol> packageInfoFiles =
-            getPackageInfoFiles(roots);
+        round.packageInfoFiles = getPackageInfoFiles(roots);
 
         Set<PackageSymbol> specifiedPackages = new LinkedHashSet<PackageSymbol>();
         for (PackageSymbol psym : pckSymbols)
             specifiedPackages.add(psym);
         this.specifiedPackages = Collections.unmodifiableSet(specifiedPackages);
 
-        // Use annotation processing to compute the set of annotations present
-        Set<TypeElement> annotationsPresent = new LinkedHashSet<TypeElement>();
         ComputeAnnotationSet annotationComputer = new ComputeAnnotationSet(elementUtils);
-        for (ClassSymbol classSym : topLevelClasses)
-            annotationComputer.scan(classSym, annotationsPresent);
-        for (PackageSymbol pkgSym : packageInfoFiles)
-            annotationComputer.scan(pkgSym, annotationsPresent);
+        round.findAnnotationsPresent(annotationComputer);
 
-        Context currentContext = context;
-
-        int roundNumber = 0;
         boolean errorStatus = false;
 
         runAround:
-        while(true) {
-            if (fatalErrors && compiler.errorCount() != 0) {
+        while (true) {
+            if ((fatalErrors && round.errorCount() != 0)
+                    || (werror && round.warningCount() != 0)) {
                 errorStatus = true;
                 break runAround;
             }
 
-            this.context = currentContext;
-            roundNumber++;
-            printRoundInfo(xout, roundNumber, topLevelClasses, annotationsPresent, false);
-
-            if (taskListener != null)
-                taskListener.started(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING_ROUND));
-
-            try {
-                discoverAndRunProcs(currentContext, annotationsPresent, topLevelClasses, packageInfoFiles);
-            } finally {
-                if (taskListener != null)
-                    taskListener.finished(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING_ROUND));
-            }
+            round.run(false, false);
 
             /*
              * Processors for round n have run to completion.  Prepare
@@ -860,65 +1067,54 @@
             if (messager.errorRaised()) {
                 errorStatus = true;
                 break runAround;
-            } else {
-                if (moreToDo()) {
-                    // annotationsPresentInSource = List.nil();
-                    annotationsPresent = new LinkedHashSet<TypeElement>();
-                    topLevelClasses  = List.nil();
-                    packageInfoFiles = List.nil();
+            }
 
-                    compiler.close(false);
-                    currentContext = contextForNextRound(currentContext, true);
+            if (!moreToDo())
+                break runAround; // No new files
 
-                    JavaFileManager fileManager = currentContext.get(JavaFileManager.class);
+            round = round.next();
 
-                    compiler = JavaCompiler.instance(currentContext);
-                    List<JCCompilationUnit> parsedFiles = sourcesToParsedFiles(compiler);
-                    roots = cleanTrees(roots).appendList(parsedFiles);
+            List<JCCompilationUnit> parsedFiles = round.parseNewSourceFiles();
+            roots = cleanTrees(roots).appendList(parsedFiles);
 
-                    // Check for errors after parsing
-                    if (log.unrecoverableError) {
-                        errorStatus = true;
-                        break runAround;
-                    } else {
-                        List<ClassSymbol> newClasses = enterNewClassFiles(currentContext);
-                        compiler.enterTrees(roots);
+            // Check for errors after parsing
+            if (round.unrecoverableError()) {
+                errorStatus = true;
+                break runAround;
+            }
+
+            List<ClassSymbol> newClasses = round.enterNewClassFiles();
+            round.enterTrees(roots);
 
-                        // annotationsPresentInSource =
-                        // collector.findAnnotations(parsedFiles);
-                        ListBuffer<ClassSymbol> tlc = new ListBuffer<ClassSymbol>();
-                        tlc.appendList(getTopLevelClasses(parsedFiles));
-                        tlc.appendList(getTopLevelClassesFromClasses(newClasses));
-                        topLevelClasses  = tlc.toList();
+            round.topLevelClasses = join(
+                    getTopLevelClasses(parsedFiles),
+                    getTopLevelClassesFromClasses(newClasses));
 
-                        ListBuffer<PackageSymbol> pif = new ListBuffer<PackageSymbol>();
-                        pif.appendList(getPackageInfoFiles(parsedFiles));
-                        pif.appendList(getPackageInfoFilesFromClasses(newClasses));
-                        packageInfoFiles = pif.toList();
+            round.packageInfoFiles = join(
+                    getPackageInfoFiles(parsedFiles),
+                    getPackageInfoFilesFromClasses(newClasses));
 
-                        annotationsPresent = new LinkedHashSet<TypeElement>();
-                        for (ClassSymbol classSym : topLevelClasses)
-                            annotationComputer.scan(classSym, annotationsPresent);
-                        for (PackageSymbol pkgSym : packageInfoFiles)
-                            annotationComputer.scan(pkgSym, annotationsPresent);
+            round.findAnnotationsPresent(annotationComputer);
+            round.updateProcessingState();
+        }
+
+        // run last round
+        round.run(true, errorStatus);
 
-                        updateProcessingState(currentContext, false);
-                    }
-                } else
-                    break runAround; // No new files
-            }
+        // Add any sources generated during the last round to the set
+        // of files to be compiled.
+        if (moreToDo()) {
+            List<JCCompilationUnit> parsedFiles = round.parseNewSourceFiles();
+            roots = cleanTrees(roots).appendList(parsedFiles);
         }
-        roots = runLastRound(xout, roundNumber, errorStatus, compiler, roots, taskListener);
+
         // Set error status for any files compiled and generated in
         // the last round
-        if (log.unrecoverableError)
+        if (round.unrecoverableError() || (werror && round.warningCount() != 0))
             errorStatus = true;
 
-        compiler.close(false);
-        currentContext = contextForNextRound(currentContext, true);
-        compiler = JavaCompiler.instance(currentContext);
+        round = round.next();
 
-        filer.newRound(currentContext, true);
         filer.warnIfUnclosedFiles();
         warnIfUnmatchedOptions();
 
@@ -935,143 +1131,43 @@
         */
         errorStatus = errorStatus || messager.errorRaised();
 
-
         // Free resources
         this.close();
 
+        TaskListener taskListener = this.context.get(TaskListener.class);
         if (taskListener != null)
             taskListener.finished(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING));
 
+        JavaCompiler compiler;
+
         if (errorStatus) {
+            compiler = round.compiler;
+            compiler.log.nwarnings += messager.warningCount();
             compiler.log.nerrors += messager.errorCount();
             if (compiler.errorCount() == 0)
                 compiler.log.nerrors++;
         } else if (procOnly && !foundTypeProcessors) {
+            compiler = round.compiler;
             compiler.todo.clear();
         } else { // Final compilation
-            compiler.close(false);
-            currentContext = contextForNextRound(currentContext, true);
-            this.context = currentContext;
-            updateProcessingState(currentContext, true);
-            compiler = JavaCompiler.instance(currentContext);
+            round = round.next();
+            round.updateProcessingState();
+            compiler = round.compiler;
             if (procOnly && foundTypeProcessors)
                 compiler.shouldStopPolicy = CompileState.FLOW;
 
-            if (true) {
-                compiler.enterTrees(cleanTrees(roots));
-            } else {
-                List<JavaFileObject> fileObjects = List.nil();
-                for (JCCompilationUnit unit : roots)
-                    fileObjects = fileObjects.prepend(unit.getSourceFile());
-                roots = null;
-                compiler.enterTrees(compiler.parseFiles(fileObjects.reverse()));
-            }
+            compiler.enterTrees(cleanTrees(roots));
         }
 
         return compiler;
     }
 
-    private List<JCCompilationUnit> sourcesToParsedFiles(JavaCompiler compiler)
-        throws IOException {
-        List<JavaFileObject> fileObjects = List.nil();
-        for (JavaFileObject jfo : filer.getGeneratedSourceFileObjects() ) {
-            fileObjects = fileObjects.prepend(jfo);
-        }
-
-       return compiler.parseFiles(fileObjects);
-    }
-
-    // Call the last round of annotation processing
-    private List<JCCompilationUnit> runLastRound(PrintWriter xout,
-                                                 int roundNumber,
-                                                 boolean errorStatus,
-                                                 JavaCompiler compiler,
-                                                 List<JCCompilationUnit> roots,
-                              TaskListener taskListener) throws IOException {
-        roundNumber++;
-        List<ClassSymbol> noTopLevelClasses = List.nil();
-        Set<TypeElement> noAnnotations =  Collections.emptySet();
-        printRoundInfo(xout, roundNumber, noTopLevelClasses, noAnnotations, true);
-
-        Set<Element> emptyRootElements = Collections.emptySet(); // immutable
-        RoundEnvironment renv = new JavacRoundEnvironment(true,
-                                                          errorStatus,
-                                                          emptyRootElements,
-                                                          JavacProcessingEnvironment.this);
-        if (taskListener != null)
-            taskListener.started(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING_ROUND));
-
-        try {
-            discoveredProcs.iterator().runContributingProcs(renv);
-        } finally {
-            if (taskListener != null)
-                taskListener.finished(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING_ROUND));
-        }
-
-        // Add any sources generated during the last round to the set
-        // of files to be compiled.
-        if (moreToDo()) {
-            List<JCCompilationUnit> parsedFiles = sourcesToParsedFiles(compiler);
-            roots = cleanTrees(roots).appendList(parsedFiles);
-        }
-
-        return roots;
-    }
-
-    private void updateProcessingState(Context currentContext, boolean lastRound) {
-        filer.newRound(currentContext, lastRound);
-        messager.newRound(currentContext);
-
-        elementUtils.setContext(currentContext);
-        typeUtils.setContext(currentContext);
-    }
-
     private void warnIfUnmatchedOptions() {
         if (!unmatchedProcessorOptions.isEmpty()) {
             log.warning("proc.unmatched.processor.options", unmatchedProcessorOptions.toString());
         }
     }
 
-    private void printRoundInfo(PrintWriter xout,
-                                int roundNumber,
-                                List<ClassSymbol> topLevelClasses,
-                                Set<TypeElement> annotationsPresent,
-                                boolean lastRound) {
-        if (printRounds || verbose) {
-            xout.println(Log.getLocalizedString("x.print.rounds",
-                                                roundNumber,
-                                                "{" + topLevelClasses.toString(", ") + "}",
-                                                annotationsPresent,
-                                                lastRound));
-        }
-    }
-
-    private List<ClassSymbol> enterNewClassFiles(Context currentContext) {
-        ClassReader reader = ClassReader.instance(currentContext);
-        Names names = Names.instance(currentContext);
-        List<ClassSymbol> list = List.nil();
-
-        for (Map.Entry<String,JavaFileObject> entry : filer.getGeneratedClasses().entrySet()) {
-            Name name = names.fromString(entry.getKey());
-            JavaFileObject file = entry.getValue();
-            if (file.getKind() != JavaFileObject.Kind.CLASS)
-                throw new AssertionError(file);
-            ClassSymbol cs;
-            if (isPkgInfo(file, JavaFileObject.Kind.CLASS)) {
-                Name packageName = Convert.packagePart(name);
-                PackageSymbol p = reader.enterPackage(packageName);
-                if (p.package_info == null)
-                    p.package_info = reader.enterClass(Convert.shortName(name), p);
-                cs = p.package_info;
-                if (cs.classfile == null)
-                    cs.classfile = file;
-            } else
-                cs = reader.enterClass(name, file);
-            list = list.prepend(cs);
-        }
-        return list.reverse();
-    }
-
     /**
      * Free resources related to annotation processing.
      */
@@ -1126,6 +1222,11 @@
         return packages.reverse();
     }
 
+    // avoid unchecked warning from use of varargs
+    private static <T> List<T> join(List<T> list1, List<T> list2) {
+        return list1.appendList(list2);
+    }
+
     private boolean isPkgInfo(JavaFileObject fo, JavaFileObject.Kind kind) {
         return fo.isNameCompatible("package-info", kind);
     }
@@ -1134,62 +1235,6 @@
         return isPkgInfo(sym.classfile, JavaFileObject.Kind.CLASS) && (sym.packge().package_info == sym);
     }
 
-    private Context contextForNextRound(Context context, boolean shareNames)
-        throws IOException
-    {
-        Context next = new Context();
-
-        Options options = Options.instance(context);
-        assert options != null;
-        next.put(Options.optionsKey, options);
-
-        PrintWriter out = context.get(Log.outKey);
-        assert out != null;
-        next.put(Log.outKey, out);
-
-        if (shareNames) {
-            Names names = Names.instance(context);
-            assert names != null;
-            next.put(Names.namesKey, names);
-        }
-
-        DiagnosticListener<?> dl = context.get(DiagnosticListener.class);
-        if (dl != null)
-            next.put(DiagnosticListener.class, dl);
-
-        TaskListener tl = context.get(TaskListener.class);
-        if (tl != null)
-            next.put(TaskListener.class, tl);
-
-        JavaFileManager jfm = context.get(JavaFileManager.class);
-        assert jfm != null;
-        next.put(JavaFileManager.class, jfm);
-        if (jfm instanceof JavacFileManager) {
-            ((JavacFileManager)jfm).setContext(next);
-        }
-
-        Names names = Names.instance(context);
-        assert names != null;
-        next.put(Names.namesKey, names);
-
-        Keywords keywords = Keywords.instance(context);
-        assert(keywords != null);
-        next.put(Keywords.keywordsKey, keywords);
-
-        JavaCompiler oldCompiler = JavaCompiler.instance(context);
-        JavaCompiler nextCompiler = JavaCompiler.instance(next);
-        nextCompiler.initRound(oldCompiler);
-
-        JavacTaskImpl task = context.get(JavacTaskImpl.class);
-        if (task != null) {
-            next.put(JavacTaskImpl.class, task);
-            task.updateContext(next);
-        }
-
-        context.clear();
-        return next;
-    }
-
     /*
      * Called retroactively to determine if a class loader was required,
      * after we have failed to create one.
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Aug 20 14:48:10 2010 -0400
@@ -61,6 +61,8 @@
     anonymous class implements interface; cannot have type arguments
 compiler.err.anon.class.impl.intf.no.qual.for.new=\
     anonymous class implements interface; cannot have qualifier for new
+compiler.misc.twr.not.applicable.to.type=\
+    automatic resource management not applicable to variable type
 compiler.err.array.and.varargs=\
     cannot declare both {0} and {1} in {2}
 compiler.err.array.dimension.missing=\
@@ -172,6 +174,8 @@
 
 compiler.err.final.parameter.may.not.be.assigned=\
     final parameter {0} may not be assigned
+compiler.err.twr.resource.may.not.be.assigned=\
+    automatic resource {0} may not be assigned
 compiler.err.multicatch.parameter.may.not.be.assigned=\
     multi-catch parameter {0} may not be assigned
 compiler.err.multicatch.param.must.be.final=\
@@ -448,6 +452,8 @@
     throws clause not allowed in @interface members
 compiler.err.try.without.catch.or.finally=\
     ''try'' without ''catch'' or ''finally''
+compiler.err.try.without.catch.finally.or.resource.decls=\
+    ''try'' without ''catch'', ''finally'' or resource declarations
 compiler.err.type.doesnt.take.params=\
     type {0} does not take parameters
 compiler.err.type.var.cant.be.deref=\
@@ -691,25 +697,31 @@
 compiler.warn.warning=\
     warning:\u0020
 
+## Warning messages may also include the following prefix to identify a
+## lint option
+compiler.warn.lintOption=\
+    [{0}]\u0020
+
 compiler.warn.constant.SVUID=\
-    [serial] serialVersionUID must be constant in class {0}
+    serialVersionUID must be constant in class {0}
 
 compiler.warn.dir.path.element.not.found=\
-    [path] bad path element "{0}": no such directory
+    bad path element "{0}": no such directory
 
 compiler.warn.finally.cannot.complete=\
-    [finally] finally clause cannot complete normally
+    finally clause cannot complete normally
 
 compiler.warn.has.been.deprecated=\
-    [deprecation] {0} in {1} has been deprecated
+    {0} in {1} has been deprecated
 
 compiler.warn.sun.proprietary=\
     {0} is internal proprietary API and may be removed in a future release
 
 compiler.warn.illegal.char.for.encoding=\
     unmappable character for encoding {0}
+
 compiler.warn.improper.SVUID=\
-    [serial] serialVersionUID must be declared static final in class {0}
+    serialVersionUID must be declared static final in class {0}
 
 compiler.warn.inexact.non-varargs.call=\
 non-varargs call of varargs method with inexact argument type for last parameter;\n\
@@ -717,10 +729,10 @@
 cast to {1} for a non-varargs call and to suppress this warning
 
 compiler.warn.long.SVUID=\
-    [serial] serialVersionUID must be of type long in class {0}
+    serialVersionUID must be of type long in class {0}
 
 compiler.warn.missing.SVUID=\
-    [serial] serializable class {0} has no definition of serialVersionUID
+    serializable class {0} has no definition of serialVersionUID
 
 compiler.warn.override.varargs.missing=\
     {0}; overridden method has no ''...''
@@ -731,13 +743,15 @@
 
 compiler.warn.pkg-info.already.seen=\
     a package-info.java file has already been seen for package {0}
+
 compiler.warn.path.element.not.found=\
-    [path] bad path element "{0}": no such file or directory
+    bad path element "{0}": no such file or directory
+
 compiler.warn.possible.fall-through.into.case=\
-    [fallthrough] possible fall-through into case
+    possible fall-through into case
 
 compiler.warn.redundant.cast=\
-    [cast] redundant cast to {0}
+    redundant cast to {0}
 
 compiler.warn.position.overflow=\
     Position encoding overflows at line {0}
@@ -747,7 +761,7 @@
     It is recommended that the compiler be upgraded.
 
 compiler.warn.static.not.qualified.by.type=\
-    [static] static {0} should be qualified by type name, {1}, instead of by an expression
+    static {0} should be qualified by type name, {1}, instead of by an expression
 
 # Warnings related to annotation processing
 compiler.warn.proc.package.does.not.exist=\
@@ -764,6 +778,9 @@
 compiler.warn.proc.illegal.file.name=\
     Cannot create file for illegal name ''{0}''.
 
+compiler.warn.proc.suspicious.class.name=\
+    Creating file for a type whose name ends in {1}: ''{0}''
+
 compiler.warn.proc.file.create.last.round=\
     File for type ''{0}'' created in the last round will not be subject to annotation processing.
 
@@ -797,39 +814,43 @@
 compiler.warn.proc.unmatched.processor.options=\
     The following options were not recognized by any processor: ''{0}''
 
+compiler.warn.twr.explicit.close.call=\
+    [arm] explicit call to close() on an automatic resource
+compiler.warn.automatic.resource.not.referenced=\
+    [arm] automatic resource {0} is never referenced in body of corresponding try statement
 compiler.warn.unchecked.assign=\
-    [unchecked] unchecked assignment: {0} to {1}
+    unchecked assignment: {0} to {1}
 compiler.warn.unchecked.assign.to.var=\
-    [unchecked] unchecked assignment to variable {0} as member of raw type {1}
+    unchecked assignment to variable {0} as member of raw type {1}
 compiler.warn.unchecked.call.mbr.of.raw.type=\
-    [unchecked] unchecked call to {0} as a member of the raw type {1}
+    unchecked call to {0} as a member of the raw type {1}
 compiler.warn.unchecked.cast.to.type=\
-    [unchecked] unchecked cast to type {0}
+    unchecked cast to type {0}
 compiler.warn.unchecked.meth.invocation.applied=\
-    [unchecked] unchecked method invocation: {0} {1} in {4} {5} is applied to given types\n\
+    unchecked method invocation: {0} {1} in {4} {5} is applied to given types\n\
     required: {2}\n\
     found: {3}
 
 compiler.warn.unchecked.generic.array.creation=\
-    [unchecked] unchecked generic array creation for varargs parameter of type {0}
+    unchecked generic array creation for varargs parameter of type {0}
 
 compiler.warn.varargs.non.reifiable.type=\
-    [varargs] Possible heap pollution from parameterized vararg type {0}
+    Possible heap pollution from parameterized vararg type {0}
 
 compiler.warn.missing.deprecated.annotation=\
-    [dep-ann] deprecated item is not annotated with @Deprecated
+    deprecated item is not annotated with @Deprecated
 
 compiler.warn.invalid.archive.file=\
-    [path] Unexpected file on path: {0}
+    Unexpected file on path: {0}
 
 compiler.warn.unexpected.archive.file=\
-    [path] Unexpected extension for archive file: {0}
+    Unexpected extension for archive file: {0}
 
 compiler.warn.div.zero=\
-    [divzero] division by zero
+    division by zero
 
 compiler.warn.empty.if=\
-    [empty] empty statement after if
+    empty statement after if
 
 compiler.warn.annotation.method.not.found=\
     Cannot find annotation method ''{1}()'' in type ''{0}''
@@ -838,7 +859,7 @@
     Cannot find annotation method ''{1}()'' in type ''{0}'': {2}
 
 compiler.warn.raw.class.use=\
-    [rawtypes] found raw type: {0}\n\
+    found raw type: {0}\n\
     missing type parameters for generic class {1}
 
 #####
@@ -996,13 +1017,13 @@
     possible loss of precision
 
 compiler.misc.unchecked.assign=\
-    [unchecked] unchecked conversion
+    unchecked conversion
 # compiler.misc.storecheck=\
-#     [unchecked] assignment might cause later store checks to fail
+#     assignment might cause later store checks to fail
 # compiler.misc.unchecked=\
-#     [unchecked] assigned array cannot dynamically check its stores
+#     assigned array cannot dynamically check its stores
 compiler.misc.unchecked.cast.to.type=\
-    [unchecked] unchecked cast
+    unchecked cast
 
 compiler.misc.assignment.from.super-bound=\
     assignment from super-bound type {0}
@@ -1172,11 +1193,11 @@
     return type {1} is not compatible with {2}
 
 compiler.warn.override.unchecked.ret=\
-    [unchecked] {0}\n\
+    {0}\n\
     return type requires unchecked conversion from {1} to {2}
 
 compiler.warn.override.unchecked.thrown=\
-    [unchecked] {0}\n\
+    {0}\n\
     overridden method does not throw {1}
 
 ## The following are all possible strings for the first argument ({0}) of the
@@ -1217,6 +1238,10 @@
     underscores in literals are not supported in -source {0}\n\
 (use -source 7 or higher to enable underscores in literals)
 
+compiler.err.automatic.resource.management.not.supported.in.source=\
+    automatic resource management is not supported in -source {0}\n\
+(use -source 7 or higher to enable automatic resource management)
+
 compiler.warn.enum.as.identifier=\
     as of release 5, ''enum'' is a keyword, and may not be used as an identifier\n\
 (use -source 5 or higher to use ''enum'' as a keyword)
@@ -1263,7 +1288,7 @@
 
 compiler.err.diamond.not.supported.in.source=\
     diamond operator is not supported in -source {0}\n\
-(use -source 7 or higher to enable multi-catch statement)
+(use -source 7 or higher to enable diamond operator)
 
 compiler.err.multicatch.not.supported.in.source=\
     multi-catch statement is not supported in -source {0}\n\
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1021,10 +1021,15 @@
         public JCBlock body;
         public List<JCCatch> catchers;
         public JCBlock finalizer;
-        protected JCTry(JCBlock body, List<JCCatch> catchers, JCBlock finalizer) {
+        public List<JCTree> resources;
+        protected JCTry(List<JCTree> resources,
+                        JCBlock body,
+                        List<JCCatch> catchers,
+                        JCBlock finalizer) {
             this.body = body;
             this.catchers = catchers;
             this.finalizer = finalizer;
+            this.resources = resources;
         }
         @Override
         public void accept(Visitor v) { v.visitTry(this); }
@@ -1040,6 +1045,10 @@
             return v.visitTry(this, d);
         }
         @Override
+        public List<? extends JCTree> getResources() {
+            return resources;
+        }
+        @Override
         public int getTag() {
             return TRY;
         }
@@ -2162,6 +2171,10 @@
         JCCase Case(JCExpression pat, List<JCStatement> stats);
         JCSynchronized Synchronized(JCExpression lock, JCBlock body);
         JCTry Try(JCBlock body, List<JCCatch> catchers, JCBlock finalizer);
+        JCTry Try(List<JCTree> resources,
+                  JCBlock body,
+                  List<JCCatch> catchers,
+                  JCBlock finalizer);
         JCCatch Catch(JCVariableDecl param, JCBlock body);
         JCConditional Conditional(JCExpression cond,
                                 JCExpression thenpart,
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Fri Aug 20 14:48:10 2010 -0400
@@ -691,6 +691,19 @@
     public void visitTry(JCTry tree) {
         try {
             print("try ");
+            if (tree.resources.nonEmpty()) {
+                print("(");
+                boolean first = true;
+                for (JCTree var : tree.resources) {
+                    if (!first) {
+                        println();
+                        indent();
+                    }
+                    printStat(var);
+                    first = false;
+                }
+                print(") ");
+            }
             printStat(tree.body);
             for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) {
                 printStat(l.head);
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Fri Aug 20 14:48:10 2010 -0400
@@ -332,10 +332,11 @@
 
     public JCTree visitTry(TryTree node, P p) {
         JCTry t = (JCTry) node;
+        List<JCTree> resources = copy(t.resources, p);
         JCBlock body = copy(t.body, p);
         List<JCCatch> catchers = copy(t.catchers, p);
         JCBlock finalizer = copy(t.finalizer, p);
-        return M.at(t.pos).Try(body, catchers, finalizer);
+        return M.at(t.pos).Try(resources, body, catchers, finalizer);
     }
 
     public JCTree visitParameterizedType(ParameterizedTypeTree node, P p) {
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Fri Aug 20 14:48:10 2010 -0400
@@ -269,7 +269,14 @@
     }
 
     public JCTry Try(JCBlock body, List<JCCatch> catchers, JCBlock finalizer) {
-        JCTry tree = new JCTry(body, catchers, finalizer);
+        return Try(List.<JCTree>nil(), body, catchers, finalizer);
+    }
+
+    public JCTry Try(List<JCTree> resources,
+                     JCBlock body,
+                     List<JCCatch> catchers,
+                     JCBlock finalizer) {
+        JCTry tree = new JCTry(resources, body, catchers, finalizer);
         tree.pos = pos;
         return tree;
     }
@@ -486,7 +493,7 @@
 
     public JCModifiers Modifiers(long flags, List<JCAnnotation> annotations) {
         JCModifiers tree = new JCModifiers(flags, annotations);
-        boolean noFlags = (flags & Flags.ModifierFlags) == 0;
+        boolean noFlags = (flags & (Flags.ModifierFlags | Flags.ANNOTATION)) == 0;
         tree.pos = (noFlags && annotations.isEmpty()) ? Position.NOPOS : pos;
         return tree;
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java	Fri Aug 20 14:48:10 2010 -0400
@@ -147,6 +147,7 @@
     }
 
     public void visitTry(JCTry tree) {
+        scan(tree.resources);
         scan(tree.body);
         scan(tree.catchers);
         scan(tree.finalizer);
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java	Fri Aug 20 14:48:10 2010 -0400
@@ -212,6 +212,7 @@
     }
 
     public void visitTry(JCTry tree) {
+        tree.resources = translate(tree.resources);
         tree.body = translate(tree.body);
         tree.catchers = translateCatchers(tree.catchers);
         tree.finalizer = translate(tree.finalizer);
--- a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Fri Aug 20 14:48:10 2010 -0400
@@ -38,6 +38,7 @@
 import com.sun.tools.javac.api.DiagnosticFormatter.Configuration.MultilineLimit;
 import com.sun.tools.javac.api.DiagnosticFormatter.PositionKind;
 import com.sun.tools.javac.api.Formattable;
+import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.code.Printer;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Type;
@@ -285,6 +286,13 @@
         return buf.toString();
     }
 
+    protected String formatLintCategory(JCDiagnostic d, Locale l) {
+        LintCategory lc = d.getLintCategory();
+        if (lc == null)
+            return "";
+        return localize(l, "compiler.warn.lintOption", lc.option);
+    }
+
     /**
      * Converts a String into a locale-dependent representation accordingly to a given locale.
      *
--- a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractLog.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractLog.java	Fri Aug 20 14:48:10 2010 -0400
@@ -29,6 +29,7 @@
 import java.util.Map;
 import javax.tools.JavaFileObject;
 
+import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition;
 
@@ -112,6 +113,16 @@
         report(diags.warning(source, null, key, args));
     }
 
+    /** Report a lint warning, unless suppressed by the  -nowarn option or the
+     *  maximum number of warnings has been reached.
+     *  @param lc     The lint category for the diagnostic
+     *  @param key    The key for the localized warning message.
+     *  @param args   Fields of the warning message.
+     */
+    public void warning(LintCategory lc, String key, Object ... args) {
+        report(diags.warning(lc, key, args));
+    }
+
     /** Report a warning, unless suppressed by the  -nowarn option or the
      *  maximum number of warnings has been reached.
      *  @param pos    The source position at which to report the warning.
@@ -122,6 +133,17 @@
         report(diags.warning(source, pos, key, args));
     }
 
+    /** Report a lint warning, unless suppressed by the  -nowarn option or the
+     *  maximum number of warnings has been reached.
+     *  @param lc     The lint category for the diagnostic
+     *  @param pos    The source position at which to report the warning.
+     *  @param key    The key for the localized warning message.
+     *  @param args   Fields of the warning message.
+     */
+    public void warning(LintCategory lc, DiagnosticPosition pos, String key, Object ... args) {
+        report(diags.warning(lc, source, pos, key, args));
+    }
+
     /** Report a warning, unless suppressed by the  -nowarn option or the
      *  maximum number of warnings has been reached.
      *  @param pos    The source position at which to report the warning.
@@ -141,6 +163,16 @@
         report(diags.mandatoryWarning(source, pos, key, args));
     }
 
+    /** Report a warning.
+     *  @param lc     The lint category for the diagnostic
+     *  @param pos    The source position at which to report the warning.
+     *  @param key    The key for the localized warning message.
+     *  @param args   Fields of the warning message.
+     */
+    public void mandatoryWarning(LintCategory lc, DiagnosticPosition pos, String key, Object ... args) {
+        report(diags.mandatoryWarning(lc, source, pos, key, args));
+    }
+
     /** Provide a non-fatal notification, unless suppressed by the -nowarn option.
      *  @param key    The key for the localized notification message.
      *  @param args   Fields of the notint an error or warning message:
--- a/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Fri Aug 20 14:48:10 2010 -0400
@@ -73,7 +73,6 @@
      * @param opts list of command-line options
      * @param msgs JavacMessages object used for i18n
      */
-    @SuppressWarnings("fallthrough")
     public BasicDiagnosticFormatter(Options options, JavacMessages msgs) {
         super(msgs, new BasicConfiguration(options));
     }
@@ -189,6 +188,8 @@
             }
             case 'm':
                 return formatMessage(d, l);
+            case 'L':
+                return formatLintCategory(d, l);
             case '_':
                 return " ";
             case '%':
@@ -244,9 +245,9 @@
                         setFormat(BasicFormatKind.DEFAULT_POS_FORMAT, formats[0]);
                 }
             }
-            String sourcePosition = null;
-            if ((((sourcePosition = options.get("sourcePosition")) != null)) &&
-                    sourcePosition.equals("bottom"))
+            String srcPos = null;
+            if ((((srcPos = options.get("sourcePosition")) != null)) &&
+                    srcPos.equals("bottom"))
                     setSourcePosition(SourcePosition.BOTTOM);
             else
                 setSourcePosition(SourcePosition.AFTER_SUMMARY);
@@ -289,9 +290,9 @@
         //where
         private void initFormat() {
             availableFormats = new HashMap<BasicFormatKind, String>();
-            setFormat(BasicFormatKind.DEFAULT_POS_FORMAT, "%f:%l:%_%t%m");
-            setFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT, "%p%m");
-            setFormat(BasicFormatKind.DEFAULT_CLASS_FORMAT, "%f:%_%t%m");
+            setFormat(BasicFormatKind.DEFAULT_POS_FORMAT, "%f:%l:%_%t%L%m");
+            setFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT, "%p%L%m");
+            setFormat(BasicFormatKind.DEFAULT_CLASS_FORMAT, "%f:%_%t%L%m");
         }
         //where
         private void initIndentation() {
--- a/langtools/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Fri Aug 20 14:48:10 2010 -0400
@@ -32,6 +32,7 @@
 import javax.tools.JavaFileObject;
 
 import com.sun.tools.javac.api.DiagnosticFormatter;
+import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.tree.JCTree;
 
 import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*;
@@ -82,86 +83,143 @@
          */
         public JCDiagnostic error(
                 DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
-            return create(ERROR, true, source, pos, key, args);
+            return create(ERROR, null, true, source, pos, key, args);
         }
 
         /**
          * Create a warning diagnostic that will not be hidden by the -nowarn or -Xlint:none options.
          *  @param source The source of the compilation unit, if any, in which to report the warning.
          *  @param pos    The source position at which to report the warning.
-         *  @param key    The key for the localized error message.
-         *  @param args   Fields of the error message.
+         *  @param key    The key for the localized warning message.
+         *  @param args   Fields of the warning message.
          *  @see MandatoryWarningHandler
          */
         public JCDiagnostic mandatoryWarning(
-                 DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
-            return create(WARNING, true, source, pos, key, args);
+                DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
+            return create(WARNING, null, true, source, pos, key, args);
+        }
+
+        /**
+         * Create a warning diagnostic that will not be hidden by the -nowarn or -Xlint:none options.
+         *  @param lc     The lint category for the diagnostic
+         *  @param source The source of the compilation unit, if any, in which to report the warning.
+         *  @param pos    The source position at which to report the warning.
+         *  @param key    The key for the localized warning message.
+         *  @param args   Fields of the warning message.
+         *  @see MandatoryWarningHandler
+         */
+        public JCDiagnostic mandatoryWarning(
+                LintCategory lc,
+                DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
+            return create(WARNING, lc, true, source, pos, key, args);
+        }
+
+        /**
+         * Create a warning diagnostic.
+         *  @param lc     The lint category for the diagnostic
+         *  @param key    The key for the localized error message.
+         *  @param args   Fields of the warning message.
+         *  @see MandatoryWarningHandler
+         */
+        public JCDiagnostic warning(
+                 LintCategory lc, String key, Object... args) {
+            return create(WARNING, lc, false, null, null, key, args);
         }
 
         /**
          * Create a warning diagnostic.
          *  @param source The source of the compilation unit, if any, in which to report the warning.
          *  @param pos    The source position at which to report the warning.
-         *  @param key    The key for the localized error message.
-         *  @param args   Fields of the error message.
+         *  @param key    The key for the localized warning message.
+         *  @param args   Fields of the warning message.
          */
         public JCDiagnostic warning(
                 DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
-            return create(WARNING, false, source, pos, key, args);
+            return create(WARNING, null, false, source, pos, key, args);
+        }
+
+        /**
+         * Create a warning diagnostic.
+         *  @param lc     The lint category for the diagnostic
+         *  @param source The source of the compilation unit, if any, in which to report the warning.
+         *  @param pos    The source position at which to report the warning.
+         *  @param key    The key for the localized warning message.
+         *  @param args   Fields of the warning message.
+         *  @see MandatoryWarningHandler
+         */
+        public JCDiagnostic warning(
+                 LintCategory lc, DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
+            return create(WARNING, lc, false, source, pos, key, args);
         }
 
         /**
          * Create a note diagnostic that will not be hidden by the -nowarn or -Xlint:none options.
-         *  @param key    The key for the localized error message.
-         *  @param args   Fields of the error message.
+         *  @param key    The key for the localized message.
+         *  @param args   Fields of the message.
          *  @see MandatoryWarningHandler
          */
         public JCDiagnostic mandatoryNote(DiagnosticSource source, String key, Object... args) {
-            return create(NOTE, true, source, null, key, args);
+            return create(NOTE, null, true, source, null, key, args);
         }
 
         /**
          * Create a note diagnostic.
          *  @param key    The key for the localized error message.
-         *  @param args   Fields of the error message.
+         *  @param args   Fields of the message.
          */
         public JCDiagnostic note(String key, Object... args) {
-            return create(NOTE, false, null, null, key, args);
+            return create(NOTE, null, false, null, null, key, args);
         }
 
         /**
          * Create a note diagnostic.
          *  @param source The source of the compilation unit, if any, in which to report the note.
          *  @param pos    The source position at which to report the note.
-         *  @param key    The key for the localized error message.
-         *  @param args   Fields of the error message.
+         *  @param key    The key for the localized message.
+         *  @param args   Fields of the message.
          */
         public JCDiagnostic note(
                 DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
-            return create(NOTE, false, source, pos, key, args);
+            return create(NOTE, null, false, source, pos, key, args);
         }
 
         /**
          * Create a fragment diagnostic, for use as an argument in other diagnostics
-         *  @param key    The key for the localized error message.
-         *  @param args   Fields of the error message.
+         *  @param key    The key for the localized message.
+         *  @param args   Fields of the message.
          */
         public JCDiagnostic fragment(String key, Object... args) {
-            return create(FRAGMENT, false, null, null, key, args);
+            return create(FRAGMENT, null, false, null, null, key, args);
+        }
+
+        /**
+         * Create a new diagnostic of the given kind, which is not mandatory and which has
+         * no lint category.
+         *  @param kind        The diagnostic kind
+         *  @param ls          The lint category, if applicable, or null
+         *  @param source      The source of the compilation unit, if any, in which to report the message.
+         *  @param pos         The source position at which to report the message.
+         *  @param key         The key for the localized message.
+         *  @param args        Fields of the message.
+         */
+        public JCDiagnostic create(
+                DiagnosticType kind, DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
+            return create(kind, null, false, source, pos, key, args);
         }
 
         /**
          * Create a new diagnostic of the given kind.
          *  @param kind        The diagnostic kind
+         *  @param lc          The lint category, if applicable, or null
          *  @param isMandatory is diagnostic mandatory?
-         *  @param source      The source of the compilation unit, if any, in which to report the note.
-         *  @param pos         The source position at which to report the note.
-         *  @param key         The key for the localized error message.
-         *  @param args        Fields of the error message.
+         *  @param source      The source of the compilation unit, if any, in which to report the message.
+         *  @param pos         The source position at which to report the message.
+         *  @param key         The key for the localized message.
+         *  @param args        Fields of the message.
          */
         public JCDiagnostic create(
-                DiagnosticType kind, boolean isMandatory, DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
-            return new JCDiagnostic(formatter, kind, isMandatory, source, pos, qualify(kind, key), args);
+                DiagnosticType kind, LintCategory lc, boolean isMandatory, DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
+            return new JCDiagnostic(formatter, kind, lc, isMandatory, source, pos, qualify(kind, key), args);
         }
 
         protected String qualify(DiagnosticType t, String key) {
@@ -181,6 +239,7 @@
     public static JCDiagnostic fragment(String key, Object... args) {
         return new JCDiagnostic(getFragmentFormatter(),
                               FRAGMENT,
+                              null,
                               false,
                               null,
                               null,
@@ -274,30 +333,34 @@
     private final int line;
     private final int column;
     private final String key;
-    protected Object[] args;
-    private boolean mandatory;
+    protected final Object[] args;
+    private final boolean mandatory;
+    private final LintCategory lintCategory;
 
     /**
      * Create a diagnostic object.
-     * @param messages the resource for localized messages
+     * @param fomatter the formatter to use for the diagnostic
      * @param dt the type of diagnostic
-     * @param name the name of the source file, or null if none.
+     * @param lc     the lint category for the diagnostic
+     * @param source the name of the source file, or null if none.
      * @param pos the character offset within the source file, if given.
      * @param key a resource key to identify the text of the diagnostic
      * @param args arguments to be included in the text of the diagnostic
      */
     protected JCDiagnostic(DiagnosticFormatter<JCDiagnostic> formatter,
                        DiagnosticType dt,
+                       LintCategory lc,
                        boolean mandatory,
                        DiagnosticSource source,
                        DiagnosticPosition pos,
                        String key,
-                       Object ... args) {
+                       Object... args) {
         if (source == null && pos != null && pos.getPreferredPosition() != Position.NOPOS)
             throw new IllegalArgumentException();
 
         this.defaultFormatter = formatter;
         this.type = dt;
+        this.lintCategory = lc;
         this.mandatory = mandatory;
         this.source = source;
         this.position = pos;
@@ -342,6 +405,20 @@
     }
 
     /**
+     * Check whether this diagnostic has an associated lint category.
+     */
+    public boolean hasLintCategory() {
+        return (lintCategory != null);
+    }
+
+    /**
+     * Get the associated lint category, or null if none.
+     */
+    public LintCategory getLintCategory() {
+        return lintCategory;
+    }
+
+    /**
      * Get the name of the source file referred to by this diagnostic.
      * @return the name of the source referred to with this diagnostic, or null if none
      */
@@ -467,6 +544,7 @@
         public MultilineDiagnostic(JCDiagnostic other, List<JCDiagnostic> subdiagnostics) {
             super(other.defaultFormatter,
                   other.getType(),
+                  other.getLintCategory(),
                   other.isMandatory(),
                   other.getDiagnosticSource(),
                   other.position,
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java	Fri Aug 20 14:48:10 2010 -0400
@@ -269,7 +269,7 @@
      */
     public void prompt() {
         if (promptOnError) {
-            System.err.println(getLocalizedString("resume.abort"));
+            System.err.println(localize("resume.abort"));
             char ch;
             try {
                 while (true) {
@@ -317,8 +317,23 @@
         if (msg.length() != 0) writer.println(msg);
     }
 
+    /** Print the text of a message to the errWriter stream,
+     *  translating newlines appropriately for the platform.
+     */
+    public void printErrLines(String key, Object... args) {
+        printLines(errWriter, localize(key, args));
+    }
+
+
+    /** Print the text of a message to the noticeWriter stream,
+     *  translating newlines appropriately for the platform.
+     */
+    public void printNoteLines(String key, Object... args) {
+        printLines(noticeWriter, localize(key, args));
+    }
+
     protected void directError(String key, Object... args) {
-        printLines(errWriter, getLocalizedString(key, args));
+        printErrLines(key, args);
         errWriter.flush();
     }
 
@@ -426,6 +441,8 @@
     }
 
     /** Find a localized string in the resource bundle.
+     *  Because this method is static, it ignores the locale.
+     *  Use localize(key, args) when possible.
      *  @param key    The key for the localized string.
      *  @param args   Fields to substitute into the string.
      */
@@ -433,6 +450,14 @@
         return JavacMessages.getDefaultLocalizedString("compiler.misc." + key, args);
     }
 
+    /** Find a localized string in the resource bundle.
+     *  @param key    The key for the localized string.
+     *  @param args   Fields to substitute into the string.
+     */
+    public String localize(String key, Object... args) {
+        return messages.getLocalizedString("compiler.misc." + key, args);
+    }
+
 /***************************************************************************
  * raw error messages without internationalization; used for experimentation
  * and quick prototyping
--- a/langtools/src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java	Fri Aug 20 14:48:10 2010 -0400
@@ -29,6 +29,7 @@
 import java.util.Set;
 import javax.tools.JavaFileObject;
 
+import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 
 
@@ -105,13 +106,16 @@
      *                True if mandatory warnings and notes are being enforced.
      * @param prefix  A common prefix for the set of message keys for
      *                the messages that may be generated.
+     * @param lc      An associated lint category for the warnings, or null if none.
      */
     public MandatoryWarningHandler(Log log, boolean verbose,
-                                   boolean enforceMandatory, String prefix) {
+                                   boolean enforceMandatory, String prefix,
+                                   LintCategory lc) {
         this.log = log;
         this.verbose = verbose;
         this.prefix = prefix;
         this.enforceMandatory = enforceMandatory;
+        this.lintCategory = lc;
     }
 
     /**
@@ -235,15 +239,22 @@
     private final boolean enforceMandatory;
 
     /**
+     * A LintCategory to be included in point-of-use diagnostics to indicate
+     * how messages might be suppressed (i.e. with @SuppressWarnings).
+     */
+    private final LintCategory lintCategory;
+
+    /**
      * Reports a mandatory warning to the log.  If mandatory warnings
      * are not being enforced, treat this as an ordinary warning.
      */
     private void logMandatoryWarning(DiagnosticPosition pos, String msg,
                                      Object... args) {
+        // Note: the following log methods are safe if lintCategory is null.
         if (enforceMandatory)
-            log.mandatoryWarning(pos, msg, args);
+            log.mandatoryWarning(lintCategory, pos, msg, args);
         else
-            log.warning(pos, msg, args);
+            log.warning(lintCategory, pos, msg, args);
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Names.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Names.java	Fri Aug 20 14:48:10 2010 -0400
@@ -148,6 +148,8 @@
     public final Name getDeclaringClass;
     public final Name ex;
     public final Name finalize;
+    public final Name java_lang_AutoCloseable;
+    public final Name close;
 
     public final Name.Table table;
 
@@ -263,6 +265,9 @@
         getDeclaringClass = fromString("getDeclaringClass");
         ex = fromString("ex");
         finalize = fromString("finalize");
+
+        java_lang_AutoCloseable = fromString("java.lang.AutoCloseable");
+        close = fromString("close");
     }
 
     protected Name.Table createTable(Options options) {
--- a/langtools/test/tools/javac/4980495/static/Test.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/4980495/static/Test.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,7 +1,7 @@
 /*
  * @test  /nodynamiccopyright/
  * @bug 4980495 6260444
- * @compile/fail/ref=Test.out -XDstdout -XDrawDiagnostics Test.java p1/A1.java p2/A2.java
+ * @compile/fail/ref=Test.out -XDrawDiagnostics Test.java p1/A1.java p2/A2.java
  */
 
 package p;
--- a/langtools/test/tools/javac/4980495/std/Test.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/4980495/std/Test.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,7 +1,7 @@
 /*
  * @test  /nodynamiccopyright/
  * @bug 4980495 6260444
- * @compile/fail/ref=Test.out -XDstdout -XDrawDiagnostics Test.java p1/A1.java p2/A2.java
+ * @compile/fail/ref=Test.out -XDrawDiagnostics Test.java p1/A1.java p2/A2.java
  *
  */
 
--- a/langtools/test/tools/javac/6304921/T6304921.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/6304921/T6304921.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,7 +1,7 @@
 /*
  * @test (important: no SCCS keywords to affect offsets in golden file.)  /nodynamiccopyright/
  * @bug 6304921
- * @compile/fail/ref=T6304921.out -XDstdout -XDcompilePolicy=bytodo -XDrawDiagnostics -Xjcov -Xlint:all,-path -Werror T6304921.java
+ * @compile/fail/ref=T6304921.out -XDcompilePolicy=bytodo -XDrawDiagnostics -Xjcov -Xlint:all,-path -Werror T6304921.java
  */
 
 import java.util.ArrayList;
--- a/langtools/test/tools/javac/6330920/T6330920.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/6330920/T6330920.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug     6330920
  * @summary Verify that javac doesn't duplicate method error on method with error
  * @author  Peter von der Ah\u00e9
- * @compile/fail/ref=T6330920.out -XDstdout -XDrawDiagnostics T6330920.java
+ * @compile/fail/ref=T6330920.out -XDrawDiagnostics T6330920.java
  */
 
 public class T6330920 {
--- a/langtools/test/tools/javac/6491592/T6491592.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/6491592/T6491592.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug     6491592
  * @summary Compiler crashes on assignment operator
  * @author  alex.buckley@...
- * @compile/fail/ref=T6491592.out -XDstdout -XDrawDiagnostics T6491592.java
+ * @compile/fail/ref=T6491592.out -XDrawDiagnostics T6491592.java
  */
 
 public class T6491592 {
--- a/langtools/test/tools/javac/6717241/T6717241a.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/6717241/T6717241a.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug     6717241
  * @summary some diagnostic argument is prematurely converted into a String object
  * @author  Maurizio Cimadamore
- * @compile/fail/ref=T6717241a.out -XDstdout -XDrawDiagnostics T6717241a.java
+ * @compile/fail/ref=T6717241a.out -XDrawDiagnostics T6717241a.java
  */
 
 class T6717241a<X extends Object & java.io.Serializable> {
--- a/langtools/test/tools/javac/6717241/T6717241b.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/6717241/T6717241b.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug     6717241
  * @summary some diagnostic argument is prematurely converted into a String object
  * @author  Maurizio Cimadamore
- * @compile/fail/ref=T6717241b.out -XDstdout -XDrawDiagnostics T6717241b.java
+ * @compile/fail/ref=T6717241b.out -XDrawDiagnostics T6717241b.java
  */
 
 class T6717241b {
--- a/langtools/test/tools/javac/ClassFileModifiers/ClassModifiers.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/ClassFileModifiers/ClassModifiers.java	Fri Aug 20 14:48:10 2010 -0400
@@ -28,7 +28,7 @@
  * file are correct, including those within InnerClasses attributes.
  * @author John Rose (jrose). Entered as a regression test by Bill Maddox (maddox).
  *
- * @compile/ref=ClassModifiers.out -XDstdout  -XDdumpmodifiers=ci ClassModifiers.java
+ * @compile/ref=ClassModifiers.out  -XDdumpmodifiers=ci ClassModifiers.java
  *
  */
 
--- a/langtools/test/tools/javac/ClassFileModifiers/MemberModifiers.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/ClassFileModifiers/MemberModifiers.java	Fri Aug 20 14:48:10 2010 -0400
@@ -26,7 +26,7 @@
  * @bug 4249112 4785453
  * @summary Verify that implicit member modifiers are set correctly.
  *
- * @compile/ref=MemberModifiers.out -XDstdout  -source 1.4 -target 1.4.2 -XDdumpmodifiers=cfm MemberModifiers.java
+ * @compile/ref=MemberModifiers.out  -source 1.4 -target 1.4.2 -XDdumpmodifiers=cfm MemberModifiers.java
  */
 
 // Currently, we check only that members of final classes are not final.
--- a/langtools/test/tools/javac/CyclicInheritance.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/CyclicInheritance.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary Test that recursive 'extends' and 'implements' clauses are detected
  * and disallowed.
  *
- * @compile/fail/ref=CyclicInheritance.out -XDrawDiagnostics -XDstdout CyclicInheritance.java
+ * @compile/fail/ref=CyclicInheritance.out -XDrawDiagnostics CyclicInheritance.java
  */
 
 
--- a/langtools/test/tools/javac/Digits.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/Digits.java	Fri Aug 20 14:48:10 2010 -0400
@@ -2,7 +2,7 @@
  * @test  /nodynamiccopyright/
  * @bug 6183529
  * @summary javac gives warnings instead of errors on non-ASCII digits
- * @compile/fail/ref=Digits.out -XDstdout -XDrawDiagnostics Digits.java
+ * @compile/fail/ref=Digits.out -XDrawDiagnostics Digits.java
  */
 
 class Digits
--- a/langtools/test/tools/javac/ExtendArray.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/ExtendArray.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug 4336282 4785453
  * @summary Verify that extending an erray class does not crash the compiler.
  *
- * @compile/fail/ref=ExtendArray.out -XDstdout -XDrawDiagnostics ExtendArray.java
+ * @compile/fail/ref=ExtendArray.out -XDrawDiagnostics ExtendArray.java
  */
 
 // Note that an error is expected, but not a crash.
--- a/langtools/test/tools/javac/ExtendsAccess/ExtendsAccess.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/ExtendsAccess/ExtendsAccess.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug 4087314 4087314 4785453
  * @summary Test access checking within 'extends' and 'implements' clause.
  * @author William Maddox (maddox)
- * @compile/fail/ref=ExtendsAccess.out -XDrawDiagnostics -XDstdout ExtendsAccess.java
+ * @compile/fail/ref=ExtendsAccess.out -XDrawDiagnostics ExtendsAccess.java
  */
 
 /*
--- a/langtools/test/tools/javac/FloatingPointChanges/BadConstructorModifiers.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/FloatingPointChanges/BadConstructorModifiers.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary strictfp may not be used with constructors
  * @author David Stoutamire (dps)
  *
- * @compile/fail/ref=BadConstructorModifiers.out -XDrawDiagnostics -XDstdout BadConstructorModifiers.java
+ * @compile/fail/ref=BadConstructorModifiers.out -XDrawDiagnostics BadConstructorModifiers.java
  */
 
 public class BadConstructorModifiers {
--- a/langtools/test/tools/javac/IllegalAnnotation.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/IllegalAnnotation.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary javac crash when declare an annotation type illegally
  *
  * @compile/fail IllegalAnnotation.java
- * @compile/fail/ref=IllegalAnnotation.out -XDdev -XDrawDiagnostics -XDstdout IllegalAnnotation.java
+ * @compile/fail/ref=IllegalAnnotation.out -XDdev -XDrawDiagnostics IllegalAnnotation.java
  */
 class IllegalAnnotation {
     {
--- a/langtools/test/tools/javac/InnerNamedConstant_2.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/InnerNamedConstant_2.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary Verify rejection of illegal static variables in inner classes.
  * @author William Maddox (maddox)
  *
- * @compile/fail/ref=InnerNamedConstant_2.out -XDrawDiagnostics -XDstdout InnerNamedConstant_2.java
+ * @compile/fail/ref=InnerNamedConstant_2.out -XDrawDiagnostics InnerNamedConstant_2.java
  */
 
 public class InnerNamedConstant_2 {
--- a/langtools/test/tools/javac/InterfaceMemberClassModifiers.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/InterfaceMemberClassModifiers.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary Verify that invalid access modifiers on interface members don't cause crash.
  * @author maddox
  *
- * @compile/fail/ref=InterfaceMemberClassModifiers.out -XDstdout -XDdiags=%b:%l:%_%m InterfaceMemberClassModifiers.java
+ * @compile/fail/ref=InterfaceMemberClassModifiers.out -XDdiags=%b:%l:%_%m InterfaceMemberClassModifiers.java
  */
 
 public interface InterfaceMemberClassModifiers {
--- a/langtools/test/tools/javac/LocalClasses_2.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/LocalClasses_2.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary Verify that a local class cannot be redefined within its scope.
  * @author William Maddox (maddox)
  *
- * @compile/fail/ref=LocalClasses_2.out -XDrawDiagnostics -XDstdout LocalClasses_2.java
+ * @compile/fail/ref=LocalClasses_2.out -XDrawDiagnostics LocalClasses_2.java
  */
 
 class LocalClasses_2 {
--- a/langtools/test/tools/javac/NameCollision.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/NameCollision.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary Interface names for classes in the same scope should not
  * cause the compiler to crash.
  *
- * @compile/fail/ref=NameCollision.out -XDrawDiagnostics -XDstdout NameCollision.java
+ * @compile/fail/ref=NameCollision.out -XDrawDiagnostics NameCollision.java
  */
 
 // The test fails if the compiler crashes.
--- a/langtools/test/tools/javac/NestedInnerClassNames.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/NestedInnerClassNames.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary Verify that an inner class cannot have the same simple name as an enclosing one.
  * @author William Maddox (maddox)
  *
- * @compile/fail/ref=NestedInnerClassNames.out -XDrawDiagnostics -XDstdout NestedInnerClassNames.java
+ * @compile/fail/ref=NestedInnerClassNames.out -XDrawDiagnostics NestedInnerClassNames.java
  */
 
 /*
--- a/langtools/test/tools/javac/NonStaticFieldExpr1.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/NonStaticFieldExpr1.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
    @author dps
    @summary field: instance access through types is not allowed
 
-   @compile/fail/ref=NonStaticFieldExpr1.out -XDrawDiagnostics -XDstdout NonStaticFieldExpr1.java
+   @compile/fail/ref=NonStaticFieldExpr1.out -XDrawDiagnostics NonStaticFieldExpr1.java
 */
 class NonStaticFieldExpr1 {
   public int x;
--- a/langtools/test/tools/javac/NonStaticFieldExpr2.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/NonStaticFieldExpr2.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
    @author dps
    @summary method: instance access through types is not allowed
 
-   @compile/fail/ref=NonStaticFieldExpr2.out -XDrawDiagnostics -XDstdout NonStaticFieldExpr2.java
+   @compile/fail/ref=NonStaticFieldExpr2.out -XDrawDiagnostics NonStaticFieldExpr2.java
 */
 
 class NonStaticFieldExpr2 {
--- a/langtools/test/tools/javac/NonStaticFieldExpr3.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/NonStaticFieldExpr3.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
    @author dps
    @summary class: instance access through types is not allowed
 
-   @compile/fail/ref=NonStaticFieldExpr3.out -XDrawDiagnostics -XDstdout NonStaticFieldExpr3.java
+   @compile/fail/ref=NonStaticFieldExpr3.out -XDrawDiagnostics NonStaticFieldExpr3.java
 */
 
 class NonStaticFieldExpr3 {
--- a/langtools/test/tools/javac/OverridePosition.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/OverridePosition.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary "attemping to assign weaker access" message doesn't give method line number
  * @author Neal Gafter
  *
- * @compile/fail/ref=OverridePosition.out -XDstdout -XDrawDiagnostics OverridePosition.java
+ * @compile/fail/ref=OverridePosition.out -XDrawDiagnostics OverridePosition.java
  */
 
 package T4524388;
--- a/langtools/test/tools/javac/QualifiedAccess/QualifiedAccess_1.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/QualifiedAccess/QualifiedAccess_1.java	Fri Aug 20 14:48:10 2010 -0400
@@ -7,7 +7,7 @@
  *
  * @compile pack1/P1.java
  * @compile pack1/P2.java
- * @compile/fail/ref=QualifiedAccess_1.out -XDrawDiagnostics -XDstdout QualifiedAccess_1.java
+ * @compile/fail/ref=QualifiedAccess_1.out -XDrawDiagnostics QualifiedAccess_1.java
  */
 
 import pack1.P1;
--- a/langtools/test/tools/javac/QualifiedAccess/QualifiedAccess_2.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/QualifiedAccess/QualifiedAccess_2.java	Fri Aug 20 14:48:10 2010 -0400
@@ -7,7 +7,7 @@
  *
  * @compile pack1/P1.java
  * @compile pack1/P2.java
- * @compile/fail/ref=QualifiedAccess_2.out -XDrawDiagnostics -XDstdout QualifiedAccess_2.java
+ * @compile/fail/ref=QualifiedAccess_2.out -XDrawDiagnostics QualifiedAccess_2.java
  */
 
 import pack1.P1;
--- a/langtools/test/tools/javac/QualifiedAccess/QualifiedAccess_3.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/QualifiedAccess/QualifiedAccess_3.java	Fri Aug 20 14:48:10 2010 -0400
@@ -5,7 +5,7 @@
  * the type to which a component member belongs be accessible in qualified
  * names.
  *
- * @compile/fail/ref=QualifiedAccess_3.out -XDrawDiagnostics -XDstdout QualifiedAccess_3.java
+ * @compile/fail/ref=QualifiedAccess_3.out -XDrawDiagnostics QualifiedAccess_3.java
  */
 
 import pack1.P1;
--- a/langtools/test/tools/javac/StringsInSwitch/BadlyTypedLabel1.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/StringsInSwitch/BadlyTypedLabel1.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug 6827009
  * @summary Check for case labels of different types.
  * @compile/fail -source 6 BadlyTypedLabel1.java
- * @compile/fail/ref=BadlyTypedLabel1.out -XDstdout -XDrawDiagnostics BadlyTypedLabel1.java
+ * @compile/fail/ref=BadlyTypedLabel1.out -XDrawDiagnostics BadlyTypedLabel1.java
  */
 class BadlyTypedLabel1 {
     String m(String s) {
--- a/langtools/test/tools/javac/StringsInSwitch/BadlyTypedLabel2.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/StringsInSwitch/BadlyTypedLabel2.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug 6827009
  * @summary Check for case lables of different types.
  * @compile/fail -source 6 BadlyTypedLabel2.java
- * @compile/fail/ref=BadlyTypedLabel2.out -XDstdout -XDrawDiagnostics BadlyTypedLabel2.java
+ * @compile/fail/ref=BadlyTypedLabel2.out -XDrawDiagnostics BadlyTypedLabel2.java
  */
 import static java.math.RoundingMode.*;
 
--- a/langtools/test/tools/javac/StringsInSwitch/NonConstantLabel.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/StringsInSwitch/NonConstantLabel.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug 6827009
  * @summary Check for non-constant case labels.
  * @compile/fail -source 6 NonConstantLabel.java
- * @compile/fail/ref=NonConstantLabel.out -XDstdout -XDrawDiagnostics NonConstantLabel.java
+ * @compile/fail/ref=NonConstantLabel.out -XDrawDiagnostics NonConstantLabel.java
  */
 class NonConstantLabel {
     String m(String s) {
--- a/langtools/test/tools/javac/StringsInSwitch/RepeatedStringCaseLabels1.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/StringsInSwitch/RepeatedStringCaseLabels1.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug 6827009
  * @summary Check for repeated string case labels.
  * @compile/fail -source 6 RepeatedStringCaseLabels1.java
- * @compile/fail/ref=RSCL1.out -XDstdout -XDrawDiagnostics RepeatedStringCaseLabels1.java
+ * @compile/fail/ref=RSCL1.out -XDrawDiagnostics RepeatedStringCaseLabels1.java
  */
 class RepeatedStringCaseLabels1 {
     String m(String s) {
--- a/langtools/test/tools/javac/StringsInSwitch/RepeatedStringCaseLabels2.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/StringsInSwitch/RepeatedStringCaseLabels2.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug 6827009
  * @summary Check for repeated string case labels.
  * @compile/fail -source 6 RepeatedStringCaseLabels2.java
- * @compile/fail/ref=RSCL2.out -XDstdout -XDrawDiagnostics RepeatedStringCaseLabels2.java
+ * @compile/fail/ref=RSCL2.out -XDrawDiagnostics RepeatedStringCaseLabels2.java
  */
 class RepeatedStringCaseLabels2 {
     String m(String s) {
--- a/langtools/test/tools/javac/SynchronizedClass.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/SynchronizedClass.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
    @summary Verify that ClassModifier "synchronized" is not allowed.
    @author dps
 
-   @compile/fail/ref=SynchronizedClass.out -XDrawDiagnostics -XDstdout SynchronizedClass.java
+   @compile/fail/ref=SynchronizedClass.out -XDrawDiagnostics SynchronizedClass.java
 */
 
 public synchronized class SynchronizedClass { } // ERROR
--- a/langtools/test/tools/javac/T4093617/T4093617.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/T4093617/T4093617.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug     4093617
  * @summary Object has no superclass
  * @author  Peter von der Ah\u00e9
- * @compile/fail/ref=T4093617.out -XDstdout -XDrawDiagnostics T4093617.java
+ * @compile/fail/ref=T4093617.out -XDrawDiagnostics T4093617.java
  */
 
 package java.lang;
--- a/langtools/test/tools/javac/T4906100.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/T4906100.java	Fri Aug 20 14:48:10 2010 -0400
@@ -2,7 +2,7 @@
  * @test  /nodynamiccopyright/
  * @bug 4906100
  * @summary detect empty statement after if
- * @compile/ref=T4906100.out -XDstdout -XDrawDiagnostics -Xlint:empty T4906100.java
+ * @compile/ref=T4906100.out -XDrawDiagnostics -Xlint:empty T4906100.java
  */
 
 class T4906100 {
--- a/langtools/test/tools/javac/T4994049/T4994049.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/T4994049/T4994049.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug     4994049
  * @summary Improved diagnostics while parsing enums
  * @author  Peter von der Ah\u00e9
- * @compile/fail/ref=T4994049.out -XDstdout -XDrawDiagnostics T4994049.java
+ * @compile/fail/ref=T4994049.out -XDrawDiagnostics T4994049.java
  */
 
 public enum T4994049 {
--- a/langtools/test/tools/javac/T5003235/T5003235a.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/T5003235/T5003235a.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug     5003235
  * @summary Private inner class accessible from subclasses
  * @author  Peter von der Ah\u00e9
- * @compile/fail/ref=T5003235a.out -XDstdout -XDdiags=%b:%l:%_%m T5003235a.java
+ * @compile/fail/ref=T5003235a.out -XDdiags=%b:%l:%_%m T5003235a.java
  */
 
 class Super {
--- a/langtools/test/tools/javac/T5003235/T5003235b.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/T5003235/T5003235b.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug     5003235
  * @summary Accessibility of private inner class
  * @author  Peter von der Ah\u00e9
- * @compile/fail/ref=T5003235b.out -XDstdout -XDdiags=%b:%l:%_%m T5003235b.java
+ * @compile/fail/ref=T5003235b.out -XDdiags=%b:%l:%_%m T5003235b.java
  */
 
 class Outer {
--- a/langtools/test/tools/javac/T5003235/T5003235c.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/T5003235/T5003235c.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug     5003235
  * @summary Access to private inner classes
  * @author  Peter von der Ah\u00e9
- * @compile/fail/ref=T5003235c.out -XDstdout -XDrawDiagnostics T5003235c.java
+ * @compile/fail/ref=T5003235c.out -XDrawDiagnostics T5003235c.java
  */
 
 class T5003235c {
--- a/langtools/test/tools/javac/T5024091/T5024091.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/T5024091/T5024091.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug     5024091
  * @summary AssertionError shouldn't be thrown
  * @author  Wei Tao
- * @compile/fail/ref=T5024091.out -XDfailcomplete=java.lang.StringBuilder -XDdev -XDstdout -XDrawDiagnostics T5024091.java
+ * @compile/fail/ref=T5024091.out -XDfailcomplete=java.lang.StringBuilder -XDdev -XDrawDiagnostics T5024091.java
  */
 
 public class T5024091 {
--- a/langtools/test/tools/javac/T5048776.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/T5048776.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,8 +1,8 @@
 /*
  * @test  /nodynamiccopyright/
  * @bug 5048776
- * @compile/ref=T5048776a.out -XDstdout -XDrawDiagnostics                  T5048776.java
- * @compile/ref=T5048776b.out -XDstdout -XDrawDiagnostics -Xlint:all,-path T5048776.java
+ * @compile/ref=T5048776a.out -XDrawDiagnostics                  T5048776.java
+ * @compile/ref=T5048776b.out -XDrawDiagnostics -Xlint:all,-path T5048776.java
  */
 class A1 {
     void foo(Object[] args) { }
--- a/langtools/test/tools/javac/T6214885.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/T6214885.java	Fri Aug 20 14:48:10 2010 -0400
@@ -2,8 +2,8 @@
  * @test  /nodynamiccopyright/
  * @bug 6214885
  * @summary This test exercises features provided by the new internal Diagnostics API
- * @compile/fail/ref=T6214885a.out -XDstdout -XDdiags=%b:%l%_%t%m|%p%m T6214885.java
- * @compile/fail/ref=T6214885b.out -XDstdout -XDdiags=%b:%l:%c%_%t%m|%p%m T6214885.java
+ * @compile/fail/ref=T6214885a.out -XDdiags=%b:%l%_%t%m|%p%m T6214885.java
+ * @compile/fail/ref=T6214885b.out -XDdiags=%b:%l:%c%_%t%m|%p%m T6214885.java
  */
 class T6214885
 {
--- a/langtools/test/tools/javac/T6224167.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/T6224167.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug 6224167
  * @summary misleading error message when both array and varargs
  *      methods are defined
- * @compile/fail/ref=T6224167.out -XDstdout -XDrawDiagnostics T6224167.java
+ * @compile/fail/ref=T6224167.out -XDrawDiagnostics T6224167.java
  */
 class T6224167
 {
--- a/langtools/test/tools/javac/T6227617.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/T6227617.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug 6227617
  * @summary Lint option for redundant casts
  * @compile -Werror T6227617.java
- * @compile/ref=T6227617.out -XDstdout -XDrawDiagnostics -Xlint:cast T6227617.java
+ * @compile/ref=T6227617.out -XDrawDiagnostics -Xlint:cast T6227617.java
  */
 import java.util.HashMap;
 import java.util.Map;
--- a/langtools/test/tools/javac/T6230128.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/T6230128.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,7 +1,7 @@
 /*
  * @test  /nodynamiccopyright/
  * @bug 6230128
- * @compile/fail/ref=T6230128.out -XDstdout -XDrawDiagnostics T6230128.java
+ * @compile/fail/ref=T6230128.out -XDrawDiagnostics T6230128.java
  */
 class A1 {
     public void foo(Object[] args) { }
--- a/langtools/test/tools/javac/T6231847.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/T6231847.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary Crash in com.sun.tools.javac.comp.Attr.visitNewClass:1352
  * @author  Peter von der Ah\u00e9
  * @compile/fail -XDdev T6231847.java
- * @compile/fail/ref=T6231847.out -XDdev -XDrawDiagnostics -XDstdout T6231847.java
+ * @compile/fail/ref=T6231847.out -XDdev -XDrawDiagnostics T6231847.java
  */
 
 class T6231847 {
--- a/langtools/test/tools/javac/T6241723.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/T6241723.java	Fri Aug 20 14:48:10 2010 -0400
@@ -2,7 +2,7 @@
  * @test  /nodynamiccopyright/
  * @bug 6241723
  * @summary compiler can miss some references to at-Deprecated classes
- * @compile/fail/ref=T6241723.out -XDstdout -XDrawDiagnostics -Xlint:deprecation -Werror T6241723.java
+ * @compile/fail/ref=T6241723.out -XDrawDiagnostics -Xlint:deprecation -Werror T6241723.java
  */
 
 @Deprecated class A1
--- a/langtools/test/tools/javac/T6245591.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/T6245591.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,7 +1,7 @@
 /*
  * @test  /nodynamiccopyright/
  * @bug 6245591
- * @compile/ref=T6245591.out -XDstdout -XDrawDiagnostics -Xlint:all,-path T6245591.java
+ * @compile/ref=T6245591.out -XDrawDiagnostics -Xlint:all,-path T6245591.java
  */
 enum Season {
     /** @deprecated */
--- a/langtools/test/tools/javac/T6247324.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/T6247324.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,7 +1,7 @@
 /*
  * @test  /nodynamiccopyright/
  * @bug 6247324
- * @compile/fail/ref=T6247324.out -XDrawDiagnostics -XDstdout -Xlint -Xlint:-path T6247324.java
+ * @compile/fail/ref=T6247324.out -XDrawDiagnostics -Xlint -Xlint:-path T6247324.java
  */
 class Pair<X,Y> {
     private X x;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T6340549.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test 6403456
+ * @summary javax.tools.JavaCompilerTool.getStandardFileManager().list() includes directories
+ */
+
+import javax.tools.*;
+import java.util.*;
+import java.io.*;
+
+import static javax.tools.JavaFileObject.Kind;
+
+public class T6340549 {
+    public static void main(String... args) throws Exception {
+
+        // Ensure a directory exists
+        File dir = new File("temp" + args.hashCode());
+        if (!dir.exists())
+            dir.mkdir();
+        if (!dir.isDirectory())
+            throw new AssertionError("Not a directory " + dir);
+
+        try {
+            JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+            StandardJavaFileManager jfm = compiler.getStandardFileManager(null, null, null);
+            jfm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(new File(".")));
+
+            for (JavaFileObject jfo : jfm.list(StandardLocation.CLASS_PATH,
+                    "", EnumSet.of(Kind.OTHER), false)) {
+                if (new File(jfo.getName()).isDirectory()) {
+                    throw new AssertionError("Found directory: " + jfo);
+                }
+            }
+        } finally {
+            dir.delete(); // cleanup
+        }
+    }
+}
--- a/langtools/test/tools/javac/T6394563.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/T6394563.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,13 +3,13 @@
  * @bug 6394563
  * @summary javac ignores -nowarn switch in 1.5.0_06 for deprecation warnings
  *
- * @compile/ref=T6394563.note.out  -XDstdout -XDrawDiagnostics -nowarn             T6394563.java
- * @compile/ref=T6394563.note.out  -XDstdout -XDrawDiagnostics -nowarn -source 1.5 T6394563.java
- * @compile/ref=T6394563.empty.out -XDstdout -XDrawDiagnostics -nowarn -source 1.4 T6394563.java
+ * @compile/ref=T6394563.note.out  -XDrawDiagnostics -nowarn             T6394563.java
+ * @compile/ref=T6394563.note.out  -XDrawDiagnostics -nowarn -source 1.5 T6394563.java
+ * @compile/ref=T6394563.empty.out -XDrawDiagnostics -nowarn -source 1.4 T6394563.java
  *
- * @compile/ref=T6394563.warn.out  -XDstdout -XDrawDiagnostics -Xlint -nowarn             T6394563.java
- * @compile/ref=T6394563.warn.out  -XDstdout -XDrawDiagnostics -Xlint -nowarn -source 1.5 T6394563.java
- * @compile/ref=T6394563.empty.out -XDstdout -XDrawDiagnostics -Xlint -nowarn -source 1.4 T6394563.java
+ * @compile/ref=T6394563.warn.out  -XDrawDiagnostics -Xlint -nowarn             T6394563.java
+ * @compile/ref=T6394563.warn.out  -XDrawDiagnostics -Xlint -nowarn -source 1.5 T6394563.java
+ * @compile/ref=T6394563.empty.out -XDrawDiagnostics -Xlint -nowarn -source 1.4 T6394563.java
  */
 
 class T6394563 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T6972327.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6972327
+ * @summary JCTree.pos incorrect for annotations without modifiers and package
+ */
+
+import com.sun.source.tree.*;
+import com.sun.source.util.Trees;
+import com.sun.tools.javac.api.*;
+import com.sun.tools.javac.tree.*;
+import com.sun.tools.javac.tree.JCTree.*;
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.*;
+
+public class T6972327 {
+
+    public static void main(String[] args) throws Exception {
+        final String bootPath = System.getProperty("sun.boot.class.path"); //NOI18N
+        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+        assert tool != null;
+
+        String code = "\n@interface Test {}";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null,
+            Arrays.asList("-bootclasspath", bootPath, "-Xjcov"), null, Arrays.asList(new MyFileObject(code)));
+        CompilationUnitTree cut = ct.parse().iterator().next();
+        ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+        Trees t = Trees.instance(ct);
+
+        long pos = t.getSourcePositions().getStartPosition(cut, clazz);
+        if (pos != code.indexOf(code.trim()))
+            throw new IllegalStateException("Unexpected position=" + pos);
+    }
+
+    static class MyFileObject extends SimpleJavaFileObject {
+        private String text;
+
+        public MyFileObject(String text) {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            this.text = text;
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return text;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/ArmLint.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,55 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 6911256 6964740 6965277 6967065
+ * @author Joseph D. Darcy
+ * @summary Check that -Xlint:arm warnings are generated as expected
+ * @compile/ref=ArmLint.out -Xlint:arm,deprecation -XDrawDiagnostics ArmLint.java
+ */
+
+class ArmLint implements AutoCloseable {
+    private static void test1() {
+        try(ArmLint r1 = new ArmLint();
+            ArmLint r2 = new ArmLint();
+            ArmLint r3 = new ArmLint()) {
+            r1.close();   // The resource's close
+            r2.close(42); // *Not* the resource's close
+            // r3 not referenced
+        }
+
+    }
+
+    @SuppressWarnings("arm")
+    private static void test2() {
+        try(@SuppressWarnings("deprecation") AutoCloseable r4 =
+            new DeprecatedAutoCloseable()) {
+            // r4 not referenced
+        } catch(Exception e) {
+            ;
+        }
+    }
+
+    /**
+     * The AutoCloseable method of a resource.
+     */
+    @Override
+    public void close () {
+        return;
+    }
+
+    /**
+     * <em>Not</em> the AutoCloseable method of a resource.
+     */
+    public void close (int arg) {
+        return;
+    }
+}
+
+@Deprecated
+class DeprecatedAutoCloseable implements AutoCloseable {
+    public DeprecatedAutoCloseable(){super();}
+
+    @Override
+    public void close () {
+        return;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/ArmLint.out	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,3 @@
+ArmLint.java:14:15: compiler.warn.twr.explicit.close.call
+ArmLint.java:13:13: compiler.warn.automatic.resource.not.referenced: r3
+2 warnings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/BadTwr.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,36 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 6911256 6964740
+ * @author Joseph D. Darcy
+ * @summary Verify bad TWRs don't compile
+ * @compile/fail -source 6 TwrFlow.java
+ * @compile/fail/ref=BadTwr.out -XDrawDiagnostics BadTwr.java
+ */
+
+public class BadTwr implements AutoCloseable {
+    public static void main(String... args) {
+        // illegal repeated name
+        try(BadTwr r1 = new BadTwr(); BadTwr r1 = new BadTwr()) {
+            System.out.println(r1.toString());
+        }
+
+        // illegal duplicate name of method argument
+        try(BadTwr args = new BadTwr()) {
+            System.out.println(args.toString());
+            final BadTwr thatsIt = new BadTwr();
+            thatsIt = null;
+        }
+
+        try(BadTwr name = new BadTwr()) {
+            // illegal duplicate name of enclosing try
+            try(BadTwr name = new BadTwr()) {
+                System.out.println(name.toString());
+            }
+        }
+
+    }
+
+    public void close() {
+        ;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/BadTwr.out	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,5 @@
+BadTwr.java:13:39: compiler.err.already.defined: r1, main(java.lang.String...)
+BadTwr.java:18:13: compiler.err.already.defined: args, main(java.lang.String...)
+BadTwr.java:21:13: compiler.err.cant.assign.val.to.final.var: thatsIt
+BadTwr.java:26:17: compiler.err.already.defined: name, main(java.lang.String...)
+4 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/BadTwrSyntax.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,22 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 6911256 6964740
+ * @author Joseph D. Darcy
+ * @summary Verify bad TWRs don't compile
+ * @compile/fail -source 6 BadTwrSyntax.java
+ * @compile/fail/ref=BadTwrSyntax.out  -XDrawDiagnostics BadTwrSyntax.java
+ */
+
+import java.io.IOException;
+public class BadTwrSyntax implements AutoCloseable {
+    public static void main(String... args) throws Exception {
+        // illegal semicolon ending resources
+        try(BadTwr twrflow = new BadTwr();) {
+            System.out.println(twrflow.toString());
+        }
+    }
+
+    public void close() {
+        ;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/BadTwrSyntax.out	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,2 @@
+BadTwrSyntax.java:14:43: compiler.err.illegal.start.of.expr
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/DuplicateResource.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6911256 6964740 6965277
+ * @author Maurizio Cimadamore
+ * @summary Check that lowered arm block does not end up creating resource twice
+ */
+
+import java.util.ArrayList;
+
+public class DuplicateResource {
+
+    static class TestResource implements AutoCloseable {
+        TestResource() {
+            resources.add(this);
+        }
+        boolean isClosed = false;
+        public void close() throws Exception {
+            isClosed = true;
+        }
+    }
+
+    static ArrayList<TestResource> resources = new ArrayList<TestResource>();
+
+    public static void main(String[] args) {
+        try(new TestResource()) {
+           //do something
+        } catch (Exception e) {
+            throw new AssertionError("Shouldn't reach here", e);
+        }
+        check();
+    }
+
+    public static void check() {
+       if (resources.size() != 1) {
+           throw new AssertionError("Expected one resource, found: " + resources.size());
+       }
+       TestResource resource = resources.get(0);
+       if (!resource.isClosed) {
+           throw new AssertionError("Resource used in ARM block has not been automatically closed");
+       }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/DuplicateResourceDecl.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,20 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 6911256 6964740 6965277
+ * @author Maurizio Cimadamore
+ * @summary Check that resource variable is not accessible from catch/finally clause
+ * @compile/fail/ref=DuplicateResourceDecl.out -XDrawDiagnostics DuplicateResourceDecl.java
+ */
+
+class DuplicateResourceDecl {
+
+    public static void main(String[] args) {
+        try(MyResource c = new MyResource();MyResource c = new MyResource()) {
+        //do something
+        } catch (Exception e) { }
+    }
+
+    static class MyResource implements AutoCloseable {
+        public void close() throws Exception {}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/DuplicateResourceDecl.out	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,2 @@
+DuplicateResourceDecl.java:12:45: compiler.err.already.defined: c, main(java.lang.String[])
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/ImplicitFinal.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 6911256 6964740 6965277
+ * @author Maurizio Cimadamore
+ * @summary Test that resource variables are implicitly final
+ * @compile/fail/ref=ImplicitFinal.out -XDrawDiagnostics ImplicitFinal.java
+ */
+
+import java.io.IOException;
+
+class ImplicitFinal implements AutoCloseable {
+    public static void main(String... args) {
+        try(ImplicitFinal r = new ImplicitFinal()) {
+            r = null; //disallowed
+        } catch (IOException ioe) { // Not reachable
+            throw new AssertionError("Shouldn't reach here", ioe);
+        }
+    }
+
+
+     // A close method, but the class is <em>not</em> Closeable or
+     // AutoCloseable.
+
+    public void close() throws IOException {
+        throw new IOException();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/ImplicitFinal.out	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,2 @@
+ImplicitFinal.java:14:13: compiler.err.twr.resource.may.not.be.assigned: r
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/PlainTry.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,15 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 6911256 6964740
+ * @author Joseph D. Darcy
+ * @summary Test error messages for an unadorned try
+ * @compile/fail/ref=PlainTry6.out -XDrawDiagnostics -source 6 PlainTry.java
+ * @compile/fail/ref=PlainTry.out  -XDrawDiagnostics           PlainTry.java
+ */
+public class PlainTry {
+    public static void main(String... args) {
+        try {
+            ;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/PlainTry.out	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,2 @@
+PlainTry.java:11:9: compiler.err.try.without.catch.finally.or.resource.decls
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/PlainTry6.out	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,2 @@
+PlainTry.java:11:9: compiler.err.try.without.catch.or.finally
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/ResourceInterface.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6970833
+ * @author Maurizio Cimadamore
+ * @summary Try-with-resource implementation throws an NPE during Flow analysis
+ * @compile/fail/ref=ResourceInterface.out -XDrawDiagnostics ResourceInterface.java
+ */
+
+class ResourceInterface {
+    public void test1() {
+        try(Resource1 r1 = null) { }
+    }
+
+    public void test2() {
+        try(Resource2 r2 = null) { }
+    }
+
+    static class E1 extends Exception {}
+
+    static class E2 extends Exception {}
+
+
+    interface C1 extends AutoCloseable {
+       void close() throws E1;
+    }
+
+    interface C2 extends AutoCloseable {
+       void close() throws E2;
+    }
+
+    interface C3 extends AutoCloseable {
+       void close() throws E2, E1;
+    }
+
+    static interface Resource1 extends C1, C2 {}
+
+    static interface Resource2 extends C1, C3 {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/ResourceInterface.out	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,2 @@
+ResourceInterface.java:38:34: compiler.err.unreported.exception.need.to.catch.or.throw: ResourceInterface.E1
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/ResourceOutsideTry.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,23 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 6911256 6964740 6965277
+ * @author Maurizio Cimadamore
+ * @summary Check that resource variable is not accessible from catch/finally clause
+ * @compile/fail/ref=ResourceOutsideTry.out -XDrawDiagnostics ResourceOutsideTry.java
+ */
+
+class ResourceOutsideTry {
+    void test() {
+        try(MyResource c = new MyResource()) {
+        //do something
+        } catch (Exception e) {
+            c.test();
+        } finally {
+            c.test();
+        }
+    }
+    static class MyResource implements AutoCloseable {
+        public void close() throws Exception {}
+        void test() {}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/ResourceOutsideTry.out	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,3 @@
+ResourceOutsideTry.java:14:13: compiler.err.cant.resolve.location: kindname.variable, c, , , kindname.class, ResourceOutsideTry
+ResourceOutsideTry.java:16:13: compiler.err.cant.resolve.location: kindname.variable, c, , , kindname.class, ResourceOutsideTry
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/ResourceTypeVar.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6911256 6964740 6965277
+ * @author Maurizio Cimadamore
+ * @summary Resource of a type-variable type crashes Flow
+ * @compile ResourceTypeVar.java
+ */
+
+class ResourceTypeVar<X extends AutoCloseable> {
+
+    public void test() {
+        try(X armflow = getX()) {
+            //do something
+        } catch (Exception e) { // Not reachable
+            throw new AssertionError("Shouldn't reach here", e);
+        }
+    }
+
+    X getX() { return null; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/TwrFlow.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,39 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 6911256 6964740
+ * @author Joseph D. Darcy
+ * @summary Test exception analysis of ARM blocks
+ * @compile/fail/ref=TwrFlow.out -XDrawDiagnostics TwrFlow.java
+ */
+
+import java.io.IOException;
+public class TwrFlow implements AutoCloseable {
+    public static void main(String... args) {
+        try(TwrFlow armflow = new TwrFlow()) {
+            System.out.println(armflow.toString());
+        } catch (IOException ioe) { // Not reachable
+            throw new AssertionError("Shouldn't reach here", ioe);
+        }
+        // CustomCloseException should be caught or added to throws clause
+
+        // Also check behavior on a resource expression rather than a
+        // declaration.
+        TwrFlow armflowexpr = new TwrFlow();
+        try(armflowexpr) {
+            System.out.println(armflowexpr.toString());
+        } catch (IOException ioe) { // Not reachable
+            throw new AssertionError("Shouldn't reach here", ioe);
+        }
+        // CustomCloseException should be caught or added to throws clause
+    }
+
+    /*
+     * A close method, but the class is <em>not</em> Closeable or
+     * AutoCloseable.
+     */
+    public void close() throws CustomCloseException {
+        throw new CustomCloseException();
+    }
+}
+
+class CustomCloseException extends Exception {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/TwrFlow.out	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,5 @@
+TwrFlow.java:14:11: compiler.err.except.never.thrown.in.try: java.io.IOException
+TwrFlow.java:24:11: compiler.err.except.never.thrown.in.try: java.io.IOException
+TwrFlow.java:12:46: compiler.err.unreported.exception.need.to.catch.or.throw: CustomCloseException
+TwrFlow.java:22:26: compiler.err.unreported.exception.need.to.catch.or.throw: CustomCloseException
+4 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/TwrInference.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6911256 6964740 6965277
+ * @author Maurizio Cimadamore
+ * @summary Verify that method type-inference works as expected in TWR context
+ * @compile TwrInference.java
+ */
+
+class TwrInference {
+
+    public void test() {
+        try(getX()) {
+            //do something
+        } catch (Exception e) { // Not reachable
+            throw new AssertionError("Shouldn't reach here", e);
+        }
+    }
+
+    <X> X getX() { return null; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/TwrIntersection.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6911256 6964740 6965277
+ * @author Maurizio Cimadamore
+ * @summary Resource of an intersection type crashes Flow
+ * @compile TwrIntersection.java
+ */
+
+interface MyCloseable extends AutoCloseable {
+   void close() throws java.io.IOException;
+}
+
+class ResourceTypeVar {
+
+    public void test() {
+        try(getX()) {
+            //do something
+        } catch (java.io.IOException e) { // Not reachable
+            throw new AssertionError("Shouldn't reach here", e);
+        }
+    }
+
+    <X extends Number & MyCloseable> X getX() { return null; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/TwrIntersection02.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,37 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 6911256 6964740 6965277
+ * @author Maurizio Cimadamore
+ * @summary Check that resources of an intersection type forces union of exception types
+ *          to be caught outside twr block
+ * @compile/fail/ref=TwrIntersection02.out -XDrawDiagnostics TwrIntersection02.java
+ */
+
+class TwrIntersection02 {
+
+    static class Exception1 extends Exception {}
+    static class Exception2 extends Exception {}
+
+
+    interface MyResource1 extends AutoCloseable {
+       void close() throws Exception1;
+    }
+
+    interface MyResource2 extends AutoCloseable {
+       void close() throws Exception2;
+    }
+
+    public void test1() throws Exception1 {
+        try(getX()) {
+            //do something
+        }
+    }
+
+    public void test2() throws Exception2 {
+        try(getX()) {
+            //do something
+        }
+    }
+
+    <X extends MyResource1 & MyResource2> X getX() { return null; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/TwrIntersection02.out	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,3 @@
+TwrIntersection02.java:25:21: compiler.err.unreported.exception.need.to.catch.or.throw: TwrIntersection02.Exception2
+TwrIntersection02.java:31:21: compiler.err.unreported.exception.need.to.catch.or.throw: TwrIntersection02.Exception1
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/TwrMultiCatch.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6911256 6964740
+ * @author Joseph D. Darcy
+ * @summary Test that TWR and multi-catch play well together
+ * @compile TwrMultiCatch.java
+ * @run main TwrMultiCatch
+ */
+
+import java.io.IOException;
+public class TwrMultiCatch implements AutoCloseable {
+    private final Class<? extends Exception> exceptionClass;
+
+    private TwrMultiCatch(Class<? extends Exception> exceptionClass) {
+        this.exceptionClass = exceptionClass;
+    }
+
+    public static void main(String... args) {
+        test(new TwrMultiCatch(CustomCloseException1.class),
+             CustomCloseException1.class);
+
+        test(new TwrMultiCatch(CustomCloseException2.class),
+             CustomCloseException2.class);
+    }
+
+    private static void test(TwrMultiCatch twrMultiCatch,
+                     Class<? extends Exception> expected) {
+        try(twrMultiCatch) {
+            System.out.println(twrMultiCatch.toString());
+        } catch (final CustomCloseException1 |
+                 CustomCloseException2 exception) {
+            if (!exception.getClass().equals(expected) ) {
+                throw new RuntimeException("Unexpected catch!");
+            }
+        }
+    }
+
+    public void close() throws CustomCloseException1, CustomCloseException2 {
+        Throwable t;
+        try {
+             t = exceptionClass.newInstance();
+        } catch(ReflectiveOperationException rfe) {
+            throw new RuntimeException(rfe);
+        }
+
+        try {
+            throw t;
+        } catch (final CustomCloseException1 |
+                 CustomCloseException2 exception) {
+            throw exception;
+        } catch (Throwable throwable) {
+            throw new RuntimeException(throwable);
+        }
+    }
+}
+
+class CustomCloseException1 extends Exception {}
+class CustomCloseException2 extends Exception {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/TwrOnNonResource.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,42 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 6911256 6964740
+ * @author Joseph D. Darcy
+ * @summary Verify invalid TWR block is not accepted.
+ * @compile/fail -source 6 TwrOnNonResource.java
+ * @compile/fail/ref=TwrOnNonResource.out -XDrawDiagnostics TwrOnNonResource.java
+ */
+
+class TwrOnNonResource {
+    public static void main(String... args) {
+        try(TwrOnNonResource aonr = new TwrOnNonResource()) {
+            System.out.println(aonr.toString());
+        }
+        try(TwrOnNonResource aonr = new TwrOnNonResource()) {
+            System.out.println(aonr.toString());
+        } finally {;}
+        try(TwrOnNonResource aonr = new TwrOnNonResource()) {
+            System.out.println(aonr.toString());
+        } catch (Exception e) {;}
+
+        // Also check expression form
+        TwrOnNonResource aonr = new TwrOnNonResource();
+        try(aonr) {
+            System.out.println(aonr.toString());
+        }
+        try(aonr) {
+            System.out.println(aonr.toString());
+        } finally {;}
+        try(aonr) {
+            System.out.println(aonr.toString());
+        } catch (Exception e) {;}
+    }
+
+    /*
+     * A close method, but the class is <em>not</em> Closeable or
+     * AutoCloseable.
+     */
+    public void close() {
+        throw new AssertionError("I'm not Closable!");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/TwrOnNonResource.out	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,7 @@
+TwrOnNonResource.java:12:13: compiler.err.prob.found.req: (compiler.misc.twr.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
+TwrOnNonResource.java:15:13: compiler.err.prob.found.req: (compiler.misc.twr.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
+TwrOnNonResource.java:18:13: compiler.err.prob.found.req: (compiler.misc.twr.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
+TwrOnNonResource.java:24:13: compiler.err.prob.found.req: (compiler.misc.twr.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
+TwrOnNonResource.java:27:13: compiler.err.prob.found.req: (compiler.misc.twr.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
+TwrOnNonResource.java:30:13: compiler.err.prob.found.req: (compiler.misc.twr.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
+6 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/TwrSuppression.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6971877
+ * @author Joseph D. Darcy
+ * @summary Verify a primary exception suppresses all throwables
+ */
+
+public class TwrSuppression implements AutoCloseable {
+    public static void main(String... args) throws Throwable {
+        try {
+            try (TwrSuppression r1 = new TwrSuppression(false);
+                 TwrSuppression r2 = new TwrSuppression(true)) {
+                throw new RuntimeException();
+            }
+        } catch(RuntimeException e) {
+            Throwable[] suppressedExceptions = e.getSuppressedExceptions();
+            int length = suppressedExceptions.length;
+            if (length != 2)
+                throw new RuntimeException("Unexpected length " + length);
+
+            if (suppressedExceptions[0].getClass() != Error.class ||
+                suppressedExceptions[1].getClass() != Exception.class) {
+                System.err.println("Unexpected suppressed types!");
+                e.printStackTrace();
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    private boolean throwError;
+
+    private TwrSuppression(boolean throwError) {
+        this.throwError = throwError;
+    }
+
+    @Override
+    public void close() throws Exception {
+        if (throwError) {
+            throw new Error();
+        } else {
+            throw new Exception();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/TwrTests.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,742 @@
+/*
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6911256 6964740
+ * @summary Tests of generated TWR code.
+ */
+
+import java.util.List;
+import java.util.ArrayList;
+
+public class TwrTests {
+    public static void main(String[] args) {
+        testCreateFailure1();
+        testCreateFailure2();
+        testCreateFailure2Nested();
+        testCreateFailure3();
+        testCreateFailure3Nested();
+        testCreateFailure4();
+        testCreateFailure4Nested();
+        testCreateFailure5();
+        testCreateFailure5Nested();
+
+        testCreateSuccess1();
+        testCreateSuccess2();
+        testCreateSuccess2Nested();
+        testCreateSuccess3();
+        testCreateSuccess3Nested();
+        testCreateSuccess4();
+        testCreateSuccess4Nested();
+        testCreateSuccess5();
+        testCreateSuccess5Nested();
+    }
+
+    /*
+     * The following tests simulate a creation failure of every possible
+     * resource in an TWR block, and check to make sure that the failure
+     * prevents creation of subsequent resources, and that all created
+     * resources are properly closed, even if one or more of the close
+     * attempts fails.
+     */
+
+    public static void testCreateFailure1() {
+        int creationFailuresDetected = 0;
+        List<Integer> closedList = new ArrayList<Integer>(0);
+        try (Resource r0 = createResource(0, 0, 0, closedList)) {
+            throw new AssertionError("Resource creation succeeded");
+        } catch (Resource.CreateFailException e) {
+            creationFailuresDetected++;
+            if (e.resourceId() != 0) {
+                throw new AssertionError("Wrong resource creation "
+                                         + e.resourceId() + " failed");
+            }
+        } catch (Resource.CloseFailException e) {
+            throw new AssertionError("Unexpected CloseFailException: " + e.resourceId());
+        }
+        checkForSingleCreationFailure(creationFailuresDetected);
+        checkClosedList(closedList, 0);
+    }
+
+    public static void testCreateFailure2() {
+        for (int createFailureId = 0; createFailureId < 2; createFailureId++) {
+            for (int bitMap = 0, n = 1 << createFailureId; bitMap < n; bitMap++) {
+                int creationFailuresDetected = 0;
+                List<Integer> closedList = new ArrayList<Integer>();
+                try (Resource r0 = createResource(0, createFailureId, bitMap, closedList);
+                     Resource r1 = createResource(1, createFailureId, bitMap, closedList)) {
+                    throw new AssertionError("Entire resource creation succeeded");
+                } catch (Resource.CreateFailException e) {
+                    creationFailuresDetected++;
+                    checkCreateFailureId(e.resourceId(), createFailureId);
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                } catch (Resource.CloseFailException e) {
+                    throw new AssertionError("Secondary exception suppression failed");
+                }
+                checkForSingleCreationFailure(creationFailuresDetected);
+                checkClosedList(closedList, createFailureId);
+            }
+        }
+    }
+
+    public static void testCreateFailure2Nested() {
+        for (int createFailureId = 0; createFailureId < 2; createFailureId++) {
+            for (int bitMap = 0, n = 1 << createFailureId; bitMap < n; bitMap++) {
+                int creationFailuresDetected = 0;
+                List<Integer> closedList = new ArrayList<Integer>();
+                try (Resource r0 = createResource(0, createFailureId, bitMap, closedList)) {
+                    try(Resource r1 = createResource(1, createFailureId, bitMap, closedList)) {
+                        throw new AssertionError("Entire resource creation succeeded");
+                    }
+                } catch (Resource.CreateFailException e) {
+                    creationFailuresDetected++;
+                    checkCreateFailureId(e.resourceId(), createFailureId);
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                } catch (Resource.CloseFailException e) {
+                    throw new AssertionError("Secondary exception suppression failed");
+                }
+                checkForSingleCreationFailure(creationFailuresDetected);
+                checkClosedList(closedList, createFailureId);
+            }
+        }
+    }
+
+    public static void testCreateFailure3() {
+        for (int createFailureId = 0; createFailureId < 3; createFailureId++) {
+            for (int bitMap = 0, n = 1 << createFailureId; bitMap < n; bitMap++) {
+                int creationFailuresDetected = 0;
+                List<Integer> closedList = new ArrayList<Integer>();
+                try (Resource r0 = createResource(0, createFailureId, bitMap, closedList);
+                     Resource r1 = createResource(1, createFailureId, bitMap, closedList);
+                     Resource r2 = createResource(2, createFailureId, bitMap, closedList)) {
+                    throw new AssertionError("Entire resource creation succeeded");
+                } catch (Resource.CreateFailException e) {
+                    creationFailuresDetected++;
+                    checkCreateFailureId(e.resourceId(), createFailureId);
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                } catch (Resource.CloseFailException e) {
+                    throw new AssertionError("Secondary exception suppression failed:" + e);
+                }
+                checkForSingleCreationFailure(creationFailuresDetected);
+                checkClosedList(closedList, createFailureId);
+            }
+        }
+    }
+
+    public static void testCreateFailure3Nested() {
+        for (int createFailureId = 0; createFailureId < 3; createFailureId++) {
+            for (int bitMap = 0, n = 1 << createFailureId; bitMap < n; bitMap++) {
+                int creationFailuresDetected = 0;
+                List<Integer> closedList = new ArrayList<Integer>();
+                try (Resource r0 = createResource(0, createFailureId, bitMap, closedList)) {
+                    try (Resource r1 = createResource(1, createFailureId, bitMap, closedList)) {
+                        try (Resource r2 = createResource(2, createFailureId, bitMap, closedList)) {
+                            throw new AssertionError("Entire resource creation succeeded");
+                        }
+                    }
+                } catch (Resource.CreateFailException e) {
+                    creationFailuresDetected++;
+                    checkCreateFailureId(e.resourceId(), createFailureId);
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                } catch (Resource.CloseFailException e) {
+                    throw new AssertionError("Secondary exception suppression failed:" + e);
+                }
+                checkForSingleCreationFailure(creationFailuresDetected);
+                checkClosedList(closedList, createFailureId);
+            }
+        }
+    }
+
+    public static void testCreateFailure4() {
+        for (int createFailureId = 0; createFailureId < 4; createFailureId++) {
+            for (int bitMap = 0, n = 1 << createFailureId; bitMap < n; bitMap++) {
+                int creationFailuresDetected = 0;
+                List<Integer> closedList = new ArrayList<Integer>();
+                try (Resource r0 = createResource(0, createFailureId, bitMap, closedList);
+                     Resource r1 = createResource(1, createFailureId, bitMap, closedList);
+                     Resource r2 = createResource(2, createFailureId, bitMap, closedList);
+                     Resource r3 = createResource(3, createFailureId, bitMap, closedList)) {
+                    throw new AssertionError("Entire resource creation succeeded");
+                } catch (Resource.CreateFailException e) {
+                    creationFailuresDetected++;
+                    checkCreateFailureId(e.resourceId(), createFailureId);
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                } catch (Resource.CloseFailException e) {
+                    throw new AssertionError("Secondary exception suppression failed:" + e);
+                }
+                checkForSingleCreationFailure(creationFailuresDetected);
+                checkClosedList(closedList, createFailureId);
+            }
+        }
+    }
+
+    public static void testCreateFailure4Nested() {
+        for (int createFailureId = 0; createFailureId < 4; createFailureId++) {
+            for (int bitMap = 0, n = 1 << createFailureId; bitMap < n; bitMap++) {
+                int creationFailuresDetected = 0;
+                List<Integer> closedList = new ArrayList<Integer>();
+                try (Resource r0 = createResource(0, createFailureId, bitMap, closedList)) {
+                    try (Resource r1 = createResource(1, createFailureId, bitMap, closedList)) {
+                        try (Resource r2 = createResource(2, createFailureId, bitMap, closedList)) {
+                            try (Resource r3 = createResource(3, createFailureId, bitMap, closedList)) {
+                                throw new AssertionError("Entire resource creation succeeded");
+                            }
+                        }
+                    }
+                } catch (Resource.CreateFailException e) {
+                    creationFailuresDetected++;
+                    checkCreateFailureId(e.resourceId(), createFailureId);
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                } catch (Resource.CloseFailException e) {
+                    throw new AssertionError("Secondary exception suppression failed:" + e);
+                }
+                checkForSingleCreationFailure(creationFailuresDetected);
+                checkClosedList(closedList, createFailureId);
+            }
+        }
+    }
+
+    public static void testCreateFailure5() {
+        for (int createFailureId = 0; createFailureId < 5; createFailureId++) {
+            for (int bitMap = 0, n = 1 << createFailureId; bitMap < n; bitMap++) {
+                int creationFailuresDetected = 0;
+                List<Integer> closedList = new ArrayList<Integer>();
+                try (Resource r0 = createResource(0, createFailureId, bitMap, closedList);
+                     Resource r1 = createResource(1, createFailureId, bitMap, closedList);
+                     Resource r2 = createResource(2, createFailureId, bitMap, closedList);
+                     Resource r3 = createResource(3, createFailureId, bitMap, closedList);
+                     Resource r4 = createResource(4, createFailureId, bitMap, closedList)) {
+                    throw new AssertionError("Entire resource creation succeeded");
+                } catch (Resource.CreateFailException e) {
+                    creationFailuresDetected++;
+                    checkCreateFailureId(e.resourceId(), createFailureId);
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                } catch (Resource.CloseFailException e) {
+                    throw new AssertionError("Secondary exception suppression failed:" + e);
+                }
+                checkForSingleCreationFailure(creationFailuresDetected);
+                checkClosedList(closedList, createFailureId);
+            }
+        }
+    }
+
+    public static void testCreateFailure5Nested() {
+        for (int createFailureId = 0; createFailureId < 5; createFailureId++) {
+            for (int bitMap = 0, n = 1 << createFailureId; bitMap < n; bitMap++) {
+                int creationFailuresDetected = 0;
+                List<Integer> closedList = new ArrayList<Integer>();
+                try (Resource r0 = createResource(0, createFailureId, bitMap, closedList)) {
+                    try (Resource r1 = createResource(1, createFailureId, bitMap, closedList)) {
+                        try (Resource r2 = createResource(2, createFailureId, bitMap, closedList)) {
+                            try (Resource r3 = createResource(3, createFailureId, bitMap, closedList)) {
+                                try (Resource r4 = createResource(4, createFailureId, bitMap, closedList)) {
+                                    throw new AssertionError("Entire resource creation succeeded");
+                                }
+                            }
+                        }
+                    }
+                } catch (Resource.CreateFailException e) {
+                    creationFailuresDetected++;
+                    checkCreateFailureId(e.resourceId(), createFailureId);
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                } catch (Resource.CloseFailException e) {
+                    throw new AssertionError("Secondary exception suppression failed:" + e);
+                }
+                checkForSingleCreationFailure(creationFailuresDetected);
+                checkClosedList(closedList, createFailureId);
+            }
+        }
+    }
+
+    /**
+     * Create a resource with the specified ID. The ID must be less than createFailureId.
+     * A subsequent attempt to close the resource will fail iff the corresponding bit
+     * is set in closeFailureBitMap.  When an attempt is made to close this resource,
+     * its ID will be added to closedList, regardless of whether the attempt succeeds.
+     *
+     * @param id the ID of this resource
+     * @param createFailureId the ID of the resource whose creation will fail
+     * @param closeFailureBitMap a bit vector describing which resources should throw an
+     *        exception when close is attempted
+     * @param closedList a list on which to record resource close attempts
+     * @throws AssertionError if no attempt should be made to create this resource
+     */
+    private static Resource createResource(int id,
+                                           int createFailureId,
+                                           int closeFailureBitMap,
+                                           List<Integer> closedList) throws Resource.CreateFailException {
+        if (id > createFailureId)
+            throw new AssertionError("Resource " + id + " shouldn't be created");
+        boolean createSucceeds = id != createFailureId;
+        boolean closeSucceeds = (closeFailureBitMap & (1 << id)) == 0;
+        return new Resource(id, createSucceeds, closeSucceeds, closedList);
+    }
+
+
+    /**
+     * Check that an observed creation failure has the expected resource ID.
+     *
+     * @param foundId the ID of the resource whose creation failed
+     * @param expectedId the ID of the resource whose creation should have failed
+     */
+    private static void checkCreateFailureId(int foundId, int expectedId) {
+        if (foundId != expectedId)
+            throw new AssertionError("Wrong resource creation failed. Found ID "
+                                     + foundId + " expected " + expectedId);
+    }
+
+    /**
+     * Check for proper suppressed exceptions in proper order.
+     *
+     * @param suppressedExceptions the suppressed exceptions array returned by
+     *        getSuppressedExceptions()
+     * @bitmap a bitmap indicating which suppressed exceptions are expected.
+     *         Bit i is set iff id should throw a CloseFailException.
+     */
+    private static void checkSuppressedExceptions(Throwable[] suppressedExceptions, int bitMap) {
+        if (suppressedExceptions.length != Integer.bitCount(bitMap))
+            throw new AssertionError("Expected " + Integer.bitCount(bitMap)
+                                     + " suppressed exceptions, got " +  suppressedExceptions.length);
+
+        int prevCloseFailExceptionId = Integer.MAX_VALUE;
+        for (Throwable t : suppressedExceptions) {
+            int id = ((Resource.CloseFailException) t).resourceId();
+            if ((1 << id  & bitMap) == 0)
+                throw new AssertionError("Unexpected suppressed CloseFailException: " + id);
+            if (id > prevCloseFailExceptionId)
+                throw new AssertionError("Suppressed CloseFailException" + id
+                                         + " followed " + prevCloseFailExceptionId);
+        }
+    }
+
+    /**
+     * Check that exactly one resource creation failed.
+     *
+     * @param numCreationFailuresDetected the number of creation failures detected
+     */
+    private static void checkForSingleCreationFailure(int numCreationFailuresDetected) {
+        if (numCreationFailuresDetected != 1)
+            throw new AssertionError("Wrong number of creation failures: "
+                                     + numCreationFailuresDetected);
+    }
+
+    /**
+     * Check that a close was attempted on every resourced that was successfully opened,
+     * and that the close attempts occurred in the proper order.
+     *
+     * @param closedList the resource IDs of the close attempts, in the order they occurred
+     * @param the ID of the resource whose creation failed.  Close attempts should occur
+     *        for all previous resources, in reverse order.
+     */
+    private static void checkClosedList(List<Integer> closedList, int createFailureId) {
+        List<Integer> expectedList = new ArrayList<Integer>(createFailureId);
+        for (int i = createFailureId - 1; i >= 0; i--)
+            expectedList.add(i);
+        if (!closedList.equals(expectedList))
+            throw new AssertionError("Closing sequence " + closedList + " != " + expectedList);
+    }
+
+    /*
+     * The following tests simulate the creation of several resources, followed
+     * by success or failure of forward processing.  They test that all resources
+     * are properly closed, even if one or more of the close attempts fails.
+     */
+
+    public static void testCreateSuccess1() {
+        for (int bitMap = 0, n = 1 << 1; bitMap < n; bitMap++) {
+            for (int failure = 0; failure < 2; failure++) {
+                List<Integer> closedList = new ArrayList<Integer>();
+                try (Resource r0 = createResource(0, bitMap, closedList)) {
+                    if (failure != 0)
+                        throw new MyKindOfException();
+                } catch (Resource.CreateFailException e) {
+                    throw new AssertionError(
+                                             "Resource creation failed: " + e.resourceId());
+                } catch (MyKindOfException e) {
+                    if (failure == 0)
+                        throw new AssertionError("Unexpected MyKindOfException");
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                } catch (Resource.CloseFailException e) {
+                    if (failure == 1)
+                        throw new AssertionError("Secondary exception suppression failed");
+                    int id = e.resourceId();
+                    if (bitMap == 0)
+                        throw new AssertionError("Unexpected CloseFailException: " + id);
+                    int highestCloseFailBit = Integer.highestOneBit(bitMap);
+                    if (1 << id != highestCloseFailBit) {
+                        throw new AssertionError("CloseFailException: got id " + id
+                                                 + ", expected lg(" + highestCloseFailBit +")");
+                    }
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                }
+                checkClosedList(closedList, 1);
+            }
+        }
+    }
+
+    public static void testCreateSuccess2() {
+        for (int bitMap = 0, n = 1 << 2; bitMap < n; bitMap++) {
+            for (int failure = 0; failure < 2; failure++) {
+                List<Integer> closedList = new ArrayList<Integer>();
+                try (Resource r0 = createResource(0, bitMap, closedList);
+                     Resource r1 = createResource(1, bitMap, closedList)) {
+                    if (failure != 0)
+                        throw new MyKindOfException();
+                } catch (Resource.CreateFailException e) {
+                    throw new AssertionError(
+                                             "Resource creation failed: " + e.resourceId());
+                } catch (MyKindOfException e) {
+                    if (failure == 0)
+                        throw new AssertionError("Unexpected MyKindOfException");
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                } catch (Resource.CloseFailException e) {
+                    if (failure == 1)
+                        throw new AssertionError("Secondary exception suppression failed");
+                    int id = e.resourceId();
+                    if (bitMap == 0)
+                        throw new AssertionError("Unexpected CloseFailException: " + id);
+                    int highestCloseFailBit = Integer.highestOneBit(bitMap);
+                    if (1 << id != highestCloseFailBit) {
+                        throw new AssertionError("CloseFailException: got id " + id
+                                                 + ", expected lg(" + highestCloseFailBit +")");
+                    }
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                }
+                checkClosedList(closedList, 2);
+            }
+        }
+    }
+
+    public static void testCreateSuccess2Nested() {
+        for (int bitMap = 0, n = 1 << 2; bitMap < n; bitMap++) {
+            for (int failure = 0; failure < 2; failure++) {
+                List<Integer> closedList = new ArrayList<Integer>();
+                try (Resource r0 = createResource(0, bitMap, closedList)) {
+                    try (Resource r1 = createResource(1, bitMap, closedList)) {
+                        if (failure != 0)
+                            throw new MyKindOfException();
+                    }
+                } catch (Resource.CreateFailException e) {
+                    throw new AssertionError(
+                                             "Resource creation failed: " + e.resourceId());
+                } catch (MyKindOfException e) {
+                    if (failure == 0)
+                        throw new AssertionError("Unexpected MyKindOfException");
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                } catch (Resource.CloseFailException e) {
+                    if (failure == 1)
+                        throw new AssertionError("Secondary exception suppression failed");
+                    int id = e.resourceId();
+                    if (bitMap == 0)
+                        throw new AssertionError("Unexpected CloseFailException: " + id);
+                    int highestCloseFailBit = Integer.highestOneBit(bitMap);
+                    if (1 << id != highestCloseFailBit) {
+                        throw new AssertionError("CloseFailException: got id " + id
+                                                 + ", expected lg(" + highestCloseFailBit +")");
+                    }
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                }
+                checkClosedList(closedList, 2);
+            }
+        }
+    }
+
+    public static void testCreateSuccess3() {
+        for (int bitMap = 0, n = 1 << 3; bitMap < n; bitMap++) {
+            for (int failure = 0; failure < 2; failure++) {
+                List<Integer> closedList = new ArrayList<Integer>();
+                try (Resource r0 = createResource(0, bitMap, closedList);
+                     Resource r1 = createResource(1, bitMap, closedList);
+                     Resource r2 = createResource(2, bitMap, closedList)) {
+                    if (failure != 0)
+                        throw new MyKindOfException();
+                } catch (Resource.CreateFailException e) {
+                    throw new AssertionError(
+                                             "Resource creation failed: " + e.resourceId());
+                } catch (MyKindOfException e) {
+                    if (failure == 0)
+                        throw new AssertionError("Unexpected MyKindOfException");
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                } catch (Resource.CloseFailException e) {
+                    if (failure == 1)
+                        throw new AssertionError("Secondary exception suppression failed");
+                    int id = e.resourceId();
+                    if (bitMap == 0)
+                        throw new AssertionError("Unexpected CloseFailException: " + id);
+                    int highestCloseFailBit = Integer.highestOneBit(bitMap);
+                    if (1 << id != highestCloseFailBit) {
+                        throw new AssertionError("CloseFailException: got id " + id
+                                                 + ", expected lg(" + highestCloseFailBit +")");
+                    }
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                }
+                checkClosedList(closedList, 3);
+            }
+        }
+    }
+
+    public static void testCreateSuccess3Nested() {
+        for (int bitMap = 0, n = 1 << 3; bitMap < n; bitMap++) {
+            for (int failure = 0; failure < 2; failure++) {
+                List<Integer> closedList = new ArrayList<Integer>();
+                try (Resource r0 = createResource(0, bitMap, closedList)) {
+                    try (Resource r1 = createResource(1, bitMap, closedList)) {
+                        try (Resource r2 = createResource(2, bitMap, closedList)) {
+                            if (failure != 0)
+                                throw new MyKindOfException();
+                        }
+                    }
+                } catch (Resource.CreateFailException e) {
+                    throw new AssertionError(
+                                             "Resource creation failed: " + e.resourceId());
+                } catch (MyKindOfException e) {
+                    if (failure == 0)
+                        throw new AssertionError("Unexpected MyKindOfException");
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                } catch (Resource.CloseFailException e) {
+                    if (failure == 1)
+                        throw new AssertionError("Secondary exception suppression failed");
+                    int id = e.resourceId();
+                    if (bitMap == 0)
+                        throw new AssertionError("Unexpected CloseFailException: " + id);
+                    int highestCloseFailBit = Integer.highestOneBit(bitMap);
+                    if (1 << id != highestCloseFailBit) {
+                        throw new AssertionError("CloseFailException: got id " + id
+                                                 + ", expected lg(" + highestCloseFailBit +")");
+                    }
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                }
+                checkClosedList(closedList, 3);
+            }
+        }
+    }
+
+    public static void testCreateSuccess4() {
+        for (int bitMap = 0, n = 1 << 4; bitMap < n; bitMap++) {
+            for (int failure = 0; failure < 2; failure++) {
+                List<Integer> closedList = new ArrayList<Integer>();
+                try (Resource r0 = createResource(0, bitMap, closedList);
+                     Resource r1 = createResource(1, bitMap, closedList);
+                     Resource r2 = createResource(2, bitMap, closedList);
+                     Resource r3 = createResource(3, bitMap, closedList)) {
+                    if (failure != 0)
+                        throw new MyKindOfException();
+                } catch (Resource.CreateFailException e) {
+                    throw new AssertionError(
+                                             "Resource creation failed: " + e.resourceId());
+                } catch (MyKindOfException e) {
+                    if (failure == 0)
+                        throw new AssertionError("Unexpected MyKindOfException");
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                } catch (Resource.CloseFailException e) {
+                    if (failure == 1)
+                        throw new AssertionError("Secondary exception suppression failed");
+                    int id = e.resourceId();
+                    if (bitMap == 0)
+                        throw new AssertionError("Unexpected CloseFailException: " + id);
+                    int highestCloseFailBit = Integer.highestOneBit(bitMap);
+                    if (1 << id != highestCloseFailBit) {
+                        throw new AssertionError("CloseFailException: got id " + id
+                                                 + ", expected lg(" + highestCloseFailBit +")");
+                    }
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                }
+                checkClosedList(closedList, 4);
+            }
+        }
+    }
+
+    public static void testCreateSuccess4Nested() {
+        for (int bitMap = 0, n = 1 << 4; bitMap < n; bitMap++) {
+            for (int failure = 0; failure < 2; failure++) {
+                List<Integer> closedList = new ArrayList<Integer>();
+                try (Resource r0 = createResource(0, bitMap, closedList)) {
+                    try (Resource r1 = createResource(1, bitMap, closedList)) {
+                        try (Resource r2 = createResource(2, bitMap, closedList)) {
+                            try (Resource r3 = createResource(3, bitMap, closedList)) {
+                                if (failure != 0)
+                                    throw new MyKindOfException();
+                            }
+                        }
+                    }
+                } catch (Resource.CreateFailException e) {
+                    throw new AssertionError(
+                                             "Resource creation failed: " + e.resourceId());
+                } catch (MyKindOfException e) {
+                    if (failure == 0)
+                        throw new AssertionError("Unexpected MyKindOfException");
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                } catch (Resource.CloseFailException e) {
+                    if (failure == 1)
+                        throw new AssertionError("Secondary exception suppression failed");
+                    int id = e.resourceId();
+                    if (bitMap == 0)
+                        throw new AssertionError("Unexpected CloseFailException: " + id);
+                    int highestCloseFailBit = Integer.highestOneBit(bitMap);
+                    if (1 << id != highestCloseFailBit) {
+                        throw new AssertionError("CloseFailException: got id " + id
+                                                 + ", expected lg(" + highestCloseFailBit +")");
+                    }
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                }
+                checkClosedList(closedList, 4);
+            }
+        }
+    }
+
+    public static void testCreateSuccess5() {
+        for (int bitMap = 0, n = 1 << 5; bitMap < n; bitMap++) {
+            for (int failure = 0; failure < 2; failure++) {
+                List<Integer> closedList = new ArrayList<Integer>();
+                try (Resource r0 = createResource(0, bitMap, closedList);
+                     Resource r1 = createResource(1, bitMap, closedList);
+                     Resource r2 = createResource(2, bitMap, closedList);
+                     Resource r3 = createResource(3, bitMap, closedList);
+                     Resource r4 = createResource(4, bitMap, closedList)) {
+                    if (failure != 0)
+                        throw new MyKindOfException();
+                } catch (Resource.CreateFailException e) {
+                    throw new AssertionError("Resource creation failed: " + e.resourceId());
+                } catch (MyKindOfException e) {
+                    if (failure == 0)
+                        throw new AssertionError("Unexpected MyKindOfException");
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                } catch (Resource.CloseFailException e) {
+                    if (failure == 1)
+                        throw new AssertionError("Secondary exception suppression failed");
+                    int id = e.resourceId();
+                    if (bitMap == 0)
+                        throw new AssertionError("Unexpected CloseFailException: " + id);
+                    int highestCloseFailBit = Integer.highestOneBit(bitMap);
+                    if (1 << id != highestCloseFailBit) {
+                        throw new AssertionError("CloseFailException: got id " + id
+                                                 + ", expected lg(" + highestCloseFailBit +")");
+                    }
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                }
+                checkClosedList(closedList, 5);
+            }
+        }
+    }
+
+    public static void testCreateSuccess5Nested() {
+        for (int bitMap = 0, n = 1 << 5; bitMap < n; bitMap++) {
+            for (int failure = 0; failure < 2; failure++) {
+                List<Integer> closedList = new ArrayList<Integer>();
+                try (Resource r0 = createResource(0, bitMap, closedList)) {
+                    try (Resource r1 = createResource(1, bitMap, closedList)) {
+                        try (Resource r2 = createResource(2, bitMap, closedList)) {
+                            try (Resource r3 = createResource(3, bitMap, closedList)) {
+                                try (Resource r4 = createResource(4, bitMap, closedList)) {
+                                    if (failure != 0)
+                                        throw new MyKindOfException();
+                                }
+                            }
+                        }
+                    }
+                } catch (Resource.CreateFailException e) {
+                    throw new AssertionError("Resource creation failed: " + e.resourceId());
+                } catch (MyKindOfException e) {
+                    if (failure == 0)
+                        throw new AssertionError("Unexpected MyKindOfException");
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                } catch (Resource.CloseFailException e) {
+                    if (failure == 1)
+                        throw new AssertionError("Secondary exception suppression failed");
+                    int id = e.resourceId();
+                    if (bitMap == 0)
+                        throw new AssertionError("Unexpected CloseFailException: " + id);
+                    int highestCloseFailBit = Integer.highestOneBit(bitMap);
+                    if (1 << id != highestCloseFailBit) {
+                        throw new AssertionError("CloseFailException: got id " + id
+                                                 + ", expected lg(" + highestCloseFailBit +")");
+                    }
+                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                }
+                checkClosedList(closedList, 5);
+            }
+        }
+    }
+
+    private static Resource createResource(int id,
+                                           int closeFailureBitMap,
+                                           List<Integer> closedList) throws Resource.CreateFailException {
+        boolean closeSucceeds = (closeFailureBitMap & (1 << id)) == 0;
+        return new Resource(id, true, closeSucceeds, closedList);
+    }
+
+    private static class MyKindOfException extends Exception {
+    }
+}
+
+class Resource implements AutoCloseable {
+    /** A number identifying this resource */
+    private final int resourceId;
+
+    /** Whether the close call on this resource should succeed or fail */
+    private final boolean closeSucceeds;
+
+    /** When resource is closed, it records its ID in this list */
+    private final List<Integer> closedList;
+
+    Resource(int resourceId, boolean createSucceeds, boolean closeSucceeds,
+             List<Integer> closedList) throws CreateFailException {
+        if (!createSucceeds)
+            throw new CreateFailException(resourceId);
+        this.resourceId = resourceId;
+        this.closeSucceeds = closeSucceeds;
+        this.closedList = closedList;
+    }
+
+    public void close() throws CloseFailException {
+        closedList.add(resourceId);
+        if (!closeSucceeds)
+            throw new CloseFailException(resourceId);
+    }
+
+    public static class ResourceException extends RuntimeException {
+        private final int resourceId;
+
+        public ResourceException(int resourceId) {
+            super("Resource ID = " + resourceId);
+            this.resourceId = resourceId;
+        }
+
+        public int resourceId() {
+            return resourceId;
+        }
+    }
+
+    public static class CreateFailException extends ResourceException {
+        public CreateFailException(int resourceId) {
+            super(resourceId);
+        }
+    }
+
+    public static class CloseFailException extends ResourceException {
+        public CloseFailException(int resourceId) {
+            super(resourceId);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/WeirdTwr.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6911256 6964740
+ * @author Joseph D. Darcy
+ * @summary Strange TWRs
+ * @compile/fail -source 6 WeirdTwr.java
+ * @compile WeirdTwr.java
+ * @run main WeirdTwr
+ */
+
+public class WeirdTwr implements AutoCloseable {
+    private static int closeCount = 0;
+    public static void main(String... args) {
+        try(WeirdTwr r1 = new WeirdTwr(); WeirdTwr r2 = r1) {
+            if (r1 != r2)
+                throw new RuntimeException("Unexpected inequality.");
+        }
+        if (closeCount != 2)
+            throw new RuntimeException("bad closeCount" + closeCount);
+    }
+
+    public void close() {
+        closeCount++;
+    }
+}
--- a/langtools/test/tools/javac/annotations/6214965/T6214965.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/annotations/6214965/T6214965.java	Fri Aug 20 14:48:10 2010 -0400
@@ -27,5 +27,5 @@
  * @summary Compiler crash on redefing nested annotation types
  * @compile CompilerAnnotationTest.java CompilerAnnotationTest2.java
  * @compile CompilerAnnotationTest2bad.java
- * @compile/ref=T6214965.out -XDstdout -XDrawDiagnostics CompilerAnnotationTest2bad.java
+ * @compile/ref=T6214965.out -XDrawDiagnostics CompilerAnnotationTest2bad.java
  */
--- a/langtools/test/tools/javac/annotations/6365854/T6365854.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/annotations/6365854/T6365854.java	Fri Aug 20 14:48:10 2010 -0400
@@ -33,11 +33,11 @@
  *
  * @compile TestAnnotation.java TestCore.java
  * @clean test.annotation.TestAnnotation
- * @compile/ref=test1.out -XDstdout -XDrawDiagnostics T6365854.java
+ * @compile/ref=test1.out -XDrawDiagnostics T6365854.java
  * @run main T6365854
- * @compile/ref=test2.out -XDstdout -XDrawDiagnostics evolve/TestAnnotation.java T6365854.java
+ * @compile/ref=test2.out -XDrawDiagnostics evolve/TestAnnotation.java T6365854.java
  * @run main T6365854
- * @compile/ref=test2.out -XDstdout -XDrawDiagnostics T6365854.java
+ * @compile/ref=test2.out -XDrawDiagnostics T6365854.java
  * @run main T6365854
  */
 
--- a/langtools/test/tools/javac/danglingDep/DepX.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/danglingDep/DepX.java	Fri Aug 20 14:48:10 2010 -0400
@@ -25,7 +25,7 @@
  * control test (2): verify that compiler handles at-deprecated correctly
  * @test
  * @clean X DepX refX
- * @compile/ref=DepX.out -XDstdout -XDrawDiagnostics DepX.java RefX.java
+ * @compile/ref=DepX.out -XDrawDiagnostics DepX.java RefX.java
  */
 class DepX
 {
--- a/langtools/test/tools/javac/danglingDep/NoDepX.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/danglingDep/NoDepX.java	Fri Aug 20 14:48:10 2010 -0400
@@ -25,7 +25,7 @@
  * control test (1): verify that compiler handles (lack of) at-deprecated correctly
  * @test
  * @clean NoDepX X RefX
- * @compile/ref=NoDepX.out -XDstdout -XDrawDiagnostics NoDepX.java RefX.java
+ * @compile/ref=NoDepX.out -XDrawDiagnostics NoDepX.java RefX.java
  */
 class NoDepX
 {
--- a/langtools/test/tools/javac/danglingDep/Test1.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/danglingDep/Test1.java	Fri Aug 20 14:48:10 2010 -0400
@@ -25,7 +25,7 @@
  * @test
  * @bug 6213430
  * @clean Test1 X RefX
- * @compile/ref=Test1.out -XDstdout -XDrawDiagnostics Test1.java RefX.java
+ * @compile/ref=Test1.out -XDrawDiagnostics Test1.java RefX.java
  */
 class Test1
 {
--- a/langtools/test/tools/javac/depDocComment/DeprecatedDocComment.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/depDocComment/DeprecatedDocComment.java	Fri Aug 20 14:48:10 2010 -0400
@@ -6,7 +6,7 @@
  * @author Jing Qian
  *
  * @compile DeprecatedDocComment2.java
- * @compile/fail/ref=DeprecatedDocComment.out -XDrawDiagnostics -XDstdout -Werror -deprecation DeprecatedDocComment.java
+ * @compile/fail/ref=DeprecatedDocComment.out -XDrawDiagnostics -Werror -deprecation DeprecatedDocComment.java
  */
 
 // WARNING: This file needs to be compiled with the -deprecation flag on.
--- a/langtools/test/tools/javac/depDocComment/SuppressDeprecation.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/depDocComment/SuppressDeprecation.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary New rules for when deprecation messages are suppressed
  * @author gafter
  *
- * @compile/ref=SuppressDeprecation.out -XDstdout -Xlint:deprecation -XDrawDiagnostics SuppressDeprecation.java
+ * @compile/ref=SuppressDeprecation.out -Xlint:deprecation -XDrawDiagnostics SuppressDeprecation.java
  */
 
 /* Test for the contexts in which deprecations warnings should
--- a/langtools/test/tools/javac/depOverrides/annotation/Test1.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/depOverrides/annotation/Test1.java	Fri Aug 20 14:48:10 2010 -0400
@@ -26,12 +26,12 @@
  * @bug 5086088
  * @summary check warnings generated when overriding deprecated methods
  *
- * @compile/ref=empty       -XDstdout -XDrawDiagnostics -Xlint:deprecation I.java
- * @compile/ref=Test1A.out  -XDstdout -XDrawDiagnostics -Xlint:deprecation A.java
- * @compile/ref=Test1B.out  -XDstdout -XDrawDiagnostics -Xlint:deprecation B.java
- * @compile/ref=Test1B2.out -XDstdout -XDrawDiagnostics -Xlint:deprecation B2.java
- * @compile/ref=empty       -XDstdout -XDrawDiagnostics -Xlint:deprecation B3.java
- * @compile/ref=empty       -XDstdout -XDrawDiagnostics -Xlint:deprecation Test1.java
+ * @compile/ref=empty       -XDrawDiagnostics -Xlint:deprecation I.java
+ * @compile/ref=Test1A.out  -XDrawDiagnostics -Xlint:deprecation A.java
+ * @compile/ref=Test1B.out  -XDrawDiagnostics -Xlint:deprecation B.java
+ * @compile/ref=Test1B2.out -XDrawDiagnostics -Xlint:deprecation B2.java
+ * @compile/ref=empty       -XDrawDiagnostics -Xlint:deprecation B3.java
+ * @compile/ref=empty       -XDrawDiagnostics -Xlint:deprecation Test1.java
  */
 
 
--- a/langtools/test/tools/javac/depOverrides/annotation/Test2.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/depOverrides/annotation/Test2.java	Fri Aug 20 14:48:10 2010 -0400
@@ -26,10 +26,10 @@
  * @bug 5086088
  * @summary check warnings generated when overriding deprecated methods
  *
- * @compile/ref=empty   -XDstdout -XDrawDiagnostics -Xlint:deprecation P.java
- * @compile/ref=Test2Q.out -XDstdout -XDrawDiagnostics -Xlint:deprecation Q.java
- * @compile/ref=Test2R.out -XDstdout -XDrawDiagnostics -Xlint:deprecation R.java
- * @compile/ref=empty   -XDstdout -XDrawDiagnostics -Xlint:deprecation Test2.java
+ * @compile/ref=empty   -XDrawDiagnostics -Xlint:deprecation P.java
+ * @compile/ref=Test2Q.out -XDrawDiagnostics -Xlint:deprecation Q.java
+ * @compile/ref=Test2R.out -XDrawDiagnostics -Xlint:deprecation R.java
+ * @compile/ref=empty   -XDrawDiagnostics -Xlint:deprecation Test2.java
  */
 
 
--- a/langtools/test/tools/javac/depOverrides/annotation/Test3.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/depOverrides/annotation/Test3.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug 5086088
  * @summary check warnings generated when overriding deprecated methods
  *
- * @compile/ref=Test3.out -XDstdout -XDrawDiagnostics -Xlint:deprecation Test3.java
+ * @compile/ref=Test3.out -XDrawDiagnostics -Xlint:deprecation Test3.java
  */
 
 interface LibInterface {
--- a/langtools/test/tools/javac/depOverrides/doccomment/Test1.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/depOverrides/doccomment/Test1.java	Fri Aug 20 14:48:10 2010 -0400
@@ -26,12 +26,12 @@
  * @bug 5086088
  * @summary check warnings generated when overriding deprecated methods
  *
- * @compile/ref=empty    -XDstdout -XDrawDiagnostics -Xlint:deprecation I.java
- * @compile/ref=Test1A.out  -XDstdout -XDrawDiagnostics -Xlint:deprecation A.java
- * @compile/ref=Test1B.out  -XDstdout -XDrawDiagnostics -Xlint:deprecation B.java
- * @compile/ref=Test1B2.out -XDstdout -XDrawDiagnostics -Xlint:deprecation B2.java
- * @compile/ref=empty    -XDstdout -XDrawDiagnostics -Xlint:deprecation B3.java
- * @compile/ref=empty    -XDstdout -XDrawDiagnostics -Xlint:deprecation Test1.java
+ * @compile/ref=empty    -XDrawDiagnostics -Xlint:deprecation I.java
+ * @compile/ref=Test1A.out  -XDrawDiagnostics -Xlint:deprecation A.java
+ * @compile/ref=Test1B.out  -XDrawDiagnostics -Xlint:deprecation B.java
+ * @compile/ref=Test1B2.out -XDrawDiagnostics -Xlint:deprecation B2.java
+ * @compile/ref=empty    -XDrawDiagnostics -Xlint:deprecation B3.java
+ * @compile/ref=empty    -XDrawDiagnostics -Xlint:deprecation Test1.java
  */
 
 
--- a/langtools/test/tools/javac/depOverrides/doccomment/Test2.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/depOverrides/doccomment/Test2.java	Fri Aug 20 14:48:10 2010 -0400
@@ -26,10 +26,10 @@
  * @bug 5086088
  * @summary check warnings generated when overriding deprecated methods
  *
- * @compile/ref=empty   -XDstdout -XDrawDiagnostics -Xlint:deprecation P.java
- * @compile/ref=Test2Q.out -XDstdout -XDrawDiagnostics -Xlint:deprecation Q.java
- * @compile/ref=Test2R.out -XDstdout -XDrawDiagnostics -Xlint:deprecation R.java
- * @compile/ref=empty   -XDstdout -XDrawDiagnostics -Xlint:deprecation Test2.java
+ * @compile/ref=empty   -XDrawDiagnostics -Xlint:deprecation P.java
+ * @compile/ref=Test2Q.out -XDrawDiagnostics -Xlint:deprecation Q.java
+ * @compile/ref=Test2R.out -XDrawDiagnostics -Xlint:deprecation R.java
+ * @compile/ref=empty   -XDrawDiagnostics -Xlint:deprecation Test2.java
  */
 
 
--- a/langtools/test/tools/javac/depOverrides/doccomment/Test3.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/depOverrides/doccomment/Test3.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug 5086088
  * @summary check warnings generated when overriding deprecated methods
  *
- * @compile/ref=Test3.out -XDstdout -XDrawDiagnostics -Xlint:deprecation Test3.java
+ * @compile/ref=Test3.out -XDrawDiagnostics -Xlint:deprecation Test3.java
  */
 
 interface LibInterface {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/CheckExamples.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,218 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6968063
+ * @summary provide examples of code that generate diagnostics
+ * @build Example CheckExamples
+ * @run main CheckExamples
+ */
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Check invariants for a set of examples.
+ * -- each example should exactly declare the keys that will be generated when
+ *      it is run.
+ * -- together, the examples should cover the set of resource keys in the
+ *      compiler.properties bundle. A list of exceptions may be given in the
+ *      not-yet.txt file. Entries on the not-yet.txt list should not be
+ *      covered by examples.
+ * When new keys are added to the resource buncle, it is strongly recommended
+ * that corresponding new examples be added here, if at all practical, instead
+ * of simply and lazily being added to the not-yet.txt list.
+ */
+public class CheckExamples {
+    /**
+     * Standard entry point.
+     */
+    public static void main(String... args) throws Exception {
+        new CheckExamples().run();
+    }
+
+    /**
+     * Run the test.
+     */
+    void run() throws Exception {
+        Set<Example> examples = getExamples();
+
+        Set<String> notYetList = getNotYetList();
+        Set<String> declaredKeys = new TreeSet<String>();
+        for (Example e: examples) {
+            Set<String> e_decl = e.getDeclaredKeys();
+            Set<String> e_actual = e.getActualKeys();
+            for (String k: e_decl) {
+                if (!e_actual.contains(k))
+                    error("Example " + e + " declares key " + k + " but does not generate it");
+            }
+            for (String k: e_actual) {
+                if (!e_decl.contains(k))
+                    error("Example " + e + " generates key " + k + " but does not declare it");
+            }
+            for (String k: e.getDeclaredKeys()) {
+                if (notYetList.contains(k))
+                    error("Example " + e + " declares key " + k + " which is also on the \"not yet\" list");
+                declaredKeys.add(k);
+            }
+        }
+
+        ResourceBundle b =
+            ResourceBundle.getBundle("com.sun.tools.javac.resources.compiler");
+        Set<String> resourceKeys = new TreeSet<String>(b.keySet());
+
+        for (String dk: declaredKeys) {
+            if (!resourceKeys.contains(dk))
+                error("Key " + dk + " is declared in tests but is not a valid key in resource bundle");
+        }
+
+        for (String nk: notYetList) {
+            if (!resourceKeys.contains(nk))
+                error("Key " + nk + " is declared in not-yet list but is not a valid key in resource bundle");
+        }
+
+        for (String rk: resourceKeys) {
+            if (!declaredKeys.contains(rk) && !notYetList.contains(rk))
+                error("Key " + rk + " is declared in resource bundle but is not in tests or not-yet list");
+        }
+
+        System.err.println(examples.size() + " examples checked");
+        System.err.println(notYetList.size() + " keys on not-yet list");
+
+        Counts declaredCounts = new Counts(declaredKeys);
+        Counts resourceCounts = new Counts(resourceKeys);
+        List<String> rows = new ArrayList<String>(Arrays.asList(Counts.prefixes));
+        rows.add("other");
+        rows.add("total");
+        System.err.println();
+        System.err.println(String.format("%-14s %15s %15s %4s",
+                "prefix", "#keys in tests", "#keys in javac", "%"));
+        for (String p: rows) {
+            int d = declaredCounts.get(p);
+            int r = resourceCounts.get(p);
+            System.err.print(String.format("%-14s %15d %15d", p, d, r));
+            if (r != 0)
+                System.err.print(String.format(" %3d%%", (d * 100) / r));
+            System.err.println();
+        }
+
+        if (errors > 0)
+            throw new Exception(errors + " errors occurred.");
+    }
+
+    /**
+     * Get the complete set of examples to be checked.
+     */
+    Set<Example> getExamples() {
+        Set<Example> results = new TreeSet<Example>();
+        File testSrc = new File(System.getProperty("test.src"));
+        File examples = new File(testSrc, "examples");
+        for (File f: examples.listFiles()) {
+            if (f.isDirectory() || f.isFile() && f.getName().endsWith(".java"))
+                results.add(new Example(f));
+        }
+        return results;
+    }
+
+    /**
+     * Get the contents of the "not-yet" list.
+     */
+    Set<String> getNotYetList() {
+        Set<String> results = new TreeSet<String>();
+        File testSrc = new File(System.getProperty("test.src"));
+        File notYetList = new File(testSrc, "examples.not-yet.txt");
+        try {
+            String[] lines = read(notYetList).split("[\r\n]");
+            for (String line: lines) {
+                int hash = line.indexOf("#");
+                if (hash != -1)
+                    line = line.substring(0, hash).trim();
+                if (line.matches("[A-Za-z0-9-_.]+"))
+                    results.add(line);
+            }
+        } catch (IOException e) {
+            throw new Error(e);
+        }
+        return results;
+    }
+
+    /**
+     * Read the contents of a file.
+     */
+    String read(File f) throws IOException {
+        byte[] bytes = new byte[(int) f.length()];
+        DataInputStream in = new DataInputStream(new FileInputStream(f));
+        try {
+            in.readFully(bytes);
+        } finally {
+            in.close();
+        }
+        return new String(bytes);
+    }
+
+    /**
+     * Report an error.
+     */
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+
+    static class Counts {
+        static String[] prefixes = {
+            "compiler.err.",
+            "compiler.warn.",
+            "compiler.note.",
+            "compiler.misc."
+        };
+
+        Counts(Set<String> keys) {
+            nextKey:
+            for (String k: keys) {
+                for (String p: prefixes) {
+                    if (k.startsWith(p)) {
+                        inc(p);
+                        continue nextKey;
+                    }
+                }
+                inc("other");
+            }
+            table.put("total", keys.size());
+        }
+
+        int get(String p) {
+             Integer i = table.get(p);
+             return (i == null ? 0 : i);
+        }
+
+        void inc(String p) {
+            Integer i = table.get(p);
+            table.put(p, (i == null ? 1 : i + 1));
+        }
+
+        Map<String,Integer> table = new HashMap<String,Integer>();
+    };
+}
--- a/langtools/test/tools/javac/diags/CheckResourceKeys.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/diags/CheckResourceKeys.java	Fri Aug 20 14:48:10 2010 -0400
@@ -294,6 +294,7 @@
         Set<String> results = new TreeSet<String>();
         JavaCompiler c = ToolProvider.getSystemJavaCompiler();
         JavaFileManager fm = c.getStandardFileManager(null, null, null);
+        JavaFileManager.Location javacLoc = findJavacLocation(fm);
         String[] pkgs = {
             "javax.annotation.processing",
             "javax.lang.model",
@@ -302,7 +303,7 @@
             "com.sun.tools.javac"
         };
         for (String pkg: pkgs) {
-            for (JavaFileObject fo: fm.list(StandardLocation.PLATFORM_CLASS_PATH,
+            for (JavaFileObject fo: fm.list(javacLoc,
                     pkg, EnumSet.of(JavaFileObject.Kind.CLASS), true)) {
                 String name = fo.getName();
                 // ignore resource files, and files which are not really part of javac
@@ -316,6 +317,23 @@
         return results;
     }
 
+    // depending on how the test is run, javac may be on bootclasspath or classpath
+    JavaFileManager.Location findJavacLocation(JavaFileManager fm) {
+        JavaFileManager.Location[] locns =
+            { StandardLocation.PLATFORM_CLASS_PATH, StandardLocation.CLASS_PATH };
+        try {
+            for (JavaFileManager.Location l: locns) {
+                JavaFileObject fo = fm.getJavaFileForInput(l,
+                    "com.sun.tools.javac.Main", JavaFileObject.Kind.CLASS);
+                if (fo != null)
+                    return l;
+            }
+        } catch (IOException e) {
+            throw new Error(e);
+        }
+        throw new IllegalStateException("Cannot find javac");
+    }
+
     /**
      * Get the set of strings from a class file.
      * Only strings that look like they might be a resource key are returned.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/Example.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,528 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.sun.tools.javac.file.JavacFileManager;
+import java.io.*;
+import java.util.*;
+import java.util.regex.*;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaCompiler.CompilationTask;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+// The following two classes are both used, but cannot be imported directly
+// import com.sun.tools.javac.Main
+// import com.sun.tools.javac.main.Main
+
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.JavacMessages;
+import com.sun.tools.javac.util.JCDiagnostic;
+import java.net.URL;
+import java.net.URLClassLoader;
+import javax.annotation.processing.Processor;
+
+/**
+ * Class to handle example code designed to illustrate javac diagnostic messages.
+ */
+class Example implements Comparable<Example> {
+    /* Create an Example from the files found at path.
+     * The head of the file, up to the first Java code, is scanned
+     * for information about the test, such as what resource keys it
+     * generates when run, what options are required to run it, and so on.
+     */
+    Example(File file) {
+        this.file = file;
+        declaredKeys = new TreeSet<String>();
+        srcFiles = new ArrayList<File>();
+        procFiles = new ArrayList<File>();
+        supportFiles = new ArrayList<File>();
+        srcPathFiles = new ArrayList<File>();
+
+        findFiles(file, srcFiles);
+        for (File f: srcFiles) {
+            parse(f);
+        }
+
+        if (infoFile == null)
+            throw new Error("Example " + file + " has no info file");
+    }
+
+    private void findFiles(File f, List<File> files) {
+        if (f.isDirectory()) {
+            for (File c: f.listFiles()) {
+                if (files == srcFiles && c.getName().equals("processors"))
+                    findFiles(c, procFiles);
+                else if (files == srcFiles && c.getName().equals("sourcepath")) {
+                    srcPathDir = c;
+                    findFiles(c, srcPathFiles);
+                } else if (files == srcFiles && c.getName().equals("support"))
+                    findFiles(c, supportFiles);
+                else
+                    findFiles(c, files);
+            }
+        } else if (f.isFile() && f.getName().endsWith(".java")) {
+            files.add(f);
+        }
+    }
+
+    private void parse(File f) {
+        Pattern keyPat = Pattern.compile(" *// *key: *([^ ]+) *");
+        Pattern optPat = Pattern.compile(" *// *options: *(.*)");
+        Pattern runPat = Pattern.compile(" *// *run: *(.*)");
+        Pattern javaPat = Pattern.compile(" *@?[A-Za-z].*");
+        try {
+            String[] lines = read(f).split("[\r\n]+");
+            for (String line: lines) {
+                Matcher keyMatch = keyPat.matcher(line);
+                if (keyMatch.matches()) {
+                    foundInfo(f);
+                    declaredKeys.add(keyMatch.group(1));
+                    continue;
+                }
+                Matcher optMatch = optPat.matcher(line);
+                if (optMatch.matches()) {
+                    foundInfo(f);
+                    options = Arrays.asList(optMatch.group(1).trim().split(" +"));
+                    continue;
+                }
+                Matcher runMatch = runPat.matcher(line);
+                if (runMatch.matches()) {
+                    foundInfo(f);
+                    runOpts = Arrays.asList(runMatch.group(1).trim().split(" +"));
+                }
+                if (javaPat.matcher(line).matches())
+                    break;
+            }
+        } catch (IOException e) {
+            throw new Error(e);
+        }
+    }
+
+    private void foundInfo(File file) {
+        if (infoFile != null && !infoFile.equals(file))
+            throw new Error("multiple info files found: " + infoFile + ", " + file);
+        infoFile = file;
+    }
+
+    String getName() {
+        return file.getName();
+    }
+
+    /**
+     * Get the set of resource keys that this test declares it will generate
+     * when it is run.
+     */
+    Set<String> getDeclaredKeys() {
+        return declaredKeys;
+    }
+
+    /**
+     * Get the set of resource keys that this test generates when it is run.
+     * The test will be run if it has not already been run.
+     */
+    Set<String> getActualKeys() {
+        if (actualKeys == null)
+            actualKeys = run(false);
+        return actualKeys;
+    }
+
+    /**
+     * Run the test.  Information in the test header is used to determine
+     * how to run the test.
+     */
+    void run(PrintWriter out, boolean raw, boolean verbose) {
+        if (out == null)
+            throw new NullPointerException();
+        try {
+            run(out, null, raw, verbose);
+        } catch (IOException e) {
+            e.printStackTrace(out);
+        }
+    }
+
+    Set<String> run(boolean verbose) {
+        Set<String> keys = new TreeSet<String>();
+        try {
+            run(null, keys, true, verbose);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return keys;
+    }
+
+    /**
+     * Run the test.  Information in the test header is used to determine
+     * how to run the test.
+     */
+    private void run(PrintWriter out, Set<String> keys, boolean raw, boolean verbose)
+            throws IOException {
+        ClassLoader loader = getClass().getClassLoader();
+        if (supportFiles.size() > 0) {
+            File supportDir = new File(tempDir, "support");
+            supportDir.mkdirs();
+            clean(supportDir);
+            List<String> sOpts = Arrays.asList("-d", supportDir.getPath());
+            new Jsr199Compiler(verbose).run(null, null, false, sOpts, procFiles);
+            URLClassLoader ucl =
+                    new URLClassLoader(new URL[] { supportDir.toURI().toURL() }, loader);
+            loader = ucl;
+        }
+
+        File classesDir = new File(tempDir, "classes");
+        classesDir.mkdirs();
+        clean(classesDir);
+
+        List<String> opts = new ArrayList<String>();
+        opts.add("-d");
+        opts.add(classesDir.getPath());
+        if (options != null)
+            opts.addAll(options);
+
+        if (procFiles.size() > 0) {
+            List<String> pOpts = Arrays.asList("-d", classesDir.getPath());
+            new Jsr199Compiler(verbose).run(null, null, false, pOpts, procFiles);
+            opts.add("-classpath"); // avoid using -processorpath for now
+            opts.add(classesDir.getPath());
+            createAnnotationServicesFile(classesDir, procFiles);
+        }
+
+        if (srcPathDir != null) {
+            opts.add("-sourcepath");
+            opts.add(srcPathDir.getPath());
+        }
+
+        try {
+            Compiler c = Compiler.getCompiler(runOpts, verbose);
+            c.run(out, keys, raw, opts, srcFiles);
+        } catch (IllegalArgumentException e) {
+            if (out != null) {
+                out.println("Invalid value for run tag: " + runOpts);
+            }
+        }
+    }
+
+    void createAnnotationServicesFile(File dir, List<File> procFiles) throws IOException {
+        File servicesDir = new File(new File(dir, "META-INF"), "services");
+        servicesDir.mkdirs();
+        File annoServices = new File(servicesDir, Processor.class.getName());
+        Writer out = new FileWriter(annoServices);
+        try {
+            for (File f: procFiles) {
+                out.write(f.getName().toString().replace(".java", ""));
+            }
+        } finally {
+            out.close();
+        }
+    }
+
+    @Override
+    public int compareTo(Example e) {
+        return file.compareTo(e.file);
+    }
+
+    @Override
+    public String toString() {
+        return file.getPath();
+    }
+
+    /**
+     * Read the contents of a file.
+     */
+    private String read(File f) throws IOException {
+        byte[] bytes = new byte[(int) f.length()];
+        DataInputStream in = new DataInputStream(new FileInputStream(f));
+        try {
+            in.readFully(bytes);
+        } finally {
+            in.close();
+        }
+        return new String(bytes);
+    }
+
+    /**
+     * Clean the contents of a directory.
+     */
+    boolean clean(File dir) {
+        boolean ok = true;
+        for (File f: dir.listFiles()) {
+            if (f.isDirectory())
+                ok &= clean(f);
+            ok &= f.delete();
+        }
+        return ok;
+    }
+
+    File file;
+    List<File> srcFiles;
+    List<File> procFiles;
+    File srcPathDir;
+    List<File> srcPathFiles;
+    List<File> supportFiles;
+    File infoFile;
+    private List<String> runOpts;
+    private List<String> options;
+    private Set<String> actualKeys;
+    private Set<String> declaredKeys;
+
+    static File tempDir = new File(System.getProperty("java.io.tmpdir"));
+    static void setTempDir(File tempDir) {
+        Example.tempDir = tempDir;
+    }
+
+    abstract static class Compiler {
+        static Compiler getCompiler(List<String> opts, boolean verbose) {
+            String first;
+            String[] rest;
+            if (opts == null || opts.size() == 0) {
+                first = null;
+                rest = new String[0];
+            } else {
+                first = opts.get(0);
+                rest = opts.subList(1, opts.size()).toArray(new String[opts.size() - 1]);
+            }
+            if (first == null || first.equals("jsr199"))
+                return new Jsr199Compiler(verbose, rest);
+            else if (first.equals("simple"))
+                return new SimpleCompiler(verbose);
+            else if (first.equals("backdoor"))
+                return new BackdoorCompiler(verbose);
+            else
+                throw new IllegalArgumentException(first);
+        }
+
+        protected Compiler(boolean verbose) {
+            this.verbose = verbose;
+        }
+
+        abstract boolean run(PrintWriter out, Set<String> keys, boolean raw,
+                List<String> opts,  List<File> files);
+
+        void setSupportClassLoader(ClassLoader cl) {
+            loader = cl;
+        }
+
+        protected ClassLoader loader;
+        protected boolean verbose;
+    }
+
+    /**
+     * Compile using the JSR 199 API.  The diagnostics generated are
+     * scanned for resource keys.   Not all diagnostic keys are generated
+     * via the JSR 199 API -- for example, rich diagnostics are not directly
+     * accessible, and some diagnostics generated by the file manager may
+     * not be generated (for example, the JSR 199 file manager does not see
+     * -Xlint:path).
+     */
+    static class Jsr199Compiler extends Compiler {
+        List<String> fmOpts;
+
+        Jsr199Compiler(boolean verbose, String... args) {
+            super(verbose);
+            for (int i = 0; i < args.length; i++) {
+                String arg = args[i];
+                if (arg.equals("-filemanager") && (i + 1 < args.length)) {
+                    fmOpts = Arrays.asList(args[++i].split(","));
+                } else
+                    throw new IllegalArgumentException(arg);
+            }
+        }
+
+        @Override
+        boolean run(PrintWriter out, Set<String> keys, boolean raw, List<String> opts, List<File> files) {
+            if (out != null && keys != null)
+                throw new IllegalArgumentException();
+
+            if (verbose)
+                System.err.println("run_jsr199: " + opts + " " + files);
+
+            DiagnosticCollector<JavaFileObject> dc = null;
+            if (keys != null)
+                dc = new DiagnosticCollector<JavaFileObject>();
+
+            if (raw) {
+                List<String> newOpts = new ArrayList<String>();
+                newOpts.add("-XDrawDiagnostics");
+                newOpts.addAll(opts);
+                opts = newOpts;
+            }
+
+            JavaCompiler c = ToolProvider.getSystemJavaCompiler();
+
+            StandardJavaFileManager fm = c.getStandardFileManager(dc, null, null);
+            if (fmOpts != null)
+                fm = new FileManager(fm, fmOpts);
+
+            Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
+
+            CompilationTask t = c.getTask(out, fm, dc, opts, null, fos);
+            Boolean ok = t.call();
+
+            if (keys != null) {
+                for (Diagnostic<? extends JavaFileObject> d: dc.getDiagnostics()) {
+                    scanForKeys((JCDiagnostic) d, keys);
+                }
+            }
+
+            return ok;
+        }
+
+        /**
+         * Scan a diagnostic for resource keys.  This will not detect additional
+         * sub diagnostics that might be generated by a rich diagnostic formatter.
+         */
+        private static void scanForKeys(JCDiagnostic d, Set<String> keys) {
+            keys.add(d.getCode());
+            for (Object o: d.getArgs()) {
+                if (o instanceof JCDiagnostic) {
+                    scanForKeys((JCDiagnostic) o, keys);
+                }
+            }
+            for (JCDiagnostic sd: d.getSubdiagnostics())
+                scanForKeys(d, keys);
+        }
+    }
+
+    /**
+     * Run the test using the standard simple entry point.
+     */
+    static class SimpleCompiler extends Compiler {
+        SimpleCompiler(boolean verbose) {
+            super(verbose);
+        }
+
+        @Override
+        boolean run(PrintWriter out, Set<String> keys, boolean raw, List<String> opts, List<File> files) {
+            if (out != null && keys != null)
+                throw new IllegalArgumentException();
+
+            if (verbose)
+                System.err.println("run_simple: " + opts + " " + files);
+
+            List<String> args = new ArrayList<String>(opts);
+
+            if (keys != null || raw)
+                args.add("-XDrawDiagnostics");
+
+            args.addAll(opts);
+            for (File f: files)
+                args.add(f.getPath());
+
+            StringWriter sw = null;
+            PrintWriter pw;
+            if (keys != null) {
+                sw = new StringWriter();
+                pw = new PrintWriter(sw);
+            } else
+                pw = out;
+
+            int rc = com.sun.tools.javac.Main.compile(args.toArray(new String[args.size()]), pw);
+
+            if (keys != null) {
+                pw.close();
+                scanForKeys(sw.toString(), keys);
+            }
+
+            return (rc == 0);
+        }
+
+        private static void scanForKeys(String text, Set<String> keys) {
+            StringTokenizer st = new StringTokenizer(text, " ,\r\n():");
+            while (st.hasMoreElements()) {
+                String t = st.nextToken();
+                if (t.startsWith("compiler."))
+                    keys.add(t);
+            }
+        }
+    }
+
+    static class BackdoorCompiler extends Compiler {
+        BackdoorCompiler(boolean verbose) {
+            super(verbose);
+        }
+
+        @Override
+        boolean run(PrintWriter out, Set<String> keys, boolean raw, List<String> opts, List<File> files) {
+            if (out != null && keys != null)
+                throw new IllegalArgumentException();
+
+            if (verbose)
+                System.err.println("run_simple: " + opts + " " + files);
+
+            List<String> args = new ArrayList<String>(opts);
+
+            if (out != null && raw)
+                args.add("-XDrawDiagnostics");
+
+            args.addAll(opts);
+            for (File f: files)
+                args.add(f.getPath());
+
+            StringWriter sw = null;
+            PrintWriter pw;
+            if (keys != null) {
+                sw = new StringWriter();
+                pw = new PrintWriter(sw);
+            } else
+                pw = out;
+
+            Context c = new Context();
+            JavacFileManager.preRegister(c); // can't create it until Log has been set up
+            MessageTracker.preRegister(c, keys);
+            com.sun.tools.javac.main.Main m = new com.sun.tools.javac.main.Main("javac", pw);
+            int rc = m.compile(args.toArray(new String[args.size()]), c);
+
+            if (keys != null) {
+                pw.close();
+            }
+
+            return (rc == 0);
+        }
+
+        static class MessageTracker extends JavacMessages {
+
+            MessageTracker(Context context) {
+                super(context);
+            }
+
+            static void preRegister(final Context c, final Set<String> keys) {
+                if (keys != null) {
+                    c.put(JavacMessages.messagesKey, new Context.Factory<JavacMessages>() {
+                        public JavacMessages make() {
+                            return new MessageTracker(c) {
+                                @Override
+                                public String getLocalizedString(Locale l, String key, Object... args) {
+                                    keys.add(key);
+                                    return super.getLocalizedString(l, key, args);
+                                }
+                            };
+                        }
+                    });
+                }
+            }
+        }
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/FileManager.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Pattern;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.NestingKind;
+import javax.tools.JavaFileManager.Location;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+
+import com.sun.tools.javac.api.WrappingJavaFileManager;
+
+/**
+ * A JavaFileManager that can throw IOException on attempting to read or write
+ * selected files that match a regular expression.
+ */
+public class FileManager
+        extends WrappingJavaFileManager<StandardJavaFileManager>
+        implements StandardJavaFileManager {
+    private static final String CANT_READ = "cantRead:";
+    private static final String CANT_WRITE = "cantWrite:";
+
+    private Pattern cantRead;
+    private Pattern cantWrite;
+
+    public FileManager(StandardJavaFileManager fm, List<String> opts) {
+        super(fm);
+        for (String opt: opts) {
+            if (opt.startsWith(CANT_READ))
+                cantRead = Pattern.compile(opt.substring(CANT_READ.length()));
+            else if (opt.startsWith(CANT_WRITE))
+                cantWrite = Pattern.compile(opt.substring(CANT_WRITE.length()));
+            else
+                throw new IllegalArgumentException(opt);
+        }
+    }
+
+    @Override
+    protected JavaFileObject wrap(JavaFileObject fo) {
+        return new WrappedFileObject(fo);
+    }
+
+    @Override
+    protected JavaFileObject unwrap(JavaFileObject fo) {
+        if (fo instanceof WrappedFileObject)
+            return ((WrappedFileObject) fo).delegate;
+        else
+            return fo;
+    }
+
+    public Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles(Iterable<? extends File> files) {
+        return wrap2(fileManager.getJavaFileObjectsFromFiles(files));
+    }
+
+    public Iterable<? extends JavaFileObject> getJavaFileObjects(File... files) {
+        return wrap2(fileManager.getJavaFileObjects(files));
+    }
+
+    public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) {
+        return wrap2(fileManager.getJavaFileObjectsFromStrings(names));
+    }
+
+    public Iterable<? extends JavaFileObject> getJavaFileObjects(String... names) {
+        return wrap2(fileManager.getJavaFileObjects(names));
+    }
+
+    /* This method is regrettably necessary because WrappingJavaFileManager.wrap takes
+     *          Iterable<JavaFileObject> fileObjects
+     * instead of
+     *          Iterable<? extends JavaFileObject> fileObjects
+     */
+    protected Iterable<JavaFileObject> wrap2(Iterable<? extends JavaFileObject> fileObjects) {
+        List<JavaFileObject> mapped = new ArrayList<JavaFileObject>();
+        for (JavaFileObject fileObject : fileObjects)
+            mapped.add(wrap(fileObject));
+        return Collections.unmodifiableList(mapped);
+    }
+
+    public void setLocation(Location location, Iterable<? extends File> path) throws IOException {
+        fileManager.setLocation(location, path);
+    }
+
+    public Iterable<? extends File> getLocation(Location location) {
+        return fileManager.getLocation(location);
+    }
+
+    class WrappedFileObject implements JavaFileObject {
+        WrappedFileObject(JavaFileObject fileObject) {
+            delegate = fileObject;
+        }
+
+        public Kind getKind() {
+            return delegate.getKind();
+        }
+
+        public boolean isNameCompatible(String simpleName, Kind kind) {
+            return delegate.isNameCompatible(simpleName, kind);
+        }
+
+        public NestingKind getNestingKind() {
+            return delegate.getNestingKind();
+        }
+
+        public Modifier getAccessLevel() {
+            return delegate.getAccessLevel();
+        }
+
+        public URI toUri() {
+            return delegate.toUri();
+        }
+
+        public String getName() {
+            return delegate.getName();
+        }
+
+        public InputStream openInputStream() throws IOException {
+            checkRead();
+            return delegate.openInputStream();
+        }
+
+        public OutputStream openOutputStream() throws IOException {
+            checkWrite();
+            return delegate.openOutputStream();
+        }
+
+        public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
+            checkRead();
+            return delegate.openReader(ignoreEncodingErrors);
+        }
+
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+            checkRead();
+            return delegate.getCharContent(ignoreEncodingErrors);
+        }
+
+        public Writer openWriter() throws IOException {
+            checkWrite();
+            return delegate.openWriter();
+        }
+
+        public long getLastModified() {
+            return delegate.getLastModified();
+        }
+
+        public boolean delete() {
+            return delegate.delete();
+        }
+
+        void checkRead() throws IOException {
+            if (cantRead != null && cantRead.matcher(getName()).matches())
+                throw new IOException("FileManager: Can't read");
+        }
+
+        void checkWrite() throws IOException {
+            if (cantWrite != null && cantWrite.matcher(getName()).matches())
+                throw new IOException("FileManager: Can't write");
+        }
+
+        JavaFileObject delegate;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/HTMLWriter.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,582 @@
+/*
+ * Copyright (c) 1996,2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+
+/**
+ * A class to facilitate writing HTML via a stream.
+ */
+public class HTMLWriter
+{
+    /**
+     * Create an HTMLWriter object, using a default doctype for HTML 3.2.
+     * @param out a Writer to which to write the generated HTML
+     * @throws IOException if there is a problem writing to the underlying stream
+     */
+    public HTMLWriter(Writer out) throws IOException {
+        this(out, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">");
+    }
+
+    /**
+     * Create an HTMLWriter object, using a specifed doctype header.
+     * @param out a Writer to which to write the generated HTML
+     * @param docType a string containing a doctype header for the HTML to be generetaed
+     * @throws IOException if there is a problem writing to the underlying stream
+     */
+    public HTMLWriter(Writer out, String docType) throws IOException {
+        if (out instanceof BufferedWriter)
+            this.out = (BufferedWriter) out;
+        else
+            this.out = new BufferedWriter(out);
+        this.out.write(docType);
+        this.out.newLine();
+    }
+
+    /**
+     * Create an HTMLWriter object, using a specified bundle for localizing messages.
+     * @param out a Writer to which to write the generated HTML
+     * @param i18n a resource bundle to use to localize messages
+     * @throws IOException if there is a problem writing to the underlying stream
+     */
+    public HTMLWriter(Writer out, ResourceBundle i18n) throws IOException {
+        this(out);
+        this.i18n = i18n;
+    }
+
+
+    /**
+     * Create an HTMLWriter object, using a specifed doctype header and
+     * using a specified bundle for l0calizing messages.
+     * @param out a Writer to which to write the generated HTML
+     * @param docType a string containing a doctype header for the HTML to be generetaed
+     * @param i18n a resource bundle to use to localize messages
+     * @throws IOException if there is a problem writing to the underlying stream
+     */
+    public HTMLWriter(Writer out, String docType, ResourceBundle i18n) throws IOException {
+        this(out, docType);
+        this.i18n = i18n;
+    }
+
+    /**
+     * Set the reource bundle to be used for localizing messages.
+     * @param i18n the resource bundle to be used for localizing messages
+     */
+    public void setResourceBundle(ResourceBundle i18n) {
+        this.i18n = i18n;
+    }
+
+    /**
+     * Flush the stream, and the underlying output stream.
+     * @throws IOException if there is a problem writing to the underlying stream
+     */
+    public void flush() throws IOException {
+        out.flush();
+    }
+
+    /**
+     * Close the stream, and the underlying output stream.
+     * @throws IOException if there is a problem closing the underlying stream
+     */
+    public void close() throws IOException {
+        out.close();
+    }
+
+    /**
+     * Write a newline to the underlying output stream.
+     * @throws IOException if there is a problem writing to the underlying stream
+     */
+    public void newLine() throws IOException {
+        out.newLine();
+    }
+
+    /**
+     * Start an HTML tag.  If a prior tag has been started, it will
+     * be closed first. Once a tag has been opened, attributes for the
+     * tag may be written out, followed by body content before finally
+     * ending the tag.
+     * @param tag the tag to be started
+     * @throws IOException if there is a problem writing to the underlying stream
+     * @see #writeAttr
+     * @see #write
+     * @see #endTag
+     */
+    public void startTag(String tag) throws IOException {
+        if (state == IN_TAG) {
+            out.write(">");
+            state = IN_BODY;
+        }
+        //newLine();
+        out.write("<");
+        out.write(tag);
+        state = IN_TAG;
+    }
+
+    /**
+     * Finish an HTML tag. It is expected that a call to endTag will match
+     * a corresponding earlier call to startTag, but there is no formal check
+     * for this.
+     * @param tag the tag to be closed.
+     * @throws IOException if there is a problem writing to the underlying stream
+     */
+    public void endTag(String tag) throws IOException {
+        if (state == IN_TAG) {
+            out.write(">");
+            state = IN_BODY;
+            out.newLine();
+        }
+        out.write("</");
+        out.write(tag);
+        out.write(">");
+        //out.newLine();   // PATCHED, jjg
+        state = IN_BODY;
+    }
+
+    /**
+     * Finish an empty element tag, such as a META, BASE or LINK tag.
+     * This is expected to correspond with a startTag.
+     * @param tag the tag which is being closed.  this is only useful for
+     *        validation, it is not written out
+     * @throws IllegalStateException if this call does not follow startTag
+     *         (stream is not currently inside a tag)
+     * @throws IOException if there is a problem writing to the underlying stream
+     */
+    public void endEmptyTag(String tag) throws IOException {
+        if (state != IN_TAG)
+            throw new IllegalStateException();
+
+        out.write(">");
+        state = IN_BODY;
+        out.newLine();
+    }
+
+    /**
+     * Write an attribute for a tag. A tag must previously have been started.
+     * All tag attributes must be written before any body text is written.
+     * The value will be quoted if necessary when writing it to the underlying
+     * stream. No check is made that the attribute is valid for the current tag.
+     * @param name the name of the attribute to be written
+     * @param value the value of the attribute to be written
+     * @throws IllegalStateException if the stream is not in a state to
+     * write attributes -- e.g. if this call does not follow startTag or other
+     * calls of writteAttr
+     * @throws IOException if there is a problem writing to the underlying stream
+     */
+    public void writeAttr(String name, String value) throws IOException {
+        if (state != IN_TAG)
+            throw new IllegalStateException();
+
+        out.write(" ");
+        out.write(name);
+        out.write("=");
+        boolean alpha = true;
+        for (int i = 0; i < value.length() && alpha; i++)
+            alpha = Character.isLetter(value.charAt(i));
+        if (!alpha)
+            out.write("\"");
+        out.write(value);
+        if (!alpha)
+            out.write("\"");
+    }
+
+    /**
+     * Write an attribute for a tag. A tag must previously have been started.
+     * All tag attributes must be written before any body text is written.
+     * The value will be quoted if necessary when writing it to the underlying
+     * stream. No check is made that the attribute is valid for the current tag.
+     * @param name the name of the attribute to be written
+     * @param value the value of the attribute to be written
+     * @throws IllegalStateException if the stream is not in a state to
+     * write attributes -- e.g. if this call does not follow startTag or other
+     * calls of writteAttr
+     * @throws IOException if there is a problem writing to the underlying stream
+     */
+    public void writeAttr(String name, int value) throws IOException {
+        writeAttr(name, Integer.toString(value));
+    }
+
+    /**
+     * Write a line of text, followed by a newline.
+     * The text will be escaped as necessary.
+     * @param text the text to be written.
+     * @throws IOException if there is a problem closing the underlying stream
+     */
+    public void writeLine(String text) throws IOException {
+        write(text);
+        out.newLine();
+    }
+
+    /**
+     * Write body text, escaping it as necessary.
+     * If this call follows a call of startTag, the open tag will be
+     * closed -- meaning that no more attributes can be written until another
+     * tag is started.  If the text value is null, the current tag will still
+     * be closed, but no other text will be written.
+     * @param text the text to be written, may be null or zero length.
+     * @throws IOException if there is a problem writing to the underlying stream
+     */
+    public void write(String text) throws IOException {
+        if (state == IN_TAG) {
+            out.write(">");
+            state = IN_BODY;
+        }
+
+        if (text == null)
+            return;
+
+        // check to see if there are any special characters
+        boolean specialChars = false;
+        for (int i = 0; i < text.length() && !specialChars; i++) {
+            switch (text.charAt(i)) {
+            case '<': case '>': case '&':
+                specialChars = true;
+            }
+        }
+
+        // if there are special characters write the string character at a time;
+        // otherwise, write it out as is
+        if (specialChars) {
+            for (int i = 0; i < text.length(); i++) {
+                char c = text.charAt(i);
+                switch (c) {
+                case '<': out.write("&lt;"); break;
+                case '>': out.write("&gt;"); break;
+                case '&': out.write("&amp;"); break;
+                default: out.write(c);
+                }
+            }
+        }
+        else
+            out.write(text);
+    }
+
+    /**
+     * Write a basic HTML entity, such as &nbsp; or &#123; .
+     * @param entity the entity to write
+     * @throws IOException if there is a problem writing to the underlying stream
+     */
+    public void writeEntity(String entity) throws IOException {
+        if (state == IN_TAG) {
+            out.write(">");
+            state = IN_BODY;
+        }
+        out.write(entity);
+    }
+
+    /**
+     * Write an image tag, using a specified path for the image source attribute.
+     * @param imagePath the path for the image source
+     * @throws IOException if there is a problem closing the underlying stream
+     */
+    public void writeImage(String imagePath) throws IOException {
+        startTag(IMAGE);
+        writeAttr(SRC, imagePath);
+    }
+
+    /**
+     * Write an image tag, using a specified path for the image source attribute.
+     * @param imageURL the url for the image source
+     * @throws IOException if there is a problem closing the underlying stream
+     */
+    public void writeImage(URL imageURL) throws IOException {
+        writeImage(imageURL.toString());
+    }
+
+    /**
+     * Write a hypertext link.
+     * @param anchor the target for the link
+     * @param body the body text for the link
+     * @throws IOException if there is a problem closing the underlying stream
+     */
+    public void writeLink(String anchor, String body) throws IOException {
+        startTag(A);
+        writeAttr(HREF, anchor);
+        write(body);
+        endTag(A);
+    }
+
+    /**
+     * Write a hypertext link.
+     * @param file the target for the link
+     * @param body the body text for the link
+     * @throws IOException if there is a problem closing the underlying stream
+     */
+    public void writeLink(File file, String body) throws IOException {
+        startTag(A);
+        StringBuffer sb = new StringBuffer();
+        String path = file.getPath().replace(File.separatorChar, '/');
+        if (file.isAbsolute() && !path.startsWith("/"))
+            sb.append('/');
+        sb.append(path);
+        writeAttr(HREF, sb.toString());
+        write(body);
+        endTag(A);
+    }
+
+    /**
+     * Write a hypertext link.
+     * @param file the target and body for the link
+     * @throws IOException if there is a problem closing the underlying stream
+     */
+    public void writeLink(File file) throws IOException {
+        writeLink(file, file.getPath());
+    }
+
+    /**
+     * Write a hypertext link.
+     * @param url the target for the link
+     * @param body the body text for the link
+     * @throws IOException if there is a problem closing the underlying stream
+     */
+    public void writeLink(URL url, String body) throws IOException {
+        startTag(A);
+        writeAttr(HREF, url.toString());
+        write(body);
+        endTag(A);
+    }
+
+    /**
+     * Write the destination marker for a hypertext link.
+     * @param anchor the destination marker for hypertext links
+     * @param body the body text for the marker
+     * @throws IOException if there is a problem closing the underlying stream
+     */
+    public void writeLinkDestination(String anchor, String body) throws IOException {
+        startTag(A);
+        writeAttr(NAME, anchor);
+        write(body);
+        endTag(A);
+    }
+
+    /**
+     * Write a parameter tag.
+     * @param name the name of the parameter
+     * @param value the value of the parameter
+     * @throws IOException if there is a problem closing the underlying stream
+     */
+    public void writeParam(String name, String value) throws IOException {
+        startTag(PARAM);
+        writeAttr(NAME, name);
+        writeAttr(VALUE, value);
+    }
+
+    /**
+     * Write a style attribute.
+     * @param value the value for the style atrtribute
+     * @throws IOException if there is a problem closing the underlying stream
+     */
+    public void writeStyleAttr(String value) throws IOException {
+        writeAttr(STYLE, value);
+    }
+
+    /**
+     * Write a localized message, using a specified resource bundle.
+     * @param i18n the resource bundle used to localize the message
+     * @param key the key for the message to be localized
+     * @throws IOException if there is a problem closing the underlying stream
+     */
+    public void write(ResourceBundle i18n, String key) throws IOException {
+        write(getString(i18n, key));
+    }
+
+    /**
+     * Write a localized message, using a specified resource bundle.
+     * @param i18n the resource bundle used to localize the message
+     * @param key the key for the message to be localized
+     * @param arg an argument to be formatted into the localized message
+     * @throws IOException if there is a problem closing the underlying stream
+     */
+    public void write(ResourceBundle i18n, String key, Object arg) throws IOException {
+        write(getString(i18n, key, arg));
+    }
+
+    /**
+     * Write a localized message, using a specified resource bundle.
+     * @param i18n the resource bundle used to localize the message
+     * @param key the key for the message to be localized
+     * @param args arguments to be formatted into the localized message
+     * @throws IOException if there is a problem closing the underlying stream
+     */
+    public void write(ResourceBundle i18n, String key, Object[] args) throws IOException {
+        write(getString(i18n, key, args));
+    }
+
+    /**
+     * Write a localized message, using the default resource bundle.
+     * @param key the key for the message to be localized
+     * @throws IOException if there is a problem closing the underlying stream
+     */
+    public void writeI18N(String key) throws IOException {
+        write(getString(i18n, key));
+    }
+
+    /**
+     * Write a localized message, using the default resource bundle.
+     * @param key the key for the message to be localized
+     * @param arg an argument to be formatted into the localized message
+     * @throws IOException if there is a problem closing the underlying stream
+     */
+    public void writeI18N(String key, Object arg) throws IOException {
+        write(getString(i18n, key, arg));
+    }
+
+    /**
+     * Write a localized message, using the default resource bundle.
+     * @param key the key for the message to be localized
+     * @param args arguments to be formatted into the localized message
+     * @throws IOException if there is a problem closing the underlying stream
+     */
+    public void writeI18N(String key, Object[] args) throws IOException {
+        write(getString(i18n, key, args));
+    }
+
+    private String getString(ResourceBundle rb, String key, Object... args) {
+        String s = rb.getString(key);
+        return MessageFormat.format(s, args);
+    }
+
+    /** The HTML "a" tag. */
+    public static final String A = "a";
+    /** The HTML "align" attribute. */
+    public static final String ALIGN = "align";
+    /** The HTML "b" tag. */
+    public static final String B = "b";
+    /** The HTML "body" tag. */
+    public static final String BODY = "body";
+    /** The HTML "border" attribute. */
+    public static final String BORDER = "border";
+    /** The HTML "br" tag. */
+    public static final String BR = "br";
+    /** The HTML "class" attribute. */
+    public static final String CLASS  = "class";
+    /** The HTML "classid" attribute. */
+    public static final String CLASSID  = "classid";
+    /** The HTML "code" tag. */
+    public static final String CODE  = "code";
+    /** The HTML "color" attribte. */
+    public static final String COLOR  = "color";
+    /** The HTML "col" attribute value. */
+    public static final String COL = "col";
+    /** The HTML "dd" tag. */
+    public static final String DD = "dd";
+    /** The HTML "div" tag. */
+    public static final String DIV = "div";
+    /** The HTML "dl" tag. */
+    public static final String DL = "dl";
+    /** The HTML "dt" tag. */
+    public static final String DT = "dt";
+    /** The HTML "font" tag. */
+    public static final String FONT = "font";
+    /** The HTML "h1" tag. */
+    public static final String H1 = "h1";
+    /** The HTML "h2" tag. */
+    public static final String H2 = "h2";
+    /** The HTML "h3" tag. */
+    public static final String H3 = "h3";
+    /** The HTML "h4" tag. */
+    public static final String H4 = "h4";
+    /** The HTML "h5" tag. */
+    public static final String H5 = "h5";
+    /** The HTML "head" tag. */
+    public static final String HEAD = "head";
+    /** The HTML "href" attribute. */
+    public static final String HREF = "href";
+    /** The HTML "html" tag. */
+    public static final String HTML = "html";
+    /** The HTML "hr" tag. */
+    public static final String HR = "hr";
+    /** The HTML "i" tag. */
+    public static final String I = "i";
+    /** The HTML "id" tag. */
+    public static final String ID = "id";
+    /** The HTML "image" tag. */
+    public static final String IMAGE = "image";
+    /** The HTML "left" attribute value. */
+    public static final String LEFT = "left";
+    /** The HTML "li" tag. */
+    public static final String LI = "li";
+    /** The HTML "link" tag. */
+    public static final String LINK = "link";
+    /** The HTML "name" attribute. */
+    public static final String NAME = "name";
+    /** The HTML "object" tag. */
+    public static final String OBJECT = "object";
+    /** The HTML "p" tag. */
+    public static final String PARAM = "param";
+    /** The HTML "param" tag. */
+    public static final String P = "p";
+    /** The HTML "rel" attribute value. */
+    public static final String REL = "rel";
+    /** The HTML "right" attribute value. */
+    public static final String RIGHT = "right";
+    /** The HTML "row" attribute value. */
+    public static final String ROW = "row";
+    /** The HTML "script" tag. */
+    public static final String SCRIPT = "script";
+    /** The HTML "small" tag. */
+    public static final String SMALL = "small";
+    /** The HTML "span" tag. */
+    public static final String SPAN = "span";
+    /** The HTML "src" attribute. */
+    public static final String SRC = "src";
+    /** The HTML "scope" attribute. */
+    public static final String SCOPE = "scope";
+    /** The HTML "style" attribute. */
+    public static final String STYLE = "style";
+    /** The HTML "table" tag. */
+    public static final String TABLE = "table";
+    /** The HTML "td" tag. */
+    public static final String TD = "td";
+    /** The HTML type for JavaScript. */
+    public static final String TEXT_JAVASCRIPT = "text/javascript";
+    /** The HTML "title"attribute. */
+    public static final String TITLE = "title";
+    /** The HTML "th" tag. */
+    public static final String TH = "th";
+    /** The HTML "top" attribute value. */
+    public static final String TOP = "top";
+    /** The HTML "tr" tag. */
+    public static final String TR = "tr";
+    /** The HTML "type" attribute. */
+    public static final String TYPE = "type";
+    /** The HTML "ul" tag. */
+    public static final String UL = "ul";
+    /** The HTML "valign" attribute. */
+    public static final String VALIGN = "valign";
+    /** The HTML "value" attribute. */
+    public static final String VALUE = "value";
+
+
+    private BufferedWriter out;
+    private int state;
+    private ResourceBundle i18n;
+    private static final int IN_TAG = 1;
+    private static final int IN_BODY = 2;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/README.examples.txt	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,134 @@
+Diagnostics Examples.
+
+The "examples/ directory contains a collection of examples of Java code, each of
+which is designed to illustrate one or more diagnostics that can be generated by
+the JDK Java compiler, javac. These examples are represented by files or
+directories of files, each of which is designed to illustrate a specific
+diagnostic. Sometimes it is unavoidable that creating one issue will lead to
+downstream issues: this is especially true for lex errors, where the error
+recovery is fragile at best. Each example declares the diagnostics that it is
+expected to generate -- this allows the examples to be verified and facilitates
+searching for examples for specific messages.
+
+Normally, tests for javac errors avoid checking the actual error messages that
+get generated. Older tests simply verify that one or more warnings or errors
+are generated; more recent tests verify that specific messages are generated,
+but these tests typically avoid checking the localized text by using the
+-XDrawDiagnostics mechanism. In addition, the focus of such tests is often on
+completeness instead of simplicity.
+
+By contrast, the intent of these examples is to provide simple and easy to
+understand examples of the situations in which a diagnostic can arise, and the
+messages that may be displayed. This will aid in reviewing the output generated
+by javac and in localizing the resource bundle to other locales. In addition,
+the examples include simple meta-information so that the collection as a whole
+can be audited for coverage, thus encouraging new examples to be added when new
+diagnostics are added to javac.
+
+There are two utilities for processing these examples.
+
+The first utility is "CheckExamples" which checks various conditions for the
+examples:
+-- each example must generate exactly the set of keys that it is declared to
+   generate
+-- together, the examples must generate all the resource keys coming from javac
+   (except for resource keys that are registered in a "not yet" list)
+-- the "not yet" list should only contain those resource keys from javac that
+   are not covered by any example
+
+CheckExamples can be run standalone, and as a jtreg test, and will fail if any
+anomalous conditions are found.
+
+The second utility is "RunExamples" which runs selected examples or all of them.
+The examples can be run with -XDrawDiagnostics or without.   Examples can be
+selected by name or by resource key.   Most examples are simple to run directly
+anyway, but some use annotation processors or sourcepath or other options, and
+the framework handles all these requirements.
+
+RunExamples can be run standalone and as a jtreg test, in which case it
+generates a simple plain text report. In addition, the langtools/make/build.xml
+file has a target "diags-examples" that uses RunExamples to create an HTML
+report containing the output from all the examples.
+
+
+Adding examples.
+
+When new diagnostics are added to javac, CheckExamples will probably initially
+fail because the diagnostic will not have a corresponding example, nor will the
+resource key be registered in the "not yet" list. Avoid the temptation to
+simply add the resource key to the "not yet" list, except as a last resort.
+
+Examples should be as simple as possible to illustrate a diagnostic.  An example
+that is a single file is to be preferred over multiple files. An example that
+generates just the one intended diagnostic is to be preferred over one that
+generates multiple diagnostics. Examples should be a simple illustration of the
+conditions that give rise to the diagnostic and should be easy to understand by
+the reviewer and, potentially, by the localization folk, who have to understand
+the context in which these new messages can appear.
+
+
+Specification for writing examples.
+
+An example may a single file or a directory of files directly in the "examples"
+directory. One file within an example must contain meta-information such as the
+keys that it generates, any javac options that may be required, and additional
+info about how to run the test, if needed.
+
+If an example is represented by a directory of files, by default all files
+within that directory will be compiled together, putting all the files on the
+command line. However, some subdirectories are special:
+-- processors/
+    Files within this directory will be treated as annotation processors and
+    compiled ahead of time. Currently, annotation processors are made available
+    to javac using the -classpath option (not -processorpath). This is to avoid
+    explicit use of annotation processing options on the javac command line.
+    Any annotation processors found will be registered for access by the JDK
+    service loaded. Currently, annotation processors are assumed to be in the
+    unnamed package.
+-- sourcepath/
+    If present, this directory will be put passed to javac using the -sourcepath
+    option.
+-- classpath/
+    This name is reserved for future use. It is expected that this directory
+    will be used to provide classes to be compiled and passes to javac via the
+    -classpath option.
+-- support/
+    This name is reserved for future use. It is expected that this directory
+    will be used to provide classes that setup non-standard conditions for a
+    test, such as very large source files, or illegal class files.
+
+Meta-information is represented by simple comment lines in exactly one of the
+source files of the example.  The file must not be in one of the special
+subdirectories (processors/, sourcepath/, classpath/ or support/). Three
+different types of information may be given:
+// key: <resource-key>
+    One or more such lines must be provided, declaring the full resource keys
+    that will be used by javac when this example is run.
+// options: <javac-options>
+    This line may be given at most once, providing one or more options to be
+    passed to javac. It is not possible to use this to specify options that
+    require filenames or directories.
+// run: <mode> <optional-args>
+    This line may be given at most once, providing infomation about how to
+    run the example. Three different kinds are supported:
+    jsr199 -- The example will be run using the JSR 199 Compiler API.
+              This is the default if the tag is omitted. Messages generated
+              by the "rich diagnostic formatter" can not be accessed in this
+              way.  However, this mode does provide additional options for
+              simulating errors in the filesystem. (See the options below.)
+    simple -- The example will be run using the simple com.sun.tools.javac.Main
+              API. This mode is most like the normal command line invocation.
+    backdoor -- The example will be run using an internal "backdoor" API, that
+              interposes access to the main compiler message bundle. This mode
+              is required to detect and track messages that bypass the normal
+              diagnostic mechanisms, such as output generated by the -verbose
+              option.
+
+The "jsr199" run mode accepts the following options:
+    -cantRead:pattern
+    -cantWrite:pattern
+In both cases, the pattern is a standard Java regular expression (See the
+javadoc for java.util.regex.Pattern for a complete specification.) Attempts to
+read or write from files matching the corresponding pattern will cause an
+IOException to occur within javac.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/RunExamples.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,582 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 6968063
+ * @summary provide examples of code that generate diagnostics
+ * @build Example HTMLWriter RunExamples
+ * @run main RunExamples
+ */
+
+import java.io.*;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Utility to run selected or all examples, writing results to
+ * stdout, a plain text file or an HTML file. This program can be
+ * run standalone, or as a jtreg test.
+ *
+ * Options:
+ *  -examples dir       directory of examples. Defaults to ${test.src}/examples
+ *  -raw                run examples with -XDrawDiagnostics
+ *  -showFiles          include text of source files in the output
+ *  -verbose            verbose output
+ *  -o file             write output to file: format will be HTML if
+ *                      file has .html extension; otherwise it will be plain text.
+ *                      default is to stdout
+ *  -title string       specify a title, only applies to HTML output
+ */
+public class RunExamples {
+    public static void main(String... args) throws Exception {
+        boolean jtreg = (System.getProperty("test.src") != null);
+        File tmpDir;
+        if (jtreg) {
+            // use standard jtreg scratch directory: the current directory
+            tmpDir = new File(System.getProperty("user.dir"));
+        } else {
+            tmpDir = new File(System.getProperty("java.io.tmpdir"),
+                    RunExamples.class.getName()
+                    + (new SimpleDateFormat("yyMMddHHmmss")).format(new Date()));
+        }
+        Example.setTempDir(tmpDir);
+
+        RunExamples r = new RunExamples();
+
+        try {
+            if (r.run(args))
+                return;
+        } finally {
+            /* VERY IMPORTANT NOTE. In jtreg mode, tmpDir is set to the
+             * jtreg scratch directory, which is the current directory.
+             * In case someone is faking jtreg mode, make sure to only
+             * clean tmpDir when it is reasonable to do so.
+             */
+            if (tmpDir.isDirectory() &&
+                    tmpDir.getName().startsWith(RunExamples.class.getName())) {
+                if (clean(tmpDir))
+                    tmpDir.delete();
+            }
+        }
+
+        if (jtreg)
+            throw new Exception(r.errors + " errors occurred");
+        else
+            System.exit(1);
+    }
+
+    boolean run(String... args) {
+        Set<String> selectedKeys = new TreeSet<String>();
+        Set<Example> selectedExamples = new TreeSet<Example>();
+        File testSrc = new File(System.getProperty("test.src", "."));
+        File examplesDir = new File(testSrc, "examples");
+        File outFile = null;
+        boolean raw = false;
+        boolean showFiles = false;
+        boolean verbose = false;
+        String title = null;
+
+        for (int i = 0; i < args.length; i++) {
+            String arg = args[i];
+            if (arg.equals("-k") && (i + 1) < args.length)
+                selectedKeys.add(args[++i]);
+            else if (arg.equals("-examples") && (i + 1) < args.length)
+                examplesDir = new File(args[++i]);
+            else if (arg.equals("-raw"))
+                raw = true;
+            else if (arg.equals("-showFiles"))
+                showFiles = true;
+            else if (arg.equals("-verbose"))
+                verbose = true;
+            else if (arg.equals("-o") && (i + 1) < args.length)
+                outFile = new File(args[++i]);
+            else if (arg.equals("-title") && (i + 1) < args.length)
+                title = args[++i];
+            else if (arg.startsWith("-")) {
+                error("unknown option: " + arg);
+                return false;
+            } else {
+                while (i < args.length) {
+                    File f = new File(examplesDir, args[i]);
+                    selectedExamples.add(new Example(f));
+                    i++;
+                }
+            }
+        }
+
+        if (selectedKeys.size() > 0) {
+            Set<Example> examples = getExamples(examplesDir);
+        nextKey:
+            for (String k: selectedKeys) {
+                for (Example e: examples) {
+                    if (e.getDeclaredKeys().contains(k))
+                        continue nextKey;
+                }
+                error("Key " + k + ": no examples found");
+            }
+        } else {
+            if (selectedExamples.size() == 0)
+                selectedExamples = getExamples(examplesDir);
+        }
+
+        try {
+            Runner r;
+            if (outFile == null) {
+                PrintWriter out = new PrintWriter(System.out);
+                r = new TextRunner(out, showFiles, raw, verbose);
+            } else if (outFile.getName().endsWith(".html"))
+                r = new HTMLRunner(outFile, showFiles, raw, verbose, title);
+            else
+                r = new TextRunner(outFile, showFiles, raw, verbose);
+            r.run(selectedExamples);
+            r.close();
+        } catch (IOException e) {
+            error("Error writing output: " + e);
+        }
+
+        return (errors == 0);
+    }
+
+    /**
+     * Get the complete set of examples to be checked.
+     */
+    Set<Example> getExamples(File examplesDir) {
+        Set<Example> results = new TreeSet<Example>();
+        for (File f: examplesDir.listFiles()) {
+            if (f.isDirectory() || f.isFile() && f.getName().endsWith(".java"))
+                results.add(new Example(f));
+        }
+        return results;
+    }
+
+    /**
+     * Report an error.
+     */
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+
+    /**
+     * Clean the contents of a directory.
+     */
+    static boolean clean(File dir) {
+        boolean ok = true;
+        for (File f: dir.listFiles()) {
+            if (f.isDirectory())
+                ok &= clean(f);
+            ok &= f.delete();
+        }
+        return ok;
+    }
+
+    static abstract class Runner {
+        Runner(boolean showFiles, boolean raw, boolean verbose) {
+            this.showFiles = showFiles;
+            this.raw = raw;
+            this.verbose = verbose;
+        }
+
+        void close() throws IOException { }
+
+        void run(Collection<Example> examples) throws IOException {
+            for (Example e: examples) {
+                startExample(e);
+                if (showFiles) {
+                    showFile(e, e.infoFile);
+                    Set<File> srcFiles = new TreeSet<File>(e.srcFiles);
+                    srcFiles.remove(e.infoFile);
+                    showFiles(e, srcFiles);
+                    showFiles(e, e.srcPathFiles);
+                    showFiles(e, e.procFiles);
+                    showFiles(e, e.supportFiles);
+                }
+                run(e);
+            }
+        }
+
+        void showFiles(Example e, Collection<File> files) throws IOException {
+            for (File f: files)
+                showFile(e, f);
+        }
+
+        abstract void startExample(Example e) throws IOException;
+
+        abstract void showFile(Example e, File f) throws IOException;
+
+        abstract void run(Example e) throws IOException;
+
+        protected String read(File f) throws IOException {
+            byte[] bytes = new byte[(int) f.length()];
+            DataInputStream in = new DataInputStream(new FileInputStream(f));
+            try {
+                in.readFully(bytes);
+            } finally {
+                in.close();
+            }
+            return new String(bytes);
+        }
+
+        protected Pattern copyrightHeaderPat =
+                Pattern.compile("(?s)(/\\*.*?Copyright.*?\\*/\n)\\s*(.*)");
+        protected Pattern infoHeaderPat =
+                Pattern.compile("(?s)((?://\\s*[a-z]+:[^\n]*\n)+)\\s*(.*)");
+
+        protected boolean showFiles;
+        protected boolean raw;
+        protected boolean verbose;
+    }
+
+    static class TextRunner extends Runner {
+        TextRunner(File file, boolean showFiles, boolean raw, boolean verbose)
+                throws IOException {
+            super(showFiles, raw, verbose);
+            this.file = file;
+            out = new PrintWriter(new FileWriter(file));
+        }
+
+        TextRunner(PrintWriter out, boolean showFiles, boolean raw, boolean verbose)
+                throws IOException {
+            super(showFiles, raw, verbose);
+            this.out = out;
+        }
+
+        @Override
+        void close() {
+            if (file != null)
+                out.close();
+        }
+
+        @Override
+        void startExample(Example e) {
+            out.println("----- " + e.getName() + " --------------------");
+            out.println();
+        }
+
+        @Override
+        void showFile(Example e, File f) {
+            out.println("--- " + f);
+            String text;
+            try {
+                text = read(f);
+            } catch (IOException ex) {
+                text = "Error reading " + f + "; " + ex;
+            }
+            Matcher m = copyrightHeaderPat.matcher(text);
+            if (m.matches()) {
+                out.println("(Copyright)");
+                writeLines(m.group(2));
+            } else {
+                writeLines(text);
+            }
+            out.println();
+        }
+
+        @Override
+        void run(Example e) {
+            // only show Output: header if also showing files
+            if (showFiles)
+                out.println("--- Output:");
+            e.run(out, raw, verbose);
+            out.println();
+        }
+
+        void writeLines(String text) {
+            for (String line: text.split("\n"))
+                out.println(line);
+        }
+
+        File file;
+        PrintWriter out;
+    }
+
+    static class HTMLRunner extends Runner {
+        HTMLRunner(File file, boolean showFiles, boolean raw, boolean verbose, String title)
+                throws IOException {
+            super(showFiles, raw, verbose);
+            this.file = file;
+            PrintWriter out = new PrintWriter(new FileWriter(file));
+            html = new HTMLWriter(out);
+            html.startTag(HTMLWriter.HEAD);
+            if (title != null) {
+                html.startTag(HTMLWriter.TITLE);
+                html.write(title);
+                html.endTag(HTMLWriter.TITLE);
+            }
+            html.startTag(HTMLWriter.STYLE);
+            html.newLine();
+            html.writeLine("div.file { background-color:#e0ffe0; margin-left:30px; margin-right:30px;\n"
+                    + "  padding: 3px; border: thin solid silver; }");
+            html.writeLine("p.file { white-space: pre-wrap; font-family:monospace; margin: 0; }");
+            html.writeLine("div.output { background-color:#e0e0ff; margin-left:30px; margin-right:30px;\n"
+                    + "  padding: 3px; border: thin solid silver; }");
+            html.writeLine("p.output { white-space: pre-wrap; font-family:monospace; margin: 0; }");
+            html.writeLine("table.index { border: thin solid silver; }");
+            html.writeLine(".copyright { font-size: x-small }");
+            html.writeLine(".hidden { display:none }");
+            html.writeLine(".unhidden { display:block }");
+            html.writeLine(".odd { background-color: #e0e0e0 }");
+            html.writeLine(".even { background-color: white }");
+            html.endTag(HTMLWriter.STYLE);
+            html.startTag(HTMLWriter.SCRIPT);
+            html.writeAttr(HTMLWriter.TYPE, HTMLWriter.TEXT_JAVASCRIPT);
+            html.writeLine("\nfunction unhide(id) {\n"
+                        + "  var item = document.getElementById(id);\n"
+                        + "  if (item) {\n"
+                        + "    item.className=(item.className=='hidden')?'unhidden':'hidden';\n"
+                        + "  }\n"
+                        + "}");
+            html.endTag(HTMLWriter.SCRIPT);
+            html.endTag(HTMLWriter.HEAD);
+            html.startTag(HTMLWriter.BODY);
+            if (title != null) {
+                html.startTag(TITLE_HEADER);
+                html.write(title);
+                html.endTag(TITLE_HEADER);
+            }
+        }
+
+        @Override
+        void close() throws IOException {
+            html.endTag(HTMLWriter.BODY);
+            html.newLine();
+            html.flush();
+        }
+
+        @Override
+        void run(Collection<Example> examples) throws IOException {
+            if (examples.size() > 1)
+                writeIndex(examples);
+            super.run(examples);
+        }
+
+        void writeIndex(Collection<Example> examples) throws IOException {
+            Map<String, Set<Example>> index = new TreeMap<String, Set<Example>>();
+            Set<String> initials = new HashSet<String>();
+            for (Example e: examples) {
+                for (String k: e.getDeclaredKeys()) {
+                    Set<Example> s = index.get(k);
+                    if (s == null)
+                        index.put(k, s = new TreeSet<Example>());
+                    s.add(e);
+                }
+                initials.add(e.getName().substring(0, 1).toUpperCase());
+            }
+
+
+            if (INDEX_HEADER != null) {
+                html.startTag(INDEX_HEADER);
+                html.write("Index");
+                html.endTag(INDEX_HEADER);
+            }
+
+            html.startTag(HTMLWriter.P);
+            html.writeLine("Examples: ");
+            for (char initial = 'A'; initial <= 'Z'; initial++) {
+                String s = String.valueOf(initial);
+                if (initials.contains(s)) {
+                    html.writeLink("#" + s, s);
+                } else {
+                    html.write(s);
+                }
+                html.newLine();
+            }
+            html.endTag(HTMLWriter.P);
+
+            html.startTag(HTMLWriter.TABLE);
+            html.writeAttr(HTMLWriter.CLASS, "index");
+            html.newLine();
+            int row = 0;
+            for (Map.Entry<String, Set<Example>> entry: index.entrySet()) {
+                html.startTag(HTMLWriter.TR);
+                html.writeAttr(HTMLWriter.CLASS,
+                        (row++ % 2 == 0 ? "even" : "odd"));
+                html.startTag(HTMLWriter.TD);
+                html.writeAttr("valign", "top");
+                html.write(entry.getKey());
+                html.endTag(HTMLWriter.TD);
+                html.newLine();
+                html.startTag(HTMLWriter.TD);
+                html.writeAttr(HTMLWriter.ALIGN, "top");
+                String sep = "";
+                for (Example e: entry.getValue()) {
+                    html.write(sep);
+                    html.writeLink('#' + e.getName(), e.getName());
+                    sep = ", ";
+                }
+                html.endTag(HTMLWriter.TD);
+                html.endTag(HTMLWriter.TR);
+                html.newLine();
+            }
+            html.endTag(HTMLWriter.TABLE);
+        }
+
+        @Override
+        void startExample(Example e) throws IOException {
+            String name = e.getName();
+            String initial = name.substring(0, 1).toUpperCase();
+            if (!initial.equals(currInitial)) {
+                html.writeLinkDestination(initial, "");
+                currInitial = initial;
+            }
+            html.writeLinkDestination(name, "");
+            html.startTag(EXAMPLE_HEADER);
+            html.write(e.getName());
+            html.endTag(EXAMPLE_HEADER);
+        }
+
+        @Override
+        void showFile(Example e, File f) throws IOException {
+            String text;
+            try {
+                text = read(f);
+            } catch (IOException ex) {
+                text = "Error reading " + f + ": " + ex;
+            }
+            if (!f.equals(e.file)) {
+                html.startTag(FILE_HEADER);
+                html.write(e.file.toURI().relativize(f.toURI()).toString());
+                html.endTag(FILE_HEADER);
+            }
+            html.startTag(HTMLWriter.DIV);
+            html.writeAttr(CLASS, FILE);
+
+            String legalHeader;
+            Matcher m1 = copyrightHeaderPat.matcher(text);
+            if (m1.matches()) {
+                legalHeader = m1.group(1);
+                text = m1.group(2);
+            } else
+                legalHeader = null;
+
+            String infoHeader;
+            Matcher m2 = infoHeaderPat.matcher(text);
+            if (m2.matches()) {
+                infoHeader = m2.group(1);
+                text = m2.group(2);
+            } else
+                infoHeader = null;
+
+            String legalId = null, infoId = null;
+            if (legalHeader != null || infoHeader != null) {
+                String sep = "";
+                html.startTag(HTMLWriter.SPAN);
+                html.writeStyleAttr("float: right");
+                if (legalHeader != null) {
+                    legalId = nextId();
+                    html.startTag(HTMLWriter.A);
+                    html.writeAttr(HTMLWriter.HREF, "javascript:unhide('" + legalId + "');");
+                    //html.writeEntity("&copy;");
+                    html.write("Copyright");
+                    html.endTag(HTMLWriter.A);
+                    sep = ", ";
+                }
+                if (infoHeader != null) {
+                    html.write(sep);
+                    infoId = nextId();
+                    html.startTag(HTMLWriter.A);
+                    html.writeAttr(HTMLWriter.HREF, "javascript:unhide('" + infoId + "');");
+                    html.write("Info");
+                    html.endTag(HTMLWriter.A);
+                    sep = ", ";
+                }
+                html.endTag(HTMLWriter.SPAN);
+            }
+
+            html.startTag(HTMLWriter.P);
+            html.writeAttr(CLASS, FILE);
+            if (legalHeader != null) {
+                html.startTag(HTMLWriter.SPAN);
+                html.writeAttr(HTMLWriter.CLASS, "hidden");
+                html.writeAttr(HTMLWriter.ID, legalId);
+                html.write(legalHeader);
+                html.newLine();
+                html.endTag(HTMLWriter.SPAN);
+            }
+            if (infoHeader != null) {
+                html.startTag(HTMLWriter.SPAN);
+                html.writeAttr(HTMLWriter.CLASS, "hidden");
+                html.writeAttr(HTMLWriter.ID, infoId);
+                html.write(infoHeader);
+                html.newLine();
+                html.endTag(HTMLWriter.SPAN);
+            }
+            html.write(text);
+            html.endTag(HTMLWriter.P);
+
+            html.endTag(HTMLWriter.DIV);
+        }
+
+        @Override
+        void run(Example e) throws IOException {
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw);
+            e.run(pw, raw, verbose);
+            pw.flush();
+
+            // only show Output: header if also showing files
+            if (showFiles) {
+                html.startTag(OUTPUT_HEADER);
+                html.write("Output:");
+                html.endTag(OUTPUT_HEADER);
+            }
+
+            html.startTag(HTMLWriter.DIV);
+            html.writeAttr(CLASS, OUTPUT);
+            html.startTag(HTMLWriter.P);
+            html.writeAttr(CLASS, OUTPUT);
+            String[] lines = sw.toString().split("\n");
+            for (String line: lines) {
+                html.write(line);
+                html.newLine();
+            }
+            html.endTag(HTMLWriter.P);
+            html.endTag(HTMLWriter.DIV);
+        }
+
+        String nextId() {
+            return "id" + (nextId++);
+        }
+
+        File file;
+        HTMLWriter html;
+        int nextId;
+        String currInitial = "";
+
+        static final String TITLE_HEADER = HTMLWriter.H3;
+        static final String INDEX_HEADER = HTMLWriter.H4;
+        static final String EXAMPLE_HEADER = HTMLWriter.H4;
+        static final String FILE_HEADER = HTMLWriter.H5;
+        static final String OUTPUT_HEADER = HTMLWriter.H5;
+        static final String CLASS = "class";
+        static final String FILE = "file";
+        static final String OUTPUT = "output";
+    }
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples.not-yet.txt	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,114 @@
+compiler.err.already.annotated                          # internal compiler error?
+compiler.err.already.defined.this.unit                  # seems to be masked by compiler.err.duplicate.class
+compiler.err.annotation.value.not.allowable.type        # cannot happen: precluded by complete type-specific tests
+compiler.err.assignment.from.super-bound                # DEAD
+compiler.err.assignment.to.extends-bound                # DEAD
+compiler.err.cant.apply.symbol.1
+compiler.err.cant.read.file                             # (apt.JavaCompiler?)
+compiler.err.cant.select.static.class.from.param.type
+compiler.err.illegal.char.for.encoding
+compiler.err.internal.error.cant.instantiate            # Attr: should not happen
+compiler.err.io.exception                               # (javah.JavahTask?)
+compiler.err.limit.code                                 # Code
+compiler.err.limit.code.too.large.for.try.stmt          # Gen
+compiler.err.limit.dimensions                           # Gen
+compiler.err.limit.locals                               # Code
+compiler.err.limit.parameters                           # Gen
+compiler.err.limit.pool                                 # Gen,JavaCompiler
+compiler.err.limit.pool.in.class                        # UNUSED?
+compiler.err.limit.stack                                # Code
+compiler.err.limit.string                               # Gen
+compiler.err.limit.string.overflow                      # JavaCompiler
+compiler.err.name.reserved.for.internal.use             # UNUSED
+compiler.err.no.annotation.member
+compiler.err.no.encl.instance.of.type.in.scope          # cannot occur; always followed by assert false;
+compiler.err.no.match.entry                             # UNUSED?
+compiler.err.not.annotation.type                        # cannot occur given preceding checkType
+compiler.err.not.within.bounds.explain                  # UNUSED?
+compiler.err.prob.found.req.1                           # Check: DEAD, in unused method
+compiler.err.proc.bad.config.file                       # JavacProcessingEnvironment
+compiler.err.proc.cant.access                           # completion failure
+compiler.err.proc.cant.create.loader                    # security exception from service loader
+compiler.err.proc.no.service                            # JavacProcessingEnvironment: no service loader available
+compiler.err.proc.processor.bad.option.name             # cannot happen? masked by javac.err.invalid.A.key
+compiler.err.proc.processor.constructor.error
+compiler.err.proc.service.problem                       # JavacProcessingEnvironment: catch Throwable from service loader
+compiler.err.signature.doesnt.match.intf                # UNUSED
+compiler.err.signature.doesnt.match.supertype           # UNUSED
+compiler.err.source.cant.overwrite.input.file
+compiler.err.stack.sim.error
+compiler.err.type.var.more.than.once                    # UNUSED
+compiler.err.type.var.more.than.once.in.result          # UNUSED
+compiler.err.undetermined.type
+compiler.err.unexpected.type
+compiler.err.unknown.enum.constant                      # in bad class file
+compiler.err.unsupported.cross.fp.lit                   # Scanner: host system dependent
+compiler.misc.arg.length.mismatch
+compiler.misc.assignment.from.super-bound
+compiler.misc.assignment.to.extends-bound
+compiler.misc.bad.class.file.header                     # bad class file
+compiler.misc.bad.class.signature                       # bad class file
+compiler.misc.bad.const.pool.tag                        # bad class file
+compiler.misc.bad.const.pool.tag.at                     # bad class file
+compiler.misc.bad.enclosing.method                      # bad class file
+compiler.misc.bad.runtime.invisible.param.annotations   # bad class file
+compiler.misc.bad.signature                             # bad class file
+compiler.misc.bad.type.annotation.value
+compiler.misc.base.membership                           # UNUSED
+compiler.misc.ccf.found.later.version
+compiler.misc.ccf.unrecognized.attribute
+compiler.misc.class.file.not.found                      # ClassReader
+compiler.misc.class.file.wrong.class
+compiler.misc.fatal.err.cant.locate.ctor                # Resolve, from Lower
+compiler.misc.fatal.err.cant.locate.field               # Resolve, from Lower
+compiler.misc.fatal.err.cant.locate.meth                # Resolve, from Lower
+compiler.misc.file.does.not.contain.package
+compiler.misc.illegal.start.of.class.file
+compiler.misc.kindname.annotation
+compiler.misc.kindname.enum
+compiler.misc.kindname.package
+compiler.misc.kindname.static
+compiler.misc.kindname.type.variable
+compiler.misc.kindname.type.variable.bound
+compiler.misc.kindname.value
+compiler.misc.no.conforming.assignment.exists
+compiler.misc.non.denotable.type
+compiler.misc.no.unique.minimal.instance.exists
+compiler.misc.resume.abort                              # prompt for a response
+compiler.misc.source.unavailable                        # DiagnosticSource
+compiler.misc.token.bad-symbol
+compiler.misc.token.character
+compiler.misc.token.double
+compiler.misc.token.end-of-input
+compiler.misc.token.float
+compiler.misc.token.integer
+compiler.misc.token.long-integer
+compiler.misc.token.string
+compiler.misc.type.captureof
+compiler.misc.type.captureof.1
+compiler.misc.type.none
+compiler.misc.type.req.exact
+compiler.misc.type.variable.has.undetermined.type
+compiler.misc.unable.to.access.file                     # ClassFile
+compiler.misc.undecl.type.var                           # ClassReader
+compiler.misc.undetermined.type
+compiler.misc.unicode.str.not.supported                 # ClassReader
+compiler.misc.verbose.retro                             # UNUSED
+compiler.misc.verbose.retro.with                        # UNUSED
+compiler.misc.verbose.retro.with.list                   # UNUSED
+compiler.misc.version.not.available                     # JavaCompiler; implies build error
+compiler.misc.where.description.captured
+compiler.misc.where.description.intersection.1
+compiler.misc.where.typevar.1
+compiler.misc.wrong.version                             # ClassReader
+compiler.warn.annotation.method.not.found               # ClassReader
+compiler.warn.annotation.method.not.found.reason        # ClassReader
+compiler.warn.big.major.version                         # ClassReader
+compiler.warn.illegal.char.for.encoding
+compiler.warn.invalid.archive.file
+compiler.warn.override.bridge
+compiler.warn.position.overflow                         # CRTable: caused by files with long lines >= 1024 chars
+compiler.warn.proc.type.already.exists                  # JavacFiler: just mentioned in TODO
+compiler.warn.unchecked.assign                          # DEAD, replaced by compiler.misc.unchecked.assign
+compiler.warn.unchecked.cast.to.type                    # DEAD, replaced by compiler.misc.unchecked.cast.to.type
+compiler.warn.unexpected.archive.file                   # Paths: zip file with unknown extn
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AbstractCantBeAccessed.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.abstract.cant.be.accessed.directly
+
+abstract class Base {
+    abstract void m();
+}
+
+class AbstractCantBeAccessed extends Base {
+    void m() {
+        super.m();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AbstractCantBeInstantiated.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.abstract.cant.be.instantiated
+
+class AbstractCantBeInstantiated {
+    abstract class C { }
+
+    void m() {
+        new C();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AbstractMethodCantHaveBody.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.abstract.meth.cant.have.body
+
+abstract class AbstractMethodCantHaveBody {
+    abstract void m() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AlreadyDefined.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.already.defined
+
+class X {
+    int i;
+    int i;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AlreadyDefinedImport.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.already.defined.single.import
+
+import java.awt.List;
+import java.util.List;
+
+class AlreadyDefinedImport { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AlreadyDefinedStaticImport/AlreadDefinedStaticImport.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.already.defined.static.single.import
+
+import static p.E1.A;
+import static p.E2.A;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AlreadyDefinedStaticImport/p/E1.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+package p;
+
+public enum E1 { A, B, C}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AlreadyDefinedStaticImport/p/E2.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+package p;
+
+public enum E2 { A, B, C }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AnnoNotApplicable.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.annotation.type.not.applicable
+
+import java.lang.annotation.*;
+
+@Target(ElementType.METHOD)
+@interface Anno { }
+
+
+@Anno()
+class AnnoNotApplicable { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AnnoNotValidForType.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.annotation.not.valid.for.type
+
+@interface Anno {
+    int value();
+}
+
+@Anno(@Deprecated)
+class AnnoNotValueForType { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AnnoValueMustBeAnnotation.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.annotation.value.must.be.annotation
+
+@interface Anno1 {
+    String value();
+}
+
+@interface Anno2 {
+    Anno1 value();
+}
+
+@Anno2("3")
+class AnnoValueMustBeAnnotation { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AnnoValueMustBeClassLiteral.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.annotation.value.must.be.class.literal
+
+@interface Anno {
+    Class value();
+}
+
+@Anno(Class.forName("java.lang.Object"))
+class AnnoValueMustBeClassLiteral { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AnnosWithoutProcessors/AnnosWithoutProcessors.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.proc.annotations.without.processors
+// options: -Xlint:processing -processor AnnoProc -proc:only
+
+@interface Anno { }
+
+@Anno
+class AnnosWithoutProcessors { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AnnosWithoutProcessors/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+
+@SupportedAnnotationTypes("NotAnno")
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        return true;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AnnotationMissingValue.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.annotation.missing.default.value
+
+@interface Anno {
+    String value();
+}
+
+@Anno
+class AnnotationMissingValue { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AnnotationMustBeNameValue.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.annotation.value.must.be.name.value
+
+@interface Anno {
+    String name() default "anon";
+    String address() default "here";
+}
+
+@Anno(name == "fred", address = "there")
+class X { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AnnotationsNotSupported.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.annotations.not.supported.in.source
+// options: -source 1.4
+
+@Deprecated
+class AnnotationsNotSupported { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AnonClassImplInterfaceNoArgs.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.anon.class.impl.intf.no.args
+
+class AnonClassInterfaceNoArgs {
+    Runnable r = new Runnable(3) {
+        public void run() { }
+    };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AnonClassImplInterfaceNoQualForNew.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.anon.class.impl.intf.no.qual.for.new
+
+class AnonClassImplInterfaceNoQualForNew {
+    interface Intf {}
+    AnonClassImplInterfaceNoQualForNew x;
+
+    Object o = x.new Intf() { };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AnonClassImplInterfaceNoTypeArgs.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.anon.class.impl.intf.no.typeargs
+
+class AnonClassInterfaceNoArgs {
+    Runnable r = new<Integer> Runnable() {
+        public void run() { }
+    };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AnonymousClass.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.anonymous.class
+// key: compiler.warn.missing.SVUID
+// options: -Xlint:serial
+// run: simple
+
+class AnonymousClass {
+    Exception m() {
+        return new Exception() { };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ArrayAndVarargs.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.array.and.varargs
+
+class ArrayAndVarags {
+    void m(int[] array) { }
+    void m(int... args) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ArrayDimMissing.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.array.dimension.missing
+
+class ArrayDimMissing {
+    int[] array = new int[];
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ArrayRequired.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.array.req.but.found
+
+class X {
+    int i;
+    int j = i[0];
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AssertAsIdentifier.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.assert.as.identifier
+// options: -source 1.3
+
+class AssertAsIdentifier {
+    int assert;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AssertAsIdentifier2.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.assert.as.identifier
+
+class AssertAsIdentifier {
+    int assert;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AttrMustBeConstant.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.attribute.value.must.be.constant
+
+@interface Anno {
+    String value();
+}
+
+@Anno(System.getProperty("user.dir"))
+class AttrMustBeConstant { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/BadSourceFileHeader/BadSourceFileHeader.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.bad.source.file.header
+// key: compiler.misc.file.doesnt.contain.class
+// key: compiler.err.cant.access
+
+class BadSourceFileHeader {
+    p.A a;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/BadSourceFileHeader/sourcepath/p/A.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package q;
+
+class A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/BreakOutsideSwitchLoop.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.break.outside.switch.loop
+
+class BreakOutsideSwitchLoop {
+    void m() {
+        break;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CallMustBeFirst.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.call.must.be.first.stmt.in.ctor
+
+class CallMustBeFirst {
+    CallMustBeFirst() {
+        int i = 0;
+        super();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CannotCreateArrayWithTypeArgs.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cannot.create.array.with.type.arguments
+
+class X {
+    Object[] array = new<Integer> Object[3];
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantApplyDiamond.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.apply.diamond
+// key: compiler.misc.diamond
+
+class CantApplyDiamond<T extends Number> {
+    CantApplyDiamond(T t) { }
+    <U> CantApplyDiamond(T t, U u) { }
+
+    void m() {
+        CantApplyDiamond<?> x = new CantApplyDiamond<>("");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantAssignToFinal.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.assign.val.to.final.var
+
+class CantAssignToFinal {
+    final int i = 0;
+
+    void m() {
+        i = 3;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantDeref.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.deref
+
+class X {
+    int m(int i) {
+        return i.x;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantExtendIntfAnno.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.extend.intf.annotation
+
+@interface Anno { }
+
+@interface CantExtendIntfAnno extends Anno { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantImplement.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.cant.implement
+// key: compiler.err.override.weaker.access
+
+interface Interface {
+    void m();
+}
+
+class CantImplement implements Interface {
+    void m() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantInheritDiffArg.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.inherit.diff.arg
+
+import java.util.*;
+
+class CantInheritDiffArg extends ArrayList<String> implements List<Integer> { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantRefBeforeConstr.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.ref.before.ctor.called
+
+class Base {
+    Base(int i) { }
+}
+
+class CantRefBeforeConstr extends Base {
+    int i;
+
+    CantRefBeforeConstr() {
+        super(i);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantResolve.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.resolve
+
+class CantResolve<T extends Object & java.io.Serializable> {
+    T t;
+    void m() {
+        Object o = t.v;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantResolveArgs.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.resolve.args
+
+import java.util.*;
+
+class CantResolveArgs {
+    void m() {
+        new Runnable() {
+            { unknown(); }
+            public void run() { }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantResolveArgsParams.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.resolve.args.params
+
+class CantResolveArgsParams<T extends Object & java.io.Serializable> {
+    T t;
+    void m() {
+        t.<Integer,Double>m2(1, "");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantResolveLocation.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.resolve.location
+
+class CantResolveLocation {
+    Unknown y;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantResolveLocationArgs.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.resolve.location.args
+
+class X {
+    void m() {
+        unknown(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantResolveLocationArgsParams.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.resolve.location.args.params
+
+import java.util.*;
+
+class X {
+    void m() {
+        Object o = List.<String>unknown();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantReturnValueForVoid.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.ret.val.from.meth.decl.void
+
+class CantReturnValueForVoid {
+    void m() {
+        return 3;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CatchWithoutTry.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.catch.without.try
+// key: compiler.err.expected
+// key: compiler.err.not.stmt
+
+class CatchWithoutTry {
+    void m() {
+        catch (Exception e) {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ClashesWith.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.clashes.with
+// key: compiler.err.override.incompatible.ret
+
+interface Base {
+    int m();
+}
+
+interface ClashesWith extends Base {
+    String m();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ClassCantWrite.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.class.cant.write
+// run: jsr199 -filemanager cantWrite:.*/ClassCantWrite.class
+
+class ClassCantWrite { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ClassPublicInFile.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.class.public.should.be.in.file
+
+public class C { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ConcreteInheritanceConflict.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.concrete.inheritance.conflict
+
+class Base<T> {
+    void m(T t) {  }
+    void m(String s) { }
+}
+
+class ConcreteInheritanceConflict extends Base<String> { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ConstExprRequired.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.const.expr.req
+
+class ConstExprRequired {
+    int i = 3;
+
+    String m(int arg) {
+        switch (arg) {
+            case 0: return "zero";
+            case 1: return "one";
+            case i: return "i";
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ConstantSVUID.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.constant.SVUID
+// options: -Xlint:serial
+
+import java.io.Serializable;
+
+class ConstantSVUID implements Serializable {
+    private static final long serialVersionUID = Integer.parseInt("0");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ContinueOutsideLoop.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cont.outside.loop
+
+class ContinueOutsideLoop {
+    void m() {
+        continue;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CountError.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.count.error
+// key: compiler.err.unreported.exception.need.to.catch.or.throw
+// run: backdoor
+
+class CountError {
+    void m() { throw new Exception(); }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CountErrorPlural.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.count.error.plural
+// key: compiler.err.unreported.exception.need.to.catch.or.throw
+// run: backdoor
+
+class CountErrorPlural {
+    void m1() { throw new Exception(); }
+    void m2() { throw new Exception(); }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CountWarn.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.count.warn
+// key: compiler.warn.warning
+// key: compiler.warn.lintOption
+// key: compiler.warn.prob.found.req
+// key: compiler.misc.unchecked.assign
+// options: -Xlint:unchecked
+// run: backdoor
+
+import java.util.*;
+
+class CountWarn {
+    List<String> list = new ArrayList();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CountWarnPlural.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.count.warn.plural
+// key: compiler.warn.warning
+// key: compiler.warn.lintOption
+// key: compiler.warn.prob.found.req
+// key: compiler.misc.unchecked.assign
+// options: -Xlint:unchecked
+// run: backdoor
+
+import java.util.*;
+
+class CountWarn {
+    List<String> list1 = new ArrayList();
+    List<String> list2 = new ArrayList();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CyclicAnnoElement.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cyclic.annotation.element
+
+@interface X {
+    X value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CyclicInheritance.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cyclic.inheritance
+
+class CyclicInheritance extends CyclicInheritance { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DefaultAllowedInIntfAnnotationMember.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.default.allowed.in.intf.annotation.member
+
+interface DefaultAllowedInIntfAnnotationMember {
+    String value() default "";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DeprecatedFilename.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.deprecated.filename
+// key: compiler.note.deprecated.recompile
+
+class DeprecatedFilename {
+    DeprecatedClass d;
+}
+
+@Deprecated
+class DeprecatedClass { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DeprecatedFilenameAdditional.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.deprecated.filename.additional
+// key: compiler.warn.has.been.deprecated
+// options: -Xlint:deprecation -Xmaxwarns 1
+
+class DeprecatedFilename {
+    DeprecatedClass d;
+}
+
+class DeprecatedFilenameAdditional {
+    DeprecatedClass d;
+}
+
+@Deprecated
+class DeprecatedClass { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DeprecatedPlural/DeprecatedClass.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+@Deprecated
+class DeprecatedClass { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DeprecatedPlural/DeprecatedFilename.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+class DeprecatedFileName {
+    DeprecatedClass d;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DeprecatedPlural/DeprecatedPlural.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.deprecated.plural
+// key: compiler.note.deprecated.recompile
+
+class DeprecatedPlural {
+    DeprecatedClass d;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DeprecatedPluralAdditional/DeprecatedClass.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+@Deprecated
+class DeprecatedClass { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DeprecatedPluralAdditional/DeprecatedFilename.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+class DeprecatedFileName {
+    DeprecatedClass d;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DeprecatedPluralAdditional/DeprecatedPlural.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+class DeprecatedPlural {
+    DeprecatedClass d;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DeprecatedPluralAdditional/DeprecatedPluralAdditional.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.deprecated.plural.additional
+// key: compiler.warn.has.been.deprecated
+// options: -Xlint:deprecation -Xmaxwarns 1
+
+class DeprecatedPluralAdditional {
+    DeprecatedClass d;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DiamondInvalidArg.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.diamond.invalid.arg
+// key: compiler.misc.diamond
+// key: compiler.err.cant.apply.diamond.1
+
+class DiamondInvalidArg {
+    static class Foo<X extends Number & Comparable<Number>> { }
+    Foo<?> foo = new Foo<>();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DiamondInvalidArgs.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.diamond.invalid.args
+// key: compiler.misc.diamond
+// key: compiler.err.cant.apply.diamond.1
+
+class DiamondInvalidArgs {
+    static class Foo<X extends Number & Comparable<Number>,
+                           Y extends Number & Comparable<Number>> { }
+    Foo<?,?> foo = new Foo<>();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DiamondNotSupported.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.diamond.not.supported.in.source
+// options: -source 6
+
+import java.util.*;
+
+class DiamondNotSupported {
+    void m() {
+        List<String> list = new ArrayList<>();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DirPathElementNotFound.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.dir.path.element.not.found
+// options: -Xlint:path -extdirs DoesNotExist
+// run: simple
+
+class DirPathElementNotFound { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DivZero.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.div.zero
+// options: -Xlint:divzero
+
+class DivZero {
+    int m(int a) {
+        return a / 0 ;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DoesNotOverride.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.does.not.override.abstract
+
+abstract class Base {
+    abstract void m();
+}
+
+class DoesNotOverride extends Base { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DoesntExist.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.doesnt.exist
+
+import DoesntExist.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DotClassExpected.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.dot.class.expected
+
+class DotClassExpected {
+    int f = int[] + 3;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.duplicate.annotation
+
+@interface Anno { }
+
+@Anno
+@Anno
+class DuplicateAnnotation { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DuplicateAnnotationMemberValue.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.duplicate.annotation.member.value
+
+@interface Anno {
+    int value();
+}
+
+@Anno(value=1, value=2)
+class DuplicateAnnotationMemberValue { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DuplicateCaseLabel.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.duplicate.case.label
+
+class DuplicateCaseLabel {
+    String m(int arg) {
+        switch (arg) {
+            case 0: return "zero";
+            case 1: return "one";
+            case 1: return "one";
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DuplicateClass.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.duplicate.class
+
+class DuplicateClass { }
+
+class DuplicateClass { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DuplicateDefaultLabel.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.duplicate.default.label
+
+class DuplicateCaseLabel {
+    String m(int arg) {
+        switch (arg) {
+            case 0:  return "zero";
+            case 1:  return "one";
+            default: return "??";
+            default: return "??";
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ElseWithoutIf.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.else.without.if
+
+class ElseWithoutIf {
+    void m() {
+        else {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/EmptyBytecodeIdent.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.empty.bytecode.ident
+
+class EmptyBytecodeIdent {
+    int #"" = 3;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/EmptyCharLiteral.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.empty.char.lit
+// key: compiler.err.unclosed.char.lit
+// key: compiler.err.expected
+// key: compiler.err.premature.eof
+
+class X {
+    char c = '';
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/EmptyIf.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.empty.if
+// options: -Xlint:empty
+
+class EmptyIf {
+    void m(int a, int b) {
+        if (a == b) ;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/EnclClassRequired.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.encl.class.required
+
+class Base {
+    class Nested { }
+}
+
+class EnclClassRequired extends Base.Nested { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/EnumAnnoValueMustBeEnumConst.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.enum.annotation.must.be.enum.constant
+
+enum E { A, B, C }
+
+@interface Anno {
+    E value();
+}
+
+@Anno(E.valueOf("A"))
+class EnumAnnoValueMustBeEnumConstant { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/EnumAsIdentifier.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.enum.as.identifier
+// options: -source 1.3
+
+class EnumAsIdentifier {
+    int enum;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/EnumAsIdentifier2.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.enum.as.identifier
+
+class EnumAsIdentifier2 {
+    int enum;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/EnumCantBeInstantiated.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.enum.cant.be.instantiated
+
+class EnumCantBeInstantiated {
+    enum E { A, B, C }
+
+    E e = new E("a");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/EnumConstRequired.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.enum.const.req
+
+class EnumConstRequired {
+    enum E { A, B, C };
+
+    void m(E e) {
+        switch (e) {
+            case e:
+                System.err.println("It's me!");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/EnumLabelUnqualified.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.enum.label.must.be.unqualified.enum
+
+
+class EnumLabelUnqualified {
+    enum E { A, B, C };
+
+    void m(E e) {
+        switch (e) {
+            case E.A:
+                System.out.println("A");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/EnumNoFinalize.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.enum.no.finalize
+
+enum EnumNoFinalize {
+    A,
+    B,
+    C;
+
+    public void finalize() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/EnumNoSubclassing.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.enum.no.subclassing
+
+class EnumNoSubclassing extends Enum { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/EnumTypesNotExtensible.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.enum.types.not.extensible
+// key: compiler.err.cant.inherit.from.final
+
+enum E { A, B, C }
+
+class EnumTypesNotExtensible extends E { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/EnumsMustBeStatic.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.enums.must.be.static
+
+class EnumsMustBeStatic {
+    class Nested {
+        enum E { A, B, C }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/EnumsNotSupported.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.enums.not.supported.in.source
+// options: -source 1.4
+
+enum EnumsNotSupported { A, B, C }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ErrProcMessager/ErrProcMessager.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.proc.messager
+// options: -processor AnnoProc -proc:only
+
+class ErrProcMessager { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ErrProcMessager/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+@SupportedAnnotationTypes("*")
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        if (renv.processingOver()) {
+            Messager m = processingEnv.getMessager();
+            m.printMessage(Diagnostic.Kind.ERROR, "Error!");
+        }
+        return true;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ErrSyntheticNameConflict.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.synthetic.name.conflict
+
+class ErrSyntheticNameConflict {
+
+    static class Outer {
+        ErrSyntheticNameConflict this$0 = null;
+    }
+
+    public class Inner extends Outer { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/Error.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.error
+// key: compiler.err.warnings.and.werror
+// key: compiler.warn.raw.class.use
+// key: compiler.warn.warning
+// key: compiler.warn.lintOption
+// key: compiler.misc.count.error
+// key: compiler.misc.count.warn
+// key: compiler.misc.kindname.interface
+// key: compiler.misc.where.description.typevar
+// key: compiler.misc.where.typevar
+// options: -Xlint:rawtypes -Werror
+// run: backdoor
+
+import java.util.*;
+
+class X {
+    List l;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ErrorReadingFile.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.error.reading.file
+// run: jsr199 -filemanager cantRead:.*/ErrorReadingFile.java
+
+class ErrorReadingFile { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ExceptAlreadyCaught.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.except.already.caught
+
+class ExceptAlreadyCaught {
+    void x() throws Exception { }
+
+    void m() {
+        try {
+            x();
+        } catch (Exception e) {
+        } catch (Exception e) {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ExceptNeverThrown.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.except.never.thrown.in.try
+
+import java.io.*;
+
+class ExceptNeverThrown {
+    void m(int i) {
+        try {
+            i++;
+        } catch (IOException e) {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/Expected2.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.expected2
+// options: -source 1.4
+
+int Expected2;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/Expected3.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.expected3
+
+int Expected3;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/FinalParamCantBeAssigned.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.final.parameter.may.not.be.assigned
+
+class FinalParamCantBeAssigned {
+    void m(final int i) {
+        i++;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/FinallyCannotComplete.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.finally.cannot.complete
+// options: -Xlint:finally
+
+class FinallyCannotComplete {
+    void m() {
+        try {
+        } finally {
+            throw new Error();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/FinallyWithoutTry.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.finally.without.try
+
+class FinallyWithoutTry {
+    void m() {
+        finally {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/FloatNumberTooLarge.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.fp.number.too.large
+
+class FloatNumberTooLarge {
+    float f = 1e9999;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/FloatNumberTooSmall.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.fp.number.too.small
+
+class FloatNumberTooSmall {
+    float f = 1e-9999;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ForeachNotApplicable.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.foreach.not.applicable.to.type
+
+class ForeachNotApplicable {
+    void m(String arg) {
+        for (String a: arg) {
+            System.out.println(a);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ForeachNotSupported.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.foreach.not.supported.in.source
+// options: -source 1.4
+
+class ForeachNotSupported {
+    void m(String[] args) {
+        for (String a: args) {
+            System.out.println(a);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/GenericArrayCreation.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.generic.array.creation
+
+import java.util.*;
+
+class GenericArrayCreation<T> {
+    ArrayList<T>[] array = new ArrayList<T>[5];
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/GenericThrowable.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.generic.throwable
+
+class GenericThrowable<T> extends Exception { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/GenericsNotSupported.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.generics.not.supported.in.source
+// options: -source 1.4
+
+class GenericsNotSupported<T> { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/HasBeenDeprecated.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.has.been.deprecated
+// options: -Xlint:deprecation
+
+package p;
+
+class Test {
+    DeprecatedClass d;
+}
+
+@Deprecated
+class DeprecatedClass { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IdentifierExpected.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.token.identifier
+// key: compiler.err.expected
+// key: compiler.err.invalid.binary.number
+// key: compiler.misc.count.error.plural
+// run: backdoor
+
+class IdentifierExpected {
+    long bl = 0BL;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IllegalBytecodeIdentChar.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.bytecode.ident.char
+
+class IllegalBytecodeIdentChar {
+    int #"abc/def" = 3;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IllegalChar.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.char
+
+class IllegalChar {
+    int i = #;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IllegalComboModifiers.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.combination.of.modifiers
+
+class IllegalComboModifiers {
+    public private int x;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IllegalEnumStaticRef.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.enum.static.ref
+
+enum IllegalEnumStaticRef {
+    A() { Object o = B; },
+    B
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IllegalEscapeChar.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.esc.char
+
+class IllegalEscapeChar {
+    String s = "\!";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IllegalForwardRef.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.forward.ref
+
+class IllegalForwardRef {
+    int x = y;
+    int y;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IllegalInitializer.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.initializer.for.type
+
+class IllegalInitializer {
+    int i = { 1 };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IllegalLineEndInCharLit.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.line.end.in.char.lit
+
+class IllegalLineEndInCharLit {
+    char c = '
+';
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IllegalNonAsciiDigit.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.nonascii.digit
+
+class X {
+    int i = 0\u0660; // Zero followed by Arabic-Indic Digit Zero
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IllegalQualNotIcls.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.qual.not.icls
+// key: compiler.err.qualified.new.of.static.class
+
+class IllegalQualNotIcls {
+    static class C { }
+    IllegalQualNotIcls x;
+    C c = x.new C() { };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IllegalSelfRef.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.self.ref
+
+class IllegalSelfRef {
+    int i = i;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IllegalStartOfExpr.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.start.of.expr
+
+class IllegalStartOfExpr {
+    int i = =3;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IllegalUnderscore.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.underscore
+
+class X {
+    int i = 1_;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IllegalUnicodeEscape.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.unicode.esc
+
+class IllegalUnicodeEscape {
+    int i = \u;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ImportRequiresCanonical/ImportRequiresCanonical.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.import.requires.canonical
+
+import p.ExtendsBase.NestedInBase;
+
+class ImportRequiredCanonical { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ImportRequiresCanonical/p/Base.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package p;
+
+public class Base {
+    public static class NestedInBase { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ImportRequiresCanonical/p/ExtendsBase.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+package p;
+
+public class ExtendsBase extends Base {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ImproperSVUID.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.improper.SVUID
+// options: -Xlint:serial
+
+import java.io.Serializable;
+
+class ImproperSVUID implements Serializable {
+    int serialVersionUID;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ImproperTypeInnerRawParam.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.improperly.formed.type.inner.raw.param
+
+class ImproperTypeInnerRawParam {
+    class Outer<S> {
+        class Inner<T> {}
+    }
+
+    void m() {
+        Object o = (Outer.Inner<?>)null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ImproperTypeParamMissing.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.improperly.formed.type.param.missing
+
+class ImproperTypeParamMissing {
+    class Outer<S> {
+        class Inner<T> {}
+    }
+
+    void m() {
+        Object o = (Outer<?>.Inner)null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IncomparableTypes.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.incomparable.types
+
+class X {
+    boolean b = (this == 1);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IncompatibleTypes1.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.incompatible.types.1
+// key: compiler.misc.no.conforming.instance.exists
+// key: compiler.err.prob.found.req
+
+class IncompatibleTypes1<V> {
+    <T extends Integer & Runnable> IncompatibleTypes1<T> m() {
+        return null;
+    }
+
+    IncompatibleTypes1<? super String> o = m();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InconvertibleTypes.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.inconvertible.types
+// key: compiler.err.prob.found.req
+
+class InconvertibleTypes {
+    class Outer<S> {
+        class Inner<T> {}
+    }
+
+    void m(Outer<Integer>.Inner<Long> p) {
+        Object o = (Outer<? super Number>.Inner<Long>)p;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InexactVarargsCall.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.inexact.non-varargs.call
+
+class C {
+    void m(Object... args) { }
+}
+
+class InexactVarargsCall {
+    void m() {
+        C c = new C();
+        c.m(null);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InferredDoNotConformToBounds.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.inferred.do.not.conform.to.bounds
+// key: compiler.err.cant.apply.diamond.1
+// key: compiler.misc.diamond
+
+class InferredDoNotConformToBounds {
+   static class SuperFoo<X> {}
+   static class Foo<X extends Number> extends SuperFoo<X> {
+       Foo(X x) {}
+   }
+
+   SuperFoo<String> sf1 = new Foo<>("");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InheritFromFinal.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.inherit.from.final
+
+final class Base { }
+
+class InheritFromFinal extends Base { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InitializerMustComplete.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.initializer.must.be.able.to.complete.normally
+
+class InitializerMustComplete {
+    {
+        throw new IllegalStateException();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InnerClassCantHaveStatic.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.icls.cant.have.static.decl
+
+class InnerClassCantHaveStatic {
+    class Inner {
+        static int i;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IntNumberTooLarge.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.int.number.too.large
+
+class IntNumberTooLarge {
+    int i = 12345678901234567890;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InterfaceExpected.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.intf.expected.here
+
+class InterfaceExpected implements String { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InterfaceNotAllowed.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.intf.not.allowed.here
+
+class InterfaceNotAllowed {
+    void m() {
+        interface I { }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IntfAnnotationCantHaveTypeParams.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.intf.annotation.cant.have.type.params
+
+@interface X<T> { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IntfAnnotationMemberClash.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.intf.annotation.member.clash
+
+@interface X {
+    String toString();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IntfAnnotationsCantHaveParams.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.intf.annotation.members.cant.have.params
+
+@interface X {
+    String value(int i);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IntfAnnotationsCantHaveTypeParams.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.intf.annotation.members.cant.have.type.params
+
+@interface X {
+    <T> String value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IntfMethodCantHaveBody.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.intf.meth.cant.have.body
+
+interface IntfMethodCantHaveBody {
+    void m() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InvalidAnnoMemberType.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.invalid.annotation.member.type
+
+@interface InvalidAnnoMemberType {
+    Object value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InvalidBinaryNumber.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.invalid.binary.number
+// key: compiler.err.illegal.start.of.type
+// key: compiler.err.expected
+// key: compiler.err.premature.eof
+
+class InvalidBinaryNumber {
+    int i = 0b201000010;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InvalidHexNumber.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.invalid.hex.number
+// key: compiler.err.expected
+
+class InvalidHexNumber {
+    int i = 0xz1357abc;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InvalidInferredTypes.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.invalid.inferred.types
+// key: compiler.misc.inferred.do.not.conform.to.params
+
+import java.util.*;
+
+class InvalidInferredTypes {
+
+    <T> Comparator<T> compound(Iterable<? extends Comparator<? super T>> it) {
+        return null;
+    }
+
+    public void test(List<Comparator<?>> x) {
+        Comparator<String> c3 = compound(x);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InvalidInstanceof.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.generic.type.for.instof
+
+import java.util.*;
+
+class IllegalInstanceof {
+    List o;
+    boolean b = (o instanceof List<String>);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InvalidMethodDecl.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.invalid.meth.decl.ret.type.req
+
+class InvalidMethodDecl {
+    m() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/KindnameClass.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.kindname.class
+// key: compiler.err.cant.resolve.location
+// key: compiler.misc.count.error
+// run: backdoor
+
+class KindnameClass {
+    NotFound x;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/KindnameConstructor.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.kindname.constructor
+// key: compiler.misc.kindname.class
+// key: compiler.misc.no.args
+// key: compiler.err.cant.apply.symbol
+// key: compiler.misc.count.error.plural
+// run: backdoor
+
+class KindnameConstructor {
+
+    KindnameConstructor(Integer x) {}
+
+    void m() {
+        new KindnameConstructor(""){};
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/KindnameMethod.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.kindname.method
+// key: compiler.misc.kindname.class
+// key: compiler.err.cant.resolve.location.args
+// key: compiler.misc.count.error
+// run: backdoor
+
+class KindnameMethod {
+    Object o = not_found();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/KindnameVariable.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.kindname.variable
+// key: compiler.misc.kindname.class
+// key: compiler.err.cant.resolve.location
+// key: compiler.misc.count.error
+// run: backdoor
+
+class KindnameVariable {
+    Object o = not_found;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LabelInUse.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.label.already.in.use
+
+class LabelInUse {
+    void m(String... args) {
+        label:
+        for (String a1: args) {
+            label:
+            for (String a2: args) {
+                System.out.println(a1 + " " + a2);
+            }
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LocalEnum.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.local.enum
+
+class LocalEnum {
+    void m() {
+        enum E { a, b, c};
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LocalVarNeedsFinal.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.local.var.accessed.from.icls.needs.final
+
+class LocalVarNeedsFinal {
+    Runnable m() {
+        int i = 3;
+        return new Runnable() {
+            public void run() {
+                System.out.println(i);
+            }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LongSVUID.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.long.SVUID
+// options: -Xlint:serial
+
+import java.io.Serializable;
+
+class LongSVUID implements Serializable {
+    private static final int serialVersionUID = 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/MalformedFpLit.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.malformed.fp.lit
+// key: compiler.err.illegal.start.of.expr
+
+class MalformedFpLit {
+    float f = 0e*;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/MalformedSupported/MalformedSupported.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.proc.malformed.supported.string
+// options: -processor AnnoProc
+
+class MalformedSupported { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/MalformedSupported/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+
+@SupportedAnnotationTypes("java.lang.*,javx.lang.*")
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        return true;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/MethodDoesNotOverride.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.method.does.not.override.superclass
+
+class X {
+    @Override
+    void m() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/MightBeAssignedInLoop.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.var.might.be.assigned.in.loop
+
+class X {
+    void m(int n) {
+        final int i;
+        for (int c = 0; c < n; c++) {
+            i = 3;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/MissingDeprecatedAnnotation.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.missing.deprecated.annotation
+// options: -Xlint:dep-ann
+
+/** @deprecated */
+class MissingDeprecatedAnnotation {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/MissingMethodBody.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.missing.meth.body.or.decl.abstract
+
+class MissingMethodBody {
+    void m();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/MissingReturnStatement.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.missing.ret.stmt
+
+class MissingReturnStatement {
+    int m() {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/MissingReturnValue.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.missing.ret.val
+
+class MissingReturnValue {
+    int m() {
+        return;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/MissingSVUID.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.missing.SVUID
+// options: -Xlint:serial
+
+import java.io.Serializable;
+
+class MissingSVUID implements Serializable {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ModifierNotAllowed.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.mod.not.allowed.here
+
+synchronized interface ModifierNotAllowed { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/MulticatchCantBeAssigned.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.multicatch.parameter.may.not.be.assigned
+
+class MulticatchCantBeAssigned{
+    void e1() throws NullPointerException { }
+    void e2() throws IllegalArgumentException { }
+
+    void m() {
+        try {
+            e1();
+            e2();
+        } catch (final NullPointerException | IllegalArgumentException e) {
+            e = new RuntimeException();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.multicatch.param.must.be.final
+
+class MulticatchMustBeFinal {
+    void e1() throws NullPointerException { }
+    void e2() throws IllegalArgumentException { }
+
+    void m() {
+        try {
+            e1();
+            e2();
+        } catch (NullPointerException | IllegalArgumentException e) {
+            e.printStackTrace();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/MulticatchNotSupported.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.multicatch.not.supported.in.source
+// options: -source 1.6
+
+class MulticatchNotSupported {
+    class E1 extends Exception { }
+    class E2 extends Exception { }
+
+    void e1() throws E1 { }
+    void e2() throws E2 { }
+
+    void m() {
+        try {
+            e1();
+            e2();
+        } catch (final E1 | E2 e) {
+            e.printStackTrace();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NameClashSameErasure.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.name.clash.same.erasure
+
+import java.util.*;
+
+class NameClassSameErasure {
+    void m(List<Integer> list) { }
+    void m(List<String> list) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NameClashSameErasureNoOverride.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.name.clash.same.erasure.no.override
+
+public class NameClashSameErasureNoOverride<X> {
+    static class A {
+        static void m(NameClashSameErasureNoOverride<String> l) {}
+    }
+
+    static class B extends A {
+        static void m(NameClashSameErasureNoOverride<Integer> l) {}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NativeMethodCantHaveBody.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.native.meth.cant.have.body
+
+abstract class NativeMethodCantHaveBody {
+    native void m() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NeitherConditionalSubtype.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.neither.conditional.subtype
+// options: -source 1.4
+
+class X {
+    Object m(boolean b) {
+        return (b ? 3 : b);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NewNotAllowedInAnno.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.new.not.allowed.in.annotation
+
+@interface Anno {
+    int[] value();
+}
+
+@Anno(new int[] { 1, 2, 3 })
+class X { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NoArgs.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.no.args
+// key: compiler.err.cant.apply.symbol
+// run: simple
+
+class X {
+    void m1(int i) { }
+
+    int x = m1();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NoExplicitAnnoProcRequested.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.proc.no.explicit.annotation.processing.requested
+// options: UnknownClass
+// run: simple
+
+class NoExplicitAnnoProcRequested { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NoInterfaceExpected.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.no.intf.expected.here
+
+class NoInterfaceExpected extends Runnable { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NoInterfaceHere.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.no.intf.expected.here
+
+interface I { }
+
+class InterfaceNotExpected extends I { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NoJavaLang.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.fatal.err.no.java.lang
+// options: -Xbootclasspath:
+// run: backdoor
+
+class NoJavaLang { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NoSuperclass.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.no.superclass
+
+package java.lang;
+
+class Object {
+    public Object() {
+        super();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NonStaticCantBeRef.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.non-static.cant.be.ref
+
+class NonStaticCantBeRef {
+    int i;
+
+    static int m() {
+        return i;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccess/NotDefAccessClassIntfCantAccess.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.not.def.access.class.intf.cant.access
+
+import p.C;
+
+class X {
+    int m() {
+        C c = new C();
+        return c.array.length; // array is public, but the type of the array is not
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccess/p/C.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+package p;
+
+public class C {
+    class Nested { }
+
+    public Nested[] array;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefPublicCantAccess/NotDefPublicCantAccess.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.not.def.public.cant.access
+
+class X {
+    Object o = new p.C();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefPublicCantAccess/p/C.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+package p;
+
+class C { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotEnclClass.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.not.encl.class
+
+class NotEnclClass {
+    Object o = Object.this;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotLoopLabel.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.not.loop.label
+
+class LabelInUse {
+    void m() {
+        label: {
+            int[] values = { 1, 2, 3 };
+            for (int v: values) {
+                if (v == 2)
+                    continue label;
+                System.err.println(v);
+            }
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotWithinBounds.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.not.within.bounds
+
+class NotWithinBounds {
+
+    static class Foo<X extends Number> { }
+
+    Foo<String> f1 = null;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/Note.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.note
+// key: compiler.note.unchecked.filename
+// key: compiler.note.unchecked.recompile
+// run: backdoor
+
+import java.util.*;
+
+class Note {
+    List<String> list = new ArrayList();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NoteProcMessager/NoteProcMessager.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.proc.messager
+// options: -processor AnnoProc -proc:only
+
+class NoteProcMessager { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NoteProcMessager/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+@SupportedAnnotationTypes("*")
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        if (renv.processingOver()) {
+            Messager m = processingEnv.getMessager();
+            m.printMessage(Diagnostic.Kind.NOTE, "Note!");
+        }
+        return true;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/OperatorCantBeApplied.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.operator.cant.be.applied
+
+class OperatorCantBeApplied {
+    String s = ("a" - "b");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/Orphaned.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.orphaned
+
+class Orphaned {
+    void m() {
+        case 3:
+            System.out.println("3");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/OverrideDoesntThrow.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.override.meth.doesnt.throw
+// key: compiler.misc.cant.override
+
+class Base {
+    void m() { }
+}
+
+class OverrideDoesntThrow extends Base {
+    void m() throws Exception { }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/OverrideIncompatibleReturn.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.override.incompatible.ret
+// key: compiler.misc.cant.override
+
+class Base {
+    int m() {
+        return 0;
+    }
+}
+
+class OverrideIncompatibleReturn extends Base {
+    String m() {
+        return null;
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/OverrideMeth.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.override.meth
+// key: compiler.misc.cant.override
+
+class Base {
+    static void m() { }
+}
+
+class OverrideMeth extends Base {
+    void m() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/OverrideStatic.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.override.static
+// key: compiler.misc.cant.override
+
+class Base {
+    void m() { }
+}
+
+class OverrideStatic extends Base {
+    static void m() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/OverrideUncheckedReturn.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.override.unchecked.ret
+// key: compiler.misc.unchecked.override
+// options: -Xlint:unchecked
+
+import java.util.*;
+
+class Base {
+    List<String> m() { return null; }
+}
+
+class OverrideUncheckedReturn extends Base {
+    List m() { return null; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/OverrideUncheckedThrown.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.override.unchecked.thrown
+// key: compiler.misc.cant.override
+// options: -Xlint:unchecked
+
+class Base {
+    <T extends Exception> void m() throws T { }
+}
+
+class OverrideUncheckedThrown extends Base {
+     void m() throws Exception { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/OverrideVarargsExtra.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.override.varargs.extra
+// key: compiler.misc.varargs.override
+// options: -Xlint:overrides
+
+class Base {
+    void m(Object... x) { }
+}
+
+class OverrideVarargsExtra extends Base {
+    void m(Object[] x) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/OverrideVarargsMissing.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.override.varargs.missing
+// key: compiler.misc.varargs.override
+// options: -Xlint:overrides
+
+class Base {
+    void m(Object[] x) { }
+}
+
+class OverrideVarargsMissing extends Base {
+    void m(Object... x) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/OverrideWeakerAccess.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.override.weaker.access
+// key: compiler.misc.cant.override
+
+class OverrideWeakerAccess {
+    String toString() { return "?"; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PackageAnnos.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.pkg.annotations.sb.in.package-info.java
+
+@Deprecated
+package p;
+
+class PackageAnnos { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PackageInfoAlreadySeen/p/package-info.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+package p;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PackageInfoAlreadySeen/package-info.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.pkg-info.already.seen
+
+package p;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PathElementNotFound.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.path.element.not.found
+// options: -Xlint:path -classpath DoesNotExist
+// run: simple
+
+class PathElementNotFound { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PkgClashWithClass/p/q.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.pkg.clashes.with.class.of.same.name
+// key: compiler.err.clash.with.pkg.of.same.name
+
+// Note: class p.q.C also exists
+
+package p;
+
+public class q { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PkgClashWithClass/p/q/C.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+package p.q;
+
+public class C { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PossibleFallThrough.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.possible.fall-through.into.case
+// options: -Xlint:fallthrough
+
+class PossibleFallThrough {
+    void m(int i) {
+        switch (i) {
+            case 0:
+                System.out.println(0);
+            case 1:
+                System.out.println(1);
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PossibleLossPrecision.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.possible.loss.of.precision
+// key: compiler.err.prob.found.req
+
+class PossibleLossPrecision {
+    long l;
+    int i = l;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PrematureEOF.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.premature.eof
+
+class PrematureEOF {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PrintProcessorInfo/PrintProcessorInfo.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.x.print.processor.info
+// options: -processor AnnoProc -XprintProcessorInfo
+// run: backdoor
+
+class PrintProcessorInfo { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PrintProcessorInfo/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+
+@SupportedAnnotationTypes("*")
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        return true;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PrintRounds/PrintRounds.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.x.print.rounds
+// options: -processor AnnoProc -XprintRounds
+// run: backdoor
+
+class PrintRounds { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PrintRounds/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+
+@SupportedAnnotationTypes("*")
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        return true;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcCantFindClass/ProcCantFindClass.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.proc.cant.find.class
+// options: -processor AnnoProc -proc:only UnknownClass
+// run: simple
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcCantFindClass/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.element.*;
+
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcFileCreateLastRound/ProcFileCreateLastRound.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.proc.file.create.last.round
+// options: -Xlint:processing -processor AnnoProc
+
+class ProcFileCreateLastRound { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcFileCreateLastRound/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+@SupportedAnnotationTypes("*")
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        if (renv.processingOver()) {
+            Filer filer = processingEnv.getFiler();
+            Messager messager = processingEnv.getMessager();
+            try {
+                JavaFileObject fo = filer.createSourceFile("Gen");
+                Writer out = fo.openWriter();
+                out.write("class Gen { }");
+                out.close();
+            } catch (IOException e) {
+                messager.printMessage(Diagnostic.Kind.ERROR, e.toString());
+            }
+        }
+        return false;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcFileReopening/ProcFileReopening.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.proc.file.reopening
+// key: compiler.err.proc.messager
+// options: -Xlint:processing -processor AnnoProc
+
+class ProcFileReopening { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcFileReopening/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+@SupportedAnnotationTypes("*")
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        if (++round == 1) {
+            Filer filer = processingEnv.getFiler();
+            Messager messager = processingEnv.getMessager();
+            try {
+                FileObject fo1 = filer.createResource(
+                    StandardLocation.CLASS_OUTPUT, "", "HelloWorld.txt");
+                Writer out = fo1.openWriter();
+                out.write("Hello World!");
+                out.close();
+                FileObject fo2 = filer.createResource(
+                    StandardLocation.CLASS_OUTPUT, "", "HelloWorld.txt");
+            } catch (IOException e) {
+                messager.printMessage(Diagnostic.Kind.ERROR, e.toString());
+            }
+        }
+        return false;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    int round = 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcIllegalFileName/ProcIllegalFileName.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.proc.illegal.file.name
+// key: compiler.err.proc.messager
+// options: -Xlint:processing -processor AnnoProc
+
+class ProcIllegalFileName { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcIllegalFileName/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+@SupportedAnnotationTypes("*")
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        if (++round == 1) {
+            Filer filer = processingEnv.getFiler();
+            Messager messager = processingEnv.getMessager();
+            try {
+                FileObject fo1 = filer.createResource(
+                    StandardLocation.CLASS_OUTPUT, "p+q", "Hello-World.txt");
+                Writer out = fo1.openWriter();
+                out.write("Hello World!");
+                out.close();
+            } catch (IOException e) {
+                messager.printMessage(Diagnostic.Kind.ERROR, e.toString());
+            }
+        }
+        return false;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    int round = 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcIncompatibleSourceVersion/ProcIncompatibleSourceVersion.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.proc.processor.incompatible.source.version
+// options: -processor AnnoProc -proc:only
+
+class ProcIncompatibleSourceVersion { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcIncompatibleSourceVersion/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+
+@SupportedSourceVersion(SourceVersion.RELEASE_6)
+@SupportedAnnotationTypes("*")
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcOnlyNoProcs.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.proc.proc-only.requested.no.procs
+// options: -proc:only
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcPackageDoesNotExist/ProcPackageDoesNotExist.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.proc.package.does.not.exist
+// options: -processor AnnoProc -proc:only -XDprocess.packages Unknown.Package
+// run: simple
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcPackageDoesNotExist/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+
+@SupportedAnnotationTypes("*")
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        return true;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcSuspiciousClassName/ProcSuspiciousClassName.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.proc.suspicious.class.name
+// options: -Xlint:processing -processor AnnoProc
+
+class ProcSuspiciousClassName { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcSuspiciousClassName/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+@SupportedAnnotationTypes("*")
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        if (++round == 1) {
+            Filer filer = processingEnv.getFiler();
+            Messager messager = processingEnv.getMessager();
+            try {
+                FileObject fo = filer.createSourceFile("HelloWorld.java");
+                try (Writer out = fo.openWriter()) {
+                    out.write("class HelloWorld {\n");
+                    out.write("  public static void main(String[] args) {\n");
+                    out.write("    System.out.println(\"Hello World!\");\n");
+                    out.write("  }\n");
+                    out.write("}\n");
+                }
+            } catch (IOException e) {
+                messager.printMessage(Diagnostic.Kind.ERROR, e.toString());
+            }
+        }
+        return false;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    int round = 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcTypeRecreate/ProcTypeRecreate.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.proc.type.recreate
+// key: compiler.err.proc.messager
+// options: -Xlint:processing -processor AnnoProc
+
+class ProcTypeRecreate { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcTypeRecreate/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+@SupportedAnnotationTypes("*")
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        round++;
+        if (round <= 2) {
+            Filer filer = processingEnv.getFiler();
+            Messager messager = processingEnv.getMessager();
+            try {
+                JavaFileObject fo = filer.createSourceFile("Gen");
+                Writer out = fo.openWriter();
+                out.write("class Gen { }");
+                out.close();
+            } catch (IOException e) {
+                messager.printMessage(Diagnostic.Kind.ERROR, e.toString());
+            }
+        }
+        return false;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    int round;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcUnclosedTypeFiles/ProcUnclosedTypeFiles.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.proc.unclosed.type.files
+// options: -Xlint:processing -processor AnnoProc
+
+class ProcUnclosedTypeFiles { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcUnclosedTypeFiles/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+@SupportedAnnotationTypes("*")
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        if (first) {
+            Filer filer = processingEnv.getFiler();
+            Messager messager = processingEnv.getMessager();
+            try {
+                JavaFileObject fo = filer.createSourceFile("Gen");
+                Writer out = fo.openWriter();
+                out.write("class Gen { }");
+                //out.close();
+            } catch (IOException e) {
+                messager.printMessage(Diagnostic.Kind.ERROR, e.toString());
+            }
+            first = false;
+        }
+        return false;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    boolean first = true;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcUseImplicit/ProcUseImplicit.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.proc.use.implicit
+// options: -processor AnnoProc -Xprefer:source
+
+import p.SomeClass;
+
+@Deprecated
+class ProcUseImplicit extends SomeClass { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcUseImplicit/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+@SupportedAnnotationTypes("*")
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        if ((++round) == 1) {
+            Filer filer = processingEnv.getFiler();
+            Messager messager = processingEnv.getMessager();
+            try {
+                JavaFileObject fo = filer.createSourceFile("Gen");
+                Writer out = fo.openWriter();
+                out.write("class Gen { }");
+                out.close();
+            } catch (IOException e) {
+                messager.printMessage(Diagnostic.Kind.ERROR, e.toString());
+            }
+        }
+        return true;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    int round;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcUseImplicit/sourcepath/p/SomeClass.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+package p;
+
+public class SomeClass { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcUseProcOrImplicit/ProcUseProcOrImplicit.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.proc.use.proc.or.implicit
+// options: -Xprefer:source
+
+import p.SomeClass;
+
+@Deprecated
+class ProcUseProcOrImplicit extends SomeClass { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcUseProcOrImplicit/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+@SupportedAnnotationTypes("*")
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        if ((++round) == 1) {
+            Filer filer = processingEnv.getFiler();
+            Messager messager = processingEnv.getMessager();
+            try {
+                JavaFileObject fo = filer.createSourceFile("Gen");
+                Writer out = fo.openWriter();
+                out.write("class Gen { }");
+                out.close();
+            } catch (IOException e) {
+                messager.printMessage(Diagnostic.Kind.ERROR, e.toString());
+            }
+        }
+        return true;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    int round;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcUseProcOrImplicit/sourcepath/p/SomeClass.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+package p;
+
+public class SomeClass { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcessorCantInstantiate/ProcessorCantInstantiate.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.proc.processor.cant.instantiate
+// options: -processor AnnoProc
+
+class ProcessorCantInstantiate { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcessorCantInstantiate/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+
+@SupportedAnnotationTypes("*")
+class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        return true;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcessorNotFound.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.proc.processor.not.found
+// options: -processor Unknown.Processor
+
+class ProcessorNotFound { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcessorWrongType/ProcessorWrongType.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.proc.processor.wrong.type
+// options: -processor AnnoProc
+
+clas ProcessorWrongType { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcessorWrongType/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+public class AnnoProc { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/QualifiedNewStaticClass.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.qualified.new.of.static.class
+
+class QualifiedNewStaticClass {
+    static class C { }
+    QualifiedNewStaticClass x;
+    C c = x.new C();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RawClassUse.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.raw.class.use
+// options: -Xlint:rawtypes
+
+import java.util.*;
+
+class RawClassUse {
+    ArrayList l;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RecursiveConstrInvocation.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.recursive.ctor.invocation
+
+class X {
+    X() {
+        this();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RedundantCast.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.redundant.cast
+// options: -Xlint:cast
+
+class RedundantCast {
+    int i = (int) 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RefAmbiguous.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.ref.ambiguous
+
+class X {
+    void m(int i, double d) { }
+    void m(double d, int m) { }
+
+    {
+      m(1, 2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RepeatedAnnotationTarget.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.repeated.annotation.target
+
+import java.lang.annotation.*;
+
+@Target({ElementType.FIELD, ElementType.FIELD})
+@interface X { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RepeatedInterface.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.repeated.interface
+
+interface I { }
+
+class RepeatedInterface
+  implements I, I
+{ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RepeatedModifier.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.repeated.modifier
+
+class RepeatedModifier {
+    public public String toString() { return "??"; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ReportAccess.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.report.access
+
+class ReportAccess {
+    int i = new Other().x;
+}
+
+class Other {
+    private int x;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ResourceClosed.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.twr.explicit.close.call
+// options: -Xlint:arm
+
+import java.io.*;
+
+class ResourceClosed {
+    void m() throws IOException {
+        try (Writer out = new StringWriter()) {
+            out.close();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ResourceMayNotBeAssigned.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.twr.resource.may.not.be.assigned
+
+import java.io.*;
+
+class ResourceMayNotBeAssigned {
+    void m(File f) {
+        try (Writer out = new StringWriter()) {
+            out = null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ResourceNotApplicableToType.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.twr.not.applicable.to.type
+// key: compiler.err.prob.found.req
+
+class ResourceNotApplicableToType {
+    void m() {
+        try (String s = "") {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ResourceNotReferenced.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.automatic.resource.not.referenced
+// options: -Xlint:arm
+
+import java.io.*;
+
+class ResourceNotReferenced {
+    void m() throws IOException {
+        try (Writer out = new StringWriter()) {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ReturnOutsideMethod.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.ret.outside.meth
+
+class ReturnOutsideMethod {
+    { return; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/StaticImportNotSupported.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.static.import.not.supported.in.source
+// options: -source 1.4
+
+import static java.util.regex.Pattern.*;
+
+class StaticImportNotSupported { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/StaticImportOnlyClassesAndInterfaces/Other.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package p;
+
+public class Other {
+    public static int[] array;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/StaticImportOnlyClassesAndInterfaces/StaticImportOnlyClassesAndInterfaces.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.static.imp.only.classes.and.interfaces
+// key: compiler.err.cant.resolve.location
+
+import static p.Other.array.length;
+
+class StaticImportOnlyClassesAndInterfaces { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/StaticNotQualifiedByType.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.static.not.qualified.by.type
+// options: -Xlint:static
+
+class StaticNotQualifiedByType {
+    int m(Other other) {
+        return other.i;
+    }
+}
+
+class Other {
+    static int i;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/StringConstRequired.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.string.const.req
+
+class StringConstRequired {
+    String s = "three";
+
+    int m(String arg) {
+        switch (arg) {
+            case "one": return 1;
+            case "two": return 2;
+            case s:     return 3;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/StringSwitchNotSupported.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.string.switch.not.supported.in.source
+// options: -source 6
+
+class StringSwitchNotSupported {
+    int m(String s) {
+        switch (s) {
+            case "one": return 1;
+            case "two": return 2;
+            default:    return -1;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/SunApiFilename.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.sunapi.filename
+// key: compiler.note.sunapi.recompile
+// options: -XDenableSunApiLintControl
+
+class SunApiFilename {
+    sun.misc.Unsafe x;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/SunApiFilenameAdditional.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.sunapi.filename.additional
+// key: compiler.warn.sun.proprietary
+// options: -XDenableSunApiLintControl -Xlint:sunapi -Xmaxwarns 1
+
+class SunApiFilenameAdditional {
+    sun.misc.Unsafe x1;
+    sun.misc.Unsafe x2;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/SunApiPlural/SunApiFilename.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+class SunApiFilename {
+    sun.misc.Unsafe x;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/SunApiPlural/SunApiPlural.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.sunapi.plural
+// key: compiler.note.sunapi.recompile
+// options: -XDenableSunApiLintControl
+
+class SunApiPlural {
+    sun.misc.Unsafe x;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/SunApiPluralAdditional/SunApiFilename.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+class SunApiFilename {
+    sun.misc.Unsafe x;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/SunApiPluralAdditional/SunApiPlural.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+class SunApiPlural {
+    sun.misc.Unsafe x;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/SunApiPluralAdditional/SunApiPluralAdditional.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.sunapi.plural.additional
+// key: compiler.warn.sun.proprietary
+// options: -XDenableSunApiLintControl -Xlint:sunapi -Xmaxwarns 1
+
+class SunApiPluralAdditional {
+    sun.misc.Unsafe x;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/SunProprietary.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.sun.proprietary
+
+class SunProprietary {
+    sun.misc.Unsafe x;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/SuperNotAllowedInEnum.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.call.to.super.not.allowed.in.enum.ctor
+
+enum SuperNotAllowedInEnum {
+    A,
+    B,
+    C;
+    SuperNotAllowedInEnum() {
+        super();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ThrowsNotAllowedInAnno.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.throws.not.allowed.in.intf.annotation
+
+@interface ThrowsNotAllowedInAnno {
+    String value() throws NullPointerException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/TryResourceNotSupported.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.automatic.resource.management.not.supported.in.source
+// options: -source 1.6
+
+import java.io.*;
+
+class TryResourceNotSupported {
+    void m() {
+        try (Writer out = new StringWriter()) {
+            out.println("Hello World");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/TryWithoutCatchOrFinally.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.try.without.catch.or.finally
+// options: -source 1.6
+
+class TryWithoutCatchOrFinally {
+    void m() {
+        try {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/TryWithoutCatchOrFinallyOrResource.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.try.without.catch.finally.or.resource.decls
+
+class TryWithoutCatchOrFinallyOrResource {
+    void m() {
+        try {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/TypeAnnotationsNotSupported.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.type.annotations.not.supported.in.source
+// options: -source 6
+
+@interface Anno { }
+
+class TypeAnnotationsNotSupported {
+    void m() {
+        int i = (@Anno int) 3.14;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/TypeFoundRequired.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.type.found.req
+// key: compiler.misc.type.parameter
+// key: compiler.misc.type.req.class
+
+import java.util.*;
+
+class X<T> {
+    List<T<Integer>> list;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/TypeNoParams.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.type.doesnt.take.params
+
+class TypeNoParams {
+    Object<Integer> obj;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/TypeReqClassArray.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.type.req.class.array
+// key: compiler.err.type.found.req
+
+import java.util.*;
+
+class TypeReqClassArray {
+    boolean b = (this instanceof int);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/TypeReqRef.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.type.req.ref
+// key: compiler.err.type.found.req
+
+class TypeReqRef {
+    int i;
+    boolean b = (i instanceof Object);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/TypeVarCantBeDeref.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.type.var.cant.be.deref
+
+class Base<T> { }
+
+class TypeVarCantBeDeref<T> extends Base<T.foo> {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/TypeVarMayNotBeFollowedByOtherBounds.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.type.var.may.not.be.followed.by.other.bounds
+
+import java.util.*;
+
+class X<T, U, V extends T & U> { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/TypesIncompatible.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.types.incompatible.diff.ret
+
+interface A {
+    int m();
+}
+
+interface B {
+    String m();
+}
+
+interface TypesIncompatible extends A, B { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UncheckedAssign.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.prob.found.req
+// key: compiler.misc.unchecked.assign
+// options: -Xlint:unchecked
+
+import java.util.*;
+
+class UncheckedAssign {
+    void m(List l1, List<String> l2) {
+        l2 = l1;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UncheckedAssignToVar.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.unchecked.assign.to.var
+// options: -Xlint:unchecked
+
+class Foo<T> {
+    T t;
+}
+
+class UncheckedAssignToVar {
+    void m() {
+        Foo f = new Foo();
+        f.t = "??";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UncheckedCall.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.unchecked.call.mbr.of.raw.type
+// options: -Xlint:unchecked
+
+import java.util.*;
+
+class UncheckedCall {
+    void m() {
+        List l = new ArrayList<String>();
+        l.add(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UncheckedCast.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.prob.found.req
+// key: compiler.misc.unchecked.cast.to.type
+// options: -Xlint:unchecked
+
+import java.util.*;
+
+class UncheckedCast {
+    <T,U> List<U> m(List<T> l) {
+        return (List<U>) l;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UncheckedClash.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.override.unchecked.ret
+// key: compiler.misc.unchecked.clash.with
+// options: -Xlint:unchecked
+
+import java.util.*;
+
+interface Intf {
+    List<String> m();
+}
+
+interface UncheckedClash extends Intf {
+    public List m();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UncheckedFilename.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.unchecked.filename
+// key: compiler.note.unchecked.recompile
+
+import java.util.*;
+
+class UncheckedFilename {
+    List<String> list = new ArrayList();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UncheckedFilenameAdditional.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.unchecked.filename.additional
+// key: compiler.warn.prob.found.req
+// key: compiler.misc.unchecked.assign
+// options: -Xlint:unchecked -Xmaxwarns 3
+
+import java.util.*;
+
+class UncheckedFilenameAdditional {
+    List<String> list1 = new ArrayList();
+    List<String> list2 = new ArrayList();
+    List<String> list3 = new ArrayList();
+    List<String> list4 = new ArrayList();
+    List<String> list5 = new ArrayList();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UncheckedGenericArrayCreation.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.unchecked.generic.array.creation
+// key: compiler.warn.varargs.non.reifiable.type
+// options: -Xlint:unchecked,varargs
+
+import java.util.*;
+
+class UncheckedGenericArrayCreation<T> {
+    void m(T t1, T t2, T t3) {
+        show(t1, t2, t3);
+    }
+
+    void show(T... items) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UncheckedImplement.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.override.unchecked.ret
+// key: compiler.misc.unchecked.implement
+// options: -Xlint:unchecked
+
+import java.util.*;
+
+interface Intf {
+    List<String> m();
+}
+
+class UncheckedImplement implements Intf {
+    public List m() { return null; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UncheckedMethodInvocation.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.unchecked.meth.invocation.applied
+// key: compiler.warn.prob.found.req
+// key: compiler.misc.unchecked.assign
+// options: -Xlint:unchecked
+
+class UncheckedMethodInvocation {
+    class X<T> {}
+
+    public <T> void m(X<T> x, T t) {}
+
+    public void test() {
+        m(new X<X<Integer>>(), new X());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UncheckedPlural/UncheckedFilename.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.*;
+
+class UncheckedFilename {
+    List<String> list = new ArrayList();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UncheckedPlural/UncheckedPlural.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.unchecked.plural
+// key: compiler.note.unchecked.recompile
+
+import java.util.*;
+
+class UncheckedPlural {
+    List<String> list = new ArrayList();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UncheckedPluralAdditional/UncheckedFilename1.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.*;
+
+class UncheckedFilename1 {
+    List<String> list = new ArrayList();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UncheckedPluralAdditional/UncheckedFilename2.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.*;
+
+class UncheckedFilename2 {
+    List<String> list = new ArrayList();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UncheckedPluralAdditional/UncheckedPluralAdditional.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.unchecked.plural.additional
+// key: compiler.warn.prob.found.req
+// key: compiler.misc.unchecked.assign
+// options: -Xlint:unchecked -Xmaxwarns 1
+
+import java.util.*;
+
+class UncheckedPluralAdditional {
+    List<String> list = new ArrayList();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnclosedBytecodeIdent.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.unclosed.bytecode.ident
+
+class UnclosedBytecodeIdent {
+    int #"abc
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnclosedCharLiteral.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.unclosed.char.lit
+
+class UnclosedCharLit {
+    char c = 'a;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnclosedComment.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.unclosed.comment
+// key: compiler.err.premature.eof
+
+class UnclosedComment {
+    /*
+    void m() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnclosedStringLiteral.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.unclosed.str.lit
+
+class UnclosedStringLit {
+    String s = "abc;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UndefinedLabel.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.undef.label
+
+class LabelInUse {
+    void m() {
+        int[] values = { 1, 2, 3 };
+        for (int v: values) {
+            if (v == 2)
+                continue label;
+            System.err.println(v);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UndeterminedType1.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.undetermined.type.1
+// key: compiler.misc.no.unique.maximal.instance.exists
+
+class UndeterminedType1<V> {
+    <T extends Integer & Runnable> UndeterminedType1<T> m() {
+        return null;
+    }
+
+
+    UndeterminedType1<? extends String> c2 = m();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnmatchedProcessorOptions/UnmatchedProcessorOptions.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.proc.unmatched.processor.options
+// options: -processor AnnoProc -proc:only -AunknownOption=123
+
+class UnmatchedProcessorOptions { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnmatchedProcessorOptions/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+
+@SupportedAnnotationTypes("*")
+@SupportedOptions({ "supportedOption" })
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        return true;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnnamedPackage.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.unnamed.package
+// key: compiler.err.already.defined
+// run: simple
+
+class UnnamedPackage {
+
+    class UnnamedPackage { }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnreachableStatement.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.unreachable.stmt
+
+class X {
+    void m() {
+        return;
+        m();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnreportedException.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.unreported.exception.need.to.catch.or.throw
+
+class UnreportedException {
+    void m() {
+        throw new Exception();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnreportedExceptionDefaultConstructor.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.unreported.exception.default.constructor
+
+class Base {
+    Base() throws Exception { }
+}
+
+class UnreportedExceptionDefaultConstructor extends Base { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnsupportedBinaryLiteral.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.unsupported.binary.lit
+// options: -source 6
+
+class UnsupportedBinaryLiteral {
+    int i = 0b01000010;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnsupportedEncoding.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.unsupported.encoding
+// options: -encoding UNSUPPORTED -doe
+
+class UnsupportedEncoding { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnsupportedFpLit.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.unsupported.fp.lit
+// options: -source 1.4
+
+class UnsupportedFpLit {
+    float f = 0xCafe.BabeP1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnsupportedUnderscoreLiteral.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.unsupported.underscore.lit
+// options: -source 6
+
+class UnsupportedUnderscoreLiteral {
+    int i = 123_456_789;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VarMightAlreadyBeAssigned.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.var.might.already.be.assigned
+
+class VarMightAlreadyBeAssigned {
+    void m(boolean b) {
+        final int i;
+        if (b)
+            i = 3;
+        i = 4;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VarMightNotHaveBeenInitialized.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.var.might.not.have.been.initialized
+
+class X {
+    final int i;
+    X(boolean b) {
+        if (b)
+            i = 3;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VarargsClash.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.varargs.clash.with
+// key: compiler.warn.override.varargs.extra
+// options: -Xlint:overrides
+
+interface Base {
+    void m(Object... x);
+}
+
+interface VarargsClash extends Base {
+    void m(Object[] x);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VarargsFilename.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.varargs.filename
+// key: compiler.note.varargs.recompile
+
+class VarargsFilename<T> {
+    void m(T... items) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VarargsFilenameAdditional.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.varargs.filename.additional
+// key: compiler.warn.varargs.non.reifiable.type
+// options: -Xlint:varargs -Xmaxwarns 1
+
+class VarargsFilenameAdditional<T> {
+    void m1(T... items) { }
+    void m2(T... items) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VarargsImplement.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.varargs.implement
+// key: compiler.warn.override.varargs.extra
+// options: -Xlint:overrides
+
+interface Base {
+    void m(Object... x);
+}
+
+class VarargsImplement implements Base {
+    public void m(Object[] x) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VarargsNonReifiableType.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.varargs.non.reifiable.type
+// options: -Xlint:varargs
+
+import java.util.*;
+
+class VarargsNonReifiableType<T> {
+    void m(T... items) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VarargsNotSupported.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.varargs.not.supported.in.source
+// options: -source 1.4
+
+class VarargsNotSupported {
+    void m(String... args) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VarargsOverride.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.varargs.override
+// key: compiler.warn.override.varargs.extra
+// options: -Xlint:overrides
+
+class Base {
+    void m(Object... x) { }
+}
+
+class VarargsOverride extends Base {
+    void m(Object[] x) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VarargsPlural/VarargsFilename.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+class VarargsFilename<T> {
+    void m(T... items) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VarargsPlural/VarargsPlural.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.varargs.plural
+// key: compiler.note.varargs.recompile
+
+class VarargsPlural<T> {
+    void m(T... items) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VarargsPluralAdditional/VarargsFilename.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+class VarargsFilename<T> {
+    void m(T... items) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VarargsPluralAdditional/VarargsPlural.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+class VarargsPlural<T> {
+    void m(T... items) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VarargsPluralAdditional/VarargsPluralAdditional.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.varargs.plural.additional
+// key: compiler.warn.varargs.non.reifiable.type
+// options: -Xlint:varargs -Xmaxwarns 1
+
+class VarargsPluralAdditional<T> {
+    void m(T... items) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/Verbose.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.verbose.parsing.started
+// key: compiler.misc.verbose.parsing.done
+// key: compiler.misc.verbose.sourcepath
+// key: compiler.misc.verbose.classpath
+// key: compiler.misc.verbose.loading
+// key: compiler.misc.verbose.checking.attribution
+// key: compiler.misc.verbose.wrote.file
+// key: compiler.misc.verbose.total
+// options: -verbose
+// run: backdoor
+
+class Verbose { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VoidNotAllowed.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.void.not.allowed.here
+
+class X {
+    void m() { }
+
+    void m2() {
+        System.err.println(m());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/WarnForwardRef.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.forward.ref
+// options: -XDuseBeforeDeclarationWarning
+
+class X {
+    static int x = X.y;
+    static int y;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/WarnProcMessager/WarnProcMessager.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.proc.messager
+// options: -processor AnnoProc -proc:only
+
+class WarnProcMessager { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/WarnProcMessager/processors/AnnoProc.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+@SupportedAnnotationTypes("*")
+public class AnnoProc extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        if (renv.processingOver()) {
+            Messager m = processingEnv.getMessager();
+            m.printMessage(Diagnostic.Kind.WARNING, "Warning!");
+        }
+        return true;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/WarnSelfRef.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.self.ref
+// options: -XDuseBeforeDeclarationWarning
+
+class X {
+    static int x = X.x;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/WarnSyntheticNameConflict.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.synthetic.name.conflict
+// options: -XDwarnOnSyntheticConflicts
+
+class WarnSyntheticNameConflict {
+
+    static class Outer {
+        WarnSyntheticNameConflict this$0 = null;
+    }
+
+    public class Inner extends Outer { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/WarningAndWerror.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.warnings.and.werror
+// key: compiler.warn.raw.class.use
+// options: -Xlint:rawtypes -Werror
+
+import java.util.*;
+
+class X {
+    List l;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/WhereCaptured.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.where.captured
+// key: compiler.misc.where.description.captured.1
+// key: compiler.misc.where.description.typevar
+// key: compiler.misc.where.typevar
+// key: compiler.err.cant.apply.symbol
+// key: compiler.misc.captured.type
+// options: -XDdiags=where,simpleNames
+// run: simple
+
+import java.util.*;
+
+class WhereCaptured {
+    <T> void m(List<T> l1, List<T> l2) {}
+
+    void test(List<? super WhereCaptured> list) {
+        m(list, list);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/WhereCaptured1.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.where.captured.1
+// key: compiler.misc.where.description.captured.1
+// key: compiler.misc.where.description.typevar
+// key: compiler.misc.where.typevar
+// key: compiler.err.cant.apply.symbol
+// key: compiler.misc.captured.type
+// key: compiler.misc.type.null
+// options: -XDdiags=where,simpleNames
+// run: simple
+
+import java.util.*;
+
+class WhereCaptured {
+    <T> void m(List<T> l1, List<T> l2) {}
+
+    void test(List<? extends WhereCaptured> list) {
+        m(list, list);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/WhereIntersection.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.where.intersection
+// key: compiler.misc.where.description.intersection
+// key: compiler.misc.intersection.type
+// key: compiler.misc.incompatible.types
+// key: compiler.err.prob.found.req
+// options: -XDdiags=where
+// run: simple
+
+class WhereIntersection {
+    interface I1 {}
+    interface I2 {}
+    class A implements I1, I2 {}
+    class B implements I1, I2 {}
+    class Test {
+        <Z> Z m(Z z1, Z z2) { return null; }
+        void main(){
+            A a = m(new A(), new B());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/WhereTypeVar.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.where.typevar
+// key: compiler.misc.where.description.typevar.1
+// key: compiler.misc.type.var
+// key: compiler.err.cant.apply.symbol
+// options: -XDdiags=where,disambiguateTvars
+// run: simple
+
+class WhereTypeVar<T extends String> {
+    <T extends Integer> void test(T t) {
+        m(t);
+    }
+    void m(T t) {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/WrongNumberTypeArgs.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.wrong.number.type.args
+
+import java.util.*;
+
+class T {
+    List<Integer,String> list;
+}
--- a/langtools/test/tools/javac/enum/6384542/T6384542.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/enum/6384542/T6384542.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary crash: test/tools/javac/versions/check.sh
  * @author  Peter von der Ah\u00e9
  * @compile/fail -source 1.4 T6384542.java
- * @compile/fail/ref=T6384542.out -source 1.4 -XDstdout -XDrawDiagnostics T6384542.java
+ * @compile/fail/ref=T6384542.out -source 1.4 -XDrawDiagnostics T6384542.java
  */
 
 import static java.lang.Math.sin;
--- a/langtools/test/tools/javac/enum/6384542/T6384542a.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/enum/6384542/T6384542a.java	Fri Aug 20 14:48:10 2010 -0400
@@ -5,8 +5,8 @@
  * @author  Peter von der Ah\u00e9
  * @compile/fail -source 5   T6384542a.java
  * @compile      -source 1.4 T6384542a.java
- * @compile/fail/ref=T6384542a_5.out -source 5   -XDstdout -XDrawDiagnostics T6384542a.java
- * @compile/ref=T6384542a_1_4.out    -source 1.4 -XDstdout -XDrawDiagnostics T6384542a.java
+ * @compile/fail/ref=T6384542a_5.out -source 5   -XDrawDiagnostics T6384542a.java
+ * @compile/ref=T6384542a_1_4.out    -source 1.4 -XDrawDiagnostics T6384542a.java
  */
 
 public class T6384542a {
--- a/langtools/test/tools/javac/enum/forwardRef/T6425594.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/enum/forwardRef/T6425594.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug     6424491
  * @summary javac accepts illegal forward references
  * @author  Peter von der Ah\u00e9
- * @compile/fail/ref=T6425594.out -XDstdout -XDrawDiagnostics -XDuseBeforeDeclarationWarning T6425594.java
+ * @compile/fail/ref=T6425594.out -XDrawDiagnostics -XDuseBeforeDeclarationWarning T6425594.java
  */
 
 public class T6425594 {
--- a/langtools/test/tools/javac/generics/5009937/T5009937.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/generics/5009937/T5009937.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary hiding versus generics versus binary compatibility
  * @author Maurizio Cimadamore
  *
- * @compile/fail/ref=T5009937.out -XDstdout -XDrawDiagnostics T5009937.java
+ * @compile/fail/ref=T5009937.out -XDrawDiagnostics T5009937.java
  */
 
 public class T5009937<X> {
--- a/langtools/test/tools/javac/generics/6207386/T6207386.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/generics/6207386/T6207386.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug     6207386
  * @summary Undecidable type system leads to crash
  * @author  Martin Odersky
- * @compile/fail/ref=T6207386.out -XDstdout -XDrawDiagnostics T6207386.java
+ * @compile/fail/ref=T6207386.out -XDrawDiagnostics T6207386.java
  */
 
 public class T6207386 {
--- a/langtools/test/tools/javac/generics/6359951/T6359951.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/generics/6359951/T6359951.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary Crash when using class field
  *
  *
- * @compile/fail/ref=T6359951.out -XDstdout -XDrawDiagnostics T6359951.java
+ * @compile/fail/ref=T6359951.out -XDrawDiagnostics T6359951.java
  */
 
 public class T6359951 {
--- a/langtools/test/tools/javac/generics/6677785/T6677785.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/generics/6677785/T6677785.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug     6677785
  * @summary REGRESSION: StackOverFlowError with Cyclic Class level Type Parameters when used in constructors
  * @author Maurizio Cimadamore
- * @compile/fail/ref=T6677785.out -XDstdout -XDrawDiagnostics T6677785.java
+ * @compile/fail/ref=T6677785.out -XDrawDiagnostics T6677785.java
  */
 public class T6677785<E extends T, T extends E> {
      T6677785() {}
--- a/langtools/test/tools/javac/generics/6723444/T6723444.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/generics/6723444/T6723444.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  *
  * @summary javac fails to substitute type variables into a constructor's throws clause
  * @author Mark Mahieu
- * @compile/fail/ref=T6723444.out -XDstdout -XDrawDiagnostics T6723444.java
+ * @compile/fail/ref=T6723444.out -XDrawDiagnostics T6723444.java
  *
  */
 public class T6723444 {
--- a/langtools/test/tools/javac/generics/inference/6611449/T6611449.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/generics/inference/6611449/T6611449.java	Fri Aug 20 14:48:10 2010 -0400
@@ -2,7 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug 6611449
  * @summary Internal Error thrown during generic method/constructor invocation
- * @compile/fail/ref=T6611449.out -XDstdout -XDrawDiagnostics T6611449.java
+ * @compile/fail/ref=T6611449.out -XDrawDiagnostics T6611449.java
  */
 public class T6611449<S> {
 
--- a/langtools/test/tools/javac/generics/inference/6718364/T6718364.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/generics/inference/6718364/T6718364.java	Fri Aug 20 14:48:10 2010 -0400
@@ -2,7 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug 6718364
  * @summary inference fails when a generic method is invoked with raw arguments
- * @compile/ref=T6718364.out -XDstdout -XDrawDiagnostics -Xlint:unchecked T6718364.java
+ * @compile/ref=T6718364.out -XDrawDiagnostics -Xlint:unchecked T6718364.java
  */
 class T6718364 {
     class X<T> {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/6938454/T6938454a.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6938454
+ *
+ * @summary Unable to determine generic type in program that compiles under Java 6
+ * @author mcimadamore
+ * @compile T6938454a.java
+ *
+ */
+
+class T6938454a {
+
+    static abstract class A { }
+
+    static class B extends A { }
+
+    B getB(B b) {
+        return makeA(b);
+    }
+
+    <X extends A, Y extends X> Y makeA(X x) {
+        return (Y)new B();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/6938454/T6938454b.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.util.List;
+
+/*
+ * @test
+ * @bug 6938454
+ *
+ * @summary Unable to determine generic type in program that compiles under Java 6
+ * @author mcimadamore
+ * @compile T6938454b.java
+ *
+ */
+
+class T6938454b {
+
+    static interface A {}
+    static interface B extends A {}
+    static class C implements B {}
+
+    <T, R extends T, S extends R> List<R> m(List<T> l, S s) {
+        return null;
+    }
+
+    List<B> test(List<A> la) {
+        return m(la, new C());
+    }
+}
--- a/langtools/test/tools/javac/generics/wildcards/6437894/T6437894.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/6437894/T6437894.java	Fri Aug 20 14:48:10 2010 -0400
@@ -6,7 +6,7 @@
  * @author  Peter von der Ah\u00e9
  * @compile A.java B.java
  * @clean   a.A
- * @compile/fail/ref=T6437894.out -XDstdout -XDrawDiagnostics T6437894.java
+ * @compile/fail/ref=T6437894.out -XDrawDiagnostics T6437894.java
  */
 
 public class T6437894 {
--- a/langtools/test/tools/javac/lint/NoWarn.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/lint/NoWarn.java	Fri Aug 20 14:48:10 2010 -0400
@@ -2,9 +2,9 @@
  * @test  /nodynamiccopyright/
  * @bug 6183484
  * @summary verify -nowarn is the same as -Xlint:none
- * @compile/ref=NoWarn1.out -XDstdout -XDrawDiagnostics             NoWarn.java
- * @compile/ref=NoWarn2.out -XDstdout -XDrawDiagnostics -nowarn     NoWarn.java
- * @compile/ref=NoWarn2.out -XDstdout -XDrawDiagnostics -Xlint:none NoWarn.java
+ * @compile/ref=NoWarn1.out -XDrawDiagnostics             NoWarn.java
+ * @compile/ref=NoWarn2.out -XDrawDiagnostics -nowarn     NoWarn.java
+ * @compile/ref=NoWarn2.out -XDrawDiagnostics -Xlint:none NoWarn.java
  */
 
 class NoWarn {
--- a/langtools/test/tools/javac/mandatoryWarnings/deprecated/Test.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/mandatoryWarnings/deprecated/Test.java	Fri Aug 20 14:48:10 2010 -0400
@@ -28,110 +28,110 @@
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test1.out -XDstdout -XDrawDiagnostics A.java
+ * @compile/ref=Test1.out -XDrawDiagnostics A.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test1.out -XDstdout -XDrawDiagnostics -nowarn A.java
+ * @compile/ref=Test1.out -XDrawDiagnostics -nowarn A.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test1.out -XDstdout -XDrawDiagnostics -Xmaxwarns 1 A.java
+ * @compile/ref=Test1.out -XDrawDiagnostics -Xmaxwarns 1 A.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test2.out -XDstdout -XDrawDiagnostics A.java B.java
+ * @compile/ref=Test2.out -XDrawDiagnostics A.java B.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test2.out -XDstdout -XDrawDiagnostics -nowarn A.java B.java
+ * @compile/ref=Test2.out -XDrawDiagnostics -nowarn A.java B.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test2.out -XDstdout -XDrawDiagnostics -Xmaxwarns 1 A.java B.java
+ * @compile/ref=Test2.out -XDrawDiagnostics -Xmaxwarns 1 A.java B.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test3.out -XDstdout -XDrawDiagnostics -Xlint:deprecation A.java
+ * @compile/ref=Test3.out -XDrawDiagnostics -Xlint:deprecation A.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test3.out -XDstdout -XDrawDiagnostics -nowarn -Xlint:deprecation A.java
+ * @compile/ref=Test3.out -XDrawDiagnostics -nowarn -Xlint:deprecation A.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test3b.out -XDstdout -XDrawDiagnostics -nowarn -Xlint:deprecation -Xmaxwarns 1 A.java
+ * @compile/ref=Test3b.out -XDrawDiagnostics -nowarn -Xlint:deprecation -Xmaxwarns 1 A.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test4.out -XDstdout -XDrawDiagnostics -Xlint:deprecation A.java B.java
+ * @compile/ref=Test4.out -XDrawDiagnostics -Xlint:deprecation A.java B.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test4.out -XDstdout -XDrawDiagnostics -nowarn -Xlint:deprecation A.java B.java
+ * @compile/ref=Test4.out -XDrawDiagnostics -nowarn -Xlint:deprecation A.java B.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test4b.out -XDstdout -XDrawDiagnostics -nowarn -Xlint:deprecation -Xmaxwarns 1 A.java B.java
+ * @compile/ref=Test4b.out -XDrawDiagnostics -nowarn -Xlint:deprecation -Xmaxwarns 1 A.java B.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test4c.out -XDstdout -XDrawDiagnostics -nowarn -Xlint:deprecation -Xmaxwarns 2 A.java B.java
+ * @compile/ref=Test4c.out -XDrawDiagnostics -nowarn -Xlint:deprecation -Xmaxwarns 2 A.java B.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test4d.out -XDstdout -XDrawDiagnostics -nowarn -Xlint:deprecation -Xmaxwarns 3 A.java B.java
+ * @compile/ref=Test4d.out -XDrawDiagnostics -nowarn -Xlint:deprecation -Xmaxwarns 3 A.java B.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test5.out -XDstdout -XDrawDiagnostics -Xlint:deprecation  P.java Q.java
+ * @compile/ref=Test5.out -XDrawDiagnostics -Xlint:deprecation  P.java Q.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test5b.out -XDstdout -XDrawDiagnostics -Xlint:deprecation -Xmaxwarns 2 P.java Q.java
+ * @compile/ref=Test5b.out -XDrawDiagnostics -Xlint:deprecation -Xmaxwarns 2 P.java Q.java
  */
--- a/langtools/test/tools/javac/mandatoryWarnings/unchecked/Test.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/mandatoryWarnings/unchecked/Test.java	Fri Aug 20 14:48:10 2010 -0400
@@ -28,96 +28,96 @@
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test1.out -XDstdout -XDrawDiagnostics A.java
+ * @compile/ref=Test1.out -XDrawDiagnostics A.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test1.out -XDstdout -XDrawDiagnostics -nowarn A.java
+ * @compile/ref=Test1.out -XDrawDiagnostics -nowarn A.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test1.out -XDstdout -XDrawDiagnostics -Xmaxwarns 1 A.java
+ * @compile/ref=Test1.out -XDrawDiagnostics -Xmaxwarns 1 A.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test2.out -XDstdout -XDrawDiagnostics A.java B.java
+ * @compile/ref=Test2.out -XDrawDiagnostics A.java B.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test2.out -XDstdout -XDrawDiagnostics -nowarn A.java B.java
+ * @compile/ref=Test2.out -XDrawDiagnostics -nowarn A.java B.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test2.out -XDstdout -XDrawDiagnostics -Xmaxwarns 1 A.java B.java
+ * @compile/ref=Test2.out -XDrawDiagnostics -Xmaxwarns 1 A.java B.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test3.out -XDstdout -XDrawDiagnostics -Xlint:unchecked A.java
+ * @compile/ref=Test3.out -XDrawDiagnostics -Xlint:unchecked A.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test3.out -XDstdout -XDrawDiagnostics -nowarn -Xlint:unchecked A.java
+ * @compile/ref=Test3.out -XDrawDiagnostics -nowarn -Xlint:unchecked A.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test3b.out -XDstdout -XDrawDiagnostics -nowarn -Xlint:unchecked -Xmaxwarns 1 A.java
+ * @compile/ref=Test3b.out -XDrawDiagnostics -nowarn -Xlint:unchecked -Xmaxwarns 1 A.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test4.out -XDstdout -XDrawDiagnostics -Xlint:unchecked A.java B.java
+ * @compile/ref=Test4.out -XDrawDiagnostics -Xlint:unchecked A.java B.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test4.out -XDstdout -XDrawDiagnostics -nowarn -Xlint:unchecked A.java B.java
+ * @compile/ref=Test4.out -XDrawDiagnostics -nowarn -Xlint:unchecked A.java B.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test4b.out -XDstdout -XDrawDiagnostics -nowarn -Xlint:unchecked -Xmaxwarns 1 A.java B.java
+ * @compile/ref=Test4b.out -XDrawDiagnostics -nowarn -Xlint:unchecked -Xmaxwarns 1 A.java B.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test4c.out -XDstdout -XDrawDiagnostics -nowarn -Xlint:unchecked -Xmaxwarns 2 A.java B.java
+ * @compile/ref=Test4c.out -XDrawDiagnostics -nowarn -Xlint:unchecked -Xmaxwarns 2 A.java B.java
  */
 
 /*
  * @test
  * @bug 5047307
  * @summary javac -nowarn improperly suppresses JLS-mandated warnings
- * @compile/ref=Test4d.out -XDstdout -XDrawDiagnostics -nowarn -Xlint:unchecked -Xmaxwarns 3 A.java B.java
+ * @compile/ref=Test4d.out -XDrawDiagnostics -nowarn -Xlint:unchecked -Xmaxwarns 3 A.java B.java
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/miranda/6964669/T6964669.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6964669
+ * @summary javac reports error on miranda methods
+ * @compile -source 1.2 -target 1.1 pkg/A.java pkg/B.java pkg/C.java
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/miranda/6964669/pkg/A.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+public abstract class A implements C {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/miranda/6964669/pkg/B.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+public class B extends A {
+    public void a() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/miranda/6964669/pkg/C.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+public interface C {
+    public void a();
+}
--- a/langtools/test/tools/javac/miranda/T4666866.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/miranda/T4666866.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary REGRESSION: Generated error message unhelpful for missing methods
  * @author gafter
  *
- * @compile/fail/ref=T4666866.out -XDstdout -XDrawDiagnostics T4666866.java
+ * @compile/fail/ref=T4666866.out -XDrawDiagnostics T4666866.java
  */
 
 class t implements Runnable {}
--- a/langtools/test/tools/javac/missingSuperRecovery/MissingSuperRecovery.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/missingSuperRecovery/MissingSuperRecovery.java	Fri Aug 20 14:48:10 2010 -0400
@@ -5,7 +5,7 @@
  * class is no longer available during a subsequent compilation.
  * @author maddox
  *
- * @compile/fail/ref=MissingSuperRecovery.out -XDstdout -XDdiags=%b:%l:%_%m MissingSuperRecovery.java
+ * @compile/fail/ref=MissingSuperRecovery.out -XDdiags=%b:%l:%_%m MissingSuperRecovery.java
  */
 
 // Requires "golden" class file 'impl.class', which contains
--- a/langtools/test/tools/javac/policy/test1/Test1a.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/policy/test1/Test1a.java	Fri Aug 20 14:48:10 2010 -0400
@@ -35,7 +35,7 @@
  * @summary provide variable policies for javac operation
  *              Default compile policy is now "by file" (reverted to "todo" for 6382700)
  *              Because of attr errors in B, no code should be generated
- * @compile/fail/ref=bytodo.ABD.out -XDstdout -XDrawDiagnostics -XDverboseCompilePolicy A.java B.java D.java
+ * @compile/fail/ref=bytodo.ABD.out -XDrawDiagnostics -XDverboseCompilePolicy A.java B.java D.java
  */
 
 /*
@@ -43,7 +43,7 @@
  * @bug 6260188
  * @summary provide variable policies for javac operation
  *              Generate code for A, A1, A2, B
- * @compile/fail/ref=bytodo.ABD.out -XDstdout -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=bytodo A.java B.java D.java
+ * @compile/fail/ref=bytodo.ABD.out -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=bytodo A.java B.java D.java
  */
 
 /*
@@ -51,7 +51,7 @@
  * @bug 6260188
  * @summary provide variable policies for javac operation
  *              Because of attr errors in B, no code should be generated
- * @compile/fail/ref=simple.ABD.out -XDstdout -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=simple A.java B.java D.java
+ * @compile/fail/ref=simple.ABD.out -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=simple A.java B.java D.java
  */
 
 /*
@@ -59,7 +59,7 @@
  * @bug 6260188
  * @summary provide variable policies for javac operation
  *              Because of attr errors in B, no code should be generated
- * @compile/fail/ref=byfile.ABD.out -XDstdout -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=byfile A.java B.java D.java
+ * @compile/fail/ref=byfile.ABD.out -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=byfile A.java B.java D.java
  */
 
 
@@ -71,7 +71,7 @@
  * @summary provide variable policies for javac operation
  *              Default compile policy is now "by file" (reverted to "todo" for 6382700)
  *              Generate code for A, A1, A2, but because of flow errors in C, no more code should be generated
- * @compile/fail/ref=bytodo.ACD.out -XDstdout -XDrawDiagnostics -XDverboseCompilePolicy A.java C.java D.java
+ * @compile/fail/ref=bytodo.ACD.out -XDrawDiagnostics -XDverboseCompilePolicy A.java C.java D.java
  */
 
 /*
@@ -79,7 +79,7 @@
  * @bug 6260188
  * @summary provide variable policies for javac operation
  *              Generate code for A, A1, A2, C
- * @compile/fail/ref=bytodo.ACD.out -XDstdout -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=bytodo A.java C.java D.java
+ * @compile/fail/ref=bytodo.ACD.out -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=bytodo A.java C.java D.java
  */
 
 /*
@@ -87,7 +87,7 @@
  * @bug 6260188
  * @summary provide variable policies for javac operation
  *              Because of flow errors in C, no code should be generated
- * @compile/fail/ref=simple.ACD.out -XDstdout -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=simple A.java C.java D.java
+ * @compile/fail/ref=simple.ACD.out -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=simple A.java C.java D.java
  */
 
 /*
@@ -95,5 +95,5 @@
  * @bug 6260188
  * @summary provide variable policies for javac operation
  *              Generate code for A, A1, A2, but because of flow errors in C, no more code should be generated
- * @compile/fail/ref=byfile.ACD.out -XDstdout -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=byfile A.java C.java D.java
+ * @compile/fail/ref=byfile.ACD.out -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=byfile A.java C.java D.java
  */
--- a/langtools/test/tools/javac/policy/test2/Test.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/policy/test2/Test.java	Fri Aug 20 14:48:10 2010 -0400
@@ -23,20 +23,20 @@
 
 /*
  * @test
- * @compile/ref=byfile.AB.out -XDstdout -XDverboseCompilePolicy -XDcompile.policy=byfile A.java B.java
+ * @compile/ref=byfile.AB.out -XDverboseCompilePolicy -XDcompile.policy=byfile A.java B.java
  */
 
 /*
  * @test
- * @compile/ref=byfile.BA.out -XDstdout -XDverboseCompilePolicy -XDcompile.policy=byfile B.java A.java
+ * @compile/ref=byfile.BA.out -XDverboseCompilePolicy -XDcompile.policy=byfile B.java A.java
  */
 
 /*
  * @test
- * @compile/ref=bytodo.AB.out -XDstdout -XDverboseCompilePolicy -XDcompile.policy=bytodo A.java B.java
+ * @compile/ref=bytodo.AB.out -XDverboseCompilePolicy -XDcompile.policy=bytodo A.java B.java
  */
 
 /*
  * @test
- * @compile/ref=bytodo.BA.out -XDstdout -XDverboseCompilePolicy -XDcompile.policy=bytodo B.java A.java
+ * @compile/ref=bytodo.BA.out -XDverboseCompilePolicy -XDcompile.policy=bytodo B.java A.java
  */
--- a/langtools/test/tools/javac/positions/T6253161.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/positions/T6253161.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary Compiler will fail to find the correct location of serial warnings for anonymous inner classes
  * @author  Seetharama Avadhanam
  * @compile -Xlint:serial -XDdev T6253161.java
- * @compile/ref=T6253161.out -Xlint:serial -XDdev -XDrawDiagnostics -XDstdout T6253161.java
+ * @compile/ref=T6253161.out -Xlint:serial -XDdev -XDrawDiagnostics T6253161.java
  */
 import java.util.List;
 import java.util.ArrayList;
--- a/langtools/test/tools/javac/positions/T6253161a.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/positions/T6253161a.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary Compiler will fail to find the correct location of serial warnings for anonymous inner classes
  * @author  Seetharama Avadhanam
  * @compile -Xlint:serial -XDdev T6253161a.java
- * @compile/ref=T6253161a.out -Xlint:serial -XDdev -XDrawDiagnostics -XDstdout T6253161a.java
+ * @compile/ref=T6253161a.out -Xlint:serial -XDdev -XDrawDiagnostics T6253161a.java
  */
 import java.util.List;
 import java.util.ArrayList;
--- a/langtools/test/tools/javac/positions/T6264029.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/positions/T6264029.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary Compiler issues wrong unchecked warning for anonymous inner class
  * @author  Seetharama Avadhanam
  * @compile -Xlint:unchecked -XDdev T6264029.java
- * @compile/ref=T6264029.out -Xlint:unchecked -XDdev -XDrawDiagnostics -XDstdout T6264029.java
+ * @compile/ref=T6264029.out -Xlint:unchecked -XDdev -XDrawDiagnostics T6264029.java
  */
 
 class T6264029A<T,K> {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/filer/TestLastRound.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test 6966604
+ * @summary JavacFiler not correctly notified of lastRound
+ * @compile TestLastRound.java
+ * @compile/fail/ref=TestLastRound.out -XDrawDiagnostics -Werror -proc:only -processor TestLastRound TestLastRound.java
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+@SupportedAnnotationTypes("*")
+public class TestLastRound extends AbstractProcessor {
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations,
+                           RoundEnvironment roundEnv) {
+        Filer filer = processingEnv.getFiler();
+        if (roundEnv.processingOver()) {
+            try {
+                JavaFileObject fo = filer.createSourceFile("LastRound.java");
+                Writer out = fo.openWriter();
+                out.write("class LastRound { }");
+                out.close();
+            } catch (IOException e) {
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/filer/TestLastRound.out	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,3 @@
+- compiler.warn.proc.file.create.last.round: LastRound.java
+- compiler.err.warnings.and.werror
+1 error
--- a/langtools/test/tools/javac/processing/messager/6362067/T6362067.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/processing/messager/6362067/T6362067.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary Messager methods do not print out source position information
  * @build   T6362067
  * @compile -processor T6362067 -proc:only T6362067.java
- * @compile/ref=T6362067.out -XDstdout -XDrawDiagnostics -processor T6362067 -proc:only T6362067.java
+ * @compile/ref=T6362067.out -XDrawDiagnostics -processor T6362067 -proc:only T6362067.java
  */
 
 import java.util.Set;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/TestResourceVariable.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug  6911256 6964740
+ * @summary Test that the resource variable kind is appropriately set
+ * @author  Joseph D. Darcy
+ * @build TestResourceVariable
+ * @compile/fail -processor TestResourceVariable -proc:only TestResourceVariable.java
+ */
+
+// Bug should be filed for this misbehavior
+
+import java.io.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.lang.model.type.*;
+import javax.lang.model.util.*;
+import java.util.*;
+import com.sun.source.tree.*;
+import com.sun.source.util.*;
+import static javax.tools.Diagnostic.Kind.*;
+
+/**
+ * Using the tree API, retrieve element representations of the
+ * resource of an ARM block and verify their kind tags are set
+ * appropriately.
+ */
+@SupportedAnnotationTypes("*")
+public class TestResourceVariable extends AbstractProcessor implements AutoCloseable {
+    int resourceVariableCount = 0;
+
+    public boolean process(Set<? extends TypeElement> annotations,
+                          RoundEnvironment roundEnv) {
+       if (!roundEnv.processingOver()) {
+           Trees trees = Trees.instance(processingEnv);
+
+           for(Element rootElement : roundEnv.getRootElements()) {
+               TreePath treePath = trees.getPath(rootElement);
+
+               (new ResourceVariableScanner(trees)).
+                   scan(trees.getTree(rootElement),
+                        treePath.getCompilationUnit());
+           }
+           if (resourceVariableCount != 3)
+               throw new RuntimeException("Bad resource variable count " +
+                                          resourceVariableCount);
+       }
+       return true;
+    }
+
+    @Override
+    public void close() {}
+
+    private void test1() {
+        try(TestResourceVariable trv = this) {}
+    }
+
+    private void test2() {
+        try(TestResourceVariable trv1 = this; TestResourceVariable trv2 = trv1) {}
+    }
+
+    class ResourceVariableScanner extends TreeScanner<Void, CompilationUnitTree> {
+       private Trees trees;
+
+       public ResourceVariableScanner(Trees trees) {
+           super();
+           this.trees = trees;
+       }
+       @Override
+       public Void visitVariable(VariableTree node, CompilationUnitTree cu) {
+           Element element = trees.getElement(trees.getPath(cu, node));
+           if (element == null) {
+               System.out.println("Null variable element: " + node);
+           } else {
+               System.out.println("Name: " + element.getSimpleName() +
+                                  "\tKind: " + element.getKind());
+           }
+           if (element != null &&
+               element.getKind() == ElementKind.RESOURCE_VARIABLE) {
+               resourceVariableCount++;
+           }
+           return super.visitVariable(node, cu);
+       }
+   }
+
+   @Override
+   public SourceVersion getSupportedSourceVersion() {
+       return SourceVersion.latest();
+   }
+}
--- a/langtools/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java	Fri Aug 20 14:48:10 2010 -0400
@@ -27,15 +27,15 @@
  * @summary Test that warnings about source versions are output as expected.
  * @author  Joseph D. Darcy
  * @compile TestSourceVersionWarnings.java
- * @compile/ref=gold_0.out             -XDrawDiagnostics -XDstdout -processor TestSourceVersionWarnings -proc:only                           -source 1.5 HelloWorld.java
- * @compile/ref=gold_sv_warn_0_2.out   -XDrawDiagnostics -XDstdout -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_0 -source 1.2 HelloWorld.java
- * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -XDstdout -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_2 -source 1.2 HelloWorld.java
- * @compile/ref=gold_sv_warn_2_3.out   -XDrawDiagnostics -XDstdout -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_2 -source 1.3 HelloWorld.java
- * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -XDstdout -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_5 -source 1.5 HelloWorld.java
- * @compile/ref=gold_sv_warn_5_6.out   -XDrawDiagnostics -XDstdout -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_5 -source 1.6 HelloWorld.java
- * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -XDstdout -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 HelloWorld.java
- * @compile/ref=gold_unsp_warn.out     -XDrawDiagnostics -XDstdout -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 -Aunsupported HelloWorld.java
- * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -XDstdout -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_7 -source 1.7 HelloWorld.java
+ * @compile/ref=gold_0.out             -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only                           -source 1.5 HelloWorld.java
+ * @compile/ref=gold_sv_warn_0_2.out   -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_0 -source 1.2 HelloWorld.java
+ * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_2 -source 1.2 HelloWorld.java
+ * @compile/ref=gold_sv_warn_2_3.out   -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_2 -source 1.3 HelloWorld.java
+ * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_5 -source 1.5 HelloWorld.java
+ * @compile/ref=gold_sv_warn_5_6.out   -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_5 -source 1.6 HelloWorld.java
+ * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 HelloWorld.java
+ * @compile/ref=gold_unsp_warn.out     -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 -Aunsupported HelloWorld.java
+ * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_7 -source 1.7 HelloWorld.java
  */
 
 import java.util.Set;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/werror/WError1.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test 6403456
+ * @summary -Werror should work with annotation processing
+ * @compile WError1.java
+ * @compile -proc:only -processor WError1 WError1.java
+ * @compile/fail/ref=WError1.out -XDrawDiagnostics -Werror -proc:only -processor WError1 WError1.java
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+@SupportedAnnotationTypes("*")
+public class WError1 extends AbstractProcessor {
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations,
+                           RoundEnvironment roundEnv) {
+        Messager messager = processingEnv.getMessager();
+        if (++round == 1) {
+            messager.printMessage(Diagnostic.Kind.WARNING, "round 1");
+        }
+        return true;
+    }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    int round = 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/werror/WError1.out	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,4 @@
+- compiler.warn.proc.messager: round 1
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/werror/WErrorGen.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test 6403456
+ * @summary -Werror should work with annotation processing
+ * @compile WErrorGen.java
+ * @compile -proc:only -processor WErrorGen WErrorGen.java
+ * @compile/fail/ref=WErrorGen.out -XDrawDiagnostics -Werror -Xlint:rawtypes -processor WErrorGen WErrorGen.java
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+@SupportedAnnotationTypes("*")
+public class WErrorGen extends AbstractProcessor {
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations,
+                           RoundEnvironment roundEnv) {
+        Filer filer = processingEnv.getFiler();
+        if (++round == 1) {
+            try {
+                JavaFileObject fo = filer.createSourceFile("Gen");
+                Writer out = fo.openWriter();
+                out.write("import java.util.*; class Gen { List l; }");
+                out.close();
+            } catch (IOException e) {
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    int round = 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/werror/WErrorGen.out	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,4 @@
+Gen.java:1:33: compiler.warn.raw.class.use: java.util.List, java.util.List<E>
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/werror/WErrorLast.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test 6403456
+ * @summary -Werror should work with annotation processing
+ * @compile WErrorLast.java
+ * @compile -proc:only -processor WErrorLast WErrorLast.java
+ * @compile/fail/ref=WErrorLast.out -XDrawDiagnostics -Werror -proc:only -processor WErrorLast WErrorLast.java
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+@SupportedAnnotationTypes("*")
+public class WErrorLast extends AbstractProcessor {
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations,
+                           RoundEnvironment roundEnv) {
+        Messager messager = processingEnv.getMessager();
+        if (roundEnv.processingOver()) {
+            messager.printMessage(Diagnostic.Kind.WARNING, "last round");
+        }
+        return true;
+    }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/werror/WErrorLast.out	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,4 @@
+- compiler.warn.proc.messager: last round
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- a/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess2.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess2.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary Verify correct implementation of JLS2e 6.6.2.1
  * @author maddox
  *
- * @compile/fail/ref=ProtectedMemberAccess2.out -XDstdout -XDdiags=-simpleNames -XDdiagsFormat=%b:%l:%_%m ProtectedMemberAccess2.java
+ * @compile/fail/ref=ProtectedMemberAccess2.out -XDdiags=-simpleNames -XDdiagsFormat=%b:%l:%_%m ProtectedMemberAccess2.java
  */
 
 // 71 errors expected.
--- a/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess3.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess3.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary Verify correct implementation of JLS2e 6.6.2.1
  * @author maddox
  *
- * @compile/fail/ref=ProtectedMemberAccess3.out -XDstdout -XDdiags=-simpleNames -XDdiagsFormat=%b:%l:%_%m ProtectedMemberAccess3.java
+ * @compile/fail/ref=ProtectedMemberAccess3.out -XDdiags=-simpleNames -XDdiagsFormat=%b:%l:%_%m ProtectedMemberAccess3.java
  */
 
 // 46 errors expected.
--- a/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess4.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess4.java	Fri Aug 20 14:48:10 2010 -0400
@@ -4,7 +4,7 @@
  * @summary Verify correct implementation of JLS2e 6.6.2.1
  * @author maddox
  *
- * @compile/fail/ref=ProtectedMemberAccess4.out -XDstdout -XDdiags=-simpleNames -XDdiagsFormat=%b:%l:%_%m ProtectedMemberAccess4.java
+ * @compile/fail/ref=ProtectedMemberAccess4.out -XDdiags=-simpleNames -XDdiagsFormat=%b:%l:%_%m ProtectedMemberAccess4.java
  */
 
 // 33 errors expected.
--- a/langtools/test/tools/javac/rawDiags/Error.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/rawDiags/Error.java	Fri Aug 20 14:48:10 2010 -0400
@@ -2,7 +2,7 @@
  * @test  /nodynamiccopyright/
  * @bug 6177732
  * @summary add hidden option to have compiler generate diagnostics in more machine-readable form
- * @compile/fail/ref=Error.out -XDrawDiagnostics -XDstdout Error.java
+ * @compile/fail/ref=Error.out -XDrawDiagnostics Error.java
  */
 class Error
 {
--- a/langtools/test/tools/javac/rawDiags/Note.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/rawDiags/Note.java	Fri Aug 20 14:48:10 2010 -0400
@@ -25,7 +25,7 @@
  * @test
  * @bug 6177732
  * @summary add hidden option to have compiler generate diagnostics in more machine-readable form
- * @compile/ref=Note.out -XDrawDiagnostics -XDstdout Note.java
+ * @compile/ref=Note.out -XDrawDiagnostics Note.java
  */
 class Note
 {
--- a/langtools/test/tools/javac/rawDiags/Warning.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/rawDiags/Warning.java	Fri Aug 20 14:48:10 2010 -0400
@@ -2,7 +2,7 @@
  * @test  /nodynamiccopyright/
  * @bug 6177732
  * @summary add hidden option to have compiler generate diagnostics in more machine-readable form
- * @compile/ref=Warning.out -XDrawDiagnostics -XDstdout -Xlint:unchecked Warning.java
+ * @compile/ref=Warning.out -XDrawDiagnostics -Xlint:unchecked Warning.java
  */
 
 import java.util.HashSet;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/typeAnnotations/6967002/T6967002.java	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6967002
+ * @summary JDK7 b99 javac compilation error (java.lang.AssertionError)
+ * @author Maurizio Cimadamore
+ * @compile/fail/ref=T6967002.out -XDrawDiagnostics T6967002.java
+ */
+class Test {
+   private static void m(byte[] octets) {
+      return m(octets..., ?);
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/typeAnnotations/6967002/T6967002.out	Fri Aug 20 14:48:10 2010 -0400
@@ -0,0 +1,8 @@
+T6967002.java:33:22: compiler.err.expected: ')'
+T6967002.java:33:25: compiler.err.illegal.start.of.expr
+T6967002.java:33:28: compiler.err.illegal.start.of.expr
+T6967002.java:33:29: compiler.err.illegal.start.of.expr
+T6967002.java:33:27: compiler.err.not.stmt
+T6967002.java:33:30: compiler.err.expected: ';'
+T6967002.java:35:2: compiler.err.premature.eof
+7 errors
--- a/langtools/test/tools/javac/unicode/UnicodeNewline.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/unicode/UnicodeNewline.java	Fri Aug 20 14:48:10 2010 -0400
@@ -3,7 +3,7 @@
  * @bug 4739428 4785453
  * @summary when \u000a is used, diagnostics are reported on the wrong line.
  *
- * @compile/fail/ref=UnicodeNewline.out -XDstdout -XDdiags=%b:%l:%_%m UnicodeNewline.java
+ * @compile/fail/ref=UnicodeNewline.out -XDdiags=%b:%l:%_%m UnicodeNewline.java
  */
 
 class UnicodeNewline {
--- a/langtools/test/tools/javac/warnings/Deprecation.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/warnings/Deprecation.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,9 +1,9 @@
 /**
  * @test  /nodynamiccopyright/
  * @bug 4986256
- * @compile/ref=Deprecation.noLint.out -XDstdout                             -XDrawDiagnostics Deprecation.java
- * @compile/ref=Deprecation.lintDeprecation.out -XDstdout -Xlint:deprecation -XDrawDiagnostics Deprecation.java
- * @compile/ref=Deprecation.lintAll.out -XDstdout         -Xlint:all,-path   -XDrawDiagnostics Deprecation.java
+ * @compile/ref=Deprecation.noLint.out                             -XDrawDiagnostics Deprecation.java
+ * @compile/ref=Deprecation.lintDeprecation.out -Xlint:deprecation -XDrawDiagnostics Deprecation.java
+ * @compile/ref=Deprecation.lintAll.out         -Xlint:all,-path   -XDrawDiagnostics Deprecation.java
  */
 
 @Deprecated
--- a/langtools/test/tools/javac/warnings/DivZero.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/warnings/DivZero.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,9 +1,9 @@
 /**
  * @test  /nodynamiccopyright/
  * @bug 4759494 4986256
- * @compile/ref=DivZero.noLint.out -XDstdout                   -XDrawDiagnostics DivZero.java
- * @compile/ref=DivZero.lint.out -XDstdout    -Xlint:divzero   -XDrawDiagnostics DivZero.java
- * @compile/ref=DivZero.lint.out -XDstdout    -Xlint:all,-path -XDrawDiagnostics DivZero.java
+ * @compile/ref=DivZero.noLint.out                   -XDrawDiagnostics DivZero.java
+ * @compile/ref=DivZero.lint.out    -Xlint:divzero   -XDrawDiagnostics DivZero.java
+ * @compile/ref=DivZero.lint.out    -Xlint:all,-path -XDrawDiagnostics DivZero.java
  */
 
 class DivZero
--- a/langtools/test/tools/javac/warnings/FallThrough.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/warnings/FallThrough.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,9 +1,9 @@
 /**
  * @test  /nodynamiccopyright/
  * @bug 4986256
- * @compile/ref=FallThrough.noLint.out -XDstdout                             -XDrawDiagnostics FallThrough.java
- * @compile/ref=FallThrough.lintAll.out -XDstdout         -Xlint:all,-path   -XDrawDiagnostics FallThrough.java
- * @compile/ref=FallThrough.lintFallThrough.out -XDstdout -Xlint:fallthrough -XDrawDiagnostics FallThrough.java
+ * @compile/ref=FallThrough.noLint.out                             -XDrawDiagnostics FallThrough.java
+ * @compile/ref=FallThrough.lintAll.out         -Xlint:all,-path   -XDrawDiagnostics FallThrough.java
+ * @compile/ref=FallThrough.lintFallThrough.out -Xlint:fallthrough -XDrawDiagnostics FallThrough.java
  */
 
 // control: this class should generate a warning
--- a/langtools/test/tools/javac/warnings/Unchecked.java	Thu Aug 12 23:21:17 2010 -0700
+++ b/langtools/test/tools/javac/warnings/Unchecked.java	Fri Aug 20 14:48:10 2010 -0400
@@ -1,9 +1,9 @@
 /**
  * @test  /nodynamiccopyright/
  * @bug 4986256
- * @compile/ref=Unchecked.noLint.out -XDstdout                         -XDrawDiagnostics Unchecked.java
- * @compile/ref=Unchecked.lintUnchecked.out -XDstdout -Xlint:unchecked -XDrawDiagnostics Unchecked.java
- * @compile/ref=Unchecked.lintAll.out -XDstdout       -Xlint:all,-path -XDrawDiagnostics Unchecked.java
+ * @compile/ref=Unchecked.noLint.out                         -XDrawDiagnostics Unchecked.java
+ * @compile/ref=Unchecked.lintUnchecked.out -Xlint:unchecked -XDrawDiagnostics Unchecked.java
+ * @compile/ref=Unchecked.lintAll.out       -Xlint:all,-path -XDrawDiagnostics Unchecked.java
  */
 
 import java.util.ArrayList;