Merge
authoracorn
Fri, 26 Mar 2010 11:10:26 -0400
changeset 5095 06b1faf0df9c
parent 5094 04c439ab7a44 (current diff)
parent 5081 41cf61730680 (diff)
child 5096 c05a19f139d5
child 5237 aab592fd4f44
Merge
hotspot/src/cpu/x86/vm/methodHandles_x86.cpp
hotspot/src/share/vm/includeDB_core
hotspot/src/share/vm/runtime/globals.hpp
jdk/test/java/nio/file/WatchService/OverflowEventIsLoner.java
langtools/test/tools/javac/treepostests/TreePosTest.java
--- a/.hgtags	Thu Mar 25 16:54:59 2010 -0700
+++ b/.hgtags	Fri Mar 26 11:10:26 2010 -0400
@@ -59,3 +59,4 @@
 a30062be6d9ca1d48579826f870f85974300004e jdk7-b82
 34c8199936a1682aa8587857f44cfaf37c2b6381 jdk7-b83
 b1e55627a6980b9508854ed0c0f21d4f981b4494 jdk7-b84
+b6f633a93ae0ec4555ff4bf756f5e2150c9bdede jdk7-b85
--- a/.hgtags-top-repo	Thu Mar 25 16:54:59 2010 -0700
+++ b/.hgtags-top-repo	Fri Mar 26 11:10:26 2010 -0400
@@ -59,3 +59,4 @@
 e1176f86805fe07fd9fb9da065dc51b47712ce76 jdk7-b82
 6880a3af9addb41541e80ebe8cde6f79ec402a58 jdk7-b83
 2f3ea057d1ad56cf3b269cdc4de2741411151982 jdk7-b84
+cf26288a114be67c39f2758959ce50b60f5ae330 jdk7-b85
--- a/corba/.hgtags	Thu Mar 25 16:54:59 2010 -0700
+++ b/corba/.hgtags	Fri Mar 26 11:10:26 2010 -0400
@@ -59,3 +59,4 @@
 1e8c1bfad1abb4b81407a0f2645e0fb85764ca48 jdk7-b82
 fde0df7a2384f7fe33204a79678989807d9c2b98 jdk7-b83
 68c8961a82e4a3ad2a67991e5d834192a81eb4cd jdk7-b84
+c67a9df7bc0ca291f08f9a9cc05cb78ea15d25e6 jdk7-b85
--- a/hotspot/.hgtags	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/.hgtags	Fri Mar 26 11:10:26 2010 -0400
@@ -81,3 +81,5 @@
 fafab5d5349c7c066d677538db67a1ee0fb33bd2 hs15-b05
 3f370a32906eb5ba993fabd7b4279be7f31052b9 jdk7-b83
 ffc8d176b84bcfb5ac21302b4feb3b0c0d69b97c jdk7-b84
+6c9796468b91dcbb39e09dfa1baf9779ac45eb66 jdk7-b85
+418bc80ce13995149eadc9eecbba21d7a9fa02ae hs17-b10
--- a/hotspot/agent/src/os/linux/libproc_impl.c	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/agent/src/os/linux/libproc_impl.c	Fri Mar 26 11:10:26 2010 -0400
@@ -174,7 +174,7 @@
       return NULL;
    }
 
-   newlib->symtab = build_symtab(newlib->fd);
+   newlib->symtab = build_symtab(newlib->fd, libname);
    if (newlib->symtab == NULL) {
       print_debug("symbol table build failed for %s\n", newlib->name);
    }
--- a/hotspot/agent/src/os/linux/symtab.c	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/agent/src/os/linux/symtab.c	Fri Mar 26 11:10:26 2010 -0400
@@ -53,8 +53,274 @@
   struct hsearch_data *hash_table;
 } symtab_t;
 
-// read symbol table from given fd.
-struct symtab* build_symtab(int fd) {
+
+// Directory that contains global debuginfo files.  In theory it
+// should be possible to change this, but in a Java environment there
+// is no obvious place to put a user interface to do it.  Maybe this
+// could be set with an environment variable.
+static const char debug_file_directory[] = "/usr/lib/debug";
+
+/* The CRC used in gnu_debuglink, retrieved from
+   http://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files. */
+unsigned int gnu_debuglink_crc32 (unsigned int crc,
+                                  unsigned char *buf, size_t len)
+{
+  static const unsigned int crc32_table[256] =
+    {
+      0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
+      0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
+      0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
+      0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
+      0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
+      0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
+      0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
+      0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
+      0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
+      0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
+      0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
+      0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+      0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
+      0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
+      0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
+      0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
+      0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
+      0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
+      0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
+      0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
+      0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
+      0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
+      0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
+      0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+      0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
+      0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
+      0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
+      0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
+      0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
+      0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
+      0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
+      0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
+      0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
+      0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
+      0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
+      0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
+      0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
+      0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
+      0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
+      0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
+      0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
+      0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
+      0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
+      0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
+      0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
+      0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
+      0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
+      0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+      0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
+      0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
+      0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
+      0x2d02ef8d
+    };
+  unsigned char *end;
+
+  crc = ~crc & 0xffffffff;
+  for (end = buf + len; buf < end; ++buf)
+    crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
+  return ~crc & 0xffffffff;
+}
+
+/* Open a debuginfo file and check its CRC.  If it exists and the CRC
+   matches return its fd.  */
+static int
+open_debug_file (const char *pathname, unsigned int crc)
+{
+  unsigned int file_crc = 0;
+  unsigned char buffer[8 * 1024];
+
+  int fd = pathmap_open(pathname);
+
+  if (fd < 0)
+    return -1;
+
+  lseek(fd, 0, SEEK_SET);
+
+  for (;;) {
+    int len = read(fd, buffer, sizeof buffer);
+    if (len <= 0)
+      break;
+    file_crc = gnu_debuglink_crc32(file_crc, buffer, len);
+  }
+
+  if (crc == file_crc)
+    return fd;
+  else {
+    close(fd);
+    return -1;
+  }
+}
+
+/* Find an ELF section.  */
+static struct elf_section *find_section_by_name(char *name,
+                                                int fd,
+                                                ELF_EHDR *ehdr,
+                                                ELF_SHDR *shbuf,
+                                                struct elf_section *scn_cache)
+{
+  ELF_SHDR* cursct = NULL;
+  char *strtab;
+  int cnt;
+
+  if (scn_cache[ehdr->e_shstrndx].c_data == NULL) {
+    if ((scn_cache[ehdr->e_shstrndx].c_data
+         = read_section_data(fd, ehdr, cursct)) == NULL) {
+      return NULL;
+    }
+  }
+
+  strtab = scn_cache[ehdr->e_shstrndx].c_data;
+
+  for (cursct = shbuf, cnt = 0;
+       cnt < ehdr->e_shnum;
+       cnt++, cursct++) {
+    if (strcmp(cursct->sh_name + strtab, name) == 0) {
+      scn_cache[cnt].c_data = read_section_data(fd, ehdr, cursct);
+      return &scn_cache[cnt];
+    }
+  }
+
+  return NULL;
+}
+
+/* Look for a ".gnu_debuglink" section.  If one exists, try to open a
+   suitable debuginfo file.  */
+static int open_file_from_debug_link(const char *name,
+                                     int fd,
+                                     ELF_EHDR *ehdr,
+                                     ELF_SHDR *shbuf,
+                                     struct elf_section *scn_cache)
+{
+  int debug_fd;
+  struct elf_section *debug_link = find_section_by_name(".gnu_debuglink", fd, ehdr,
+                                                        shbuf, scn_cache);
+  if (debug_link == NULL)
+    return -1;
+  char *debug_filename = debug_link->c_data;
+  int offset = (strlen(debug_filename) + 4) >> 2;
+  static unsigned int crc;
+  crc = ((unsigned int*)debug_link->c_data)[offset];
+  char *debug_pathname = malloc(strlen(debug_filename)
+                                + strlen(name)
+                                + strlen(".debug/")
+                                + strlen(debug_file_directory)
+                                + 2);
+  strcpy(debug_pathname, name);
+  char *last_slash = strrchr(debug_pathname, '/');
+  if (last_slash == NULL)
+    return -1;
+
+  /* Look in the same directory as the object.  */
+  strcpy(last_slash+1, debug_filename);
+
+  debug_fd = open_debug_file(debug_pathname, crc);
+  if (debug_fd >= 0) {
+    free(debug_pathname);
+    return debug_fd;
+  }
+
+  /* Look in a subdirectory named ".debug".  */
+  strcpy(last_slash+1, ".debug/");
+  strcat(last_slash, debug_filename);
+
+  debug_fd = open_debug_file(debug_pathname, crc);
+  if (debug_fd >= 0) {
+    free(debug_pathname);
+    return debug_fd;
+  }
+
+  /* Look in /usr/lib/debug + the full pathname.  */
+  strcpy(debug_pathname, debug_file_directory);
+  strcat(debug_pathname, name);
+  last_slash = strrchr(debug_pathname, '/');
+  strcpy(last_slash+1, debug_filename);
+
+  debug_fd = open_debug_file(debug_pathname, crc);
+  if (debug_fd >= 0) {
+    free(debug_pathname);
+    return debug_fd;
+  }
+
+  free(debug_pathname);
+  return -1;
+}
+
+static struct symtab* build_symtab_internal(int fd, const char *filename, bool try_debuginfo);
+
+/* Look for a ".gnu_debuglink" section.  If one exists, try to open a
+   suitable debuginfo file and read a symbol table from it.  */
+static struct symtab *build_symtab_from_debug_link(const char *name,
+                                     int fd,
+                                     ELF_EHDR *ehdr,
+                                     ELF_SHDR *shbuf,
+                                     struct elf_section *scn_cache)
+{
+  fd = open_file_from_debug_link(name, fd, ehdr, shbuf, scn_cache);
+
+  if (fd >= 0) {
+    struct symtab *symtab = build_symtab_internal(fd, NULL, /* try_debuginfo */ false);
+    close(fd);
+    return symtab;
+  }
+
+  return NULL;
+}
+
+// Given a build_id, find the associated debuginfo file
+static char *
+build_id_to_debug_filename (size_t size, unsigned char *data)
+{
+  char *filename, *s;
+
+  filename = malloc(strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
+                    + 2 * size + (sizeof ".debug" - 1) + 1);
+  s = filename + sprintf (filename, "%s/.build-id/", debug_file_directory);
+  if (size > 0)
+    {
+      size--;
+      s += sprintf (s, "%02x", *data++);
+    }
+  if (size > 0)
+    *s++ = '/';
+  while (size-- > 0)
+    s += sprintf (s, "%02x", *data++);
+  strcpy (s, ".debug");
+
+  return filename;
+}
+
+// Read a build ID note.  Try to open any associated debuginfo file
+// and return its symtab
+static struct symtab* build_symtab_from_build_id(Elf64_Nhdr *note)
+{
+  int fd;
+  struct symtab *symtab = NULL;
+
+  unsigned char *bytes
+    = (unsigned char*)(note+1) + note->n_namesz;
+  unsigned char *filename
+    = (build_id_to_debug_filename (note->n_descsz, bytes));
+
+  fd = pathmap_open(filename);
+  if (fd >= 0) {
+    symtab = build_symtab_internal(fd, NULL, /* try_debuginfo */ false);
+    close(fd);
+  }
+  free(filename);
+
+  return symtab;
+}
+
+// read symbol table from given fd.  If try_debuginfo) is true, also
+// try to open an associated debuginfo file
+static struct symtab* build_symtab_internal(int fd, const char *filename, bool try_debuginfo) {
   ELF_EHDR ehdr;
   char *names = NULL;
   struct symtab* symtab = NULL;
@@ -66,6 +332,7 @@
   ELF_SHDR* cursct = NULL;
   ELF_PHDR* phbuf = NULL;
   ELF_PHDR* phdr = NULL;
+  int sym_section = SHT_DYNSYM;
 
   uintptr_t baseaddr = (uintptr_t)-1;
 
@@ -90,18 +357,23 @@
 
   for (cursct = shbuf, cnt = 0; cnt < ehdr.e_shnum; cnt++) {
     scn_cache[cnt].c_shdr = cursct;
-    if (cursct->sh_type == SHT_SYMTAB || cursct->sh_type == SHT_STRTAB) {
+    if (cursct->sh_type == SHT_SYMTAB || cursct->sh_type == SHT_STRTAB
+        || cursct->sh_type == SHT_NOTE || cursct->sh_type == SHT_DYNSYM) {
       if ( (scn_cache[cnt].c_data = read_section_data(fd, &ehdr, cursct)) == NULL) {
          goto quit;
       }
     }
+    if (cursct->sh_type == SHT_SYMTAB) {
+      // Full symbol table available so use that
+      sym_section = cursct->sh_type;
+    }
     cursct++;
   }
 
   for (cnt = 1; cnt < ehdr.e_shnum; cnt++) {
     ELF_SHDR *shdr = scn_cache[cnt].c_shdr;
 
-    if (shdr->sh_type == SHT_SYMTAB) {
+    if (shdr->sh_type == sym_section) {
       ELF_SYM  *syms;
       int j, n, rslt;
       size_t size;
@@ -163,6 +435,45 @@
     }
   }
 
+  // Look for a separate debuginfo file.
+  if (try_debuginfo) {
+
+    // We prefer a debug symtab to an object's own symtab, so look in
+    // the debuginfo file.  We stash a copy of the old symtab in case
+    // there is no debuginfo.
+    struct symtab* prev_symtab = symtab;
+    symtab = NULL;
+
+#ifdef NT_GNU_BUILD_ID
+    // First we look for a Build ID
+    for (cursct = shbuf, cnt = 0;
+         symtab == NULL && cnt < ehdr.e_shnum;
+         cnt++) {
+      if (cursct->sh_type == SHT_NOTE) {
+        Elf64_Nhdr *note = (Elf64_Nhdr *)scn_cache[cnt].c_data;
+        if (note->n_type == NT_GNU_BUILD_ID) {
+          symtab = build_symtab_from_build_id(note);
+        }
+      }
+      cursct++;
+    }
+#endif
+
+    // Then, if that doesn't work, the debug link
+    if (symtab == NULL) {
+      symtab = build_symtab_from_debug_link(filename, fd, &ehdr, shbuf,
+                                            scn_cache);
+    }
+
+    // If we still haven't found a symtab, use the object's own symtab.
+    if (symtab != NULL) {
+      if (prev_symtab != NULL)
+        destroy_symtab(prev_symtab);
+    } else {
+      symtab = prev_symtab;
+    }
+  }
+
 quit:
   if (shbuf) free(shbuf);
   if (phbuf) free(phbuf);
@@ -177,6 +488,11 @@
   return symtab;
 }
 
+struct symtab* build_symtab(int fd, const char *filename) {
+  return build_symtab_internal(fd, filename, /* try_debuginfo */ true);
+}
+
+
 void destroy_symtab(struct symtab* symtab) {
   if (!symtab) return;
   if (symtab->strs) free(symtab->strs);
--- a/hotspot/agent/src/os/linux/symtab.h	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/agent/src/os/linux/symtab.h	Fri Mar 26 11:10:26 2010 -0400
@@ -32,7 +32,7 @@
 struct symtab;
 
 // build symbol table for a given ELF file descriptor
-struct symtab* build_symtab(int fd);
+struct symtab* build_symtab(int fd, const char *filename);
 
 // destroy the symbol table
 void destroy_symtab(struct symtab* symtab);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/make/linux/makefiles/build_vm_def.sh	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+nm --defined-only $* | awk '
+   { if ($3 ~ /^_ZTV/ || $3 ~ /^gHotSpotVM/) print "\t" $3 ";" }
+   '
--- a/hotspot/make/linux/makefiles/mapfile-vers-debug	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/make/linux/makefiles/mapfile-vers-debug	Fri Mar 26 11:10:26 2010 -0400
@@ -290,6 +290,9 @@
 
                 # This is for Forte Analyzer profiling support.
                 AsyncGetCallTrace;
+
+		# INSERT VTABLE SYMBOLS HERE
+
         local:
                 *;
 };
--- a/hotspot/make/linux/makefiles/mapfile-vers-product	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/make/linux/makefiles/mapfile-vers-product	Fri Mar 26 11:10:26 2010 -0400
@@ -285,6 +285,9 @@
 
                 # This is for Forte Analyzer profiling support.
                 AsyncGetCallTrace;
+
+		# INSERT VTABLE SYMBOLS HERE
+
         local:
                 *;
 };
--- a/hotspot/make/linux/makefiles/vm.make	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/make/linux/makefiles/vm.make	Fri Mar 26 11:10:26 2010 -0400
@@ -121,14 +121,21 @@
 
 vm_version.o: $(filter-out vm_version.o,$(JVM_OBJ_FILES))
 
-mapfile : $(MAPFILE)
+mapfile : $(MAPFILE) vm.def
 	rm -f $@
-	cat $^ > $@
+	awk '{ if ($$0 ~ "INSERT VTABLE SYMBOLS HERE")	\
+                 { system ("cat vm.def"); }		\
+               else					\
+                 { print $$0 }				\
+             }' > $@ < $(MAPFILE)
 
 mapfile_reorder : mapfile $(REORDERFILE)
 	rm -f $@
 	cat $^ > $@
 
+vm.def: $(Res_Files) $(Obj_Files)
+	sh $(GAMMADIR)/make/linux/makefiles/build_vm_def.sh *.o > $@
+
 ifeq ($(ZERO_LIBARCH), ppc64)
   STATIC_CXX = false
 else
--- a/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-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
@@ -377,6 +377,16 @@
 
 }
 
+
+void DeoptimizeStub::emit_code(LIR_Assembler* ce) {
+  __ bind(_entry);
+  __ call(SharedRuntime::deopt_blob()->unpack_with_reexecution());
+  __ delayed()->nop();
+  ce->add_call_info_here(_info);
+  debug_only(__ should_not_reach_here());
+}
+
+
 void ArrayCopyStub::emit_code(LIR_Assembler* ce) {
   //---------------slow case: call to native-----------------
   __ bind(_entry);
--- a/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-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
@@ -143,3 +143,6 @@
 
   static bool is_caller_save_register (LIR_Opr  reg);
   static bool is_caller_save_register (Register r);
+
+  // JSR 292
+  static LIR_Opr& method_handle_invoke_SP_save_opr() { return L7_opr; }
--- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -378,12 +378,7 @@
 
   int offset = code_offset();
 
-  if (compilation()->has_exception_handlers() || compilation()->env()->jvmti_can_post_on_exceptions()) {
-    __ call(Runtime1::entry_for(Runtime1::handle_exception_id), relocInfo::runtime_call_type);
-    __ delayed()->nop();
-  }
-
-  __ call(Runtime1::entry_for(Runtime1::unwind_exception_id), relocInfo::runtime_call_type);
+  __ call(Runtime1::entry_for(Runtime1::handle_exception_id), relocInfo::runtime_call_type);
   __ delayed()->nop();
   debug_only(__ stop("should have gone to the caller");)
   assert(code_offset() - offset <= exception_handler_size, "overflow");
@@ -685,29 +680,29 @@
 }
 
 
-void LIR_Assembler::call(address entry, relocInfo::relocType rtype, CodeEmitInfo* info) {
-  __ call(entry, rtype);
+void LIR_Assembler::call(LIR_OpJavaCall* op, relocInfo::relocType rtype) {
+  __ call(op->addr(), rtype);
   // the peephole pass fills the delay slot
 }
 
 
-void LIR_Assembler::ic_call(address entry, CodeEmitInfo* info) {
+void LIR_Assembler::ic_call(LIR_OpJavaCall* op) {
   RelocationHolder rspec = virtual_call_Relocation::spec(pc());
   __ set_oop((jobject)Universe::non_oop_word(), G5_inline_cache_reg);
   __ relocate(rspec);
-  __ call(entry, relocInfo::none);
+  __ call(op->addr(), relocInfo::none);
   // the peephole pass fills the delay slot
 }
 
 
-void LIR_Assembler::vtable_call(int vtable_offset, CodeEmitInfo* info) {
-  add_debug_info_for_null_check_here(info);
+void LIR_Assembler::vtable_call(LIR_OpJavaCall* op) {
+  add_debug_info_for_null_check_here(op->info());
   __ ld_ptr(O0, oopDesc::klass_offset_in_bytes(), G3_scratch);
-  if (__ is_simm13(vtable_offset) ) {
-    __ ld_ptr(G3_scratch, vtable_offset, G5_method);
+  if (__ is_simm13(op->vtable_offset())) {
+    __ ld_ptr(G3_scratch, op->vtable_offset(), G5_method);
   } else {
     // This will generate 2 instructions
-    __ set(vtable_offset, G5_method);
+    __ set(op->vtable_offset(), G5_method);
     // ld_ptr, set_hi, set
     __ ld_ptr(G3_scratch, G5_method, G5_method);
   }
@@ -717,6 +712,16 @@
 }
 
 
+void LIR_Assembler::preserve_SP(LIR_OpJavaCall* op) {
+  Unimplemented();
+}
+
+
+void LIR_Assembler::restore_SP(LIR_OpJavaCall* op) {
+  Unimplemented();
+}
+
+
 // load with 32-bit displacement
 int LIR_Assembler::load(Register s, int disp, Register d, BasicType ld_type, CodeEmitInfo *info) {
   int load_offset = code_offset();
@@ -1067,7 +1072,8 @@
   LIR_Const* c = src->as_constant_ptr();
   switch (c->type()) {
     case T_INT:
-    case T_FLOAT: {
+    case T_FLOAT:
+    case T_ADDRESS: {
       Register src_reg = O7;
       int value = c->as_jint_bits();
       if (value == 0) {
@@ -1123,7 +1129,8 @@
   }
   switch (c->type()) {
     case T_INT:
-    case T_FLOAT: {
+    case T_FLOAT:
+    case T_ADDRESS: {
       LIR_Opr tmp = FrameMap::O7_opr;
       int value = c->as_jint_bits();
       if (value == 0) {
@@ -1195,6 +1202,7 @@
 
   switch (c->type()) {
     case T_INT:
+    case T_ADDRESS:
       {
         jint con = c->as_jint();
         if (to_reg->is_single_cpu()) {
--- a/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-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
@@ -42,17 +42,6 @@
 }
 
 
-void C1_MacroAssembler::method_exit(bool restore_frame) {
-  // this code must be structured this way so that the return
-  // instruction can be a safepoint.
-  if (restore_frame) {
-    restore();
-  }
-  retl();
-  delayed()->nop();
-}
-
-
 void C1_MacroAssembler::explicit_null_check(Register base) {
   Unimplemented();
 }
--- a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-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
@@ -677,7 +677,7 @@
         __ add(I7, frame::pc_return_offset, Oissuing_pc->after_save());
 
         __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address),
-                        Oissuing_pc->after_save());
+                        G2_thread, Oissuing_pc->after_save());
         __ verify_not_null_oop(Oexception->after_save());
         __ jmp(O0, 0);
         __ delayed()->restore();
@@ -985,7 +985,6 @@
 
 void Runtime1::generate_handle_exception(StubAssembler* sasm, OopMapSet* oop_maps, OopMap* oop_map, bool) {
   Label no_deopt;
-  Label no_handler;
 
   __ verify_not_null_oop(Oexception);
 
@@ -1003,9 +1002,14 @@
   // whether it had a handler or not we will deoptimize
   // by entering the deopt blob with a pending exception.
 
+#ifdef ASSERT
+  Label done;
   __ tst(O0);
-  __ br(Assembler::zero, false, Assembler::pn, no_handler);
+  __ br(Assembler::notZero, false, Assembler::pn, done);
   __ delayed()->nop();
+  __ stop("should have found address");
+  __ bind(done);
+#endif
 
   // restore the registers that were saved at the beginning and jump to the exception handler.
   restore_live_registers(sasm);
@@ -1013,20 +1017,6 @@
   __ jmp(O0, 0);
   __ delayed()->restore();
 
-  __ bind(no_handler);
-  __ mov(L0, I7); // restore return address
-
-  // restore exception oop
-  __ ld_ptr(G2_thread, in_bytes(JavaThread::exception_oop_offset()), Oexception->after_save());
-  __ st_ptr(G0, G2_thread, in_bytes(JavaThread::exception_oop_offset()));
-
-  __ restore();
-
-  AddressLiteral exc(Runtime1::entry_for(Runtime1::unwind_exception_id));
-  __ jump_to(exc, G4);
-  __ delayed()->nop();
-
-
   oop_maps->add_gc_map(call_offset, oop_map);
 }
 
--- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -244,9 +244,10 @@
 }
 
 
-void InterpreterMacroAssembler::super_call_VM_leaf(Register thread_cache, address entry_point, Register arg_1) {
+void InterpreterMacroAssembler::super_call_VM_leaf(Register thread_cache, address entry_point, Register arg_1, Register arg_2) {
   mov(arg_1, O0);
-  MacroAssembler::call_VM_leaf_base(thread_cache, entry_point, 1);
+  mov(arg_2, O1);
+  MacroAssembler::call_VM_leaf_base(thread_cache, entry_point, 2);
 }
 #endif /* CC_INTERP */
 
--- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-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
@@ -121,7 +121,7 @@
                      bool check_exception = true);
 
 #ifndef CC_INTERP
-  void super_call_VM_leaf(Register thread_cache, address entry_point, Register arg_1);
+  void super_call_VM_leaf(Register thread_cache, address entry_point, Register arg_1, Register arg_2);
 
   // Generate a subtype check: branch to ok_is_subtype if sub_klass is
   // a subtype of super_klass.  Blows registers tmp1, tmp2 and tmp3.
--- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -379,7 +379,7 @@
     __ save_frame(0);             // compensates for compiler weakness
     __ add(O7->after_save(), frame::pc_return_offset, Lscratch); // save the issuing PC
     BLOCK_COMMENT("call exception_handler_for_return_address");
-    __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), Lscratch);
+    __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), G2_thread, Lscratch);
     __ mov(O0, handler_reg);
     __ restore();                 // compensates for compiler weakness
 
--- a/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-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
@@ -37,8 +37,13 @@
 
 enum /* platform_dependent_constants */ {
   // %%%%%%%% May be able to shrink this a lot
-  code_size1 = 20000,                                        // simply increase if too small (assembler will crash if too small)
-  code_size2 = 20000                                         // simply increase if too small (assembler will crash if too small)
+  code_size1 = 20000,           // simply increase if too small (assembler will crash if too small)
+  code_size2 = 20000            // simply increase if too small (assembler will crash if too small)
+};
+
+// MethodHandles adapters
+enum method_handles_platform_dependent_constants {
+  method_handles_adapters_code_size = 5000
 };
 
 class Sparc {
--- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-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
@@ -1822,7 +1822,7 @@
   __ add(issuing_pc_addr, Oissuing_pc->after_save());  // likewise set I1 to a value local to the caller
   __ super_call_VM_leaf(L7_thread_cache,
                         CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address),
-                        Oissuing_pc->after_save());
+                        G2_thread, Oissuing_pc->after_save());
 
   // The caller's SP was adjusted upon method entry to accomodate
   // the callee's non-argument locals. Undo that adjustment.
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -8460,6 +8460,7 @@
   subptr(str1, result); // Restore counter
   shrl(str1, 1);
   addl(cnt1, str1);
+  decrementl(cnt1);
   lea(str1, Address(result, 2)); // Reload string
 
   // Load substr
--- a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-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
@@ -373,6 +373,14 @@
 }
 
 
+void DeoptimizeStub::emit_code(LIR_Assembler* ce) {
+  __ bind(_entry);
+  __ call(RuntimeAddress(SharedRuntime::deopt_blob()->unpack_with_reexecution()));
+  ce->add_call_info_here(_info);
+  debug_only(__ should_not_reach_here());
+}
+
+
 void ImplicitNullCheckStub::emit_code(LIR_Assembler* ce) {
   ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
   __ bind(_entry);
--- a/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-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
@@ -126,3 +126,6 @@
     assert(i >= 0 && i < nof_caller_save_xmm_regs, "out of bounds");
     return _caller_save_xmm_regs[i];
   }
+
+  // JSR 292
+  static LIR_Opr& method_handle_invoke_SP_save_opr() { return rbp_opr; }
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -436,40 +436,18 @@
 
   int offset = code_offset();
 
-  // if the method does not have an exception handler, then there is
-  // no reason to search for one
-  if (compilation()->has_exception_handlers() || compilation()->env()->jvmti_can_post_on_exceptions()) {
-    // the exception oop and pc are in rax, and rdx
-    // no other registers need to be preserved, so invalidate them
-    __ invalidate_registers(false, true, true, false, true, true);
-
-    // check that there is really an exception
-    __ verify_not_null_oop(rax);
-
-    // search an exception handler (rax: exception oop, rdx: throwing pc)
-    __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::handle_exception_nofpu_id)));
-
-    // if the call returns here, then the exception handler for particular
-    // exception doesn't exist -> unwind activation and forward exception to caller
-  }
-
-  // the exception oop is in rax,
+  // the exception oop and pc are in rax, and rdx
   // no other registers need to be preserved, so invalidate them
-  __ invalidate_registers(false, true, true, true, true, true);
+  __ invalidate_registers(false, true, true, false, true, true);
 
   // check that there is really an exception
   __ verify_not_null_oop(rax);
 
-  // unlock the receiver/klass if necessary
-  // rax,: exception
-  ciMethod* method = compilation()->method();
-  if (method->is_synchronized() && GenerateSynchronizationCode) {
-    monitorexit(FrameMap::rbx_oop_opr, FrameMap::rcx_opr, SYNC_header, 0, rax);
-  }
-
-  // unwind activation and forward exception to caller
-  // rax,: exception
-  __ jump(RuntimeAddress(Runtime1::entry_for(Runtime1::unwind_exception_id)));
+  // search an exception handler (rax: exception oop, rdx: throwing pc)
+  __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::handle_exception_nofpu_id)));
+
+  __ stop("should not reach here");
+
   assert(code_offset() - offset <= exception_handler_size, "overflow");
   __ end_a_stub();
 
@@ -495,8 +473,10 @@
 
   int offset = code_offset();
   InternalAddress here(__ pc());
+
   __ pushptr(here.addr());
   __ jump(RuntimeAddress(SharedRuntime::deopt_blob()->unpack()));
+
   assert(code_offset() - offset <= deopt_handler_size, "overflow");
   __ end_a_stub();
 
@@ -593,7 +573,7 @@
   }
 
   // Pop the stack before the safepoint code
-  __ leave();
+  __ remove_frame(initial_frame_size_in_bytes());
 
   bool result_is_oop = result->is_valid() ? result->is_oop() : false;
 
@@ -648,7 +628,8 @@
   LIR_Const* c = src->as_constant_ptr();
 
   switch (c->type()) {
-    case T_INT: {
+    case T_INT:
+    case T_ADDRESS: {
       assert(patch_code == lir_patch_none, "no patching handled here");
       __ movl(dest->as_register(), c->as_jint());
       break;
@@ -731,6 +712,7 @@
   switch (c->type()) {
     case T_INT:  // fall through
     case T_FLOAT:
+    case T_ADDRESS:
       __ movl(frame_map()->address_for_slot(dest->single_stack_ix()), c->as_jint_bits());
       break;
 
@@ -766,6 +748,7 @@
   switch (type) {
     case T_INT:    // fall through
     case T_FLOAT:
+    case T_ADDRESS:
       __ movl(as_Address(addr), c->as_jint_bits());
       break;
 
@@ -2738,6 +2721,7 @@
     switch (code) {
       case lir_static_call:
       case lir_optvirtual_call:
+      case lir_dynamic_call:
         offset += NativeCall::displacement_offset;
         break;
       case lir_icvirtual_call:
@@ -2753,30 +2737,41 @@
 }
 
 
-void LIR_Assembler::call(address entry, relocInfo::relocType rtype, CodeEmitInfo* info) {
+void LIR_Assembler::call(LIR_OpJavaCall* op, relocInfo::relocType rtype) {
   assert(!os::is_MP() || (__ offset() + NativeCall::displacement_offset) % BytesPerWord == 0,
          "must be aligned");
-  __ call(AddressLiteral(entry, rtype));
-  add_call_info(code_offset(), info);
+  __ call(AddressLiteral(op->addr(), rtype));
+  add_call_info(code_offset(), op->info(), op->is_method_handle_invoke());
 }
 
 
-void LIR_Assembler::ic_call(address entry, CodeEmitInfo* info) {
+void LIR_Assembler::ic_call(LIR_OpJavaCall* op) {
   RelocationHolder rh = virtual_call_Relocation::spec(pc());
   __ movoop(IC_Klass, (jobject)Universe::non_oop_word());
   assert(!os::is_MP() ||
          (__ offset() + NativeCall::displacement_offset) % BytesPerWord == 0,
          "must be aligned");
-  __ call(AddressLiteral(entry, rh));
-  add_call_info(code_offset(), info);
+  __ call(AddressLiteral(op->addr(), rh));
+  add_call_info(code_offset(), op->info(), op->is_method_handle_invoke());
 }
 
 
 /* Currently, vtable-dispatch is only enabled for sparc platforms */
-void LIR_Assembler::vtable_call(int vtable_offset, CodeEmitInfo* info) {
+void LIR_Assembler::vtable_call(LIR_OpJavaCall* op) {
   ShouldNotReachHere();
 }
 
+
+void LIR_Assembler::preserve_SP(LIR_OpJavaCall* op) {
+  __ movptr(FrameMap::method_handle_invoke_SP_save_opr()->as_register(), rsp);
+}
+
+
+void LIR_Assembler::restore_SP(LIR_OpJavaCall* op) {
+  __ movptr(rsp, FrameMap::method_handle_invoke_SP_save_opr()->as_register());
+}
+
+
 void LIR_Assembler::emit_static_call_stub() {
   address call_pc = __ pc();
   address stub = __ start_a_stub(call_stub_size);
@@ -2829,10 +2824,12 @@
     } else {
       unwind_id = Runtime1::handle_exception_nofpu_id;
     }
+    __ call(RuntimeAddress(Runtime1::entry_for(unwind_id)));
   } else {
-    unwind_id = Runtime1::unwind_exception_id;
+    // remove the activation
+    __ remove_frame(initial_frame_size_in_bytes());
+    __ jump(RuntimeAddress(Runtime1::entry_for(Runtime1::unwind_exception_id)));
   }
-  __ call(RuntimeAddress(Runtime1::entry_for(unwind_id)));
 
   // enough room for two byte trap
   __ nop();
--- a/hotspot/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-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
@@ -317,14 +317,6 @@
 }
 
 
-void C1_MacroAssembler::method_exit(bool restore_frame) {
-  if (restore_frame) {
-    leave();
-  }
-  ret(0);
-}
-
-
 void C1_MacroAssembler::build_frame(int frame_size_in_bytes) {
   // Make sure there is enough stack space for this method's activation.
   // Note that we do this before doing an enter(). This matches the
@@ -333,7 +325,7 @@
   // between the two compilers.
   generate_stack_overflow_check(frame_size_in_bytes);
 
-  enter();
+  push(rbp);
 #ifdef TIERED
   // c2 leaves fpu stack dirty. Clean it on entry
   if (UseSSE < 2 ) {
@@ -344,6 +336,12 @@
 }
 
 
+void C1_MacroAssembler::remove_frame(int frame_size_in_bytes) {
+  increment(rsp, frame_size_in_bytes);  // Does not emit code for frame_size == 0
+  pop(rbp);
+}
+
+
 void C1_MacroAssembler::unverified_entry(Register receiver, Register ic_klass) {
   if (C1Breakpoint) int3();
   inline_cache_check(receiver, ic_klass);
--- a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-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
@@ -688,18 +688,21 @@
   int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, exception_handler_for_pc));
   oop_maps->add_gc_map(call_offset, oop_map);
 
-  // rax,: handler address or NULL if no handler exists
+  // rax,: handler address
   //      will be the deopt blob if nmethod was deoptimized while we looked up
   //      handler regardless of whether handler existed in the nmethod.
 
   // only rax, is valid at this time, all other registers have been destroyed by the runtime call
   __ invalidate_registers(false, true, true, true, true, true);
 
+#ifdef ASSERT
   // Do we have an exception handler in the nmethod?
-  Label no_handler;
   Label done;
   __ testptr(rax, rax);
-  __ jcc(Assembler::zero, no_handler);
+  __ jcc(Assembler::notZero, done);
+  __ stop("no handler found");
+  __ bind(done);
+#endif
 
   // exception handler found
   // patch the return address -> the stub will directly return to the exception handler
@@ -712,36 +715,14 @@
   __ leave();
   __ ret(0);
 
-  __ bind(no_handler);
-  // no exception handler found in this method, so the exception is
-  // forwarded to the caller (using the unwind code of the nmethod)
-  // there is no need to restore the registers
-
-  // restore the real return address that was saved before the RT-call
-  __ movptr(real_return_addr, Address(rsp, temp_1_off * VMRegImpl::stack_slot_size));
-  __ movptr(Address(rbp, 1*BytesPerWord), real_return_addr);
-
-  // load address of JavaThread object for thread-local data
-  NOT_LP64(__ get_thread(thread);)
-  // restore exception oop into rax, (convention for unwind code)
-  __ movptr(exception_oop, Address(thread, JavaThread::exception_oop_offset()));
-
-  // clear exception fields in JavaThread because they are no longer needed
-  // (fields must be cleared because they are processed by GC otherwise)
-  __ movptr(Address(thread, JavaThread::exception_oop_offset()), NULL_WORD);
-  __ movptr(Address(thread, JavaThread::exception_pc_offset()), NULL_WORD);
-
-  // pop the stub frame off
-  __ leave();
-
-  generate_unwind_exception(sasm);
-  __ stop("should not reach here");
 }
 
 
 void Runtime1::generate_unwind_exception(StubAssembler *sasm) {
   // incoming parameters
   const Register exception_oop = rax;
+  // callee-saved copy of exception_oop during runtime call
+  const Register exception_oop_callee_saved = NOT_LP64(rsi) LP64_ONLY(r14);
   // other registers used in this stub
   const Register exception_pc = rdx;
   const Register handler_addr = rbx;
@@ -769,38 +750,39 @@
   // clear the FPU stack in case any FPU results are left behind
   __ empty_FPU_stack();
 
-  // leave activation of nmethod
-  __ leave();
-  // store return address (is on top of stack after leave)
+  // save exception_oop in callee-saved register to preserve it during runtime calls
+  __ verify_not_null_oop(exception_oop);
+  __ movptr(exception_oop_callee_saved, exception_oop);
+
+  NOT_LP64(__ get_thread(thread);)
+  // Get return address (is on top of stack after leave).
   __ movptr(exception_pc, Address(rsp, 0));
 
-  __ verify_oop(exception_oop);
-
-  // save exception oop from rax, to stack before call
-  __ push(exception_oop);
+  // search the exception handler address of the caller (using the return address)
+  __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), thread, exception_pc);
+  // rax: exception handler address of the caller
 
-  // search the exception handler address of the caller (using the return address)
-  __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), exception_pc);
-  // rax,: exception handler address of the caller
-
-  // only rax, is valid at this time, all other registers have been destroyed by the call
-  __ invalidate_registers(false, true, true, true, true, true);
+  // Only RAX and RSI are valid at this time, all other registers have been destroyed by the call.
+  __ invalidate_registers(false, true, true, true, false, true);
 
   // move result of call into correct register
   __ movptr(handler_addr, rax);
 
-  // restore exception oop in rax, (required convention of exception handler)
-  __ pop(exception_oop);
+  // Restore exception oop to RAX (required convention of exception handler).
+  __ movptr(exception_oop, exception_oop_callee_saved);
 
-  __ verify_oop(exception_oop);
+  // verify that there is really a valid exception in rax
+  __ verify_not_null_oop(exception_oop);
 
   // get throwing pc (= return address).
   // rdx has been destroyed by the call, so it must be set again
   // the pop is also necessary to simulate the effect of a ret(0)
   __ pop(exception_pc);
 
-  // verify that that there is really a valid exception in rax,
-  __ verify_not_null_oop(exception_oop);
+  // Restore SP from BP if the exception PC is a MethodHandle call site.
+  NOT_LP64(__ get_thread(thread);)
+  __ cmpl(Address(thread, JavaThread::is_method_handle_exception_offset()), 0);
+  __ cmovptr(Assembler::notEqual, rsp, rbp);
 
   // continue at exception handler (return address removed)
   // note: do *not* remove arguments when unwinding the
@@ -808,9 +790,9 @@
   //       all arguments on the stack when entering the
   //       runtime to determine the exception handler
   //       (GC happens at call site with arguments!)
-  // rax,: exception oop
+  // rax: exception oop
   // rdx: throwing pc
-  // rbx,: exception handler
+  // rbx: exception handler
   __ jmp(handler_addr);
 }
 
--- a/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-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
@@ -60,13 +60,13 @@
 }
 
 #ifdef ASSERT
-static void verify_argslot(MacroAssembler* _masm, Register rax_argslot,
+static void verify_argslot(MacroAssembler* _masm, Register argslot_reg,
                            const char* error_message) {
   // Verify that argslot lies within (rsp, rbp].
   Label L_ok, L_bad;
-  __ cmpptr(rax_argslot, rbp);
+  __ cmpptr(argslot_reg, rbp);
   __ jccb(Assembler::above, L_bad);
-  __ cmpptr(rsp, rax_argslot);
+  __ cmpptr(rsp, argslot_reg);
   __ jccb(Assembler::below, L_ok);
   __ bind(L_bad);
   __ stop(error_message);
@@ -178,22 +178,6 @@
 
   // Now move the argslot down, to point to the opened-up space.
   __ lea(rax_argslot, Address(rax_argslot, arg_slots, Address::times_ptr));
-
-  if (TaggedStackInterpreter && arg_mask != _INSERT_NO_MASK) {
-    // The caller has specified a bitmask of tags to put into the opened space.
-    // This only works when the arg_slots value is an assembly-time constant.
-    int constant_arg_slots = arg_slots.as_constant() / stack_move_unit();
-    int tag_offset = Interpreter::tag_offset_in_bytes() - Interpreter::value_offset_in_bytes();
-    for (int slot = 0; slot < constant_arg_slots; slot++) {
-      BasicType slot_type   = ((arg_mask & (1 << slot)) == 0 ? T_OBJECT : T_INT);
-      int       slot_offset = Interpreter::stackElementSize() * slot;
-      Address   tag_addr(rax_argslot, slot_offset + tag_offset);
-      __ movptr(tag_addr, frame::tag_for_basic_type(slot_type));
-    }
-    // Note that the new argument slots are tagged properly but contain
-    // garbage at this point.  The value portions must be initialized
-    // by the caller.  (Especially references!)
-  }
 }
 
 // Helper to remove argument slots from the stack.
@@ -206,18 +190,9 @@
                              (!arg_slots.is_register() ? rsp : arg_slots.as_register()));
 
 #ifdef ASSERT
-  {
-    // Verify that [argslot..argslot+size) lies within (rsp, rbp).
-    Label L_ok, L_bad;
-    __ lea(rbx_temp, Address(rax_argslot, arg_slots, Address::times_ptr));
-    __ cmpptr(rbx_temp, rbp);
-    __ jccb(Assembler::above, L_bad);
-    __ cmpptr(rsp, rax_argslot);
-    __ jccb(Assembler::below, L_ok);
-    __ bind(L_bad);
-    __ stop("deleted argument(s) must fall within current frame");
-    __ bind(L_ok);
-  }
+  // Verify that [argslot..argslot+size) lies within (rsp, rbp).
+  __ lea(rbx_temp, Address(rax_argslot, arg_slots, Address::times_ptr));
+  verify_argslot(_masm, rbx_temp, "deleted argument(s) must fall within current frame");
   if (arg_slots.is_register()) {
     Label L_ok, L_bad;
     __ cmpptr(arg_slots.as_register(), (int32_t) NULL_WORD);
@@ -321,12 +296,6 @@
   Address rcx_amh_conversion( rcx_recv, sun_dyn_AdapterMethodHandle::conversion_offset_in_bytes() );
   Address vmarg;                // __ argument_address(vmargslot)
 
-  int tag_offset = -1;
-  if (TaggedStackInterpreter) {
-    tag_offset = Interpreter::tag_offset_in_bytes() - Interpreter::value_offset_in_bytes();
-    assert(tag_offset = wordSize, "stack grows as expected");
-  }
-
   const int java_mirror_offset = klassOopDesc::klass_part_offset_in_bytes() + Klass::java_mirror_offset_in_bytes();
 
   if (have_entry(ek)) {
@@ -372,11 +341,8 @@
       __ mov(rsp, rsi);   // cut the stack back to where the caller started
 
       // Repush the arguments as if coming from the interpreter.
-      if (TaggedStackInterpreter)  __ push(frame::tag_for_basic_type(T_INT));
       __ push(rdx_code);
-      if (TaggedStackInterpreter)  __ push(frame::tag_for_basic_type(T_OBJECT));
       __ push(rcx_fail);
-      if (TaggedStackInterpreter)  __ push(frame::tag_for_basic_type(T_OBJECT));
       __ push(rax_want);
 
       Register rbx_method = rbx_temp;
@@ -397,7 +363,6 @@
       // Do something that is at least causes a valid throw from the interpreter.
       __ bind(no_method);
       __ pop(rax_want);
-      if (TaggedStackInterpreter)  __ pop(rcx_fail);
       __ pop(rcx_fail);
       __ push(rax_want);
       __ push(rcx_fail);
@@ -510,18 +475,10 @@
   case _bound_long_direct_mh:
     {
       bool direct_to_method = (ek >= _bound_ref_direct_mh);
-      BasicType arg_type = T_ILLEGAL;
-      if (ek == _bound_long_mh || ek == _bound_long_direct_mh) {
-        arg_type = T_LONG;
-      } else if (ek == _bound_int_mh || ek == _bound_int_direct_mh) {
-        arg_type = T_INT;
-      } else {
-        assert(ek == _bound_ref_mh || ek == _bound_ref_direct_mh, "must be ref");
-        arg_type = T_OBJECT;
-      }
-      int arg_slots = type2size[arg_type];
-      int arg_mask  = (arg_type == T_OBJECT ? _INSERT_REF_MASK :
-                       arg_slots == 1       ? _INSERT_INT_MASK :  _INSERT_LONG_MASK);
+      BasicType arg_type  = T_ILLEGAL;
+      int       arg_mask  = _INSERT_NO_MASK;
+      int       arg_slots = -1;
+      get_ek_bound_mh_info(ek, arg_type, arg_mask, arg_slots);
 
       // make room for the new argument:
       __ movl(rax_argslot, rcx_bmh_vmargslot);
@@ -660,13 +617,10 @@
         }
         break;
       default:
-        assert(false, "");
+        ShouldNotReachHere();
       }
-      goto finish_int_conversion;
-    }
 
-  finish_int_conversion:
-    {
+      // Do the requested conversion and store the value.
       Register rbx_vminfo = rbx_temp;
       __ movl(rbx_vminfo, rcx_amh_conversion);
       assert(CONV_VMINFO_SHIFT == 0, "preshifted");
@@ -692,7 +646,7 @@
       __ shrl(rdx_temp /*, rcx*/);
 
       __ bind(done);
-      __ movl(vmarg, rdx_temp);
+      __ movl(vmarg, rdx_temp);  // Store the value.
       __ xchgptr(rcx, rbx_vminfo);                // restore rcx_recv
 
       __ jump_to_method_handle_entry(rcx_recv, rdx_temp);
@@ -715,9 +669,14 @@
       switch (ek) {
       case _adapter_opt_i2l:
         {
+#ifdef _LP64
+          __ movslq(rdx_temp, vmarg1);  // Load sign-extended
+          __ movq(vmarg1, rdx_temp);    // Store into first slot
+#else
           __ movl(rdx_temp, vmarg1);
-          __ sarl(rdx_temp, 31);  // __ extend_sign()
+          __ sarl(rdx_temp, BitsPerInt - 1);  // __ extend_sign()
           __ movl(vmarg2, rdx_temp); // store second word
+#endif
         }
         break;
       case _adapter_opt_unboxl:
@@ -727,14 +686,19 @@
           int value_offset = java_lang_boxing_object::value_offset_in_bytes(T_LONG);
           assert(value_offset == java_lang_boxing_object::value_offset_in_bytes(T_DOUBLE), "");
           __ null_check(rdx_temp, value_offset);
+#ifdef _LP64
+          __ movq(rbx_temp, Address(rdx_temp, value_offset));
+          __ movq(vmarg1, rbx_temp);
+#else
           __ movl(rbx_temp, Address(rdx_temp, value_offset + 0*BytesPerInt));
           __ movl(rdx_temp, Address(rdx_temp, value_offset + 1*BytesPerInt));
           __ movl(vmarg1, rbx_temp);
           __ movl(vmarg2, rdx_temp);
+#endif
         }
         break;
       default:
-        assert(false, "");
+        ShouldNotReachHere();
       }
 
       __ movptr(rcx_recv, rcx_mh_vmtarget);
@@ -768,20 +732,9 @@
       if (ek == _adapter_opt_f2d) {
         __ fld_s(vmarg);        // load float to ST0
         __ fstp_s(vmarg);       // store single
-      } else if (!TaggedStackInterpreter) {
+      } else {
         __ fld_d(vmarg);        // load double to ST0
         __ fstp_s(vmarg);       // store single
-      } else {
-        Address vmarg_tag = vmarg.plus_disp(tag_offset);
-        Address vmarg2    = vmarg.plus_disp(Interpreter::stackElementSize());
-        // vmarg2_tag does not participate in this code
-        Register rbx_tag = rbx_temp;
-        __ movl(rbx_tag, vmarg_tag); // preserve tag
-        __ movl(rdx_temp, vmarg2); // get second word of double
-        __ movl(vmarg_tag, rdx_temp); // align with first word
-        __ fld_d(vmarg);        // load double to ST0
-        __ movl(vmarg_tag, rbx_tag); // restore tag
-        __ fstp_s(vmarg);       // store single
       }
 #endif //_LP64
 
@@ -812,19 +765,8 @@
   case _adapter_opt_rot_2_up:
   case _adapter_opt_rot_2_down:
     {
-      int rotate = 0, swap_slots = 0;
-      switch ((int)ek) {
-      case _adapter_opt_swap_1:     swap_slots = 1; break;
-      case _adapter_opt_swap_2:     swap_slots = 2; break;
-      case _adapter_opt_rot_1_up:   swap_slots = 1; rotate++; break;
-      case _adapter_opt_rot_1_down: swap_slots = 1; rotate--; break;
-      case _adapter_opt_rot_2_up:   swap_slots = 2; rotate++; break;
-      case _adapter_opt_rot_2_down: swap_slots = 2; rotate--; break;
-      default: assert(false, "");
-      }
-
-      // the real size of the move must be doubled if TaggedStackInterpreter:
-      int swap_bytes = (int)( swap_slots * Interpreter::stackElementWords() * wordSize );
+      int swap_bytes = 0, rotate = 0;
+      get_ek_adapter_opt_swap_rot_info(ek, swap_bytes, rotate);
 
       // 'argslot' is the position of the first argument to swap
       __ movl(rax_argslot, rcx_amh_vmargslot);
@@ -925,8 +867,8 @@
 
       // 'stack_move' is negative number of words to duplicate
       Register rdx_stack_move = rdx_temp;
-      __ movl(rdx_stack_move, rcx_amh_conversion);
-      __ sarl(rdx_stack_move, CONV_STACK_MOVE_SHIFT);
+      __ movl2ptr(rdx_stack_move, rcx_amh_conversion);
+      __ sarptr(rdx_stack_move, CONV_STACK_MOVE_SHIFT);
 
       int argslot0_num = 0;
       Address argslot0 = __ argument_address(RegisterOrConstant(argslot0_num));
@@ -988,8 +930,8 @@
 
       // 'stack_move' is number of words to drop
       Register rdi_stack_move = rdi;
-      __ movl(rdi_stack_move, rcx_amh_conversion);
-      __ sarl(rdi_stack_move, CONV_STACK_MOVE_SHIFT);
+      __ movl2ptr(rdi_stack_move, rcx_amh_conversion);
+      __ sarptr(rdi_stack_move, CONV_STACK_MOVE_SHIFT);
       remove_arg_slots(_masm, rdi_stack_move,
                        rax_argslot, rbx_temp, rdx_temp);
 
@@ -1014,11 +956,7 @@
   case _adapter_opt_spread_more:
     {
       // spread an array out into a group of arguments
-      int length_constant = -1;
-      switch (ek) {
-      case _adapter_opt_spread_0: length_constant = 0; break;
-      case _adapter_opt_spread_1: length_constant = 1; break;
-      }
+      int length_constant = get_ek_adapter_opt_spread_info(ek);
 
       // find the address of the array argument
       __ movl(rax_argslot, rcx_amh_vmargslot);
@@ -1079,8 +1017,8 @@
         __ lea(rdx_argslot_limit, Address(rax_argslot, Interpreter::stackElementSize()));
         // 'stack_move' is negative number of words to insert
         Register rdi_stack_move = rdi;
-        __ movl(rdi_stack_move, rcx_amh_conversion);
-        __ sarl(rdi_stack_move, CONV_STACK_MOVE_SHIFT);
+        __ movl2ptr(rdi_stack_move, rcx_amh_conversion);
+        __ sarptr(rdi_stack_move, CONV_STACK_MOVE_SHIFT);
         Register rsi_temp = rsi_array;  // spill this
         insert_arg_slots(_masm, rdi_stack_move, -1,
                          rax_argslot, rbx_temp, rsi_temp);
@@ -1114,10 +1052,6 @@
         __ movptr(rbx_temp, Address(rsi_source, 0));
         __ movptr(Address(rax_argslot, 0), rbx_temp);
         __ addptr(rsi_source, type2aelembytes(elem_type));
-        if (TaggedStackInterpreter) {
-          __ movptr(Address(rax_argslot, tag_offset),
-                    frame::tag_for_basic_type(elem_type));
-        }
         __ addptr(rax_argslot, Interpreter::stackElementSize());
         __ cmpptr(rax_argslot, rdx_argslot_limit);
         __ jccb(Assembler::less, loop);
@@ -1131,11 +1065,7 @@
           __ movptr(rbx_temp, Address(rsi_array, elem_offset));
           __ movptr(Address(rax_argslot, slot_offset), rbx_temp);
           elem_offset += type2aelembytes(elem_type);
-          if (TaggedStackInterpreter) {
-            __ movptr(Address(rax_argslot, slot_offset + tag_offset),
-                      frame::tag_for_basic_type(elem_type));
-          }
-          slot_offset += Interpreter::stackElementSize();
+           slot_offset += Interpreter::stackElementSize();
         }
       }
 
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -369,7 +369,7 @@
   // The pending exception in Thread is converted into a Java-level exception.
   //
   // Contract with Java-level exception handlers:
-  // rax,: exception
+  // rax: exception
   // rdx: throwing pc
   //
   // NOTE: At entry of this stub, exception-pc must be on stack !!
@@ -377,6 +377,12 @@
   address generate_forward_exception() {
     StubCodeMark mark(this, "StubRoutines", "forward exception");
     address start = __ pc();
+    const Register thread = rcx;
+
+    // other registers used in this stub
+    const Register exception_oop = rax;
+    const Register handler_addr  = rbx;
+    const Register exception_pc  = rdx;
 
     // Upon entry, the sp points to the return address returning into Java
     // (interpreted or compiled) code; i.e., the return address becomes the
@@ -389,8 +395,8 @@
 #ifdef ASSERT
     // make sure this code is only executed if there is a pending exception
     { Label L;
-      __ get_thread(rcx);
-      __ cmpptr(Address(rcx, Thread::pending_exception_offset()), (int32_t)NULL_WORD);
+      __ get_thread(thread);
+      __ cmpptr(Address(thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD);
       __ jcc(Assembler::notEqual, L);
       __ stop("StubRoutines::forward exception: no pending exception (1)");
       __ bind(L);
@@ -398,33 +404,40 @@
 #endif
 
     // compute exception handler into rbx,
-    __ movptr(rax, Address(rsp, 0));
+    __ get_thread(thread);
+    __ movptr(exception_pc, Address(rsp, 0));
     BLOCK_COMMENT("call exception_handler_for_return_address");
-    __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), rax);
-    __ mov(rbx, rax);
+    __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), thread, exception_pc);
+    __ mov(handler_addr, rax);
 
-    // setup rax, & rdx, remove return address & clear pending exception
-    __ get_thread(rcx);
-    __ pop(rdx);
-    __ movptr(rax, Address(rcx, Thread::pending_exception_offset()));
-    __ movptr(Address(rcx, Thread::pending_exception_offset()), NULL_WORD);
+    // setup rax & rdx, remove return address & clear pending exception
+    __ get_thread(thread);
+    __ pop(exception_pc);
+    __ movptr(exception_oop, Address(thread, Thread::pending_exception_offset()));
+    __ movptr(Address(thread, Thread::pending_exception_offset()), NULL_WORD);
 
 #ifdef ASSERT
     // make sure exception is set
     { Label L;
-      __ testptr(rax, rax);
+      __ testptr(exception_oop, exception_oop);
       __ jcc(Assembler::notEqual, L);
       __ stop("StubRoutines::forward exception: no pending exception (2)");
       __ bind(L);
     }
 #endif
 
+    // Verify that there is really a valid exception in RAX.
+    __ verify_oop(exception_oop);
+
+    // Restore SP from BP if the exception PC is a MethodHandle call site.
+    __ cmpl(Address(thread, JavaThread::is_method_handle_exception_offset()), 0);
+    __ cmovptr(Assembler::notEqual, rsp, rbp);
+
     // continue at exception handler (return address removed)
-    // rax,: exception
-    // rbx,: exception handler
+    // rax: exception
+    // rbx: exception handler
     // rdx: throwing pc
-    __ verify_oop(rax);
-    __ jmp(rbx);
+    __ jmp(handler_addr);
 
     return start;
   }
@@ -2263,16 +2276,6 @@
     // arraycopy stubs used by compilers
     generate_arraycopy_stubs();
 
-    // generic method handle stubs
-    if (EnableMethodHandles && SystemDictionary::MethodHandle_klass() != NULL) {
-      for (MethodHandles::EntryKind ek = MethodHandles::_EK_FIRST;
-           ek < MethodHandles::_EK_LIMIT;
-           ek = MethodHandles::EntryKind(1 + (int)ek)) {
-        StubCodeMark mark(this, "MethodHandle", MethodHandles::entry_name(ek));
-        MethodHandles::generate_method_handle_stub(_masm, ek);
-      }
-    }
-
     generate_math_stubs();
   }
 
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -466,7 +466,7 @@
     BLOCK_COMMENT("call exception_handler_for_return_address");
     __ call_VM_leaf(CAST_FROM_FN_PTR(address,
                          SharedRuntime::exception_handler_for_return_address),
-                    c_rarg0);
+                    r15_thread, c_rarg0);
     __ mov(rbx, rax);
 
     // setup rax & rdx, remove return address & clear pending exception
@@ -3009,16 +3009,6 @@
     // arraycopy stubs used by compilers
     generate_arraycopy_stubs();
 
-    // generic method handle stubs
-    if (EnableMethodHandles && SystemDictionary::MethodHandle_klass() != NULL) {
-      for (MethodHandles::EntryKind ek = MethodHandles::_EK_FIRST;
-           ek < MethodHandles::_EK_LIMIT;
-           ek = MethodHandles::EntryKind(1 + (int)ek)) {
-        StubCodeMark mark(this, "MethodHandle", MethodHandles::entry_name(ek));
-        MethodHandles::generate_method_handle_stub(_masm, ek);
-      }
-    }
-
     generate_math_stubs();
   }
 
--- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-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
@@ -31,6 +31,11 @@
   code_size2 = 22000            // simply increase if too small (assembler will crash if too small)
 };
 
+// MethodHandles adapters
+enum method_handles_platform_dependent_constants {
+  method_handles_adapters_code_size = 5000
+};
+
 class x86 {
  friend class StubGenerator;
  friend class VMStructs;
--- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-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
@@ -28,12 +28,14 @@
 
 static bool    returns_to_call_stub(address return_pc)   { return return_pc == _call_stub_return_address; }
 
-enum platform_dependent_constants
-{
-  code_size1 =  19000, // simply increase if too small (assembler will
-                      // crash if too small)
-  code_size2 = 22000  // simply increase if too small (assembler will
-                      // crash if too small)
+enum platform_dependent_constants {
+  code_size1 = 19000,          // simply increase if too small (assembler will crash if too small)
+  code_size2 = 22000           // simply increase if too small (assembler will crash if too small)
+};
+
+// MethodHandles adapters
+enum method_handles_platform_dependent_constants {
+  method_handles_adapters_code_size = 13000
 };
 
 class x86 {
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1550,6 +1550,7 @@
 void TemplateInterpreterGenerator::generate_throw_exception() {
   // Entry point in previous activation (i.e., if the caller was interpreted)
   Interpreter::_rethrow_exception_entry = __ pc();
+  const Register thread = rcx;
 
   // Restore sp to interpreter_frame_last_sp even though we are going
   // to empty the expression stack for the exception processing.
@@ -1598,10 +1599,10 @@
   // Set the popframe_processing bit in pending_popframe_condition indicating that we are
   // currently handling popframe, so that call_VMs that may happen later do not trigger new
   // popframe handling cycles.
-  __ get_thread(rcx);
-  __ movl(rdx, Address(rcx, JavaThread::popframe_condition_offset()));
+  __ get_thread(thread);
+  __ movl(rdx, Address(thread, JavaThread::popframe_condition_offset()));
   __ orl(rdx, JavaThread::popframe_processing_bit);
-  __ movl(Address(rcx, JavaThread::popframe_condition_offset()), rdx);
+  __ movl(Address(thread, JavaThread::popframe_condition_offset()), rdx);
 
   {
     // Check to see whether we are returning to a deoptimized frame.
@@ -1629,8 +1630,8 @@
     __ subptr(rdi, rax);
     __ addptr(rdi, wordSize);
     // Save these arguments
-    __ get_thread(rcx);
-    __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::popframe_preserve_args), rcx, rax, rdi);
+    __ get_thread(thread);
+    __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::popframe_preserve_args), thread, rax, rdi);
 
     __ remove_activation(vtos, rdx,
                          /* throw_monitor_exception */ false,
@@ -1638,8 +1639,8 @@
                          /* notify_jvmdi */ false);
 
     // Inform deoptimization that it is responsible for restoring these arguments
-    __ get_thread(rcx);
-    __ movl(Address(rcx, JavaThread::popframe_condition_offset()), JavaThread::popframe_force_deopt_reexecution_bit);
+    __ get_thread(thread);
+    __ movl(Address(thread, JavaThread::popframe_condition_offset()), JavaThread::popframe_force_deopt_reexecution_bit);
 
     // Continue in deoptimization handler
     __ jmp(rdx);
@@ -1665,12 +1666,12 @@
   // expression stack if necessary.
   __ mov(rax, rsp);
   __ movptr(rbx, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize));
-  __ get_thread(rcx);
+  __ get_thread(thread);
   // PC must point into interpreter here
-  __ set_last_Java_frame(rcx, noreg, rbp, __ pc());
-  __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::popframe_move_outgoing_args), rcx, rax, rbx);
-  __ get_thread(rcx);
-  __ reset_last_Java_frame(rcx, true, true);
+  __ set_last_Java_frame(thread, noreg, rbp, __ pc());
+  __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::popframe_move_outgoing_args), thread, rax, rbx);
+  __ get_thread(thread);
+  __ reset_last_Java_frame(thread, true, true);
   // Restore the last_sp and null it out
   __ movptr(rsp, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize));
   __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD);
@@ -1684,8 +1685,8 @@
   }
 
   // Clear the popframe condition flag
-  __ get_thread(rcx);
-  __ movl(Address(rcx, JavaThread::popframe_condition_offset()), JavaThread::popframe_inactive);
+  __ get_thread(thread);
+  __ movl(Address(thread, JavaThread::popframe_condition_offset()), JavaThread::popframe_inactive);
 
   __ dispatch_next(vtos);
   // end of PopFrame support
@@ -1694,27 +1695,27 @@
 
   // preserve exception over this code sequence
   __ pop_ptr(rax);
-  __ get_thread(rcx);
-  __ movptr(Address(rcx, JavaThread::vm_result_offset()), rax);
+  __ get_thread(thread);
+  __ movptr(Address(thread, JavaThread::vm_result_offset()), rax);
   // remove the activation (without doing throws on illegalMonitorExceptions)
   __ remove_activation(vtos, rdx, false, true, false);
   // restore exception
-  __ get_thread(rcx);
-  __ movptr(rax, Address(rcx, JavaThread::vm_result_offset()));
-  __ movptr(Address(rcx, JavaThread::vm_result_offset()), NULL_WORD);
+  __ get_thread(thread);
+  __ movptr(rax, Address(thread, JavaThread::vm_result_offset()));
+  __ movptr(Address(thread, JavaThread::vm_result_offset()), NULL_WORD);
   __ verify_oop(rax);
 
   // Inbetween activations - previous activation type unknown yet
   // compute continuation point - the continuation point expects
   // the following registers set up:
   //
-  // rax,: exception
+  // rax: exception
   // rdx: return address/pc that threw exception
   // rsp: expression stack of caller
-  // rbp,: rbp, of caller
+  // rbp: rbp, of caller
   __ push(rax);                                  // save exception
   __ push(rdx);                                  // save return address
-  __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), rdx);
+  __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), thread, rdx);
   __ mov(rbx, rax);                              // save exception handler
   __ pop(rdx);                                   // restore return address
   __ pop(rax);                                   // restore exception
@@ -1728,6 +1729,7 @@
 //
 address TemplateInterpreterGenerator::generate_earlyret_entry_for(TosState state) {
   address entry = __ pc();
+  const Register thread = rcx;
 
   __ restore_bcp();
   __ restore_locals();
@@ -1735,8 +1737,8 @@
   __ empty_FPU_stack();
   __ load_earlyret_value(state);
 
-  __ get_thread(rcx);
-  __ movptr(rcx, Address(rcx, JavaThread::jvmti_thread_state_offset()));
+  __ get_thread(thread);
+  __ movptr(rcx, Address(thread, JavaThread::jvmti_thread_state_offset()));
   const Address cond_addr(rcx, JvmtiThreadState::earlyret_state_offset());
 
   // Clear the earlyret state
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1741,7 +1741,7 @@
   __ push(rdx);                                  // save return address
   __ super_call_VM_leaf(CAST_FROM_FN_PTR(address,
                           SharedRuntime::exception_handler_for_return_address),
-                        rdx);
+                        r15_thread, rdx);
   __ mov(rbx, rax);                              // save exception handler
   __ pop(rdx);                                   // restore return address
   __ pop(rax);                                   // restore exception
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-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
@@ -2915,12 +2915,8 @@
     __ andl(recv, 0xFF);
     // recv count is 0 based?
     Address recv_addr(rsp, recv, Interpreter::stackElementScale(), -Interpreter::expr_offset_in_bytes(1));
-    if (is_invokedynamic) {
-      __ lea(recv, recv_addr);
-    } else {
-      __ movptr(recv, recv_addr);
-      __ verify_oop(recv);
-    }
+    __ movptr(recv, recv_addr);
+    __ verify_oop(recv);
   }
 
   // do null check if needed
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-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
@@ -2860,12 +2860,8 @@
     __ andl(recv, 0xFF);
     if (TaggedStackInterpreter) __ shll(recv, 1);  // index*2
     Address recv_addr(rsp, recv, Address::times_8, -Interpreter::expr_offset_in_bytes(1));
-    if (is_invokedynamic) {
-      __ lea(recv, recv_addr);
-    } else {
-      __ movptr(recv, recv_addr);
-      __ verify_oop(recv);
-    }
+    __ movptr(recv, recv_addr);
+    __ verify_oop(recv);
   }
 
   // do null check if needed
--- a/hotspot/src/os_cpu/linux_zero/vm/globals_linux_zero.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/os_cpu/linux_zero/vm/globals_linux_zero.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,6 +1,6 @@
 /*
  * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2007, 2008 Red Hat, Inc.
+ * Copyright 2007, 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
@@ -29,11 +29,10 @@
 //
 
 define_pd_global(bool,  DontYieldALot,           false);
+define_pd_global(intx,  ThreadStackSize,         1536);
 #ifdef _LP64
-define_pd_global(intx,  ThreadStackSize,         1536);
 define_pd_global(intx,  VMThreadStackSize,       1024);
 #else
-define_pd_global(intx,  ThreadStackSize,         1024);
 define_pd_global(intx,  VMThreadStackSize,       512);
 #endif // _LP64
 define_pd_global(intx,  SurvivorRatio,           8);
--- a/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-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
@@ -222,11 +222,15 @@
     }
   } else {
     LoadField* lf = x->array()->as_LoadField();
-    if (lf != NULL && lf->field()->is_constant()) {
-      ciObject* c = lf->field()->constant_value().as_object();
-      if (c->is_array()) {
-        ciArray* array = (ciArray*) c;
-        set_constant(array->length());
+    if (lf != NULL) {
+      ciField* field = lf->field();
+      if (field->is_constant() && field->is_static()) {
+        // final static field
+        ciObject* c = field->constant_value().as_object();
+        if (c->is_array()) {
+          ciArray* array = (ciArray*) c;
+          set_constant(array->length());
+        }
       }
     }
   }
--- a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-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
@@ -415,6 +415,28 @@
 };
 
 
+//------------------------------------------------------------------------------
+// DeoptimizeStub
+//
+class DeoptimizeStub : public CodeStub {
+private:
+  CodeEmitInfo* _info;
+
+public:
+  DeoptimizeStub(CodeEmitInfo* info) : _info(new CodeEmitInfo(info)) {}
+
+  virtual void emit_code(LIR_Assembler* e);
+  virtual CodeEmitInfo* info() const           { return _info; }
+  virtual bool is_exception_throw_stub() const { return true; }
+  virtual void visit(LIR_OpVisitState* visitor) {
+    visitor->do_slow_case(_info);
+  }
+#ifndef PRODUCT
+  virtual void print_name(outputStream* out) const { out->print("DeoptimizeStub"); }
+#endif // PRODUCT
+};
+
+
 class SimpleExceptionStub: public CodeStub {
  private:
   LIR_Opr          _obj;
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-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
@@ -1524,18 +1524,14 @@
     code = Bytecodes::_invokespecial;
   }
 
-  if (code == Bytecodes::_invokedynamic) {
-    BAILOUT("invokedynamic NYI"); // FIXME
-    return;
-  }
-
   // NEEDS_CLEANUP
   // I've added the target-is_loaded() test below but I don't really understand
   // how klass->is_loaded() can be true and yet target->is_loaded() is false.
   // this happened while running the JCK invokevirtual tests under doit.  TKR
   ciMethod* cha_monomorphic_target = NULL;
   ciMethod* exact_target = NULL;
-  if (UseCHA && DeoptC1 && klass->is_loaded() && target->is_loaded()) {
+  if (UseCHA && DeoptC1 && klass->is_loaded() && target->is_loaded() &&
+      !target->is_method_handle_invoke()) {
     Value receiver = NULL;
     ciInstanceKlass* receiver_klass = NULL;
     bool type_is_exact = false;
@@ -1681,11 +1677,20 @@
   CHECK_BAILOUT();
 
   // inlining not successful => standard invoke
-  bool is_static = code == Bytecodes::_invokestatic;
+  bool is_loaded = target->is_loaded();
+  bool has_receiver =
+    code == Bytecodes::_invokespecial   ||
+    code == Bytecodes::_invokevirtual   ||
+    code == Bytecodes::_invokeinterface;
+  bool is_invokedynamic = code == Bytecodes::_invokedynamic;
   ValueType* result_type = as_ValueType(target->return_type());
+
+  // We require the debug info to be the "state before" because
+  // invokedynamics may deoptimize.
+  ValueStack* state_before = is_invokedynamic ? state()->copy() : NULL;
+
   Values* args = state()->pop_arguments(target->arg_size_no_receiver());
-  Value recv = is_static ? NULL : apop();
-  bool is_loaded = target->is_loaded();
+  Value recv = has_receiver ? apop() : NULL;
   int vtable_index = methodOopDesc::invalid_vtable_index;
 
 #ifdef SPARC
@@ -1723,7 +1728,7 @@
     profile_call(recv, target_klass);
   }
 
-  Invoke* result = new Invoke(code, result_type, recv, args, vtable_index, target);
+  Invoke* result = new Invoke(code, result_type, recv, args, vtable_index, target, state_before);
   // push result
   append_split(result);
 
@@ -2862,20 +2867,18 @@
   _initial_state = state_at_entry();
   start_block->merge(_initial_state);
 
-  BlockBegin* sync_handler = NULL;
-  if (method()->is_synchronized() || _compilation->env()->dtrace_method_probes()) {
-    // setup an exception handler to do the unlocking and/or notification
-    sync_handler = new BlockBegin(-1);
-    sync_handler->set(BlockBegin::exception_entry_flag);
-    sync_handler->set(BlockBegin::is_on_work_list_flag);
-    sync_handler->set(BlockBegin::default_exception_handler_flag);
-
-    ciExceptionHandler* desc = new ciExceptionHandler(method()->holder(), 0, method()->code_size(), -1, 0);
-    XHandler* h = new XHandler(desc);
-    h->set_entry_block(sync_handler);
-    scope_data()->xhandlers()->append(h);
-    scope_data()->set_has_handler();
-  }
+  // setup an exception handler to do the unlocking and/or
+  // notification and unwind the frame.
+  BlockBegin* sync_handler = new BlockBegin(-1);
+  sync_handler->set(BlockBegin::exception_entry_flag);
+  sync_handler->set(BlockBegin::is_on_work_list_flag);
+  sync_handler->set(BlockBegin::default_exception_handler_flag);
+
+  ciExceptionHandler* desc = new ciExceptionHandler(method()->holder(), 0, method()->code_size(), -1, 0);
+  XHandler* h = new XHandler(desc);
+  h->set_entry_block(sync_handler);
+  scope_data()->xhandlers()->append(h);
+  scope_data()->set_has_handler();
 
   // complete graph
   _vmap        = new ValueMap();
--- a/hotspot/src/share/vm/c1/c1_IR.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_IR.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-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
@@ -259,10 +259,10 @@
 }
 
 
-void CodeEmitInfo::record_debug_info(DebugInformationRecorder* recorder, int pc_offset) {
+void CodeEmitInfo::record_debug_info(DebugInformationRecorder* recorder, int pc_offset, bool is_method_handle_invoke) {
   // record the safepoint before recording the debug info for enclosing scopes
   recorder->add_safepoint(pc_offset, _oop_map->deep_copy());
-  _scope_debug_info->record_debug_info(recorder, pc_offset, true/*topmost*/);
+  _scope_debug_info->record_debug_info(recorder, pc_offset, true/*topmost*/, is_method_handle_invoke);
   recorder->end_safepoint(pc_offset);
 }
 
--- a/hotspot/src/share/vm/c1/c1_IR.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_IR.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-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
@@ -242,7 +242,7 @@
   //Whether we should reexecute this bytecode for deopt
   bool should_reexecute();
 
-  void record_debug_info(DebugInformationRecorder* recorder, int pc_offset, bool topmost) {
+  void record_debug_info(DebugInformationRecorder* recorder, int pc_offset, bool topmost, bool is_method_handle_invoke = false) {
     if (caller() != NULL) {
       // Order is significant:  Must record caller first.
       caller()->record_debug_info(recorder, pc_offset, false/*topmost*/);
@@ -252,7 +252,6 @@
     DebugToken* monvals = recorder->create_monitor_values(monitors());
     // reexecute allowed only for the topmost frame
     bool reexecute = topmost ? should_reexecute() : false;
-    bool is_method_handle_invoke = false;
     bool return_oop = false; // This flag will be ignored since it used only for C2 with escape analysis.
     recorder->describe_scope(pc_offset, scope()->method(), bci(), reexecute, is_method_handle_invoke, return_oop, locvals, expvals, monvals);
   }
@@ -303,7 +302,7 @@
   int bci() const                                { return _bci; }
 
   void add_register_oop(LIR_Opr opr);
-  void record_debug_info(DebugInformationRecorder* recorder, int pc_offset);
+  void record_debug_info(DebugInformationRecorder* recorder, int pc_offset, bool is_method_handle_invoke = false);
 
   CodeEmitInfo* next() const        { return _next; }
   void set_next(CodeEmitInfo* next) { _next = next; }
--- a/hotspot/src/share/vm/c1/c1_Instruction.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_Instruction.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-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
@@ -334,13 +334,14 @@
 
 
 Invoke::Invoke(Bytecodes::Code code, ValueType* result_type, Value recv, Values* args,
-               int vtable_index, ciMethod* target)
+               int vtable_index, ciMethod* target, ValueStack* state_before)
   : StateSplit(result_type)
   , _code(code)
   , _recv(recv)
   , _args(args)
   , _vtable_index(vtable_index)
   , _target(target)
+  , _state_before(state_before)
 {
   set_flag(TargetIsLoadedFlag,   target->is_loaded());
   set_flag(TargetIsFinalFlag,    target_is_loaded() && target->is_final_method());
@@ -355,6 +356,9 @@
   _signature = new BasicTypeList(number_of_arguments() + (has_receiver() ? 1 : 0));
   if (has_receiver()) {
     _signature->append(as_BasicType(receiver()->type()));
+  } else if (is_invokedynamic()) {
+    // Add the synthetic MethodHandle argument to the signature.
+    _signature->append(T_OBJECT);
   }
   for (int i = 0; i < number_of_arguments(); i++) {
     ValueType* t = argument_at(i)->type();
@@ -364,6 +368,13 @@
 }
 
 
+void Invoke::state_values_do(void f(Value*)) {
+  StateSplit::state_values_do(f);
+  if (state_before() != NULL) state_before()->values_do(f);
+  if (state()        != NULL) state()->values_do(f);
+}
+
+
 // Implementation of Contant
 intx Constant::hash() const {
   if (_state == NULL) {
--- a/hotspot/src/share/vm/c1/c1_Instruction.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_Instruction.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-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
@@ -1134,17 +1134,18 @@
 
 LEAF(Invoke, StateSplit)
  private:
-  Bytecodes::Code           _code;
-  Value                     _recv;
-  Values*                   _args;
-  BasicTypeList*            _signature;
-  int                       _vtable_index;
-  ciMethod*                 _target;
+  Bytecodes::Code _code;
+  Value           _recv;
+  Values*         _args;
+  BasicTypeList*  _signature;
+  int             _vtable_index;
+  ciMethod*       _target;
+  ValueStack*     _state_before;  // Required for deoptimization.
 
  public:
   // creation
   Invoke(Bytecodes::Code code, ValueType* result_type, Value recv, Values* args,
-         int vtable_index, ciMethod* target);
+         int vtable_index, ciMethod* target, ValueStack* state_before);
 
   // accessors
   Bytecodes::Code code() const                   { return _code; }
@@ -1155,6 +1156,7 @@
   int vtable_index() const                       { return _vtable_index; }
   BasicTypeList* signature() const               { return _signature; }
   ciMethod* target() const                       { return _target; }
+  ValueStack* state_before() const               { return _state_before; }
 
   // Returns false if target is not loaded
   bool target_is_final() const                   { return check_flag(TargetIsFinalFlag); }
@@ -1162,6 +1164,9 @@
   // Returns false if target is not loaded
   bool target_is_strictfp() const                { return check_flag(TargetIsStrictfpFlag); }
 
+  // JSR 292 support
+  bool is_invokedynamic() const                  { return code() == Bytecodes::_invokedynamic; }
+
   // generic
   virtual bool can_trap() const                  { return true; }
   virtual void input_values_do(void f(Value*)) {
@@ -1169,6 +1174,7 @@
     if (has_receiver()) f(&_recv);
     for (int i = 0; i < _args->length(); i++) f(_args->adr_at(i));
   }
+  virtual void state_values_do(void f(Value*));
 };
 
 
--- a/hotspot/src/share/vm/c1/c1_LIR.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIR.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-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
@@ -76,7 +76,7 @@
       return LIR_OprFact::oopConst(type->as_ObjectType()->encoding());
     }
   }
-  case addressTag: return LIR_OprFact::intConst(type->as_AddressConstant()->value());
+  case addressTag: return LIR_OprFact::addressConst(type->as_AddressConstant()->value());
   case intTag    : return LIR_OprFact::intConst(type->as_IntConstant()->value());
   case floatTag  : return LIR_OprFact::floatConst(type->as_FloatConstant()->value());
   case longTag   : return LIR_OprFact::longConst(type->as_LongConstant()->value());
@@ -89,7 +89,7 @@
 LIR_Opr LIR_OprFact::dummy_value_type(ValueType* type) {
   switch (type->tag()) {
     case objectTag: return LIR_OprFact::oopConst(NULL);
-    case addressTag:
+    case addressTag:return LIR_OprFact::addressConst(0);
     case intTag:    return LIR_OprFact::intConst(0);
     case floatTag:  return LIR_OprFact::floatConst(0.0);
     case longTag:   return LIR_OprFact::longConst(0);
@@ -689,9 +689,10 @@
     case lir_static_call:
     case lir_optvirtual_call:
     case lir_icvirtual_call:
-    case lir_virtual_call: {
-      assert(op->as_OpJavaCall() != NULL, "must be");
-      LIR_OpJavaCall* opJavaCall = (LIR_OpJavaCall*)op;
+    case lir_virtual_call:
+    case lir_dynamic_call: {
+      LIR_OpJavaCall* opJavaCall = op->as_OpJavaCall();
+      assert(opJavaCall != NULL, "must be");
 
       if (opJavaCall->_receiver->is_valid())     do_input(opJavaCall->_receiver);
 
@@ -704,6 +705,7 @@
       }
 
       if (opJavaCall->_info)                     do_info(opJavaCall->_info);
+      if (opJavaCall->is_method_handle_invoke()) do_temp(FrameMap::method_handle_invoke_SP_save_opr());
       do_call();
       if (opJavaCall->_result->is_valid())       do_output(opJavaCall->_result);
 
@@ -1410,6 +1412,7 @@
 // LIR_Address
 void LIR_Const::print_value_on(outputStream* out) const {
   switch (type()) {
+    case T_ADDRESS:out->print("address:%d",as_jint());          break;
     case T_INT:    out->print("int:%d",   as_jint());           break;
     case T_LONG:   out->print("lng:%lld", as_jlong());          break;
     case T_FLOAT:  out->print("flt:%f",   as_jfloat());         break;
@@ -1590,6 +1593,7 @@
      case lir_optvirtual_call:       s = "optvirtual";    break;
      case lir_icvirtual_call:        s = "icvirtual";     break;
      case lir_virtual_call:          s = "virtual";       break;
+     case lir_dynamic_call:          s = "dynamic";       break;
      // LIR_OpArrayCopy
      case lir_arraycopy:             s = "arraycopy";     break;
      // LIR_OpLock
--- a/hotspot/src/share/vm/c1/c1_LIR.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIR.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -85,9 +85,10 @@
 
   void type_check(BasicType t) const   { assert(type() == t, "type check"); }
   void type_check(BasicType t1, BasicType t2) const   { assert(type() == t1 || type() == t2, "type check"); }
+  void type_check(BasicType t1, BasicType t2, BasicType t3) const   { assert(type() == t1 || type() == t2 || type() == t3, "type check"); }
 
  public:
-  LIR_Const(jint i)                              { _value.set_type(T_INT);     _value.set_jint(i); }
+  LIR_Const(jint i, bool is_address=false)       { _value.set_type(is_address?T_ADDRESS:T_INT); _value.set_jint(i); }
   LIR_Const(jlong l)                             { _value.set_type(T_LONG);    _value.set_jlong(l); }
   LIR_Const(jfloat f)                            { _value.set_type(T_FLOAT);   _value.set_jfloat(f); }
   LIR_Const(jdouble d)                           { _value.set_type(T_DOUBLE);  _value.set_jdouble(d); }
@@ -105,7 +106,7 @@
   virtual BasicType type()       const { return _value.get_type(); }
   virtual LIR_Const* as_constant()     { return this; }
 
-  jint      as_jint()    const         { type_check(T_INT   ); return _value.get_jint(); }
+  jint      as_jint()    const         { type_check(T_INT, T_ADDRESS); return _value.get_jint(); }
   jlong     as_jlong()   const         { type_check(T_LONG  ); return _value.get_jlong(); }
   jfloat    as_jfloat()  const         { type_check(T_FLOAT ); return _value.get_jfloat(); }
   jdouble   as_jdouble() const         { type_check(T_DOUBLE); return _value.get_jdouble(); }
@@ -120,7 +121,7 @@
 #endif
 
 
-  jint      as_jint_bits() const       { type_check(T_FLOAT, T_INT); return _value.get_jint(); }
+  jint      as_jint_bits() const       { type_check(T_FLOAT, T_INT, T_ADDRESS); return _value.get_jint(); }
   jint      as_jint_lo_bits() const    {
     if (type() == T_DOUBLE) {
       return low(jlong_cast(_value.get_jdouble()));
@@ -718,6 +719,7 @@
   static LIR_Opr intptrConst(void* p)            { return (LIR_Opr)(new LIR_Const(p)); }
   static LIR_Opr intptrConst(intptr_t v)         { return (LIR_Opr)(new LIR_Const((void*)v)); }
   static LIR_Opr illegal()                       { return (LIR_Opr)-1; }
+  static LIR_Opr addressConst(jint i)            { return (LIR_Opr)(new LIR_Const(i, true)); }
 
   static LIR_Opr value_type(ValueType* type);
   static LIR_Opr dummy_value_type(ValueType* type);
@@ -840,6 +842,7 @@
       , lir_optvirtual_call
       , lir_icvirtual_call
       , lir_virtual_call
+      , lir_dynamic_call
   , end_opJavaCall
   , begin_opArrayCopy
       , lir_arraycopy
@@ -1052,6 +1055,16 @@
   LIR_Opr receiver() const                       { return _receiver; }
   ciMethod* method() const                       { return _method;   }
 
+  // JSR 292 support.
+  bool is_invokedynamic() const                  { return code() == lir_dynamic_call; }
+  bool is_method_handle_invoke() const {
+    return
+      is_invokedynamic()  // An invokedynamic is always a MethodHandle call site.
+      ||
+      (method()->holder()->name() == ciSymbol::java_dyn_MethodHandle() &&
+       method()->name()           == ciSymbol::invoke_name());
+  }
+
   intptr_t vtable_offset() const {
     assert(_code == lir_virtual_call, "only have vtable for real vcall");
     return (intptr_t) addr();
@@ -1766,6 +1779,10 @@
                     intptr_t vtable_offset, LIR_OprList* arguments, CodeEmitInfo* info) {
     append(new LIR_OpJavaCall(lir_virtual_call, method, receiver, result, vtable_offset, arguments, info));
   }
+  void call_dynamic(ciMethod* method, LIR_Opr receiver, LIR_Opr result,
+                    address dest, LIR_OprList* arguments, CodeEmitInfo* info) {
+    append(new LIR_OpJavaCall(lir_dynamic_call, method, receiver, result, dest, arguments, info));
+  }
 
   void get_thread(LIR_Opr result)                { append(new LIR_Op0(lir_get_thread, result)); }
   void word_align()                              { append(new LIR_Op0(lir_word_align)); }
--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-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
@@ -301,9 +301,9 @@
 }
 
 
-void LIR_Assembler::add_call_info(int pc_offset, CodeEmitInfo* cinfo) {
+void LIR_Assembler::add_call_info(int pc_offset, CodeEmitInfo* cinfo, bool is_method_handle_invoke) {
   flush_debug_info(pc_offset);
-  cinfo->record_debug_info(compilation()->debug_info_recorder(), pc_offset);
+  cinfo->record_debug_info(compilation()->debug_info_recorder(), pc_offset, is_method_handle_invoke);
   if (cinfo->exception_handlers() != NULL) {
     compilation()->add_exception_handlers_for_pco(pc_offset, cinfo->exception_handlers());
   }
@@ -413,6 +413,12 @@
 void LIR_Assembler::emit_call(LIR_OpJavaCall* op) {
   verify_oop_map(op->info());
 
+  // JSR 292
+  // Preserve the SP over MethodHandle call sites.
+  if (op->is_method_handle_invoke()) {
+    preserve_SP(op);
+  }
+
   if (os::is_MP()) {
     // must align calls sites, otherwise they can't be updated atomically on MP hardware
     align_call(op->code());
@@ -423,19 +429,25 @@
 
   switch (op->code()) {
   case lir_static_call:
-    call(op->addr(), relocInfo::static_call_type, op->info());
+    call(op, relocInfo::static_call_type);
     break;
   case lir_optvirtual_call:
-    call(op->addr(), relocInfo::opt_virtual_call_type, op->info());
+  case lir_dynamic_call:
+    call(op, relocInfo::opt_virtual_call_type);
     break;
   case lir_icvirtual_call:
-    ic_call(op->addr(), op->info());
+    ic_call(op);
     break;
   case lir_virtual_call:
-    vtable_call(op->vtable_offset(), op->info());
+    vtable_call(op);
     break;
   default: ShouldNotReachHere();
   }
+
+  if (op->is_method_handle_invoke()) {
+    restore_SP(op);
+  }
+
 #if defined(X86) && defined(TIERED)
   // C2 leave fpu stack dirty clean it
   if (UseSSE < 2) {
--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -82,7 +82,7 @@
   Address as_Address_hi(LIR_Address* addr);
 
   // debug information
-  void add_call_info(int pc_offset, CodeEmitInfo* cinfo);
+  void add_call_info(int pc_offset, CodeEmitInfo* cinfo, bool is_method_handle_invoke = false);
   void add_debug_info_for_branch(CodeEmitInfo* info);
   void add_debug_info_for_div0(int pc_offset, CodeEmitInfo* cinfo);
   void add_debug_info_for_div0_here(CodeEmitInfo* info);
@@ -205,9 +205,13 @@
   void comp_fl2i(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr result, LIR_Op2* op);
   void cmove(LIR_Condition code, LIR_Opr left, LIR_Opr right, LIR_Opr result);
 
-  void ic_call(address destination, CodeEmitInfo* info);
-  void vtable_call(int vtable_offset, CodeEmitInfo* info);
-  void call(address entry, relocInfo::relocType rtype, CodeEmitInfo* info);
+  void call(        LIR_OpJavaCall* op, relocInfo::relocType rtype);
+  void ic_call(     LIR_OpJavaCall* op);
+  void vtable_call( LIR_OpJavaCall* op);
+
+  // JSR 292
+  void preserve_SP(LIR_OpJavaCall* op);
+  void restore_SP( LIR_OpJavaCall* op);
 
   void osr_entry();
 
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -2284,7 +2284,7 @@
 
 
 void LIRGenerator::invoke_load_arguments(Invoke* x, LIRItemList* args, const LIR_OprList* arg_list) {
-  int i = x->has_receiver() ? 1 : 0;
+  int i = (x->has_receiver() || x->is_invokedynamic()) ? 1 : 0;
   for (; i < args->length(); i++) {
     LIRItem* param = args->at(i);
     LIR_Opr loc = arg_list->at(i);
@@ -2322,6 +2322,10 @@
     LIRItem* receiver = new LIRItem(x->receiver(), this);
     argument_items->append(receiver);
   }
+  if (x->is_invokedynamic()) {
+    // Insert a dummy for the synthetic MethodHandle argument.
+    argument_items->append(NULL);
+  }
   int idx = x->has_receiver() ? 1 : 0;
   for (int i = 0; i < x->number_of_arguments(); i++) {
     LIRItem* param = new LIRItem(x->argument_at(i), this);
@@ -2371,6 +2375,9 @@
 
   CodeEmitInfo* info = state_for(x, x->state());
 
+  // invokedynamics can deoptimize.
+  CodeEmitInfo* deopt_info = x->is_invokedynamic() ? state_for(x, x->state_before()) : NULL;
+
   invoke_load_arguments(x, args, arg_list);
 
   if (x->has_receiver()) {
@@ -2407,6 +2414,47 @@
         __ call_virtual(x->target(), receiver, result_register, vtable_offset, arg_list, info);
       }
       break;
+    case Bytecodes::_invokedynamic: {
+      ciBytecodeStream bcs(x->scope()->method());
+      bcs.force_bci(x->bci());
+      assert(bcs.cur_bc() == Bytecodes::_invokedynamic, "wrong stream");
+      ciCPCache* cpcache = bcs.get_cpcache();
+
+      // Get CallSite offset from constant pool cache pointer.
+      int index = bcs.get_method_index();
+      size_t call_site_offset = cpcache->get_f1_offset(index);
+
+      // If this invokedynamic call site hasn't been executed yet in
+      // the interpreter, the CallSite object in the constant pool
+      // cache is still null and we need to deoptimize.
+      if (cpcache->is_f1_null_at(index)) {
+        // Cannot re-use same xhandlers for multiple CodeEmitInfos, so
+        // clone all handlers.  This is handled transparently in other
+        // places by the CodeEmitInfo cloning logic but is handled
+        // specially here because a stub isn't being used.
+        x->set_exception_handlers(new XHandlers(x->exception_handlers()));
+
+        DeoptimizeStub* deopt_stub = new DeoptimizeStub(deopt_info);
+        __ jump(deopt_stub);
+      }
+
+      // Use the receiver register for the synthetic MethodHandle
+      // argument.
+      receiver = LIR_Assembler::receiverOpr();
+      LIR_Opr tmp = new_register(objectType);
+
+      // Load CallSite object from constant pool cache.
+      __ oop2reg(cpcache->constant_encoding(), tmp);
+      __ load(new LIR_Address(tmp, call_site_offset, T_OBJECT), tmp);
+
+      // Load target MethodHandle from CallSite object.
+      __ load(new LIR_Address(tmp, java_dyn_CallSite::target_offset_in_bytes(), T_OBJECT), receiver);
+
+      __ call_dynamic(x->target(), receiver, result_register,
+                      SharedRuntime::get_resolve_opt_virtual_call_stub(),
+                      arg_list, info);
+      break;
+    }
     default:
       ShouldNotReachHere();
       break;
--- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -2479,6 +2479,15 @@
       return 2;
     }
 
+    case T_ADDRESS: {
+#ifdef _LP64
+      scope_values->append(new ConstantLongValue(c->as_jint()));
+#else
+      scope_values->append(new ConstantIntValue(c->as_jint()));
+#endif
+      return 1;
+    }
+
     default:
       ShouldNotReachHere();
       return -1;
--- a/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-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
@@ -34,7 +34,7 @@
 
   void inline_cache_check(Register receiver, Register iCache);
   void build_frame(int frame_size_in_bytes);
-  void method_exit(bool restore_frame);
+  void remove_frame(int frame_size_in_bytes);
 
   void unverified_entry(Register receiver, Register ic_klass);
   void verified_entry();
--- a/hotspot/src/share/vm/ci/ciCPCache.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/ci/ciCPCache.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2009-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
@@ -41,6 +41,16 @@
 
 
 // ------------------------------------------------------------------
+// ciCPCache::is_f1_null_at
+bool ciCPCache::is_f1_null_at(int index) {
+  VM_ENTRY_MARK;
+  constantPoolCacheOop cpcache = (constantPoolCacheOop) get_oop();
+  oop f1 = cpcache->secondary_entry_at(index)->f1();
+  return (f1 == NULL);
+}
+
+
+// ------------------------------------------------------------------
 // ciCPCache::print
 //
 // Print debugging information about the cache.
--- a/hotspot/src/share/vm/ci/ciCPCache.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/ci/ciCPCache.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2009-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
@@ -39,5 +39,7 @@
   // requested entry.
   size_t get_f1_offset(int index);
 
+  bool is_f1_null_at(int index);
+
   void print();
 };
--- a/hotspot/src/share/vm/code/codeBlob.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/code/codeBlob.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-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
@@ -249,7 +249,6 @@
   size += round_to(buffer_size, oopSize);
   assert(name != NULL, "must provide a name");
   {
-
     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     blob = new (size) BufferBlob(name, size);
   }
@@ -271,7 +270,6 @@
   unsigned int size = allocation_size(cb, sizeof(BufferBlob));
   assert(name != NULL, "must provide a name");
   {
-
     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     blob = new (size) BufferBlob(name, size, cb);
   }
@@ -298,10 +296,48 @@
   MemoryService::track_code_cache_memory_usage();
 }
 
-bool BufferBlob::is_adapter_blob() const {
-  return (strcmp(AdapterHandlerEntry::name, name()) == 0);
+
+//----------------------------------------------------------------------------------------------------
+// Implementation of AdapterBlob
+
+AdapterBlob* AdapterBlob::create(CodeBuffer* cb) {
+  ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
+
+  AdapterBlob* blob = NULL;
+  unsigned int size = allocation_size(cb, sizeof(AdapterBlob));
+  {
+    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    blob = new (size) AdapterBlob(size, cb);
+  }
+  // Track memory usage statistic after releasing CodeCache_lock
+  MemoryService::track_code_cache_memory_usage();
+
+  return blob;
 }
 
+
+//----------------------------------------------------------------------------------------------------
+// Implementation of MethodHandlesAdapterBlob
+
+MethodHandlesAdapterBlob* MethodHandlesAdapterBlob::create(int buffer_size) {
+  ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
+
+  MethodHandlesAdapterBlob* blob = NULL;
+  unsigned int size = sizeof(MethodHandlesAdapterBlob);
+  // align the size to CodeEntryAlignment
+  size = align_code_offset(size);
+  size += round_to(buffer_size, oopSize);
+  {
+    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    blob = new (size) MethodHandlesAdapterBlob(size);
+  }
+  // Track memory usage statistic after releasing CodeCache_lock
+  MemoryService::track_code_cache_memory_usage();
+
+  return blob;
+}
+
+
 //----------------------------------------------------------------------------------------------------
 // Implementation of RuntimeStub
 
--- a/hotspot/src/share/vm/code/codeBlob.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/code/codeBlob.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-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
@@ -90,14 +90,15 @@
   void flush();
 
   // Typing
-  virtual bool is_buffer_blob() const            { return false; }
-  virtual bool is_nmethod() const                { return false; }
-  virtual bool is_runtime_stub() const           { return false; }
-  virtual bool is_deoptimization_stub() const    { return false; }
-  virtual bool is_uncommon_trap_stub() const     { return false; }
-  virtual bool is_exception_stub() const         { return false; }
-  virtual bool is_safepoint_stub() const         { return false; }
-  virtual bool is_adapter_blob() const           { return false; }
+  virtual bool is_buffer_blob() const                 { return false; }
+  virtual bool is_nmethod() const                     { return false; }
+  virtual bool is_runtime_stub() const                { return false; }
+  virtual bool is_deoptimization_stub() const         { return false; }
+  virtual bool is_uncommon_trap_stub() const          { return false; }
+  virtual bool is_exception_stub() const              { return false; }
+  virtual bool is_safepoint_stub() const              { return false; }
+  virtual bool is_adapter_blob() const                { return false; }
+  virtual bool is_method_handles_adapter_blob() const { return false; }
 
   virtual bool is_compiled_by_c2() const         { return false; }
   virtual bool is_compiled_by_c1() const         { return false; }
@@ -221,6 +222,9 @@
 
 class BufferBlob: public CodeBlob {
   friend class VMStructs;
+  friend class AdapterBlob;
+  friend class MethodHandlesAdapterBlob;
+
  private:
   // Creation support
   BufferBlob(const char* name, int size);
@@ -236,8 +240,7 @@
   static void free(BufferBlob* buf);
 
   // Typing
-  bool is_buffer_blob() const                    { return true; }
-  bool is_adapter_blob() const;
+  virtual bool is_buffer_blob() const            { return true; }
 
   // GC/Verification support
   void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f)  { /* nothing to do */ }
@@ -255,6 +258,40 @@
 
 
 //----------------------------------------------------------------------------------------------------
+// AdapterBlob: used to hold C2I/I2C adapters
+
+class AdapterBlob: public BufferBlob {
+private:
+  AdapterBlob(int size)                 : BufferBlob("I2C/C2I adapters", size) {}
+  AdapterBlob(int size, CodeBuffer* cb) : BufferBlob("I2C/C2I adapters", size, cb) {}
+
+public:
+  // Creation
+  static AdapterBlob* create(CodeBuffer* cb);
+
+  // Typing
+  virtual bool is_adapter_blob() const { return true; }
+};
+
+
+//----------------------------------------------------------------------------------------------------
+// MethodHandlesAdapterBlob: used to hold MethodHandles adapters
+
+class MethodHandlesAdapterBlob: public BufferBlob {
+private:
+  MethodHandlesAdapterBlob(int size)                 : BufferBlob("MethodHandles adapters", size) {}
+  MethodHandlesAdapterBlob(int size, CodeBuffer* cb) : BufferBlob("MethodHandles adapters", size, cb) {}
+
+public:
+  // Creation
+  static MethodHandlesAdapterBlob* create(int buffer_size);
+
+  // Typing
+  virtual bool is_method_handles_adapter_blob() const { return true; }
+};
+
+
+//----------------------------------------------------------------------------------------------------
 // RuntimeStub: describes stubs used by compiled code to call a (static) C++ runtime routine
 
 class RuntimeStub: public CodeBlob {
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -988,10 +988,12 @@
     }
     if (method->is_not_compilable(comp_level)) return NULL;
 
-    nmethod* saved = CodeCache::find_and_remove_saved_code(method());
-    if (saved != NULL) {
-      method->set_code(method, saved);
-      return saved;
+    if (UseCodeCacheFlushing) {
+      nmethod* saved = CodeCache::find_and_remove_saved_code(method());
+      if (saved != NULL) {
+        method->set_code(method, saved);
+        return saved;
+      }
     }
 
   } else {
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -3704,7 +3704,14 @@
         // enough to point to the next possible object header (the
         // bitmap knows by how much we need to move it as it knows its
         // granularity).
-        move_finger_to(_nextMarkBitMap->nextWord(_finger));
+        assert(_finger < _region_limit, "invariant");
+        HeapWord* new_finger = _nextMarkBitMap->nextWord(_finger);
+        // Check if bitmap iteration was aborted while scanning the last object
+        if (new_finger >= _region_limit) {
+            giveup_current_region();
+        } else {
+            move_finger_to(new_finger);
+        }
       }
     }
     // At this point we have either completed iterating over the
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -24,8 +24,8 @@
 
 class G1CollectedHeap;
 class CMTask;
-typedef GenericTaskQueue<oop> CMTaskQueue;
-typedef GenericTaskQueueSet<oop> CMTaskQueueSet;
+typedef GenericTaskQueue<oop>            CMTaskQueue;
+typedef GenericTaskQueueSet<CMTaskQueue> CMTaskQueueSet;
 
 // A generic CM bit map.  This is essentially a wrapper around the BitMap
 // class, with one bit per (1<<_shifter) HeapWords.
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -2102,18 +2102,21 @@
 size_t G1CollectedHeap::unsafe_max_tlab_alloc(Thread* ignored) const {
   // Return the remaining space in the cur alloc region, but not less than
   // the min TLAB size.
-  // Also, no more than half the region size, since we can't allow tlabs to
-  // grow big enough to accomodate humongous objects.
-
-  // We need to story it locally, since it might change between when we
-  // test for NULL and when we use it later.
+
+  // Also, this value can be at most the humongous object threshold,
+  // since we can't allow tlabs to grow big enough to accomodate
+  // humongous objects.
+
+  // We need to store the cur alloc region locally, since it might change
+  // between when we test for NULL and when we use it later.
   ContiguousSpace* cur_alloc_space = _cur_alloc_region;
+  size_t max_tlab_size = _humongous_object_threshold_in_words * wordSize;
+
   if (cur_alloc_space == NULL) {
-    return HeapRegion::GrainBytes/2;
+    return max_tlab_size;
   } else {
-    return MAX2(MIN2(cur_alloc_space->free(),
-                     (size_t)(HeapRegion::GrainBytes/2)),
-                (size_t)MinTLABSize);
+    return MIN2(MAX2(cur_alloc_space->free(), (size_t)MinTLABSize),
+                max_tlab_size);
   }
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -56,8 +56,8 @@
 #  define IF_G1_DETAILED_STATS(code)
 #endif
 
-typedef GenericTaskQueue<StarTask>    RefToScanQueue;
-typedef GenericTaskQueueSet<StarTask> RefToScanQueueSet;
+typedef GenericTaskQueue<StarTask>          RefToScanQueue;
+typedef GenericTaskQueueSet<RefToScanQueue> RefToScanQueueSet;
 
 typedef int RegionIdx_t;   // needs to hold [ 0..max_regions() )
 typedef int CardIdx_t;     // needs to hold [ 0..CardsPerRegion )
@@ -1055,7 +1055,12 @@
 
   // Returns "true" iff the given word_size is "very large".
   static bool isHumongous(size_t word_size) {
-    return word_size >= _humongous_object_threshold_in_words;
+    // Note this has to be strictly greater-than as the TLABs
+    // are capped at the humongous thresold and we want to
+    // ensure that we don't try to allocate a TLAB as
+    // humongous and that we don't allocate a humongous
+    // object in a TLAB.
+    return word_size > _humongous_object_threshold_in_words;
   }
 
   // Update mod union table with the set of dirty cards.
--- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -101,6 +101,8 @@
 
   GenMarkSweep::_marking_stack =
     new (ResourceObj::C_HEAP) GrowableArray<oop>(4000, true);
+  GenMarkSweep::_objarray_stack =
+    new (ResourceObj::C_HEAP) GrowableArray<ObjArrayTask>(50, true);
 
   int size = SystemDictionary::number_of_classes() * 2;
   GenMarkSweep::_revisit_klass_stack =
--- a/hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge	Fri Mar 26 11:10:26 2010 -0400
@@ -175,6 +175,7 @@
 psAdaptiveSizePolicy.hpp		adaptiveSizePolicy.hpp
 
 psCompactionManager.cpp                 gcTaskManager.hpp
+psCompactionManager.cpp                 objArrayKlass.inline.hpp
 psCompactionManager.cpp                 objectStartArray.hpp
 psCompactionManager.cpp                 oop.hpp
 psCompactionManager.cpp                 oop.inline.hpp
@@ -189,6 +190,9 @@
 psCompactionManager.hpp                 allocation.hpp
 psCompactionManager.hpp                 taskqueue.hpp
 
+psCompactionManager.inline.hpp		psCompactionManager.hpp
+psCompactionManager.inline.hpp		psParallelCompact.hpp
+
 psGCAdaptivePolicyCounters.hpp		gcAdaptivePolicyCounters.hpp
 psGCAdaptivePolicyCounters.hpp          gcPolicyCounters.hpp
 psGCAdaptivePolicyCounters.hpp          psAdaptiveSizePolicy.hpp
@@ -379,12 +383,12 @@
 pcTasks.cpp                             jniHandles.hpp
 pcTasks.cpp                             jvmtiExport.hpp
 pcTasks.cpp                             management.hpp
+pcTasks.cpp                             objArrayKlass.inline.hpp
 pcTasks.cpp                             psParallelCompact.hpp
 pcTasks.cpp                             pcTasks.hpp
 pcTasks.cpp                             oop.inline.hpp
 pcTasks.cpp                             oop.pcgc.inline.hpp
 pcTasks.cpp                             systemDictionary.hpp
-pcTasks.cpp                             taskqueue.hpp
 pcTasks.cpp                             thread.hpp
 pcTasks.cpp                             universe.hpp
 pcTasks.cpp                             vmThread.hpp
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -48,7 +48,7 @@
     _vm_thread->oops_do(&mark_and_push_closure, &mark_and_push_in_blobs);
 
   // Do the real work
-  cm->drain_marking_stacks(&mark_and_push_closure);
+  cm->follow_marking_stacks();
 }
 
 
@@ -118,7 +118,7 @@
   }
 
   // Do the real work
-  cm->drain_marking_stacks(&mark_and_push_closure);
+  cm->follow_marking_stacks();
   // cm->deallocate_stacks();
 }
 
@@ -196,17 +196,19 @@
   PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm);
 
   oop obj = NULL;
+  ObjArrayTask task;
   int random_seed = 17;
-  while(true) {
-    if (ParCompactionManager::steal(which, &random_seed, obj)) {
+  do {
+    while (ParCompactionManager::steal_objarray(which, &random_seed, task)) {
+      objArrayKlass* const k = (objArrayKlass*)task.obj()->blueprint();
+      k->oop_follow_contents(cm, task.obj(), task.index());
+      cm->follow_marking_stacks();
+    }
+    while (ParCompactionManager::steal(which, &random_seed, obj)) {
       obj->follow_contents(cm);
-      cm->drain_marking_stacks(&mark_and_push_closure);
-    } else {
-      if (terminator()->offer_termination()) {
-        break;
-      }
+      cm->follow_marking_stacks();
     }
-  }
+  } while (!terminator()->offer_termination());
 }
 
 //
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -28,6 +28,8 @@
 PSOldGen*            ParCompactionManager::_old_gen = NULL;
 ParCompactionManager**  ParCompactionManager::_manager_array = NULL;
 OopTaskQueueSet*     ParCompactionManager::_stack_array = NULL;
+ParCompactionManager::ObjArrayTaskQueueSet*
+  ParCompactionManager::_objarray_queues = NULL;
 ObjectStartArray*    ParCompactionManager::_start_array = NULL;
 ParMarkBitMap*       ParCompactionManager::_mark_bitmap = NULL;
 RegionTaskQueueSet*   ParCompactionManager::_region_array = NULL;
@@ -46,6 +48,11 @@
 
   // We want the overflow stack to be permanent
   _overflow_stack = new (ResourceObj::C_HEAP) GrowableArray<oop>(10, true);
+
+  _objarray_queue.initialize();
+  _objarray_overflow_stack =
+    new (ResourceObj::C_HEAP) ObjArrayOverflowStack(10, true);
+
 #ifdef USE_RegionTaskQueueWithOverflow
   region_stack()->initialize();
 #else
@@ -69,6 +76,7 @@
 
 ParCompactionManager::~ParCompactionManager() {
   delete _overflow_stack;
+  delete _objarray_overflow_stack;
   delete _revisit_klass_stack;
   delete _revisit_mdo_stack;
   // _manager_array and _stack_array are statics
@@ -86,18 +94,21 @@
 
   assert(_manager_array == NULL, "Attempt to initialize twice");
   _manager_array = NEW_C_HEAP_ARRAY(ParCompactionManager*, parallel_gc_threads+1 );
-  guarantee(_manager_array != NULL, "Could not initialize promotion manager");
+  guarantee(_manager_array != NULL, "Could not allocate manager_array");
 
   _stack_array = new OopTaskQueueSet(parallel_gc_threads);
-  guarantee(_stack_array != NULL, "Count not initialize promotion manager");
+  guarantee(_stack_array != NULL, "Could not allocate stack_array");
+  _objarray_queues = new ObjArrayTaskQueueSet(parallel_gc_threads);
+  guarantee(_objarray_queues != NULL, "Could not allocate objarray_queues");
   _region_array = new RegionTaskQueueSet(parallel_gc_threads);
-  guarantee(_region_array != NULL, "Count not initialize promotion manager");
+  guarantee(_region_array != NULL, "Could not allocate region_array");
 
   // Create and register the ParCompactionManager(s) for the worker threads.
   for(uint i=0; i<parallel_gc_threads; i++) {
     _manager_array[i] = new ParCompactionManager();
     guarantee(_manager_array[i] != NULL, "Could not create ParCompactionManager");
     stack_array()->register_queue(i, _manager_array[i]->marking_stack());
+    _objarray_queues->register_queue(i, &_manager_array[i]->_objarray_queue);
 #ifdef USE_RegionTaskQueueWithOverflow
     region_array()->register_queue(i, _manager_array[i]->region_stack()->task_queue());
 #else
@@ -203,36 +214,30 @@
   }
 }
 
-void ParCompactionManager::drain_marking_stacks(OopClosure* blk) {
-#ifdef ASSERT
-  ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
-  assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
-  MutableSpace* to_space = heap->young_gen()->to_space();
-  MutableSpace* old_space = heap->old_gen()->object_space();
-  MutableSpace* perm_space = heap->perm_gen()->object_space();
-#endif /* ASSERT */
-
-
+void ParCompactionManager::follow_marking_stacks() {
   do {
-
-    // Drain overflow stack first, so other threads can steal from
-    // claimed stack while we work.
-    while(!overflow_stack()->is_empty()) {
-      oop obj = overflow_stack()->pop();
+    // Drain the overflow stack first, to allow stealing from the marking stack.
+    oop obj;
+    while (!overflow_stack()->is_empty()) {
+      overflow_stack()->pop()->follow_contents(this);
+    }
+    while (marking_stack()->pop_local(obj)) {
       obj->follow_contents(this);
     }
 
-    oop obj;
-    // obj is a reference!!!
-    while (marking_stack()->pop_local(obj)) {
-      // It would be nice to assert about the type of objects we might
-      // pop, but they can come from anywhere, unfortunately.
-      obj->follow_contents(this);
+    // Process ObjArrays one at a time to avoid marking stack bloat.
+    ObjArrayTask task;
+    if (!_objarray_overflow_stack->is_empty()) {
+      task = _objarray_overflow_stack->pop();
+      objArrayKlass* const k = (objArrayKlass*)task.obj()->blueprint();
+      k->oop_follow_contents(this, task.obj(), task.index());
+    } else if (_objarray_queue.pop_local(task)) {
+      objArrayKlass* const k = (objArrayKlass*)task.obj()->blueprint();
+      k->oop_follow_contents(this, task.obj(), task.index());
     }
-  } while((marking_stack()->size() != 0) || (overflow_stack()->length() != 0));
+  } while (!marking_stacks_empty());
 
-  assert(marking_stack()->size() == 0, "Sanity");
-  assert(overflow_stack()->length() == 0, "Sanity");
+  assert(marking_stacks_empty(), "Sanity");
 }
 
 void ParCompactionManager::drain_region_overflow_stack() {
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -22,18 +22,6 @@
  *
  */
 
-//
-// psPromotionManager is used by a single thread to manage object survival
-// during a scavenge. The promotion manager contains thread local data only.
-//
-// NOTE! Be carefull when allocating the stacks on cheap. If you are going
-// to use a promotion manager in more than one thread, the stacks MUST be
-// on cheap. This can lead to memory leaks, though, as they are not auto
-// deallocated.
-//
-// FIX ME FIX ME Add a destructor, and don't rely on the user to drain/flush/deallocate!
-//
-
 // Move to some global location
 #define HAS_BEEN_MOVED 0x1501d01d
 // End move to some global location
@@ -46,8 +34,6 @@
 class ParallelCompactData;
 class ParMarkBitMap;
 
-// Move to it's own file if this works out.
-
 class ParCompactionManager : public CHeapObj {
   friend class ParallelTaskTerminator;
   friend class ParMarkBitMap;
@@ -72,14 +58,27 @@
 // ------------------------  End don't putback if not needed
 
  private:
+  // 32-bit:  4K * 8 = 32KiB; 64-bit:  8K * 16 = 128KiB
+  #define OBJARRAY_QUEUE_SIZE (1 << NOT_LP64(12) LP64_ONLY(13))
+  typedef GenericTaskQueue<ObjArrayTask, OBJARRAY_QUEUE_SIZE> ObjArrayTaskQueue;
+  typedef GenericTaskQueueSet<ObjArrayTaskQueue> ObjArrayTaskQueueSet;
+  #undef OBJARRAY_QUEUE_SIZE
+
   static ParCompactionManager** _manager_array;
   static OopTaskQueueSet*       _stack_array;
+  static ObjArrayTaskQueueSet*  _objarray_queues;
   static ObjectStartArray*      _start_array;
   static RegionTaskQueueSet*    _region_array;
   static PSOldGen*              _old_gen;
 
+private:
   OopTaskQueue                  _marking_stack;
   GrowableArray<oop>*           _overflow_stack;
+
+  typedef GrowableArray<ObjArrayTask> ObjArrayOverflowStack;
+  ObjArrayTaskQueue             _objarray_queue;
+  ObjArrayOverflowStack*        _objarray_overflow_stack;
+
   // Is there a way to reuse the _marking_stack for the
   // saving empty regions?  For now just create a different
   // type of TaskQueue.
@@ -128,8 +127,8 @@
   // Pushes onto the region stack.  If the region stack is full,
   // pushes onto the region overflow stack.
   void region_stack_push(size_t region_index);
- public:
 
+public:
   Action action() { return _action; }
   void set_action(Action v) { _action = v; }
 
@@ -163,6 +162,8 @@
   // Get a oop for scanning.  If returns null, no oop were found.
   oop retrieve_for_scanning();
 
+  inline void push_objarray(oop obj, size_t index);
+
   // Save region for later processing.  Must not fail.
   void save_for_processing(size_t region_index);
   // Get a region for processing.  If returns null, no region were found.
@@ -175,12 +176,17 @@
     return stack_array()->steal(queue_num, seed, t);
   }
 
+  static bool steal_objarray(int queue_num, int* seed, ObjArrayTask& t) {
+    return _objarray_queues->steal(queue_num, seed, t);
+  }
+
   static bool steal(int queue_num, int* seed, RegionTask& t) {
     return region_array()->steal(queue_num, seed, t);
   }
 
-  // Process tasks remaining on any stack
-  void drain_marking_stacks(OopClosure *blk);
+  // Process tasks remaining on any marking stack
+  void follow_marking_stacks();
+  inline bool marking_stacks_empty() const;
 
   // Process tasks remaining on any stack
   void drain_region_stacks();
@@ -200,3 +206,8 @@
     "out of range manager_array access");
   return _manager_array[index];
 }
+
+bool ParCompactionManager::marking_stacks_empty() const {
+  return _marking_stack.size() == 0 && _overflow_stack->is_empty() &&
+    _objarray_queue.size() == 0 && _objarray_overflow_stack->is_empty();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ *
+ */
+
+void ParCompactionManager::push_objarray(oop obj, size_t index)
+{
+  ObjArrayTask task(obj, index);
+  assert(task.is_valid(), "bad ObjArrayTask");
+  if (!_objarray_queue.push(task)) {
+    _objarray_overflow_stack->push(task);
+  }
+}
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -479,6 +479,7 @@
   _preserved_oop_stack = NULL;
 
   _marking_stack = new (ResourceObj::C_HEAP) GrowableArray<oop>(4000, true);
+  _objarray_stack = new (ResourceObj::C_HEAP) GrowableArray<ObjArrayTask>(50, true);
 
   int size = SystemDictionary::number_of_classes() * 2;
   _revisit_klass_stack = new (ResourceObj::C_HEAP) GrowableArray<Klass*>(size, true);
@@ -497,6 +498,7 @@
   }
 
   delete _marking_stack;
+  delete _objarray_stack;
   delete _revisit_klass_stack;
   delete _revisit_mdo_stack;
 }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -785,7 +785,7 @@
 void PSParallelCompact::AdjustPointerClosure::do_oop(oop* p)       { adjust_pointer(p, _is_root); }
 void PSParallelCompact::AdjustPointerClosure::do_oop(narrowOop* p) { adjust_pointer(p, _is_root); }
 
-void PSParallelCompact::FollowStackClosure::do_void() { follow_stack(_compaction_manager); }
+void PSParallelCompact::FollowStackClosure::do_void() { _compaction_manager->follow_marking_stacks(); }
 
 void PSParallelCompact::MarkAndPushClosure::do_oop(oop* p)       { mark_and_push(_compaction_manager, p); }
 void PSParallelCompact::MarkAndPushClosure::do_oop(narrowOop* p) { mark_and_push(_compaction_manager, p); }
@@ -2376,7 +2376,7 @@
   // Follow code cache roots.
   CodeCache::do_unloading(is_alive_closure(), &mark_and_push_closure,
                           purged_class);
-  follow_stack(cm); // Flush marking stack.
+  cm->follow_marking_stacks(); // Flush marking stack.
 
   // Update subklass/sibling/implementor links of live klasses
   // revisit_klass_stack is used in follow_weak_klass_links().
@@ -2389,8 +2389,7 @@
   SymbolTable::unlink(is_alive_closure());
   StringTable::unlink(is_alive_closure());
 
-  assert(cm->marking_stack()->size() == 0, "stack should be empty by now");
-  assert(cm->overflow_stack()->is_empty(), "stack should be empty by now");
+  assert(cm->marking_stacks_empty(), "marking stacks should be empty");
 }
 
 // This should be moved to the shared markSweep code!
@@ -2709,22 +2708,6 @@
   young_gen->move_and_update(cm);
 }
 
-
-void PSParallelCompact::follow_stack(ParCompactionManager* cm) {
-  while(!cm->overflow_stack()->is_empty()) {
-    oop obj = cm->overflow_stack()->pop();
-    obj->follow_contents(cm);
-  }
-
-  oop obj;
-  // obj is a reference!!!
-  while (cm->marking_stack()->pop_local(obj)) {
-    // It would be nice to assert about the type of objects we might
-    // pop, but they can come from anywhere, unfortunately.
-    obj->follow_contents(cm);
-  }
-}
-
 void
 PSParallelCompact::follow_weak_klass_links() {
   // All klasses on the revisit stack are marked at this point.
@@ -2745,7 +2728,7 @@
         &keep_alive_closure);
     }
     // revisit_klass_stack is cleared in reset()
-    follow_stack(cm);
+    cm->follow_marking_stacks();
   }
 }
 
@@ -2776,7 +2759,7 @@
       rms->at(j)->follow_weak_refs(is_alive_closure());
     }
     // revisit_mdo_stack is cleared in reset()
-    follow_stack(cm);
+    cm->follow_marking_stacks();
   }
 }
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -901,7 +901,6 @@
   // Mark live objects
   static void marking_phase(ParCompactionManager* cm,
                             bool maximum_heap_compaction);
-  static void follow_stack(ParCompactionManager* cm);
   static void follow_weak_klass_links();
   static void follow_mdo_weak_refs();
 
@@ -1276,7 +1275,7 @@
       }
     }
   }
-  follow_stack(cm);
+  cm->follow_marking_stacks();
 }
 
 template <class T>
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -25,8 +25,9 @@
 #include "incls/_precompiled.incl"
 #include "incls/_markSweep.cpp.incl"
 
-GrowableArray<oop>*     MarkSweep::_marking_stack       = NULL;
-GrowableArray<Klass*>*  MarkSweep::_revisit_klass_stack = NULL;
+GrowableArray<oop>*          MarkSweep::_marking_stack = NULL;
+GrowableArray<ObjArrayTask>* MarkSweep::_objarray_stack = NULL;
+GrowableArray<Klass*>*       MarkSweep::_revisit_klass_stack = NULL;
 GrowableArray<DataLayout*>*  MarkSweep::_revisit_mdo_stack = NULL;
 
 GrowableArray<oop>*     MarkSweep::_preserved_oop_stack = NULL;
@@ -104,11 +105,19 @@
 void MarkSweep::MarkAndPushClosure::do_oop(narrowOop* p) { mark_and_push(p); }
 
 void MarkSweep::follow_stack() {
-  while (!_marking_stack->is_empty()) {
-    oop obj = _marking_stack->pop();
-    assert (obj->is_gc_marked(), "p must be marked");
-    obj->follow_contents();
-  }
+  do {
+    while (!_marking_stack->is_empty()) {
+      oop obj = _marking_stack->pop();
+      assert (obj->is_gc_marked(), "p must be marked");
+      obj->follow_contents();
+    }
+    // Process ObjArrays one at a time to avoid marking stack bloat.
+    if (!_objarray_stack->is_empty()) {
+      ObjArrayTask task = _objarray_stack->pop();
+      objArrayKlass* const k = (objArrayKlass*)task.obj()->blueprint();
+      k->oop_follow_contents(task.obj(), task.index());
+    }
+  } while (!_marking_stack->is_empty() || !_objarray_stack->is_empty());
 }
 
 MarkSweep::FollowStackClosure MarkSweep::follow_stack_closure;
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -110,8 +110,9 @@
   // Vars
   //
  protected:
-  // Traversal stack used during phase1
+  // Traversal stacks used during phase1
   static GrowableArray<oop>*             _marking_stack;
+  static GrowableArray<ObjArrayTask>*    _objarray_stack;
   // Stack for live klasses to revisit at end of marking phase
   static GrowableArray<Klass*>*          _revisit_klass_stack;
   // Set (stack) of MDO's to revisit at end of marking phase
@@ -188,6 +189,7 @@
   template <class T> static inline void mark_and_follow(T* p);
   // Check mark and maybe push on marking stack
   template <class T> static inline void mark_and_push(T* p);
+  static inline void push_objarray(oop obj, size_t index);
 
   static void follow_stack();   // Empty marking stack.
 
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -77,6 +77,12 @@
   }
 }
 
+void MarkSweep::push_objarray(oop obj, size_t index) {
+  ObjArrayTask task(obj, index);
+  assert(task.is_valid(), "bad ObjArrayTask");
+  _objarray_stack->push(task);
+}
+
 template <class T> inline void MarkSweep::adjust_pointer(T* p, bool isroot) {
   T heap_oop = oopDesc::load_heap_oop(p);
   if (!oopDesc::is_null(heap_oop)) {
--- a/hotspot/src/share/vm/includeDB_compiler1	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/includeDB_compiler1	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 //
-// Copyright 1999-2009 Sun Microsystems, Inc.  All Rights Reserved.
+// Copyright 1999-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
@@ -246,6 +246,7 @@
 c1_LIRGenerator.cpp                     c1_LIRGenerator.hpp
 c1_LIRGenerator.cpp                     c1_ValueStack.hpp
 c1_LIRGenerator.cpp                     ciArrayKlass.hpp
+c1_LIRGenerator.cpp                     ciCPCache.hpp
 c1_LIRGenerator.cpp                     ciInstance.hpp
 c1_LIRGenerator.cpp                     heapRegion.hpp
 c1_LIRGenerator.cpp                     sharedRuntime.hpp
--- a/hotspot/src/share/vm/includeDB_core	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/includeDB_core	Fri Mar 26 11:10:26 2010 -0400
@@ -541,6 +541,7 @@
 
 ciCPCache.cpp                           cpCacheOop.hpp
 ciCPCache.cpp                           ciCPCache.hpp
+ciCPCache.cpp                           ciUtilities.hpp
 
 ciCPCache.hpp                           ciClassList.hpp
 ciCPCache.hpp                           ciObject.hpp
@@ -2016,6 +2017,7 @@
 init.cpp                                icBuffer.hpp
 init.cpp                                icache.hpp
 init.cpp                                init.hpp
+init.cpp                                methodHandles.hpp
 init.cpp                                safepoint.hpp
 init.cpp                                sharedRuntime.hpp
 init.cpp                                universe.hpp
@@ -2726,8 +2728,10 @@
 
 markSweep.cpp                           compileBroker.hpp
 markSweep.cpp                           methodDataOop.hpp
+markSweep.cpp				objArrayKlass.inline.hpp
 
 markSweep.hpp                           collectedHeap.hpp
+markSweep.hpp				taskqueue.hpp
 
 memRegion.cpp                           globals.hpp
 memRegion.cpp                           memRegion.hpp
@@ -2872,6 +2876,7 @@
 methodHandles.cpp                       oopFactory.hpp
 methodHandles.cpp                       reflection.hpp
 methodHandles.cpp                       signature.hpp
+methodHandles.cpp                       stubRoutines.hpp
 methodHandles.cpp                       symbolTable.hpp
 
 methodHandles_<arch>.cpp                allocation.inline.hpp
@@ -3056,8 +3061,10 @@
 objArrayKlass.cpp                       genOopClosures.inline.hpp
 objArrayKlass.cpp                       handles.inline.hpp
 objArrayKlass.cpp                       instanceKlass.hpp
+objArrayKlass.cpp                       markSweep.inline.hpp
 objArrayKlass.cpp                       mutexLocker.hpp
 objArrayKlass.cpp                       objArrayKlass.hpp
+objArrayKlass.cpp                       objArrayKlass.inline.hpp
 objArrayKlass.cpp                       objArrayKlassKlass.hpp
 objArrayKlass.cpp                       objArrayOop.hpp
 objArrayKlass.cpp                       oop.inline.hpp
@@ -3068,11 +3075,12 @@
 objArrayKlass.cpp                       universe.inline.hpp
 objArrayKlass.cpp                       vmSymbols.hpp
 
-
 objArrayKlass.hpp                       arrayKlass.hpp
 objArrayKlass.hpp                       instanceKlass.hpp
 objArrayKlass.hpp                       specialized_oop_closures.hpp
 
+objArrayKlass.inline.hpp		objArrayKlass.hpp
+
 objArrayKlassKlass.cpp                  collectedHeap.inline.hpp
 objArrayKlassKlass.cpp                  instanceKlass.hpp
 objArrayKlassKlass.cpp                  javaClasses.hpp
@@ -4098,6 +4106,7 @@
 task.hpp                                top.hpp
 
 taskqueue.cpp                           debug.hpp
+taskqueue.cpp				oop.inline.hpp
 taskqueue.cpp                           os.hpp
 taskqueue.cpp                           taskqueue.hpp
 taskqueue.cpp                           thread_<os_family>.inline.hpp
--- a/hotspot/src/share/vm/includeDB_gc_parallel	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/includeDB_gc_parallel	Fri Mar 26 11:10:26 2010 -0400
@@ -115,10 +115,14 @@
 objArrayKlass.cpp                       g1CollectedHeap.inline.hpp
 objArrayKlass.cpp                       g1OopClosures.inline.hpp
 objArrayKlass.cpp                       oop.pcgc.inline.hpp
+objArrayKlass.cpp                       psCompactionManager.hpp
 objArrayKlass.cpp                       psPromotionManager.inline.hpp
 objArrayKlass.cpp                       psScavenge.inline.hpp
 objArrayKlass.cpp                       parOopClosures.inline.hpp
 
+objArrayKlass.inline.hpp		psCompactionManager.inline.hpp
+objArrayKlass.inline.hpp		psParallelCompact.hpp
+
 oop.pcgc.inline.hpp                     parNewGeneration.hpp
 oop.pcgc.inline.hpp                     parallelScavengeHeap.hpp
 oop.pcgc.inline.hpp                     psCompactionManager.hpp
--- a/hotspot/src/share/vm/memory/genMarkSweep.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -159,6 +159,7 @@
   _preserved_oop_stack = NULL;
 
   _marking_stack       = new (ResourceObj::C_HEAP) GrowableArray<oop>(4000, true);
+  _objarray_stack      = new (ResourceObj::C_HEAP) GrowableArray<ObjArrayTask>(50, true);
 
   int size = SystemDictionary::number_of_classes() * 2;
   _revisit_klass_stack = new (ResourceObj::C_HEAP) GrowableArray<Klass*>(size, true);
@@ -194,7 +195,6 @@
 
 
 void GenMarkSweep::deallocate_stacks() {
-
   if (!UseG1GC) {
     GenCollectedHeap* gch = GenCollectedHeap::heap();
     gch->release_scratch();
@@ -208,6 +208,7 @@
   }
 
   delete _marking_stack;
+  delete _objarray_stack;
   delete _revisit_klass_stack;
   delete _revisit_mdo_stack;
 
--- a/hotspot/src/share/vm/memory/genOopClosures.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/memory/genOopClosures.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -28,10 +28,10 @@
 class CardTableModRefBS;
 class DefNewGeneration;
 
-template<class E> class GenericTaskQueue;
-typedef GenericTaskQueue<oop> OopTaskQueue;
-template<class E> class GenericTaskQueueSet;
-typedef GenericTaskQueueSet<oop> OopTaskQueueSet;
+template<class E, unsigned int N> class GenericTaskQueue;
+typedef GenericTaskQueue<oop, TASKQUEUE_SIZE> OopTaskQueue;
+template<class T> class GenericTaskQueueSet;
+typedef GenericTaskQueueSet<OopTaskQueue> OopTaskQueueSet;
 
 // Closure for iterating roots from a particular generation
 // Note: all classes deriving from this MUST call this do_barrier
--- a/hotspot/src/share/vm/oops/objArrayKlass.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -314,24 +314,24 @@
 
 void objArrayKlass::oop_follow_contents(oop obj) {
   assert (obj->is_array(), "obj must be array");
-  objArrayOop a = objArrayOop(obj);
-  a->follow_header();
-  ObjArrayKlass_OOP_ITERATE( \
-    a, p, \
-    /* we call mark_and_follow here to avoid excessive marking stack usage */ \
-    MarkSweep::mark_and_follow(p))
+  objArrayOop(obj)->follow_header();
+  if (UseCompressedOops) {
+    objarray_follow_contents<narrowOop>(obj, 0);
+  } else {
+    objarray_follow_contents<oop>(obj, 0);
+  }
 }
 
 #ifndef SERIALGC
 void objArrayKlass::oop_follow_contents(ParCompactionManager* cm,
                                         oop obj) {
-  assert (obj->is_array(), "obj must be array");
-  objArrayOop a = objArrayOop(obj);
-  a->follow_header(cm);
-  ObjArrayKlass_OOP_ITERATE( \
-    a, p, \
-    /* we call mark_and_follow here to avoid excessive marking stack usage */ \
-    PSParallelCompact::mark_and_follow(cm, p))
+  assert(obj->is_array(), "obj must be array");
+  objArrayOop(obj)->follow_header(cm);
+  if (UseCompressedOops) {
+    objarray_follow_contents<narrowOop>(cm, obj, 0);
+  } else {
+    objarray_follow_contents<oop>(cm, obj, 0);
+  }
 }
 #endif // SERIALGC
 
--- a/hotspot/src/share/vm/oops/objArrayKlass.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/oops/objArrayKlass.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -91,10 +91,18 @@
 
   // Garbage collection
   void oop_follow_contents(oop obj);
+  inline void oop_follow_contents(oop obj, int index);
+  template <class T> inline void objarray_follow_contents(oop obj, int index);
+
   int  oop_adjust_pointers(oop obj);
 
   // Parallel Scavenge and Parallel Old
   PARALLEL_GC_DECLS
+#ifndef SERIALGC
+  inline void oop_follow_contents(ParCompactionManager* cm, oop obj, int index);
+  template <class T> inline void
+    objarray_follow_contents(ParCompactionManager* cm, oop obj, int index);
+#endif // !SERIALGC
 
   // Iterators
   int oop_oop_iterate(oop obj, OopClosure* blk) {
@@ -131,5 +139,4 @@
   void oop_verify_on(oop obj, outputStream* st);
   void oop_verify_old_oop(oop obj, oop* p, bool allow_dirty);
   void oop_verify_old_oop(oop obj, narrowOop* p, bool allow_dirty);
-
 };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ *
+ */
+
+void objArrayKlass::oop_follow_contents(oop obj, int index) {
+  if (UseCompressedOops) {
+    objarray_follow_contents<narrowOop>(obj, index);
+  } else {
+    objarray_follow_contents<oop>(obj, index);
+  }
+}
+
+template <class T>
+void objArrayKlass::objarray_follow_contents(oop obj, int index) {
+  objArrayOop a = objArrayOop(obj);
+  const size_t len = size_t(a->length());
+  const size_t beg_index = size_t(index);
+  assert(beg_index < len || len == 0, "index too large");
+
+  const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
+  const size_t end_index = beg_index + stride;
+  T* const base = (T*)a->base();
+  T* const beg = base + beg_index;
+  T* const end = base + end_index;
+
+  // Push the non-NULL elements of the next stride on the marking stack.
+  for (T* e = beg; e < end; e++) {
+    MarkSweep::mark_and_push<T>(e);
+  }
+
+  if (end_index < len) {
+    MarkSweep::push_objarray(a, end_index); // Push the continuation.
+  }
+}
+
+#ifndef SERIALGC
+void objArrayKlass::oop_follow_contents(ParCompactionManager* cm, oop obj,
+                                        int index) {
+  if (UseCompressedOops) {
+    objarray_follow_contents<narrowOop>(cm, obj, index);
+  } else {
+    objarray_follow_contents<oop>(cm, obj, index);
+  }
+}
+
+template <class T>
+void objArrayKlass::objarray_follow_contents(ParCompactionManager* cm, oop obj,
+                                             int index) {
+  objArrayOop a = objArrayOop(obj);
+  const size_t len = size_t(a->length());
+  const size_t beg_index = size_t(index);
+  assert(beg_index < len || len == 0, "index too large");
+
+  const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
+  const size_t end_index = beg_index + stride;
+  T* const base = (T*)a->base();
+  T* const beg = base + beg_index;
+  T* const end = base + end_index;
+
+  // Push the non-NULL elements of the next stride on the marking stack.
+  for (T* e = beg; e < end; e++) {
+    PSParallelCompact::mark_and_push<T>(cm, e);
+  }
+
+  if (end_index < len) {
+    cm->push_objarray(a, end_index); // Push the continuation.
+  }
+}
+#endif // #ifndef SERIALGC
--- a/hotspot/src/share/vm/opto/loopTransform.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-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
@@ -2088,29 +2088,41 @@
 BoolNode* PhaseIdealLoop::rc_predicate(Node* ctrl,
                                        int scale, Node* offset,
                                        Node* init, Node* limit, Node* stride,
-                                       Node* range) {
+                                       Node* range, bool upper) {
+  DEBUG_ONLY(ttyLocker ttyl);
+  if (TraceLoopPredicate) tty->print("rc_predicate ");
+
   Node* max_idx_expr  = init;
   int stride_con = stride->get_int();
-  if ((stride_con > 0) == (scale > 0)) {
+  if ((stride_con > 0) == (scale > 0) == upper) {
     max_idx_expr = new (C, 3) SubINode(limit, stride);
     register_new_node(max_idx_expr, ctrl);
+    if (TraceLoopPredicate) tty->print("(limit - stride) ");
+  } else {
+    if (TraceLoopPredicate) tty->print("init ");
   }
 
   if (scale != 1) {
     ConNode* con_scale = _igvn.intcon(scale);
     max_idx_expr = new (C, 3) MulINode(max_idx_expr, con_scale);
     register_new_node(max_idx_expr, ctrl);
+    if (TraceLoopPredicate) tty->print("* %d ", scale);
   }
 
   if (offset && (!offset->is_Con() || offset->get_int() != 0)){
     max_idx_expr = new (C, 3) AddINode(max_idx_expr, offset);
     register_new_node(max_idx_expr, ctrl);
+    if (TraceLoopPredicate)
+      if (offset->is_Con()) tty->print("+ %d ", offset->get_int());
+      else tty->print("+ offset ");
   }
 
   CmpUNode* cmp = new (C, 3) CmpUNode(max_idx_expr, range);
   register_new_node(cmp, ctrl);
   BoolNode* bol = new (C, 2) BoolNode(cmp, BoolTest::lt);
   register_new_node(bol, ctrl);
+
+  if (TraceLoopPredicate) tty->print_cr("<u range");
   return bol;
 }
 
@@ -2187,7 +2199,6 @@
   while (if_proj_list.size() > 0) {
     // Following are changed to nonnull when a predicate can be hoisted
     ProjNode* new_predicate_proj = NULL;
-    BoolNode* new_predicate_bol   = NULL;
 
     ProjNode* proj = if_proj_list.pop()->as_Proj();
     IfNode*   iff  = proj->in(0)->as_If();
@@ -2218,93 +2229,120 @@
       // Invariant test
       new_predicate_proj = create_new_if_for_predicate(predicate_proj);
       Node* ctrl = new_predicate_proj->in(0)->as_If()->in(0);
-      new_predicate_bol  = invar.clone(bol, ctrl)->as_Bool();
-      if (TraceLoopPredicate) tty->print("invariant");
+      BoolNode* new_predicate_bol = invar.clone(bol, ctrl)->as_Bool();
+
+      // Negate test if necessary
+      bool negated = false;
+      if (proj->_con != predicate_proj->_con) {
+        new_predicate_bol = new (C, 2) BoolNode(new_predicate_bol->in(1), new_predicate_bol->_test.negate());
+        register_new_node(new_predicate_bol, ctrl);
+        negated = true;
+      }
+      IfNode* new_predicate_iff = new_predicate_proj->in(0)->as_If();
+      _igvn.hash_delete(new_predicate_iff);
+      new_predicate_iff->set_req(1, new_predicate_bol);
+      if (TraceLoopPredicate) tty->print_cr("invariant if%s: %d", negated ? " negated" : "", new_predicate_iff->_idx);
+
     } else if (cl != NULL && loop->is_range_check_if(iff, this, invar)) {
-      // Range check (only for counted loops)
-      new_predicate_proj = create_new_if_for_predicate(predicate_proj);
-      Node *ctrl = new_predicate_proj->in(0)->as_If()->in(0);
+      assert(proj->_con == predicate_proj->_con, "must match");
+
+      // Range check for counted loops
       const Node*    cmp    = bol->in(1)->as_Cmp();
       Node*          idx    = cmp->in(1);
       assert(!invar.is_invariant(idx), "index is variant");
       assert(cmp->in(2)->Opcode() == Op_LoadRange, "must be");
-      LoadRangeNode* ld_rng = (LoadRangeNode*)cmp->in(2); // LoadRangeNode
+      Node* ld_rng = cmp->in(2); // LoadRangeNode
       assert(invar.is_invariant(ld_rng), "load range must be invariant");
-      ld_rng = (LoadRangeNode*)invar.clone(ld_rng, ctrl);
       int scale    = 1;
       Node* offset = zero;
       bool ok = is_scaled_iv_plus_offset(idx, cl->phi(), &scale, &offset);
       assert(ok, "must be index expression");
+
+      Node* init    = cl->init_trip();
+      Node* limit   = cl->limit();
+      Node* stride  = cl->stride();
+
+      // Build if's for the upper and lower bound tests.  The
+      // lower_bound test will dominate the upper bound test and all
+      // cloned or created nodes will use the lower bound test as
+      // their declared control.
+      ProjNode* lower_bound_proj = create_new_if_for_predicate(predicate_proj);
+      ProjNode* upper_bound_proj = create_new_if_for_predicate(predicate_proj);
+      assert(upper_bound_proj->in(0)->as_If()->in(0) == lower_bound_proj, "should dominate");
+      Node *ctrl = lower_bound_proj->in(0)->as_If()->in(0);
+
+      // Perform cloning to keep Invariance state correct since the
+      // late schedule will place invariant things in the loop.
+      ld_rng = invar.clone(ld_rng, ctrl);
       if (offset && offset != zero) {
         assert(invar.is_invariant(offset), "offset must be loop invariant");
         offset = invar.clone(offset, ctrl);
       }
-      Node* init    = cl->init_trip();
-      Node* limit   = cl->limit();
-      Node* stride  = cl->stride();
-      new_predicate_bol = rc_predicate(ctrl, scale, offset, init, limit, stride, ld_rng);
-      if (TraceLoopPredicate) tty->print("range check");
-    }
+
+      // Test the lower bound
+      Node*  lower_bound_bol = rc_predicate(ctrl, scale, offset, init, limit, stride, ld_rng, false);
+      IfNode* lower_bound_iff = lower_bound_proj->in(0)->as_If();
+      _igvn.hash_delete(lower_bound_iff);
+      lower_bound_iff->set_req(1, lower_bound_bol);
+      if (TraceLoopPredicate) tty->print_cr("lower bound check if: %d", lower_bound_iff->_idx);
 
-    if (new_predicate_proj == NULL) {
+      // Test the upper bound
+      Node* upper_bound_bol = rc_predicate(ctrl, scale, offset, init, limit, stride, ld_rng, true);
+      IfNode* upper_bound_iff = upper_bound_proj->in(0)->as_If();
+      _igvn.hash_delete(upper_bound_iff);
+      upper_bound_iff->set_req(1, upper_bound_bol);
+      if (TraceLoopPredicate) tty->print_cr("upper bound check if: %d", lower_bound_iff->_idx);
+
+      // Fall through into rest of the clean up code which will move
+      // any dependent nodes onto the upper bound test.
+      new_predicate_proj = upper_bound_proj;
+    } else {
       // The other proj of the "iff" is a uncommon trap projection, and we can assume
       // the other proj will not be executed ("executed" means uct raised).
       continue;
-    } else {
-      // Success - attach condition (new_predicate_bol) to predicate if
-      invar.map_ctrl(proj, new_predicate_proj); // so that invariance test can be appropriate
-      IfNode* new_iff = new_predicate_proj->in(0)->as_If();
+    }
 
-      // Negate test if necessary
-      if (proj->_con != predicate_proj->_con) {
-        new_predicate_bol = new (C, 2) BoolNode(new_predicate_bol->in(1), new_predicate_bol->_test.negate());
-        register_new_node(new_predicate_bol, new_iff->in(0));
-        if (TraceLoopPredicate) tty->print_cr(" if negated: %d", iff->_idx);
-      } else {
-        if (TraceLoopPredicate) tty->print_cr(" if: %d", iff->_idx);
-      }
+    // Success - attach condition (new_predicate_bol) to predicate if
+    invar.map_ctrl(proj, new_predicate_proj); // so that invariance test can be appropriate
 
-      _igvn.hash_delete(new_iff);
-      new_iff->set_req(1, new_predicate_bol);
-
-      _igvn.hash_delete(iff);
-      iff->set_req(1, proj->is_IfFalse() ? cond_false : cond_true);
+    // Eliminate the old if in the loop body
+    _igvn.hash_delete(iff);
+    iff->set_req(1, proj->is_IfFalse() ? cond_false : cond_true);
 
-      Node* ctrl = new_predicate_proj; // new control
-      ProjNode* dp = proj;     // old control
-      assert(get_loop(dp) == loop, "guarenteed at the time of collecting proj");
-      // Find nodes (depends only on the test) off the surviving projection;
-      // move them outside the loop with the control of proj_clone
-      for (DUIterator_Fast imax, i = dp->fast_outs(imax); i < imax; i++) {
-        Node* cd = dp->fast_out(i); // Control-dependent node
-        if (cd->depends_only_on_test()) {
-          assert(cd->in(0) == dp, "");
-          _igvn.hash_delete(cd);
-          cd->set_req(0, ctrl); // ctrl, not NULL
-          set_early_ctrl(cd);
-          _igvn._worklist.push(cd);
-          IdealLoopTree *new_loop = get_loop(get_ctrl(cd));
-          if (new_loop != loop) {
-            if (!loop->_child) loop->_body.yank(cd);
-            if (!new_loop->_child ) new_loop->_body.push(cd);
-          }
-          --i;
-          --imax;
+    Node* ctrl = new_predicate_proj; // new control
+    ProjNode* dp = proj;     // old control
+    assert(get_loop(dp) == loop, "guaranteed at the time of collecting proj");
+    // Find nodes (depends only on the test) off the surviving projection;
+    // move them outside the loop with the control of proj_clone
+    for (DUIterator_Fast imax, i = dp->fast_outs(imax); i < imax; i++) {
+      Node* cd = dp->fast_out(i); // Control-dependent node
+      if (cd->depends_only_on_test()) {
+        assert(cd->in(0) == dp, "");
+        _igvn.hash_delete(cd);
+        cd->set_req(0, ctrl); // ctrl, not NULL
+        set_early_ctrl(cd);
+        _igvn._worklist.push(cd);
+        IdealLoopTree *new_loop = get_loop(get_ctrl(cd));
+        if (new_loop != loop) {
+          if (!loop->_child) loop->_body.yank(cd);
+          if (!new_loop->_child ) new_loop->_body.push(cd);
         }
+        --i;
+        --imax;
       }
+    }
 
-      hoisted = true;
-      C->set_major_progress();
-    }
+    hoisted = true;
+    C->set_major_progress();
   } // end while
 
 #ifndef PRODUCT
-    // report that the loop predication has been actually performed
-    // for this loop
-    if (TraceLoopPredicate && hoisted) {
-      tty->print("Loop Predication Performed:");
-      loop->dump_head();
-    }
+  // report that the loop predication has been actually performed
+  // for this loop
+  if (TraceLoopPredicate && hoisted) {
+    tty->print("Loop Predication Performed:");
+    loop->dump_head();
+  }
 #endif
 
   return hoisted;
--- a/hotspot/src/share/vm/opto/loopnode.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/opto/loopnode.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -821,7 +821,7 @@
   BoolNode* rc_predicate(Node* ctrl,
                          int scale, Node* offset,
                          Node* init, Node* limit, Node* stride,
-                         Node* range);
+                         Node* range, bool upper);
 
   // Implementation of the loop predication to promote checks outside the loop
   bool loop_predication_impl(IdealLoopTree *loop);
--- a/hotspot/src/share/vm/opto/runtime.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/opto/runtime.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -864,7 +864,7 @@
     thread->set_exception_handler_pc(handler_address);
     thread->set_exception_stack_size(0);
 
-    // Check if the exception PC is a MethodHandle call.
+    // Check if the exception PC is a MethodHandle call site.
     thread->set_is_method_handle_exception(nm->is_method_handle_return(pc));
   }
 
@@ -952,7 +952,7 @@
 
   thread->set_vm_result(exception);
   // Frame not compiled (handles deoptimization blob)
-  return SharedRuntime::raw_exception_handler_for_return_address(ret_pc);
+  return SharedRuntime::raw_exception_handler_for_return_address(thread, ret_pc);
 }
 
 
--- a/hotspot/src/share/vm/prims/methodHandles.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008-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
@@ -82,6 +82,10 @@
   NULL
 };
 
+// Adapters.
+MethodHandlesAdapterBlob* MethodHandles::_adapter_code      = NULL;
+int                       MethodHandles::_adapter_code_size = StubRoutines::method_handles_adapters_code_size;
+
 jobject MethodHandles::_raise_exception_method;
 
 #ifdef ASSERT
@@ -95,6 +99,41 @@
 }
 #endif
 
+
+//------------------------------------------------------------------------------
+// MethodHandles::generate_adapters
+//
+void MethodHandles::generate_adapters() {
+  if (!EnableMethodHandles || SystemDictionary::MethodHandle_klass() == NULL)  return;
+
+  assert(_adapter_code == NULL, "generate only once");
+
+  ResourceMark rm;
+  TraceTime timer("MethodHandles adapters generation", TraceStartupTime);
+  _adapter_code = MethodHandlesAdapterBlob::create(_adapter_code_size);
+  if (_adapter_code == NULL)
+    vm_exit_out_of_memory(_adapter_code_size, "CodeCache: no room for MethodHandles adapters");
+  CodeBuffer code(_adapter_code->instructions_begin(), _adapter_code->instructions_size());
+
+  MethodHandlesAdapterGenerator g(&code);
+  g.generate();
+}
+
+
+//------------------------------------------------------------------------------
+// MethodHandlesAdapterGenerator::generate
+//
+void MethodHandlesAdapterGenerator::generate() {
+  // Generate generic method handle adapters.
+  for (MethodHandles::EntryKind ek = MethodHandles::_EK_FIRST;
+       ek < MethodHandles::_EK_LIMIT;
+       ek = MethodHandles::EntryKind(1 + (int)ek)) {
+    StubCodeMark mark(this, "MethodHandle", MethodHandles::entry_name(ek));
+    MethodHandles::generate_method_handle_stub(_masm, ek);
+  }
+}
+
+
 void MethodHandles::set_enabled(bool z) {
   if (_enabled != z) {
     guarantee(z && EnableMethodHandles, "can only enable once, and only if -XX:+EnableMethodHandles");
--- a/hotspot/src/share/vm/prims/methodHandles.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/prims/methodHandles.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008-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
@@ -115,6 +115,10 @@
   static const char*        _entry_names[_EK_LIMIT+1];
   static jobject            _raise_exception_method;
 
+  // Adapters.
+  static MethodHandlesAdapterBlob* _adapter_code;
+  static int                       _adapter_code_size;
+
   static bool ek_valid(EntryKind ek)            { return (uint)ek < (uint)_EK_LIMIT; }
   static bool conv_op_valid(int op)             { return (uint)op < (uint)CONV_OP_LIMIT; }
 
@@ -133,6 +137,43 @@
     _entries[ek] = me;
   }
 
+  // Some adapter helper functions.
+  static void get_ek_bound_mh_info(EntryKind ek, BasicType& arg_type, int& arg_mask, int& arg_slots) {
+    switch (ek) {
+    case _bound_int_mh        : // fall-thru
+    case _bound_int_direct_mh : arg_type = T_INT;    arg_mask = _INSERT_INT_MASK;  break;
+    case _bound_long_mh       : // fall-thru
+    case _bound_long_direct_mh: arg_type = T_LONG;   arg_mask = _INSERT_LONG_MASK; break;
+    case _bound_ref_mh        : // fall-thru
+    case _bound_ref_direct_mh : arg_type = T_OBJECT; arg_mask = _INSERT_REF_MASK;  break;
+    default: ShouldNotReachHere();
+    }
+    arg_slots = type2size[arg_type];
+  }
+
+  static void get_ek_adapter_opt_swap_rot_info(EntryKind ek, int& swap_bytes, int& rotate) {
+    int swap_slots = 0;
+    switch (ek) {
+    case _adapter_opt_swap_1:     swap_slots = 1; rotate =  0; break;
+    case _adapter_opt_swap_2:     swap_slots = 2; rotate =  0; break;
+    case _adapter_opt_rot_1_up:   swap_slots = 1; rotate =  1; break;
+    case _adapter_opt_rot_1_down: swap_slots = 1; rotate = -1; break;
+    case _adapter_opt_rot_2_up:   swap_slots = 2; rotate =  1; break;
+    case _adapter_opt_rot_2_down: swap_slots = 2; rotate = -1; break;
+    default: ShouldNotReachHere();
+    }
+    // Return the size of the stack slots to move in bytes.
+    swap_bytes = swap_slots * Interpreter::stackElementSize();
+  }
+
+  static int get_ek_adapter_opt_spread_info(EntryKind ek) {
+    switch (ek) {
+    case _adapter_opt_spread_0: return  0;
+    case _adapter_opt_spread_1: return  1;
+    default                   : return -1;
+    }
+  }
+
   static methodOop raise_exception_method() {
     oop rem = JNIHandles::resolve(_raise_exception_method);
     assert(rem == NULL || rem->is_method(), "");
@@ -230,7 +271,10 @@
   // bit values for suppress argument to expand_MemberName:
   enum { _suppress_defc = 1, _suppress_name = 2, _suppress_type = 4 };
 
-  // called from InterpreterGenerator and StubGenerator
+  // Generate MethodHandles adapters.
+  static void generate_adapters();
+
+  // Called from InterpreterGenerator and MethodHandlesAdapterGenerator.
   static address generate_method_handle_interpreter_entry(MacroAssembler* _masm);
   static void generate_method_handle_stub(MacroAssembler* _masm, EntryKind ek);
 
@@ -385,13 +429,13 @@
   static void insert_arg_slots(MacroAssembler* _masm,
                                RegisterOrConstant arg_slots,
                                int arg_mask,
-                               Register rax_argslot,
-                               Register rbx_temp, Register rdx_temp);
+                               Register argslot_reg,
+                               Register temp_reg, Register temp2_reg);
 
   static void remove_arg_slots(MacroAssembler* _masm,
                                RegisterOrConstant arg_slots,
-                               Register rax_argslot,
-                               Register rbx_temp, Register rdx_temp);
+                               Register argslot_reg,
+                               Register temp_reg, Register temp2_reg);
 };
 
 
@@ -447,3 +491,14 @@
 
 address MethodHandles::from_compiled_entry(EntryKind ek) { return entry(ek)->from_compiled_entry(); }
 address MethodHandles::from_interpreted_entry(EntryKind ek) { return entry(ek)->from_interpreted_entry(); }
+
+
+//------------------------------------------------------------------------------
+// MethodHandlesAdapterGenerator
+//
+class MethodHandlesAdapterGenerator : public StubCodeGenerator {
+public:
+  MethodHandlesAdapterGenerator(CodeBuffer* code) : StubCodeGenerator(code) {}
+
+  void generate();
+};
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1346,9 +1346,7 @@
   }
 
   if (FLAG_IS_DEFAULT(MarkStackSize)) {
-    // Size as a multiple of TaskQueueSuper::N which is larger
-    // for 64-bit.
-    FLAG_SET_DEFAULT(MarkStackSize, 128 * TaskQueueSuper::total_size());
+    FLAG_SET_DEFAULT(MarkStackSize, 128 * TASKQUEUE_SIZE);
   }
   if (PrintGCDetails && Verbose) {
     tty->print_cr("MarkStackSize: %uk  MarkStackSizeMax: %uk",
@@ -2859,6 +2857,12 @@
   }
 #endif // _LP64
 
+  // MethodHandles code does not support TaggedStackInterpreter.
+  if (EnableMethodHandles && TaggedStackInterpreter) {
+    warning("TaggedStackInterpreter is not supported by MethodHandles code.  Disabling TaggedStackInterpreter.");
+    TaggedStackInterpreter = false;
+  }
+
   // Check the GC selections again.
   if (!check_gc_consistency()) {
     return JNI_EINVAL;
--- a/hotspot/src/share/vm/runtime/globals.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1795,6 +1795,10 @@
   product(uintx, PreserveMarkStackSize, 1024,                               \
           "Size for stack used in promotion failure handling")              \
                                                                             \
+  develop(uintx, ObjArrayMarkingStride, 512,                                \
+          "Number of ObjArray elements to push onto the marking stack"      \
+          "before pushing a continuation entry")                            \
+                                                                            \
   product_pd(bool, UseTLAB, "Use thread-local object allocation")           \
                                                                             \
   product_pd(bool, ResizeTLAB,                                              \
--- a/hotspot/src/share/vm/runtime/init.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/runtime/init.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-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
@@ -118,6 +118,9 @@
   javaClasses_init();  // must happen after vtable initialization
   stubRoutines_init2(); // note: StubRoutines need 2-phase init
 
+  // Generate MethodHandles adapters.
+  MethodHandles::generate_adapters();
+
   // Although we'd like to, we can't easily do a heap verify
   // here because the main thread isn't yet a JavaThread, so
   // its TLAB may not be made parseable from the usual interfaces.
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -256,7 +256,7 @@
 // The continuation address is the entry point of the exception handler of the
 // previous frame depending on the return address.
 
-address SharedRuntime::raw_exception_handler_for_return_address(address return_address) {
+address SharedRuntime::raw_exception_handler_for_return_address(JavaThread* thread, address return_address) {
   assert(frame::verify_return_pc(return_address), "must be a return pc");
 
   // the fastest case first
@@ -264,6 +264,8 @@
   if (blob != NULL && blob->is_nmethod()) {
     nmethod* code = (nmethod*)blob;
     assert(code != NULL, "nmethod must be present");
+    // Check if the return address is a MethodHandle call site.
+    thread->set_is_method_handle_exception(code->is_method_handle_return(return_address));
     // native nmethods don't have exception handlers
     assert(!code->is_native_method(), "no exception handler");
     assert(code->header_begin() != code->exception_begin(), "no exception handler");
@@ -289,6 +291,8 @@
     if (blob->is_nmethod()) {
       nmethod* code = (nmethod*)blob;
       assert(code != NULL, "nmethod must be present");
+      // Check if the return address is a MethodHandle call site.
+      thread->set_is_method_handle_exception(code->is_method_handle_return(return_address));
       assert(code->header_begin() != code->exception_begin(), "no exception handler");
       return code->exception_begin();
     }
@@ -309,10 +313,11 @@
 }
 
 
-JRT_LEAF(address, SharedRuntime::exception_handler_for_return_address(address return_address))
-  return raw_exception_handler_for_return_address(return_address);
+JRT_LEAF(address, SharedRuntime::exception_handler_for_return_address(JavaThread* thread, address return_address))
+  return raw_exception_handler_for_return_address(thread, return_address);
 JRT_END
 
+
 address SharedRuntime::get_poll_stub(address pc) {
   address stub;
   // Look up the code blob
@@ -465,16 +470,6 @@
     t = table.entry_for(catch_pco, -1, 0);
   }
 
-#ifdef COMPILER1
-  if (nm->is_compiled_by_c1() && t == NULL && handler_bci == -1) {
-    // Exception is not handled by this frame so unwind.  Note that
-    // this is not the same as how C2 does this.  C2 emits a table
-    // entry that dispatches to the unwind code in the nmethod.
-    return NULL;
-  }
-#endif /* COMPILER1 */
-
-
   if (t == NULL) {
     tty->print_cr("MISSING EXCEPTION HANDLER for pc " INTPTR_FORMAT " and handler bci %d", ret_pc, handler_bci);
     tty->print_cr("   Exception:");
@@ -587,7 +582,7 @@
           // 3. Implict null exception in nmethod
 
           if (!cb->is_nmethod()) {
-            guarantee(cb->is_adapter_blob(),
+            guarantee(cb->is_adapter_blob() || cb->is_method_handles_adapter_blob(),
                       "exception happened outside interpreter, nmethods and vtable stubs (1)");
             // There is no handler here, so we will simply unwind.
             return StubRoutines::throw_NullPointerException_at_call_entry();
@@ -892,12 +887,13 @@
   RegisterMap cbl_map(thread, false);
   frame caller_frame = thread->last_frame().sender(&cbl_map);
 
-  CodeBlob* cb = caller_frame.cb();
-  guarantee(cb != NULL && cb->is_nmethod(), "must be called from nmethod");
+  CodeBlob* caller_cb = caller_frame.cb();
+  guarantee(caller_cb != NULL && caller_cb->is_nmethod(), "must be called from nmethod");
+  nmethod* caller_nm = caller_cb->as_nmethod_or_null();
   // make sure caller is not getting deoptimized
   // and removed before we are done with it.
   // CLEANUP - with lazy deopt shouldn't need this lock
-  nmethodLocker caller_lock((nmethod*)cb);
+  nmethodLocker caller_lock(caller_nm);
 
 
   // determine call info & receiver
@@ -929,6 +925,13 @@
   }
 #endif
 
+  // JSR 292
+  // If the resolved method is a MethodHandle invoke target the call
+  // site must be a MethodHandle call site.
+  if (callee_method->is_method_handle_invoke()) {
+    assert(caller_nm->is_method_handle_return(caller_frame.pc()), "must be MH call site");
+  }
+
   // Compute entry points. This might require generation of C2I converter
   // frames, so we cannot be holding any locks here. Furthermore, the
   // computation of the entry points is independent of patching the call.  We
@@ -940,13 +943,12 @@
   StaticCallInfo static_call_info;
   CompiledICInfo virtual_call_info;
 
-
   // Make sure the callee nmethod does not get deoptimized and removed before
   // we are done patching the code.
-  nmethod* nm = callee_method->code();
-  nmethodLocker nl_callee(nm);
+  nmethod* callee_nm = callee_method->code();
+  nmethodLocker nl_callee(callee_nm);
 #ifdef ASSERT
-  address dest_entry_point = nm == NULL ? 0 : nm->entry_point(); // used below
+  address dest_entry_point = callee_nm == NULL ? 0 : callee_nm->entry_point(); // used below
 #endif
 
   if (is_virtual) {
@@ -2077,7 +2079,6 @@
 
 // ---------------------------------------------------------------------------
 // Implementation of AdapterHandlerLibrary
-const char* AdapterHandlerEntry::name = "I2C/C2I adapters";
 AdapterHandlerTable* AdapterHandlerLibrary::_adapters = NULL;
 AdapterHandlerEntry* AdapterHandlerLibrary::_abstract_method_handler = NULL;
 const int AdapterHandlerLibrary_size = 16*K;
@@ -2129,7 +2130,7 @@
   ResourceMark rm;
 
   NOT_PRODUCT(int code_size);
-  BufferBlob *B = NULL;
+  AdapterBlob* B = NULL;
   AdapterHandlerEntry* entry = NULL;
   AdapterFingerPrint* fingerprint = NULL;
   {
@@ -2179,7 +2180,7 @@
 
     // Create I2C & C2I handlers
 
-    BufferBlob*  buf = buffer_blob(); // the temporary code buffer in CodeCache
+    BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache
     if (buf != NULL) {
       CodeBuffer buffer(buf->instructions_begin(), buf->instructions_size());
       short buffer_locs[20];
@@ -2208,7 +2209,7 @@
       }
 #endif
 
-      B = BufferBlob::create(AdapterHandlerEntry::name, &buffer);
+      B = AdapterBlob::create(&buffer);
       NOT_PRODUCT(code_size = buffer.code_size());
     }
     if (B == NULL) {
@@ -2240,7 +2241,7 @@
     jio_snprintf(blob_id,
                  sizeof(blob_id),
                  "%s(%s)@" PTR_FORMAT,
-                 AdapterHandlerEntry::name,
+                 B->name(),
                  fingerprint->as_string(),
                  B->instructions_begin());
     VTune::register_stub(blob_id, B->instructions_begin(), B->instructions_end());
--- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -96,10 +96,9 @@
   static jdouble dexp(jdouble x);
   static jdouble dpow(jdouble x, jdouble y);
 
-
   // exception handling across interpreter/compiler boundaries
-  static address raw_exception_handler_for_return_address(address return_address);
-  static address exception_handler_for_return_address(address return_address);
+  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);
 
 #ifndef SERIALGC
   // G1 write barriers
@@ -568,9 +567,6 @@
   AdapterHandlerEntry();
 
  public:
-  // The name we give all buffer blobs
-  static const char* name;
-
   address get_i2c_entry()            { return _i2c_entry; }
   address get_c2i_entry()            { return _c2i_entry; }
   address get_c2i_unverified_entry() { return _c2i_unverified_entry; }
--- a/hotspot/src/share/vm/runtime/vframeArray.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/runtime/vframeArray.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -223,7 +223,7 @@
         break;
       case Deoptimization::Unpack_exception:
         // exception is pending
-        pc = SharedRuntime::raw_exception_handler_for_return_address(pc);
+        pc = SharedRuntime::raw_exception_handler_for_return_address(thread, pc);
         // [phh] We're going to end up in some handler or other, so it doesn't
         // matter what mdp we point to.  See exception_handler_for_exception()
         // in interpreterRuntime.cpp.
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -827,6 +827,8 @@
 #define       badHeapWord       (::badHeapWordVal)
 #define       badJNIHandle      ((oop)::badJNIHandleVal)
 
+// Default TaskQueue size is 16K (32-bit) or 128K (64-bit)
+#define TASKQUEUE_SIZE (NOT_LP64(1<<14) LP64_ONLY(1<<17))
 
 //----------------------------------------------------------------------------------------------------
 // Utility functions for bitfield manipulations
--- a/hotspot/src/share/vm/utilities/taskqueue.cpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/utilities/taskqueue.cpp	Fri Mar 26 11:10:26 2010 -0400
@@ -31,10 +31,6 @@
 uint ParallelTaskTerminator::_total_peeks = 0;
 #endif
 
-bool TaskQueueSuper::peek() {
-  return _bottom != _age.top();
-}
-
 int TaskQueueSetSuper::randomParkAndMiller(int *seed0) {
   const int a =      16807;
   const int m = 2147483647;
@@ -180,6 +176,13 @@
   }
 }
 
+#ifdef ASSERT
+bool ObjArrayTask::is_valid() const {
+  return _obj != NULL && _obj->is_objArray() && _index > 0 &&
+    _index < objArrayOop(_obj)->length();
+}
+#endif // ASSERT
+
 bool RegionTaskQueueWithOverflow::is_empty() {
   return (_region_queue.size() == 0) &&
          (_overflow_stack->length() == 0);
--- a/hotspot/src/share/vm/utilities/taskqueue.hpp	Thu Mar 25 16:54:59 2010 -0700
+++ b/hotspot/src/share/vm/utilities/taskqueue.hpp	Fri Mar 26 11:10:26 2010 -0400
@@ -22,6 +22,7 @@
  *
  */
 
+template <unsigned int N>
 class TaskQueueSuper: public CHeapObj {
 protected:
   // Internal type for indexing the queue; also used for the tag.
@@ -30,10 +31,7 @@
   // The first free element after the last one pushed (mod N).
   volatile uint _bottom;
 
-  enum {
-    N = 1 << NOT_LP64(14) LP64_ONLY(17), // Queue size: 16K or 128K
-    MOD_N_MASK = N - 1                   // To compute x mod N efficiently.
-  };
+  enum { MOD_N_MASK = N - 1 };
 
   class Age {
   public:
@@ -84,12 +82,12 @@
 
   // Returns a number in the range [0..N).  If the result is "N-1", it should be
   // interpreted as 0.
-  uint dirty_size(uint bot, uint top) {
+  uint dirty_size(uint bot, uint top) const {
     return (bot - top) & MOD_N_MASK;
   }
 
   // Returns the size corresponding to the given "bot" and "top".
-  uint size(uint bot, uint top) {
+  uint size(uint bot, uint top) const {
     uint sz = dirty_size(bot, top);
     // Has the queue "wrapped", so that bottom is less than top?  There's a
     // complicated special case here.  A pair of threads could perform pop_local
@@ -111,17 +109,17 @@
 public:
   TaskQueueSuper() : _bottom(0), _age() {}
 
-  // Return "true" if the TaskQueue contains any tasks.
-  bool peek();
+  // Return true if the TaskQueue contains any tasks.
+  bool peek() { return _bottom != _age.top(); }
 
   // Return an estimate of the number of elements in the queue.
   // The "careful" version admits the possibility of pop_local/pop_global
   // races.
-  uint size() {
+  uint size() const {
     return size(_bottom, _age.top());
   }
 
-  uint dirty_size() {
+  uint dirty_size() const {
     return dirty_size(_bottom, _age.top());
   }
 
@@ -132,19 +130,36 @@
 
   // Maximum number of elements allowed in the queue.  This is two less
   // than the actual queue size, for somewhat complicated reasons.
-  uint max_elems() { return N - 2; }
+  uint max_elems() const { return N - 2; }
 
   // Total size of queue.
   static const uint total_size() { return N; }
 };
 
-template<class E> class GenericTaskQueue: public TaskQueueSuper {
+template<class E, unsigned int N = TASKQUEUE_SIZE>
+class GenericTaskQueue: public TaskQueueSuper<N> {
+protected:
+  typedef typename TaskQueueSuper<N>::Age Age;
+  typedef typename TaskQueueSuper<N>::idx_t idx_t;
+
+  using TaskQueueSuper<N>::_bottom;
+  using TaskQueueSuper<N>::_age;
+  using TaskQueueSuper<N>::increment_index;
+  using TaskQueueSuper<N>::decrement_index;
+  using TaskQueueSuper<N>::dirty_size;
+
+public:
+  using TaskQueueSuper<N>::max_elems;
+  using TaskQueueSuper<N>::size;
+
 private:
   // Slow paths for push, pop_local.  (pop_global has no fast path.)
   bool push_slow(E t, uint dirty_n_elems);
   bool pop_local_slow(uint localBot, Age oldAge);
 
 public:
+  typedef E element_type;
+
   // Initializes the queue to empty.
   GenericTaskQueue();
 
@@ -175,19 +190,19 @@
   volatile E* _elems;
 };
 
-template<class E>
-GenericTaskQueue<E>::GenericTaskQueue():TaskQueueSuper() {
+template<class E, unsigned int N>
+GenericTaskQueue<E, N>::GenericTaskQueue() {
   assert(sizeof(Age) == sizeof(size_t), "Depends on this.");
 }
 
-template<class E>
-void GenericTaskQueue<E>::initialize() {
+template<class E, unsigned int N>
+void GenericTaskQueue<E, N>::initialize() {
   _elems = NEW_C_HEAP_ARRAY(E, N);
   guarantee(_elems != NULL, "Allocation failed.");
 }
 
-template<class E>
-void GenericTaskQueue<E>::oops_do(OopClosure* f) {
+template<class E, unsigned int N>
+void GenericTaskQueue<E, N>::oops_do(OopClosure* f) {
   // tty->print_cr("START OopTaskQueue::oops_do");
   uint iters = size();
   uint index = _bottom;
@@ -203,21 +218,21 @@
   // tty->print_cr("END OopTaskQueue::oops_do");
 }
 
-
-template<class E>
-bool GenericTaskQueue<E>::push_slow(E t, uint dirty_n_elems) {
+template<class E, unsigned int N>
+bool GenericTaskQueue<E, N>::push_slow(E t, uint dirty_n_elems) {
   if (dirty_n_elems == N - 1) {
     // Actually means 0, so do the push.
     uint localBot = _bottom;
-    _elems[localBot] = t;
+    // g++ complains if the volatile result of the assignment is unused.
+    const_cast<E&>(_elems[localBot] = t);
     OrderAccess::release_store(&_bottom, increment_index(localBot));
     return true;
   }
   return false;
 }
 
-template<class E>
-bool GenericTaskQueue<E>::
+template<class E, unsigned int N>
+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,
@@ -249,8 +264,8 @@
   return false;
 }
 
-template<class E>
-bool GenericTaskQueue<E>::pop_global(E& t) {
+template<class E, unsigned int N>
+bool GenericTaskQueue<E, N>::pop_global(E& t) {
   Age oldAge = _age.get();
   uint localBot = _bottom;
   uint n_elems = size(localBot, oldAge.top());
@@ -258,7 +273,7 @@
     return false;
   }
 
-  t = _elems[oldAge.top()];
+  const_cast<E&>(t = _elems[oldAge.top()]);
   Age newAge(oldAge);
   newAge.increment();
   Age resAge = _age.cmpxchg(newAge, oldAge);
@@ -269,8 +284,8 @@
   return resAge == oldAge;
 }
 
-template<class E>
-GenericTaskQueue<E>::~GenericTaskQueue() {
+template<class E, unsigned int N>
+GenericTaskQueue<E, N>::~GenericTaskQueue() {
   FREE_C_HEAP_ARRAY(E, _elems);
 }
 
@@ -283,16 +298,18 @@
   virtual bool peek() = 0;
 };
 
-template<class E> class GenericTaskQueueSet: public TaskQueueSetSuper {
+template<class T>
+class GenericTaskQueueSet: public TaskQueueSetSuper {
 private:
   uint _n;
-  GenericTaskQueue<E>** _queues;
+  T** _queues;
 
 public:
+  typedef typename T::element_type E;
+
   GenericTaskQueueSet(int n) : _n(n) {
-    typedef GenericTaskQueue<E>* GenericTaskQueuePtr;
+    typedef T* GenericTaskQueuePtr;
     _queues = NEW_C_HEAP_ARRAY(GenericTaskQueuePtr, n);
-    guarantee(_queues != NULL, "Allocation failure.");
     for (int i = 0; i < n; i++) {
       _queues[i] = NULL;
     }
@@ -302,9 +319,9 @@
   bool steal_best_of_2(uint queue_num, int* seed, E& t);
   bool steal_best_of_all(uint queue_num, int* seed, E& t);
 
-  void register_queue(uint i, GenericTaskQueue<E>* q);
+  void register_queue(uint i, T* q);
 
-  GenericTaskQueue<E>* queue(uint n);
+  T* queue(uint n);
 
   // The thread with queue number "queue_num" (and whose random number seed
   // is at "seed") is trying to steal a task from some other queue.  (It
@@ -316,27 +333,27 @@
   bool peek();
 };
 
-template<class E>
-void GenericTaskQueueSet<E>::register_queue(uint i, GenericTaskQueue<E>* q) {
+template<class T> void
+GenericTaskQueueSet<T>::register_queue(uint i, T* q) {
   assert(i < _n, "index out of range.");
   _queues[i] = q;
 }
 
-template<class E>
-GenericTaskQueue<E>* GenericTaskQueueSet<E>::queue(uint i) {
+template<class T> T*
+GenericTaskQueueSet<T>::queue(uint i) {
   return _queues[i];
 }
 
-template<class E>
-bool GenericTaskQueueSet<E>::steal(uint queue_num, int* seed, E& t) {
+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))
       return true;
   return false;
 }
 
-template<class E>
-bool GenericTaskQueueSet<E>::steal_best_of_all(uint queue_num, int* seed, E& t) {
+template<class T> bool
+GenericTaskQueueSet<T>::steal_best_of_all(uint queue_num, int* seed, E& t) {
   if (_n > 2) {
     int best_k;
     uint best_sz = 0;
@@ -359,8 +376,8 @@
   }
 }
 
-template<class E>
-bool GenericTaskQueueSet<E>::steal_1_random(uint queue_num, int* seed, E& t) {
+template<class T> bool
+GenericTaskQueueSet<T>::steal_1_random(uint queue_num, int* seed, E& t) {
   if (_n > 2) {
     uint k = queue_num;
     while (k == queue_num) k = randomParkAndMiller(seed) % _n;
@@ -375,8 +392,8 @@
   }
 }
 
-template<class E>
-bool GenericTaskQueueSet<E>::steal_best_of_2(uint queue_num, int* seed, E& t) {
+template<class T> bool
+GenericTaskQueueSet<T>::steal_best_of_2(uint queue_num, int* seed, E& t) {
   if (_n > 2) {
     uint k1 = queue_num;
     while (k1 == queue_num) k1 = randomParkAndMiller(seed) % _n;
@@ -397,8 +414,8 @@
   }
 }
 
-template<class E>
-bool GenericTaskQueueSet<E>::peek() {
+template<class T>
+bool GenericTaskQueueSet<T>::peek() {
   // Try all the queues.
   for (uint j = 0; j < _n; j++) {
     if (_queues[j]->peek())
@@ -468,14 +485,16 @@
 #endif
 };
 
-template<class E> inline bool GenericTaskQueue<E>::push(E t) {
+template<class E, unsigned int N> inline bool
+GenericTaskQueue<E, N>::push(E t) {
   uint localBot = _bottom;
   assert((localBot >= 0) && (localBot < N), "_bottom out of range.");
   idx_t top = _age.top();
   uint dirty_n_elems = dirty_size(localBot, top);
-  assert((dirty_n_elems >= 0) && (dirty_n_elems < N), "n_elems out of range.");
+  assert(dirty_n_elems < N, "n_elems out of range.");
   if (dirty_n_elems < max_elems()) {
-    _elems[localBot] = t;
+    // g++ complains if the volatile result of the assignment is unused.
+    const_cast<E&>(_elems[localBot] = t);
     OrderAccess::release_store(&_bottom, increment_index(localBot));
     return true;
   } else {
@@ -483,7 +502,8 @@
   }
 }
 
-template<class E> inline bool GenericTaskQueue<E>::pop_local(E& t) {
+template<class E, unsigned int N> inline bool
+GenericTaskQueue<E, N>::pop_local(E& t) {
   uint localBot = _bottom;
   // This value cannot be N-1.  That can only occur as a result of
   // the assignment to bottom in this method.  If it does, this method
@@ -497,7 +517,7 @@
   // This is necessary to prevent any read below from being reordered
   // before the store just above.
   OrderAccess::fence();
-  t = _elems[localBot];
+  const_cast<E&>(t = _elems[localBot]);
   // This is a second read of "age"; the "size()" above is the first.
   // If there's still at least one element in the queue, based on the
   // "_bottom" and "age" we've read, then there can be no interference with
@@ -514,17 +534,23 @@
 }
 
 typedef oop Task;
-typedef GenericTaskQueue<Task>         OopTaskQueue;
-typedef GenericTaskQueueSet<Task>      OopTaskQueueSet;
+typedef GenericTaskQueue<Task>            OopTaskQueue;
+typedef GenericTaskQueueSet<OopTaskQueue> OopTaskQueueSet;
 
-
-#define COMPRESSED_OOP_MASK  1
+#ifdef _MSC_VER
+#pragma warning(push)
+// warning C4522: multiple assignment operators specified
+#pragma warning(disable:4522)
+#endif
 
 // This is a container class for either an oop* or a narrowOop*.
 // Both are pushed onto a task queue and the consumer will test is_narrow()
 // to determine which should be processed.
 class StarTask {
   void*  _holder;        // either union oop* or narrowOop*
+
+  enum { COMPRESSED_OOP_MASK = 1 };
+
  public:
   StarTask(narrowOop* p) {
     assert(((uintptr_t)p & COMPRESSED_OOP_MASK) == 0, "Information loss!");
@@ -540,20 +566,61 @@
     return (narrowOop*)((uintptr_t)_holder & ~COMPRESSED_OOP_MASK);
   }
 
-  // Operators to preserve const/volatile in assignments required by gcc
-  void operator=(const volatile StarTask& t) volatile { _holder = t._holder; }
+  StarTask& operator=(const StarTask& t) {
+    _holder = t._holder;
+    return *this;
+  }
+  volatile StarTask& operator=(const volatile StarTask& t) volatile {
+    _holder = t._holder;
+    return *this;
+  }
 
   bool is_narrow() const {
     return (((uintptr_t)_holder & COMPRESSED_OOP_MASK) != 0);
   }
 };
 
-typedef GenericTaskQueue<StarTask>     OopStarTaskQueue;
-typedef GenericTaskQueueSet<StarTask>  OopStarTaskQueueSet;
+class ObjArrayTask
+{
+public:
+  ObjArrayTask(oop o = NULL, int idx = 0): _obj(o), _index(idx) { }
+  ObjArrayTask(oop o, size_t idx): _obj(o), _index(int(idx)) {
+    assert(idx <= size_t(max_jint), "too big");
+  }
+  ObjArrayTask(const ObjArrayTask& t): _obj(t._obj), _index(t._index) { }
+
+  ObjArrayTask& operator =(const ObjArrayTask& t) {
+    _obj = t._obj;
+    _index = t._index;
+    return *this;
+  }
+  volatile ObjArrayTask&
+  operator =(const volatile ObjArrayTask& t) volatile {
+    _obj = t._obj;
+    _index = t._index;
+    return *this;
+  }
+
+  inline oop obj()   const { return _obj; }
+  inline int index() const { return _index; }
+
+  DEBUG_ONLY(bool is_valid() const); // Tasks to be pushed/popped must be valid.
+
+private:
+  oop _obj;
+  int _index;
+};
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+typedef GenericTaskQueue<StarTask>            OopStarTaskQueue;
+typedef GenericTaskQueueSet<OopStarTaskQueue> OopStarTaskQueueSet;
 
 typedef size_t RegionTask;  // index for region
-typedef GenericTaskQueue<RegionTask>    RegionTaskQueue;
-typedef GenericTaskQueueSet<RegionTask> RegionTaskQueueSet;
+typedef GenericTaskQueue<RegionTask>         RegionTaskQueue;
+typedef GenericTaskQueueSet<RegionTaskQueue> RegionTaskQueueSet;
 
 class RegionTaskQueueWithOverflow: public CHeapObj {
  protected:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/6930043/Test6930043.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,76 @@
+/*
+ * 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 6930043
+ * @summary C2: SIGSEGV in javasoft.sqe.tests.lang.arr017.arr01702.arr01702.loop_forw(II)I
+ *
+ * @run main Test6930043
+ */
+
+import java.io.PrintStream;
+
+public class Test6930043 {
+    int[] a;
+    int idx;
+
+    public int loop_back(int i, int i_0_) {
+        int i_1_ = 0;
+        int[] is = a;
+        if (is == null) return 0;
+        for (int i_2_ = i; i_2_ >= i_0_; i_2_--)
+            i_1_ += is[idx = i_2_];
+        return i_1_;
+    }
+
+    public int loop_forw(int start, int end) {
+        int result = 0;
+        int[] is = a;
+        if (is == null) return 0;
+        for (int index = start; index < end; index++)
+            result += is[index];
+            // result += is[idx = index];
+        return result;
+    }
+
+    public static void main(String[] strings) {
+        Test6930043 var_Test6930043 = new Test6930043();
+        var_Test6930043.a = new int[1000000];
+        var_Test6930043.loop_forw(10, 999990);
+        var_Test6930043.loop_forw(10, 999990);
+        for (int i = 0; i < 3; i++) {
+            try {
+                if (var_Test6930043.loop_forw(-1, 999990) != 0) throw new InternalError();
+            } catch (ArrayIndexOutOfBoundsException e) { }
+        }
+        var_Test6930043.loop_back(999990, 10);
+        var_Test6930043.loop_back(999990, 10);
+        for (int i = 0; i < 3; i++) {
+            try {
+                if (var_Test6930043.loop_back(999990, -1) != 0) throw new InternalError();
+            } catch (ArrayIndexOutOfBoundsException e) { }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/6932496/Test6932496.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,51 @@
+/*
+ * 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 6932496
+ * @summary incorrect deopt of jsr subroutine on 64 bit c1
+ *
+ * @compile -source 1.5 -target 1.5 -XDjsrlimit=0 Test6932496.java
+ * @run main/othervm -Xcomp -XX:CompileOnly=Test6932496.m Test6932496
+ */
+
+public class Test6932496 {
+    static class A {
+        volatile boolean flag = false;
+    }
+
+    static void m() {
+        try {
+        } finally {
+            A a = new A();
+            a.flag = true;
+        }
+    }
+
+
+    static public void main(String[] args) {
+        m();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/6935535/Test.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,48 @@
+/*
+ * 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 6935535
+ * @summary String.indexOf() returns incorrect result on x86 with SSE4.2
+ *
+ * @run main/othervm -Xcomp Test
+ */
+
+public class Test {
+
+  static int IndexOfTest(String str) {
+    return str.indexOf("1111111111111xx1x");
+  }
+
+  public static void main(String args[]) {
+    String str = "1111111111111xx1111111111111xx1x";
+    str = str.substring(0, 31);
+    int idx = IndexOfTest(str);
+    System.out.println("IndexOf(" + "1111111111111xx1x" + ") = " + idx + " in " + str);
+    if (idx != -1) {
+      System.exit(97);
+    }
+  }
+}
+
--- a/jaxp/.hgtags	Thu Mar 25 16:54:59 2010 -0700
+++ b/jaxp/.hgtags	Fri Mar 26 11:10:26 2010 -0400
@@ -59,3 +59,4 @@
 c876ad22e4bf9d3c6460080db7ace478e29a3ff9 jdk7-b82
 309a0a7fc6ceb1c9fc3a85b3608e97ef8f7b0dfd jdk7-b83
 32c0cf01d555747918529a6ff9e06b0090c7a474 jdk7-b84
+6c0ccabb430dacdcd4479f8b197980d5da4eeb66 jdk7-b85
--- a/jaxws/.hgtags	Thu Mar 25 16:54:59 2010 -0700
+++ b/jaxws/.hgtags	Fri Mar 26 11:10:26 2010 -0400
@@ -59,3 +59,4 @@
 31573ae8eed15a6c170f3f0d1abd0b9109c0e086 jdk7-b82
 371e3ded591d09112a9f231e37cb072781c486ac jdk7-b83
 8bc02839eee4ef02cd1b50e87638874368a26535 jdk7-b84
+8424512588ff95362c1f1e5f11c6efd4e7f7db6e jdk7-b85
--- a/jdk/.hgtags	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/.hgtags	Fri Mar 26 11:10:26 2010 -0400
@@ -59,3 +59,4 @@
 69ef657320ad5c35cfa12e4d8322d877e778f8b3 jdk7-b82
 9027c6b9d7e2c9ca04a1add691b5b50d0f22b1aa jdk7-b83
 7cb9388bb1a16365fa5118c5efa38b1cd58be40d jdk7-b84
+b396584a3e64988839cca21ea1f7fbdcc9248783 jdk7-b85
--- a/jdk/make/common/shared/Sanity.gmk	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/make/common/shared/Sanity.gmk	Fri Mar 26 11:10:26 2010 -0400
@@ -687,13 +687,13 @@
 ######################################################
 sane-alt_outputdir:
 ifdef ALT_OUTPUTDIR
-	@if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
+	@if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
 	  $(ECHO) "ERROR: ALT_OUTPUTDIR must be an Absolute Path Name, \n" \
 	    "      not a Relative Path Name. \n" \
 	    "" >> $(ERROR_FILE) ; \
 	fi
   ifeq ($(PLATFORM), windows)
-	@if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -ci '^([a-z]:)'` -ne 1 ]; then \
+	@if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -c '^([A-Za-z]:)'` -ne 1 ]; then \
 	  $(ECHO) "ERROR: On windows, ALT_OUTPUTDIR must contain the drive letter. \n" \
 	    "" >> $(ERROR_FILE) ; \
 	fi
@@ -742,7 +742,7 @@
 ######################################################
 sane-alt_bootdir:
 ifdef ALT_BOOTDIR
-	@if [ `$(ECHO) $(subst \,/,$(ALT_BOOTDIR)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
+	@if [ `$(ECHO) $(subst \,/,$(ALT_BOOTDIR)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
 	  $(ECHO) "ERROR: ALT_BOOTDIR must be an Absolute Path Name, \n" \
 	    "      not a Relative Path Name. \n" \
 	    "      The current value of ALT_BOOTDIR is \n" \
@@ -772,7 +772,7 @@
 ######################################################
 sane-local-bootdir:
 ifeq ($(PLATFORM), windows)
-	@if [ `$(ECHO) $(BOOTDIR) | $(EGREP) -ci '^J:'` -ne 0 ]; then \
+	@if [ `$(ECHO) $(BOOTDIR) | $(EGREP) -c '^[jJ]:'` -ne 0 ]; then \
 	  $(ECHO) "WARNING: Your BOOTDIR is located on the J: drive. Often the J:\n" \
 	    "        drive is mapped over a network. Using a mapped drive for\n" \
 	    "        the BOOTDIR may significantly slow down the build process.\n" \
@@ -789,7 +789,7 @@
 ######################################################
 sane-cacerts:
   ifdef ALT_CACERTS_FILE
-	@if [ `$(ECHO) $(subst \,/,$(ALT_CACERTS_FILE)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
+	@if [ `$(ECHO) $(subst \,/,$(ALT_CACERTS_FILE)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
 	  $(ECHO) "ERROR: ALT_CACERTS_FILE must be an Absolute Path Name, \n" \
 	    "      not a Relative Path Name. \n" \
 	    "      The current value of ALT_CACERTS_FILE is \n" \
@@ -1538,7 +1538,7 @@
 sane-mozilla:
 ifeq ($(ARCH_DATA_MODEL), 32)
   ifdef ALT_MOZILLA_HEADERS_PATH
-	@if [ `$(ECHO) $(subst \,/,$(ALT_MOZILLA_HEADERS_PATH)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
+	@if [ `$(ECHO) $(subst \,/,$(ALT_MOZILLA_HEADERS_PATH)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
 	  $(ECHO) "ERROR: ALT_MOZILLA_HEADERS_PATH must be an Absolute Path Name, \n" \
 	    "      not a Relative Path Name. \n" \
 	    "      The current value of ALT_MOZILLA_HEADERS_PATH is \n" \
--- a/jdk/make/modules/tools/Makefile	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/make/modules/tools/Makefile	Fri Mar 26 11:10:26 2010 -0400
@@ -135,9 +135,8 @@
 
 $(CLASSANALYZER_JAR_FILE): $(BUILDTOOL_MANIFEST_FILE) $(FILES_class)
 	@$(prep-target)
-	$(CD) $(BUILDTOOLCLASSDIR) && \
-	    $(BOOT_JAR_CMD) cfm $@ $(BUILDTOOL_MANIFEST_FILE) \
-	       $(PKGDIR) $(BOOT_JAR_JFLAGS) || $(RM) $@
+	$(BOOT_JAR_CMD) cfm $@ $(BUILDTOOL_MANIFEST_FILE) \
+	    -C $(BUILDTOOLCLASSDIR) $(PKGDIR) $(BOOT_JAR_JFLAGS) || $(RM) $@
 	@$(java-vm-cleanup)
 
 $(BUILDTOOLJARDIR)/classfile.jar: $(FILES_classfile_class)
--- a/jdk/make/sun/javazic/tzdata/VERSION	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/make/sun/javazic/tzdata/VERSION	Fri Mar 26 11:10:26 2010 -0400
@@ -21,4 +21,4 @@
 # CA 95054 USA or visit www.sun.com if you need additional information or
 # have any questions.
 #
-tzdata2009r
+tzdata2010b
--- a/jdk/make/sun/javazic/tzdata/antarctica	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/make/sun/javazic/tzdata/antarctica	Fri Mar 26 11:10:26 2010 -0400
@@ -128,7 +128,7 @@
 Zone Antarctica/Davis	0	-	zzz	1957 Jan 13
 			7:00	-	DAVT	1964 Nov # Davis Time
 			0	-	zzz	1969 Feb
-			7:00	-	DAVT	2009 Oct 18 2:0
+			7:00	-	DAVT	2009 Oct 18 2:00
 			5:00	-	DAVT
 Zone Antarctica/Mawson	0	-	zzz	1954 Feb 13
 			6:00	-	MAWT	2009 Oct 18 2:00
--- a/jdk/make/sun/javazic/tzdata/asia	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/make/sun/javazic/tzdata/asia	Fri Mar 26 11:10:26 2010 -0400
@@ -218,6 +218,41 @@
 # http://www.thaindian.com/newsportal/business/bangladesh-to-continue-indefinitely-with-advanced-time_100259987.html
 # </a>
 
+# From Alexander Krivenyshev (2009-12-24):
+# According to Bangladesh newspaper "The Daily Star,"
+# Bangladesh will change its clock back to Standard Time on Dec 31, 2009.
+#
+# Clock goes back 1-hr on Dec 31 night.
+# <a href="http://www.thedailystar.net/newDesign/news-details.php?nid=119228">
+# http://www.thedailystar.net/newDesign/news-details.php?nid=119228
+# </a>
+# and
+# <a href="http://www.worldtimezone.com/dst_news/dst_news_bangladesh05.html">
+# http://www.worldtimezone.com/dst_news/dst_news_bangladesh05.html
+# </a>
+#
+# "...The government yesterday decided to put the clock back by one hour
+# on December 31 midnight and the new time will continue until March 31,
+# 2010 midnight. The decision came at a cabinet meeting at the Prime
+# Minister's Office last night..."
+
+# From Danvin Ruangchan (2009-12-24):
+# ...the news mentions DST will be turned off again 7 months after March
+# 31st on Oct 31, 2010.
+
+# From Arthur David Olson (2009-12-26):
+# Indeed, "The government will advance again the Banglasdesh Standard
+# Time by one one hour on March 31 next year by enforcing the Daylight
+# Saving Time (DST) for seven months. It will continue till October 31
+# until further notice." I take that last sentence as the
+# establishment of a rule.
+
+# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
+Rule	Dhaka	2009	only	-	Jun	19	23:00	1:00	S
+Rule	Dhaka	2010	only	-	Jan	1	0:00	0	-
+Rule	Dhaka	2010	max	-	Mar	31	23:00	1:00	S
+Rule	Dhaka	2010	max	-	Nov	1	0:00	0	-
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dhaka	6:01:40 -	LMT	1890
 			5:53:20	-	HMT	1941 Oct    # Howrah Mean Time?
@@ -225,8 +260,8 @@
 			5:30	-	IST	1942 Sep
 			6:30	-	BURT	1951 Sep 30
 			6:00	-	DACT	1971 Mar 26 # Dacca Time
-			6:00	-	BDT	2009 Jun 19 23:00 # Bangladesh Time
-			6:00	1:00	BDST
+			6:00	-	BDT	2009
+			6:00	Dhaka	BD%sT
 
 # Bhutan
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -385,6 +420,69 @@
 # West Xinjiang, including Aksu, Atushi, Yining, Hetian, Cele, Luopu, Nileke,
 # Zhaosu, Tekesi, Gongliu, Chabuchaer, Huocheng, Bole, Pishan, Suiding,
 # and Yarkand.
+
+# From Luther Ma (2009-10-17):
+# Almost all (>99.9%) ethnic Chinese (properly ethnic Han) living in
+# Xinjiang use Chinese Standard Time. Some are aware of Xinjiang time,
+# but have no need of it. All planes, trains, and schools function on
+# what is called "Beijing time." When Han make an appointment in Chinese
+# they implicitly use Beijing time.
+#
+# On the other hand, ethnic Uyghurs, who make up about half the
+# population of Xinjiang, typically use "Xinjiang time" which is two
+# hours behind Beijing time, or UTC +0600. The government of the Xinjiang
+# Uyghur Autonomous Region, (XAUR, or just Xinjiang for short) as well as
+# local governments such as the Urumqi city government use both times in
+# publications, referring to what is popularly called Xinjiang time as
+# "Urumqi time." When Uyghurs make an appointment in the Uyghur language
+# they almost invariably use Xinjiang time.
+#
+# (Their ethnic Han compatriots would typically have no clue of its
+# widespread use, however, because so extremely few of them are fluent in
+# Uyghur, comparable to the number of Anglo-Americans fluent in Navajo.)
+#
+# (...As with the rest of China there was a brief interval ending in 1990
+# or 1991 when summer time was in use.  The confusion was severe, with
+# the province not having dual times but four times in use at the same
+# time. Some areas remained on standard Xinjiang time or Beijing time and
+# others moving their clocks ahead.)
+#
+# ...an example of an official website using of Urumqi time.
+#
+# The first few lines of the Google translation of
+# <a href="http://www.fjysgl.gov.cn/show.aspx?id=2379&cid=39">
+# http://www.fjysgl.gov.cn/show.aspx?id=2379&cid=39
+# </a>
+# (retrieved 2009-10-13)
+# > Urumqi fire seven people are missing the alleged losses of at least
+# > 500 million yuan
+# >
+# > (Reporter Dong Liu) the day before 20:20 or so (Urumqi Time 18:20),
+# > Urumqi City Department of International Plaza Luther Qiantang River
+# > burst fire. As of yesterday, 18:30, Urumqi City Fire officers and men
+# > have worked continuously for 22 hours...
+
+# From Luther Ma (2009-11-19):
+# With the risk of being redundant to previous answers these are the most common
+# English "transliterations" (w/o using non-English symbols):
+#
+# 1. Wulumuqi...
+# 2. Kashi...
+# 3. Urumqi...
+# 4. Kashgar...
+# ...
+# 5. It seems that Uyghurs in Urumqi has been using Xinjiang since at least the
+# 1960's. I know of one Han, now over 50, who grew up in the surrounding
+# countryside and used Xinjiang time as a child.
+#
+# 6. Likewise for Kashgar and the rest of south Xinjiang I don't know of any
+# start date for Xinjiang time.
+#
+# Without having access to local historical records, nor the ability to legally
+# publish them, I would go with October 1, 1949, when Xinjiang became the Uyghur
+# Autonomous Region under the PRC. (Before that Uyghurs, of course, would also
+# not be using Beijing time, but some local time.)
+
 Zone	Asia/Kashgar	5:03:56	-	LMT	1928 # or Kashi or Kaxgar
 			5:30	-	KAST	1940	 # Kashgar Time
 			5:00	-	KAST	1980 May
@@ -392,8 +490,8 @@
 
 
 # From Lee Yiu Chung (2009-10-24):
-# I found there are some mistakes for the historial DST rule for Hong
-# Kong. Accoring to the DST record from Hong Kong Observatory (actually,
+# I found there are some mistakes for the...DST rule for Hong
+# Kong. [According] to the DST record from Hong Kong Observatory (actually,
 # it is not [an] observatory, but the official meteorological agency of HK,
 # and also serves as the official timing agency), there are some missing
 # and incorrect rules. Although the exact switch over time is missing, I
--- a/jdk/make/sun/javazic/tzdata/australasia	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/make/sun/javazic/tzdata/australasia	Fri Mar 26 11:10:26 2010 -0400
@@ -270,9 +270,30 @@
 			6:30	-	CCT	# Cocos Islands Time
 
 # Fiji
+# From Alexander Krivenyshev (2009-11-10):
+# According to Fiji Broadcasting Corporation,  Fiji plans to re-introduce DST
+# from November 29th 2009  to April 25th 2010.
+#
+# "Daylight savings to commence this month"
+# <a href="http://www.radiofiji.com.fj/fullstory.php?id=23719">
+# http://www.radiofiji.com.fj/fullstory.php?id=23719
+# </a>
+# or
+# <a href="http://www.worldtimezone.com/dst_news/dst_news_fiji01.html">
+# http://www.worldtimezone.com/dst_news/dst_news_fiji01.html
+# </a>
+
+# From Steffen Thorsen (2009-11-10):
+# The Fiji Government has posted some more details about the approved
+# amendments:
+# <a href="http://www.fiji.gov.fj/publish/page_16198.shtml">
+# http://www.fiji.gov.fj/publish/page_16198.shtml
+# </a>
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Fiji	1998	1999	-	Nov	Sun>=1	2:00	1:00	S
 Rule	Fiji	1999	2000	-	Feb	lastSun	3:00	0	-
+Rule	Fiji	2009	only	-	Nov	29	2:00	1:00	S
+Rule	Fiji	2010	only	-	Apr	25	3:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Fiji	11:53:40 -	LMT	1915 Oct 26	# Suva
 			12:00	Fiji	FJ%sT	# Fiji Time
--- a/jdk/make/sun/javazic/tzdata/europe	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/make/sun/javazic/tzdata/europe	Fri Mar 26 11:10:26 2010 -0400
@@ -2152,12 +2152,20 @@
 # From Oscar van Vlijmen (2003-10-18): [This region consists of]
 # Aginskij Buryatskij avtonomnyj okrug, Amurskaya oblast',
 # [parts of] Respublika Sakha (Yakutiya), Chitinskaya oblast'.
+
+# From Oscar van Vlijmen (2009-11-29):
+# ...some regions of RUssia were merged with others since 2005...
+# Some names were changed, no big deal, except for one instance: a new name.
+# YAK/YAKST: UTC+9 Zabajkal'skij kraj.
+
+# From Oscar van Vlijmen (2009-11-29):
 # The Sakha districts are: Aldanskij, Amginskij, Anabarskij,
-# Bulunskij, Verkhnekolymskij, Verkhnevilyujskij, Vilyujskij, Gornyj,
+# Verkhnevilyujskij, Vilyujskij, Gornyj,
 # Zhiganskij, Kobyajskij, Lenskij, Megino-Kangalasskij, Mirninskij,
-# Namskij, Nyurbinskij, Olenekskij, Olekminskij, Srednekolymskij,
+# Namskij, Nyurbinskij, Olenyokskij, Olyokminskij,
 # Suntarskij, Tattinskij, Ust'-Aldanskij, Khangalasskij,
-# Churapchinskij, Eveno-Bytantajskij.
+# Churapchinskij, Eveno-Bytantajskij Natsional'nij.
+
 Zone Asia/Yakutsk	 8:38:40 -	LMT	1919 Dec 15
 			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
 			 9:00	Russia	YAK%sT	1991 Mar 31 2:00s
@@ -2167,7 +2175,9 @@
 # From Oscar van Vlijmen (2003-10-18): [This region consists of]
 # Evrejskaya avtonomnaya oblast', Khabarovskij kraj, Primorskij kraj,
 # [parts of] Respublika Sakha (Yakutiya).
-# The Sakha districts are: Verkhoyanskij, Tomponskij, Ust'-Majskij,
+
+# From Oscar van Vlijmen (2009-11-29):
+# The Sakha districts are: Bulunskij, Verkhoyanskij, Tomponskij, Ust'-Majskij,
 # Ust'-Yanskij.
 Zone Asia/Vladivostok	 8:47:44 -	LMT	1922 Nov 15
 			 9:00	-	VLAT	1930 Jun 21 # Vladivostok Time
@@ -2188,8 +2198,10 @@
 # From Oscar van Vlijmen (2003-10-18): [This region consists of]
 # Magadanskaya oblast', Respublika Sakha (Yakutiya).
 # Probably also: Kuril Islands.
-# The Sakha districts are: Abyjskij, Allaikhovskij, Momskij,
-# Nizhnekolymskij, Ojmyakonskij.
+
+# From Oscar van Vlijmen (2009-11-29):
+# The Sakha districts are: Abyjskij, Allaikhovskij, Verkhhhnekolymskij, Momskij,
+# Nizhnekolymskij, Ojmyakonskij, Srednekolymskij.
 Zone Asia/Magadan	10:03:12 -	LMT	1924 May  2
 			10:00	-	MAGT	1930 Jun 21 # Magadan Time
 			11:00	Russia	MAG%sT	1991 Mar 31 2:00s
--- a/jdk/make/sun/javazic/tzdata/northamerica	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/make/sun/javazic/tzdata/northamerica	Fri Mar 26 11:10:26 2010 -0400
@@ -1977,6 +1977,58 @@
 # http://www.conae.gob.mx/ahorro/horaver2001_m1_2002.html (2002-02-20)
 # confirms this.  Sonora as usual is the only state where DST is not applied.
 
+# From Steffen Thorsen (2009-12-28):
+#
+# Steffen Thorsen wrote:
+# > Mexico's House of Representatives has approved a proposal for northern
+# > Mexico's border cities to share the same daylight saving schedule as
+# > the United States.
+# Now this has passed both the Congress and the Senate, so starting from
+# 2010, some border regions will be the same:
+# <a href="http://www.signonsandiego.com/news/2009/dec/28/clocks-will-match-both-sides-border/">
+# http://www.signonsandiego.com/news/2009/dec/28/clocks-will-match-both-sides-border/
+# </a>
+# <a href="http://www.elmananarey.com/diario/noticia/nacional/noticias/empatan_horario_de_frontera_con_eu/621939">
+# http://www.elmananarey.com/diario/noticia/nacional/noticias/empatan_horario_de_frontera_con_eu/621939
+# </a>
+# (Spanish)
+#
+# Could not find the new law text, but the proposed law text changes are here:
+# <a href="http://gaceta.diputados.gob.mx/Gaceta/61/2009/dic/20091210-V.pdf">
+# http://gaceta.diputados.gob.mx/Gaceta/61/2009/dic/20091210-V.pdf
+# </a>
+# (Gaceta Parlamentaria)
+#
+# There is also a list of the votes here:
+# <a href="http://gaceta.diputados.gob.mx/Gaceta/61/2009/dic/V2-101209.html">
+# http://gaceta.diputados.gob.mx/Gaceta/61/2009/dic/V2-101209.html
+# </a>
+#
+# Our page:
+# <a href="http://www.timeanddate.com/news/time/north-mexico-dst-change.html">
+# http://www.timeanddate.com/news/time/north-mexico-dst-change.html
+# </a>
+
+# From Arthur David Olson (2010-01-20):
+# The page
+# <a href="http://dof.gob.mx/nota_detalle.php?codigo=5127480&fecha=06/01/2010">
+# http://dof.gob.mx/nota_detalle.php?codigo=5127480&fecha=06/01/2010
+# </a>
+# includes this text:
+# En los municipios fronterizos de Tijuana y Mexicali en Baja California;
+# Ju&aacute;rez y Ojinaga en Chihuahua; Acu&ntilde;a y Piedras Negras en Coahuila;
+# An&aacute;huac en Nuevo Le&oacute;n; y Nuevo Laredo, Reynosa y Matamoros en
+# Tamaulipas, la aplicaci&oacute;n de este horario estacional surtir&aacute; efecto
+# desde las dos horas del segundo domingo de marzo y concluir&aacute; a las dos
+# horas del primer domingo de noviembre.
+# En los municipios fronterizos que se encuentren ubicados en la franja
+# fronteriza norte en el territorio comprendido entre la l&iacute;nea
+# internacional y la l&iacute;nea paralela ubicada a una distancia de veinte
+# kil&oacute;metros, as&iacute; como la Ciudad de Ensenada, Baja California, hacia el
+# interior del pa&iacute;s, la aplicaci&oacute;n de este horario estacional surtir&aacute;
+# efecto desde las dos horas del segundo domingo de marzo y concluir&aacute; a
+# las dos horas del primer domingo de noviembre.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Mexico	1939	only	-	Feb	5	0:00	1:00	D
 Rule	Mexico	1939	only	-	Jun	25	0:00	0	S
@@ -2003,13 +2055,19 @@
 			-6:00	-	CST	1981 Dec 23
 			-5:00	-	EST	1982 Dec  2
 			-6:00	Mexico	C%sT
-# Coahuila, Durango, Nuevo Leon, Tamaulipas
+# Coahuila, Durango, Nuevo Leon, Tamaulipas (near US border)
+Zone America/Matamoros	-6:40:00 -	LMT	1921 Dec 31 23:20:00
+			-6:00	-	CST	1988
+			-6:00	US	C%sT	1989
+			-6:00	Mexico	C%sT	2010
+			-6:00	US	C%sT
+# Coahuila, Durango, Nuevo Leon, Tamaulipas (away from US border)
 Zone America/Monterrey	-6:41:16 -	LMT	1921 Dec 31 23:18:44
 			-6:00	-	CST	1988
 			-6:00	US	C%sT	1989
 			-6:00	Mexico	C%sT
 # Central Mexico
-Zone America/Mexico_City -6:36:36 -	LMT	1922 Jan  1  0:23:24
+Zone America/Mexico_City -6:36:36 -	LMT	1922 Jan  1 0:23:24
 			-7:00	-	MST	1927 Jun 10 23:00
 			-6:00	-	CST	1930 Nov 15
 			-7:00	-	MST	1931 May  1 23:00
@@ -2018,7 +2076,19 @@
 			-6:00	Mexico	C%sT	2001 Sep 30 02:00
 			-6:00	-	CST	2002 Feb 20
 			-6:00	Mexico	C%sT
-# Chihuahua
+# Chihuahua (near US border)
+Zone America/Ojinaga	-6:57:40 -	LMT	1922 Jan 1 0:02:20
+			-7:00	-	MST	1927 Jun 10 23:00
+			-6:00	-	CST	1930 Nov 15
+			-7:00	-	MST	1931 May  1 23:00
+			-6:00	-	CST	1931 Oct
+			-7:00	-	MST	1932 Apr  1
+			-6:00	-	CST	1996
+			-6:00	Mexico	C%sT	1998
+			-6:00	-	CST	1998 Apr Sun>=1 3:00
+			-7:00	Mexico	M%sT	2010
+			-7:00	US	M%sT
+# Chihuahua (away from US border)
 Zone America/Chihuahua	-7:04:20 -	LMT	1921 Dec 31 23:55:40
 			-7:00	-	MST	1927 Jun 10 23:00
 			-6:00	-	CST	1930 Nov 15
@@ -2052,7 +2122,7 @@
 			-7:00	-	MST	1949 Jan 14
 			-8:00	-	PST	1970
 			-7:00	Mexico	M%sT
-# Baja California
+# Baja California (near US border)
 Zone America/Tijuana	-7:48:04 -	LMT	1922 Jan  1  0:11:56
 			-7:00	-	MST	1924
 			-8:00	-	PST	1927 Jun 10 23:00
@@ -2070,6 +2140,26 @@
 			-8:00	US	P%sT	1996
 			-8:00	Mexico	P%sT	2001
 			-8:00	US	P%sT	2002 Feb 20
+			-8:00	Mexico	P%sT	2010
+			-8:00	US	P%sT
+# Baja California (away from US border)
+Zone America/Santa_Isabel	-7:39:28 -	LMT	1922 Jan  1  0:20:32
+			-7:00	-	MST	1924
+			-8:00	-	PST	1927 Jun 10 23:00
+			-7:00	-	MST	1930 Nov 15
+			-8:00	-	PST	1931 Apr  1
+			-8:00	1:00	PDT	1931 Sep 30
+			-8:00	-	PST	1942 Apr 24
+			-8:00	1:00	PWT	1945 Aug 14 23:00u
+			-8:00	1:00	PPT	1945 Nov 12 # Peace
+			-8:00	-	PST	1948 Apr  5
+			-8:00	1:00	PDT	1949 Jan 14
+			-8:00	-	PST	1954
+			-8:00	CA	P%sT	1961
+			-8:00	-	PST	1976
+			-8:00	US	P%sT	1996
+			-8:00	Mexico	P%sT	2001
+			-8:00	US	P%sT	2002 Feb 20
 			-8:00	Mexico	P%sT
 # From Paul Eggert (2006-03-22):
 # Formerly there was an America/Ensenada zone, which differed from
--- a/jdk/make/sun/javazic/tzdata/zone.tab	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/make/sun/javazic/tzdata/zone.tab	Fri Mar 26 11:10:26 2010 -0400
@@ -301,11 +301,14 @@
 MX	+1924-09909	America/Mexico_City	Central Time - most locations
 MX	+2105-08646	America/Cancun	Central Time - Quintana Roo
 MX	+2058-08937	America/Merida	Central Time - Campeche, Yucatan
-MX	+2540-10019	America/Monterrey	Central Time - Coahuila, Durango, Nuevo Leon, Tamaulipas
+MX	+2540-10019	America/Monterrey	Mexican Central Time - Coahuila, Durango, Nuevo Leon, Tamaulipas away from US border
+MX	+2550-09730	America/Matamoros	US Central Time - Coahuila, Durango, Nuevo Leon, Tamaulipas near US border
 MX	+2313-10625	America/Mazatlan	Mountain Time - S Baja, Nayarit, Sinaloa
-MX	+2838-10605	America/Chihuahua	Mountain Time - Chihuahua
+MX	+2838-10605	America/Chihuahua	Mexican Mountain Time - Chihuahua away from US border
+MX	+2934-10425	America/Ojinaga	US Mountain Time - Chihuahua near US border
 MX	+2904-11058	America/Hermosillo	Mountain Standard Time - Sonora
-MX	+3232-11701	America/Tijuana	Pacific Time
+MX	+3232-11701	America/Tijuana	US Pacific Time - Baja California near US border
+MX	+3018-11452	America/Santa_Isabel	Mexican Pacific Time - Baja California away from US border
 MY	+0310+10142	Asia/Kuala_Lumpur	peninsular Malaysia
 MY	+0133+11020	Asia/Kuching	Sabah & Sarawak
 MZ	-2558+03235	Africa/Maputo
--- a/jdk/src/share/classes/com/sun/jndi/ldap/Filter.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/Filter.java	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-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
@@ -33,6 +33,7 @@
 /**
  * LDAP (RFC-1960) and LDAPv3 (RFC-2254) search filters.
  *
+ * @author Xuelei Fan
  * @author Vincent Ryan
  * @author Jagane Sundar
  * @author Rosanna Lee
@@ -258,7 +259,7 @@
         byte[] answer = new byte[j];
         System.arraycopy(tbuf, 0, answer, 0, j);
         if (dbg) {
-            Ber.dumpBER(System.err, null, answer, 0, j);
+            Ber.dumpBER(System.err, "", answer, 0, j);
         }
         return answer;
     }
@@ -330,7 +331,7 @@
         }
 
 
-        valueStart = eq + 1;            // value starts after equal sign
+        valueStart = eq + 1;        // value starts after equal sign
         valueEnd = filtEnd;
         typeStart = filtStart;      // beginning of string
 
@@ -355,20 +356,199 @@
             break;
         default:
             typeEnd = eq;
+            //initializing ftype to make the compiler happy
+            ftype = 0x00;
+            break;
+        }
+
+        if (dbg) {
+            System.err.println("type: " + typeStart + ", " + typeEnd);
+            System.err.println("value: " + valueStart + ", " + valueEnd);
+        }
+
+        // check validity of type
+        //
+        // RFC4512 defines the type as the following ABNF:
+        //     attr = attributedescription
+        //     attributedescription = attributetype options
+        //     attributetype = oid
+        //     oid = descr / numericoid
+        //     descr = keystring
+        //     keystring = leadkeychar *keychar
+        //     leadkeychar = ALPHA
+        //     keychar = ALPHA / DIGIT / HYPHEN
+        //     numericoid = number 1*( DOT number )
+        //     number  = DIGIT / ( LDIGIT 1*DIGIT )
+        //     options = *( SEMI option )
+        //     option = 1*keychar
+        //
+        // And RFC4515 defines the extensible type as the following ABNF:
+        //     attr [dnattrs] [matchingrule] / [dnattrs] matchingrule
+        int optionsStart = -1;
+        int extensibleStart = -1;
+        if ((filter[typeStart] >= '0' && filter[typeStart] <= '9') ||
+            (filter[typeStart] >= 'A' && filter[typeStart] <= 'Z') ||
+            (filter[typeStart] >= 'a' && filter[typeStart] <= 'z')) {
+
+            boolean isNumericOid =
+                filter[typeStart] >= '0' && filter[typeStart] <= '9';
+            for (int i = typeStart + 1; i < typeEnd; i++) {
+                // ';' is an indicator of attribute options
+                if (filter[i] == ';') {
+                    if (isNumericOid && filter[i - 1] == '.') {
+                        throw new InvalidSearchFilterException(
+                                    "invalid attribute description");
+                    }
+
+                    // attribute options
+                    optionsStart = i;
+                    break;
+                }
+
+                // ':' is an indicator of extensible rules
+                if (filter[i] == ':' && ftype == LDAP_FILTER_EXT) {
+                    if (isNumericOid && filter[i - 1] == '.') {
+                        throw new InvalidSearchFilterException(
+                                    "invalid attribute description");
+                    }
+
+                    // extensible matching
+                    extensibleStart = i;
+                    break;
+                }
+
+                if (isNumericOid) {
+                    // numeric object identifier
+                    if ((filter[i] == '.' && filter[i - 1] == '.') ||
+                        (filter[i] != '.' &&
+                            !(filter[i] >= '0' && filter[i] <= '9'))) {
+                        throw new InvalidSearchFilterException(
+                                    "invalid attribute description");
+                    }
+                } else {
+                    // descriptor
+                    if (filter[i] != '-' &&
+                        !(filter[i] >= '0' && filter[i] <= '9') &&
+                        !(filter[i] >= 'A' && filter[i] <= 'Z') &&
+                        !(filter[i] >= 'a' && filter[i] <= 'z')) {
+                        throw new InvalidSearchFilterException(
+                                    "invalid attribute description");
+                    }
+                }
+            }
+        } else if (ftype == LDAP_FILTER_EXT && filter[typeStart] == ':') {
+            // extensible matching
+            extensibleStart = typeStart;
+        } else {
+            throw new InvalidSearchFilterException(
+                                    "invalid attribute description");
+        }
+
+        // check attribute options
+        if (optionsStart > 0) {
+            for (int i = optionsStart + 1; i < typeEnd; i++) {
+                if (filter[i] == ';') {
+                    if (filter[i - 1] == ';') {
+                        throw new InvalidSearchFilterException(
+                                    "invalid attribute description");
+                    }
+                    continue;
+                }
+
+                // ':' is an indicator of extensible rules
+                if (filter[i] == ':' && ftype == LDAP_FILTER_EXT) {
+                    if (filter[i - 1] == ';') {
+                        throw new InvalidSearchFilterException(
+                                    "invalid attribute description");
+                    }
+
+                    // extensible matching
+                    extensibleStart = i;
+                    break;
+                }
+
+                if (filter[i] != '-' &&
+                        !(filter[i] >= '0' && filter[i] <= '9') &&
+                        !(filter[i] >= 'A' && filter[i] <= 'Z') &&
+                        !(filter[i] >= 'a' && filter[i] <= 'z')) {
+                    throw new InvalidSearchFilterException(
+                                    "invalid attribute description");
+                }
+            }
+        }
+
+        // check extensible matching
+        if (extensibleStart > 0) {
+            boolean isMatchingRule = false;
+            for (int i = extensibleStart + 1; i < typeEnd; i++) {
+                if (filter[i] == ':') {
+                    throw new InvalidSearchFilterException(
+                                    "invalid attribute description");
+                } else if ((filter[i] >= '0' && filter[i] <= '9') ||
+                           (filter[i] >= 'A' && filter[i] <= 'Z') ||
+                           (filter[i] >= 'a' && filter[i] <= 'z')) {
+                    boolean isNumericOid = filter[i] >= '0' && filter[i] <= '9';
+                    i++;
+                    for (int j = i; j < typeEnd; j++, i++) {
+                        // allows no more than two extensible rules
+                        if (filter[j] == ':') {
+                            if (isMatchingRule) {
+                                throw new InvalidSearchFilterException(
+                                            "invalid attribute description");
+                            }
+                            if (isNumericOid && filter[j - 1] == '.') {
+                                throw new InvalidSearchFilterException(
+                                            "invalid attribute description");
+                            }
+
+                            isMatchingRule = true;
+                            break;
+                        }
+
+                        if (isNumericOid) {
+                            // numeric object identifier
+                            if ((filter[j] == '.' && filter[j - 1] == '.') ||
+                                (filter[j] != '.' &&
+                                    !(filter[j] >= '0' && filter[j] <= '9'))) {
+                                throw new InvalidSearchFilterException(
+                                            "invalid attribute description");
+                            }
+                        } else {
+                            // descriptor
+                            if (filter[j] != '-' &&
+                                !(filter[j] >= '0' && filter[j] <= '9') &&
+                                !(filter[j] >= 'A' && filter[j] <= 'Z') &&
+                                !(filter[j] >= 'a' && filter[j] <= 'z')) {
+                                throw new InvalidSearchFilterException(
+                                            "invalid attribute description");
+                            }
+                        }
+                    }
+                } else {
+                    throw new InvalidSearchFilterException(
+                                    "invalid attribute description");
+                }
+            }
+        }
+
+        // ensure the latest byte is not isolated
+        if (filter[typeEnd - 1] == '.' || filter[typeEnd - 1] == ';' ||
+                                          filter[typeEnd - 1] == ':') {
+            throw new InvalidSearchFilterException(
+                "invalid attribute description");
+        }
+
+        if (typeEnd == eq) { // filter type is of "equal"
             if (findUnescaped(filter, '*', valueStart, valueEnd) == -1) {
                 ftype = LDAP_FILTER_EQUALITY;
-            } else if (filter[valueStart] == '*' && valueStart == (valueEnd - 1)) {
+            } else if (filter[valueStart] == '*' &&
+                            valueStart == (valueEnd - 1)) {
                 ftype = LDAP_FILTER_PRESENT;
             } else {
                 encodeSubstringFilter(ber, filter,
                     typeStart, typeEnd, valueStart, valueEnd);
                 return;
             }
-            break;
-        }
-        if (dbg) {
-            System.err.println("type: " + typeStart + ", " + typeEnd);
-            System.err.println("value: " + valueStart + ", " + valueEnd);
         }
 
         if (ftype == LDAP_FILTER_PRESENT) {
@@ -379,7 +559,7 @@
         } else {
             ber.beginSeq(ftype);
                 ber.encodeOctetString(filter, Ber.ASN_OCTET_STR,
-                    typeStart, typeEnd-typeStart);
+                    typeStart, typeEnd - typeStart);
                 ber.encodeOctetString(
                     unescapeFilterValue(filter, valueStart, valueEnd),
                     Ber.ASN_OCTET_STR);
@@ -623,7 +803,8 @@
     //
     ////////////////////////////////////////////////////////////////////////////
 
-    private static final boolean dbg = false;
+    // private static final boolean dbg = false;
+    private static final boolean dbg = true;
     private static int dbgIndent = 0;
 
     private static void dprint(String msg) {
--- a/jdk/src/share/classes/java/awt/AlphaComposite.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/java/awt/AlphaComposite.java	Fri Mar 26 11:10:26 2010 -0400
@@ -614,14 +614,15 @@
     }
 
     private AlphaComposite(int rule, float alpha) {
-        if (alpha < 0.0f || alpha > 1.0f) {
-            throw new IllegalArgumentException("alpha value out of range");
-        }
         if (rule < MIN_RULE || rule > MAX_RULE) {
             throw new IllegalArgumentException("unknown composite rule");
         }
-        this.rule = rule;
-        this.extraAlpha = alpha;
+        if (alpha >= 0.0f && alpha <= 1.0f) {
+            this.rule = rule;
+            this.extraAlpha = alpha;
+        } else {
+            throw new IllegalArgumentException("alpha value out of range");
+        }
     }
 
     /**
--- a/jdk/src/share/classes/java/beans/BeanDescriptor.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/java/beans/BeanDescriptor.java	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1996-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1996-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
@@ -101,4 +101,9 @@
         beanClassRef = old.beanClassRef;
         customizerClassRef = old.customizerClassRef;
     }
+
+    void appendTo(StringBuilder sb) {
+        appendTo(sb, "beanClass", this.beanClassRef);
+        appendTo(sb, "customizerClass", this.customizerClassRef);
+    }
 }
--- a/jdk/src/share/classes/java/beans/EventSetDescriptor.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/java/beans/EventSetDescriptor.java	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1996-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1996-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
@@ -26,7 +26,6 @@
 package java.beans;
 
 import java.lang.ref.Reference;
-
 import java.lang.reflect.Method;
 
 /**
@@ -357,8 +356,7 @@
      * @return The method used to register a listener at the event source.
      */
     public synchronized Method getAddListenerMethod() {
-        return (addMethodDescriptor != null ?
-                    addMethodDescriptor.getMethod() : null);
+        return getMethod(this.addMethodDescriptor);
     }
 
     private synchronized void setAddListenerMethod(Method method) {
@@ -378,8 +376,7 @@
      * @return The method used to remove a listener at the event source.
      */
     public synchronized Method getRemoveListenerMethod() {
-        return (removeMethodDescriptor != null ?
-                    removeMethodDescriptor.getMethod() : null);
+        return getMethod(this.removeMethodDescriptor);
     }
 
     private synchronized void setRemoveListenerMethod(Method method) {
@@ -401,8 +398,7 @@
      * @since 1.4
      */
     public synchronized Method getGetListenerMethod() {
-        return (getMethodDescriptor != null ?
-                    getMethodDescriptor.getMethod() : null);
+        return getMethod(this.getMethodDescriptor);
     }
 
     private synchronized void setGetListenerMethod(Method method) {
@@ -522,4 +518,19 @@
         unicast = old.unicast;
         inDefaultEventSet = old.inDefaultEventSet;
     }
+
+    void appendTo(StringBuilder sb) {
+        appendTo(sb, "unicast", this.unicast);
+        appendTo(sb, "inDefaultEventSet", this.inDefaultEventSet);
+        appendTo(sb, "listenerType", this.listenerTypeRef);
+        appendTo(sb, "getListenerMethod", getMethod(this.getMethodDescriptor));
+        appendTo(sb, "addListenerMethod", getMethod(this.addMethodDescriptor));
+        appendTo(sb, "removeListenerMethod", getMethod(this.removeMethodDescriptor));
+    }
+
+    private static Method getMethod(MethodDescriptor descriptor) {
+        return (descriptor != null)
+                ? descriptor.getMethod()
+                : null;
+    }
 }
--- a/jdk/src/share/classes/java/beans/FeatureDescriptor.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/java/beans/FeatureDescriptor.java	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1996-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1996-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
@@ -35,6 +35,7 @@
 
 import java.util.Enumeration;
 import java.util.Hashtable;
+import java.util.Map.Entry;
 
 /**
  * The FeatureDescriptor class is the common baseclass for PropertyDescriptor,
@@ -393,4 +394,52 @@
     private String name;
     private String displayName;
     private Hashtable<String, Object> table;
+
+    /**
+     * Returns a string representation of the object.
+     *
+     * @return a string representation of the object
+     *
+     * @since 1.7
+     */
+    public String toString() {
+        StringBuilder sb = new StringBuilder(getClass().getName());
+        sb.append("[name=").append(this.name);
+        appendTo(sb, "displayName", this.displayName);
+        appendTo(sb, "shortDescription", this.shortDescription);
+        appendTo(sb, "preferred", this.preferred);
+        appendTo(sb, "hidden", this.hidden);
+        appendTo(sb, "expert", this.expert);
+        if ((this.table != null) && !this.table.isEmpty()) {
+            sb.append("; values={");
+            for (Entry<String, Object> entry : this.table.entrySet()) {
+                sb.append(entry.getKey()).append("=").append(entry.getValue()).append("; ");
+            }
+            sb.setLength(sb.length() - 2);
+            sb.append("}");
+        }
+        appendTo(sb);
+        return sb.append("]").toString();
+    }
+
+    void appendTo(StringBuilder sb) {
+    }
+
+    static void appendTo(StringBuilder sb, String name, Reference reference) {
+        if (reference != null) {
+            appendTo(sb, name, reference.get());
+        }
+    }
+
+    static void appendTo(StringBuilder sb, String name, Object value) {
+        if (value != null) {
+            sb.append("; ").append(name).append("=").append(value);
+        }
+    }
+
+    static void appendTo(StringBuilder sb, String name, boolean value) {
+        if (value) {
+            sb.append("; ").append(name);
+        }
+    }
 }
--- a/jdk/src/share/classes/java/beans/IndexedPropertyChangeEvent.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/java/beans/IndexedPropertyChangeEvent.java	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-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
@@ -62,7 +62,6 @@
         this.index = index;
     }
 
-
     /**
      * Gets the index of the property that was changed.
      *
@@ -72,4 +71,8 @@
     public int getIndex() {
         return index;
     }
+
+    void appendTo(StringBuilder sb) {
+        sb.append("; index=").append(getIndex());
+    }
 }
--- a/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1996-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1996-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
@@ -26,7 +26,6 @@
 package java.beans;
 
 import java.lang.ref.Reference;
-
 import java.lang.reflect.Method;
 
 /**
@@ -117,8 +116,7 @@
      * This constructor takes the name of a simple property, and Method
      * objects for reading and writing the property.
      *
-     * @param propertyName The programmatic name of the pro
-perty.
+     * @param propertyName The programmatic name of the property.
      * @param readMethod The method used for reading the property values as an array.
      *          May be null if the property is write-only or must be indexed.
      * @param writeMethod The method used for writing the property values as an array.
@@ -518,20 +516,10 @@
         return result;
     }
 
-    /*
-    public String toString() {
-        String message = super.toString();
-
-        message += ", indexedType=";
-        message += getIndexedPropertyType();
-
-        message += ", indexedWriteMethod=";
-        message += indexedWriteMethodName;
-
-        message += ", indexedReadMethod=";
-        message += indexedReadMethodName;
-
-        return message;
+    void appendTo(StringBuilder sb) {
+        super.appendTo(sb);
+        appendTo(sb, "indexedPropertyType", this.indexedPropertyTypeRef);
+        appendTo(sb, "indexedReadMethod", this.indexedReadMethodRef);
+        appendTo(sb, "indexedWriteMethod", this.indexedWriteMethodRef);
     }
-    */
 }
--- a/jdk/src/share/classes/java/beans/MethodDescriptor.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/java/beans/MethodDescriptor.java	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1996-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1996-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
@@ -27,9 +27,7 @@
 
 import java.lang.ref.Reference;
 import java.lang.ref.WeakReference;
-
 import java.lang.reflect.Method;
-
 import java.util.List;
 import java.util.ArrayList;
 
@@ -167,23 +165,6 @@
     }
 
     /*
-    public String toString() {
-        String message = "name=" + getName();
-        Class cls = getClass0();
-        if (cls != null) {
-            message += ", class=";
-            message += cls.getName();
-        }
-        String[] names = getParamNames();
-        if (names != null) {
-            for (int i = 0; i < names.length; i++) {
-                message += ", param=" + names[i];
-            }
-        }
-        return message;
-        } */
-
-    /*
      * Package-private constructor
      * Merge two method descriptors.  Where they conflict, give the
      * second argument (y) priority over the first argument (x).
@@ -233,4 +214,15 @@
         }
     }
 
+    void appendTo(StringBuilder sb) {
+        appendTo(sb, "method", this.methodRef);
+        if (this.parameterDescriptors != null) {
+            sb.append("; parameterDescriptors={");
+            for (ParameterDescriptor pd : this.parameterDescriptors) {
+                sb.append(pd).append(", ");
+            }
+            sb.setLength(sb.length() - 2);
+            sb.append("}");
+        }
+    }
 }
--- a/jdk/src/share/classes/java/beans/PropertyChangeEvent.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/java/beans/PropertyChangeEvent.java	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1996-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1996-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
@@ -140,4 +140,25 @@
      * @see #getPropagationId
      */
     private Object propagationId;
+
+    /**
+     * Returns a string representation of the object.
+     *
+     * @return a string representation of the object
+     *
+     * @since 1.7
+     */
+    public String toString() {
+        StringBuilder sb = new StringBuilder(getClass().getName());
+        sb.append("[propertyName=").append(getPropertyName());
+        appendTo(sb);
+        sb.append("; oldValue=").append(getOldValue());
+        sb.append("; newValue=").append(getNewValue());
+        sb.append("; propagationId=").append(getPropagationId());
+        sb.append("; source=").append(getSource());
+        return sb.append("]").toString();
+    }
+
+    void appendTo(StringBuilder sb) {
+    }
 }
--- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 1996-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1996-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
@@ -26,7 +26,6 @@
 package java.beans;
 
 import java.lang.ref.Reference;
-
 import java.lang.reflect.Method;
 import java.lang.reflect.Constructor;
 
@@ -710,22 +709,12 @@
         return baseName;
     }
 
-    /*
-    public String toString() {
-        String message = "name=" + getName();
-        message += ", class=" + getClass0();
-        message += ", type=" + getPropertyType();
-
-        message += ", writeMethod=";
-        message += writeMethodName;
-
-        message += ", readMethod=";
-        message += readMethodName;
-
-        message += ", bound=" + bound;
-        message += ", constrained=" + constrained;
-
-        return message;
+    void appendTo(StringBuilder sb) {
+        appendTo(sb, "bound", this.bound);
+        appendTo(sb, "constrained", this.constrained);
+        appendTo(sb, "propertyEditorClass", this.propertyEditorClassRef);
+        appendTo(sb, "propertyType", this.propertyTypeRef);
+        appendTo(sb, "readMethod", this.readMethodRef);
+        appendTo(sb, "writeMethod", this.writeMethodRef);
     }
-    */
 }
--- a/jdk/src/share/classes/java/beans/XMLEncoder.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/java/beans/XMLEncoder.java	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-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
@@ -214,8 +214,8 @@
     private Object owner;
     private int indentation = 0;
     private boolean internal = false;
-    private Map valueToExpression;
-    private Map targetToStatementList;
+    private Map<Object, ValueData> valueToExpression;
+    private Map<Object, List<Statement>> targetToStatementList;
     private boolean preambleWritten = false;
     private NameGenerator nameGenerator;
 
@@ -287,8 +287,8 @@
         this.declaration = declaration;
         this.indentation = indentation;
         this.out = new OutputStreamWriter(out, cs.newEncoder());
-        valueToExpression = new IdentityHashMap();
-        targetToStatementList = new IdentityHashMap();
+        valueToExpression = new IdentityHashMap<Object, ValueData>();
+        targetToStatementList = new IdentityHashMap<Object, List<Statement>>();
         nameGenerator = new NameGenerator();
     }
 
@@ -331,13 +331,12 @@
         }
     }
 
-    private Vector statementList(Object target) {
-        Vector list = (Vector)targetToStatementList.get(target);
-        if (list != null) {
-            return list;
+    private List<Statement> statementList(Object target) {
+        List<Statement> list = targetToStatementList.get(target);
+        if (list == null) {
+            list = new ArrayList<Statement>();
+            targetToStatementList.put(target, list);
         }
-        list = new Vector();
-        targetToStatementList.put(target, list);
         return list;
     }
 
@@ -363,13 +362,13 @@
         }
         d.marked = true;
         Object target = exp.getTarget();
+        mark(exp);
         if (!(target instanceof Class)) {
             statementList(target).add(exp);
             // Pending: Why does the reference count need to
             // be incremented here?
             d.refs++;
         }
-        mark(exp);
     }
 
     private void mark(Statement stm) {
@@ -463,9 +462,9 @@
             preambleWritten = true;
         }
         indentation++;
-        Vector roots = statementList(this);
-        for(int i = 0; i < roots.size(); i++) {
-            Statement s = (Statement)roots.get(i);
+        List<Statement> statements = statementList(this);
+        while (!statements.isEmpty()) {
+            Statement s = statements.remove(0);
             if ("writeObject".equals(s.getMethodName())) {
                 outputValue(s.getArguments()[0], this, true);
             }
@@ -513,7 +512,7 @@
     }
 
     private ValueData getValueData(Object o) {
-        ValueData d = (ValueData)valueToExpression.get(o);
+        ValueData d = valueToExpression.get(o);
         if (d == null) {
             d = new ValueData();
             valueToExpression.put(o, d);
@@ -619,11 +618,11 @@
         }
 
         if (d.name != null) {
-            writeln("<object idref=" + quote(d.name) + "/>");
-            return;
+            outputXML(isArgument ? "object" : "void", " idref=" + quote(d.name), value);
         }
-
-        outputStatement(d.exp, outer, isArgument);
+        else if (d.exp != null) {
+            outputStatement(d.exp, outer, isArgument);
+        }
     }
 
     private static String quoteCharCode(int code) {
@@ -683,13 +682,6 @@
         String tag = (expression && isArgument) ? "object" : "void";
         String attributes = "";
         ValueData d = getValueData(value);
-        if (expression) {
-            if (d.refs > 1) {
-                String instanceName = nameGenerator.instanceName(value);
-                d.name = instanceName;
-                attributes = attributes + " id=" + quote(instanceName);
-            }
-        }
 
         // Special cases for targets.
         if (target == outer) {
@@ -706,13 +698,19 @@
         else {
             d.refs = 2;
             getValueData(target).refs++;
+            List<Statement> statements = statementList(target);
+            if (!statements.contains(exp)) {
+                statements.add(exp);
+            }
             outputValue(target, outer, false);
-            if (isArgument) {
-                outputValue(value, outer, false);
-            }
+            outputValue(value, outer, isArgument);
             return;
         }
-
+        if (expression && (d.refs > 1)) {
+            String instanceName = nameGenerator.instanceName(value);
+            d.name = instanceName;
+            attributes = attributes + " id=" + quote(instanceName);
+        }
 
         // Special cases for methods.
         if ((!expression && methodName.equals("set") && args.length == 2 &&
@@ -730,8 +728,11 @@
         else if (!methodName.equals("new") && !methodName.equals("newInstance")) {
             attributes = attributes + " method=" + quote(methodName);
         }
+        outputXML(tag, attributes, value, args);
+    }
 
-        Vector statements = statementList(value);
+    private void outputXML(String tag, String attributes, Object value, Object... args) {
+        List<Statement> statements = statementList(value);
         // Use XML's short form when there is no body.
         if (args.length == 0 && statements.size() == 0) {
             writeln("<" + tag + attributes + "/>");
@@ -745,8 +746,8 @@
             outputValue(args[i], null, true);
         }
 
-        for(int i = 0; i < statements.size(); i++) {
-            Statement s = (Statement)statements.get(i);
+        while (!statements.isEmpty()) {
+            Statement s = statements.remove(0);
             outputStatement(s, value, false);
         }
 
--- a/jdk/src/share/classes/java/lang/Iterable.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/java/lang/Iterable.java	Fri Mar 26 11:10:26 2010 -0400
@@ -27,8 +27,12 @@
 
 import java.util.Iterator;
 
-/** Implementing this interface allows an object to be the target of
- *  the "foreach" statement.
+/**
+ * Implementing this interface allows an object to be the target of
+ * the "foreach" statement.
+ *
+ * @param <T> the type of elements returned by the iterator
+ *
  * @since 1.5
  */
 public interface Iterable<T> {
--- a/jdk/src/share/classes/java/lang/String.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/java/lang/String.java	Fri Mar 26 11:10:26 2010 -0400
@@ -1492,7 +1492,7 @@
      */
     public int hashCode() {
         int h = hash;
-        if (h == 0) {
+        if (h == 0 && count > 0) {
             int off = offset;
             char val[] = value;
             int len = count;
--- a/jdk/src/share/classes/java/security/IdentityScope.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/java/security/IdentityScope.java	Fri Mar 26 11:10:26 2010 -0400
@@ -129,7 +129,8 @@
     /**
      * Returns the system's identity scope.
      *
-     * @return the system's identity scope.
+     * @return the system's identity scope, or {@code null} if none has been
+     *         set.
      *
      * @see #setSystemScope
      */
--- a/jdk/src/share/classes/java/util/Collection.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/java/util/Collection.java	Fri Mar 26 11:10:26 2010 -0400
@@ -103,6 +103,8 @@
  * <a href="{@docRoot}/../technotes/guides/collections/index.html">
  * Java Collections Framework</a>.
  *
+ * @param <E> the type of elements in this collection
+ *
  * @author  Josh Bloch
  * @author  Neal Gafter
  * @see     Set
--- a/jdk/src/share/classes/java/util/DualPivotQuicksort.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/java/util/DualPivotQuicksort.java	Fri Mar 26 11:10:26 2010 -0400
@@ -253,7 +253,7 @@
                         a[less] = ak;
                     }
                     less++;
-                } else { // (a[k] > pivot1) -  Move a[k] to right part
+                } else { // (a[k] > pivot1) - Move a[k] to right part
                     /*
                      * We know that pivot1 == a[e3] == pivot2. Thus, we know
                      * that great will still be >= k when the following loop
@@ -531,7 +531,7 @@
                         a[less] = ak;
                     }
                     less++;
-                } else { // (a[k] > pivot1) -  Move a[k] to right part
+                } else { // (a[k] > pivot1) - Move a[k] to right part
                     /*
                      * We know that pivot1 == a[e3] == pivot2. Thus, we know
                      * that great will still be >= k when the following loop
@@ -826,7 +826,7 @@
                         a[less] = ak;
                     }
                     less++;
-                } else { // (a[k] > pivot1) -  Move a[k] to right part
+                } else { // (a[k] > pivot1) - Move a[k] to right part
                     /*
                      * We know that pivot1 == a[e3] == pivot2. Thus, we know
                      * that great will still be >= k when the following loop
@@ -1119,7 +1119,7 @@
                         a[less] = ak;
                     }
                     less++;
-                } else { // (a[k] > pivot1) -  Move a[k] to right part
+                } else { // (a[k] > pivot1) - Move a[k] to right part
                     /*
                      * We know that pivot1 == a[e3] == pivot2. Thus, we know
                      * that great will still be >= k when the following loop
@@ -1414,7 +1414,7 @@
                         a[less] = ak;
                     }
                     less++;
-                } else { // (a[k] > pivot1) -  Move a[k] to right part
+                } else { // (a[k] > pivot1) - Move a[k] to right part
                     /*
                      * We know that pivot1 == a[e3] == pivot2. Thus, we know
                      * that great will still be >= k when the following loop
@@ -1531,7 +1531,7 @@
      * Sorts the specified range of the array into ascending order. The range
      * to be sorted extends from the index {@code fromIndex}, inclusive, to
      * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
-     * the range to be sorted is empty  and the call is a no-op).
+     * the range to be sorted is empty and the call is a no-op).
      *
      * <p>The {@code <} relation does not provide a total order on all float
      * values: {@code -0.0f == 0.0f} is {@code true} and a {@code Float.NaN}
@@ -1787,7 +1787,7 @@
                         a[less] = ak;
                     }
                     less++;
-                } else { // (a[k] > pivot1) -  Move a[k] to right part
+                } else { // (a[k] > pivot1) - Move a[k] to right part
                     /*
                      * We know that pivot1 == a[e3] == pivot2. Thus, we know
                      * that great will still be >= k when the following loop
@@ -2160,7 +2160,7 @@
                         a[less] = ak;
                     }
                     less++;
-                } else { // (a[k] > pivot1) -  Move a[k] to right part
+                } else { // (a[k] > pivot1) - Move a[k] to right part
                     /*
                      * We know that pivot1 == a[e3] == pivot2. Thus, we know
                      * that great will still be >= k when the following loop
--- a/jdk/src/share/classes/java/util/Iterator.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/java/util/Iterator.java	Fri Mar 26 11:10:26 2010 -0400
@@ -41,6 +41,8 @@
  * <a href="{@docRoot}/../technotes/guides/collections/index.html">
  * Java Collections Framework</a>.
  *
+ * @param <E> the type of elements returned by this iterator
+ *
  * @author  Josh Bloch
  * @see Collection
  * @see ListIterator
--- a/jdk/src/share/classes/java/util/List.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/java/util/List.java	Fri Mar 26 11:10:26 2010 -0400
@@ -89,6 +89,8 @@
  * <a href="{@docRoot}/../technotes/guides/collections/index.html">
  * Java Collections Framework</a>.
  *
+ * @param <E> the type of elements in this list
+ *
  * @author  Josh Bloch
  * @author  Neal Gafter
  * @see Collection
--- a/jdk/src/share/classes/javax/swing/JTable.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/JTable.java	Fri Mar 26 11:10:26 2010 -0400
@@ -2506,10 +2506,7 @@
         Color old = this.selectionForeground;
         this.selectionForeground = selectionForeground;
         firePropertyChange("selectionForeground", old, selectionForeground);
-        if ( !selectionForeground.equals(old) )
-        {
-            repaint();
-        }
+        repaint();
     }
 
     /**
@@ -2547,10 +2544,7 @@
         Color old = this.selectionBackground;
         this.selectionBackground = selectionBackground;
         firePropertyChange("selectionBackground", old, selectionBackground);
-        if ( !selectionBackground.equals(old) )
-        {
-            repaint();
-        }
+        repaint();
     }
 
     /**
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java	Fri Mar 26 11:10:26 2010 -0400
@@ -169,15 +169,13 @@
                                                     + c + " when it only knows about "
                                                     + slider + ".");
 
-        LookAndFeel.uninstallBorder(slider);
-
         scrollTimer.stop();
         scrollTimer = null;
 
+        uninstallDefaults(slider);
         uninstallListeners( slider );
         uninstallKeyboardActions(slider);
 
-        focusInsets = null;
         insetCache = null;
         leftToRightCache = true;
         focusRect = null;
@@ -210,6 +208,12 @@
         if (focusInsets == null) focusInsets = new InsetsUIResource(2,2,2,2);
     }
 
+    protected void uninstallDefaults(JSlider slider) {
+        LookAndFeel.uninstallBorder(slider);
+
+        focusInsets = null;
+    }
+
     protected TrackListener createTrackListener(JSlider slider) {
         return new TrackListener();
     }
@@ -1571,20 +1575,8 @@
             offset = 0;
             scrollTimer.stop();
 
-            // This is the way we have to determine snap-to-ticks.  It's
-            // hard to explain but since ChangeEvents don't give us any
-            // idea what has changed we don't have a way to stop the thumb
-            // bounds from being recalculated.  Recalculating the thumb
-            // bounds moves the thumb over the current value (i.e., snapping
-            // to the ticks).
-            if (slider.getSnapToTicks() /*|| slider.getSnapToValue()*/ ) {
-                isDragging = false;
-                slider.setValueIsAdjusting(false);
-            }
-            else {
-                slider.setValueIsAdjusting(false);
-                isDragging = false;
-            }
+            isDragging = false;
+            slider.setValueIsAdjusting(false);
             slider.repaint();
         }
 
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java	Fri Mar 26 11:10:26 2010 -0400
@@ -62,6 +62,7 @@
                      (scrollbar.getLayout() instanceof UIResource)) {
             scrollbar.setLayout(this);
         }
+        configureScrollBarColors();
         updateStyle(scrollbar);
     }
 
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java	Fri Mar 26 11:10:26 2010 -0400
@@ -43,7 +43,7 @@
 
 /**
  * Provides the Synth L&F UI delegate for
- * {@link javax.swing.JSlider}.
+ * {@link JSlider}.
  *
  * @author Joshua Outwater
  * @since 1.7
@@ -65,7 +65,7 @@
      * the slider has not changed sizes since being last layed out. If necessary
      * we recompute the layout.
      */
-    private Dimension lastSize = null;
+    private Dimension lastSize;
 
     private int trackHeight;
     private int trackBorder;
@@ -109,7 +109,7 @@
      * Uninstalls default setting. This method is called when a
      * {@code LookAndFeel} is uninstalled.
      */
-    protected void uninstallDefaults() {
+    protected void uninstallDefaults(JSlider slider) {
         SynthContext context = getContext(slider, ENABLED);
         style.uninstallDefaults(context);
         context.dispose();
@@ -339,6 +339,7 @@
      */
     @Override
     protected void calculateGeometry() {
+        calculateThumbSize();
         layout();
         calculateThumbLocation();
     }
@@ -350,10 +351,6 @@
         SynthContext context = getContext(slider);
         SynthGraphicsUtils synthGraphics = style.getGraphicsUtils(context);
 
-        // Set the thumb size.
-        Dimension size = getThumbSize();
-        thumbRect.setSize(size.width, size.height);
-
         // Get the insets for the track.
         Insets trackInsets = new Insets(0, 0, 0, 0);
         SynthContext trackContext = getContext(slider, Region.SLIDER_TRACK);
@@ -557,39 +554,6 @@
      * @inheritDoc
      */
     @Override
-    protected void calculateTickRect() {
-        if (slider.getOrientation() == JSlider.HORIZONTAL) {
-            tickRect.x = trackRect.x;
-            tickRect.y = trackRect.y + trackRect.height + 2 + getTickLength();
-            tickRect.width = trackRect.width;
-            tickRect.height = getTickLength();
-
-            if (!slider.getPaintTicks()) {
-                --tickRect.y;
-                tickRect.height = 0;
-            }
-        } else {
-            if (SynthLookAndFeel.isLeftToRight(slider)) {
-                tickRect.x = trackRect.x + trackRect.width;
-                tickRect.width = getTickLength();
-            } else {
-                tickRect.width = getTickLength();
-                tickRect.x = trackRect.x - tickRect.width;
-            }
-            tickRect.y = trackRect.y;
-            tickRect.height = trackRect.height;
-
-            if (!slider.getPaintTicks()) {
-                --tickRect.x;
-                tickRect.width = 0;
-            }
-        }
-    }
-
-    /**
-     * @inheritDoc
-     */
-    @Override
     public void setThumbLocation(int x, int y) {
         super.setThumbLocation(x, y);
         // Value rect is tied to the thumb location.  We need to repaint when
@@ -865,13 +829,17 @@
                     valueRect.y, -1);
         }
 
-        SynthContext subcontext = getContext(slider, Region.SLIDER_TRACK);
-        paintTrack(subcontext, g, trackRect);
-        subcontext.dispose();
+        if (slider.getPaintTrack() && clip.intersects(trackRect)) {
+            SynthContext subcontext = getContext(slider, Region.SLIDER_TRACK);
+            paintTrack(subcontext, g, trackRect);
+            subcontext.dispose();
+        }
 
-        subcontext = getContext(slider, Region.SLIDER_THUMB);
-        paintThumb(subcontext, g, thumbRect);
-        subcontext.dispose();
+        if (clip.intersects(thumbRect)) {
+            SynthContext subcontext = getContext(slider, Region.SLIDER_THUMB);
+            paintThumb(subcontext, g, thumbRect);
+            subcontext.dispose();
+        }
 
         if (slider.getPaintTicks() && clip.intersects(tickRect)) {
             paintTicks(g);
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java	Fri Mar 26 11:10:26 2010 -0400
@@ -45,8 +45,7 @@
 import javax.swing.JTable;
 import javax.swing.LookAndFeel;
 import javax.swing.border.Border;
-import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.UIResource;
+import javax.swing.plaf.*;
 import javax.swing.plaf.basic.BasicTableUI;
 import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.JTableHeader;
@@ -158,7 +157,7 @@
                 if (gridColor == null) {
                     gridColor = style.getColor(context, ColorType.FOREGROUND);
                 }
-                table.setGridColor(gridColor);
+                table.setGridColor(gridColor == null ? new ColorUIResource(Color.GRAY) : gridColor);
             }
 
             useTableColors = style.getBoolean(context,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java	Fri Mar 26 11:10:26 2010 -0400
@@ -248,23 +248,26 @@
                                                 toolBar.getOrientation());
     }
 
-    // Overloaded to do nothing so we can share listeners.
     /**
-     * @inheritDoc
+     * This implementation does nothing, because the {@code rollover}
+     * property of the {@code JToolBar} class is not used
+     * in the Synth Look and Feel.
      */
     @Override
     protected void setBorderToNonRollover(Component c) {}
 
-    // Overloaded to do nothing so we can share listeners.
     /**
-     * @inheritDoc
+     * This implementation does nothing, because the {@code rollover}
+     * property of the {@code JToolBar} class is not used
+     * in the Synth Look and Feel.
      */
     @Override
     protected void setBorderToRollover(Component c) {}
 
-    // Overloaded to do nothing so we can share listeners.
     /**
-     * @inheritDoc
+     * This implementation does nothing, because the {@code rollover}
+     * property of the {@code JToolBar} class is not used
+     * in the Synth Look and Feel.
      */
     @Override
     protected void setBorderToNormal(Component c) {}
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java	Fri Mar 26 11:10:26 2010 -0400
@@ -173,13 +173,20 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the border. The method is never called,
+     * because the {@code JViewport} class does not support a border.
+     * This implementation does nothing.
+     *
+     * @param context a component context
+     * @param g the {@code Graphics} to paint on
+     * @param x the X coordinate
+     * @param y the Y coordinate
+     * @param w width of the border
+     * @param h height of the border
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
-        // This does nothing on purpose, JViewport doesn't allow a border
-        // and therefor this will NEVER be called.
     }
 
     /**
--- a/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java	Fri Mar 26 11:10:26 2010 -0400
@@ -1461,13 +1461,17 @@
                             // Make sure the new visible location contains
                             // the location of dot, otherwise Caret will
                             // cause an additional scroll.
-                            adjustScrollIfNecessary(target, newVis, initialY,
-                                                    newIndex);
-                            if (select) {
-                                target.moveCaretPosition(newIndex);
-                            }
-                            else {
-                                target.setCaretPosition(newIndex);
+                            int newY = getAdjustedY(target, newVis, newIndex);
+
+                            if (direction == -1 && newY <= initialY || direction == 1 && newY >= initialY) {
+                                // Change index and correct newVis.y only if won't cause scrolling upward
+                                newVis.y = newY;
+
+                                if (select) {
+                                    target.moveCaretPosition(newIndex);
+                                } else {
+                                    target.setCaretPosition(newIndex);
+                                }
                             }
                         }
                     } catch (BadLocationException ble) { }
@@ -1513,34 +1517,27 @@
         }
 
         /**
-         * Adjusts the rectangle that indicates the location to scroll to
+         * Returns adjustsed {@code y} position that indicates the location to scroll to
          * after selecting <code>index</code>.
          */
-        private void adjustScrollIfNecessary(JTextComponent text,
-                                             Rectangle visible, int initialY,
-                                             int index) {
+        private int getAdjustedY(JTextComponent text, Rectangle visible, int index) {
+            int result = visible.y;
+
             try {
                 Rectangle dotBounds = text.modelToView(index);
 
-                if (dotBounds.y < visible.y ||
-                       (dotBounds.y > (visible.y + visible.height)) ||
-                       (dotBounds.y + dotBounds.height) >
-                       (visible.y + visible.height)) {
-                    int y;
-
-                    if (dotBounds.y < visible.y) {
-                        y = dotBounds.y;
-                    }
-                    else {
-                        y = dotBounds.y + dotBounds.height - visible.height;
-                    }
-                    if ((direction == -1 && y < initialY) ||
-                                        (direction == 1 && y > initialY)) {
-                        // Only adjust if won't cause scrolling upward.
-                        visible.y = y;
+                if (dotBounds.y < visible.y) {
+                    result = dotBounds.y;
+                } else {
+                    if ((dotBounds.y > visible.y + visible.height) ||
+                            (dotBounds.y + dotBounds.height > visible.y + visible.height)) {
+                        result = dotBounds.y + dotBounds.height - visible.height;
                     }
                 }
-            } catch (BadLocationException ble) {}
+            } catch (BadLocationException ble) {
+            }
+
+            return result;
         }
 
         /**
--- a/jdk/src/share/classes/sun/font/SunFontManager.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/sun/font/SunFontManager.java	Fri Mar 26 11:10:26 2010 -0400
@@ -3058,7 +3058,7 @@
             return;
         }
         /* Use lock specific to the font system */
-        synchronized (lucidaFontName) {
+        synchronized (this) {
             if (FontUtilities.debugFonts()) {
                 Thread.dumpStack();
                 FontUtilities.getLogger()
@@ -3194,7 +3194,7 @@
             return;
         }
         /* Use lock specific to the font system */
-        synchronized (lucidaFontName) {
+        synchronized (this) {
             if (FontUtilities.debugFonts()) {
                 Thread.dumpStack();
                 FontUtilities.getLogger().info("loadAllFontFiles() called");
--- a/jdk/src/share/classes/sun/nio/fs/AbstractWatchKey.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/sun/nio/fs/AbstractWatchKey.java	Fri Mar 26 11:10:26 2010 -0400
@@ -59,10 +59,15 @@
     // pending events
     private List<WatchEvent<?>> events;
 
+    // maps a context to the last event for the context (iff the last queued
+    // event for the context is an ENTRY_MODIFY event).
+    private Map<Object,WatchEvent<?>> lastModifyEvents;
+
     protected AbstractWatchKey(AbstractWatchService watcher) {
         this.watcher = watcher;
         this.state = State.READY;
         this.events = new ArrayList<WatchEvent<?>>();
+        this.lastModifyEvents = new HashMap<Object,WatchEvent<?>>();
     }
 
     final AbstractWatchService watcher() {
@@ -86,6 +91,7 @@
      */
     @SuppressWarnings("unchecked")
     final void signalEvent(WatchEvent.Kind<?> kind, Object context) {
+        boolean isModify = (kind == StandardWatchEventKind.ENTRY_MODIFY);
         synchronized (this) {
             int size = events.size();
             if (size > 0) {
@@ -100,17 +106,43 @@
                     return;
                 }
 
+                // if this is a modify event and the last entry for the context
+                // is a modify event then we simply increment the count
+                if (!lastModifyEvents.isEmpty()) {
+                    if (isModify) {
+                        WatchEvent<?> ev = lastModifyEvents.get(context);
+                        if (ev != null) {
+                            assert ev.kind() == StandardWatchEventKind.ENTRY_MODIFY;
+                            ((Event<?>)ev).increment();
+                            return;
+                        }
+                    } else {
+                        // not a modify event so remove from the map as the
+                        // last event will no longer be a modify event.
+                        lastModifyEvents.remove(context);
+                    }
+                }
+
                 // if the list has reached the limit then drop pending events
                 // and queue an OVERFLOW event
                 if (size >= MAX_EVENT_LIST_SIZE) {
-                    events.clear();
                     kind = StandardWatchEventKind.OVERFLOW;
+                    isModify = false;
                     context = null;
                 }
             }
 
             // non-repeated event
-            events.add(new Event<Object>((WatchEvent.Kind<Object>)kind, context));
+            Event<Object> ev =
+                new Event<Object>((WatchEvent.Kind<Object>)kind, context);
+            if (isModify) {
+                lastModifyEvents.put(context, ev);
+            } else if (kind == StandardWatchEventKind.OVERFLOW) {
+                // drop all pending events
+                events.clear();
+                lastModifyEvents.clear();
+            }
+            events.add(ev);
             signal();
         }
     }
@@ -120,6 +152,7 @@
         synchronized (this) {
             List<WatchEvent<?>> result = events;
             events = new ArrayList<WatchEvent<?>>();
+            lastModifyEvents.clear();
             return result;
         }
     }
--- a/jdk/src/share/classes/sun/security/krb5/internal/crypto/EType.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/internal/crypto/EType.java	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Portions Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Portions Copyright 2000-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
@@ -36,9 +36,9 @@
 import sun.security.krb5.EncryptedData;
 import sun.security.krb5.EncryptionKey;
 import sun.security.krb5.KrbException;
-import sun.security.krb5.Asn1Exception;
 import sun.security.krb5.KrbCryptoException;
 import javax.crypto.*;
+import java.util.Arrays;
 import java.util.List;
 import java.util.ArrayList;
 
@@ -48,6 +48,23 @@
 public abstract class EType {
 
     private static final boolean DEBUG = Krb5.DEBUG;
+    private static final boolean ALLOW_WEAK_CRYPTO;
+
+    static {
+        boolean allowed = true;
+        try {
+            Config cfg = Config.getInstance();
+            String temp = cfg.getDefault("allow_weak_crypto", "libdefaults");
+            if (temp != null && temp.equals("false")) allowed = false;
+        } catch (Exception exc) {
+            if (DEBUG) {
+                System.out.println ("Exception in getting allow_weak_crypto, " +
+                                    "using default value " +
+                                    exc.getMessage());
+            }
+        }
+        ALLOW_WEAK_CRYPTO = allowed;
+    }
 
     public static EType getInstance  (int eTypeConst)
         throws KdcErrException {
@@ -163,6 +180,10 @@
         return result;
     }
 
+    // Note: the first 2 entries of BUILTIN_ETYPES and BUILTIN_ETYPES_NOAES256
+    // should be kept DES-related. They will be removed when allow_weak_crypto
+    // is set to false.
+
     private static final int[] BUILTIN_ETYPES = new int[] {
         EncryptedData.ETYPE_DES_CBC_MD5,
         EncryptedData.ETYPE_DES_CBC_CRC,
@@ -189,10 +210,17 @@
         } catch (Exception e) {
             // should not happen
         }
+        int[] result;
         if (allowed < 256) {
-            return BUILTIN_ETYPES_NOAES256;
+            result = BUILTIN_ETYPES_NOAES256;
+        } else {
+            result = BUILTIN_ETYPES;
         }
-        return BUILTIN_ETYPES;
+        if (!ALLOW_WEAK_CRYPTO) {
+            // The first 2 etypes are now weak ones
+            return Arrays.copyOfRange(result, 2, result.length);
+        }
+        return result;
     }
 
     /**
@@ -207,9 +235,7 @@
             if (DEBUG) {
                 System.out.println("Exception while getting " +
                     configName + exc.getMessage());
-                System.out.println("Using defaults " +
-                    "des-cbc-md5, des-cbc-crc, des3-cbc-sha1," +
-                        " aes128cts, aes256cts, rc4-hmac");
+                System.out.println("Using default builtin etypes");
             }
             return getBuiltInDefaults();
         }
--- a/jdk/src/share/classes/sun/security/provider/JavaKeyStore.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/sun/security/provider/JavaKeyStore.java	Fri Mar 26 11:10:26 2010 -0400
@@ -29,9 +29,9 @@
 import java.security.*;
 import java.security.cert.Certificate;
 import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
 import java.security.cert.CertificateException;
 import java.util.*;
+import sun.misc.IOUtils;
 
 import sun.security.pkcs.EncryptedPrivateKeyInfo;
 
@@ -677,50 +677,39 @@
                     entry.date = new Date(dis.readLong());
 
                     // Read the private key
-                    try {
-                        entry.protectedPrivKey = new byte[dis.readInt()];
-                    } catch (OutOfMemoryError e) {
-                        throw new IOException("Keysize too big");
-                    }
-                    dis.readFully(entry.protectedPrivKey);
+                    entry.protectedPrivKey =
+                            IOUtils.readFully(dis, dis.readInt(), true);
 
                     // Read the certificate chain
                     int numOfCerts = dis.readInt();
-                    try {
-                        if (numOfCerts > 0) {
-                            entry.chain = new Certificate[numOfCerts];
+                    if (numOfCerts > 0) {
+                        List<Certificate> certs = new ArrayList<>(
+                                numOfCerts > 10 ? 10 : numOfCerts);
+                        for (int j = 0; j < numOfCerts; j++) {
+                            if (xVersion == 2) {
+                                // read the certificate type, and instantiate a
+                                // certificate factory of that type (reuse
+                                // existing factory if possible)
+                                String certType = dis.readUTF();
+                                if (cfs.containsKey(certType)) {
+                                    // reuse certificate factory
+                                    cf = cfs.get(certType);
+                                } else {
+                                    // create new certificate factory
+                                    cf = CertificateFactory.getInstance(certType);
+                                    // store the certificate factory so we can
+                                    // reuse it later
+                                    cfs.put(certType, cf);
+                                }
+                            }
+                            // instantiate the certificate
+                            encoded = IOUtils.readFully(dis, dis.readInt(), true);
+                            bais = new ByteArrayInputStream(encoded);
+                            certs.add(cf.generateCertificate(bais));
+                            bais.close();
                         }
-                    } catch (OutOfMemoryError e) {
-                        throw new IOException
-                            ("Too many certificates in chain");
-                    }
-                    for (int j = 0; j < numOfCerts; j++) {
-                        if (xVersion == 2) {
-                            // read the certificate type, and instantiate a
-                            // certificate factory of that type (reuse
-                            // existing factory if possible)
-                            String certType = dis.readUTF();
-                            if (cfs.containsKey(certType)) {
-                                // reuse certificate factory
-                                cf = cfs.get(certType);
-                            } else {
-                                // create new certificate factory
-                                cf = CertificateFactory.getInstance(certType);
-                                // store the certificate factory so we can
-                                // reuse it later
-                                cfs.put(certType, cf);
-                            }
-                        }
-                        // instantiate the certificate
-                        try {
-                            encoded = new byte[dis.readInt()];
-                        } catch (OutOfMemoryError e) {
-                            throw new IOException("Certificate too big");
-                        }
-                        dis.readFully(encoded);
-                        bais = new ByteArrayInputStream(encoded);
-                        entry.chain[j] = cf.generateCertificate(bais);
-                        bais.close();
+                        // We can be sure now that numOfCerts of certs are read
+                        entry.chain = certs.toArray(new Certificate[numOfCerts]);
                     }
 
                     // Add the entry to the list
@@ -753,12 +742,7 @@
                             cfs.put(certType, cf);
                         }
                     }
-                    try {
-                        encoded = new byte[dis.readInt()];
-                    } catch (OutOfMemoryError e) {
-                        throw new IOException("Certificate too big");
-                    }
-                    dis.readFully(encoded);
+                    encoded = IOUtils.readFully(dis, dis.readInt(), true);
                     bais = new ByteArrayInputStream(encoded);
                     entry.cert = cf.generateCertificate(bais);
                     bais.close();
--- a/jdk/src/share/classes/sun/security/tools/TimestampedSigner.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/sun/security/tools/TimestampedSigner.java	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright (c) 2007-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
@@ -375,7 +375,8 @@
                 }
                 if (!isSigner) {
                     keyPurposes = cert.getExtendedKeyUsage();
-                    if (! keyPurposes.contains(KP_TIMESTAMPING_OID)) {
+                    if (keyPurposes == null ||
+                            ! keyPurposes.contains(KP_TIMESTAMPING_OID)) {
                         throw new CertificateException(
                             "Certificate is not valid for timestamping");
                     }
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java	Fri Mar 26 11:10:26 2010 -0400
@@ -384,6 +384,7 @@
             {"America/Manaus", AMT},
             {"America/Marigot", AST},
             {"America/Martinique", AST},
+            {"America/Matamoros", CST},
             {"America/Mazatlan", MST},
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
@@ -403,6 +404,7 @@
             {"America/Noronha", NORONHA},
             {"America/North_Dakota/Center", CST},
             {"America/North_Dakota/New_Salem", CST},
+            {"America/Ojinaga", MST},
             {"America/Panama", EST},
             {"America/Pangnirtung", EST},
             {"America/Paramaribo", new String[] {"Suriname Time", "SRT",
@@ -419,6 +421,7 @@
             {"America/Resolute", RST},
             {"America/Rio_Branco", AMT},
             {"America/Rosario", AGT},
+            {"America/Santa_Isabel", PST},
             {"America/Santarem", BRT},
             {"America/Santiago", CLT},
             {"America/Santo_Domingo", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_de.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_de.java	Fri Mar 26 11:10:26 2010 -0400
@@ -384,6 +384,7 @@
             {"America/Manaus", AMT},
             {"America/Marigot", AST},
             {"America/Martinique", AST},
+            {"America/Matamoros", CST},
             {"America/Mazatlan", MST},
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
@@ -403,6 +404,7 @@
             {"America/Noronha", NORONHA},
             {"America/North_Dakota/Center", CST},
             {"America/North_Dakota/New_Salem", CST},
+            {"America/Ojinaga", MST},
             {"America/Panama", EST},
             {"America/Pangnirtung", EST},
             {"America/Paramaribo", new String[] {"Suriname Zeit", "SRT",
@@ -419,6 +421,7 @@
             {"America/Resolute", RST},
             {"America/Rio_Branco", AMT},
             {"America/Rosario", AGT},
+            {"America/Santa_Isabel", PST},
             {"America/Santarem", BRT},
             {"America/Santiago", CLT},
             {"America/Santo_Domingo", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_es.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_es.java	Fri Mar 26 11:10:26 2010 -0400
@@ -384,6 +384,7 @@
             {"America/Manaus", AMT},
             {"America/Marigot", AST},
             {"America/Martinique", AST},
+            {"America/Matamoros", CST},
             {"America/Mazatlan", MST},
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
@@ -403,6 +404,7 @@
             {"America/Noronha", NORONHA},
             {"America/North_Dakota/Center", CST},
             {"America/North_Dakota/New_Salem", CST},
+            {"America/Ojinaga", MST},
             {"America/Panama", EST},
             {"America/Pangnirtung", EST},
             {"America/Paramaribo", new String[] {"Hora de Surinam", "SRT",
@@ -419,6 +421,7 @@
             {"America/Resolute", RST},
             {"America/Rio_Branco", AMT},
             {"America/Rosario", AGT},
+            {"America/Santa_Isabel", PST},
             {"America/Santarem", BRT},
             {"America/Santiago", CLT},
             {"America/Santo_Domingo", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_fr.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_fr.java	Fri Mar 26 11:10:26 2010 -0400
@@ -384,6 +384,7 @@
             {"America/Manaus", AMT},
             {"America/Marigot", AST},
             {"America/Martinique", AST},
+            {"America/Matamoros", CST},
             {"America/Mazatlan", MST},
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
@@ -403,6 +404,7 @@
             {"America/Noronha", NORONHA},
             {"America/North_Dakota/Center", CST},
             {"America/North_Dakota/New_Salem", CST},
+            {"America/Ojinaga", MST},
             {"America/Panama", EST},
             {"America/Pangnirtung", EST},
             {"America/Paramaribo", new String[] {"Heure du Surinam", "SRT",
@@ -419,6 +421,7 @@
             {"America/Resolute", RST},
             {"America/Rio_Branco", AMT},
             {"America/Rosario", AGT},
+            {"America/Santa_Isabel", PST},
             {"America/Santarem", BRT},
             {"America/Santiago", CLT},
             {"America/Santo_Domingo", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_it.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_it.java	Fri Mar 26 11:10:26 2010 -0400
@@ -384,6 +384,7 @@
             {"America/Manaus", AMT},
             {"America/Marigot", AST},
             {"America/Martinique", AST},
+            {"America/Matamoros", CST},
             {"America/Mazatlan", MST},
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
@@ -403,6 +404,7 @@
             {"America/Noronha", NORONHA},
             {"America/North_Dakota/Center", CST},
             {"America/North_Dakota/New_Salem", CST},
+            {"America/Ojinaga", MST},
             {"America/Panama", EST},
             {"America/Pangnirtung", EST},
             {"America/Paramaribo", new String[] {"Ora di Suriname", "SRT",
@@ -419,6 +421,7 @@
             {"America/Resolute", RST},
             {"America/Rio_Branco", AMT},
             {"America/Rosario", AGT},
+            {"America/Santa_Isabel", PST},
             {"America/Santarem", BRT},
             {"America/Santiago", CLT},
             {"America/Santo_Domingo", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ja.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ja.java	Fri Mar 26 11:10:26 2010 -0400
@@ -384,6 +384,7 @@
             {"America/Manaus", AMT},
             {"America/Marigot", AST},
             {"America/Martinique", AST},
+            {"America/Matamoros", CST},
             {"America/Mazatlan", MST},
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
@@ -403,6 +404,7 @@
             {"America/Noronha", NORONHA},
             {"America/North_Dakota/Center", CST},
             {"America/North_Dakota/New_Salem", CST},
+            {"America/Ojinaga", MST},
             {"America/Panama", EST},
             {"America/Pangnirtung", EST},
             {"America/Paramaribo", new String[] {"\u30b9\u30ea\u30ca\u30e0\u6642\u9593", "SRT",
@@ -419,6 +421,7 @@
             {"America/Resolute", RST},
             {"America/Rio_Branco", AMT},
             {"America/Rosario", AGT},
+            {"America/Santa_Isabel", PST},
             {"America/Santarem", BRT},
             {"America/Santiago", CLT},
             {"America/Santo_Domingo", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ko.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ko.java	Fri Mar 26 11:10:26 2010 -0400
@@ -384,6 +384,7 @@
             {"America/Manaus", AMT},
             {"America/Marigot", AST},
             {"America/Martinique", AST},
+            {"America/Matamoros", CST},
             {"America/Mazatlan", MST},
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
@@ -403,6 +404,7 @@
             {"America/Noronha", NORONHA},
             {"America/North_Dakota/Center", CST},
             {"America/North_Dakota/New_Salem", CST},
+            {"America/Ojinaga", MST},
             {"America/Panama", EST},
             {"America/Pangnirtung", EST},
             {"America/Paramaribo", new String[] {"\uc218\ub9ac\ub0a8 \uc2dc\uac04", "SRT",
@@ -419,6 +421,7 @@
             {"America/Resolute", RST},
             {"America/Rio_Branco", AMT},
             {"America/Rosario", AGT},
+            {"America/Santa_Isabel", PST},
             {"America/Santarem", BRT},
             {"America/Santiago", CLT},
             {"America/Santo_Domingo", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java	Fri Mar 26 11:10:26 2010 -0400
@@ -384,6 +384,7 @@
             {"America/Manaus", AMT},
             {"America/Marigot", AST},
             {"America/Martinique", AST},
+            {"America/Matamoros", CST},
             {"America/Mazatlan", MST},
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
@@ -403,6 +404,7 @@
             {"America/Noronha", NORONHA},
             {"America/North_Dakota/Center", CST},
             {"America/North_Dakota/New_Salem", CST},
+            {"America/Ojinaga", MST},
             {"America/Panama", EST},
             {"America/Pangnirtung", EST},
             {"America/Paramaribo", new String[] {"Surinam, normaltid", "SRT",
@@ -419,6 +421,7 @@
             {"America/Resolute", RST},
             {"America/Rio_Branco", AMT},
             {"America/Rosario", AGT},
+            {"America/Santa_Isabel", PST},
             {"America/Santarem", BRT},
             {"America/Santiago", CLT},
             {"America/Santo_Domingo", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java	Fri Mar 26 11:10:26 2010 -0400
@@ -384,6 +384,7 @@
             {"America/Manaus", AMT},
             {"America/Marigot", AST},
             {"America/Martinique", AST},
+            {"America/Matamoros", CST},
             {"America/Mazatlan", MST},
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
@@ -403,6 +404,7 @@
             {"America/Noronha", NORONHA},
             {"America/North_Dakota/Center", CST},
             {"America/North_Dakota/New_Salem", CST},
+            {"America/Ojinaga", MST},
             {"America/Panama", EST},
             {"America/Pangnirtung", EST},
             {"America/Paramaribo", new String[] {"\u82cf\u5229\u5357\u65f6\u95f4", "SRT",
@@ -419,6 +421,7 @@
             {"America/Resolute", RST},
             {"America/Rio_Branco", AMT},
             {"America/Rosario", AGT},
+            {"America/Santa_Isabel", PST},
             {"America/Santarem", BRT},
             {"America/Santiago", CLT},
             {"America/Santo_Domingo", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java	Fri Mar 26 11:10:26 2010 -0400
@@ -384,6 +384,7 @@
             {"America/Manaus", AMT},
             {"America/Marigot", AST},
             {"America/Martinique", AST},
+            {"America/Matamoros", CST},
             {"America/Mazatlan", MST},
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
@@ -403,6 +404,7 @@
             {"America/Noronha", NORONHA},
             {"America/North_Dakota/Center", CST},
             {"America/North_Dakota/New_Salem", CST},
+            {"America/Ojinaga", MST},
             {"America/Panama", EST},
             {"America/Pangnirtung", EST},
             {"America/Paramaribo", new String[] {"\u8607\u5229\u5357\u6642\u9593", "SRT",
@@ -419,6 +421,7 @@
             {"America/Resolute", RST},
             {"America/Rio_Branco", AMT},
             {"America/Rosario", AGT},
+            {"America/Santa_Isabel", PST},
             {"America/Santarem", BRT},
             {"America/Santiago", CLT},
             {"America/Santo_Domingo", AST},
--- a/jdk/src/share/lib/security/java.security	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/share/lib/security/java.security	Fri Mar 26 11:10:26 2010 -0400
@@ -118,11 +118,6 @@
 keystore.type=jks
 
 #
-# Class to instantiate as the system scope:
-#
-system.scope=sun.security.provider.IdentityDatabase
-
-#
 # List of comma-separated packages that start with or equal this string
 # will cause a security exception to be thrown when
 # passed to checkPackageAccess unless the
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java	Fri Mar 26 11:10:26 2010 -0400
@@ -624,8 +624,11 @@
     public boolean endsWith(Path other) {
         UnixPath that = checkPath(other);
 
+        int thisLen = path.length;
+        int thatLen = that.path.length;
+
         // other path is longer
-        if (that.path.length > path.length)
+        if (thatLen > thisLen)
             return false;
 
         // other path is absolute so this path must be absolute
@@ -643,10 +646,10 @@
             if (thatOffsetCount == thisOffsetCount) {
                 if (thisOffsetCount == 0)
                     return true;
-                int expectedLen = path.length;
+                int expectedLen = thisLen;
                 if (this.isAbsolute() && !that.isAbsolute())
                     expectedLen--;
-                if (that.path.length != expectedLen)
+                if (thatLen != expectedLen)
                     return false;
             } else {
                 // this path has more elements so given path must be relative
@@ -658,7 +661,9 @@
         // compare bytes
         int thisPos = offsets[thisOffsetCount - thatOffsetCount];
         int thatPos = that.offsets[0];
-        while (thatPos < that.path.length) {
+        if ((thatLen - thatPos) != (thisLen - thisPos))
+            return false;
+        while (thatPos < thatLen) {
             if (this.path[thisPos++] != that.path[thatPos++])
                 return false;
         }
--- a/jdk/src/solaris/native/java/io/UnixFileSystem_md.c	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/src/solaris/native/java/io/UnixFileSystem_md.c	Fri Mar 26 11:10:26 2010 -0400
@@ -414,9 +414,9 @@
     jlong rv = 0L;
 
     WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) {
-        struct statvfs fsstat;
-        memset(&fsstat, 0, sizeof(struct statvfs));
-        if (statvfs(path, &fsstat) == 0) {
+        struct statvfs64 fsstat;
+        memset(&fsstat, 0, sizeof(fsstat));
+        if (statvfs64(path, &fsstat) == 0) {
             switch(t) {
             case java_io_FileSystem_SPACE_TOTAL:
                 rv = jlong_mul(long_to_jlong(fsstat.f_frsize),
--- a/jdk/test/Makefile	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/test/Makefile	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 #
-# Copyright 1995-2009 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1995-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
@@ -37,25 +37,19 @@
 AWK       = awk
 CAT       = cat
 CD        = cd
-CHMOD     = chmod
 CP        = cp
 CUT       = cut
 ECHO      = echo
 EGREP     = egrep
 EXPAND    = expand
-EXPR      = expr
-KILL      = /usr/bin/kill
 MKDIR     = mkdir
-NOHUP     = nohup
 PWD       = pwd
 SED       = sed
-SLEEP     = sleep
 SORT      = sort
 TEE       = tee
 UNAME     = uname
 UNIQ      = uniq
 WC        = wc
-XHOST     = xhost
 ZIP       = zip
 
 # Get OS name from uname
@@ -211,66 +205,6 @@
   ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
 endif
 
-# DISPLAY settings for virtual frame buffer
-START_XVFB = start-Xvfb.sh
-NOHUP_OUTPUT = $(ABS_TEST_OUTPUT_DIR)/start-Xvfb.nohup-output.txt
-DISPLAY_PID_FILE=$(ABS_TEST_OUTPUT_DIR)/xvfb-display-number.txt
-DISPLAY_SLEEP_TIME=10
-DISPLAY_MAX_SLEEPS=10
-ifeq ($(OS_NAME),solaris)
-  VIRTUAL_FRAME_BUFFER = true
-endif
-ifeq ($(OS_NAME),linux)
-  VIRTUAL_FRAME_BUFFER = true
-endif
-
-# Does not work yet, display dies as soon as it gets used. :^(
-VIRTUAL_FRAME_BUFFER = false
-
-# Are we using a VIRTUAL_FRAME_BUFFER (Xvfb)
-ifeq ($(VIRTUAL_FRAME_BUFFER),true)
-  
-  PREP_DISPLAY = \
-    $(CP) $(START_XVFB) $(ABS_TEST_OUTPUT_DIR); \
-    $(CHMOD) a+x $(ABS_TEST_OUTPUT_DIR)/$(START_XVFB); \
-    ( $(CD) $(ABS_TEST_OUTPUT_DIR) && \
-      $(NOHUP) $(ABS_TEST_OUTPUT_DIR)/$(START_XVFB) $(DISPLAY_PID_FILE) > $(NOHUP_OUTPUT) 2>&1 && \
-      $(SLEEP) $(DISPLAY_SLEEP_TIME) ) & \
-    count=1; \
-    while [ ! -s $(DISPLAY_PID_FILE) ] ; do \
-      $(ECHO) "Sleeping $(DISPLAY_SLEEP_TIME) more seconds, DISPLAY not ready"; \
-      $(SLEEP) $(DISPLAY_SLEEP_TIME); \
-      count=`$(EXPR) $${count} '+' 1`; \
-      if [ $${count} -gt $(DISPLAY_MAX_SLEEPS) ] ; then \
-        $(ECHO) "ERROR: DISPLAY not ready, giving up on DISPLAY"; \
-        exit 9; \
-      fi; \
-    done ; \
-    DISPLAY=":`$(CAT) $(DISPLAY_PID_FILE)`"; \
-    export DISPLAY; \
-    $(CAT) $(NOHUP_OUTPUT); \
-    $(ECHO) "Prepared DISPLAY=$${DISPLAY}"; \
-    $(XHOST) || \
-    ( $(ECHO) "ERROR: No display" ; exit 8)
-
-  KILL_DISPLAY = \
-    ( \
-      DISPLAY=":`$(CAT) $(DISPLAY_PID_FILE)`"; \
-      export DISPLAY; \
-      if [ -s "$(DISPLAY_PID_FILE)" ] ; then \
-        $(KILL) `$(CAT) $(DISPLAY_PID_FILE)` > /dev/null 2>&1; \
-        $(KILL) -9 `$(CAT) $(DISPLAY_PID_FILE)` > /dev/null 2>&1; \
-      fi; \
-      $(ECHO) "Killed DISPLAY=$${DISPLAY}"; \
-    )
-
-else
-  
-  PREP_DISPLAY = $(ECHO) "VIRTUAL_FRAME_BUFFER=$(VIRTUAL_FRAME_BUFFER)"
-  KILL_DISPLAY = $(ECHO) "VIRTUAL_FRAME_BUFFER=$(VIRTUAL_FRAME_BUFFER)"
-
-endif
-
 # How to create the test bundle (pass or fail, we want to create this)
 #   Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
 ZIP_UP_RESULTS = ( $(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)`     \
@@ -327,7 +261,7 @@
     $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
   fi; \
   $(CAT) $(STATS_TXT); \
-  $(ZIP_UP_RESULTS) && $(KILL_DISPLAY) ; \
+  $(ZIP_UP_RESULTS) ; \
   $(TESTEXIT) \
 )
 
@@ -629,7 +563,6 @@
 	(                                                                    \
 	  ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)");                   \
             export JT_HOME;                                                  \
-	    $(PREP_DISPLAY) &&                                               \
             $(shell $(GETMIXEDPATH) "$(JTREG)")                              \
               $(JTREG_BASIC_OPTIONS)                                         \
               -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport  \
--- a/jdk/test/ProblemList.txt	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/test/ProblemList.txt	Fri Mar 26 11:10:26 2010 -0400
@@ -1,6 +1,6 @@
 ###########################################################################
 #
-# Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2009-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
@@ -431,6 +431,12 @@
 
 # jdk_management
 
+# Fails on linux: KO: StringMonitor notification missed or not emitted
+javax/management/monitor/NonComparableAttributeValueTest.java	generic-all
+
+# Port conflict? Fails with communication error
+sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.sh generic-all
+
 # Fails on Windows 2000, Test failed for iiop java.lang.NullPointerException
 #  at org.omg.stub.javax.management.remote.rmi._RMIConnectionImpl_Tie._invoke(Unknown Source)
 #  at com.sun.corba.se.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:653)
@@ -583,6 +589,9 @@
 # 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
@@ -736,6 +745,13 @@
 # Suspect many of these tests auffer from using fixed ports, no concrete 
 #   evidence.
 
+# Occasionally Failing with java.lang.AssertionError on Windows X64
+#  at sun.nio.ch.PendingIoCache.clearPendingIoMap(PendingIoCache.java:144)
+#java/nio/channels/FileChannel/ReleaseOnCloseDeadlock.java	windows-all
+
+# Some kind of sleep/wake problem on Windows X64
+java/nio/channels/Selector/Wakeup.java				windows-all
+
 # Fails with -ea -esa, Assertion error, but only on Solaris 10 machines?
 com/sun/nio/sctp/SctpChannel/Send.java				generic-all
 com/sun/nio/sctp/SctpChannel/Shutdown.java			generic-all
@@ -932,6 +948,18 @@
 
 # jdk_security
 
+# Unknown problem, could be a jtreg -samevm issue?
+#  Error while cleaning up threads after test
+java/security/Security/SynchronizedAccess.java			generic-all
+
+# Failing on Solaris X64 (-d64 -server) with:
+#  GSSException: Failure unspecified at GSS-API level 
+#    (Mechanism level: Specified version of key is not available (44))
+sun/security/krb5/auto/BasicKrb5Test.java			generic-all
+
+# Solaris X86 failures, readjar.jks: No such file or directory
+sun/security/tools/keytool/readjar.sh				generic-all
+
 # Fails with -ea -esa, but only on Solaris sparc? Suspect it is timing out
 sun/security/tools/keytool/standard.sh				generic-all
 
@@ -1256,6 +1284,13 @@
 
 # jdk_util
 
+# Fails with assertion error on windows
+#   11 separate stacktraces created... file reuse problem?
+java/util/zip/ZipFile/ReadLongZipFileName.java			generic-all
+
+# Recent failure on all platforms
+sun/util/resources/TimeZone/Bug6317929.java			generic-all
+
 # Fails with -ea -esa on all platforms with Assertion error
 java/util/ResourceBundle/Test4300693.java			generic-all
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jndi/ldap/InvalidLdapFilters.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,311 @@
+/*
+ * 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 6916202
+ * @summary More cases of invalid ldap filters accepted and processed
+ * @run main/othervm InvalidLdapFilters valid (cn=Babs)
+ * @run main/othervm InvalidLdapFilters valid (&(cn=Bob))
+ * @run main/othervm InvalidLdapFilters valid (&(objectClass=*)(uid=*))
+ * @run main/othervm InvalidLdapFilters valid (|(cn=Bob))
+ * @run main/othervm InvalidLdapFilters valid (|(objectClass=*)(uid=*))
+ * @run main/othervm InvalidLdapFilters valid (!(cn=Tim))
+ * @run main/othervm InvalidLdapFilters valid (!(!(cn=Tim)))
+ * @run main/othervm InvalidLdapFilters valid (!(&(objectClass=*)(uid=*)))
+ * @run main/othervm InvalidLdapFilters valid (!(|(objectClass=*)(uid=*)))
+ * @run main/othervm InvalidLdapFilters valid (o=univ*of*mich*)
+ * @run main/othervm InvalidLdapFilters valid (seeAlso=)
+ * @run main/othervm InvalidLdapFilters valid (cn:caseExactMatch:=Flintstone)
+ * @run main/othervm InvalidLdapFilters valid (cn:=Betty)
+ * @run main/othervm InvalidLdapFilters valid (sn:dn:2.4.6.8.10:=Barney)
+ * @run main/othervm InvalidLdapFilters valid (o:dn:=Ace)
+ * @run main/othervm InvalidLdapFilters valid (:1.2.3:=Wilma)
+ * @run main/othervm InvalidLdapFilters valid (:DN:2.4.6.8.10:=Dino)
+ * @run main/othervm InvalidLdapFilters valid (1.2.3=abc)
+ * @run main/othervm InvalidLdapFilters valid (cn;lang-de;lang-en=abc)
+ * @run main/othervm InvalidLdapFilters valid (owner=abc)
+ * @run main/othervm InvalidLdapFilters valid (sn;lang-en:dn:2.4.6.8.10:=Barney)
+ * @run main/othervm InvalidLdapFilters valid
+         (&(objectClass=Person)(|(sn=Jensen)(cn=Bab*)))
+ * @run main/othervm InvalidLdapFilters invalid "(&(cn=Robert Dean)))"
+ * @run main/othervm InvalidLdapFilters invalid (&|(cn=Bob))
+ * @run main/othervm InvalidLdapFilters invalid (&&(cn=Bob))
+ * @run main/othervm InvalidLdapFilters invalid (|&(cn=Bob))
+ * @run main/othervm InvalidLdapFilters invalid (||(cn=Bob))
+ * @run main/othervm InvalidLdapFilters invalid (:1.2.:=Wilma)
+ * @run main/othervm InvalidLdapFilters invalid (::DN:2.4.6.8.10:=Dino)
+ * @run main/othervm InvalidLdapFilters invalid (:DN::2.4.6.8.10:=Dino)
+ * @run main/othervm InvalidLdapFilters invalid (:DN:2.4.6.8.10::=Dino)
+ * @run main/othervm InvalidLdapFilters invalid (:DN:2.4.6..8.10:=Dino)
+ * @run main/othervm InvalidLdapFilters invalid (:DN:2.4.6.8.:=Dino)
+ * @run main/othervm InvalidLdapFilters invalid (1.2.;::=abc)
+ * @run main/othervm InvalidLdapFilters invalid (1.2.3;::=abc)
+ * @run main/othervm InvalidLdapFilters invalid (1.2.3;x;=abc)
+ * @run main/othervm InvalidLdapFilters invalid (1.2.3:x::=abc)
+ * @run main/othervm InvalidLdapFilters invalid (1.2.3:x=abc)
+ * @run main/othervm InvalidLdapFilters invalid (sn;:dn:2.4.6.8.10:=Barney)
+ * @run main/othervm InvalidLdapFilters invalid "\"((objectClass=*)&(uid=*))\""
+ * @run main/othervm InvalidLdapFilters invalid "&(objectClass=*)(uid=*)"
+ * @run main/othervm InvalidLdapFilters invalid "(:DN:2.4.6.8.10:cn:=Dino)"
+ * @run main/othervm InvalidLdapFilters invalid "(:DN:2.4.6.8.10:cn=Dino)"
+ * @run main/othervm InvalidLdapFilters invalid
+         "((objectCategory=person)(cn=u)(!(cn=u2*)))"
+ * @run main/othervm InvalidLdapFilters invalid
+         "((&(objectClass=user)(cn=andy*)(cn=steve*)(cn=bob*)))"
+ *
+ * @author Xuelei Fan
+ */
+
+import java.io.*;
+import javax.naming.*;
+import javax.naming.directory.*;
+import java.util.Properties;
+import java.util.Hashtable;
+
+import java.net.Socket;
+import java.net.ServerSocket;
+
+public class InvalidLdapFilters {
+    // Should we run the client or server in a separate thread?
+    //
+    // Both sides can throw exceptions, but do you have a preference
+    // as to which side should be the main thread.
+    static boolean separateServerThread = true;
+
+    // use any free port by default
+    volatile int serverPort = 0;
+
+    // Is the server ready to serve?
+    volatile static boolean serverReady = false;
+
+    // Define the server side of the test.
+    //
+    // If the server prematurely exits, serverReady will be set to true
+    // to avoid infinite hangs.
+    void doServerSide() throws Exception {
+        ServerSocket serverSock = new ServerSocket(serverPort);
+
+        // signal client, it's ready to accecpt connection
+        serverPort = serverSock.getLocalPort();
+        serverReady = true;
+
+        // accept a connection
+        Socket socket = serverSock.accept();
+        System.out.println("Server: Connection accepted");
+
+        InputStream is = socket.getInputStream();
+        OutputStream os = socket.getOutputStream();
+
+        // read the bindRequest
+        while (is.read() != -1) {
+            // ignore
+            is.skip(is.available());
+            break;
+        }
+
+        byte[] bindResponse = {0x30, 0x0C, 0x02, 0x01, 0x01, 0x61, 0x07, 0x0A,
+                               0x01, 0x00, 0x04, 0x00, 0x04, 0x00};
+        // write bindResponse
+        os.write(bindResponse);
+        os.flush();
+
+        // ignore any more request.
+        while (is.read() != -1) {
+            // ignore
+            is.skip(is.available());
+        }
+
+        is.close();
+        os.close();
+        socket.close();
+        serverSock.close();
+    }
+
+    //  Define the client side of the test.
+    //
+    // If the server prematurely exits, serverReady will be set to true
+    // to avoid infinite hangs.
+    void doClientSide() throws Exception {
+        // Wait for server to get started.
+        while (!serverReady) {
+            Thread.sleep(50);
+        }
+
+        // set up the environment for creating the initial context
+        Hashtable<Object, Object> env = new Hashtable<Object, Object>();
+        env.put(Context.INITIAL_CONTEXT_FACTORY,
+                                "com.sun.jndi.ldap.LdapCtxFactory");
+        env.put(Context.PROVIDER_URL, "ldap://localhost:" + serverPort);
+        env.put("com.sun.jndi.ldap.read.timeout", "1000");
+
+        // env.put(Context.SECURITY_AUTHENTICATION, "simple");
+        // env.put(Context.SECURITY_PRINCIPAL,"cn=root");
+        // env.put(Context.SECURITY_CREDENTIALS,"root");
+
+        // create initial context
+        DirContext context = new InitialDirContext(env);
+
+        // searching
+        SearchControls scs = new SearchControls();
+        scs.setSearchScope(SearchControls.SUBTREE_SCOPE);
+
+        try {
+            NamingEnumeration answer =
+                    context.search("o=sun,c=us", searchFilter, scs);
+        } catch (InvalidSearchFilterException isfe) {
+            if (filterIsValid) {
+                // unexpected filter exception.
+                throw new Exception("Unexpected ISFE", isfe);
+            } else {
+                // ignore, it is the expected filter exception.
+                System.out.println("Expected exception: " + isfe.getMessage());
+            }
+        } catch (NamingException ne) {
+            // maybe a read timeout exception, as the server does not response.
+            if (filterIsValid) {
+                System.out.println("Expected exception: " + ne.getMessage());
+            } else {
+                throw new Exception("Not an InvalidSearchFilterException", ne);
+            }
+        }
+
+        context.close();
+    }
+
+    private static boolean filterIsValid;
+    private static String searchFilter;
+
+    private static void parseArguments(String[] args) {
+        System.out.println("arguments length: " + args.length);
+        if (args[0].equals("valid")) {
+          filterIsValid = true;
+        }
+
+        searchFilter = args[1];
+    }
+
+    /*
+     * ============================================================
+     * The remainder is just support stuff
+     */
+
+    // client and server thread
+    Thread clientThread = null;
+    Thread serverThread = null;
+
+    // client and server exceptions
+    volatile Exception serverException = null;
+    volatile Exception clientException = null;
+
+    void startServer(boolean newThread) throws Exception {
+        if (newThread) {
+            serverThread = new Thread() {
+                public void run() {
+                    try {
+                        doServerSide();
+                    } catch (Exception e) {
+                        /*
+                         * Our server thread just died.
+                         *
+                         * Release the client, if not active already...
+                         */
+                        System.err.println("Server died...");
+                        System.err.println(e);
+                        serverReady = true;
+                        serverException = e;
+                    }
+                }
+            };
+            serverThread.start();
+        } else {
+            doServerSide();
+        }
+    }
+
+    void startClient(boolean newThread) throws Exception {
+        if (newThread) {
+            clientThread = new Thread() {
+                public void run() {
+                    try {
+                        doClientSide();
+                    } catch (Exception e) {
+                        /*
+                         * Our client thread just died.
+                         */
+                        System.err.println("Client died...");
+                        clientException = e;
+                    }
+                }
+            };
+            clientThread.start();
+        } else {
+            doClientSide();
+        }
+    }
+
+    // Primary constructor, used to drive remainder of the test.
+    InvalidLdapFilters() throws Exception {
+        if (separateServerThread) {
+            startServer(true);
+            startClient(false);
+        } else {
+            startClient(true);
+            startServer(false);
+        }
+
+        /*
+         * Wait for other side to close down.
+         */
+        if (separateServerThread) {
+            serverThread.join();
+        } else {
+            clientThread.join();
+        }
+
+        /*
+         * When we get here, the test is pretty much over.
+         *
+         * If the main thread excepted, that propagates back
+         * immediately.  If the other thread threw an exception, we
+         * should report back.
+         */
+        if (serverException != null) {
+            System.out.print("Server Exception:");
+            throw serverException;
+        }
+        if (clientException != null) {
+            System.out.print("Client Exception:");
+            throw clientException;
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        // parse the customized arguments
+        parseArguments(args);
+
+        // start the test
+        new InvalidLdapFilters();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/AlphaComposite/TestAlphaCompositeForNaN.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,22 @@
+/*
+ * @test
+ * @bug 6918065
+ * @summary Test for passing NaN as alpha
+ *          should throw IllegalArgumentException
+ */
+
+import java.awt.*;
+
+public class TestAlphaCompositeForNaN {
+  public static void main(String[] args) {
+    try {
+      AlphaComposite a = AlphaComposite.getInstance(AlphaComposite.DST, Float.NaN);
+      System.out.println("Failed");
+      throw new RuntimeException(a + " failed to throw IllegalArgumentException for alpha = " + Float.NaN);
+    }
+    catch (IllegalArgumentException ie) {
+      System.out.println("Passed");
+      System.out.println("Caught " + ie);
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/Test4498236.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,188 @@
+/*
+ * 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 4498236
+ * @summary Tests toString methods
+ * @author Sergey Malenkov
+ */
+
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.beans.BeanDescriptor;
+import java.beans.EventSetDescriptor;
+import java.beans.FeatureDescriptor;
+import java.beans.IndexedPropertyChangeEvent;
+import java.beans.IndexedPropertyDescriptor;
+import java.beans.MethodDescriptor;
+import java.beans.ParameterDescriptor;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+
+public class Test4498236 {
+
+    public static void main(String[] args) throws Exception {
+        PropertyChangeEvent event = new PropertyChangeEvent("source", null, null, null);
+        event.setPropagationId("id");
+        test("[propertyName=null; oldValue=null; newValue=null; propagationId=id; source=source]", event);
+        test("[propertyName=name; oldValue=old; newValue=new; propagationId=null; source=source]",
+             new PropertyChangeEvent("source", "name", "old", "new")
+        );
+        test("[propertyName=array; index=5; oldValue=old; newValue=new; propagationId=null; source=source]",
+             new IndexedPropertyChangeEvent("source", "array", "old", "new", 5)
+        );
+        FeatureDescriptor fd = new FeatureDescriptor();
+        fd.setName("n");
+        fd.setDisplayName("dn");
+        fd.setShortDescription("sd");
+        fd.setPreferred(true);
+        fd.setHidden(true);
+        fd.setExpert(true);
+        fd.setValue("first", "value");
+        test("[name=n; displayName=dn; shortDescription=sd; preferred; hidden; expert; values={first=value}]", fd);
+        test("[name=String; beanClass=class java.lang.String]",
+             new BeanDescriptor(String.class)
+        );
+        test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
+             new BeanDescriptor(Object.class, String.class)
+        );
+        test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
+             new BeanDescriptor(Object.class, String.class)
+        );
+        test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object)]",
+             new MethodDescriptor(Object.class.getMethod("equals", Object.class))
+        );
+        test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object); parameterDescriptors={java.beans.ParameterDescriptor[name=null]}]",
+             new MethodDescriptor(Object.class.getMethod("equals", Object.class), new ParameterDescriptor[] {
+                     new ParameterDescriptor()
+             })
+        );
+        Class type = KeyListener.class;
+        String[] names = { "keyTyped", "keyPressed", "keyReleased" };
+        Method[] methods = new Method[names.length];
+        for (int i = 0; i < names.length; i++) {
+            methods[i] = type.getMethod(names[i], KeyEvent.class);
+        }
+        test("[name=key; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.getKeyListeners(); addListenerMethod=public void Test4498236.addKeyListener(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.removeKeyListener(java.awt.event.KeyListener)]",
+             new EventSetDescriptor(Test4498236.class, "key", type, names[0])
+        );
+        test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
+             new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove")
+        );
+        test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
+             new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove", "get")
+        );
+        test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
+             new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type))
+        );
+        test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
+             new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type), Test4498236.class.getMethod("get"))
+        );
+        test("[name=value; propertyType=boolean; readMethod=public boolean Test4498236.isValue(); writeMethod=public void Test4498236.setValue(boolean)]",
+             new PropertyDescriptor("value", Test4498236.class)
+        );
+        test("[name=$$$]",
+             new PropertyDescriptor("$$$", Test4498236.class, null, null)
+        );
+        test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
+             new PropertyDescriptor("$$$", Test4498236.class, "getValue", null)
+        );
+        test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
+             new PropertyDescriptor("$$$", Test4498236.class, "getValue", "setValue")
+        );
+        test("[name=$$$]",
+             new PropertyDescriptor("$$$", null, null)
+        );
+        test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
+             new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), null)
+        );
+        test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
+             new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), Test4498236.class.getMethod("setValue", boolean.class))
+        );
+        test("[name=index; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
+             new IndexedPropertyDescriptor("index", Test4498236.class)
+        );
+        test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
+             new IndexedPropertyDescriptor("$$$", Test4498236.class, "getIndex", "setIndex", "getIndex", "setIndex")
+        );
+        test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
+             new IndexedPropertyDescriptor("$$$", Test4498236.class.getMethod("getIndex"), Test4498236.class.getMethod("setIndex", new int[0].getClass()), Test4498236.class.getMethod("getIndex", int.class), Test4498236.class.getMethod("setIndex", int.class, int.class) )
+        );
+    }
+
+    public void addKeyListener(KeyListener listener) {
+        add(listener);
+    }
+
+    public void removeKeyListener(KeyListener listener) {
+        remove(listener);
+    }
+
+    public KeyListener getKeyListeners() {
+        return null;
+    }
+
+    public void add(KeyListener listener) {
+    }
+
+    public void remove(KeyListener listener) {
+    }
+
+    public KeyListener get() {
+        return null;
+    }
+
+    public boolean isValue() {
+        return true;
+    }
+
+    public boolean getValue() {
+        return true;
+    }
+
+    public void setValue(boolean value) {
+    }
+
+    public int[] getIndex() {
+        return null;
+    }
+
+    public int getIndex(int index) {
+        return 0;
+    }
+
+    public void setIndex(int index, int value) {
+    }
+
+    public void setIndex(int[] value) {
+    }
+
+    private static void test(String expected, Object object) {
+        String actual = object.toString();
+        if (!actual.equals(object.getClass().getName() + expected)) {
+            throw new Error(actual);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/XMLEncoder/Test5023550.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,122 @@
+/*
+ * 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 5023550
+ * @summary Tests complex references to owner
+ * @author Sergey Malenkov
+ */
+
+import java.beans.DefaultPersistenceDelegate;
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.XMLDecoder;
+import java.beans.XMLEncoder;
+
+public class Test5023550 extends AbstractTest {
+    public static void main(String[] args) {
+        new Test5023550().test(true);
+    }
+
+    private final Owner owner = new Owner();
+
+    @Override
+    protected void initialize(XMLEncoder encoder) {
+        encoder.setOwner(this.owner);
+        encoder.setPersistenceDelegate(A.class, new ADelegate());
+        encoder.setPersistenceDelegate(B.class, new BDelegate());
+        encoder.setPersistenceDelegate(C.class, new CDelegate());
+    }
+
+    @Override
+    protected void initialize(XMLDecoder decoder) {
+        decoder.setOwner(this.owner);
+    }
+
+    protected Object getObject() {
+        return this.owner.newA(this.owner.newB().newC());
+    }
+
+    public static class Owner {
+        public A newA(C c) {
+            return new A(c);
+        }
+
+        public B newB() {
+            return new B();
+        }
+    }
+
+    public static class A {
+        private final C c;
+
+        private A(C c) {
+            this.c = c;
+        }
+
+        public C getC() {
+            return this.c;
+        }
+    }
+
+    public static class B {
+        public C newC() {
+            return new C(this);
+        }
+    }
+
+    public static class C {
+        private final B b;
+
+        private C(B b) {
+            this.b = b;
+        }
+
+        public B getB() {
+            return this.b;
+        }
+    }
+
+    public static class ADelegate extends DefaultPersistenceDelegate {
+        protected Expression instantiate(Object old, Encoder out) {
+            XMLEncoder encoder = (XMLEncoder) out;
+            A a = (A) old;
+            return new Expression(old, encoder.getOwner(), "newA", new Object[] { a.getC() });
+        }
+    }
+
+    public static class BDelegate extends DefaultPersistenceDelegate {
+        protected Expression instantiate(Object old, Encoder out) {
+            XMLEncoder encoder = (XMLEncoder) out;
+            return new Expression(old, encoder.getOwner(), "newB", new Object[0]);
+        }
+    }
+
+    public static class CDelegate extends DefaultPersistenceDelegate {
+        protected Expression instantiate(Object old, Encoder out) {
+            C c = (C) old;
+            return new Expression(c, c.getB(), "newC", new Object[0]);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/XMLEncoder/Test5023557.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,99 @@
+/*
+ * 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 5023557
+ * @summary Tests complex references
+ * @author Sergey Malenkov
+ */
+
+import java.beans.DefaultPersistenceDelegate;
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.XMLEncoder;
+
+public class Test5023557 extends AbstractTest {
+    public static void main(String[] args) {
+        new Test5023557().test(true);
+    }
+
+    @Override
+    protected void initialize(XMLEncoder encoder) {
+        encoder.setPersistenceDelegate(B.class, new BDelegate());
+        encoder.setPersistenceDelegate(C.class, new CDelegate());
+    }
+
+    protected Object getObject() {
+        A a = new A();
+        return a.newC(a.newB());
+    }
+
+    public static class A {
+        public B newB() {
+            return new B(this);
+        }
+
+        public C newC(B b) {
+            return new C(b);
+        }
+    }
+
+    public static class B {
+        private final A a;
+
+        private B(A a) {
+            this.a = a;
+        }
+
+        public A getA() {
+            return this.a;
+        }
+    }
+
+    public static class C {
+        private final B b;
+
+        private C(B b) {
+            this.b = b;
+        }
+
+        public B getB() {
+            return this.b;
+        }
+    }
+
+    public static class BDelegate extends DefaultPersistenceDelegate {
+        protected Expression instantiate(Object old, Encoder out) {
+            B b = (B) old;
+            return new Expression(b, b.getA(), "newB", new Object[0]);
+        }
+    }
+
+    public static class CDelegate extends DefaultPersistenceDelegate {
+        protected Expression instantiate(Object old, Encoder out) {
+            C c = (C) old;
+            return new Expression(c, c.getB().getA(), "newC", new Object[] { c.getB() });
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/XMLEncoder/Test6921644.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,197 @@
+/*
+ * 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 6921644
+ * @summary Tests references to cached integer
+ * @author Sergey Malenkov
+ */
+
+import java.beans.ConstructorProperties;
+import java.util.ArrayList;
+import java.util.List;
+
+public final class Test6921644 extends AbstractTest {
+    public static void main(String[] args) {
+        new Test6921644().test(true);
+    }
+
+    protected Object getObject() {
+        Owner<Author> o = new Owner<Author>(100); // it works if ID >= 128
+
+        Category c = new Category(o);
+
+        Document d1 = new Document(o);
+        Document d2 = new Document(o);
+        Document d3 = new Document(o);
+
+        Author a1 = new Author(o);
+        Author a2 = new Author(o);
+        Author a3 = new Author(o);
+
+        o.getList().add(a1);
+        o.getList().add(a2);
+        o.getList().add(a3);
+
+        a3.setRef(o.getId());
+
+        d2.setCategory(c);
+        d3.setCategory(c);
+
+        a1.addDocument(d1);
+        a1.addDocument(d2);
+        a3.addDocument(d3);
+
+        c.addDocument(d2);
+        c.addDocument(d3);
+
+        return o;
+    }
+
+    public static class Owner<T> {
+        private int id;
+        private List<T> list = new ArrayList<T>();
+
+        @ConstructorProperties("id")
+        public Owner(int id) {
+            this.id = id;
+        }
+
+        public int getId() {
+            return this.id;
+        }
+
+        public List<T> getList() {
+            return this.list;
+        }
+
+        public void setList(List<T> list) {
+            this.list = list;
+        }
+    }
+
+    public static class Author {
+        private int id;
+        private int ref;
+        private Owner owner;
+        private List<Document> list = new ArrayList<Document>();
+
+        @ConstructorProperties("owner")
+        public Author(Owner<Author> owner) {
+            this.owner = owner;
+            this.id = owner.getId();
+        }
+
+        public Owner getOwner() {
+            return this.owner;
+        }
+
+        public Integer getId() {
+            return this.id;
+        }
+
+        public void setId(Integer id) {
+            this.id = id;
+        }
+
+        public Integer getRef() {
+            return this.ref;
+        }
+
+        public void setRef(Integer ref) {
+            this.ref = ref;
+        }
+
+        public List<Document> getList() {
+            return this.list;
+        }
+
+        public void setList(List<Document> list) {
+            this.list = list;
+        }
+
+        public void addDocument(Document document) {
+            this.list.add(document);
+            document.setAuthor(this);
+        }
+    }
+
+    public static class Category {
+        private Owner owner;
+        private List<Document> list = new ArrayList<Document>();
+
+        @ConstructorProperties("owner")
+        public Category(Owner owner) {
+            this.owner = owner;
+        }
+
+        public Owner getOwner() {
+            return this.owner;
+        }
+
+        public List<Document> getList() {
+            return this.list;
+        }
+
+        public void setList(List<Document> list) {
+            this.list = list;
+        }
+
+        public void addDocument(Document document) {
+            this.list.add(document);
+            document.setCategory(this);
+        }
+    }
+
+    public static class Document {
+        private Owner owner;
+        private Author author;
+        private Category category;
+
+        @ConstructorProperties("owner")
+        public Document(Owner owner) {
+            this.owner = owner;
+        }
+
+        public Owner getOwner() {
+            return this.owner;
+        }
+
+        public Author getAuthor() {
+            return this.author;
+        }
+
+        public void setAuthor(Author author) {
+            this.author = author;
+        }
+
+        public Category getCategory() {
+            return this.category;
+        }
+
+        public void setCategory(Category category) {
+            this.category = category;
+        }
+    }
+}
--- a/jdk/test/java/nio/file/Files/PrintFileTree.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/test/java/nio/file/Files/PrintFileTree.java	Fri Mar 26 11:10:26 2010 -0400
@@ -28,27 +28,33 @@
 
 /**
  * Invokes Files.walkFileTree to traverse a file tree and prints
- * each of the directories and files. The -L option causes symbolic
- * links to be followed.
+ * each of the directories and files. The -follow option causes symbolic
+ * links to be followed and the -printCycles option will print links
+ * where the target of the link is an ancestor directory.
  */
 
 public class PrintFileTree {
 
     public static void main(String[] args) throws Exception {
         boolean followLinks = false;
-        Path dir;
-
-        if (args[0].equals("-L")) {
-            followLinks = true;
-            dir = Paths.get(args[1]);
-        } else {
-            dir = Paths.get(args[0]);
+        boolean printCycles = false;
+        int i = 0;
+        while (i < (args.length-1)) {
+            switch (args[i]) {
+                case "-follow"      : followLinks = true; break;
+                case "-printCycles" : printCycles = true;  break;
+                default:
+                    throw new RuntimeException(args[i] + " not recognized");
+            }
+            i++;
         }
+        Path dir = Paths.get(args[i]);
 
         Set<FileVisitOption> options = new HashSet<FileVisitOption>();
         if (followLinks)
             options.add(FileVisitOption.FOLLOW_LINKS);
 
+        final boolean reportCycles = printCycles;
         Files.walkFileTree(dir, options, Integer.MAX_VALUE, new FileVisitor<FileRef>() {
             public FileVisitResult preVisitDirectory(FileRef dir) {
                 System.out.println(dir);
@@ -59,7 +65,8 @@
                 return FileVisitResult.CONTINUE;
             }
             public FileVisitResult visitFile(FileRef file, BasicFileAttributes attrs) {
-                System.out.println(file);
+                if (!attrs.isDirectory() || reportCycles)
+                    System.out.println(file);
                 return FileVisitResult.CONTINUE;
             }
             public FileVisitResult postVisitDirectory(FileRef dir, IOException exc) {
--- a/jdk/test/java/nio/file/Files/walk_file_tree.sh	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/test/java/nio/file/Files/walk_file_tree.sh	Fri Mar 26 11:10:26 2010 -0400
@@ -61,12 +61,20 @@
 diff out1 out2
 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
 
-# repeat test following links (use -follow instead of -L
-# to allow running on older systems)
-$JAVA PrintFileTree -L "$ROOT" > out1
-find "$ROOT" -follow > out2
+# repeat test following links. Some versions of find(1) output
+# cycles (sym links to ancestor directories), other versions do
+# not. For that reason we run PrintFileTree with the -printCycles
+# option when the output without this option differs to find(1).
+find "$ROOT" -follow > out1
+$JAVA PrintFileTree -follow "$ROOT" > out2
 diff out1 out2
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
+if [ $? != 0 ];
+  then 
+    # re-run printing cycles to stdout
+    $JAVA PrintFileTree -follow -printCycles "$ROOT" > out2
+    diff out1 out2
+    if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
+  fi
 
 # test SKIP_SIBLINGS
 $JAVA SkipSiblings "$ROOT"
--- a/jdk/test/java/nio/file/Path/CheckPermissions.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/test/java/nio/file/Path/CheckPermissions.java	Fri Mar 26 11:10:26 2010 -0400
@@ -197,7 +197,7 @@
     }
 
     public static void main(String[] args) throws IOException {
-        Path dir = Paths.get(System.getProperty("test.src", "."));
+        Path dir = Paths.get(System.getProperty("test.dir", "."));
         Path file = dir.resolve("file1234").createFile();
         try {
             LoggingSecurityManager.install();
--- a/jdk/test/java/nio/file/Path/PathOps.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/jdk/test/java/nio/file/Path/PathOps.java	Fri Mar 26 11:10:26 2010 -0400
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 4313887 6838333
+ * @bug 4313887 6838333 6925932
  * @summary Unit test for java.nio.file.Path path operations
  */
 
@@ -614,17 +614,34 @@
         test("/foo")
             .ends("foo")
             .ends("/foo")
-            .notEnds("/");
+            .notEnds("fool");
         test("/foo/bar")
             .ends("bar")
             .ends("foo/bar")
             .ends("/foo/bar")
-            .notEnds("/bar");
+            .notEnds("ar")
+            .notEnds("barack")
+            .notEnds("/bar")
+            .notEnds("o/bar");
         test("foo")
-            .ends("foo");
+            .ends("foo")
+            .notEnds("oo")
+            .notEnds("oola");
         test("foo/bar")
             .ends("bar")
-            .ends("foo/bar");
+            .ends("foo/bar")
+            .notEnds("r")
+            .notEnds("barmaid")
+            .notEnds("/bar");
+        test("foo/bar/gus")
+            .ends("gus")
+            .ends("bar/gus")
+            .ends("foo/bar/gus")
+            .notEnds("g")
+            .notEnds("/gus")
+            .notEnds("r/gus")
+            .notEnds("barack/gus")
+            .notEnds("bar/gust");
 
         // elements
         test("a/b/c")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/file/WatchService/LotsOfEvents.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,222 @@
+/*
+ * 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 6907760 6929532
+ * @summary Tests WatchService behavior when lots of events are pending
+ * @library ..
+ * @run main/timeout=180 LotsOfEvents
+ */
+
+import java.nio.file.*;
+import static java.nio.file.StandardWatchEventKind.*;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+public class LotsOfEvents {
+
+    static final Random rand = new Random();
+
+    public static void main(String[] args) throws Exception {
+        Path dir = TestUtil.createTemporaryDirectory();
+        try {
+            testOverflowEvent(dir);
+            testModifyEventsQueuing(dir);
+        } finally {
+            TestUtil.removeAll(dir);
+        }
+    }
+
+    /**
+     * Tests that OVERFLOW events are not retreived with other events.
+     */
+    static void testOverflowEvent(Path dir)
+        throws IOException, InterruptedException
+    {
+        WatchService watcher = dir.getFileSystem().newWatchService();
+        try {
+            dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE);
+
+            // create a lot of files
+            int n = 1024;
+            Path[] files = new Path[n];
+            for (int i=0; i<n; i++) {
+                files[i] = dir.resolve("foo" + i).createFile();
+            }
+
+            // give time for events to accumulate (improve chance of overflow)
+            Thread.sleep(1000);
+
+            // check that we see the create events (or overflow)
+            drainAndCheckOverflowEvents(watcher, ENTRY_CREATE, n);
+
+            // delete the files
+            for (int i=0; i<n; i++) {
+                files[i].delete();
+            }
+
+            // give time for events to accumulate (improve chance of overflow)
+            Thread.sleep(1000);
+
+            // check that we see the delete events (or overflow)
+            drainAndCheckOverflowEvents(watcher, ENTRY_DELETE, n);
+        } finally {
+            watcher.close();
+        }
+    }
+
+    static void drainAndCheckOverflowEvents(WatchService watcher,
+                                            WatchEvent.Kind<?> expectedKind,
+                                            int count)
+        throws IOException, InterruptedException
+    {
+        // wait for key to be signalled - the timeout is long to allow for
+        // polling implementations
+        WatchKey key = watcher.poll(15, TimeUnit.SECONDS);
+        if (key != null && count == 0)
+            throw new RuntimeException("Key was signalled (unexpected)");
+        if (key == null && count > 0)
+            throw new RuntimeException("Key not signalled (unexpected)");
+
+        int nread = 0;
+        boolean gotOverflow = false;
+        while (key != null) {
+            List<WatchEvent<?>> events = key.pollEvents();
+            for (WatchEvent<?> event: events) {
+                WatchEvent.Kind<?> kind = event.kind();
+                if (kind == expectedKind) {
+                    // expected event kind
+                    if (++nread > count)
+                        throw new RuntimeException("More events than expected!!");
+                } else if (kind == OVERFLOW) {
+                    // overflow event should not be retrieved with other events
+                    if (events.size() > 1)
+                        throw new RuntimeException("Overflow retrieved with other events");
+                    gotOverflow = true;
+                } else {
+                    throw new RuntimeException("Unexpected event '" + kind + "'");
+                }
+            }
+            if (!key.reset())
+                throw new RuntimeException("Key is no longer valid");
+            key = watcher.poll(2, TimeUnit.SECONDS);
+        }
+
+        // check that all expected events were received or there was an overflow
+        if (nread < count && !gotOverflow)
+            throw new RuntimeException("Insufficient events");
+    }
+
+    /**
+     * Tests that check that ENTRY_MODIFY events are queued efficiently
+     */
+    static void testModifyEventsQueuing(Path dir)
+        throws IOException, InterruptedException
+    {
+        // this test uses a random number of files
+        final int nfiles = 5 + rand.nextInt(10);
+        DirectoryEntry[] entries = new DirectoryEntry[nfiles];
+        for (int i=0; i<nfiles; i++) {
+            entries[i] = new DirectoryEntry(dir.resolve("foo" + i));
+
+            // "some" of the files exist, some do not.
+            entries[i].deleteIfExists();
+            if (rand.nextBoolean())
+                entries[i].create();
+        }
+
+        WatchService watcher = dir.getFileSystem().newWatchService();
+        try {
+            dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
+
+            // do several rounds of noise and test
+            for (int round=0; round<10; round++) {
+
+                // make some noise!!!
+                for (int i=0; i<100; i++) {
+                    DirectoryEntry entry = entries[rand.nextInt(nfiles)];
+                    int action = rand.nextInt(10);
+                    switch (action) {
+                        case 0 : entry.create(); break;
+                        case 1 : entry.deleteIfExists(); break;
+                        default: entry.modifyIfExists();
+                    }
+                }
+
+                // process events and ensure that we don't get repeated modify
+                // events for the same file.
+                WatchKey key = watcher.poll(15, TimeUnit.SECONDS);
+                while (key != null) {
+                    Set<Path> modified = new HashSet<Path>();
+                    for (WatchEvent<?> event: key.pollEvents()) {
+                        WatchEvent.Kind<?> kind = event.kind();
+                        Path file = (kind == OVERFLOW) ? null : (Path)event.context();
+                        if (kind == ENTRY_MODIFY) {
+                            boolean added = modified.add(file);
+                            if (!added) {
+                                throw new RuntimeException(
+                                    "ENTRY_MODIFY events not queued efficiently");
+                            }
+                        } else {
+                            if (file != null) modified.remove(file);
+                        }
+                    }
+                    if (!key.reset())
+                        throw new RuntimeException("Key is no longer valid");
+                    key = watcher.poll(2, TimeUnit.SECONDS);
+                }
+            }
+
+        } finally {
+            watcher.close();
+        }
+    }
+
+    static class DirectoryEntry {
+        private final Path file;
+        DirectoryEntry(Path file) {
+            this.file = file;
+        }
+        void create() throws IOException {
+            if (file.notExists())
+                file.createFile();
+
+        }
+        void deleteIfExists() throws IOException {
+            file.deleteIfExists();
+        }
+        void modifyIfExists() throws IOException {
+            if (file.exists()) {
+                OutputStream out = file.newOutputStream(StandardOpenOption.APPEND);
+                try {
+                    out.write("message".getBytes());
+                } finally {
+                    out.close();
+                }
+            }
+        }
+    }
+
+}
--- a/jdk/test/java/nio/file/WatchService/OverflowEventIsLoner.java	Thu Mar 25 16:54:59 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-/*
- * 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 6907760
- * @summary Check that the OVERFLOW event is not retrieved with other events
- * @library ..
- */
-
-import java.nio.file.*;
-import static java.nio.file.StandardWatchEventKind.*;
-import java.io.IOException;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-public class OverflowEventIsLoner {
-
-    static void drainEvents(WatchService watcher,
-                            WatchEvent.Kind<?> expectedKind,
-                            int count)
-        throws IOException, InterruptedException
-    {
-        // wait for key to be signalled - the timeout is long to allow for
-        // polling implementations
-        WatchKey key = watcher.poll(15, TimeUnit.SECONDS);
-        if (key != null && count == 0)
-            throw new RuntimeException("Key was signalled (unexpected)");
-        if (key == null && count > 0)
-            throw new RuntimeException("Key not signalled (unexpected)");
-
-        int nread = 0;
-        boolean gotOverflow = false;
-        do {
-            List<WatchEvent<?>> events = key.pollEvents();
-            for (WatchEvent<?> event: events) {
-                WatchEvent.Kind<?> kind = event.kind();
-                if (kind == expectedKind) {
-                    // expected event kind
-                    if (++nread > count)
-                        throw new RuntimeException("More events than expected!!");
-                } else if (kind == OVERFLOW) {
-                    // overflow event should not be retrieved with other events
-                    if (events.size() > 1)
-                        throw new RuntimeException("Overflow retrieved with other events");
-                    gotOverflow = true;
-                } else {
-                    throw new RuntimeException("Unexpected event '" + kind + "'");
-                }
-            }
-            if (!key.reset())
-                throw new RuntimeException("Key is no longer valid");
-            key = watcher.poll(2, TimeUnit.SECONDS);
-        } while (key != null);
-
-        // check that all expected events were received or there was an overflow
-        if (nread < count && !gotOverflow)
-            throw new RuntimeException("Insufficient events");
-    }
-
-
-    static void test(Path dir) throws IOException, InterruptedException {
-        WatchService watcher = dir.getFileSystem().newWatchService();
-        try {
-            WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE);
-
-            // create a lot of files
-            int n = 1024;
-            Path[] files = new Path[n];
-            for (int i=0; i<n; i++) {
-                files[i] = dir.resolve("foo" + i).createFile();
-            }
-
-            // give time for events to accumulate (improve chance of overflow)
-            Thread.sleep(1000);
-
-            // check that we see the create events (or overflow)
-            drainEvents(watcher, ENTRY_CREATE, n);
-
-            // delete the files
-            for (int i=0; i<n; i++) {
-                files[i].delete();
-            }
-
-            // give time for events to accumulate (improve chance of overflow)
-            Thread.sleep(1000);
-
-            // check that we see the delete events (or overflow)
-            drainEvents(watcher, ENTRY_DELETE, n);
-        } finally {
-            watcher.close();
-        }
-    }
-
-    public static void main(String[] args) throws Exception {
-        Path dir = TestUtil.createTemporaryDirectory();
-        try {
-            test(dir);
-        } finally {
-            TestUtil.removeAll(dir);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/IdentityScope/NoDefaultSystemScope.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,42 @@
+/*
+ * 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 6921001
+ * @summary The default system identity scope is now null.
+ */
+import java.security.*;
+
+public class NoDefaultSystemScope {
+
+    public static void main(String args[]) throws Exception {
+        IdentityScope s = IdentityScope.getSystemScope();
+
+        if (s != null) {
+            throw new Exception("The default system scope should be null");
+        }
+        System.out.println("TEST PASSED");
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JEditorPane/6917744/bug6917744.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,113 @@
+/*
+ * 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 6917744
+ * @summary JScrollPane Page Up/Down keys do not handle correctly html tables with different cells contents
+ * @author Pavel Porvatov
+ * @run main bug6917744
+ */
+
+import java.awt.*;
+import java.awt.event.KeyEvent;
+import java.io.IOException;
+import javax.swing.*;
+
+import sun.awt.SunToolkit;
+
+public class bug6917744 {
+    private static JFrame frame;
+
+    private static JEditorPane editorPane;
+
+    private static JScrollPane scrollPane;
+
+    private static Robot robot;
+
+    public static void main(String[] args) throws Exception {
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+        robot = new Robot();
+        robot.setAutoDelay(100);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                frame = new JFrame();
+
+                editorPane = new JEditorPane();
+
+                try {
+                    editorPane.setPage(bug6917744.class.getResource("/test.html"));
+                } catch (IOException e) {
+                    throw new RuntimeException("HTML resource not found", e);
+                }
+
+                scrollPane = new JScrollPane(editorPane);
+
+                frame.getContentPane().add(scrollPane);
+                frame.setSize(400, 300);
+                frame.setVisible(true);
+            }
+        });
+
+        toolkit.realSync();
+
+        for (int i = 0; i < 50; i++) {
+            robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+        }
+
+        toolkit.realSync();
+
+        // Check that we at the end of document
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                BoundedRangeModel model = scrollPane.getVerticalScrollBar().getModel();
+
+                if (model.getValue() + model.getExtent() != model.getMaximum()) {
+                    throw new RuntimeException("Invalid HTML position");
+                }
+            }
+        });
+
+        toolkit.realSync();
+
+        for (int i = 0; i < 50; i++) {
+            robot.keyPress(KeyEvent.VK_PAGE_UP);
+        }
+
+        toolkit.realSync();
+
+        // Check that we at the begin of document
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                BoundedRangeModel model = scrollPane.getVerticalScrollBar().getModel();
+
+                if (model.getValue() != model.getMinimum()) {
+                    throw new RuntimeException("Invalid HTML position");
+                }
+
+                frame.dispose();
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JEditorPane/6917744/test.html	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,494 @@
+<html>
+<body bgcolor="#ffffff">
+<table border="0">
+<tr>
+<td>&nbsp;</td>
+<td valign="top">
+
+<font size="+1" face="Arial, Helvetica, sans-serif">
+    <b>TEST FOR JScrollPane BUG</b> <br>
+</font>
+<font face="Arial, Helvetica, sans-serif" size="-1">
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<font size="+1" face="Arial, Helvetica, sans-serif">
+    <b>END OF TEST FOR JScrollPane BUG</b> <br>
+</font>
+</font>
+</td>
+<td>&nbsp;</td>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JScrollBar/6924059/bug6924059.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,56 @@
+/*
+ * 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 6924059
+ * @summary SynthScrollBarUI.configureScrollBarColors() should have spec different from the overridden method
+ * @author Pavel Porvatov
+ * @run main bug6924059
+ */
+
+import javax.swing.*;
+import javax.swing.plaf.synth.SynthLookAndFeel;
+import javax.swing.plaf.synth.SynthScrollBarUI;
+
+public class bug6924059 {
+    private static boolean isMethodCalled;
+
+    public static void main(String[] args) throws Exception {
+        UIManager.setLookAndFeel(new SynthLookAndFeel());
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                new JScrollBar().setUI(new SynthScrollBarUI() {
+                    protected void configureScrollBarColors() {
+                        super.configureScrollBarColors();
+                        isMethodCalled = true;
+                    }
+                });
+
+                if (!isMethodCalled) {
+                    throw new RuntimeException("The configureScrollBarColors was not called");
+                }
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JSlider/6848475/bug6848475.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,126 @@
+/*
+ * 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 6848475
+ * @summary JSlider does not display the correct value of its BoundedRangeModel
+ * @author Pavel Porvatov
+ * @run main bug6848475
+ */
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import javax.swing.plaf.SliderUI;
+import javax.swing.plaf.basic.BasicSliderUI;
+import java.awt.*;
+import java.awt.event.InputEvent;
+import java.lang.reflect.Field;
+
+public class bug6848475 {
+    private static JFrame frame;
+
+    private static JSlider slider;
+
+    private static Robot robot;
+
+    private static int thumbRectX;
+
+    public static void main(String[] args) throws Exception {
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+        robot = new Robot();
+        robot.setAutoDelay(100);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                frame = new JFrame();
+
+                DefaultBoundedRangeModel sliderModel = new DefaultBoundedRangeModel() {
+                    public void setValue(int n) {
+                        // Don't allow value to be changed
+                    }
+                };
+
+                slider = new JSlider(sliderModel);
+
+                frame.getContentPane().add(slider);
+                frame.pack();
+                frame.setVisible(true);
+            }
+        });
+
+        toolkit.realSync();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                Point p = slider.getLocationOnScreen();
+
+                robot.mouseMove(p.x, p.y);
+            }
+        });
+
+        toolkit.realSync();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                thumbRectX = getThumbRectField().x;
+
+                Point p = slider.getLocationOnScreen();
+
+                robot.mouseMove(p.x, p.y);
+                robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+                robot.mouseMove(p.x + 20, p.y);
+                robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+            }
+        });
+
+        toolkit.realSync();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                Rectangle newThumbRect = getThumbRectField();
+
+                if (newThumbRect.x != thumbRectX) {
+                    throw new RuntimeException("Test failed: the thumb was moved");
+                }
+
+                frame.dispose();
+            }
+        });
+    }
+
+    private static Rectangle getThumbRectField() {
+        try {
+            SliderUI ui = slider.getUI();
+
+            Field field = BasicSliderUI.class.getDeclaredField("thumbRect");
+
+            field.setAccessible(true);
+
+            return (Rectangle) field.get(ui);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JSlider/6918861/bug6918861.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,103 @@
+/*
+ * 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 6918861
+ * @summary SynthSliderUI.uninstallDefaults() is not called when UI is uninstalled
+ * @author Pavel Porvatov
+ * @run main bug6918861
+ */
+
+import javax.swing.*;
+import javax.swing.plaf.synth.SynthLookAndFeel;
+import javax.swing.plaf.synth.SynthSliderUI;
+
+public class bug6918861 {
+    public static void main(String[] args) throws Exception {
+        UIManager.setLookAndFeel(new SynthLookAndFeel());
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                JSlider slider = new JSlider();
+
+                HackedSynthSliderUI ui = new HackedSynthSliderUI(slider);
+
+                slider.setUI(ui);
+
+                if (ui.counter != 111) {
+                    throw new RuntimeException("Some installers of SynthSliderUI weren't invoked");
+                }
+
+                slider.setUI(null);
+
+                if (ui.counter != 0) {
+                    throw new RuntimeException("Some uninstallers of SynthSliderUI weren't invoked");
+                }
+            }
+        });
+    }
+
+    private static class HackedSynthSliderUI extends SynthSliderUI {
+        private int counter;
+
+        protected HackedSynthSliderUI(JSlider c) {
+            super(c);
+        }
+
+        protected void installDefaults(JSlider slider) {
+            super.installDefaults(slider);
+
+            counter += 1;
+        }
+
+        protected void uninstallDefaults(JSlider slider) {
+            super.uninstallDefaults(slider);
+
+            counter -= 1;
+        }
+
+        protected void installListeners(JSlider slider) {
+            super.installListeners(slider);
+
+            counter += 10;
+        }
+
+        protected void uninstallListeners(JSlider slider) {
+            super.uninstallListeners(slider);
+
+            counter -= 10;
+        }
+
+        protected void installKeyboardActions(JSlider slider) {
+            super.installKeyboardActions(slider);
+
+            counter += 100;
+        }
+
+        protected void uninstallKeyboardActions(JSlider slider) {
+            super.uninstallKeyboardActions(slider);
+
+            counter -= 100;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JSlider/6923305/bug6923305.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,63 @@
+/*
+ * 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 6923305
+ * @summary SynthSliderUI paints the slider track when the slider's "paintTrack" property is set to false
+ * @author Pavel Porvatov
+ * @run main bug6923305
+ */
+
+import javax.swing.*;
+import javax.swing.plaf.synth.SynthContext;
+import javax.swing.plaf.synth.SynthLookAndFeel;
+import javax.swing.plaf.synth.SynthSliderUI;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+public class bug6923305 {
+    public static void main(String[] args) throws Exception {
+        UIManager.setLookAndFeel(new SynthLookAndFeel());
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                JSlider slider = new JSlider();
+
+                slider.setUI(new SynthSliderUI(slider) {
+                    @Override
+                    protected void paintTrack(SynthContext context, Graphics g, Rectangle trackBounds) {
+                        throw new RuntimeException("Test failed: the SynthSliderUI.paintTrack was invoked");
+                    }
+                });
+
+                slider.setPaintTrack(false);
+                slider.setSize(slider.getPreferredSize());
+
+                BufferedImage bufferedImage = new BufferedImage(slider.getWidth(), slider.getHeight(),
+                        BufferedImage.TYPE_INT_ARGB);
+
+                slider.paint(bufferedImage.getGraphics());
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTable/6913768/bug6913768.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,53 @@
+/*
+ * 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 6913768
+ * @summary With default SynthLookAndFeel instance installed new JTable creation leads to throwing NPE
+ * @author Pavel Porvatov
+ * @run main bug6913768
+ */
+
+import javax.swing.*;
+import javax.swing.plaf.synth.SynthLookAndFeel;
+
+public class bug6913768 {
+    public static void main(String[] args) throws Exception {
+        UIManager.setLookAndFeel(new SynthLookAndFeel());
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                JFrame frame = new JFrame();
+
+                JTable table = new JTable(new Object[][]{{"1", "2"}, {"3", "4"}},
+                        new Object[]{"col1", "col2"});
+
+                frame.getContentPane().add(new JScrollPane(table));
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                frame.setSize(300, 200);
+                frame.setLocationRelativeTo(null);
+                frame.setVisible(true);
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/etype/WeakCrypto.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,50 @@
+/*
+ * 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 6844909
+ * @run main/othervm WeakCrypto
+ * @summary support allow_weak_crypto in krb5.conf
+ */
+
+import java.io.File;
+import sun.security.krb5.internal.crypto.EType;
+import sun.security.krb5.EncryptedData;
+
+public class WeakCrypto {
+    public static void main(String[] args) throws Exception {
+        System.setProperty("java.security.krb5.conf",
+                System.getProperty("test.src", ".") +
+                File.separator +
+                "weakcrypto.conf");
+        int[] etypes = EType.getBuiltInDefaults();
+
+        for (int i=0, length = etypes.length; i<length; i++) {
+            if (etypes[i] == EncryptedData.ETYPE_DES_CBC_CRC ||
+                    etypes[i] == EncryptedData.ETYPE_DES_CBC_MD4 ||
+                    etypes[i] == EncryptedData.ETYPE_DES_CBC_MD5) {
+                throw new Exception("DES should not appear");
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/etype/weakcrypto.conf	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,2 @@
+[libdefaults]
+allow_weak_crypto = false
--- a/langtools/.hgtags	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/.hgtags	Fri Mar 26 11:10:26 2010 -0400
@@ -59,3 +59,4 @@
 47003a3622f6a17756ab0338bfa8a43e36549e99 jdk7-b82
 c9f4ae1f1480e89aaf7e72173184089d9cea397a jdk7-b83
 d9cd5b8286e44f3baf90da290cd295433e21c05a jdk7-b84
+136bfc67946219fb02ee223984540a4a9c5b209f jdk7-b85
--- a/langtools/src/share/classes/com/sun/tools/apt/comp/Apt.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/apt/comp/Apt.java	Fri Mar 26 11:10:26 2010 -0400
@@ -457,8 +457,10 @@
                 throw new UsageMessageNeededException();
 
             try {
-                for(AnnotationProcessorFactory apFactory: factoryToAnnotation.keySet()) {
-                    AnnotationProcessor processor = apFactory.getProcessorFor(factoryToAnnotation.get(apFactory),
+                for(Map.Entry<AnnotationProcessorFactory, Set<AnnotationTypeDeclaration>> entry :
+                        factoryToAnnotation.entrySet()) {
+                    AnnotationProcessorFactory  apFactory = entry.getKey();
+                    AnnotationProcessor processor = apFactory.getProcessorFor(entry.getValue(),
                                                                               trivAPE);
                     if (processor != null)
                         processors.add(processor);
--- a/langtools/src/share/classes/com/sun/tools/apt/main/CommandLine.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/apt/main/CommandLine.java	Fri Mar 26 11:10:26 2010 -0400
@@ -82,7 +82,7 @@
         st.commentChar('#');
         st.quoteChar('"');
         st.quoteChar('\'');
-        while (st.nextToken() != st.TT_EOF) {
+        while (st.nextToken() != StreamTokenizer.TT_EOF) {
             args.append(st.sval);
         }
         r.close();
--- a/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java	Fri Mar 26 11:10:26 2010 -0400
@@ -270,7 +270,7 @@
      * The toString, hashCode, and equals methods foward to the underlying
      * type.
      */
-    private static class MirroredTypeExceptionProxy extends ExceptionProxy {
+    private static final class MirroredTypeExceptionProxy extends ExceptionProxy {
         private static final long serialVersionUID = 6662035281599933545L;
 
         private MirroredTypeException ex;
@@ -312,7 +312,7 @@
      * The toString, hashCode, and equals methods foward to the underlying
      * types.
      */
-    private static class MirroredTypesExceptionProxy extends ExceptionProxy {
+    private static final class MirroredTypesExceptionProxy extends ExceptionProxy {
         private static final long serialVersionUID = -6670822532616693951L;
 
         private MirroredTypesException ex;
--- a/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/DeclarationImpl.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/DeclarationImpl.java	Fri Mar 26 11:10:26 2010 -0400
@@ -58,7 +58,7 @@
     protected final AptEnv env;
     public final Symbol sym;
 
-    protected static DeclarationFilter identityFilter =
+    protected static final DeclarationFilter identityFilter =
             new DeclarationFilter();
 
 
--- a/langtools/src/share/classes/com/sun/tools/apt/mirror/type/TypeMirrorImpl.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/apt/mirror/type/TypeMirrorImpl.java	Fri Mar 26 11:10:26 2010 -0400
@@ -71,6 +71,6 @@
      * {@inheritDoc}
      */
     public int hashCode() {
-        return env.jctypes.hashCode(type);
+        return Types.hashCode(type);
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java	Fri Mar 26 11:10:26 2010 -0400
@@ -40,7 +40,7 @@
  */
 public class ConstantPool {
 
-    public class InvalidIndex extends ConstantPoolException {
+    public static class InvalidIndex extends ConstantPoolException {
         private static final long serialVersionUID = -4350294289300939730L;
         InvalidIndex(int index) {
             super(index);
@@ -53,7 +53,7 @@
         }
     }
 
-    public class UnexpectedEntry extends ConstantPoolException {
+    public static class UnexpectedEntry extends ConstantPoolException {
         private static final long serialVersionUID = 6986335935377933211L;
         UnexpectedEntry(int index, int expected_tag, int found_tag) {
             super(index);
@@ -71,7 +71,7 @@
         public final int found_tag;
     }
 
-    public class InvalidEntry extends ConstantPoolException {
+    public static class InvalidEntry extends ConstantPoolException {
         private static final long serialVersionUID = 1000087545585204447L;
         InvalidEntry(int index, int tag) {
             super(index);
@@ -87,7 +87,7 @@
         public final int tag;
     }
 
-    public class EntryNotFound extends ConstantPoolException {
+    public static class EntryNotFound extends ConstantPoolException {
         private static final long serialVersionUID = 2885537606468581850L;
         EntryNotFound(Object value) {
             super(-1);
@@ -694,7 +694,7 @@
         public int byteLength() {
             class SizeOutputStream extends OutputStream {
                 @Override
-                public void write(int b) throws IOException {
+                public void write(int b) {
                     size++;
                 }
                 int size;
--- a/langtools/src/share/classes/com/sun/tools/doclets/standard/Standard.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/standard/Standard.java	Fri Mar 26 11:10:26 2010 -0400
@@ -31,23 +31,21 @@
 
 public class Standard {
 
-    public static final HtmlDoclet htmlDoclet = new HtmlDoclet();
-
     public static int optionLength(String option) {
-        return htmlDoclet.optionLength(option);
+        return HtmlDoclet.optionLength(option);
     }
 
     public static boolean start(RootDoc root) {
-        return htmlDoclet.start(root);
+        return HtmlDoclet.start(root);
     }
 
     public static boolean validOptions(String[][] options,
                                    DocErrorReporter reporter) {
-        return htmlDoclet.validOptions(options, reporter);
+        return HtmlDoclet.validOptions(options, reporter);
     }
 
     public static LanguageVersion languageVersion() {
-        return htmlDoclet.languageVersion();
+        return HtmlDoclet.languageVersion();
     }
 
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/Launcher.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/Launcher.java	Fri Mar 26 11:10:26 2010 -0400
@@ -64,7 +64,7 @@
                 fileChooser.setSelectedFile(new File(fileName));
             }
         }
-        if (fileChooser.showOpenDialog(null) == fileChooser.APPROVE_OPTION) {
+        if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
             String fileName = fileChooser.getSelectedFile().getPath();
             prefs.put("recent.file", fileName);
             javac.run(System.in, null, null, "-d", "/tmp", fileName);
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java	Fri Mar 26 11:10:26 2010 -0400
@@ -137,7 +137,7 @@
     }
 
     private static boolean match(OptionKind clientKind, OptionKind optionKind) {
-        return (clientKind == (optionKind == OptionKind.HIDDEN ? optionKind.EXTENDED : optionKind));
+        return (clientKind == (optionKind == OptionKind.HIDDEN ? OptionKind.EXTENDED : optionKind));
     }
 
     public JavacFileManager getStandardFileManager(
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java	Fri Mar 26 11:10:26 2010 -0400
@@ -198,7 +198,12 @@
         /**
          * Warn about Sun proprietary API that may be removed in a future release.
          */
-        SUNAPI("sunapi", true);
+        SUNAPI("sunapi", true),
+
+        /**
+         * Warn about issues relating to use of statics
+         */
+        STATIC("static");
 
         LintCategory(String option) {
             this(option, false);
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Fri Mar 26 11:10:26 2010 -0400
@@ -162,7 +162,7 @@
      * the default package; otherwise, the owner symbol is returned
      */
     public Symbol location() {
-        if (owner.name == null || (owner.name.isEmpty() && owner.kind != PCK)) {
+        if (owner.name == null || (owner.name.isEmpty() && owner.kind != PCK && owner.kind != TYP)) {
             return null;
         }
         return owner;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Fri Mar 26 11:10:26 2010 -0400
@@ -2504,7 +2504,7 @@
             }
             @Override
             public int hashCode() {
-                return 127 * Types.this.hashCode(t1) + Types.this.hashCode(t2);
+                return 127 * Types.hashCode(t1) + Types.hashCode(t2);
             }
             @Override
             public boolean equals(Object obj) {
@@ -3375,7 +3375,7 @@
             this.t = t;
         }
         public int hashCode() {
-            return Types.this.hashCode(t);
+            return Types.hashCode(t);
         }
         public boolean equals(Object obj) {
             return (obj instanceof SingletonType) &&
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Mar 26 11:10:26 2010 -0400
@@ -2020,6 +2020,10 @@
                               tree.pos(), site, sym.name, true);
                 }
             }
+        } else if (sym.kind != ERR && (sym.flags() & STATIC) != 0 && sym.name != names._class) {
+            // If the qualified item is not a type and the selected item is static, report
+            // a warning. Make allowance for the class of an array type e.g. Object[].class)
+            chk.warnStatic(tree, "static.not.qualified.by.type", Kinds.kindName(sym.kind), sym.owner);
         }
 
         // If we are selecting an instance member via a `super', ...
@@ -2636,6 +2640,7 @@
                 if (tree.bounds.tail.nonEmpty()) {
                     log.error(tree.bounds.tail.head.pos(),
                               "type.var.may.not.be.followed.by.other.bounds");
+                    log.unrecoverableError = true;
                     tree.bounds = List.of(tree.bounds.head);
                     a.bound = bs.head;
                 }
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Fri Mar 26 11:10:26 2010 -0400
@@ -189,6 +189,11 @@
             sunApiHandler.report(pos, msg, args);
     }
 
+    public void warnStatic(DiagnosticPosition pos, String msg, Object... args) {
+        if (lint.isEnabled(LintCategory.STATIC))
+            log.warning(pos, msg, args);
+    }
+
     /**
      * Report any deferred diagnostics.
      */
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java	Fri Mar 26 11:10:26 2010 -0400
@@ -270,6 +270,7 @@
         return ts.toList();
     }
 
+    @Override
     public void visitTopLevel(JCCompilationUnit tree) {
         JavaFileObject prev = log.useSource(tree.sourcefile);
         boolean addEnv = false;
@@ -289,13 +290,13 @@
             tree.packge = syms.unnamedPackage;
         }
         tree.packge.complete(); // Find all classes in package.
-        Env<AttrContext> env = topLevelEnv(tree);
+        Env<AttrContext> topEnv = topLevelEnv(tree);
 
         // Save environment of package-info.java file.
         if (isPkgInfo) {
             Env<AttrContext> env0 = typeEnvs.get(tree.packge);
             if (env0 == null) {
-                typeEnvs.put(tree.packge, env);
+                typeEnvs.put(tree.packge, topEnv);
             } else {
                 JCCompilationUnit tree0 = env0.toplevel;
                 if (!fileManager.isSameFile(tree.sourcefile, tree0.sourcefile)) {
@@ -306,7 +307,7 @@
                     if (addEnv || (tree0.packageAnnotations.isEmpty() &&
                                    tree.docComments != null &&
                                    tree.docComments.get(tree) != null)) {
-                        typeEnvs.put(tree.packge, env);
+                        typeEnvs.put(tree.packge, topEnv);
                     }
                 }
             }
@@ -322,14 +323,15 @@
             c.members_field = new Scope(c);
             tree.packge.package_info = c;
         }
-        classEnter(tree.defs, env);
+        classEnter(tree.defs, topEnv);
         if (addEnv) {
-            todo.append(env);
+            todo.append(topEnv);
         }
         log.useSource(prev);
         result = null;
     }
 
+    @Override
     public void visitClassDef(JCClassDecl tree) {
         Symbol owner = env.info.scope.owner;
         Scope enclScope = enterScope(env);
@@ -435,6 +437,7 @@
      *  Enter a symbol for type parameter in local scope, after checking that it
      *  is unique.
      */
+    @Override
     public void visitTypeParameter(JCTypeParameter tree) {
         TypeVar a = (tree.type != null)
             ? (TypeVar)tree.type
@@ -448,6 +451,7 @@
 
     /** Default class enter visitor method: do nothing.
      */
+    @Override
     public void visitTree(JCTree tree) {
         result = null;
     }
@@ -489,10 +493,8 @@
                 for (JCCompilationUnit tree : trees) {
                     if (tree.starImportScope.elems == null) {
                         JavaFileObject prev = log.useSource(tree.sourcefile);
-                        Env<AttrContext> env = typeEnvs.get(tree);
-                        if (env == null)
-                            env = topLevelEnv(tree);
-                        memberEnter.memberEnter(tree, env);
+                        Env<AttrContext> topEnv = topLevelEnv(tree);
+                        memberEnter.memberEnter(tree, topEnv);
                         log.useSource(prev);
                     }
                 }
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Fri Mar 26 11:10:26 2010 -0400
@@ -607,10 +607,12 @@
     public void visitNewArray(JCNewArray tree) {
         tree.elemtype = translate(tree.elemtype, null);
         translate(tree.dims, syms.intType);
-        tree.elems = translate(tree.elems,
-                               (tree.type == null) ? null
-                               : erasure(types.elemtype(tree.type)));
-        tree.type = erasure(tree.type);
+        if (tree.type != null) {
+            tree.elems = translate(tree.elems, erasure(types.elemtype(tree.type)));
+            tree.type = erasure(tree.type);
+        } else {
+            tree.elems = translate(tree.elems, null);
+        }
 
         result = tree;
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Fri Mar 26 11:10:26 2010 -0400
@@ -260,7 +260,7 @@
                     archive = openArchive(directory);
                 } catch (IOException ex) {
                     log.error("error.reading.file",
-                       directory, ex.getLocalizedMessage());
+                       directory, getMessage(ex));
                     return;
                 }
             }
@@ -489,7 +489,7 @@
                 archive = new MissingArchive(zipFileName);
             } catch (IOException ex) {
                 if (zipFileName.exists())
-                    log.error("error.reading.file", zipFileName, ex.getLocalizedMessage());
+                    log.error("error.reading.file", zipFileName, getMessage(ex));
                 archive = new MissingArchive(zipFileName);
             }
 
@@ -838,4 +838,23 @@
         }
         throw new IllegalArgumentException("Invalid relative path: " + file);
     }
+
+    /**
+     * Get a detail message from an IOException.
+     * Most, but not all, instances of IOException provide a non-null result
+     * for getLocalizedMessage().  But some instances return null: in these
+     * cases, fallover to getMessage(), and if even that is null, return the
+     * name of the exception itself.
+     * @param e an IOException
+     * @return a string to include in a compiler diagnostic
+     */
+    public static String getMessage(IOException e) {
+        String s = e.getLocalizedMessage();
+        if (s != null)
+            return s;
+        s = e.getMessage();
+        if (s != null)
+            return s;
+        return e.toString();
+    }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java	Fri Mar 26 11:10:26 2010 -0400
@@ -320,7 +320,7 @@
                     addFile(f, warn);
                 }
             } catch (IOException e) {
-                log.error("error.reading.file", jarFile, e.getLocalizedMessage());
+                log.error("error.reading.file", jarFile, JavacFileManager.getMessage(e));
             }
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri Mar 26 11:10:26 2010 -0400
@@ -1135,7 +1135,7 @@
         self.name = simpleBinaryName(self.flatname, c.flatname) ;
         self.owner = m != null ? m : c;
         if (self.name.isEmpty())
-            self.fullname = null;
+            self.fullname = names.empty;
         else
             self.fullname = ClassSymbol.formFullName(self.name, self.owner);
 
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Fri Mar 26 11:10:26 2010 -0400
@@ -808,8 +808,8 @@
             code.resolve(secondJumps);
             CondItem second = genCond(tree.falsepart, CRT_FLOW_TARGET);
             CondItem result = items.makeCondItem(second.opcode,
-                                      code.mergeChains(trueJumps, second.trueJumps),
-                                      code.mergeChains(falseJumps, second.falseJumps));
+                                      Code.mergeChains(trueJumps, second.trueJumps),
+                                      Code.mergeChains(falseJumps, second.falseJumps));
             if (markBranches) result.tree = tree.falsepart;
             return result;
         } else {
@@ -1322,7 +1322,7 @@
                 if (useJsrLocally) {
                     if (tree.finalizer != null) {
                         Code.State jsrState = code.state.dup();
-                        jsrState.push(code.jsrReturnValue);
+                        jsrState.push(Code.jsrReturnValue);
                         tryEnv.info.cont =
                             new Chain(code.emitJump(jsr),
                                       tryEnv.info.cont,
@@ -1375,7 +1375,7 @@
                 genFinalizer(env);
                 if (hasFinalizer || l.tail.nonEmpty()) {
                     code.statBegin(TreeInfo.endPos(env.tree));
-                    exitChain = code.mergeChains(exitChain,
+                    exitChain = Code.mergeChains(exitChain,
                                                  code.branch(goto_));
                 }
                 endFinalizerGap(env);
@@ -1963,7 +1963,7 @@
                 result = items.
                     makeCondItem(rcond.opcode,
                                  rcond.trueJumps,
-                                 code.mergeChains(falseJumps,
+                                 Code.mergeChains(falseJumps,
                                                   rcond.falseJumps));
             } else {
                 result = lcond;
@@ -1976,7 +1976,7 @@
                 CondItem rcond = genCond(tree.rhs, CRT_FLOW_TARGET);
                 result = items.
                     makeCondItem(rcond.opcode,
-                                 code.mergeChains(trueJumps, rcond.trueJumps),
+                                 Code.mergeChains(trueJumps, rcond.trueJumps),
                                  rcond.falseJumps);
             } else {
                 result = lcond;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Items.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Items.java	Fri Mar 26 11:10:26 2010 -0400
@@ -792,25 +792,25 @@
         }
 
         Chain jumpTrue() {
-            if (tree == null) return code.mergeChains(trueJumps, code.branch(opcode));
+            if (tree == null) return Code.mergeChains(trueJumps, code.branch(opcode));
             // we should proceed further in -Xjcov mode only
             int startpc = code.curPc();
-            Chain c = code.mergeChains(trueJumps, code.branch(opcode));
+            Chain c = Code.mergeChains(trueJumps, code.branch(opcode));
             code.crt.put(tree, CRTable.CRT_BRANCH_TRUE, startpc, code.curPc());
             return c;
         }
 
         Chain jumpFalse() {
-            if (tree == null) return code.mergeChains(falseJumps, code.branch(code.negate(opcode)));
+            if (tree == null) return Code.mergeChains(falseJumps, code.branch(Code.negate(opcode)));
             // we should proceed further in -Xjcov mode only
             int startpc = code.curPc();
-            Chain c = code.mergeChains(falseJumps, code.branch(code.negate(opcode)));
+            Chain c = Code.mergeChains(falseJumps, code.branch(Code.negate(opcode)));
             code.crt.put(tree, CRTable.CRT_BRANCH_FALSE, startpc, code.curPc());
             return c;
         }
 
         CondItem negate() {
-            CondItem c = new CondItem(code.negate(opcode), falseJumps, trueJumps);
+            CondItem c = new CondItem(Code.negate(opcode), falseJumps, trueJumps);
             c.tree = tree;
             return c;
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/main/CommandLine.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/CommandLine.java	Fri Mar 26 11:10:26 2010 -0400
@@ -82,7 +82,7 @@
         st.commentChar('#');
         st.quoteChar('"');
         st.quoteChar('\'');
-        while (st.nextToken() != st.TT_EOF) {
+        while (st.nextToken() != StreamTokenizer.TT_EOF) {
             args.append(st.sval);
         }
         r.close();
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Fri Mar 26 11:10:26 2010 -0400
@@ -549,12 +549,6 @@
             return log.nwarnings;
     }
 
-    /** Whether or not any parse errors have occurred.
-     */
-    public boolean parseErrors() {
-        return parseErrors;
-    }
-
     /** Try to open input stream with given name.
      *  Report an error if this fails.
      *  @param filename   The file name of the input stream to be opened.
@@ -564,7 +558,7 @@
             inputFiles.add(filename);
             return filename.getCharContent(false);
         } catch (IOException e) {
-            log.error("error.reading.file", filename, e.getLocalizedMessage());
+            log.error("error.reading.file", filename, JavacFileManager.getMessage(e));
             return null;
         }
     }
@@ -588,7 +582,7 @@
             int initialErrorCount = log.nerrors;
             Parser parser = parserFactory.newParser(content, keepComments(), genEndPos, lineDebugInfo);
             tree = parser.parseCompilationUnit();
-            parseErrors |= (log.nerrors > initialErrorCount);
+            log.unrecoverableError |= (log.nerrors > initialErrorCount);
             if (verbose) {
                 printVerbose("parsing.done", Long.toString(elapsed(msec)));
             }
@@ -723,7 +717,7 @@
         try {
             tree = parse(filename, filename.getCharContent(false));
         } catch (IOException e) {
-            log.error("error.reading.file", filename, e);
+            log.error("error.reading.file", filename, JavacFileManager.getMessage(e));
             tree = make.TopLevel(List.<JCTree.JCAnnotation>nil(), null, List.<JCTree>nil());
         } finally {
             log.useSource(prev);
@@ -768,9 +762,6 @@
     private long start_msec = 0;
     public long elapsed_msec = 0;
 
-    /** Track whether any errors occurred while parsing source text. */
-    private boolean parseErrors = false;
-
     public void compile(List<JavaFileObject> sourceFileObject)
         throws Throwable {
         compile(sourceFileObject, List.<String>nil(), null);
@@ -1114,7 +1105,7 @@
             return env;
 
         if (verboseCompilePolicy)
-            log.printLines(log.noticeWriter, "[attribute " + env.enclClass.sym + "]");
+            Log.printLines(log.noticeWriter, "[attribute " + env.enclClass.sym + "]");
         if (verbose)
             printVerbose("checking.attribution", env.enclClass.sym);
 
--- a/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java	Fri Mar 26 11:10:26 2010 -0400
@@ -26,6 +26,8 @@
 package com.sun.tools.javac.model;
 
 import com.sun.tools.javac.util.*;
+import java.io.ObjectInputStream;
+import java.io.IOException;
 import java.lang.annotation.*;
 import java.lang.reflect.Array;
 import java.lang.reflect.Method;
@@ -268,10 +270,10 @@
      * The toString, hashCode, and equals methods foward to the underlying
      * type.
      */
-    private static class MirroredTypeExceptionProxy extends ExceptionProxy {
+    private static final class MirroredTypeExceptionProxy extends ExceptionProxy {
         static final long serialVersionUID = 269;
 
-        private transient final TypeMirror type;
+        private transient TypeMirror type;
         private final String typeString;
 
         MirroredTypeExceptionProxy(TypeMirror t) {
@@ -296,6 +298,13 @@
         protected RuntimeException generateException() {
             return new MirroredTypeException(type);
         }
+
+        // Explicitly set all transient fields.
+        private void readObject(ObjectInputStream s)
+            throws IOException, ClassNotFoundException {
+            s.defaultReadObject();
+            type = null;
+        }
     }
 
 
@@ -304,10 +313,10 @@
      * The toString, hashCode, and equals methods foward to the underlying
      * types.
      */
-    private static class MirroredTypesExceptionProxy extends ExceptionProxy {
+    private static final class MirroredTypesExceptionProxy extends ExceptionProxy {
         static final long serialVersionUID = 269;
 
-        private transient final List<TypeMirror> types;
+        private transient List<TypeMirror> types;
         private final String typeStrings;
 
         MirroredTypesExceptionProxy(List<TypeMirror> ts) {
@@ -333,5 +342,12 @@
         protected RuntimeException generateException() {
             return new MirroredTypesException(types);
         }
+
+        // Explicitly set all transient fields.
+        private void readObject(ObjectInputStream s)
+            throws IOException, ClassNotFoundException {
+            s.defaultReadObject();
+            types = null;
+        }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Mar 26 11:10:26 2010 -0400
@@ -1561,7 +1561,10 @@
             JCNewClass newClass = classCreatorRest(newpos, null, typeArgs, t);
             if (newClass.def != null) {
                 assert newClass.def.mods.annotations.isEmpty();
-                newClass.def.mods.annotations = List.convert(JCAnnotation.class, newAnnotations);
+                if (newAnnotations.nonEmpty()) {
+                    newClass.def.mods.pos = earlier(newClass.def.mods.pos, newAnnotations.head.pos);
+                    newClass.def.mods.annotations = List.convert(JCAnnotation.class, newAnnotations);
+                }
             }
             return newClass;
         } else {
@@ -3016,6 +3019,18 @@
         return (oc >= 0) ? TreeInfo.opPrec(oc) : -1;
     }
 
+    /**
+     * Return the lesser of two positions, making allowance for either one
+     * being unset.
+     */
+    static int earlier(int pos1, int pos2) {
+        if (pos1 == Position.NOPOS)
+            return pos2;
+        if (pos2 == Position.NOPOS)
+            return pos1;
+        return (pos1 < pos2 ? pos1 : pos2);
+    }
+
     /** Return operation tag of binary operator represented by token,
      *  -1 if token is not a binary operator.
      */
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Fri Mar 26 11:10:26 2010 -0400
@@ -690,10 +690,12 @@
             ProcessorState ps = psi.next();
             Set<String>  matchedNames = new HashSet<String>();
             Set<TypeElement> typeElements = new LinkedHashSet<TypeElement>();
-            for (String unmatchedAnnotationName : unmatchedAnnotations.keySet()) {
+
+            for (Map.Entry<String, TypeElement> entry: unmatchedAnnotations.entrySet()) {
+                String unmatchedAnnotationName = entry.getKey();
                 if (ps.annotationSupported(unmatchedAnnotationName) ) {
                     matchedNames.add(unmatchedAnnotationName);
-                    TypeElement te = unmatchedAnnotations.get(unmatchedAnnotationName);
+                    TypeElement te = entry.getValue();
                     if (te != null)
                         typeElements.add(te);
                 }
@@ -790,16 +792,13 @@
                                      List<JCCompilationUnit> roots,
                                      List<ClassSymbol> classSymbols,
                                      Iterable<? extends PackageSymbol> pckSymbols)
-    throws IOException {
+        throws IOException {
 
         log = Log.instance(context);
         // Writer for -XprintRounds and -XprintProcessorInfo data
         PrintWriter xout = context.get(Log.outKey);
         TaskListener taskListener = context.get(TaskListener.class);
 
-
-        AnnotationCollector collector = new AnnotationCollector();
-
         JavaCompiler compiler = JavaCompiler.instance(context);
         compiler.todo.clear(); // free the compiler's resources
 
@@ -878,7 +877,7 @@
                     roots = cleanTrees(roots).appendList(parsedFiles);
 
                     // Check for errors after parsing
-                    if (compiler.parseErrors()) {
+                    if (log.unrecoverableError) {
                         errorStatus = true;
                         break runAround;
                     } else {
@@ -912,7 +911,7 @@
         roots = runLastRound(xout, roundNumber, errorStatus, compiler, roots, taskListener);
         // Set error status for any files compiled and generated in
         // the last round
-        if (compiler.parseErrors())
+        if (log.unrecoverableError)
             errorStatus = true;
 
         compiler.close(false);
@@ -1218,45 +1217,6 @@
         return false;
     }
 
-    private class AnnotationCollector extends TreeScanner {
-        List<JCTree> path = List.nil();
-        static final boolean verbose = false;
-        List<JCAnnotation> annotations = List.nil();
-
-        public List<JCAnnotation> findAnnotations(List<? extends JCTree> nodes) {
-            annotations = List.nil();
-            scan(nodes);
-            List<JCAnnotation> found = annotations;
-            annotations = List.nil();
-            return found.reverse();
-        }
-
-        public void scan(JCTree node) {
-            if (node == null)
-                return;
-            Symbol sym = TreeInfo.symbolFor(node);
-            if (sym != null)
-                path = path.prepend(node);
-            super.scan(node);
-            if (sym != null)
-                path = path.tail;
-        }
-
-        public void visitAnnotation(JCAnnotation node) {
-            annotations = annotations.prepend(node);
-            if (verbose) {
-                StringBuilder sb = new StringBuilder();
-                for (JCTree tree : path.reverse()) {
-                    System.err.print(sb);
-                    System.err.println(TreeInfo.symbolFor(tree));
-                    sb.append("  ");
-                }
-                System.err.print(sb);
-                System.err.println(node);
-            }
-        }
-    }
-
     private static <T extends JCTree> List<T> cleanTrees(List<T> nodes) {
         for (T node : nodes)
             treeCleaner.scan(node);
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Mar 26 11:10:26 2010 -0400
@@ -720,6 +720,9 @@
     {0}: major version {1} is newer than {2}, the highest major version supported by this compiler.\n\
     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
+
 # Warnings related to annotation processing
 compiler.warn.proc.package.does.not.exist=\
     package {0} does not exist
--- a/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Fri Mar 26 11:10:26 2010 -0400
@@ -201,7 +201,7 @@
     private String selectFormat(JCDiagnostic d) {
         DiagnosticSource source = d.getDiagnosticSource();
         String format = getConfiguration().getFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT);
-        if (source != null) {
+        if (source != null && source != DiagnosticSource.NO_SOURCE) {
             if (d.getIntPosition() != Position.NOPOS) {
                 format = getConfiguration().getFormat(BasicFormatKind.DEFAULT_POS_FORMAT);
             } else if (source.getFile() != null &&
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java	Fri Mar 26 11:10:26 2010 -0400
@@ -192,6 +192,12 @@
      */
     public int nwarnings = 0;
 
+    /**
+     * Whether or not an unrecoverable error has been seen.
+     * Unrecoverable errors prevent subsequent annotation processing.
+     */
+    public boolean unrecoverableError;
+
     /** A set of all errors generated so far. This is used to avoid printing an
      *  error message more than once. For each error, a pair consisting of the
      *  source file name and source code position of the error is added to the set.
--- a/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Fri Mar 26 11:10:26 2010 -0400
@@ -34,7 +34,6 @@
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.ClassType;
-import com.sun.tools.javac.comp.Attr;
 import com.sun.tools.javac.comp.Check;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.Context;
@@ -73,10 +72,6 @@
     /** Referenced directly in RootDocImpl. */
     JavadocClassReader reader;
 
-    /** The compiler's attribution phase (needed to evaluate
-     *  constant initializers). */
-    Attr attr;
-
     /** Javadoc's own version of the compiler's enter phase. */
     JavadocEnter enter;
 
@@ -91,8 +86,6 @@
     /** Access filter (public, protected, ...).  */
     ModifierFilter showAccess;
 
-    private ClassDocImpl runtimeException;
-
     /** True if we are using a sentence BreakIterator. */
     boolean breakiterator;
 
@@ -129,7 +122,6 @@
         syms = Symtab.instance(context);
         reader = JavadocClassReader.instance0(context);
         enter = JavadocEnter.instance0(context);
-        attr = Attr.instance(context);
         names = Names.instance(context);
         externalizableSym = reader.enterClass(names.fromString("java.io.Externalizable"));
         chk = Check.instance(context);
--- a/langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java	Fri Mar 26 11:10:26 2010 -0400
@@ -349,12 +349,12 @@
     // (int i, String s) ==> [0] = "int",  [1] = String
     // (int[][], String[]) ==> [0] = "int[][]" // [1] = "String[]"
     class ParameterParseMachine {
-        final int START = 0;
-        final int TYPE = 1;
-        final int NAME = 2;
-        final int TNSPACE = 3;  // space between type and name
-        final int ARRAYDECORATION = 4;
-        final int ARRAYSPACE = 5;
+        static final int START = 0;
+        static final int TYPE = 1;
+        static final int NAME = 2;
+        static final int TNSPACE = 3;  // space between type and name
+        static final int ARRAYDECORATION = 4;
+        static final int ARRAYSPACE = 5;
 
         String parameters;
 
--- a/langtools/src/share/classes/com/sun/tools/javah/JavahTask.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javah/JavahTask.java	Fri Mar 26 11:10:26 2010 -0400
@@ -255,9 +255,11 @@
         }
 
         this.classes = new ArrayList<String>();
-        for (String classname: classes) {
-            classname.getClass(); // null-check
-            this.classes.add(classname);
+        if (classes != null) {
+            for (String classname: classes) {
+                classname.getClass(); // null-check
+                this.classes.add(classname);
+            }
         }
     }
 
@@ -316,6 +318,12 @@
     int run(String[] args) {
         try {
             handleOptions(args);
+            if (classes == null || classes.size() == 0) {
+                if (help || version || fullVersion)
+                    return 0;
+                else
+                    return 1;
+            }
             boolean ok = run();
             return ok ? 0 : 1;
         } catch (BadArgs e) {
@@ -347,8 +355,7 @@
             fileManager = getDefaultFileManager(diagnosticListener, log);
 
         Iterator<String> iter = args.iterator();
-        if (!iter.hasNext())
-            help = true;
+        boolean noArgs = !iter.hasNext();
 
         while (iter.hasNext()) {
             String arg = iter.next();
@@ -365,7 +372,7 @@
         }
 
         if ((classes == null || classes.size() == 0) &&
-                !(help || version || fullVersion)) {
+                !(noArgs || help || version || fullVersion)) {
             throw new BadArgs("err.no.classes.specified");
         }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/4880220/T4880220.error.out	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,9 @@
+T4880220.java:20:27: compiler.warn.static.not.qualified.by.type: kindname.method, T4880220.C
+T4880220.java:21:27: compiler.warn.static.not.qualified.by.type: kindname.variable, T4880220.C
+T4880220.java:22:27: compiler.warn.static.not.qualified.by.type: kindname.variable, T4880220.C
+T4880220.java:24:29: compiler.warn.static.not.qualified.by.type: kindname.method, T4880220.C
+T4880220.java:25:29: compiler.warn.static.not.qualified.by.type: kindname.variable, T4880220.C
+T4880220.java:26:29: compiler.warn.static.not.qualified.by.type: kindname.variable, T4880220.C
+- compiler.err.warnings.and.werror
+1 error
+6 warnings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/4880220/T4880220.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,43 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 4880220
+ * @summary Add a warning when accessing a static method via an reference
+ *
+ * @compile/ref=T4880220.empty.out                                                   T4880220.java
+ * @compile/ref=T4880220.warn.out       -XDrawDiagnostics         -Xlint:static      T4880220.java
+ * @compile/ref=T4880220.warn.out       -XDrawDiagnostics         -Xlint:all         T4880220.java
+ * @compile/ref=T4880220.empty.out      -XDrawDiagnostics         -Xlint:all,-static T4880220.java
+ * @compile/ref=T4880220.error.out/fail -XDrawDiagnostics -Werror -Xlint:all         T4880220.java
+ */
+
+public class T4880220 {
+    void m1() {
+        int good_1 = C.m();
+        int good_2 = C.f;
+        int good_3 = C.x;
+
+        C c = new C();
+        int bad_inst_1 = c.m();
+        int bad_inst_2 = c.f;
+        int bad_inst_3 = c.x;
+
+        int bad_expr_1 = c().m();
+        int bad_expr_2 = c().f;
+        int bad_expr_3 = c().x;
+    }
+
+    void m2() {
+        Class<?> good_1 = C.class;
+        Class<?> good_2 = C[].class;
+    }
+
+    C c() {
+        return new C();
+    }
+
+    static class C {
+        static int m() { return 0; }
+        static int f;
+        static final int x = 3;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/4880220/T4880220.warn.out	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,7 @@
+T4880220.java:20:27: compiler.warn.static.not.qualified.by.type: kindname.method, T4880220.C
+T4880220.java:21:27: compiler.warn.static.not.qualified.by.type: kindname.variable, T4880220.C
+T4880220.java:22:27: compiler.warn.static.not.qualified.by.type: kindname.variable, T4880220.C
+T4880220.java:24:29: compiler.warn.static.not.qualified.by.type: kindname.method, T4880220.C
+T4880220.java:25:29: compiler.warn.static.not.qualified.by.type: kindname.variable, T4880220.C
+T4880220.java:26:29: compiler.warn.static.not.qualified.by.type: kindname.variable, T4880220.C
+6 warnings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T6881645.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,38 @@
+/*
+ * 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
+ * @summary Unchecked method call on a method declared inside anonymous inner causes javac to crash
+ * @compile -Xlint:unchecked T6881645.java
+ */
+
+class T6881645 {
+   Object o = new Object() {
+       <Z> void m (Class<Z> x) {}
+       void test() {
+           m((Class)null);
+       }
+   };
+}
+
--- a/langtools/test/tools/javac/ThrowsIntersection_1.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/test/tools/javac/ThrowsIntersection_1.java	Fri Mar 26 11:10:26 2010 -0400
@@ -30,6 +30,8 @@
  * @compile ThrowsIntersection_1.java
  */
 
+package ThrowsIntersection_1;
+
 class Ex1 extends Exception {}
 class Ex2 extends Exception {}
 
--- a/langtools/test/tools/javac/ThrowsIntersection_2.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/test/tools/javac/ThrowsIntersection_2.java	Fri Mar 26 11:10:26 2010 -0400
@@ -30,6 +30,8 @@
  * @compile ThrowsIntersection_2.java
  */
 
+package ThrowsIntersection_2;
+
 class Ex1 extends Exception {}
 class Ex2 extends Exception {}
 class Ex3 extends Exception {}
--- a/langtools/test/tools/javac/ThrowsIntersection_3.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/test/tools/javac/ThrowsIntersection_3.java	Fri Mar 26 11:10:26 2010 -0400
@@ -30,6 +30,8 @@
  * @run compile/fail ThrowsIntersection_3.java
  */
 
+package ThrowsIntersection_3;
+
 class Ex1 extends Exception {}
 class Ex2 extends Exception {}
 
--- a/langtools/test/tools/javac/ThrowsIntersection_4.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/test/tools/javac/ThrowsIntersection_4.java	Fri Mar 26 11:10:26 2010 -0400
@@ -30,6 +30,8 @@
  * @run compile/fail ThrowsIntersection_4.java
  */
 
+package ThrowsIntersection_4;
+
 // Note:  This is the test that actually failed for 4042259.  The others are for completeness.
 
 class Ex1 extends Exception {}
--- a/langtools/test/tools/javac/annotations/neg/Constant.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Constant.java	Fri Mar 26 11:10:26 2010 -0400
@@ -30,7 +30,7 @@
  * @compile/fail Constant.java
  */
 
-package test.tools.javac.annotation.Constant;
+package Constant;
 
 @T(a = X.x)
 @interface T {
--- a/langtools/test/tools/javac/api/TestJavacTaskScanner.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/test/tools/javac/api/TestJavacTaskScanner.java	Fri Mar 26 11:10:26 2010 -0400
@@ -34,7 +34,10 @@
 import com.sun.tools.javac.parser.*; // XXX
 import com.sun.tools.javac.util.*; // XXX
 import java.io.*;
+import java.net.*;
 import java.nio.*;
+import java.nio.charset.Charset;
+import java.util.Arrays;
 import javax.lang.model.element.Element;
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.type.DeclaredType;
@@ -43,6 +46,10 @@
 import javax.lang.model.util.Types;
 import javax.tools.*;
 
+import static javax.tools.StandardLocation.CLASS_PATH;
+import static javax.tools.StandardLocation.SOURCE_PATH;
+import static javax.tools.StandardLocation.CLASS_OUTPUT;
+
 public class TestJavacTaskScanner extends ToolTester {
 
     final JavacTaskImpl task;
@@ -56,6 +63,7 @@
     TestJavacTaskScanner(File file) {
         final Iterable<? extends JavaFileObject> compilationUnits =
             fm.getJavaFileObjects(new File[] {file});
+        StandardJavaFileManager fm = getLocalFileManager(tool, null, null);
         task = (JavacTaskImpl)tool.getTask(null, fm, null, null, null, compilationUnits);
         task.getContext().put(Scanner.Factory.scannerFactoryKey,
                 new MyScanner.Factory(task.getContext(), this));
@@ -83,7 +91,7 @@
         System.out.println("#parseTypeElements: " + numParseTypeElements);
         System.out.println("#allMembers: " + numAllMembers);
 
-        check(numTokens, "#Tokens", 891);
+        check(numTokens, "#Tokens", 1222);
         check(numParseTypeElements, "#parseTypeElements", 136);
         check(numAllMembers, "#allMembers", 67);
     }
@@ -117,6 +125,47 @@
             numAllMembers++;
         }
     }
+
+    /* Similar to ToolTester.getFileManager, except that this version also ensures
+     * javac classes will be available on the classpath.  The javac classes are assumed
+     * to be on the classpath used to run this test (this is true when using jtreg).
+     * The classes are found by obtaining the URL for a sample javac class, using
+     * getClassLoader().getResource(), and then deconstructing the URL to find the
+     * underlying directory or jar file to place on the classpath.
+     */
+    public StandardJavaFileManager getLocalFileManager(JavaCompiler tool,
+                                                        DiagnosticListener<JavaFileObject> dl,
+                                                        Charset encoding) {
+        File javac_classes;
+        try {
+            final String javacMainClass = "com/sun/tools/javac/Main.class";
+            URL url = getClass().getClassLoader().getResource(javacMainClass);
+            if (url == null)
+                throw new Error("can't locate javac classes");
+            URI uri = url.toURI();
+            String scheme = uri.getScheme();
+            String ssp = uri.getSchemeSpecificPart();
+            if (scheme.equals("jar")) {
+                javac_classes = new File(new URI(ssp.substring(0, ssp.indexOf("!/"))));
+            } else if (scheme.equals("file")) {
+                javac_classes = new File(ssp.substring(0, ssp.indexOf(javacMainClass)));
+            } else
+                throw new Error("unknown URL: " + url);
+        } catch (URISyntaxException e) {
+            throw new Error(e);
+        }
+        System.err.println("javac_classes: " + javac_classes);
+
+        StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, encoding);
+        try {
+            fm.setLocation(SOURCE_PATH,  Arrays.asList(test_src));
+            fm.setLocation(CLASS_PATH,   Arrays.asList(test_classes, javac_classes));
+            fm.setLocation(CLASS_OUTPUT, Arrays.asList(test_classes));
+        } catch (IOException e) {
+            throw new AssertionError(e);
+        }
+        return fm;
+    }
 }
 
 class MyScanner extends Scanner {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/api/TestResolveError.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,101 @@
+/*
+ * 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 6930108
+ * @summary IllegalArgumentException in AbstractDiagnosticFormatter for tools/javac/api/TestJavacTaskScanner.java
+ * @library ./lib
+ * @build ToolTester
+ * @run main TestResolveError
+ */
+
+import java.io.*;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.Elements;
+import javax.lang.model.util.Types;
+import javax.tools.*;
+
+import com.sun.tools.javac.api.JavacTaskImpl;
+
+/*
+ * This is a cut down version of TestJavacTaskScanner, which as originally written
+ * caused an IllegalArgumentException in AbstractDiagnosticFormatter as a result
+ * of calling task.parseType with a name whose resolution depended on the setting
+ * of the bootclasspath.
+ * This test has the same call, task.parseType("List<String>", clazz), but checks
+ * that the error is handled in a reasonable way by javac.
+ */
+public class TestResolveError extends ToolTester {
+    public static void main(String... args) throws Exception {
+        new TestResolveError().run();
+    }
+
+    void run() throws Exception {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        File file = new File(test_src, "TestResolveError.java");
+        final Iterable<? extends JavaFileObject> compilationUnits =
+            fm.getJavaFileObjects(new File[] {file});
+        task = (JavacTaskImpl)tool.getTask(pw, fm, null, null, null, compilationUnits);
+        elements = task.getElements();
+        types = task.getTypes();
+
+        Iterable<? extends TypeElement> toplevels;
+        try {
+            toplevels = task.enter(task.parse());
+        } catch (IOException ex) {
+            throw new AssertionError(ex);
+        }
+
+        for (TypeElement clazz : toplevels) {
+            System.out.format("Testing %s:%n%n", clazz.getSimpleName());
+            // this should not cause any exception from the compiler,
+            // such as IllegalArgumentException
+            testParseType(clazz);
+        }
+
+        pw.close();
+
+        String out = sw.toString();
+        System.out.println(out);
+
+        if (out.contains("com.sun.tools.javac.util"))
+            throw new Exception("Unexpected output from compiler");
+    }
+
+    void testParseType(TypeElement clazz) {
+        DeclaredType type = (DeclaredType)task.parseType("List<String>", clazz);
+        for (Element member : elements.getAllMembers((TypeElement)type.asElement())) {
+            TypeMirror mt = types.asMemberOf(type, member);
+            System.out.format("%s : %s -> %s%n", member.getSimpleName(), member.asType(), mt);
+        }
+    }
+
+    JavacTaskImpl task;
+    Elements elements;
+    Types types;
+}
--- a/langtools/test/tools/javac/generics/Casting.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/test/tools/javac/generics/Casting.java	Fri Mar 26 11:10:26 2010 -0400
@@ -30,7 +30,7 @@
  * @compile  Casting.java
  */
 
-package test.tools.javac.generics.Casting;
+package Casting;
 
 class Test {}
 
--- a/langtools/test/tools/javac/generics/Casting3.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/test/tools/javac/generics/Casting3.java	Fri Mar 26 11:10:26 2010 -0400
@@ -30,7 +30,7 @@
  * @compile  Casting3.java
  */
 
-package test.tools.javac.generics.Casting3;
+package Casting3;
 
 class A<T extends A<T>> {
     <U extends A<U>> void f() {
--- a/langtools/test/tools/javac/generics/Casting4.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/test/tools/javac/generics/Casting4.java	Fri Mar 26 11:10:26 2010 -0400
@@ -30,7 +30,7 @@
  * @compile -Werror -Xlint:unchecked  Casting4.java
  */
 
-package test.tools.javac.generics.Casting4;
+package Casting4;
 
 class Casting4 {
     <M> Integer f(Comparable<M> c) {
--- a/langtools/test/tools/javac/generics/InnerInterface1.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/test/tools/javac/generics/InnerInterface1.java	Fri Mar 26 11:10:26 2010 -0400
@@ -30,7 +30,7 @@
  * @compile  InnerInterface1.java
  */
 
-package test.tools.javac.generics.InnerInterface1;
+package InnerInterface1;
 
 interface Iterator<E> {
 }
--- a/langtools/test/tools/javac/generics/InnerInterface2.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/test/tools/javac/generics/InnerInterface2.java	Fri Mar 26 11:10:26 2010 -0400
@@ -30,7 +30,7 @@
  * @compile  InnerInterface2.java
  */
 
-package test.tools.javac.generics.InnerInterface2;
+package InnerInterface2;
 
 class Builder<Community> {
 
--- a/langtools/test/tools/javac/generics/Multibound1.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/test/tools/javac/generics/Multibound1.java	Fri Mar 26 11:10:26 2010 -0400
@@ -30,7 +30,7 @@
  * @compile/fail  Multibound1.java
  */
 
-package test.tools.javac.generics.Multibound1;
+package Multibound1;
 
 interface A {}
 interface B {}
--- a/langtools/test/tools/javac/generics/MultipleInheritance.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/test/tools/javac/generics/MultipleInheritance.java	Fri Mar 26 11:10:26 2010 -0400
@@ -30,7 +30,7 @@
  * @compile  MultipleInheritance.java
  */
 
-package test.tools.javac.generics.MultipleInheritance;
+package MultipleInheritance;
 
 import java.util.*;
 
--- a/langtools/test/tools/javac/generics/NameOrder.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/test/tools/javac/generics/NameOrder.java	Fri Mar 26 11:10:26 2010 -0400
@@ -27,22 +27,22 @@
  * @summary generics: type inference failure due to a bug in ClassSymbol.isLess
  * @author gafter
  *
- * @compile  NameOrder.java
+ * @compile NameOrder.java
  */
 
-package test.tools.javac.generics.NameOrder;
+package NameOrder;
 
 interface a {}
 interface b {}
 interface c {}
 
-class A implements a, b {}
-class B implements c, a {}
+class AB implements a, b {}
+class CA implements c, a {}
 
 // this is how to trigger a symptom:
-abstract class C {
+abstract class X {
     <T> T f(T t1, T t2) { return null; }
     void g() {
-        a x = f( new A(), new B() );
+        a x = f( new AB(), new CA() );
     }
 }
--- a/langtools/test/tools/javac/generics/PermuteBound.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/test/tools/javac/generics/PermuteBound.java	Fri Mar 26 11:10:26 2010 -0400
@@ -30,7 +30,7 @@
  * @compile  PermuteBound.java
  */
 
-package test.tools.javac.generics.PermuteBound;
+package PermuteBound;
 
 class C<X, Y> {}
 
--- a/langtools/test/tools/javac/generics/PrimitiveVariant.java	Thu Mar 25 16:54:59 2010 -0700
+++ b/langtools/test/tools/javac/generics/PrimitiveVariant.java	Fri Mar 26 11:10:26 2010 -0400
@@ -30,7 +30,7 @@
  * @compile/fail  PrimitiveVariant.java
  */
 
-package test.tools.javac.generics.PrimitiveVariant;
+package PrimitiveVariant;
 
 interface I {
     double m();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/6511613/DummyProcessor.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,40 @@
+/*
+ * 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 javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import java.util.Set;
+
+@SupportedAnnotationTypes("*")
+public class DummyProcessor extends  AbstractProcessor {
+   public boolean process(Set<? extends TypeElement> annotations,
+                  RoundEnvironment roundEnv) {
+       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/6511613/clss41701.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,43 @@
+/*
+ * 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 6511613
+ * @summary javac unexpectedly doesn't fail in some cases if an annotation processor specified
+ *
+ * @build DummyProcessor
+ * @compile/fail clss41701.java
+ * @compile/fail -processor DummyProcessor clss41701.java
+ */
+
+import java.io.PrintStream;
+
+interface clss41701i {
+    void run();
+}
+
+class clss41701a<A extends clss41701i,
+                 B extends clss41701i,
+                 C extends A&B> {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/TestAnonClassNames.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,186 @@
+/*
+ * 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 6449781
+ * @summary Test that reported names of anonymous classes are non-null.
+ * @author  Joseph D. Darcy
+ * @build TestAnonSourceNames
+ * @compile/fail -processor TestAnonSourceNames TestAnonClassNames.java
+ * @build TestAnonClassNames
+ * @run main TestAnonClassNames
+ */
+
+/*
+ * This test operates in phases to test retrieving the qualified name
+ * of anonymous classes from type elements modeling the anonymous
+ * class.  The type elements are generated using both source files and
+ * class files as the basis of constructing the elements.
+ *
+ * Source files will be tested by the @compile line which runs
+ * TestAnonSourceNames as an annotation processor over this file.
+ * This compile line is expected to fail until 6930507 is fixed.  Once
+ * bug 6930507 is fixed, the "@compile/fail -processor ..." and
+ * following "@build..." steps can be replaced with a single "@compile
+ * -processor ..." directive.
+ *
+ * Class files are tested by the @run command on this type.  This
+ * class gets the names of classes with different nesting kinds,
+ * including anonymous classes, and then invokes the compiler with an
+ * annotation processor having the class files names as inputs.  The
+ * compiler is invoked via the javax.tools mechanism.
+ */
+
+import java.lang.annotation.*;
+import javax.lang.model.element.*;
+import javax.annotation.processing.*;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.*;
+import javax.lang.model.util.*;
+import javax.tools.*;
+import java.util.*;
+
+import static java.lang.annotation.RetentionPolicy.*;
+import static javax.lang.model.element.NestingKind.*;
+import static javax.lang.model.util.ElementFilter.*;
+import static javax.tools.Diagnostic.Kind.*;
+import static javax.tools.StandardLocation.*;
+
+@Nesting(TOP_LEVEL)
+public class TestAnonClassNames {
+    @Nesting(MEMBER)
+    static class MemberClass1{}
+
+    @Nesting(MEMBER)
+    class MemberClass2{}
+
+    @Nesting(MEMBER)
+    class Win$$AtVegas { } // Class with funny name.
+
+    public static void main(String... argv) {
+        @Nesting(LOCAL)
+        class LocalClass{};
+
+        Object o =  new @Nesting(ANONYMOUS) Object() { // An anonymous annotated class
+                public String toString() {
+                    return "I have no name!";
+                }
+            };
+
+        Class<?>[] classes = {
+            MemberClass1.class,
+            MemberClass2.class,
+            LocalClass.class,
+            Win$$AtVegas.class,
+            o.getClass(),
+            TestAnonClassNames.class,
+        };
+
+        for(Class<?> clazz : classes) {
+            String name = clazz.getName();
+            System.out.format("%s is %s%n",
+                              clazz.getName(),
+                              clazz.getAnnotation(Nesting.class).value());
+            testClassName(name);
+        }
+    }
+
+    /**
+     * Perform annotation processing on the class file name and verify
+     * the existence of different flavors of class names when the
+     * input classes are modeled as elements.
+     */
+    static void testClassName(String className) {
+        JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
+        List<String> classNames = new ArrayList<>();
+        classNames.add(className);
+
+        List<String> options = new ArrayList<>();
+        options.add("-proc:only");
+        options.add("-classpath");
+        options.add(System.getProperty("test.classes"));
+
+        JavaCompiler.CompilationTask compileTask =
+            javaCompiler.getTask(null, // Output
+                                 null, // File manager
+                                 null, // Diagnostics
+                                 options,
+                                 classNames,
+                                 null); // Sources
+        List<Processor> processors = new ArrayList<>();
+        processors.add(new ClassNameProber());
+        compileTask.setProcessors(processors);
+        Boolean goodResult = compileTask.call();
+        if (!goodResult) {
+            throw new RuntimeException("Errors found during compile.");
+        }
+    }
+}
+
+@Retention(RUNTIME)
+@interface Nesting {
+    NestingKind value();
+}
+
+/**
+ * Probe at the various kinds of names of a type element.
+ */
+@SupportedAnnotationTypes("*")
+class ClassNameProber extends AbstractProcessor {
+    public ClassNameProber(){super();}
+
+    private boolean classesFound=false;
+
+    public boolean process(Set<? extends TypeElement> annotations,
+                           RoundEnvironment roundEnv) {
+        if (!roundEnv.processingOver()) {
+            for(TypeElement typeElt : typesIn(roundEnv.getRootElements())) {
+                classesFound = true;
+
+                // Verify different names are non-null; an NPE will
+                // result in failed compile status being reported.
+                NestingKind nestingKind = typeElt.getNestingKind();
+                System.out.printf("\tSimple name: ''%s''\tQualified Name: ''%s''\tKind ''%s''\tNesting ''%s''%n",
+                                  typeElt.getSimpleName().toString(),
+                                  typeElt.getQualifiedName().toString(),
+                                  typeElt.getKind().toString(),
+                                  nestingKind.toString());
+
+                if (typeElt.getAnnotation(Nesting.class).value() != nestingKind) {
+                    throw new RuntimeException("Mismatch of expected and reported nesting kind.");
+                }
+            }
+
+        }
+
+        if (!classesFound) {
+            throw new RuntimeException("Error: no classes processed.");
+        }
+        return true;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/TestAnonSourceNames.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,92 @@
+/*
+ * 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.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 anonymous
+ * classes and verify their names are as specified.
+ */
+@SupportedAnnotationTypes("*")
+public class TestAnonSourceNames extends AbstractProcessor {
+
+   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 ClassTreeScanner(trees)).
+                   scan(trees.getTree(rootElement),
+                        treePath.getCompilationUnit());
+           }
+       }
+       return true;
+   }
+
+   class ClassTreeScanner extends TreeScanner<Void, CompilationUnitTree> {
+       private Trees trees;
+
+       public ClassTreeScanner(Trees trees) {
+           super();
+           this.trees = trees;
+       }
+       @Override
+       public Void visitClass(ClassTree node, CompilationUnitTree cu) {
+                     Element element = trees.getElement(trees.getPath(cu, node));
+           if (element == null) {
+               processingEnv.getMessager().printMessage(ERROR,
+                                                        "No element retreived for node named ''" +
+                                                        node.getSimpleName() + "''.");
+           } else {
+
+               System.out.println("\nVisiting class ``" + element.getSimpleName() +
+                                  "'' of kind " + element.getKind());
+                         if (element instanceof TypeElement) {
+                   TypeElement typeElement = (TypeElement) element;
+                   String s = typeElement.getQualifiedName().toString();
+                   System.out.println("\tqualified name:" + s);
+               } else {
+                   throw new RuntimeException("TypeElement not gotten from ClassTree.");
+               }
+           }
+           return super.visitClass(node, cu);
+       }
+   }
+
+   @Override
+   public SourceVersion getSupportedSourceVersion() {
+       return SourceVersion.latest();
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/tree/TestAnnotatedAnonClass.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * This file is not a regular test, but is processed by ./TreePosTest.java,
+ * which verifies the position info in the javac tree.
+ * To run the test standalone, compile TreePosTest, then run TreePosTest
+ * on this file.
+ * @bug 6931927
+ * @summary position issues with synthesized anonymous class
+ */
+class TestAnnotatedAnonClass {
+    void m() {
+        Object o = new @Deprecated Object() { };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/tree/TreePosTest.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,762 @@
+/*
+ * 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.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+import javax.swing.event.CaretEvent;
+import javax.swing.event.CaretListener;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.DefaultHighlighter;
+import javax.swing.text.Highlighter;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticListener;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
+import com.sun.tools.javac.tree.JCTree.JCNewClass;
+import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
+import com.sun.tools.javac.tree.TreeInfo;
+import com.sun.tools.javac.tree.TreeScanner;
+
+import static com.sun.tools.javac.util.Position.NOPOS;
+
+/**
+ * Utility and test program to check validity of tree positions for tree nodes.
+ * The program can be run standalone, or as a jtreg test.  In standalone mode,
+ * errors can be displayed in a gui viewer. For info on command line args,
+ * run program with no args.
+ *
+ * <p>
+ * jtreg: Note that by using the -r switch in the test description below, this test
+ * will process all java files in the langtools/test directory, thus implicitly
+ * covering any new language features that may be tested in this test suite.
+ */
+
+/*
+ * @test
+ * @bug 6919889
+ * @summary assorted position errors in compiler syntax trees
+ * @run main TreePosTest -q -r -ef ./tools/javac/typeAnnotations -ef ./tools/javap/typeAnnotations -et ANNOTATED_TYPE .
+ */
+public class TreePosTest {
+    /**
+     * Main entry point.
+     * If test.src is set, program runs in jtreg mode, and will throw an Error
+     * if any errors arise, otherwise System.exit will be used, unless the gui
+     * viewer is being used. In jtreg mode, the default base directory for file
+     * args is the value of ${test.src}. In jtreg mode, the -r option can be
+     * given to change the default base directory to the root test directory.
+     */
+    public static void main(String... args) {
+        String testSrc = System.getProperty("test.src");
+        File baseDir = (testSrc == null) ? null : new File(testSrc);
+        boolean ok = new TreePosTest().run(baseDir, args);
+        if (!ok) {
+            if (testSrc != null)  // jtreg mode
+                throw new Error("failed");
+            else
+                System.exit(1);
+        }
+    }
+
+    /**
+     * Run the program. A base directory can be provided for file arguments.
+     * In jtreg mode, the -r option can be given to change the default base
+     * directory to the test root directory. For other options, see usage().
+     * @param baseDir base directory for any file arguments.
+     * @param args command line args
+     * @return true if successful or in gui mode
+     */
+    boolean run(File baseDir, String... args) {
+        if (args.length == 0) {
+            usage(System.out);
+            return true;
+        }
+
+        List<File> files = new ArrayList<File>();
+        for (int i = 0; i < args.length; i++) {
+            String arg = args[i];
+            if (arg.equals("-encoding") && i + 1 < args.length)
+                encoding = args[++i];
+            else if (arg.equals("-gui"))
+                gui = true;
+            else if (arg.equals("-q"))
+                quiet = true;
+            else if (arg.equals("-v"))
+                verbose = true;
+            else if (arg.equals("-t") && i + 1 < args.length)
+                tags.add(args[++i]);
+            else if (arg.equals("-ef") && i + 1 < args.length)
+                excludeFiles.add(new File(baseDir, args[++i]));
+            else if (arg.equals("-et") && i + 1 < args.length)
+                excludeTags.add(args[++i]);
+            else if (arg.equals("-r")) {
+                if (excludeFiles.size() > 0)
+                    throw new Error("-r must be used before -ef");
+                File d = baseDir;
+                while (!new File(d, "TEST.ROOT").exists()) {
+                    d = d.getParentFile();
+                    if (d == null)
+                        throw new Error("cannot find TEST.ROOT");
+                }
+                baseDir = d;
+            }
+            else if (arg.startsWith("-"))
+                throw new Error("unknown option: " + arg);
+            else {
+                while (i < args.length)
+                    files.add(new File(baseDir, args[i++]));
+            }
+        }
+
+        for (File file: files) {
+            if (file.exists())
+                test(file);
+            else
+                error("File not found: " + file);
+        }
+
+        if (fileCount != 1)
+            System.err.println(fileCount + " files read");
+        if (errors > 0)
+            System.err.println(errors + " errors");
+
+        return (gui || errors == 0);
+    }
+
+    /**
+     * Print command line help.
+     * @param out output stream
+     */
+    void usage(PrintStream out) {
+        out.println("Usage:");
+        out.println("  java TreePosTest options... files...");
+        out.println("");
+        out.println("where options include:");
+        out.println("-gui      Display returns in a GUI viewer");
+        out.println("-q        Quiet: don't report on inapplicable files");
+        out.println("-v        Verbose: report on files as they are being read");
+        out.println("-t tag    Limit checks to tree nodes with this tag");
+        out.println("          Can be repeated if desired");
+        out.println("-ef file  Exclude file or directory");
+        out.println("-et tag   Exclude tree nodes with given tag name");
+        out.println("");
+        out.println("files may be directories or files");
+        out.println("directories will be scanned recursively");
+        out.println("non java files, or java files which cannot be parsed, will be ignored");
+        out.println("");
+    }
+
+    /**
+     * Test a file. If the file is a directory, it will be recursively scanned
+     * for java files.
+     * @param file the file or directory to test
+     */
+    void test(File file) {
+        if (excludeFiles.contains(file)) {
+            if (!quiet)
+                error("File " + file + " excluded");
+            return;
+        }
+
+        if (file.isDirectory()) {
+            for (File f: file.listFiles()) {
+                test(f);
+            }
+            return;
+        }
+
+        if (file.isFile() && file.getName().endsWith(".java")) {
+            try {
+                if (verbose)
+                    System.err.println(file);
+                fileCount++;
+                PosTester p = new PosTester();
+                p.test(read(file));
+            } catch (ParseException e) {
+                if (!quiet) {
+                    error("Error parsing " + file + "\n" + e.getMessage());
+                }
+            } catch (IOException e) {
+                error("Error reading " + file + ": " + e);
+            }
+            return;
+        }
+
+        if (!quiet)
+            error("File " + file + " ignored");
+    }
+
+    /**
+     * Read a file.
+     * @param file the file to be read
+     * @return the tree for the content of the file
+     * @throws IOException if any IO errors occur
+     * @throws TreePosTest.ParseException if any errors occur while parsing the file
+     */
+    JCCompilationUnit read(File file) throws IOException, ParseException {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        Reporter r = new Reporter(pw);
+        JavacTool tool = JavacTool.create();
+        Charset cs = (encoding == null ? null : Charset.forName(encoding));
+        StandardJavaFileManager fm = tool.getStandardFileManager(r, null, null);
+        Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(file);
+        JavacTask task = tool.getTask(pw, fm, r, Collections.<String>emptyList(), null, files);
+        Iterable<? extends CompilationUnitTree> trees = task.parse();
+        pw.flush();
+        if (r.errors > 0)
+            throw new ParseException(sw.toString());
+        Iterator<? extends CompilationUnitTree> iter = trees.iterator();
+        if (!iter.hasNext())
+            throw new Error("no trees found");
+        JCCompilationUnit t = (JCCompilationUnit) iter.next();
+        if (iter.hasNext())
+            throw new Error("too many trees found");
+        return t;
+    }
+
+    /**
+     * Report an error. When the program is complete, the program will either
+     * exit or throw an Error if any errors have been reported.
+     * @param msg the error message
+     */
+    void error(String msg) {
+        System.err.println(msg);
+        errors++;
+    }
+
+    /** Number of files that have been analyzed. */
+    int fileCount;
+    /** Number of errors reported. */
+    int errors;
+    /** Flag: don't report irrelevant files. */
+    boolean quiet;
+    /** Flag: report files as they are processed. */
+    boolean verbose;
+    /** Flag: show errors in GUI viewer. */
+    boolean gui;
+    /** Option: encoding for test files. */
+    String encoding;
+    /** The GUI viewer for errors. */
+    Viewer viewer;
+    /** The set of tags for tree nodes to be analyzed; if empty, all tree nodes
+     * are analyzed. */
+    Set<String> tags = new HashSet<String>();
+    /** Set of files and directories to be excluded from analysis. */
+    Set<File> excludeFiles = new HashSet<File>();
+    /** Set of tag names to be excluded from analysis. */
+    Set<String> excludeTags = new HashSet<String>();
+    /** Table of printable names for tree tag values. */
+    TagNames tagNames = new TagNames();
+
+    /**
+     * Main class for testing assertions concerning tree positions for tree nodes.
+     */
+    private class PosTester extends TreeScanner {
+        void test(JCCompilationUnit tree) {
+            sourcefile = tree.sourcefile;
+            endPosTable = tree.endPositions;
+            encl = new Info();
+            tree.accept(this);
+        }
+
+        @Override
+        public void scan(JCTree tree) {
+            if (tree == null)
+                return;
+
+            Info self = new Info(tree, endPosTable);
+            if (check(encl, self)) {
+                // Modifiers nodes are present throughout the tree even where
+                // there is no corresponding source text.
+                // Redundant semicolons in a class definition can cause empty
+                // initializer blocks with no positions.
+                if ((self.tag == JCTree.MODIFIERS || self.tag == JCTree.BLOCK)
+                        && self.pos == NOPOS) {
+                    // If pos is NOPOS, so should be the start and end positions
+                    check("start == NOPOS", encl, self, self.start == NOPOS);
+                    check("end == NOPOS", encl, self, self.end == NOPOS);
+                } else {
+                    // For this node, start , pos, and endpos should be all defined
+                    check("start != NOPOS", encl, self, self.start != NOPOS);
+                    check("pos != NOPOS", encl, self, self.pos != NOPOS);
+                    check("end != NOPOS", encl, self, self.end != NOPOS);
+                    // The following should normally be ordered
+                    // encl.start <= start <= pos <= end <= encl.end
+                    // In addition, the position of the enclosing node should be
+                    // within this node.
+                    // The primary exceptions are for array type nodes, because of the
+                    // need to support legacy syntax:
+                    //    e.g.    int a[];    int[] b[];    int f()[] { return null; }
+                    // and because of inconsistent nesting of left and right of
+                    // array declarations:
+                    //    e.g.    int[][] a = new int[2][];
+                    check("encl.start <= start", encl, self, encl.start <= self.start);
+                    check("start <= pos", encl, self, self.start <= self.pos);
+                    if (!(self.tag == JCTree.TYPEARRAY
+                            && (encl.tag == JCTree.VARDEF || encl.tag == JCTree.TYPEARRAY))) {
+                        check("encl.pos <= start || end <= encl.pos",
+                                encl, self, encl.pos <= self.start || self.end <= encl.pos);
+                    }
+                    check("pos <= end", encl, self, self.pos <= self.end);
+                    if (!(self.tag == JCTree.TYPEARRAY && encl.tag == JCTree.TYPEARRAY)) {
+                        check("end <= encl.end", encl, self, self.end <= encl.end);
+                    }
+                }
+            }
+
+            Info prevEncl = encl;
+            encl = self;
+            tree.accept(this);
+            encl = prevEncl;
+        }
+
+        @Override
+        public void visitVarDef(JCVariableDecl tree) {
+            // enum member declarations are desugared in the parser and have
+            // ill-defined semantics for tree positions, so for now, we
+            // skip the synthesized bits and just check parts which came from
+            // the original source text
+            if ((tree.mods.flags & Flags.ENUM) != 0) {
+                scan(tree.mods);
+                if (tree.init != null) {
+                    if (tree.init.getTag() == JCTree.NEWCLASS) {
+                        JCNewClass init = (JCNewClass) tree.init;
+                        if (init.args != null && init.args.nonEmpty()) {
+                            scan(init.args);
+                        }
+                        if (init.def != null && init.def.defs != null) {
+                            scan(init.def.defs);
+                        }
+                    }
+                }
+            } else
+                super.visitVarDef(tree);
+        }
+
+        boolean check(Info encl, Info self) {
+            if (excludeTags.size() > 0) {
+                if (encl != null && excludeTags.contains(tagNames.get(encl.tag))
+                        || excludeTags.contains(tagNames.get(self.tag)))
+                    return false;
+            }
+            return tags.size() == 0 || tags.contains(tagNames.get(self.tag));
+        }
+
+        void check(String label, Info encl, Info self, boolean ok) {
+            if (!ok) {
+                if (gui) {
+                    if (viewer == null)
+                        viewer = new Viewer();
+                    viewer.addEntry(sourcefile, label, encl, self);
+                }
+
+                String s = self.tree.toString();
+                String msg = sourcefile.getName() + ": " + label + ": " +
+                        "encl:" + encl + " this:" + self + "\n" +
+                        s.substring(0, Math.min(80, s.length())).replaceAll("[\r\n]+", " ");
+                error(msg);
+            }
+        }
+
+        JavaFileObject sourcefile;
+        Map<JCTree, Integer> endPosTable;
+        Info encl;
+
+    }
+
+    /**
+     * Utility class providing easy access to position and other info for a tree node.
+     */
+    private class Info {
+        Info() {
+            tree = null;
+            tag = JCTree.ERRONEOUS;
+            start = 0;
+            pos = 0;
+            end = Integer.MAX_VALUE;
+        }
+
+        Info(JCTree tree, Map<JCTree, Integer> endPosTable) {
+            this.tree = tree;
+            tag = tree.getTag();
+            start = TreeInfo.getStartPos(tree);
+            pos = tree.pos;
+            end = TreeInfo.getEndPos(tree, endPosTable);
+        }
+
+        @Override
+        public String toString() {
+            return tagNames.get(tree.getTag()) + "[start:" + start + ",pos:" + pos + ",end:" + end + "]";
+        }
+
+        final JCTree tree;
+        final int tag;
+        final int start;
+        final int pos;
+        final int end;
+    }
+
+    /**
+     * Names for tree tags.
+     * javac does not provide an API to convert tag values to strings, so this class uses
+     * reflection to determine names of public static final int values in JCTree.
+     */
+    private static class TagNames {
+        String get(int tag) {
+            if (map == null) {
+                map = new HashMap<Integer, String>();
+                Class c = JCTree.class;
+                for (Field f : c.getDeclaredFields()) {
+                    if (f.getType().equals(int.class)) {
+                        int mods = f.getModifiers();
+                        if (Modifier.isPublic(mods) && Modifier.isStatic(mods) && Modifier.isFinal(mods)) {
+                            try {
+                                map.put(f.getInt(null), f.getName());
+                            } catch (IllegalAccessException e) {
+                            }
+                        }
+                    }
+                }
+            }
+            String name = map.get(tag);
+            return (name == null) ? "??" : name;
+        }
+
+        private Map<Integer, String> map;
+    }
+
+    /**
+     * Thrown when errors are found parsing a java file.
+     */
+    private static class ParseException extends Exception {
+        ParseException(String msg) {
+            super(msg);
+        }
+    }
+
+    /**
+     * DiagnosticListener to report diagnostics and count any errors that occur.
+     */
+    private static class Reporter implements DiagnosticListener<JavaFileObject> {
+        Reporter(PrintWriter out) {
+            this.out = out;
+        }
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            out.println(diagnostic);
+            switch (diagnostic.getKind()) {
+                case ERROR:
+                    errors++;
+            }
+        }
+        int errors;
+        PrintWriter out;
+    }
+
+    /**
+     * GUI viewer for issues found by TreePosTester. The viewer provides a drop
+     * down list for selecting error conditions, a header area providing details
+     * about an error, and a text area with the ranges of text highlighted as
+     * appropriate.
+     */
+    private class Viewer extends JFrame {
+        /**
+         * Create a viewer.
+         */
+        Viewer() {
+            initGUI();
+        }
+
+        /**
+         * Add another entry to the list of errors.
+         * @param file The file containing the error
+         * @param check The condition that was being tested, and which failed
+         * @param encl the enclosing tree node
+         * @param self the tree node containing the error
+         */
+        void addEntry(JavaFileObject file, String check, Info encl, Info self) {
+            Entry e = new Entry(file, check, encl, self);
+            DefaultComboBoxModel m = (DefaultComboBoxModel) entries.getModel();
+            m.addElement(e);
+            if (m.getSize() == 1)
+                entries.setSelectedItem(e);
+        }
+
+        /**
+         * Initialize the GUI window.
+         */
+        private void initGUI() {
+            JPanel head = new JPanel(new GridBagLayout());
+            GridBagConstraints lc = new GridBagConstraints();
+            GridBagConstraints fc = new GridBagConstraints();
+            fc.anchor = GridBagConstraints.WEST;
+            fc.fill = GridBagConstraints.HORIZONTAL;
+            fc.gridwidth = GridBagConstraints.REMAINDER;
+
+            entries = new JComboBox();
+            entries.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    showEntry((Entry) entries.getSelectedItem());
+                }
+            });
+            fc.insets.bottom = 10;
+            head.add(entries, fc);
+            fc.insets.bottom = 0;
+            head.add(new JLabel("check:"), lc);
+            head.add(checkField = createTextField(80), fc);
+            fc.fill = GridBagConstraints.NONE;
+            head.add(setBackground(new JLabel("encl:"), enclColor), lc);
+            head.add(enclPanel = new InfoPanel(), fc);
+            head.add(setBackground(new JLabel("self:"), selfColor), lc);
+            head.add(selfPanel = new InfoPanel(), fc);
+            add(head, BorderLayout.NORTH);
+
+            body = new JTextArea();
+            body.setFont(Font.decode(Font.MONOSPACED));
+            body.addCaretListener(new CaretListener() {
+                public void caretUpdate(CaretEvent e) {
+                    int dot = e.getDot();
+                    int mark = e.getMark();
+                    if (dot == mark)
+                        statusText.setText("dot: " + dot);
+                    else
+                        statusText.setText("dot: " + dot + ", mark:" + mark);
+                }
+            });
+            JScrollPane p = new JScrollPane(body,
+                    JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+                    JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+            p.setPreferredSize(new Dimension(640, 480));
+            add(p, BorderLayout.CENTER);
+
+            statusText = createTextField(80);
+            add(statusText, BorderLayout.SOUTH);
+
+            pack();
+            setLocationRelativeTo(null); // centered on screen
+            setVisible(true);
+            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        }
+
+        /** Show an entry that has been selected. */
+        private void showEntry(Entry e) {
+            try {
+                // update simple fields
+                setTitle(e.file.getName());
+                checkField.setText(e.check);
+                enclPanel.setInfo(e.encl);
+                selfPanel.setInfo(e.self);
+                // show file text with highlights
+                body.setText(e.file.getCharContent(true).toString());
+                Highlighter highlighter = body.getHighlighter();
+                highlighter.removeAllHighlights();
+                addHighlight(highlighter, e.encl, enclColor);
+                addHighlight(highlighter, e.self, selfColor);
+                scroll(body, getMinPos(enclPanel.info, selfPanel.info));
+            } catch (IOException ex) {
+                body.setText("Cannot read " + e.file.getName() + ": " + e);
+            }
+        }
+
+        /** Create a test field. */
+        private JTextField createTextField(int width) {
+            JTextField f = new JTextField(width);
+            f.setEditable(false);
+            f.setBorder(null);
+            return f;
+        }
+
+        /** Add a highlighted region based on the positions in an Info object. */
+        private void addHighlight(Highlighter h, Info info, Color c) {
+            int start = info.start;
+            int end = info.end;
+            if (start == -1 && end == -1)
+                return;
+            if (start == -1)
+                start = end;
+            if (end == -1)
+                end = start;
+            try {
+                h.addHighlight(info.start, info.end,
+                        new DefaultHighlighter.DefaultHighlightPainter(c));
+                if (info.pos != -1) {
+                    Color c2 = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int)(.4f * 255)); // 40%
+                    h.addHighlight(info.pos, info.pos + 1,
+                        new DefaultHighlighter.DefaultHighlightPainter(c2));
+                }
+            } catch (BadLocationException e) {
+                e.printStackTrace();
+            }
+        }
+
+        /** Get the minimum valid position in a set of info objects. */
+        private int getMinPos(Info... values) {
+            int i = Integer.MAX_VALUE;
+            for (Info info: values) {
+                if (info.start >= 0) i = Math.min(i, info.start);
+                if (info.pos   >= 0) i = Math.min(i, info.pos);
+                if (info.end   >= 0) i = Math.min(i, info.end);
+            }
+            return (i == Integer.MAX_VALUE) ? 0 : i;
+        }
+
+        /** Set the background on a component. */
+        private JComponent setBackground(JComponent comp, Color c) {
+            comp.setOpaque(true);
+            comp.setBackground(c);
+            return comp;
+        }
+
+        /** Scroll a text area to display a given position near the middle of the visible area. */
+        private void scroll(final JTextArea t, final int pos) {
+            // Using invokeLater appears to give text a chance to sort itself out
+            // before the scroll happens; otherwise scrollRectToVisible doesn't work.
+            // Maybe there's a better way to sync with the text...
+            EventQueue.invokeLater(new Runnable() {
+                public void run() {
+                    try {
+                        Rectangle r = t.modelToView(pos);
+                        JScrollPane p = (JScrollPane) SwingUtilities.getAncestorOfClass(JScrollPane.class, t);
+                        r.y = Math.max(0, r.y - p.getHeight() * 2 / 5);
+                        r.height += p.getHeight() * 4 / 5;
+                        t.scrollRectToVisible(r);
+                    } catch (BadLocationException ignore) {
+                    }
+                }
+            });
+        }
+
+        private JComboBox entries;
+        private JTextField checkField;
+        private InfoPanel enclPanel;
+        private InfoPanel selfPanel;
+        private JTextArea body;
+        private JTextField statusText;
+
+        private Color selfColor = new Color(0.f, 1.f, 0.f, 0.2f); // 20% green
+        private Color enclColor = new Color(1.f, 0.f, 0.f, 0.2f); // 20% red
+
+        /** Panel to display an Info object. */
+        private class InfoPanel extends JPanel {
+            InfoPanel() {
+                add(tagName = createTextField(20));
+                add(new JLabel("start:"));
+                add(addListener(start = createTextField(6)));
+                add(new JLabel("pos:"));
+                add(addListener(pos = createTextField(6)));
+                add(new JLabel("end:"));
+                add(addListener(end = createTextField(6)));
+            }
+
+            void setInfo(Info info) {
+                this.info = info;
+                tagName.setText(tagNames.get(info.tag));
+                start.setText(String.valueOf(info.start));
+                pos.setText(String.valueOf(info.pos));
+                end.setText(String.valueOf(info.end));
+            }
+
+            JTextField addListener(final JTextField f) {
+                f.addMouseListener(new MouseAdapter() {
+                    @Override
+                    public void mouseClicked(MouseEvent e) {
+                        body.setCaretPosition(Integer.valueOf(f.getText()));
+                        body.getCaret().setVisible(true);
+                    }
+                });
+                return f;
+            }
+
+            Info info;
+            JTextField tagName;
+            JTextField start;
+            JTextField pos;
+            JTextField end;
+        }
+
+        /** Object to record information about an error to be displayed. */
+        private class Entry {
+            Entry(JavaFileObject file, String check, Info encl, Info self) {
+                this.file = file;
+                this.check = check;
+                this.encl = encl;
+                this.self= self;
+            }
+
+            @Override
+            public String toString() {
+                return file.getName() + " " + check + " " + getMinPos(encl, self);
+            }
+
+            final JavaFileObject file;
+            final String check;
+            final Info encl;
+            final Info self;
+        }
+    }
+}
+
--- a/langtools/test/tools/javac/treepostests/TreePosTest.java	Thu Mar 25 16:54:59 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,762 +0,0 @@
-/*
- * 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.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.EventQueue;
-import java.awt.Font;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Rectangle;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.JComboBox;
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.SwingUtilities;
-import javax.swing.event.CaretEvent;
-import javax.swing.event.CaretListener;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.DefaultHighlighter;
-import javax.swing.text.Highlighter;
-import javax.tools.Diagnostic;
-import javax.tools.DiagnosticListener;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-
-import com.sun.source.tree.CompilationUnitTree;
-import com.sun.source.util.JavacTask;
-import com.sun.tools.javac.api.JavacTool;
-import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
-import com.sun.tools.javac.tree.JCTree.JCNewClass;
-import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
-import com.sun.tools.javac.tree.TreeInfo;
-import com.sun.tools.javac.tree.TreeScanner;
-
-import static com.sun.tools.javac.util.Position.NOPOS;
-
-/**
- * Utility and test program to check validity of tree positions for tree nodes.
- * The program can be run standalone, or as a jtreg test.  In standalone mode,
- * errors can be displayed in a gui viewer. For info on command line args,
- * run program with no args.
- *
- * <p>
- * jtreg: Note that by using the -r switch in the test description below, this test
- * will process all java files in the langtools/test directory, thus implicitly
- * covering any new language features that may be tested in this test suite.
- */
-
-/*
- * @test
- * @bug 6919889
- * @summary assorted position errors in compiler syntax trees
- * @run main TreePosTest -q -r -ef ./tools/javac/typeAnnotations -ef ./tools/javap/typeAnnotations -et ANNOTATED_TYPE .
- */
-public class TreePosTest {
-    /**
-     * Main entry point.
-     * If test.src is set, program runs in jtreg mode, and will throw an Error
-     * if any errors arise, otherwise System.exit will be used, unless the gui
-     * viewer is being used. In jtreg mode, the default base directory for file
-     * args is the value of ${test.src}. In jtreg mode, the -r option can be
-     * given to change the default base directory to the root test directory.
-     */
-    public static void main(String... args) {
-        String testSrc = System.getProperty("test.src");
-        File baseDir = (testSrc == null) ? null : new File(testSrc);
-        boolean ok = new TreePosTest().run(baseDir, args);
-        if (!ok) {
-            if (testSrc != null)  // jtreg mode
-                throw new Error("failed");
-            else
-                System.exit(1);
-        }
-    }
-
-    /**
-     * Run the program. A base directory can be provided for file arguments.
-     * In jtreg mode, the -r option can be given to change the default base
-     * directory to the test root directory. For other options, see usage().
-     * @param baseDir base directory for any file arguments.
-     * @param args command line args
-     * @return true if successful or in gui mode
-     */
-    boolean run(File baseDir, String... args) {
-        if (args.length == 0) {
-            usage(System.out);
-            return true;
-        }
-
-        List<File> files = new ArrayList<File>();
-        for (int i = 0; i < args.length; i++) {
-            String arg = args[i];
-            if (arg.equals("-encoding") && i + 1 < args.length)
-                encoding = args[++i];
-            else if (arg.equals("-gui"))
-                gui = true;
-            else if (arg.equals("-q"))
-                quiet = true;
-            else if (arg.equals("-v"))
-                verbose = true;
-            else if (arg.equals("-t") && i + 1 < args.length)
-                tags.add(args[++i]);
-            else if (arg.equals("-ef") && i + 1 < args.length)
-                excludeFiles.add(new File(baseDir, args[++i]));
-            else if (arg.equals("-et") && i + 1 < args.length)
-                excludeTags.add(args[++i]);
-            else if (arg.equals("-r")) {
-                if (excludeFiles.size() > 0)
-                    throw new Error("-r must be used before -ef");
-                File d = baseDir;
-                while (!new File(d, "TEST.ROOT").exists()) {
-                    d = d.getParentFile();
-                    if (d == null)
-                        throw new Error("cannot find TEST.ROOT");
-                }
-                baseDir = d;
-            }
-            else if (arg.startsWith("-"))
-                throw new Error("unknown option: " + arg);
-            else {
-                while (i < args.length)
-                    files.add(new File(baseDir, args[i++]));
-            }
-        }
-
-        for (File file: files) {
-            if (file.exists())
-                test(file);
-            else
-                error("File not found: " + file);
-        }
-
-        if (fileCount != 1)
-            System.err.println(fileCount + " files read");
-        if (errors > 0)
-            System.err.println(errors + " errors");
-
-        return (gui || errors == 0);
-    }
-
-    /**
-     * Print command line help.
-     * @param out output stream
-     */
-    void usage(PrintStream out) {
-        out.println("Usage:");
-        out.println("  java TreePosTest options... files...");
-        out.println("");
-        out.println("where options include:");
-        out.println("-gui      Display returns in a GUI viewer");
-        out.println("-q        Quiet: don't report on inapplicable files");
-        out.println("-v        Verbose: report on files as they are being read");
-        out.println("-t tag    Limit checks to tree nodes with this tag");
-        out.println("          Can be repeated if desired");
-        out.println("-ef file  Exclude file or directory");
-        out.println("-et tag   Exclude tree nodes with given tag name");
-        out.println("");
-        out.println("files may be directories or files");
-        out.println("directories will be scanned recursively");
-        out.println("non java files, or java files which cannot be parsed, will be ignored");
-        out.println("");
-    }
-
-    /**
-     * Test a file. If the file is a directory, it will be recursively scanned
-     * for java files.
-     * @param file the file or directory to test
-     */
-    void test(File file) {
-        if (excludeFiles.contains(file)) {
-            if (!quiet)
-                error("File " + file + " excluded");
-            return;
-        }
-
-        if (file.isDirectory()) {
-            for (File f: file.listFiles()) {
-                test(f);
-            }
-            return;
-        }
-
-        if (file.isFile() && file.getName().endsWith(".java")) {
-            try {
-                if (verbose)
-                    System.err.println(file);
-                fileCount++;
-                PosTester p = new PosTester();
-                p.test(read(file));
-            } catch (ParseException e) {
-                if (!quiet) {
-                    error("Error parsing " + file + "\n" + e.getMessage());
-                }
-            } catch (IOException e) {
-                error("Error reading " + file + ": " + e);
-            }
-            return;
-        }
-
-        if (!quiet)
-            error("File " + file + " ignored");
-    }
-
-    /**
-     * Read a file.
-     * @param file the file to be read
-     * @return the tree for the content of the file
-     * @throws IOException if any IO errors occur
-     * @throws TreePosTest.ParseException if any errors occur while parsing the file
-     */
-    JCCompilationUnit read(File file) throws IOException, ParseException {
-        StringWriter sw = new StringWriter();
-        PrintWriter pw = new PrintWriter(sw);
-        Reporter r = new Reporter(pw);
-        JavacTool tool = JavacTool.create();
-        Charset cs = (encoding == null ? null : Charset.forName(encoding));
-        StandardJavaFileManager fm = tool.getStandardFileManager(r, null, null);
-        Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(file);
-        JavacTask task = tool.getTask(pw, fm, r, Collections.<String>emptyList(), null, files);
-        Iterable<? extends CompilationUnitTree> trees = task.parse();
-        pw.flush();
-        if (r.errors > 0)
-            throw new ParseException(sw.toString());
-        Iterator<? extends CompilationUnitTree> iter = trees.iterator();
-        if (!iter.hasNext())
-            throw new Error("no trees found");
-        JCCompilationUnit t = (JCCompilationUnit) iter.next();
-        if (iter.hasNext())
-            throw new Error("too many trees found");
-        return t;
-    }
-
-    /**
-     * Report an error. When the program is complete, the program will either
-     * exit or throw an Error if any errors have been reported.
-     * @param msg the error message
-     */
-    void error(String msg) {
-        System.err.println(msg);
-        errors++;
-    }
-
-    /** Number of files that have been analyzed. */
-    int fileCount;
-    /** Number of errors reported. */
-    int errors;
-    /** Flag: don't report irrelevant files. */
-    boolean quiet;
-    /** Flag: report files as they are processed. */
-    boolean verbose;
-    /** Flag: show errors in GUI viewer. */
-    boolean gui;
-    /** Option: encoding for test files. */
-    String encoding;
-    /** The GUI viewer for errors. */
-    Viewer viewer;
-    /** The set of tags for tree nodes to be analyzed; if empty, all tree nodes
-     * are analyzed. */
-    Set<String> tags = new HashSet<String>();
-    /** Set of files and directories to be excluded from analysis. */
-    Set<File> excludeFiles = new HashSet<File>();
-    /** Set of tag names to be excluded from analysis. */
-    Set<String> excludeTags = new HashSet<String>();
-    /** Table of printable names for tree tag values. */
-    TagNames tagNames = new TagNames();
-
-    /**
-     * Main class for testing assertions concerning tree positions for tree nodes.
-     */
-    private class PosTester extends TreeScanner {
-        void test(JCCompilationUnit tree) {
-            sourcefile = tree.sourcefile;
-            endPosTable = tree.endPositions;
-            encl = new Info();
-            tree.accept(this);
-        }
-
-        @Override
-        public void scan(JCTree tree) {
-            if (tree == null)
-                return;
-
-            Info self = new Info(tree, endPosTable);
-            if (check(encl, self)) {
-                // Modifiers nodes are present throughout the tree even where
-                // there is no corresponding source text.
-                // Redundant semicolons in a class definition can cause empty
-                // initializer blocks with no positions.
-                if ((self.tag == JCTree.MODIFIERS || self.tag == JCTree.BLOCK)
-                        && self.pos == NOPOS) {
-                    // If pos is NOPOS, so should be the start and end positions
-                    check("start == NOPOS", encl, self, self.start == NOPOS);
-                    check("end == NOPOS", encl, self, self.end == NOPOS);
-                } else {
-                    // For this node, start , pos, and endpos should be all defined
-                    check("start != NOPOS", encl, self, self.start != NOPOS);
-                    check("pos != NOPOS", encl, self, self.pos != NOPOS);
-                    check("end != NOPOS", encl, self, self.end != NOPOS);
-                    // The following should normally be ordered
-                    // encl.start <= start <= pos <= end <= encl.end
-                    // In addition, the position of the enclosing node should be
-                    // within this node.
-                    // The primary exceptions are for array type nodes, because of the
-                    // need to support legacy syntax:
-                    //    e.g.    int a[];    int[] b[];    int f()[] { return null; }
-                    // and because of inconsistent nesting of left and right of
-                    // array declarations:
-                    //    e.g.    int[][] a = new int[2][];
-                    check("encl.start <= start", encl, self, encl.start <= self.start);
-                    check("start <= pos", encl, self, self.start <= self.pos);
-                    if (!(self.tag == JCTree.TYPEARRAY
-                            && (encl.tag == JCTree.VARDEF || encl.tag == JCTree.TYPEARRAY))) {
-                        check("encl.pos <= start || end <= encl.pos",
-                                encl, self, encl.pos <= self.start || self.end <= encl.pos);
-                    }
-                    check("pos <= end", encl, self, self.pos <= self.end);
-                    if (!(self.tag == JCTree.TYPEARRAY && encl.tag == JCTree.TYPEARRAY)) {
-                        check("end <= encl.end", encl, self, self.end <= encl.end);
-                    }
-                }
-            }
-
-            Info prevEncl = encl;
-            encl = self;
-            tree.accept(this);
-            encl = prevEncl;
-        }
-
-        @Override
-        public void visitVarDef(JCVariableDecl tree) {
-            // enum member declarations are desugared in the parser and have
-            // ill-defined semantics for tree positions, so for now, we
-            // skip the synthesized bits and just check parts which came from
-            // the original source text
-            if ((tree.mods.flags & Flags.ENUM) != 0) {
-                scan(tree.mods);
-                if (tree.init != null) {
-                    if (tree.init.getTag() == JCTree.NEWCLASS) {
-                        JCNewClass init = (JCNewClass) tree.init;
-                        if (init.args != null && init.args.nonEmpty()) {
-                            scan(init.args);
-                        }
-                        if (init.def != null && init.def.defs != null) {
-                            scan(init.def.defs);
-                        }
-                    }
-                }
-            } else
-                super.visitVarDef(tree);
-        }
-
-        boolean check(Info encl, Info self) {
-            if (excludeTags.size() > 0) {
-                if (encl != null && excludeTags.contains(tagNames.get(encl.tag))
-                        || excludeTags.contains(tagNames.get(self.tag)))
-                    return false;
-            }
-            return tags.size() == 0 || tags.contains(tagNames.get(self.tag));
-        }
-
-        void check(String label, Info encl, Info self, boolean ok) {
-            if (!ok) {
-                if (gui) {
-                    if (viewer == null)
-                        viewer = new Viewer();
-                    viewer.addEntry(sourcefile, label, encl, self);
-                }
-
-                String s = self.tree.toString();
-                String msg = sourcefile.getName() + ": " + label + ": " +
-                        "encl:" + encl + " this:" + self + "\n" +
-                        s.substring(0, Math.min(80, s.length())).replaceAll("[\r\n]+", " ");
-                error(msg);
-            }
-        }
-
-        JavaFileObject sourcefile;
-        Map<JCTree, Integer> endPosTable;
-        Info encl;
-
-    }
-
-    /**
-     * Utility class providing easy access to position and other info for a tree node.
-     */
-    private class Info {
-        Info() {
-            tree = null;
-            tag = JCTree.ERRONEOUS;
-            start = 0;
-            pos = 0;
-            end = Integer.MAX_VALUE;
-        }
-
-        Info(JCTree tree, Map<JCTree, Integer> endPosTable) {
-            this.tree = tree;
-            tag = tree.getTag();
-            start = TreeInfo.getStartPos(tree);
-            pos = tree.pos;
-            end = TreeInfo.getEndPos(tree, endPosTable);
-        }
-
-        @Override
-        public String toString() {
-            return tagNames.get(tree.getTag()) + "[start:" + start + ",pos:" + pos + ",end:" + end + "]";
-        }
-
-        final JCTree tree;
-        final int tag;
-        final int start;
-        final int pos;
-        final int end;
-    }
-
-    /**
-     * Names for tree tags.
-     * javac does not provide an API to convert tag values to strings, so this class uses
-     * reflection to determine names of public static final int values in JCTree.
-     */
-    private static class TagNames {
-        String get(int tag) {
-            if (map == null) {
-                map = new HashMap<Integer, String>();
-                Class c = JCTree.class;
-                for (Field f : c.getDeclaredFields()) {
-                    if (f.getType().equals(int.class)) {
-                        int mods = f.getModifiers();
-                        if (Modifier.isPublic(mods) && Modifier.isStatic(mods) && Modifier.isFinal(mods)) {
-                            try {
-                                map.put(f.getInt(null), f.getName());
-                            } catch (IllegalAccessException e) {
-                            }
-                        }
-                    }
-                }
-            }
-            String name = map.get(tag);
-            return (name == null) ? "??" : name;
-        }
-
-        private Map<Integer, String> map;
-    }
-
-    /**
-     * Thrown when errors are found parsing a java file.
-     */
-    private static class ParseException extends Exception {
-        ParseException(String msg) {
-            super(msg);
-        }
-    }
-
-    /**
-     * DiagnosticListener to report diagnostics and count any errors that occur.
-     */
-    private static class Reporter implements DiagnosticListener<JavaFileObject> {
-        Reporter(PrintWriter out) {
-            this.out = out;
-        }
-
-        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
-            out.println(diagnostic);
-            switch (diagnostic.getKind()) {
-                case ERROR:
-                    errors++;
-            }
-        }
-        int errors;
-        PrintWriter out;
-    }
-
-    /**
-     * GUI viewer for issues found by TreePosTester. The viewer provides a drop
-     * down list for selecting error conditions, a header area providing details
-     * about an error, and a text area with the ranges of text highlighted as
-     * appropriate.
-     */
-    private class Viewer extends JFrame {
-        /**
-         * Create a viewer.
-         */
-        Viewer() {
-            initGUI();
-        }
-
-        /**
-         * Add another entry to the list of errors.
-         * @param file The file containing the error
-         * @param check The condition that was being tested, and which failed
-         * @param encl the enclosing tree node
-         * @param self the tree node containing the error
-         */
-        void addEntry(JavaFileObject file, String check, Info encl, Info self) {
-            Entry e = new Entry(file, check, encl, self);
-            DefaultComboBoxModel m = (DefaultComboBoxModel) entries.getModel();
-            m.addElement(e);
-            if (m.getSize() == 1)
-                entries.setSelectedItem(e);
-        }
-
-        /**
-         * Initialize the GUI window.
-         */
-        private void initGUI() {
-            JPanel head = new JPanel(new GridBagLayout());
-            GridBagConstraints lc = new GridBagConstraints();
-            GridBagConstraints fc = new GridBagConstraints();
-            fc.anchor = GridBagConstraints.WEST;
-            fc.fill = GridBagConstraints.HORIZONTAL;
-            fc.gridwidth = GridBagConstraints.REMAINDER;
-
-            entries = new JComboBox();
-            entries.addActionListener(new ActionListener() {
-                public void actionPerformed(ActionEvent e) {
-                    showEntry((Entry) entries.getSelectedItem());
-                }
-            });
-            fc.insets.bottom = 10;
-            head.add(entries, fc);
-            fc.insets.bottom = 0;
-            head.add(new JLabel("check:"), lc);
-            head.add(checkField = createTextField(80), fc);
-            fc.fill = GridBagConstraints.NONE;
-            head.add(setBackground(new JLabel("encl:"), enclColor), lc);
-            head.add(enclPanel = new InfoPanel(), fc);
-            head.add(setBackground(new JLabel("self:"), selfColor), lc);
-            head.add(selfPanel = new InfoPanel(), fc);
-            add(head, BorderLayout.NORTH);
-
-            body = new JTextArea();
-            body.setFont(Font.decode(Font.MONOSPACED));
-            body.addCaretListener(new CaretListener() {
-                public void caretUpdate(CaretEvent e) {
-                    int dot = e.getDot();
-                    int mark = e.getMark();
-                    if (dot == mark)
-                        statusText.setText("dot: " + dot);
-                    else
-                        statusText.setText("dot: " + dot + ", mark:" + mark);
-                }
-            });
-            JScrollPane p = new JScrollPane(body,
-                    JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
-                    JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
-            p.setPreferredSize(new Dimension(640, 480));
-            add(p, BorderLayout.CENTER);
-
-            statusText = createTextField(80);
-            add(statusText, BorderLayout.SOUTH);
-
-            pack();
-            setLocationRelativeTo(null); // centered on screen
-            setVisible(true);
-            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-        }
-
-        /** Show an entry that has been selected. */
-        private void showEntry(Entry e) {
-            try {
-                // update simple fields
-                setTitle(e.file.getName());
-                checkField.setText(e.check);
-                enclPanel.setInfo(e.encl);
-                selfPanel.setInfo(e.self);
-                // show file text with highlights
-                body.setText(e.file.getCharContent(true).toString());
-                Highlighter highlighter = body.getHighlighter();
-                highlighter.removeAllHighlights();
-                addHighlight(highlighter, e.encl, enclColor);
-                addHighlight(highlighter, e.self, selfColor);
-                scroll(body, getMinPos(enclPanel.info, selfPanel.info));
-            } catch (IOException ex) {
-                body.setText("Cannot read " + e.file.getName() + ": " + e);
-            }
-        }
-
-        /** Create a test field. */
-        private JTextField createTextField(int width) {
-            JTextField f = new JTextField(width);
-            f.setEditable(false);
-            f.setBorder(null);
-            return f;
-        }
-
-        /** Add a highlighted region based on the positions in an Info object. */
-        private void addHighlight(Highlighter h, Info info, Color c) {
-            int start = info.start;
-            int end = info.end;
-            if (start == -1 && end == -1)
-                return;
-            if (start == -1)
-                start = end;
-            if (end == -1)
-                end = start;
-            try {
-                h.addHighlight(info.start, info.end,
-                        new DefaultHighlighter.DefaultHighlightPainter(c));
-                if (info.pos != -1) {
-                    Color c2 = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int)(.4f * 255)); // 40%
-                    h.addHighlight(info.pos, info.pos + 1,
-                        new DefaultHighlighter.DefaultHighlightPainter(c2));
-                }
-            } catch (BadLocationException e) {
-                e.printStackTrace();
-            }
-        }
-
-        /** Get the minimum valid position in a set of info objects. */
-        private int getMinPos(Info... values) {
-            int i = Integer.MAX_VALUE;
-            for (Info info: values) {
-                if (info.start >= 0) i = Math.min(i, info.start);
-                if (info.pos   >= 0) i = Math.min(i, info.pos);
-                if (info.end   >= 0) i = Math.min(i, info.end);
-            }
-            return (i == Integer.MAX_VALUE) ? 0 : i;
-        }
-
-        /** Set the background on a component. */
-        private JComponent setBackground(JComponent comp, Color c) {
-            comp.setOpaque(true);
-            comp.setBackground(c);
-            return comp;
-        }
-
-        /** Scroll a text area to display a given position near the middle of the visible area. */
-        private void scroll(final JTextArea t, final int pos) {
-            // Using invokeLater appears to give text a chance to sort itself out
-            // before the scroll happens; otherwise scrollRectToVisible doesn't work.
-            // Maybe there's a better way to sync with the text...
-            EventQueue.invokeLater(new Runnable() {
-                public void run() {
-                    try {
-                        Rectangle r = t.modelToView(pos);
-                        JScrollPane p = (JScrollPane) SwingUtilities.getAncestorOfClass(JScrollPane.class, t);
-                        r.y = Math.max(0, r.y - p.getHeight() * 2 / 5);
-                        r.height += p.getHeight() * 4 / 5;
-                        t.scrollRectToVisible(r);
-                    } catch (BadLocationException ignore) {
-                    }
-                }
-            });
-        }
-
-        private JComboBox entries;
-        private JTextField checkField;
-        private InfoPanel enclPanel;
-        private InfoPanel selfPanel;
-        private JTextArea body;
-        private JTextField statusText;
-
-        private Color selfColor = new Color(0.f, 1.f, 0.f, 0.2f); // 20% green
-        private Color enclColor = new Color(1.f, 0.f, 0.f, 0.2f); // 20% red
-
-        /** Panel to display an Info object. */
-        private class InfoPanel extends JPanel {
-            InfoPanel() {
-                add(tagName = createTextField(20));
-                add(new JLabel("start:"));
-                add(addListener(start = createTextField(6)));
-                add(new JLabel("pos:"));
-                add(addListener(pos = createTextField(6)));
-                add(new JLabel("end:"));
-                add(addListener(end = createTextField(6)));
-            }
-
-            void setInfo(Info info) {
-                this.info = info;
-                tagName.setText(tagNames.get(info.tag));
-                start.setText(String.valueOf(info.start));
-                pos.setText(String.valueOf(info.pos));
-                end.setText(String.valueOf(info.end));
-            }
-
-            JTextField addListener(final JTextField f) {
-                f.addMouseListener(new MouseAdapter() {
-                    @Override
-                    public void mouseClicked(MouseEvent e) {
-                        body.setCaretPosition(Integer.valueOf(f.getText()));
-                        body.getCaret().setVisible(true);
-                    }
-                });
-                return f;
-            }
-
-            Info info;
-            JTextField tagName;
-            JTextField start;
-            JTextField pos;
-            JTextField end;
-        }
-
-        /** Object to record information about an error to be displayed. */
-        private class Entry {
-            Entry(JavaFileObject file, String check, Info encl, Info self) {
-                this.file = file;
-                this.check = check;
-                this.encl = encl;
-                this.self= self;
-            }
-
-            @Override
-            public String toString() {
-                return file.getName() + " " + check + " " + getMinPos(encl, self);
-            }
-
-            final JavaFileObject file;
-            final String check;
-            final Info encl;
-            final Info self;
-        }
-    }
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javah/T6893943.java	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,75 @@
+/*
+ * 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 6893943
+ * @summary exit code from javah with no args is 0
+ */
+
+import java.io.*;
+import java.util.*;
+
+public class T6893943 {
+    public static void main(String... args) throws Exception {
+        new T6893943().run();
+    }
+
+    void run() throws Exception {
+        testSimpleAPI();
+        testCommand();
+    }
+
+    void testSimpleAPI() throws Exception {
+        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.err));
+        int rc = com.sun.tools.javah.Main.run(new String[] { }, pw);
+        expect("testSimpleAPI", rc, 1);
+    }
+
+    void testCommand() throws Exception {
+        File javaHome = new File(System.getProperty("java.home"));
+        if (javaHome.getName().equals("jre"))
+            javaHome = javaHome.getParentFile();
+
+        List<String> command = new ArrayList<String>();
+        command.add(new File(new File(javaHome, "bin"), "javah").getPath());
+        command.add("-J-Xbootclasspath:" + System.getProperty("sun.boot.class.path"));
+        //System.err.println("command: " + command);
+
+        ProcessBuilder pb = new ProcessBuilder(command);
+        pb.redirectErrorStream(true);
+        Process p = pb.start();
+        p.getOutputStream().close();
+        String line;
+        BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
+        while ((line = in.readLine()) != null)
+            System.err.println("javah: " + line);
+        int rc = p.waitFor();
+        expect("testCommand", rc, 1);
+    }
+
+    void expect(String name, int actual, int expect) throws Exception {
+        if (actual != expect)
+            throw new Exception(name + ": unexpected exit: " + actual + ", expected: " + expect);
+    }
+}
--- a/make/jprt.properties	Thu Mar 25 16:54:59 2010 -0700
+++ b/make/jprt.properties	Fri Mar 26 11:10:26 2010 -0400
@@ -1,5 +1,5 @@
 #
-# Copyright 2006-2009 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2006-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
@@ -27,15 +27,15 @@
 jprt.tools.default.release=jdk1.7.0
 
 # Specific platform list
-jprt.build.platforms=\
-solaris_sparc_5.10,\
-solaris_sparcv9_5.10,\
-solaris_i586_5.10,\
-solaris_x64_5.10,\
-linux_i586_2.6,\
-linux_x64_2.6,\
-windows_i586,\
-windows_x64
+jprt.build.platforms=   \
+  solaris_sparc_5.10,   \
+  solaris_sparcv9_5.10, \
+  solaris_i586_5.10,    \
+  solaris_x64_5.10,     \
+  linux_i586_2.6,       \
+  linux_x64_2.6,        \
+  windows_i586_5.0,     \
+  windows_x64_5.2
 
 # The different build flavors we want
 jprt.build.flavors=product,fastdebug
@@ -51,6 +51,44 @@
 jprt.solaris_sparcv9.build.platform.match32=solaris_sparc_5.10
 jprt.solaris_x64.build.platform.match32=solaris_i586_5.10
 
-# Standard list of jprt test targets for this workspace
-jprt.test.targets=*-*-*-jvm98
+# Shortened list of vm tests
+jprt.test.targets=              \
+  *-product-*-jvm98,            \
+  *-product-*-scimark,          \
+  *-product-*-runThese,         \
+  *-product-*-GCBasher_default, \
+  *-product-*-GCOld_default,    \
+  *-product-*-jbb_default
 
+# Test targets in test/Makefile
+jprt.make.rule.test.targets=   \
+  *-product-*-jdk_beans1,      \
+  *-product-*-jdk_beans2,      \
+  *-product-*-jdk_beans3,      \
+  *-product-*-jdk_io,          \
+  *-product-*-jdk_lang,        \
+  *-product-*-jdk_management1, \
+  *-product-*-jdk_management2, \
+  *-product-*-jdk_math,        \
+  *-product-*-jdk_misc,        \
+  *-product-*-jdk_net,         \
+  *-product-*-jdk_nio1,        \
+  *-product-*-jdk_nio2,        \
+  *-product-*-jdk_nio3,        \
+  *-product-*-jdk_security1,   \
+  *-product-*-jdk_security2,   \
+  *-product-*-jdk_security3,   \
+  *-product-*-jdk_text,        \
+  *-product-*-jdk_tools1,      \
+  *-product-*-jdk_tools2,      \
+  *-product-*-jdk_util
+
+# Not Ready Yet:
+#   *-product-*-langtools_all
+#   *-product-*-jdk_awt
+#   *-product-*-jdk_rmi
+#   *-product-*-jdk_swing
+
+# Directories to be excluded from source bundles
+jprt.bundle.exclude.src.dirs=build dist webrev
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/Makefile	Fri Mar 26 11:10:26 2010 -0400
@@ -0,0 +1,89 @@
+#
+# 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.  Sun designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Sun 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 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.
+#
+
+#
+# Makefile to run tests from multiple sibling directories
+#
+
+# Root of the forest that was built
+TOPDIR=..
+
+# This makefile depends on the availability of sibling directories.
+LANGTOOLS_DIR=$(TOPDIR)/langtools
+JDK_DIR=$(TOPDIR)/jdk
+
+# Macro to run a test target in a subdir
+define SUBDIR_TEST # subdirectory target
+if [ -d $1 ] ; then \
+  if [ -r $1/test/Makefile ] ; then \
+    echo "$(MAKE) -C $1/test $2" ; \
+    $(MAKE) -C $1/test $2 ; \
+  else \
+    echo "ERROR: File does not exist: $1/test/Makefile"; \
+  fi; \
+else \
+  echo "WARNING: No testing done, directory does not exist: $1"; \
+fi
+endef
+
+# Test target list for langtools repository
+LANGTOOLS_TEST_LIST = langtools_all
+
+# Test target list for jdk repository
+JDK_TEST_LIST = \
+	jdk_awt \
+	jdk_beans jdk_beans1 jdk_beans2 jdk_beans3  \
+	jdk_io  \
+	jdk_lang  \
+	jdk_management jdk_management1 jdk_management2  \
+	jdk_math  \
+	jdk_misc  \
+	jdk_net  \
+	jdk_nio jdk_nio1 jdk_nio2 jdk_nio3  \
+	jdk_rmi \
+	jdk_security jdk_security1 jdk_security2 jdk_security3  \
+	jdk_swing \
+	jdk_text  \
+	jdk_tools jdk_tools1 jdk_tools2  \
+	jdk_util
+
+# Default test target (everything)
+all: $(JDK_TEST_LIST) $(LANGTOOLS_TEST_LIST)
+
+# Test targets
+$(LANGTOOLS_TEST_LIST):
+	@$(call SUBDIR_TEST, $(LANGTOOLS_DIR), all)
+$(JDK_TEST_LIST):
+	@$(call SUBDIR_TEST, $(JDK_DIR), $@)
+
+clean:
+
+################################################################
+
+# Phony targets (e.g. these are not filenames)
+.PHONY: all clean $(JDK_TEST_LIST) $(LANGTOOLS_TEST_LIST)
+
+################################################################
+