# HG changeset patch # User lana # Date 1269049776 25200 # Node ID a491e7a776d524952120f084f77f594acc65e3d2 # Parent 9b1fde936a71e025155dfa4a06789001fdf967b3# Parent b7456c473862048fa70ed8092313a4ef0a55d403 Merge diff -r 9b1fde936a71 -r a491e7a776d5 .hgtags --- a/.hgtags Fri Mar 12 01:09:13 2010 +0000 +++ b/.hgtags Fri Mar 19 18:49:36 2010 -0700 @@ -58,3 +58,6 @@ dcc938ac40cc45f1ef454d76020b5db5d943001c jdk7-b81 a30062be6d9ca1d48579826f870f85974300004e jdk7-b82 34c8199936a1682aa8587857f44cfaf37c2b6381 jdk7-b83 +b1e55627a6980b9508854ed0c0f21d4f981b4494 jdk7-b84 +b6f633a93ae0ec4555ff4bf756f5e2150c9bdede jdk7-b85 +c94d9cc81f495d97817eba9d71b84fc45f7661a5 jdk7-b86 diff -r 9b1fde936a71 -r a491e7a776d5 .hgtags-top-repo --- a/.hgtags-top-repo Fri Mar 12 01:09:13 2010 +0000 +++ b/.hgtags-top-repo Fri Mar 19 18:49:36 2010 -0700 @@ -58,3 +58,6 @@ 8403096d1fe7ff5318df9708cfec84a3fd3e1cf9 jdk7-b81 e1176f86805fe07fd9fb9da065dc51b47712ce76 jdk7-b82 6880a3af9addb41541e80ebe8cde6f79ec402a58 jdk7-b83 +2f3ea057d1ad56cf3b269cdc4de2741411151982 jdk7-b84 +cf26288a114be67c39f2758959ce50b60f5ae330 jdk7-b85 +433a60a9c0bf1b26ee7e65cebaa89c541f497aed jdk7-b86 diff -r 9b1fde936a71 -r a491e7a776d5 corba/.hgtags --- a/corba/.hgtags Fri Mar 12 01:09:13 2010 +0000 +++ b/corba/.hgtags Fri Mar 19 18:49:36 2010 -0700 @@ -58,3 +58,6 @@ e08a42a2a94d97ea8eedb187a94dbff822c8fbba jdk7-b81 1e8c1bfad1abb4b81407a0f2645e0fb85764ca48 jdk7-b82 fde0df7a2384f7fe33204a79678989807d9c2b98 jdk7-b83 +68c8961a82e4a3ad2a67991e5d834192a81eb4cd jdk7-b84 +c67a9df7bc0ca291f08f9a9cc05cb78ea15d25e6 jdk7-b85 +6253e28826d16cf1aecc39ce04c8de1f6bf2df5f jdk7-b86 diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/.hgtags --- a/hotspot/.hgtags Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/.hgtags Fri Mar 19 18:49:36 2010 -0700 @@ -80,3 +80,8 @@ 9ab385cb0c42997e16a7761ebcd25c90560a2714 hs15-b04 fafab5d5349c7c066d677538db67a1ee0fb33bd2 hs15-b05 3f370a32906eb5ba993fabd7b4279be7f31052b9 jdk7-b83 +ffc8d176b84bcfb5ac21302b4feb3b0c0d69b97c jdk7-b84 +6c9796468b91dcbb39e09dfa1baf9779ac45eb66 jdk7-b85 +418bc80ce13995149eadc9eecbba21d7a9fa02ae hs17-b10 +bf823ef06b4f211e66988d76a2e2669be5c0820e jdk7-b86 +07226e9eab8f74b37346b32715f829a2ef2c3188 hs18-b01 diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/agent/src/os/linux/libproc_impl.c --- a/hotspot/agent/src/os/linux/libproc_impl.c Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/agent/src/os/linux/libproc_impl.c Fri Mar 19 18:49:36 2010 -0700 @@ -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); } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/agent/src/os/linux/symtab.c --- a/hotspot/agent/src/os/linux/symtab.c Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/agent/src/os/linux/symtab.c Fri Mar 19 18:49:36 2010 -0700 @@ -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); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/agent/src/os/linux/symtab.h --- a/hotspot/agent/src/os/linux/symtab.h Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/agent/src/os/linux/symtab.h Fri Mar 19 18:49:36 2010 -0700 @@ -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); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/make/hotspot_version --- a/hotspot/make/hotspot_version Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/make/hotspot_version Fri Mar 19 18:49:36 2010 -0700 @@ -31,11 +31,11 @@ # # Don't put quotes (fail windows build). -HOTSPOT_VM_COPYRIGHT=Copyright 2009 +HOTSPOT_VM_COPYRIGHT=Copyright 2010 -HS_MAJOR_VER=17 +HS_MAJOR_VER=18 HS_MINOR_VER=0 -HS_BUILD_NUMBER=09 +HS_BUILD_NUMBER=01 JDK_MAJOR_VER=1 JDK_MINOR_VER=7 diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/make/linux/makefiles/build_vm_def.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/make/linux/makefiles/build_vm_def.sh Fri Mar 19 18:49:36 2010 -0700 @@ -0,0 +1,5 @@ +#!/bin/sh + +nm --defined-only $* | awk ' + { if ($3 ~ /^_ZTV/ || $3 ~ /^gHotSpotVM/) print "\t" $3 ";" } + ' diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/make/linux/makefiles/mapfile-vers-debug --- a/hotspot/make/linux/makefiles/mapfile-vers-debug Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/make/linux/makefiles/mapfile-vers-debug Fri Mar 19 18:49:36 2010 -0700 @@ -290,6 +290,9 @@ # This is for Forte Analyzer profiling support. AsyncGetCallTrace; + + # INSERT VTABLE SYMBOLS HERE + local: *; }; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/make/linux/makefiles/mapfile-vers-product --- a/hotspot/make/linux/makefiles/mapfile-vers-product Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/make/linux/makefiles/mapfile-vers-product Fri Mar 19 18:49:36 2010 -0700 @@ -285,6 +285,9 @@ # This is for Forte Analyzer profiling support. AsyncGetCallTrace; + + # INSERT VTABLE SYMBOLS HERE + local: *; }; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/make/linux/makefiles/vm.make --- a/hotspot/make/linux/makefiles/vm.make Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/make/linux/makefiles/vm.make Fri Mar 19 18:49:36 2010 -0700 @@ -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 diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.hpp --- a/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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; } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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()) { @@ -2730,9 +2738,6 @@ } Address counter_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset()) - mdo_offset_bias); - __ lduw(counter_addr, tmp1); - __ add(tmp1, DataLayout::counter_increment, tmp1); - __ stw(tmp1, counter_addr); Bytecodes::Code bc = method->java_code_at_bci(bci); // Perform additional virtual call profiling for invokevirtual and // invokeinterface bytecodes @@ -2822,15 +2827,23 @@ __ set(DataLayout::counter_increment, tmp1); __ st_ptr(tmp1, mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_count_offset(i)) - mdo_offset_bias); - if (i < (VirtualCallData::row_limit() - 1)) { - __ br(Assembler::always, false, Assembler::pt, update_done); - __ delayed()->nop(); - } + __ br(Assembler::always, false, Assembler::pt, update_done); + __ delayed()->nop(); __ bind(next_test); } + // Receiver did not match any saved receiver and there is no empty row for it. + // Increment total counter to indicate polymorphic case. + __ lduw(counter_addr, tmp1); + __ add(tmp1, DataLayout::counter_increment, tmp1); + __ stw(tmp1, counter_addr); __ bind(update_done); } + } else { + // Static call + __ lduw(counter_addr, tmp1); + __ add(tmp1, DataLayout::counter_increment, tmp1); + __ stw(tmp1, counter_addr); } } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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(); } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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); } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -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 */ @@ -1733,7 +1734,7 @@ brx(Assembler::zero, false, Assembler::pn, found_null); delayed()->nop(); // Receiver did not match any saved receiver and there is no empty row for it. - // Increment total counter to indicate polimorphic case. + // Increment total counter to indicate polymorphic case. increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch); ba(false, done); delayed()->nop(); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/sparc/vm/interp_masm_sparc.hpp --- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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. diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -851,10 +851,10 @@ __ set(reg2offset(r_1) + extraspace + bias, ld_off); #else int ld_off = reg2offset(r_1) + extraspace + bias; +#endif // _LP64 #ifdef ASSERT G1_forced = true; #endif // ASSERT -#endif // _LP64 r_1 = G1_scratch->as_VMReg();// as part of the load/store shuffle if (!r_2->is_valid()) __ ld (base, ld_off, G1_scratch); else __ ldx(base, ld_off, G1_scratch); @@ -865,9 +865,11 @@ if (sig_bt[i] == T_OBJECT || sig_bt[i] == T_ARRAY) { store_c2i_object(r, base, st_off); } else if (sig_bt[i] == T_LONG || sig_bt[i] == T_DOUBLE) { +#ifndef _LP64 if (TieredCompilation) { assert(G1_forced || sig_bt[i] != T_LONG, "should not use register args for longs"); } +#endif // _LP64 store_c2i_long(r, base, st_off, r_2->is_stack()); } else { store_c2i_int(r, base, st_off); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/sparc/vm/sparc.ad --- a/hotspot/src/cpu/sparc/vm/sparc.ad Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/sparc/vm/sparc.ad Fri Mar 19 18:49:36 2010 -0700 @@ -1803,8 +1803,9 @@ // to implement the UseStrictFP mode. const bool Matcher::strict_fp_requires_explicit_rounding = false; -// Do floats take an entire double register or just half? -const bool Matcher::float_in_double = false; +// Are floats conerted to double when stored to stack during deoptimization? +// Sparc does not handle callee-save floats. +bool Matcher::float_in_double() { return false; } // Do ints take an entire long register or just half? // Note that we if-def off of _LP64. diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp --- a/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 { diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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. diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/assembler_x86.cpp --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp --- a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp --- a/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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; } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp --- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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(); @@ -3279,7 +3276,7 @@ __ bind(next_test); } // Receiver did not match any saved receiver and there is no empty row for it. - // Increment total counter to indicate polimorphic case. + // Increment total counter to indicate polymorphic case. __ addl(counter_addr, DataLayout::counter_increment); __ bind(update_done); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp --- a/hotspot/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp --- a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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); } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/frame_x86.inline.hpp --- a/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -233,7 +233,8 @@ } else { // sp() may have been extended or shrunk by an adapter. At least // check that we don't fall behind the legal region. - assert(last_sp < (intptr_t*) interpreter_frame_monitor_begin(), "bad tos"); + // For top deoptimized frame last_sp == interpreter_frame_monitor_end. + assert(last_sp <= (intptr_t*) interpreter_frame_monitor_end(), "bad tos"); return last_sp; } } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -1308,7 +1308,7 @@ if (is_virtual_call) { jccb(Assembler::zero, found_null); // Receiver did not match any saved receiver and there is no empty row for it. - // Increment total counter to indicate polimorphic case. + // Increment total counter to indicate polymorphic case. increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); jmp(done); bind(found_null); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -1341,7 +1341,7 @@ if (is_virtual_call) { jccb(Assembler::zero, found_null); // Receiver did not match any saved receiver and there is no empty row for it. - // Increment total counter to indicate polimorphic case. + // Increment total counter to indicate polymorphic case. increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); jmp(done); bind(found_null); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/methodHandles_x86.cpp --- a/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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); @@ -584,7 +541,7 @@ Label done; __ movptr(rdx_temp, vmarg); - __ testl(rdx_temp, rdx_temp); + __ testptr(rdx_temp, rdx_temp); __ jccb(Assembler::zero, done); // no cast if null __ load_klass(rdx_temp, rdx_temp); @@ -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,10 +1065,6 @@ __ 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(); } } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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(); } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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(); } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp --- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp --- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 { diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -3238,17 +3234,19 @@ __ xorl(rcx, rcx); // use zero reg to clear memory (shorter code) __ store_klass_gap(rax, rcx); // zero klass gap for compressed oops __ store_klass(rax, rsi); // store klass last + + { + SkipIfEqual skip(_masm, &DTraceAllocProbes, false); + // Trigger dtrace event for fastpath + __ push(atos); // save the return value + __ call_VM_leaf( + CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc), rax); + __ pop(atos); // restore the return value + + } __ jmp(done); } - { - SkipIfEqual skip(_masm, &DTraceAllocProbes, false); - // Trigger dtrace event for fastpath - __ push(atos); // save the return value - __ call_VM_leaf( - CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc), rax); - __ pop(atos); // restore the return value - } // slow case __ bind(slow_case); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/x86_32.ad --- a/hotspot/src/cpu/x86/vm/x86_32.ad Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/x86_32.ad Fri Mar 19 18:49:36 2010 -0700 @@ -1444,8 +1444,10 @@ // to implement the UseStrictFP mode. const bool Matcher::strict_fp_requires_explicit_rounding = true; -// Do floats take an entire double register or just half? -const bool Matcher::float_in_double = true; +// Are floats conerted to double when stored to stack during deoptimization? +// On x32 it is stored with convertion only when FPU is used for floats. +bool Matcher::float_in_double() { return (UseSSE == 0); } + // Do ints take an entire long register or just half? const bool Matcher::int_in_long = false; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/x86/vm/x86_64.ad --- a/hotspot/src/cpu/x86/vm/x86_64.ad Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/x86/vm/x86_64.ad Fri Mar 19 18:49:36 2010 -0700 @@ -2074,8 +2074,10 @@ // implement the UseStrictFP mode. const bool Matcher::strict_fp_requires_explicit_rounding = true; -// Do floats take an entire double register or just half? -const bool Matcher::float_in_double = true; +// Are floats conerted to double when stored to stack during deoptimization? +// On x64 it is stored without convertion so we can use normal access. +bool Matcher::float_in_double() { return false; } + // Do ints take an entire long register or just half? const bool Matcher::int_in_long = true; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp --- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -1,6 +1,6 @@ /* * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. - * Copyright 2007, 2008, 2009 Red Hat, Inc. + * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -145,7 +145,7 @@ } else if (istate->msg() == BytecodeInterpreter::return_from_method) { // Copy the result into the caller's frame - result_slots = type2size[method->result_type()]; + result_slots = type2size[result_type_of(method)]; assert(result_slots >= 0 && result_slots <= 2, "what?"); result = istate->stack() + result_slots; break; @@ -394,9 +394,10 @@ // Push our result if (!HAS_PENDING_EXCEPTION) { - stack->set_sp(stack->sp() - type2size[method->result_type()]); + BasicType type = result_type_of(method); + stack->set_sp(stack->sp() - type2size[type]); - switch (method->result_type()) { + switch (type) { case T_VOID: break; @@ -707,6 +708,26 @@ return i; } +BasicType CppInterpreter::result_type_of(methodOop method) { + BasicType t; + switch (method->result_index()) { + case 0 : t = T_BOOLEAN; break; + case 1 : t = T_CHAR; break; + case 2 : t = T_BYTE; break; + case 3 : t = T_SHORT; break; + case 4 : t = T_INT; break; + case 5 : t = T_LONG; break; + case 6 : t = T_VOID; break; + case 7 : t = T_FLOAT; break; + case 8 : t = T_DOUBLE; break; + case 9 : t = T_OBJECT; break; + default: ShouldNotReachHere(); + } + assert(AbstractInterpreter::BasicType_as_index(t) == method->result_index(), + "out of step with AbstractInterpreter::BasicType_as_index"); + return t; +} + address InterpreterGenerator::generate_empty_entry() { if (!UseFastEmptyMethods) return NULL; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/zero/vm/cppInterpreter_zero.hpp --- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -1,6 +1,6 @@ /* * Copyright 1997-2007 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 @@ -41,3 +41,7 @@ private: // Stack overflow checks static bool stack_overflow_imminent(JavaThread *thread); + + private: + // Fast result type determination + static BasicType result_type_of(methodOop method); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/cpu/zero/vm/globals_zero.hpp --- a/hotspot/src/cpu/zero/vm/globals_zero.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/cpu/zero/vm/globals_zero.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -1,6 +1,6 @@ /* * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved. - * Copyright 2007, 2008, 2009 Red Hat, Inc. + * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ define_pd_global(intx, StackYellowPages, 2); define_pd_global(intx, StackRedPages, 1); -define_pd_global(intx, StackShadowPages, 3 LP64_ONLY(+3) DEBUG_ONLY(+3)); +define_pd_global(intx, StackShadowPages, 5 LP64_ONLY(+1) DEBUG_ONLY(+3)); define_pd_global(bool, RewriteBytecodes, true); define_pd_global(bool, RewriteFrequentPairs, true); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/os_cpu/linux_zero/vm/globals_linux_zero.hpp --- a/hotspot/src/os_cpu/linux_zero/vm/globals_linux_zero.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/os_cpu/linux_zero/vm/globals_linux_zero.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.hpp --- a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -1,6 +1,6 @@ /* * Copyright 2003-2004 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 @@ -39,7 +39,13 @@ "stfd %0, 0(%2)\n" : "=f"(tmp) : "b"(src), "b"(dst)); +#elif defined(S390) && !defined(_LP64) + double tmp; + asm volatile ("ld %0, 0(%1)\n" + "std %0, 0(%2)\n" + : "=r"(tmp) + : "a"(src), "a"(dst)); #else *(jlong *) dst = *(jlong *) src; -#endif // PPC && !_LP64 +#endif } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp --- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -730,11 +730,12 @@ st->print(", RSI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSI]); st->print(", RDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDI]); st->cr(); - st->print(", R8=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R8]); + st->print( "R8=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R8]); st->print(", R9=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R9]); st->print(", R10=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R10]); st->print(", R11=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R11]); - st->print(", R12=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R12]); + st->cr(); + st->print( "R12=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R12]); st->print(", R13=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R13]); st->print(", R14=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R14]); st->print(", R15=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R15]); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/c1/c1_Canonicalizer.cpp --- a/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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()); + } } } } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/c1/c1_CodeStubs.hpp --- a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/c1/c1_GraphBuilder.cpp --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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(); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/c1/c1_IR.cpp --- a/hotspot/src/share/vm/c1/c1_IR.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/c1/c1_IR.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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); } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/c1/c1_IR.hpp --- a/hotspot/src/share/vm/c1/c1_IR.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/c1/c1_IR.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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,8 +252,8 @@ 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; - recorder->describe_scope(pc_offset, scope()->method(), bci(), reexecute, is_method_handle_invoke, locvals, expvals, monvals); + 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); } }; @@ -302,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; } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/c1/c1_Instruction.cpp --- a/hotspot/src/share/vm/c1/c1_Instruction.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/c1/c1_Instruction.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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) { diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/c1/c1_Instruction.hpp --- a/hotspot/src/share/vm/c1/c1_Instruction.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/c1/c1_Instruction.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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*)); }; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/c1/c1_LIR.cpp --- a/hotspot/src/share/vm/c1/c1_LIR.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/c1/c1_LIR.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/c1/c1_LIR.hpp --- a/hotspot/src/share/vm/c1/c1_LIR.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/c1/c1_LIR.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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)); } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/c1/c1_LIRAssembler.cpp --- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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) { diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/c1/c1_LIRAssembler.hpp --- a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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(); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/c1/c1_LIRGenerator.cpp --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/c1/c1_LinearScan.cpp --- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/c1/c1_MacroAssembler.hpp --- a/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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(); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/c1/c1_Runtime1.cpp --- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -1075,6 +1075,7 @@ }; +// Below length is the # elements copied. template int obj_arraycopy_work(oopDesc* src, T* src_addr, oopDesc* dst, T* dst_addr, int length) { @@ -1083,22 +1084,22 @@ // barrier. The assert will fail if this is not the case. // Note that we use the non-virtual inlineable variant of write_ref_array. BarrierSet* bs = Universe::heap()->barrier_set(); - assert(bs->has_write_ref_array_opt(), - "Barrier set must have ref array opt"); + assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt"); + assert(bs->has_write_ref_array_pre_opt(), "For pre-barrier as well."); if (src == dst) { // same object, no check + bs->write_ref_array_pre(dst_addr, length); Copy::conjoint_oops_atomic(src_addr, dst_addr, length); - bs->write_ref_array(MemRegion((HeapWord*)dst_addr, - (HeapWord*)(dst_addr + length))); + bs->write_ref_array((HeapWord*)dst_addr, length); return ac_ok; } else { klassOop bound = objArrayKlass::cast(dst->klass())->element_klass(); klassOop stype = objArrayKlass::cast(src->klass())->element_klass(); if (stype == bound || Klass::cast(stype)->is_subtype_of(bound)) { // Elements are guaranteed to be subtypes, so no check necessary + bs->write_ref_array_pre(dst_addr, length); Copy::conjoint_oops_atomic(src_addr, dst_addr, length); - bs->write_ref_array(MemRegion((HeapWord*)dst_addr, - (HeapWord*)(dst_addr + length))); + bs->write_ref_array((HeapWord*)dst_addr, length); return ac_ok; } } @@ -1162,9 +1163,16 @@ #endif if (num == 0) return; + BarrierSet* bs = Universe::heap()->barrier_set(); + assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt"); + assert(bs->has_write_ref_array_pre_opt(), "For pre-barrier as well."); + if (UseCompressedOops) { + bs->write_ref_array_pre((narrowOop*)dst, num); + } else { + bs->write_ref_array_pre((oop*)dst, num); + } Copy::conjoint_oops_atomic((oop*) src, (oop*) dst, num); - BarrierSet* bs = Universe::heap()->barrier_set(); - bs->write_ref_array(MemRegion(dst, dst + num)); + bs->write_ref_array(dst, num); JRT_END diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/ci/ciCPCache.cpp --- a/hotspot/src/share/vm/ci/ciCPCache.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/ci/ciCPCache.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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. diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/ci/ciCPCache.hpp --- a/hotspot/src/share/vm/ci/ciCPCache.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/ci/ciCPCache.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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(); }; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/ci/ciMethod.cpp --- a/hotspot/src/share/vm/ci/ciMethod.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/ci/ciMethod.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -445,7 +445,8 @@ (morphism == ciCallProfile::MorphismLimit && count == 0)) { #ifdef ASSERT if (count > 0) { - tty->print_cr("bci: %d", bci); + this->print_short_name(tty); + tty->print_cr(" @ bci:%d", bci); this->print_codes(); assert(false, "this call site should not be polymorphic"); } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/classfile/javaClasses.cpp --- a/hotspot/src/share/vm/classfile/javaClasses.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -1121,10 +1121,23 @@ } void flush() { + // The following appears to have been an optimization to save from + // doing a barrier for each individual store into the _methods array, + // but rather to do it for the entire array after the series of writes. + // That optimization seems to have been lost when compressed oops was + // implemented. However, the extra card-marks below was left in place, + // but is now redundant because the individual stores into the + // _methods array already execute the barrier code. CR 6918185 has + // been filed so the original code may be restored by deferring the + // barriers until after the entire sequence of stores, thus re-enabling + // the intent of the original optimization. In the meantime the redundant + // card mark below is now disabled. if (_dirty && _methods != NULL) { +#if 0 BarrierSet* bs = Universe::heap()->barrier_set(); assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt"); bs->write_ref_array((HeapWord*)_methods->base(), _methods->length()); +#endif _dirty = false; } } @@ -1168,9 +1181,7 @@ method = mhandle(); } - _methods->obj_at_put(_index, method); - // bad for UseCompressedOops - // *_methods->obj_at_addr(_index) = method; + _methods->obj_at_put(_index, method); _bcis->ushort_at_put(_index, bci); _index++; _dirty = true; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/classfile/loaderConstraints.cpp --- a/hotspot/src/share/vm/classfile/loaderConstraints.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/classfile/loaderConstraints.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -457,7 +457,8 @@ } -void LoaderConstraintTable::verify(Dictionary* dictionary) { +void LoaderConstraintTable::verify(Dictionary* dictionary, + PlaceholderTable* placeholders) { Thread *thread = Thread::current(); for (int cindex = 0; cindex < _loader_constraint_size; cindex++) { for (LoaderConstraintEntry* probe = bucket(cindex); @@ -472,7 +473,23 @@ unsigned int d_hash = dictionary->compute_hash(name, loader); int d_index = dictionary->hash_to_index(d_hash); klassOop k = dictionary->find_class(d_index, d_hash, name, loader); - guarantee(k == probe->klass(), "klass should be in dictionary"); + if (k != NULL) { + // We found the class in the system dictionary, so we should + // make sure that the klassOop matches what we already have. + guarantee(k == probe->klass(), "klass should be in dictionary"); + } else { + // If we don't find the class in the system dictionary, it + // has to be in the placeholders table. + unsigned int p_hash = placeholders->compute_hash(name, loader); + int p_index = placeholders->hash_to_index(p_hash); + PlaceholderEntry* entry = placeholders->get_entry(p_index, p_hash, + name, loader); + + // The instanceKlass might not be on the entry, so the only + // thing we can check here is whether we were successful in + // finding the class in the placeholders table. + guarantee(entry != NULL, "klass should be in the placeholders"); + } } for (int n = 0; n< probe->num_loaders(); n++) { guarantee(probe->loader(n)->is_oop_or_null(), "should be oop"); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/classfile/loaderConstraints.hpp --- a/hotspot/src/share/vm/classfile/loaderConstraints.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/classfile/loaderConstraints.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -84,7 +84,7 @@ void purge_loader_constraints(BoolObjectClosure* is_alive); - void verify(Dictionary* dictionary); + void verify(Dictionary* dictionary, PlaceholderTable* placeholders); #ifndef PRODUCT void print(); #endif diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/classfile/systemDictionary.cpp --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -2573,7 +2573,7 @@ // Verify constraint table guarantee(constraints() != NULL, "Verify of loader constraints failed"); - constraints()->verify(dictionary()); + constraints()->verify(dictionary(), placeholders()); } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/code/codeBlob.cpp --- a/hotspot/src/share/vm/code/codeBlob.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/code/codeBlob.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/code/codeBlob.hpp --- a/hotspot/src/share/vm/code/codeBlob.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/code/codeBlob.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 { diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/code/debugInfoRec.cpp --- a/hotspot/src/share/vm/code/debugInfoRec.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/code/debugInfoRec.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -282,6 +282,7 @@ int bci, bool reexecute, bool is_method_handle_invoke, + bool return_oop, DebugToken* locals, DebugToken* expressions, DebugToken* monitors) { @@ -296,6 +297,7 @@ // Record flags into pcDesc. last_pd->set_should_reexecute(reexecute); last_pd->set_is_method_handle_invoke(is_method_handle_invoke); + last_pd->set_return_oop(return_oop); // serialize sender stream offest stream()->write_int(sender_stream_offset); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/code/debugInfoRec.hpp --- a/hotspot/src/share/vm/code/debugInfoRec.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/code/debugInfoRec.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -89,6 +89,7 @@ int bci, bool reexecute, bool is_method_handle_invoke = false, + bool return_oop = false, DebugToken* locals = NULL, DebugToken* expressions = NULL, DebugToken* monitors = NULL); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/code/nmethod.cpp --- a/hotspot/src/share/vm/code/nmethod.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/code/nmethod.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -988,7 +988,8 @@ PcDesc* pd = pc_desc_at(pc); guarantee(pd != NULL, "scope must be present"); return new ScopeDesc(this, pd->scope_decode_offset(), - pd->obj_decode_offset(), pd->should_reexecute()); + pd->obj_decode_offset(), pd->should_reexecute(), + pd->return_oop()); } @@ -2010,7 +2011,10 @@ print_pcs(); } #endif - guarantee(cont_offset != 0, "unhandled implicit exception in compiled code"); + if (cont_offset == 0) { + // Let the normal error handling report the exception + return NULL; + } return instructions_begin() + cont_offset; } @@ -2156,7 +2160,8 @@ PcDesc* pd = pc_desc_at(ic->end_of_call()); assert(pd != NULL, "PcDesc must exist"); for (ScopeDesc* sd = new ScopeDesc(this, pd->scope_decode_offset(), - pd->obj_decode_offset(), pd->should_reexecute()); + pd->obj_decode_offset(), pd->should_reexecute(), + pd->return_oop()); !sd->is_top(); sd = sd->sender()) { sd->verify(); } @@ -2421,7 +2426,8 @@ PcDesc* p = pc_desc_near(begin+1); if (p != NULL && p->real_pc(this) <= end) { return new ScopeDesc(this, p->scope_decode_offset(), - p->obj_decode_offset(), p->should_reexecute()); + p->obj_decode_offset(), p->should_reexecute(), + p->return_oop()); } return NULL; } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/code/pcDesc.cpp --- a/hotspot/src/share/vm/code/pcDesc.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/code/pcDesc.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -52,7 +52,8 @@ tty->print(" "); sd->method()->print_short_name(tty); tty->print(" @%d", sd->bci()); - tty->print(" reexecute=%s", sd->should_reexecute()?"true":"false"); + if (sd->should_reexecute()) + tty->print(" reexecute=true"); tty->cr(); } #endif diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/code/pcDesc.hpp --- a/hotspot/src/share/vm/code/pcDesc.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/code/pcDesc.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -39,6 +39,7 @@ struct { unsigned int reexecute: 1; unsigned int is_method_handle_invoke: 1; + unsigned int return_oop: 1; } bits; bool operator ==(const PcDescFlags& other) { return word == other.word; } } _flags; @@ -76,6 +77,9 @@ bool is_method_handle_invoke() const { return _flags.bits.is_method_handle_invoke; } void set_is_method_handle_invoke(bool z) { _flags.bits.is_method_handle_invoke = z; } + bool return_oop() const { return _flags.bits.return_oop; } + void set_return_oop(bool z) { _flags.bits.return_oop = z; } + // Returns the real pc address real_pc(const nmethod* code) const; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/code/scopeDesc.cpp --- a/hotspot/src/share/vm/code/scopeDesc.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/code/scopeDesc.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -26,19 +26,21 @@ # include "incls/_scopeDesc.cpp.incl" -ScopeDesc::ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute) { +ScopeDesc::ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool return_oop) { _code = code; _decode_offset = decode_offset; _objects = decode_object_values(obj_decode_offset); _reexecute = reexecute; + _return_oop = return_oop; decode_body(); } -ScopeDesc::ScopeDesc(const nmethod* code, int decode_offset, bool reexecute) { +ScopeDesc::ScopeDesc(const nmethod* code, int decode_offset, bool reexecute, bool return_oop) { _code = code; _decode_offset = decode_offset; _objects = decode_object_values(DebugInformationRecorder::serialized_null); _reexecute = reexecute; + _return_oop = return_oop; decode_body(); } @@ -48,6 +50,7 @@ _decode_offset = parent->_sender_decode_offset; _objects = parent->_objects; _reexecute = false; //reexecute only applies to the first scope + _return_oop = false; decode_body(); } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/code/scopeDesc.hpp --- a/hotspot/src/share/vm/code/scopeDesc.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/code/scopeDesc.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -52,17 +52,18 @@ class ScopeDesc : public ResourceObj { public: // Constructor - ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute); + ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool return_oop); // Calls above, giving default value of "serialized_null" to the // "obj_decode_offset" argument. (We don't use a default argument to // avoid a .hpp-.hpp dependency.) - ScopeDesc(const nmethod* code, int decode_offset, bool reexecute); + ScopeDesc(const nmethod* code, int decode_offset, bool reexecute, bool return_oop); // JVM state methodHandle method() const { return _method; } int bci() const { return _bci; } bool should_reexecute() const { return _reexecute; } + bool return_oop() const { return _return_oop; } GrowableArray* locals(); GrowableArray* expressions(); @@ -88,6 +89,7 @@ methodHandle _method; int _bci; bool _reexecute; + bool _return_oop; // Decoding offsets int _decode_offset; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/compiler/compileBroker.cpp --- a/hotspot/src/share/vm/compiler/compileBroker.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 { diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -46,9 +46,9 @@ _processor_count = os::active_processor_count(); - if (CMSConcurrentMTEnabled && (ParallelCMSThreads > 1)) { + if (CMSConcurrentMTEnabled && (ConcGCThreads > 1)) { assert(_processor_count > 0, "Processor count is suspect"); - _concurrent_processor_count = MIN2((uint) ParallelCMSThreads, + _concurrent_processor_count = MIN2((uint) ConcGCThreads, (uint) _processor_count); } else { _concurrent_processor_count = 1; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -606,7 +606,7 @@ assert(_modUnionTable.covers(_span), "_modUnionTable inconsistency?"); } - if (!_markStack.allocate(CMSMarkStackSize)) { + if (!_markStack.allocate(MarkStackSize)) { warning("Failed to allocate CMS Marking Stack"); return; } @@ -617,13 +617,13 @@ // Support for multi-threaded concurrent phases if (ParallelGCThreads > 0 && CMSConcurrentMTEnabled) { - if (FLAG_IS_DEFAULT(ParallelCMSThreads)) { + if (FLAG_IS_DEFAULT(ConcGCThreads)) { // just for now - FLAG_SET_DEFAULT(ParallelCMSThreads, (ParallelGCThreads + 3)/4); - } - if (ParallelCMSThreads > 1) { + FLAG_SET_DEFAULT(ConcGCThreads, (ParallelGCThreads + 3)/4); + } + if (ConcGCThreads > 1) { _conc_workers = new YieldingFlexibleWorkGang("Parallel CMS Threads", - ParallelCMSThreads, true); + ConcGCThreads, true); if (_conc_workers == NULL) { warning("GC/CMS: _conc_workers allocation failure: " "forcing -CMSConcurrentMTEnabled"); @@ -634,13 +634,13 @@ } } if (!CMSConcurrentMTEnabled) { - ParallelCMSThreads = 0; + ConcGCThreads = 0; } else { // Turn off CMSCleanOnEnter optimization temporarily for // the MT case where it's not fixed yet; see 6178663. CMSCleanOnEnter = false; } - assert((_conc_workers != NULL) == (ParallelCMSThreads > 1), + assert((_conc_workers != NULL) == (ConcGCThreads > 1), "Inconsistency"); // Parallel task queues; these are shared for the @@ -648,7 +648,7 @@ // are not shared with parallel scavenge (ParNew). { uint i; - uint num_queues = (uint) MAX2(ParallelGCThreads, ParallelCMSThreads); + uint num_queues = (uint) MAX2(ParallelGCThreads, ConcGCThreads); if ((CMSParallelRemarkEnabled || CMSConcurrentMTEnabled || ParallelRefProcEnabled) @@ -723,8 +723,9 @@ // Support for parallelizing survivor space rescan if (CMSParallelRemarkEnabled && CMSParallelSurvivorRemarkEnabled) { - size_t max_plab_samples = cp->max_gen0_size()/ - ((SurvivorRatio+2)*MinTLABSize); + const size_t max_plab_samples = + ((DefNewGeneration*)_young_gen)->max_survivor_size()/MinTLABSize; + _survivor_plab_array = NEW_C_HEAP_ARRAY(ChunkArray, ParallelGCThreads); _survivor_chunk_array = NEW_C_HEAP_ARRAY(HeapWord*, 2*max_plab_samples); _cursor = NEW_C_HEAP_ARRAY(size_t, ParallelGCThreads); @@ -3657,7 +3658,7 @@ assert(_revisitStack.isEmpty(), "tabula rasa"); DEBUG_ONLY(RememberKlassesChecker cmx(should_unload_classes());) bool result = false; - if (CMSConcurrentMTEnabled && ParallelCMSThreads > 0) { + if (CMSConcurrentMTEnabled && ConcGCThreads > 0) { result = do_marking_mt(asynch); } else { result = do_marking_st(asynch); @@ -4174,10 +4175,10 @@ } bool CMSCollector::do_marking_mt(bool asynch) { - assert(ParallelCMSThreads > 0 && conc_workers() != NULL, "precondition"); + assert(ConcGCThreads > 0 && conc_workers() != NULL, "precondition"); // In the future this would be determined ergonomically, based // on #cpu's, # active mutator threads (and load), and mutation rate. - int num_workers = ParallelCMSThreads; + int num_workers = ConcGCThreads; CompactibleFreeListSpace* cms_space = _cmsGen->cmsSpace(); CompactibleFreeListSpace* perm_space = _permGen->cmsSpace(); @@ -6429,8 +6430,8 @@ // For now we take the expedient path of just disabling the // messages for the problematic case.) void CMSMarkStack::expand() { - assert(_capacity <= CMSMarkStackSizeMax, "stack bigger than permitted"); - if (_capacity == CMSMarkStackSizeMax) { + assert(_capacity <= MarkStackSizeMax, "stack bigger than permitted"); + if (_capacity == MarkStackSizeMax) { if (_hit_limit++ == 0 && !CMSConcurrentMTEnabled && PrintGCDetails) { // We print a warning message only once per CMS cycle. gclog_or_tty->print_cr(" (benign) Hit CMSMarkStack max size limit"); @@ -6438,7 +6439,7 @@ return; } // Double capacity if possible - size_t new_capacity = MIN2(_capacity*2, CMSMarkStackSizeMax); + size_t new_capacity = MIN2(_capacity*2, MarkStackSizeMax); // Do not give up existing stack until we have managed to // get the double capacity that we desired. ReservedSpace rs(ReservedSpace::allocation_align_size_up( diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -44,20 +44,20 @@ { // Ergomonically select initial concurrent refinement parameters - if (FLAG_IS_DEFAULT(G1ConcRefineGreenZone)) { - FLAG_SET_DEFAULT(G1ConcRefineGreenZone, MAX2(ParallelGCThreads, 1)); + if (FLAG_IS_DEFAULT(G1ConcRefinementGreenZone)) { + FLAG_SET_DEFAULT(G1ConcRefinementGreenZone, MAX2(ParallelGCThreads, 1)); } - set_green_zone(G1ConcRefineGreenZone); + set_green_zone(G1ConcRefinementGreenZone); - if (FLAG_IS_DEFAULT(G1ConcRefineYellowZone)) { - FLAG_SET_DEFAULT(G1ConcRefineYellowZone, green_zone() * 3); + if (FLAG_IS_DEFAULT(G1ConcRefinementYellowZone)) { + FLAG_SET_DEFAULT(G1ConcRefinementYellowZone, green_zone() * 3); } - set_yellow_zone(MAX2(G1ConcRefineYellowZone, green_zone())); + set_yellow_zone(MAX2(G1ConcRefinementYellowZone, green_zone())); - if (FLAG_IS_DEFAULT(G1ConcRefineRedZone)) { - FLAG_SET_DEFAULT(G1ConcRefineRedZone, yellow_zone() * 2); + if (FLAG_IS_DEFAULT(G1ConcRefinementRedZone)) { + FLAG_SET_DEFAULT(G1ConcRefinementRedZone, yellow_zone() * 2); } - set_red_zone(MAX2(G1ConcRefineRedZone, yellow_zone())); + set_red_zone(MAX2(G1ConcRefinementRedZone, yellow_zone())); _n_worker_threads = thread_num(); // We need one extra thread to do the young gen rset size sampling. _n_threads = _n_worker_threads + 1; @@ -76,15 +76,15 @@ } void ConcurrentG1Refine::reset_threshold_step() { - if (FLAG_IS_DEFAULT(G1ConcRefineThresholdStep)) { + if (FLAG_IS_DEFAULT(G1ConcRefinementThresholdStep)) { _thread_threshold_step = (yellow_zone() - green_zone()) / (worker_thread_num() + 1); } else { - _thread_threshold_step = G1ConcRefineThresholdStep; + _thread_threshold_step = G1ConcRefinementThresholdStep; } } int ConcurrentG1Refine::thread_num() { - return MAX2((G1ParallelRSetThreads > 0) ? G1ParallelRSetThreads : ParallelGCThreads, 1); + return MAX2((G1ConcRefinementThreads > 0) ? G1ConcRefinementThreads : ParallelGCThreads, 1); } void ConcurrentG1Refine::init() { @@ -300,7 +300,23 @@ int count; jbyte* cached_ptr = add_card_count(card_ptr, &count, defer); assert(cached_ptr != NULL, "bad cached card ptr"); - assert(!is_young_card(cached_ptr), "shouldn't get a card in young region"); + + if (is_young_card(cached_ptr)) { + // The region containing cached_ptr has been freed during a clean up + // pause, reallocated, and tagged as young. + assert(cached_ptr != card_ptr, "shouldn't be"); + + // We've just inserted a new old-gen card pointer into the card count + // cache and evicted the previous contents of that count slot. + // The evicted card pointer has been determined to be in a young region + // and so cannot be the newly inserted card pointer (that will be + // in an old region). + // The count for newly inserted card will be set to zero during the + // insertion, so we don't want to defer the cleaning of the newly + // inserted card pointer. + assert(*defer == false, "deferring non-hot card"); + return NULL; + } // The card pointer we obtained from card count cache is not hot // so do not store it in the cache; return it for immediate diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -39,7 +39,8 @@ * running. If the length becomes red (max queue length) the mutators start * processing the buffers. * - * There are some interesting cases (with G1AdaptiveConcRefine turned off): + * There are some interesting cases (when G1UseAdaptiveConcRefinement + * is turned off): * 1) green = yellow = red = 0. In this case the mutator will process all * buffers. Except for those that are created by the deferred updates * machinery during a collection. diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -107,7 +107,7 @@ if (_should_terminate) { break; } - _monitor->wait(Mutex::_no_safepoint_check_flag, G1ConcRefineServiceInterval); + _monitor->wait(Mutex::_no_safepoint_check_flag, G1ConcRefinementServiceIntervalMillis); } } @@ -127,7 +127,7 @@ void ConcurrentG1RefineThread::activate() { MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag); if (_worker_id > 0) { - if (G1TraceConcurrentRefinement) { + if (G1TraceConcRefinement) { DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); gclog_or_tty->print_cr("G1-Refine-activated worker %d, on threshold %d, current %d", _worker_id, _threshold, (int)dcqs.completed_buffers_num()); @@ -143,7 +143,7 @@ void ConcurrentG1RefineThread::deactivate() { MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag); if (_worker_id > 0) { - if (G1TraceConcurrentRefinement) { + if (G1TraceConcRefinement) { DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); gclog_or_tty->print_cr("G1-Refine-deactivated worker %d, off threshold %d, current %d", _worker_id, _deactivation_threshold, (int)dcqs.completed_buffers_num()); @@ -218,9 +218,13 @@ void ConcurrentG1RefineThread::yield() { - if (G1TraceConcurrentRefinement) gclog_or_tty->print_cr("G1-Refine-yield"); + if (G1TraceConcRefinement) { + gclog_or_tty->print_cr("G1-Refine-yield"); + } _sts.yield("G1 refine"); - if (G1TraceConcurrentRefinement) gclog_or_tty->print_cr("G1-Refine-yield-end"); + if (G1TraceConcRefinement) { + gclog_or_tty->print_cr("G1-Refine-yield-end"); + } } void ConcurrentG1RefineThread::stop() { @@ -241,7 +245,9 @@ Terminator_lock->wait(); } } - if (G1TraceConcurrentRefinement) gclog_or_tty->print_cr("G1-Refine-stop"); + if (G1TraceConcRefinement) { + gclog_or_tty->print_cr("G1-Refine-stop"); + } } void ConcurrentG1RefineThread::print() const { diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -447,7 +447,7 @@ gclog_or_tty->print_cr("[global] init, heap start = "PTR_FORMAT", " "heap end = "PTR_FORMAT, _heap_start, _heap_end); - _markStack.allocate(G1MarkStackSize); + _markStack.allocate(MarkStackSize); _regionStack.allocate(G1MarkRegionStackSize); // Create & start a ConcurrentMark thread. @@ -461,7 +461,7 @@ assert(_markBitMap2.covers(rs), "_markBitMap2 inconsistency"); SATBMarkQueueSet& satb_qs = JavaThread::satb_mark_queue_set(); - satb_qs.set_buffer_size(G1SATBLogBufferSize); + satb_qs.set_buffer_size(G1SATBBufferSize); int size = (int) MAX2(ParallelGCThreads, (size_t)1); _par_cleanup_thread_state = NEW_C_HEAP_ARRAY(ParCleanupThreadState*, size); @@ -483,8 +483,8 @@ _accum_task_vtime[i] = 0.0; } - if (ParallelMarkingThreads > ParallelGCThreads) { - vm_exit_during_initialization("Can't have more ParallelMarkingThreads " + if (ConcGCThreads > ParallelGCThreads) { + vm_exit_during_initialization("Can't have more ConcGCThreads " "than ParallelGCThreads."); } if (ParallelGCThreads == 0) { @@ -494,11 +494,11 @@ _sleep_factor = 0.0; _marking_task_overhead = 1.0; } else { - if (ParallelMarkingThreads > 0) { - // notice that ParallelMarkingThreads overwrites G1MarkingOverheadPercent + if (ConcGCThreads > 0) { + // notice that ConcGCThreads overwrites G1MarkingOverheadPercent // if both are set - _parallel_marking_threads = ParallelMarkingThreads; + _parallel_marking_threads = ConcGCThreads; _sleep_factor = 0.0; _marking_task_overhead = 1.0; } else if (G1MarkingOverheadPercent > 0) { diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -583,7 +583,7 @@ res->zero_fill_state() == HeapRegion::Allocated)), "Non-young alloc Regions must be zero filled (and non-H)"); - if (G1PrintRegions) { + if (G1PrintHeapRegions) { if (res != NULL) { gclog_or_tty->print_cr("new alloc region %d:["PTR_FORMAT", "PTR_FORMAT"], " "top "PTR_FORMAT, @@ -2477,7 +2477,7 @@ if (G1SummarizeRSetStats) { g1_rem_set()->print_summary_info(); } - if (G1SummarizeConcurrentMark) { + if (G1SummarizeConcMark) { concurrent_mark()->print_summary_info(); } if (G1SummarizeZFStats) { @@ -2505,6 +2505,7 @@ } void G1CollectedHeap::gc_prologue(bool full /* Ignored */) { + // always_do_update_barrier = false; assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer"); // Call allocation profiler AllocationProfiler::iterate_since_last_gc(); @@ -2518,6 +2519,7 @@ // is set. COMPILER2_PRESENT(assert(DerivedPointerTable::is_empty(), "derived pointer present")); + // always_do_update_barrier = true; } void G1CollectedHeap::do_collection_pause() { @@ -2644,6 +2646,13 @@ // +struct PrepareForRSScanningClosure : public HeapRegionClosure { + bool doHeapRegion(HeapRegion *r) { + r->rem_set()->set_iter_claimed(0); + return false; + } +}; + void G1CollectedHeap::do_collection_pause_at_safepoint() { if (PrintHeapAtGC) { @@ -2782,6 +2791,8 @@ gclog_or_tty->print_cr("\nAfter pause, heap:"); print(); #endif + PrepareForRSScanningClosure prepare_for_rs_scan; + collection_set_iterate(&prepare_for_rs_scan); setup_surviving_young_words(); @@ -3469,7 +3480,7 @@ HeapRegion* r = heap_region_containing(old); if (!r->evacuation_failed()) { r->set_evacuation_failed(true); - if (G1PrintRegions) { + if (G1PrintHeapRegions) { gclog_or_tty->print("evacuation failed in heap region "PTR_FORMAT" " "["PTR_FORMAT","PTR_FORMAT")\n", r, r->bottom(), r->end()); @@ -3779,22 +3790,16 @@ return obj; } -template +template template -void G1ParCopyClosure +void G1ParCopyClosure ::do_oop_work(T* p) { oop obj = oopDesc::load_decode_heap_oop(p); assert(barrier != G1BarrierRS || obj != NULL, "Precondition: G1BarrierRS implies obj is nonNull"); - // The only time we skip the cset test is when we're scanning - // references popped from the queue. And we only push on the queue - // references that we know point into the cset, so no point in - // checking again. But we'll leave an assert here for peace of mind. - assert(!skip_cset_test || _g1->obj_in_cs(obj), "invariant"); - // here the null check is implicit in the cset_fast_test() test - if (skip_cset_test || _g1->in_cset_fast_test(obj)) { + if (_g1->in_cset_fast_test(obj)) { #if G1_REM_SET_LOGGING gclog_or_tty->print_cr("Loc "PTR_FORMAT" contains pointer "PTR_FORMAT" " "into CS.", p, (void*) obj); @@ -3811,7 +3816,6 @@ } } - // When scanning moved objs, must look at all oops. if (barrier == G1BarrierEvac && obj != NULL) { _par_scan_state->update_rs(_from, p, _par_scan_state->queue_num()); } @@ -3821,8 +3825,8 @@ } } -template void G1ParCopyClosure::do_oop_work(oop* p); -template void G1ParCopyClosure::do_oop_work(narrowOop* p); +template void G1ParCopyClosure::do_oop_work(oop* p); +template void G1ParCopyClosure::do_oop_work(narrowOop* p); template void G1ParScanPartialArrayClosure::do_oop_nv(T* p) { assert(has_partial_array_mask(p), "invariant"); @@ -3894,11 +3898,11 @@ assert(UseCompressedOops, "Error"); narrowOop* p = (narrowOop*) stolen_task; assert(has_partial_array_mask(p) || - _g1h->obj_in_cs(oopDesc::load_decode_heap_oop(p)), "Error"); + _g1h->is_in_g1_reserved(oopDesc::load_decode_heap_oop(p)), "Error"); pss->push_on_queue(p); } else { oop* p = (oop*) stolen_task; - assert(has_partial_array_mask(p) || _g1h->obj_in_cs(*p), "Error"); + assert(has_partial_array_mask(p) || _g1h->is_in_g1_reserved(*p), "Error"); pss->push_on_queue(p); } continue; @@ -3960,6 +3964,7 @@ G1ParScanExtRootClosure only_scan_root_cl(_g1h, &pss); G1ParScanPermClosure only_scan_perm_cl(_g1h, &pss); G1ParScanHeapRSClosure only_scan_heap_rs_cl(_g1h, &pss); + G1ParPushHeapRSClosure push_heap_rs_cl(_g1h, &pss); G1ParScanAndMarkExtRootClosure scan_mark_root_cl(_g1h, &pss); G1ParScanAndMarkPermClosure scan_mark_perm_cl(_g1h, &pss); @@ -3983,7 +3988,7 @@ _g1h->g1_process_strong_roots(/* not collecting perm */ false, SharedHeap::SO_AllClasses, scan_root_cl, - &only_scan_heap_rs_cl, + &push_heap_rs_cl, scan_so_cl, scan_perm_cl, i); @@ -3997,9 +4002,7 @@ _g1h->g1_policy()->record_obj_copy_time(i, elapsed_ms-term_ms); _g1h->g1_policy()->record_termination_time(i, term_ms); } - if (G1UseSurvivorSpaces) { - _g1h->g1_policy()->record_thread_age_table(pss.age_table()); - } + _g1h->g1_policy()->record_thread_age_table(pss.age_table()); _g1h->update_surviving_young_words(pss.surviving_young_words()+1); // Clean up any par-expanded rem sets. diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -1623,7 +1623,7 @@ template void push_on_queue(T* ref) { assert(ref != NULL, "invariant"); assert(has_partial_array_mask(ref) || - _g1h->obj_in_cs(oopDesc::load_decode_heap_oop(ref)), "invariant"); + _g1h->is_in_g1_reserved(oopDesc::load_decode_heap_oop(ref)), "invariant"); #ifdef ASSERT if (has_partial_array_mask(ref)) { oop p = clear_partial_array_mask(ref); @@ -1644,9 +1644,9 @@ assert((oop*)ref != NULL, "pop_local() returned true"); assert(UseCompressedOops || !ref.is_narrow(), "Error"); assert(has_partial_array_mask((oop*)ref) || - _g1h->obj_in_cs(ref.is_narrow() ? oopDesc::load_decode_heap_oop((narrowOop*)ref) - : oopDesc::load_decode_heap_oop((oop*)ref)), - "invariant"); + _g1h->is_in_g1_reserved(ref.is_narrow() ? oopDesc::load_decode_heap_oop((narrowOop*)ref) + : oopDesc::load_decode_heap_oop((oop*)ref)), + "invariant"); IF_G1_DETAILED_STATS(note_pop()); } else { StarTask null_task; @@ -1659,9 +1659,9 @@ assert((oop*)new_ref != NULL, "pop() from a local non-empty stack"); assert(UseCompressedOops || !new_ref.is_narrow(), "Error"); assert(has_partial_array_mask((oop*)new_ref) || - _g1h->obj_in_cs(new_ref.is_narrow() ? oopDesc::load_decode_heap_oop((narrowOop*)new_ref) - : oopDesc::load_decode_heap_oop((oop*)new_ref)), - "invariant"); + _g1h->is_in_g1_reserved(new_ref.is_narrow() ? oopDesc::load_decode_heap_oop((narrowOop*)new_ref) + : oopDesc::load_decode_heap_oop((oop*)new_ref)), + "invariant"); ref = new_ref; } @@ -1825,12 +1825,12 @@ assert(UseCompressedOops, "Error"); narrowOop* p = (narrowOop*)ref_to_scan; assert(!has_partial_array_mask(p) && - _g1h->obj_in_cs(oopDesc::load_decode_heap_oop(p)), "sanity"); + _g1h->is_in_g1_reserved(oopDesc::load_decode_heap_oop(p)), "sanity"); deal_with_reference(p); } else { oop* p = (oop*)ref_to_scan; - assert((has_partial_array_mask(p) && _g1h->obj_in_cs(clear_partial_array_mask(p))) || - _g1h->obj_in_cs(oopDesc::load_decode_heap_oop(p)), "sanity"); + assert((has_partial_array_mask(p) && _g1h->is_in_g1_reserved(clear_partial_array_mask(p))) || + _g1h->is_in_g1_reserved(oopDesc::load_decode_heap_oop(p)), "sanity"); deal_with_reference(p); } } @@ -1844,12 +1844,12 @@ assert(UseCompressedOops, "Error"); narrowOop* p = (narrowOop*)ref_to_scan; assert(!has_partial_array_mask(p) && - _g1h->obj_in_cs(oopDesc::load_decode_heap_oop(p)), "sanity"); + _g1h->is_in_g1_reserved(oopDesc::load_decode_heap_oop(p)), "sanity"); deal_with_reference(p); } else { oop* p = (oop*)ref_to_scan; assert((has_partial_array_mask(p) && _g1h->obj_in_cs(clear_partial_array_mask(p))) || - _g1h->obj_in_cs(oopDesc::load_decode_heap_oop(p)), "sanity"); + _g1h->is_in_g1_reserved(oopDesc::load_decode_heap_oop(p)), "sanity"); deal_with_reference(p); } } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -205,6 +205,7 @@ // policy is created before the heap, we have to set this up here, // so it's done as soon as possible. HeapRegion::setup_heap_region_size(Arguments::min_heap_size()); + HeapRegionRemSet::setup_remset_size(); _recent_prev_end_times_for_all_gcs_sec->add(os::elapsedTime()); _prev_collection_pause_end_ms = os::elapsedTime() * 1000.0; @@ -269,14 +270,10 @@ _concurrent_mark_cleanup_times_ms->add(0.20); _tenuring_threshold = MaxTenuringThreshold; - if (G1UseSurvivorSpaces) { - // if G1FixedSurvivorSpaceSize is 0 which means the size is not - // fixed, then _max_survivor_regions will be calculated at - // calculate_young_list_target_config during initialization - _max_survivor_regions = G1FixedSurvivorSpaceSize / HeapRegion::GrainBytes; - } else { - _max_survivor_regions = 0; - } + // if G1FixedSurvivorSpaceSize is 0 which means the size is not + // fixed, then _max_survivor_regions will be calculated at + // calculate_young_list_target_config during initialization + _max_survivor_regions = G1FixedSurvivorSpaceSize / HeapRegion::GrainBytes; initialize_all(); } @@ -295,28 +292,54 @@ CollectorPolicy::initialize_flags(); } +// The easiest way to deal with the parsing of the NewSize / +// MaxNewSize / etc. parameteres is to re-use the code in the +// TwoGenerationCollectorPolicy class. This is similar to what +// ParallelScavenge does with its GenerationSizer class (see +// ParallelScavengeHeap::initialize()). We might change this in the +// future, but it's a good start. +class G1YoungGenSizer : public TwoGenerationCollectorPolicy { + size_t size_to_region_num(size_t byte_size) { + return MAX2((size_t) 1, byte_size / HeapRegion::GrainBytes); + } + +public: + G1YoungGenSizer() { + initialize_flags(); + initialize_size_info(); + } + + size_t min_young_region_num() { + return size_to_region_num(_min_gen0_size); + } + size_t initial_young_region_num() { + return size_to_region_num(_initial_gen0_size); + } + size_t max_young_region_num() { + return size_to_region_num(_max_gen0_size); + } +}; + void G1CollectorPolicy::init() { // Set aside an initial future to_space. _g1 = G1CollectedHeap::heap(); - size_t regions = Universe::heap()->capacity() / HeapRegion::GrainBytes; assert(Heap_lock->owned_by_self(), "Locking discipline."); - if (G1SteadyStateUsed < 50) { - vm_exit_during_initialization("G1SteadyStateUsed must be at least 50%."); - } - initialize_gc_policy_counters(); if (G1Gen) { _in_young_gc_mode = true; - if (G1YoungGenSize == 0) { + G1YoungGenSizer sizer; + size_t initial_region_num = sizer.initial_young_region_num(); + + if (UseAdaptiveSizePolicy) { set_adaptive_young_list_length(true); _young_list_fixed_length = 0; } else { set_adaptive_young_list_length(false); - _young_list_fixed_length = (G1YoungGenSize / HeapRegion::GrainBytes); + _young_list_fixed_length = initial_region_num; } _free_regions_at_end_of_collection = _g1->free_regions(); _scan_only_regions_at_end_of_collection = 0; @@ -454,7 +477,7 @@ guarantee( adaptive_young_list_length(), "pre-condition" ); double start_time_sec = os::elapsedTime(); - size_t min_reserve_perc = MAX2((size_t)2, (size_t)G1MinReservePercent); + size_t min_reserve_perc = MAX2((size_t)2, (size_t)G1ReservePercent); min_reserve_perc = MIN2((size_t) 50, min_reserve_perc); size_t reserve_regions = (size_t) ((double) min_reserve_perc * (double) _g1->n_regions() / 100.0); @@ -1109,10 +1132,7 @@ size_t short_lived_so_length = _young_list_so_prefix_length; _short_lived_surv_rate_group->record_scan_only_prefix(short_lived_so_length); tag_scan_only(short_lived_so_length); - - if (G1UseSurvivorSpaces) { - _survivors_age_table.clear(); - } + _survivors_age_table.clear(); assert( verify_young_ages(), "region age verification" ); } @@ -1431,7 +1451,7 @@ record_concurrent_mark_init_end_pre(0.0); size_t min_used_targ = - (_g1->capacity() / 100) * (G1SteadyStateUsed - G1SteadyStateUsedDelta); + (_g1->capacity() / 100) * InitiatingHeapOccupancyPercent; if (cur_used_bytes > min_used_targ) { if (cur_used_bytes <= _prev_collection_pause_used_at_end_bytes) { @@ -1915,7 +1935,7 @@ calculate_young_list_target_config(); // Note that _mmu_tracker->max_gc_time() returns the time in seconds. - double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSUpdatePauseFractionPercent / 100.0; + double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0; adjust_concurrent_refinement(update_rs_time, update_rs_processed_buffers, update_rs_time_goal_ms); // @@ -1931,7 +1951,7 @@ DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); ConcurrentG1Refine *cg1r = G1CollectedHeap::heap()->concurrent_g1_refine(); - if (G1AdaptiveConcRefine) { + if (G1UseAdaptiveConcRefinement) { const int k_gy = 3, k_gr = 6; const double inc_k = 1.1, dec_k = 0.9; @@ -2606,9 +2626,6 @@ // Calculates survivor space parameters. void G1CollectorPolicy::calculate_survivors_policy() { - if (!G1UseSurvivorSpaces) { - return; - } if (G1FixedSurvivorSpaceSize == 0) { _max_survivor_regions = _young_list_target_length / SurvivorRatio; } else { @@ -2627,13 +2644,6 @@ G1CollectorPolicy_BestRegionsFirst::should_do_collection_pause(size_t word_size) { assert(_g1->regions_accounted_for(), "Region leakage!"); - // Initiate a pause when we reach the steady-state "used" target. - size_t used_hard = (_g1->capacity() / 100) * G1SteadyStateUsed; - size_t used_soft = - MAX2((_g1->capacity() / 100) * (G1SteadyStateUsed - G1SteadyStateUsedDelta), - used_hard/2); - size_t used = _g1->used(); - double max_pause_time_ms = _mmu_tracker->max_gc_time() * 1000.0; size_t young_list_length = _g1->young_list_length(); @@ -2866,7 +2876,7 @@ // estimate of the number of live bytes. void G1CollectorPolicy:: add_to_collection_set(HeapRegion* hr) { - if (G1PrintRegions) { + if (G1PrintHeapRegions) { gclog_or_tty->print_cr("added region to cset %d:["PTR_FORMAT", "PTR_FORMAT"], " "top "PTR_FORMAT", young %s", hr->hrs_index(), hr->bottom(), hr->end(), diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/g1MMUTracker.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1MMUTracker.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MMUTracker.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -88,13 +88,13 @@ // the time slice than what's allowed) // consolidate the two entries with the minimum gap between them // (this might allow less GC time than what's allowed) - guarantee(NOT_PRODUCT(ScavengeALot ||) G1ForgetfulMMUTracker, - "array full, currently we can't recover unless +G1ForgetfulMMUTracker"); + guarantee(NOT_PRODUCT(ScavengeALot ||) G1UseFixedWindowMMUTracker, + "array full, currently we can't recover unless +G1UseFixedWindowMMUTracker"); // In the case where ScavengeALot is true, such overflow is not // uncommon; in such cases, we can, without much loss of precision // or performance (we are GC'ing most of the time anyway!), // simply overwrite the oldest entry in the tracker: this - // is also the behaviour when G1ForgetfulMMUTracker is enabled. + // is also the behaviour when G1UseFixedWindowMMUTracker is enabled. _head_index = trim_index(_head_index + 1); assert(_head_index == _tail_index, "Because we have a full circular buffer"); _tail_index = trim_index(_tail_index + 1); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/g1MMUTracker.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1MMUTracker.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MMUTracker.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -101,7 +101,7 @@ // If the array is full, an easy fix is to look for the pauses with // the shortest gap between them and consolidate them. // For now, we have taken the expedient alternative of forgetting - // the oldest entry in the event that +G1ForgetfulMMUTracker, thus + // the oldest entry in the event that +G1UseFixedWindowMMUTracker, thus // potentially violating MMU specs for some time thereafter. G1MMUTrackerQueueElem _array[QueueLength]; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -53,6 +53,15 @@ bool apply_to_weak_ref_discovered_field() { return true; } }; +class G1ParPushHeapRSClosure : public G1ParClosureSuper { +public: + G1ParPushHeapRSClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) : + G1ParClosureSuper(g1, par_scan_state) { } + template void do_oop_nv(T* p); + virtual void do_oop(oop* p) { do_oop_nv(p); } + virtual void do_oop(narrowOop* p) { do_oop_nv(p); } +}; + class G1ParScanClosure : public G1ParClosureSuper { public: G1ParScanClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) : @@ -100,7 +109,7 @@ }; template + bool do_mark_forwardee> class G1ParCopyClosure : public G1ParCopyHelper { G1ParScanClosure _scanner; template void do_oop_work(T* p); @@ -116,12 +125,13 @@ virtual void do_oop(narrowOop* p) { do_oop_nv(p); } }; -typedef G1ParCopyClosure G1ParScanExtRootClosure; -typedef G1ParCopyClosure G1ParScanPermClosure; -typedef G1ParCopyClosure G1ParScanHeapRSClosure; -typedef G1ParCopyClosure G1ParScanAndMarkExtRootClosure; -typedef G1ParCopyClosure G1ParScanAndMarkPermClosure; -typedef G1ParCopyClosure G1ParScanAndMarkHeapRSClosure; +typedef G1ParCopyClosure G1ParScanExtRootClosure; +typedef G1ParCopyClosure G1ParScanPermClosure; +typedef G1ParCopyClosure G1ParScanHeapRSClosure; +typedef G1ParCopyClosure G1ParScanAndMarkExtRootClosure; +typedef G1ParCopyClosure G1ParScanAndMarkPermClosure; +typedef G1ParCopyClosure G1ParScanAndMarkHeapRSClosure; + // This is the only case when we set skip_cset_test. Basically, this // closure is (should?) only be called directly while we're draining // the overflow and task queues. In that case we know that the @@ -132,7 +142,7 @@ // We need a separate closure to handle references during evacuation // failure processing, as we cannot asume that the reference already // points into the collection set (like G1ParScanHeapEvacClosure does). -typedef G1ParCopyClosure G1ParScanHeapEvacFailureClosure; +typedef G1ParCopyClosure G1ParScanHeapEvacFailureClosure; class FilterIntoCSClosure: public OopClosure { G1CollectedHeap* _g1; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -104,3 +104,16 @@ } } } + +template inline void G1ParPushHeapRSClosure::do_oop_nv(T* p) { + T heap_oop = oopDesc::load_heap_oop(p); + + if (!oopDesc::is_null(heap_oop)) { + oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); + if (_g1->in_cset_fast_test(obj)) { + Prefetch::write(obj->mark_addr(), 0); + Prefetch::read(obj->mark_addr(), (HeapWordSize*2)); + _par_scan_state->push_on_queue(p); + } + } +} diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -155,8 +155,8 @@ G1BlockOffsetSharedArray* _bot_shared; CardTableModRefBS *_ct_bs; int _worker_i; + int _block_size; bool _try_claimed; - size_t _min_skip_distance, _max_skip_distance; public: ScanRSClosure(OopsInHeapRegionClosure* oc, int worker_i) : _oc(oc), @@ -168,8 +168,7 @@ _g1h = G1CollectedHeap::heap(); _bot_shared = _g1h->bot_shared(); _ct_bs = (CardTableModRefBS*) (_g1h->barrier_set()); - _min_skip_distance = 16; - _max_skip_distance = 2 * _g1h->n_par_threads() * _min_skip_distance; + _block_size = MAX2(G1RSetScanBlockSize, 1); } void set_try_claimed() { _try_claimed = true; } @@ -225,12 +224,15 @@ HeapRegionRemSetIterator* iter = _g1h->rem_set_iterator(_worker_i); hrrs->init_iterator(iter); size_t card_index; - size_t skip_distance = 0, current_card = 0, jump_to_card = 0; - while (iter->has_next(card_index)) { - if (current_card < jump_to_card) { - ++current_card; - continue; + + // We claim cards in block so as to recude the contention. The block size is determined by + // the G1RSetScanBlockSize parameter. + size_t jump_to_card = hrrs->iter_claimed_next(_block_size); + for (size_t current_card = 0; iter->has_next(card_index); current_card++) { + if (current_card >= jump_to_card + _block_size) { + jump_to_card = hrrs->iter_claimed_next(_block_size); } + if (current_card < jump_to_card) continue; HeapWord* card_start = _g1h->bot_shared()->address_for_index(card_index); #if 0 gclog_or_tty->print("Rem set iteration yielded card [" PTR_FORMAT ", " PTR_FORMAT ").\n", @@ -247,22 +249,14 @@ // If the card is dirty, then we will scan it during updateRS. if (!card_region->in_collection_set() && !_ct_bs->is_card_dirty(card_index)) { - if (!_ct_bs->is_card_claimed(card_index) && _ct_bs->claim_card(card_index)) { - scanCard(card_index, card_region); - } else if (_try_claimed) { - if (jump_to_card == 0 || jump_to_card != current_card) { - // We did some useful work in the previous iteration. - // Decrease the distance. - skip_distance = MAX2(skip_distance >> 1, _min_skip_distance); - } else { - // Previous iteration resulted in a claim failure. - // Increase the distance. - skip_distance = MIN2(skip_distance << 1, _max_skip_distance); - } - jump_to_card = current_card + skip_distance; - } + // We make the card as "claimed" lazily (so races are possible but they're benign), + // which reduces the number of duplicate scans (the rsets of the regions in the cset + // can intersect). + if (!_ct_bs->is_card_claimed(card_index)) { + _ct_bs->set_card_claimed(card_index); + scanCard(card_index, card_region); + } } - ++current_card; } if (!_try_claimed) { hrrs->set_iter_complete(); @@ -299,30 +293,18 @@ double rs_time_start = os::elapsedTime(); HeapRegion *startRegion = calculateStartRegion(worker_i); - BufferingOopsInHeapRegionClosure boc(oc); - ScanRSClosure scanRScl(&boc, worker_i); + ScanRSClosure scanRScl(oc, worker_i); _g1->collection_set_iterate_from(startRegion, &scanRScl); scanRScl.set_try_claimed(); _g1->collection_set_iterate_from(startRegion, &scanRScl); - boc.done(); - double closure_app_time_sec = boc.closure_app_seconds(); - double scan_rs_time_sec = (os::elapsedTime() - rs_time_start) - - closure_app_time_sec; - double closure_app_time_ms = closure_app_time_sec * 1000.0; + double scan_rs_time_sec = os::elapsedTime() - rs_time_start; assert( _cards_scanned != NULL, "invariant" ); _cards_scanned[worker_i] = scanRScl.cards_done(); _g1p->record_scan_rs_start_time(worker_i, rs_time_start * 1000.0); _g1p->record_scan_rs_time(worker_i, scan_rs_time_sec * 1000.0); - - double scan_new_refs_time_ms = _g1p->get_scan_new_refs_time(worker_i); - if (scan_new_refs_time_ms > 0.0) { - closure_app_time_ms += scan_new_refs_time_ms; - } - - _g1p->record_obj_copy_time(worker_i, closure_app_time_ms); } void HRInto_G1RemSet::updateRS(int worker_i) { @@ -449,9 +431,8 @@ oc->do_oop(p); } } - _g1p->record_scan_new_refs_time(worker_i, - (os::elapsedTime() - scan_new_refs_start_sec) - * 1000.0); + double scan_new_refs_time_ms = (os::elapsedTime() - scan_new_refs_start_sec) * 1000.0; + _g1p->record_scan_new_refs_time(worker_i, scan_new_refs_time_ms); } void HRInto_G1RemSet::cleanupHRRS() { @@ -486,7 +467,7 @@ // and they are causing failures. When we resolve said race // conditions, we'll revert back to parallel remembered set // updating and scanning. See CRs 6677707 and 6677708. - if (G1ParallelRSetUpdatingEnabled || (worker_i == 0)) { + if (G1UseParallelRSetUpdating || (worker_i == 0)) { updateRS(worker_i); scanNewRefsRS(oc, worker_i); } else { @@ -495,7 +476,7 @@ _g1p->record_update_rs_time(worker_i, 0.0); _g1p->record_scan_new_refs_time(worker_i, 0.0); } - if (G1ParallelRSetScanningEnabled || (worker_i == 0)) { + if (G1UseParallelRSetScanning || (worker_i == 0)) { scanRS(oc, worker_i); } else { _g1p->record_scan_rs_start_time(worker_i, os::elapsedTime() * 1000.0); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -37,9 +37,6 @@ develop(intx, G1MarkingOverheadPercent, 0, \ "Overhead of concurrent marking") \ \ - product(uintx, G1YoungGenSize, 0, \ - "Size of the G1 young generation, 0 is the adaptive policy") \ - \ develop(bool, G1Gen, true, \ "If true, it will enable the generational G1") \ \ @@ -70,7 +67,7 @@ develop(intx, G1PausesBtwnConcMark, -1, \ "If positive, fixed number of pauses between conc markings") \ \ - diagnostic(bool, G1SummarizeConcurrentMark, false, \ + diagnostic(bool, G1SummarizeConcMark, false, \ "Summarize concurrent mark info") \ \ diagnostic(bool, G1SummarizeRSetStats, false, \ @@ -85,12 +82,9 @@ diagnostic(bool, G1SummarizeZFStats, false, \ "Summarize zero-filling info") \ \ - diagnostic(bool, G1TraceConcurrentRefinement, false, \ + diagnostic(bool, G1TraceConcRefinement, false, \ "Trace G1 concurrent refinement") \ \ - product(intx, G1MarkStackSize, 2 * 1024 * 1024, \ - "Size of the mark stack for concurrent marking.") \ - \ product(intx, G1MarkRegionStackSize, 1024 * 1024, \ "Size of the region stack for concurrent marking.") \ \ @@ -100,20 +94,13 @@ develop(intx, G1ConcZFMaxRegions, 1, \ "Stop zero-filling when # of zf'd regions reaches") \ \ - product(intx, G1SteadyStateUsed, 90, \ - "If non-0, try to maintain 'used' at this pct (of max)") \ - \ - product(intx, G1SteadyStateUsedDelta, 30, \ - "If G1SteadyStateUsed is non-0, then do pause this number of " \ - "of percentage points earlier if no marking is in progress.") \ - \ develop(bool, G1SATBBarrierPrintNullPreVals, false, \ "If true, count frac of ptr writes with null pre-vals.") \ \ - product(intx, G1SATBLogBufferSize, 1*K, \ + product(intx, G1SATBBufferSize, 1*K, \ "Number of entries in an SATB log buffer.") \ \ - product(intx, G1SATBProcessCompletedThreshold, 20, \ + develop(intx, G1SATBProcessCompletedThreshold, 20, \ "Number of completed buffers that triggers log processing.") \ \ develop(intx, G1ExtraRegionSurvRate, 33, \ @@ -127,7 +114,7 @@ develop(bool, G1SATBPrintStubs, false, \ "If true, print generated stubs for the SATB barrier") \ \ - product(intx, G1ExpandByPercentOfAvailable, 20, \ + experimental(intx, G1ExpandByPercentOfAvailable, 20, \ "When expanding, % of uncommitted space to claim.") \ \ develop(bool, G1RSBarrierRegionFilter, true, \ @@ -165,36 +152,36 @@ product(intx, G1UpdateBufferSize, 256, \ "Size of an update buffer") \ \ - product(intx, G1ConcRefineYellowZone, 0, \ + product(intx, G1ConcRefinementYellowZone, 0, \ "Number of enqueued update buffers that will " \ "trigger concurrent processing. Will be selected ergonomically " \ "by default.") \ \ - product(intx, G1ConcRefineRedZone, 0, \ + product(intx, G1ConcRefinementRedZone, 0, \ "Maximum number of enqueued update buffers before mutator " \ "threads start processing new ones instead of enqueueing them. " \ "Will be selected ergonomically by default. Zero will disable " \ "concurrent processing.") \ \ - product(intx, G1ConcRefineGreenZone, 0, \ + product(intx, G1ConcRefinementGreenZone, 0, \ "The number of update buffers that are left in the queue by the " \ "concurrent processing threads. Will be selected ergonomically " \ "by default.") \ \ - product(intx, G1ConcRefineServiceInterval, 300, \ + product(intx, G1ConcRefinementServiceIntervalMillis, 300, \ "The last concurrent refinement thread wakes up every " \ "specified number of milliseconds to do miscellaneous work.") \ \ - product(intx, G1ConcRefineThresholdStep, 0, \ + product(intx, G1ConcRefinementThresholdStep, 0, \ "Each time the rset update queue increases by this amount " \ "activate the next refinement thread if available. " \ "Will be selected ergonomically by default.") \ \ - product(intx, G1RSUpdatePauseFractionPercent, 10, \ + product(intx, G1RSetUpdatingPauseTimePercent, 10, \ "A target percentage of time that is allowed to be spend on " \ "process RS update buffers during the collection pause.") \ \ - product(bool, G1AdaptiveConcRefine, true, \ + product(bool, G1UseAdaptiveConcRefinement, true, \ "Select green, yellow and red zones adaptively to meet the " \ "the pause requirements.") \ \ @@ -207,8 +194,20 @@ develop(bool, G1PrintOopAppls, false, \ "When true, print applications of closures to external locs.") \ \ - develop(intx, G1LogRSRegionEntries, 7, \ - "Log_2 of max number of regions for which we keep bitmaps.") \ + develop(intx, G1RSetRegionEntriesBase, 256, \ + "Max number of regions in a fine-grain table per MB.") \ + \ + product(intx, G1RSetRegionEntries, 0, \ + "Max number of regions for which we keep bitmaps." \ + "Will be set ergonomically by default") \ + \ + develop(intx, G1RSetSparseRegionEntriesBase, 4, \ + "Max number of entries per region in a sparse table " \ + "per MB.") \ + \ + product(intx, G1RSetSparseRegionEntries, 0, \ + "Max number of entries per region in a sparse table." \ + "Will be set ergonomically by default.") \ \ develop(bool, G1RecordHRRSOops, false, \ "When true, record recent calls to rem set operations.") \ @@ -233,15 +232,15 @@ "the number of regions for which we'll print a surv rate " \ "summary.") \ \ - product(bool, G1UseScanOnlyPrefix, false, \ + develop(bool, G1UseScanOnlyPrefix, false, \ "It determines whether the system will calculate an optimum " \ "scan-only set.") \ \ - product(intx, G1MinReservePercent, 10, \ + product(intx, G1ReservePercent, 10, \ "It determines the minimum reserve we should have in the heap " \ "to minimize the probability of promotion failure.") \ \ - diagnostic(bool, G1PrintRegions, false, \ + diagnostic(bool, G1PrintHeapRegions, false, \ "If set G1 will print information on which regions are being " \ "allocated and which are reclaimed.") \ \ @@ -251,9 +250,6 @@ develop(bool, G1HRRSFlushLogBuffersOnVerify, false, \ "Forces flushing of log buffers before verification.") \ \ - product(bool, G1UseSurvivorSpaces, true, \ - "When true, use survivor space.") \ - \ develop(bool, G1FailOnFPError, false, \ "When set, G1 will fail when it encounters an FP 'error', " \ "so as to allow debugging") \ @@ -268,21 +264,21 @@ "If non-0 is the size of the G1 survivor space, " \ "otherwise SurvivorRatio is used to determine the size") \ \ - product(bool, G1ForgetfulMMUTracker, false, \ + product(bool, G1UseFixedWindowMMUTracker, false, \ "If the MMU tracker's memory is full, forget the oldest entry") \ \ product(uintx, G1HeapRegionSize, 0, \ "Size of the G1 regions.") \ \ - experimental(bool, G1ParallelRSetUpdatingEnabled, false, \ + experimental(bool, G1UseParallelRSetUpdating, false, \ "Enables the parallelization of remembered set updating " \ "during evacuation pauses") \ \ - experimental(bool, G1ParallelRSetScanningEnabled, false, \ + experimental(bool, G1UseParallelRSetScanning, false, \ "Enables the parallelization of remembered set scanning " \ "during evacuation pauses") \ \ - product(uintx, G1ParallelRSetThreads, 0, \ + product(uintx, G1ConcRefinementThreads, 0, \ "If non-0 is the number of parallel rem set update threads, " \ "otherwise the value is determined ergonomically.") \ \ @@ -293,6 +289,10 @@ develop(bool, G1VerifyCTCleanup, false, \ "Verify card table cleanup.") \ \ + product(uintx, G1RSetScanBlockSize, 64, \ + "Size of a work unit of cards claimed by a worker thread" \ + "during RSet scanning.") \ + \ develop(bool, ReduceInitialCardMarksForG1, false, \ "When ReduceInitialCardMarks is true, this flag setting " \ " controls whether G1 allows the RICM optimization") diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -33,11 +33,12 @@ }; template + bool do_mark_forwardee> class G1ParCopyClosure; class G1ParScanClosure; +class G1ParPushHeapRSClosure; -typedef G1ParCopyClosure G1ParScanHeapEvacClosure; +typedef G1ParCopyClosure G1ParScanHeapEvacClosure; class FilterIntoCSClosure; class FilterOutOfRegionClosure; @@ -51,6 +52,7 @@ #define FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES(f) \ f(G1ParScanHeapEvacClosure,_nv) \ f(G1ParScanClosure,_nv) \ + f(G1ParPushHeapRSClosure,_nv) \ f(FilterIntoCSClosure,_nv) \ f(FilterOutOfRegionClosure,_nv) \ f(FilterInHeapRegionAndIntoCSClosure,_nv) \ diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -258,42 +258,6 @@ ReserveParTableExpansion = 1 }; - void par_expand() { - int n = HeapRegionRemSet::num_par_rem_sets()-1; - if (n <= 0) return; - if (_par_tables == NULL) { - PerRegionTable* res = - (PerRegionTable*) - Atomic::cmpxchg_ptr((PerRegionTable*)ReserveParTableExpansion, - &_par_tables, NULL); - if (res != NULL) return; - // Otherwise, we reserved the right to do the expansion. - - PerRegionTable** ptables = NEW_C_HEAP_ARRAY(PerRegionTable*, n); - for (int i = 0; i < n; i++) { - PerRegionTable* ptable = PerRegionTable::alloc(hr()); - ptables[i] = ptable; - } - // Here we do not need an atomic. - _par_tables = ptables; -#if COUNT_PAR_EXPANDS - print_par_expand(); -#endif - // We must put this table on the expanded list. - PosParPRT* exp_head = _par_expanded_list; - while (true) { - set_next_par_expanded(exp_head); - PosParPRT* res = - (PosParPRT*) - Atomic::cmpxchg_ptr(this, &_par_expanded_list, exp_head); - if (res == exp_head) return; - // Otherwise. - exp_head = res; - } - ShouldNotReachHere(); - } - } - void par_contract() { assert(_par_tables != NULL, "Precondition."); int n = HeapRegionRemSet::num_par_rem_sets()-1; @@ -391,13 +355,49 @@ void set_next(PosParPRT* nxt) { _next = nxt; } PosParPRT** next_addr() { return &_next; } + bool should_expand(int tid) { + return par_tables() == NULL && tid > 0 && hr()->is_gc_alloc_region(); + } + + void par_expand() { + int n = HeapRegionRemSet::num_par_rem_sets()-1; + if (n <= 0) return; + if (_par_tables == NULL) { + PerRegionTable* res = + (PerRegionTable*) + Atomic::cmpxchg_ptr((PerRegionTable*)ReserveParTableExpansion, + &_par_tables, NULL); + if (res != NULL) return; + // Otherwise, we reserved the right to do the expansion. + + PerRegionTable** ptables = NEW_C_HEAP_ARRAY(PerRegionTable*, n); + for (int i = 0; i < n; i++) { + PerRegionTable* ptable = PerRegionTable::alloc(hr()); + ptables[i] = ptable; + } + // Here we do not need an atomic. + _par_tables = ptables; +#if COUNT_PAR_EXPANDS + print_par_expand(); +#endif + // We must put this table on the expanded list. + PosParPRT* exp_head = _par_expanded_list; + while (true) { + set_next_par_expanded(exp_head); + PosParPRT* res = + (PosParPRT*) + Atomic::cmpxchg_ptr(this, &_par_expanded_list, exp_head); + if (res == exp_head) return; + // Otherwise. + exp_head = res; + } + ShouldNotReachHere(); + } + } + void add_reference(OopOrNarrowOopStar from, int tid) { // Expand if necessary. PerRegionTable** pt = par_tables(); - if (par_tables() == NULL && tid > 0 && hr()->is_gc_alloc_region()) { - par_expand(); - pt = par_tables(); - } if (pt != NULL) { // We always have to assume that mods to table 0 are in parallel, // because of the claiming scheme in parallel expansion. A thread @@ -505,12 +505,13 @@ typedef PosParPRT* PosParPRTPtr; if (_max_fine_entries == 0) { assert(_mod_max_fine_entries_mask == 0, "Both or none."); - _max_fine_entries = (size_t)(1 << G1LogRSRegionEntries); + size_t max_entries_log = (size_t)log2_long((jlong)G1RSetRegionEntries); + _max_fine_entries = (size_t)(1 << max_entries_log); _mod_max_fine_entries_mask = _max_fine_entries - 1; #if SAMPLE_FOR_EVICTION assert(_fine_eviction_sample_size == 0 && _fine_eviction_stride == 0, "All init at same time."); - _fine_eviction_sample_size = MAX2((size_t)4, (size_t)G1LogRSRegionEntries); + _fine_eviction_sample_size = MAX2((size_t)4, max_entries_log); _fine_eviction_stride = _max_fine_entries / _fine_eviction_sample_size; #endif } @@ -655,13 +656,6 @@ #endif } - // Otherwise, transfer from sparse to fine-grain. - CardIdx_t cards[SparsePRTEntry::CardsPerEntry]; - if (G1HRRSUseSparseTable) { - bool res = _sparse_table.get_cards(from_hrs_ind, &cards[0]); - assert(res, "There should have been an entry"); - } - if (_n_fine_entries == _max_fine_entries) { prt = delete_region_table(); } else { @@ -676,10 +670,12 @@ _fine_grain_regions[ind] = prt; _n_fine_entries++; - // Add in the cards from the sparse table. if (G1HRRSUseSparseTable) { - for (int i = 0; i < SparsePRTEntry::CardsPerEntry; i++) { - CardIdx_t c = cards[i]; + // Transfer from sparse to fine-grain. + SparsePRTEntry *sprt_entry = _sparse_table.get_entry(from_hrs_ind); + assert(sprt_entry != NULL, "There should have been an entry"); + for (int i = 0; i < SparsePRTEntry::cards_num(); i++) { + CardIdx_t c = sprt_entry->card(i); if (c != SparsePRTEntry::NullEntry) { prt->add_card(c); } @@ -696,7 +692,21 @@ // OtherRegionsTable for why this is OK. assert(prt != NULL, "Inv"); - prt->add_reference(from, tid); + if (prt->should_expand(tid)) { + MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag); + HeapRegion* prt_hr = prt->hr(); + if (prt_hr == from_hr) { + // Make sure the table still corresponds to the same region + prt->par_expand(); + prt->add_reference(from, tid); + } + // else: The table has been concurrently coarsened, evicted, and + // the table data structure re-used for another table. So, we + // don't need to add the reference any more given that the table + // has been coarsened and the whole region will be scanned anyway. + } else { + prt->add_reference(from, tid); + } if (G1RecordHRRSOops) { HeapRegionRemSet::record(hr(), from); #if HRRS_VERBOSE @@ -1070,6 +1080,19 @@ {} +void HeapRegionRemSet::setup_remset_size() { + // Setup sparse and fine-grain tables sizes. + // table_size = base * (log(region_size / 1M) + 1) + int region_size_log_mb = MAX2((int)HeapRegion::LogOfHRGrainBytes - (int)LOG_M, 0); + if (FLAG_IS_DEFAULT(G1RSetSparseRegionEntries)) { + G1RSetSparseRegionEntries = G1RSetSparseRegionEntriesBase * (region_size_log_mb + 1); + } + if (FLAG_IS_DEFAULT(G1RSetRegionEntries)) { + G1RSetRegionEntries = G1RSetRegionEntriesBase * (region_size_log_mb + 1); + } + guarantee(G1RSetSparseRegionEntries > 0 && G1RSetRegionEntries > 0 , "Sanity"); +} + void HeapRegionRemSet::init_for_par_iteration() { _iter_state = Unclaimed; } @@ -1385,7 +1408,7 @@ os::sleep(Thread::current(), (jlong)5000, false); G1CollectedHeap* g1h = G1CollectedHeap::heap(); - // Run with "-XX:G1LogRSRegionEntries=2", so that 1 and 5 end up in same + // Run with "-XX:G1LogRSetRegionEntries=2", so that 1 and 5 end up in same // hash bucket. HeapRegion* hr0 = g1h->region_at(0); HeapRegion* hr1 = g1h->region_at(1); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -187,7 +187,8 @@ void clear_outgoing_entries(); enum ParIterState { Unclaimed, Claimed, Complete }; - ParIterState _iter_state; + volatile ParIterState _iter_state; + volatile jlong _iter_claimed; // Unused unless G1RecordHRRSOops is true. @@ -209,6 +210,7 @@ HeapRegion* hr); static int num_par_rem_sets(); + static void setup_remset_size(); HeapRegion* hr() const { return _other_regions.hr(); @@ -272,6 +274,19 @@ // Returns "true" iff the region's iteration is complete. bool iter_is_complete(); + // Support for claiming blocks of cards during iteration + void set_iter_claimed(size_t x) { _iter_claimed = (jlong)x; } + size_t iter_claimed() const { return (size_t)_iter_claimed; } + // Claim the next block of cards + size_t iter_claimed_next(size_t step) { + size_t current, next; + do { + current = iter_claimed(); + next = current + step; + } while (Atomic::cmpxchg((jlong)next, &_iter_claimed, (jlong)current) != (jlong)current); + return current; + } + // Initialize the given iterator to iterate over this rem set. void init_iterator(HeapRegionRemSetIterator* iter) const; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -27,7 +27,7 @@ #define SPARSE_PRT_VERBOSE 0 -#define UNROLL_CARD_LOOPS 1 +#define UNROLL_CARD_LOOPS 1 void SparsePRT::init_iterator(SparsePRTIter* sprt_iter) { sprt_iter->init(this); @@ -36,27 +36,32 @@ void SparsePRTEntry::init(RegionIdx_t region_ind) { _region_ind = region_ind; _next_index = NullEntry; + #if UNROLL_CARD_LOOPS - assert(CardsPerEntry == 4, "Assumption. If changes, un-unroll."); - _cards[0] = NullEntry; - _cards[1] = NullEntry; - _cards[2] = NullEntry; - _cards[3] = NullEntry; + assert((cards_num() & (UnrollFactor - 1)) == 0, "Invalid number of cards in the entry"); + for (int i = 0; i < cards_num(); i += UnrollFactor) { + _cards[i] = NullEntry; + _cards[i + 1] = NullEntry; + _cards[i + 2] = NullEntry; + _cards[i + 3] = NullEntry; + } #else - for (int i = 0; i < CardsPerEntry; i++) + for (int i = 0; i < cards_num(); i++) _cards[i] = NullEntry; #endif } bool SparsePRTEntry::contains_card(CardIdx_t card_index) const { #if UNROLL_CARD_LOOPS - assert(CardsPerEntry == 4, "Assumption. If changes, un-unroll."); - if (_cards[0] == card_index) return true; - if (_cards[1] == card_index) return true; - if (_cards[2] == card_index) return true; - if (_cards[3] == card_index) return true; + assert((cards_num() & (UnrollFactor - 1)) == 0, "Invalid number of cards in the entry"); + for (int i = 0; i < cards_num(); i += UnrollFactor) { + if (_cards[i] == card_index || + _cards[i + 1] == card_index || + _cards[i + 2] == card_index || + _cards[i + 3] == card_index) return true; + } #else - for (int i = 0; i < CardsPerEntry; i++) { + for (int i = 0; i < cards_num(); i++) { if (_cards[i] == card_index) return true; } #endif @@ -67,14 +72,16 @@ int SparsePRTEntry::num_valid_cards() const { int sum = 0; #if UNROLL_CARD_LOOPS - assert(CardsPerEntry == 4, "Assumption. If changes, un-unroll."); - if (_cards[0] != NullEntry) sum++; - if (_cards[1] != NullEntry) sum++; - if (_cards[2] != NullEntry) sum++; - if (_cards[3] != NullEntry) sum++; + assert((cards_num() & (UnrollFactor - 1)) == 0, "Invalid number of cards in the entry"); + for (int i = 0; i < cards_num(); i += UnrollFactor) { + sum += (_cards[i] != NullEntry); + sum += (_cards[i + 1] != NullEntry); + sum += (_cards[i + 2] != NullEntry); + sum += (_cards[i + 3] != NullEntry); + } #else - for (int i = 0; i < CardsPerEntry; i++) { - if (_cards[i] != NulLEntry) sum++; + for (int i = 0; i < cards_num(); i++) { + sum += (_cards[i] != NullEntry); } #endif // Otherwise, we're full. @@ -83,27 +90,27 @@ SparsePRTEntry::AddCardResult SparsePRTEntry::add_card(CardIdx_t card_index) { #if UNROLL_CARD_LOOPS - assert(CardsPerEntry == 4, "Assumption. If changes, un-unroll."); - CardIdx_t c = _cards[0]; - if (c == card_index) return found; - if (c == NullEntry) { _cards[0] = card_index; return added; } - c = _cards[1]; - if (c == card_index) return found; - if (c == NullEntry) { _cards[1] = card_index; return added; } - c = _cards[2]; - if (c == card_index) return found; - if (c == NullEntry) { _cards[2] = card_index; return added; } - c = _cards[3]; - if (c == card_index) return found; - if (c == NullEntry) { _cards[3] = card_index; return added; } + assert((cards_num() & (UnrollFactor - 1)) == 0, "Invalid number of cards in the entry"); + CardIdx_t c; + for (int i = 0; i < cards_num(); i += UnrollFactor) { + c = _cards[i]; + if (c == card_index) return found; + if (c == NullEntry) { _cards[i] = card_index; return added; } + c = _cards[i + 1]; + if (c == card_index) return found; + if (c == NullEntry) { _cards[i + 1] = card_index; return added; } + c = _cards[i + 2]; + if (c == card_index) return found; + if (c == NullEntry) { _cards[i + 2] = card_index; return added; } + c = _cards[i + 3]; + if (c == card_index) return found; + if (c == NullEntry) { _cards[i + 3] = card_index; return added; } + } #else - for (int i = 0; i < CardsPerEntry; i++) { + for (int i = 0; i < cards_num(); i++) { CardIdx_t c = _cards[i]; if (c == card_index) return found; - if (c == NullEntry) { - _cards[i] = card_index; - return added; - } + if (c == NullEntry) { _cards[i] = card_index; return added; } } #endif // Otherwise, we're full. @@ -112,13 +119,15 @@ void SparsePRTEntry::copy_cards(CardIdx_t* cards) const { #if UNROLL_CARD_LOOPS - assert(CardsPerEntry == 4, "Assumption. If changes, un-unroll."); - cards[0] = _cards[0]; - cards[1] = _cards[1]; - cards[2] = _cards[2]; - cards[3] = _cards[3]; + assert((cards_num() & (UnrollFactor - 1)) == 0, "Invalid number of cards in the entry"); + for (int i = 0; i < cards_num(); i += UnrollFactor) { + cards[i] = _cards[i]; + cards[i + 1] = _cards[i + 1]; + cards[i + 2] = _cards[i + 2]; + cards[i + 3] = _cards[i + 3]; + } #else - for (int i = 0; i < CardsPerEntry; i++) { + for (int i = 0; i < cards_num(); i++) { cards[i] = _cards[i]; } #endif @@ -133,7 +142,7 @@ RSHashTable::RSHashTable(size_t capacity) : _capacity(capacity), _capacity_mask(capacity-1), _occupied_entries(0), _occupied_cards(0), - _entries(NEW_C_HEAP_ARRAY(SparsePRTEntry, capacity)), + _entries((SparsePRTEntry*)NEW_C_HEAP_ARRAY(char, SparsePRTEntry::size() * capacity)), _buckets(NEW_C_HEAP_ARRAY(int, capacity)), _free_list(NullEntry), _free_region(0) { @@ -161,8 +170,8 @@ "_capacity too large"); // This will put -1 == NullEntry in the key field of all entries. - memset(_entries, -1, _capacity * sizeof(SparsePRTEntry)); - memset(_buckets, -1, _capacity * sizeof(int)); + memset(_entries, NullEntry, _capacity * SparsePRTEntry::size()); + memset(_buckets, NullEntry, _capacity * sizeof(int)); _free_list = NullEntry; _free_region = 0; } @@ -175,8 +184,8 @@ if (res == SparsePRTEntry::added) _occupied_cards++; #if SPARSE_PRT_VERBOSE gclog_or_tty->print_cr(" after add_card[%d]: valid-cards = %d.", - pointer_delta(e, _entries, sizeof(SparsePRTEntry)), - e->num_valid_cards()); + pointer_delta(e, _entries, SparsePRTEntry::size()), + e->num_valid_cards()); #endif assert(e->num_valid_cards() > 0, "Postcondition"); return res != SparsePRTEntry::overflow; @@ -199,6 +208,22 @@ return true; } +SparsePRTEntry* RSHashTable::get_entry(RegionIdx_t region_ind) { + int ind = (int) (region_ind & capacity_mask()); + int cur_ind = _buckets[ind]; + SparsePRTEntry* cur; + while (cur_ind != NullEntry && + (cur = entry(cur_ind))->r_ind() != region_ind) { + cur_ind = cur->next_index(); + } + + if (cur_ind == NullEntry) return NULL; + // Otherwise... + assert(cur->r_ind() == region_ind, "Postcondition of loop + test above."); + assert(cur->num_valid_cards() > 0, "Inv"); + return cur; +} + bool RSHashTable::delete_entry(RegionIdx_t region_ind) { int ind = (int) (region_ind & capacity_mask()); int* prev_loc = &_buckets[ind]; @@ -225,20 +250,8 @@ int ind = (int) (region_ind & capacity_mask()); int cur_ind = _buckets[ind]; SparsePRTEntry* cur; - // XXX - // int k = 0; while (cur_ind != NullEntry && (cur = entry(cur_ind))->r_ind() != region_ind) { - /* - k++; - if (k > 10) { - gclog_or_tty->print_cr("RSHashTable::entry_for_region_ind(%d): " - "k = %d, cur_ind = %d.", region_ind, k, cur_ind); - if (k >= 1000) { - while (1) ; - } - } - */ cur_ind = cur->next_index(); } @@ -319,7 +332,7 @@ bool /* RSHashTable:: */ RSHashTableIter::has_next(size_t& card_index) { _card_ind++; CardIdx_t ci; - if (_card_ind < SparsePRTEntry::CardsPerEntry && + if (_card_ind < SparsePRTEntry::cards_num() && ((ci = _rsht->entry(_bl_ind)->card(_card_ind)) != SparsePRTEntry::NullEntry)) { card_index = compute_card_ind(ci); @@ -359,7 +372,7 @@ size_t RSHashTable::mem_size() const { return sizeof(this) + - capacity() * (sizeof(SparsePRTEntry) + sizeof(int)); + capacity() * (SparsePRTEntry::size() + sizeof(int)); } // ---------------------------------------------------------------------- @@ -446,6 +459,10 @@ return _next->get_cards(region_id, cards); } +SparsePRTEntry* SparsePRT::get_entry(RegionIdx_t region_id) { + return _next->get_entry(region_id); +} + bool SparsePRT::delete_entry(RegionIdx_t region_id) { return _next->delete_entry(region_id); } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -32,21 +32,28 @@ // insertions only enqueue old versions for deletions, but do not delete // old versions synchronously. - class SparsePRTEntry: public CHeapObj { public: - enum SomePublicConstants { - CardsPerEntry = 4, - NullEntry = -1 + NullEntry = -1, + UnrollFactor = 4 }; - private: RegionIdx_t _region_ind; int _next_index; - CardIdx_t _cards[CardsPerEntry]; - + CardIdx_t _cards[1]; + // WARNING: Don't put any data members beyond this line. Card array has, in fact, variable length. + // It should always be the last data member. public: + // Returns the size of the entry, used for entry allocation. + static size_t size() { return sizeof(SparsePRTEntry) + sizeof(CardIdx_t) * (cards_num() - 1); } + // Returns the size of the card array. + static int cards_num() { + // The number of cards should be a multiple of 4, because that's our current + // unrolling factor. + static const int s = MAX2(G1RSetSparseRegionEntries & ~(UnrollFactor - 1), UnrollFactor); + return s; + } // Set the region_ind to the given value, and delete all cards. inline void init(RegionIdx_t region_ind); @@ -134,12 +141,15 @@ bool add_card(RegionIdx_t region_id, CardIdx_t card_index); bool get_cards(RegionIdx_t region_id, CardIdx_t* cards); + bool delete_entry(RegionIdx_t region_id); bool contains_card(RegionIdx_t region_id, CardIdx_t card_index) const; void add_entry(SparsePRTEntry* e); + SparsePRTEntry* get_entry(RegionIdx_t region_id); + void clear(); size_t capacity() const { return _capacity; } @@ -148,7 +158,7 @@ size_t occupied_cards() const { return _occupied_cards; } size_t mem_size() const; - SparsePRTEntry* entry(int i) const { return &_entries[i]; } + SparsePRTEntry* entry(int i) const { return (SparsePRTEntry*)((char*)_entries + SparsePRTEntry::size() * i); } void print(); }; @@ -157,7 +167,7 @@ class RSHashTableIter VALUE_OBJ_CLASS_SPEC { int _tbl_ind; // [-1, 0.._rsht->_capacity) int _bl_ind; // [-1, 0.._rsht->_capacity) - short _card_ind; // [0..CardsPerEntry) + short _card_ind; // [0..SparsePRTEntry::cards_num()) RSHashTable* _rsht; size_t _heap_bot_card_ind; @@ -176,7 +186,7 @@ RSHashTableIter(size_t heap_bot_card_ind) : _tbl_ind(RSHashTable::NullEntry), _bl_ind(RSHashTable::NullEntry), - _card_ind((SparsePRTEntry::CardsPerEntry-1)), + _card_ind((SparsePRTEntry::cards_num() - 1)), _rsht(NULL), _heap_bot_card_ind(heap_bot_card_ind) {} @@ -185,7 +195,7 @@ _rsht = rsht; _tbl_ind = -1; // So that first increment gets to 0. _bl_ind = RSHashTable::NullEntry; - _card_ind = (SparsePRTEntry::CardsPerEntry-1); + _card_ind = (SparsePRTEntry::cards_num() - 1); } bool has_next(size_t& card_index); @@ -241,9 +251,13 @@ // If the table hold an entry for "region_ind", Copies its // cards into "cards", which must be an array of length at least - // "CardsPerEntry", and returns "true"; otherwise, returns "false". + // "SparePRTEntry::cards_num()", and returns "true"; otherwise, + // returns "false". bool get_cards(RegionIdx_t region_ind, CardIdx_t* cards); + // Return the pointer to the entry associated with the given region. + SparsePRTEntry* get_entry(RegionIdx_t region_ind); + // If there is an entry for "region_ind", removes it and return "true"; // otherwise returns "false." bool delete_entry(RegionIdx_t region_ind); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/includeDB_compiler1 --- a/hotspot/src/share/vm/includeDB_compiler1 Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/includeDB_compiler1 Fri Mar 19 18:49:36 2010 -0700 @@ -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 diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/includeDB_core --- a/hotspot/src/share/vm/includeDB_core Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/includeDB_core Fri Mar 19 18:49:36 2010 -0700 @@ -175,6 +175,8 @@ arguments.cpp management.hpp arguments.cpp oop.inline.hpp arguments.cpp os_.inline.hpp +arguments.cpp referenceProcessor.hpp +arguments.cpp taskqueue.hpp arguments.cpp universe.inline.hpp arguments.cpp vm_version_.hpp @@ -539,6 +541,7 @@ ciCPCache.cpp cpCacheOop.hpp ciCPCache.cpp ciCPCache.hpp +ciCPCache.cpp ciUtilities.hpp ciCPCache.hpp ciClassList.hpp ciCPCache.hpp ciObject.hpp @@ -1020,6 +1023,7 @@ codeCache.cpp codeCache.hpp codeCache.cpp dependencies.hpp codeCache.cpp gcLocker.hpp +codeCache.cpp handles.inline.hpp codeCache.cpp icache.hpp codeCache.cpp iterator.hpp codeCache.cpp java.hpp @@ -1483,6 +1487,7 @@ deoptimization.cpp vframe.hpp deoptimization.cpp vframeArray.hpp deoptimization.cpp vframe_hp.hpp +deoptimization.cpp vmreg_.inline.hpp deoptimization.cpp xmlstream.hpp deoptimization.hpp allocation.hpp @@ -2012,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 @@ -2653,6 +2659,7 @@ loaderConstraints.cpp safepoint.hpp loaderConstraints.hpp dictionary.hpp +loaderConstraints.hpp placeholders.hpp loaderConstraints.hpp hashtable.hpp location.cpp debugInfo.hpp @@ -2865,6 +2872,7 @@ methodHandles.cpp oopFactory.hpp methodHandles.cpp reflection.hpp methodHandles.cpp signature.hpp +methodHandles.cpp stubRoutines.hpp methodHandles.cpp symbolTable.hpp methodHandles_.cpp allocation.inline.hpp diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/memory/barrierSet.hpp --- a/hotspot/src/share/vm/memory/barrierSet.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/memory/barrierSet.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -124,8 +124,6 @@ // Below length is the # array elements being written virtual void write_ref_array_pre( oop* dst, int length) {} virtual void write_ref_array_pre(narrowOop* dst, int length) {} - // Below MemRegion mr is expected to be HeapWord-aligned - inline void write_ref_array(MemRegion mr); // Below count is the # array elements being written, starting // at the address "start", which may not necessarily be HeapWord-aligned inline void write_ref_array(HeapWord* start, size_t count); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/memory/barrierSet.inline.hpp --- a/hotspot/src/share/vm/memory/barrierSet.inline.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/memory/barrierSet.inline.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -42,16 +42,6 @@ } } -void BarrierSet::write_ref_array(MemRegion mr) { - assert((HeapWord*)align_size_down((uintptr_t)mr.start(), HeapWordSize) == mr.start() , "Unaligned start"); - assert((HeapWord*)align_size_up ((uintptr_t)mr.end(), HeapWordSize) == mr.end(), "Unaligned end" ); - if (kind() == CardTableModRef) { - ((CardTableModRefBS*)this)->inline_write_ref_array(mr); - } else { - write_ref_array_work(mr); - } -} - // count is number of array elements being written void BarrierSet::write_ref_array(HeapWord* start, size_t count) { assert(count <= (size_t)max_intx, "count too large"); @@ -61,12 +51,12 @@ // strictly necessary for current uses, but a case of good hygiene and, // if you will, aesthetics) and the second upward (this is essential for // current uses) to a HeapWord boundary, so we mark all cards overlapping - // this write. In the event that this evolves in the future to calling a + // this write. If this evolves in the future to calling a // logging barrier of narrow oop granularity, like the pre-barrier for G1 // (mentioned here merely by way of example), we will need to change this - // interface, much like the pre-barrier one above, so it is "exactly precise" - // (if i may be allowed the adverbial redundancy for emphasis) and does not - // include narrow oop slots not included in the original write interval. + // interface, so it is "exactly precise" (if i may be allowed the adverbial + // redundancy for emphasis) and does not include narrow oop slots not + // included in the original write interval. HeapWord* aligned_start = (HeapWord*)align_size_down((uintptr_t)start, HeapWordSize); HeapWord* aligned_end = (HeapWord*)align_size_up ((uintptr_t)end, HeapWordSize); // If compressed oops were not being used, these should already be aligned diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/memory/cardTableModRefBS.hpp --- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -339,6 +339,16 @@ return (val & (clean_card_mask_val() | claimed_card_val())) == claimed_card_val(); } + void set_card_claimed(size_t card_index) { + jbyte val = _byte_map[card_index]; + if (val == clean_card_val()) { + val = (jbyte)claimed_card_val(); + } else { + val |= (jbyte)claimed_card_val(); + } + _byte_map[card_index] = val; + } + bool claim_card(size_t card_index); bool is_card_clean(size_t card_index) { diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/memory/referenceProcessor.hpp --- a/hotspot/src/share/vm/memory/referenceProcessor.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/memory/referenceProcessor.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -263,10 +263,13 @@ int parallel_gc_threads = 1, bool mt_processing = false, bool discovered_list_needs_barrier = false); + // RefDiscoveryPolicy values - enum { + enum DiscoveryPolicy { ReferenceBasedDiscovery = 0, - ReferentBasedDiscovery = 1 + ReferentBasedDiscovery = 1, + DiscoveryPolicyMin = ReferenceBasedDiscovery, + DiscoveryPolicyMax = ReferentBasedDiscovery }; static void init_statics(); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/oops/methodDataOop.hpp --- a/hotspot/src/share/vm/oops/methodDataOop.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/oops/methodDataOop.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -545,6 +545,10 @@ return cell_offset(counter_cell_count); } + void set_count(uint count) { + set_uint_at(count_off, count); + } + #ifndef PRODUCT void print_data_on(outputStream* st); #endif @@ -692,6 +696,23 @@ void clear_row(uint row) { assert(row < row_limit(), "oob"); + // Clear total count - indicator of polymorphic call site. + // The site may look like as monomorphic after that but + // it allow to have more accurate profiling information because + // there was execution phase change since klasses were unloaded. + // If the site is still polymorphic then MDO will be updated + // to reflect it. But it could be the case that the site becomes + // only bimorphic. Then keeping total count not 0 will be wrong. + // Even if we use monomorphic (when it is not) for compilation + // we will only have trap, deoptimization and recompile again + // with updated MDO after executing method in Interpreter. + // An additional receiver will be recorded in the cleaned row + // during next call execution. + // + // Note: our profiling logic works with empty rows in any slot. + // We do sorting a profiling info (ciCallProfile) for compilation. + // + set_count(0); set_receiver(row, NULL); set_receiver_count(row, 0); } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/opto/callGenerator.cpp --- a/hotspot/src/share/vm/opto/callGenerator.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/opto/callGenerator.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -136,8 +136,10 @@ } // Mark the call node as virtual, sort of: call->set_optimized_virtual(true); - if (method()->is_method_handle_invoke()) + if (method()->is_method_handle_invoke()) { call->set_method_handle_invoke(true); + kit.C->set_has_method_handle_invokes(true); + } } kit.set_arguments_for_java_call(call); kit.set_edges_for_java_call(call, false, _separate_io_proj); @@ -194,6 +196,7 @@ call->set_optimized_virtual(true); // Take extra care (in the presence of argument motion) not to trash the SP: call->set_method_handle_invoke(true); + kit.C->set_has_method_handle_invokes(true); // Pass the target MethodHandle as first argument and shift the // other arguments. diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/opto/compile.cpp --- a/hotspot/src/share/vm/opto/compile.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/opto/compile.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -465,6 +465,7 @@ _code_buffer("Compile::Fill_buffer"), _orig_pc_slot(0), _orig_pc_slot_offset_in_bytes(0), + _has_method_handle_invokes(false), _node_bundling_limit(0), _node_bundling_base(NULL), _java_calls(0), @@ -759,6 +760,7 @@ _do_escape_analysis(false), _failure_reason(NULL), _code_buffer("Compile::Fill_buffer"), + _has_method_handle_invokes(false), _node_bundling_limit(0), _node_bundling_base(NULL), _java_calls(0), diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/opto/compile.hpp --- a/hotspot/src/share/vm/opto/compile.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/opto/compile.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -166,6 +166,9 @@ bool _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing #endif + // JSR 292 + bool _has_method_handle_invokes; // True if this method has MethodHandle invokes. + // Compilation environment. Arena _comp_arena; // Arena with lifetime equivalent to Compile ciEnv* _env; // CI interface @@ -336,6 +339,10 @@ void set_parsed_irreducible_loop(bool z) { _parsed_irreducible_loop = z; } #endif + // JSR 292 + bool has_method_handle_invokes() const { return _has_method_handle_invokes; } + void set_has_method_handle_invokes(bool z) { _has_method_handle_invokes = z; } + void begin_method() { #ifndef PRODUCT if (_printer) _printer->begin_method(this); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/opto/doCall.cpp --- a/hotspot/src/share/vm/opto/doCall.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/opto/doCall.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -70,7 +70,7 @@ CompileLog* log = this->log(); if (log != NULL) { int rid = (receiver_count >= 0)? log->identify(profile.receiver(0)): -1; - int r2id = (profile.morphism() == 2)? log->identify(profile.receiver(1)):-1; + int r2id = (rid != -1 && profile.has_receiver(1))? log->identify(profile.receiver(1)):-1; log->begin_elem("call method='%d' count='%d' prof_factor='%g'", log->identify(call_method), site_count, prof_factor); if (call_is_virtual) log->print(" virtual='1'"); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/opto/graphKit.cpp --- a/hotspot/src/share/vm/opto/graphKit.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/opto/graphKit.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -780,12 +780,20 @@ // Helper function for enforcing certain bytecodes to reexecute if // deoptimization happens -static bool should_reexecute_implied_by_bytecode(JVMState *jvms) { +static bool should_reexecute_implied_by_bytecode(JVMState *jvms, bool is_anewarray) { ciMethod* cur_method = jvms->method(); int cur_bci = jvms->bci(); if (cur_method != NULL && cur_bci != InvocationEntryBci) { Bytecodes::Code code = cur_method->java_code_at_bci(cur_bci); - return Interpreter::bytecode_should_reexecute(code); + return Interpreter::bytecode_should_reexecute(code) || + is_anewarray && code == Bytecodes::_multianewarray; + // Reexecute _multianewarray bytecode which was replaced with + // sequence of [a]newarray. See Parse::do_multianewarray(). + // + // Note: interpreter should not have it set since this optimization + // is limited by dimensions and guarded by flag so in some cases + // multianewarray() runtime calls will be generated and + // the bytecode should not be reexecutes (stack will not be reset). } else return false; } @@ -836,7 +844,7 @@ // For a known set of bytecodes, the interpreter should reexecute them if // deoptimization happens. We set the reexecute state for them here if (out_jvms->is_reexecute_undefined() && //don't change if already specified - should_reexecute_implied_by_bytecode(out_jvms)) { + should_reexecute_implied_by_bytecode(out_jvms, call->is_AllocateArray())) { out_jvms->set_should_reexecute(true); //NOTE: youngest_jvms not changed } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/opto/loopTransform.cpp --- a/hotspot/src/share/vm/opto/loopTransform.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/opto/loopTransform.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -1785,6 +1785,8 @@ bool PhaseIdealLoop::is_uncommon_trap_if_pattern(ProjNode *proj, bool must_reason_predicate) { Node *in0 = proj->in(0); if (!in0->is_If()) return false; + // Variation of a dead If node. + if (in0->outcnt() < 2) return false; IfNode* iff = in0->as_If(); // we need "If(Conv2B(Opaque1(...)))" pattern for must_reason_predicate @@ -2086,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("_head->is_Loop()) { + // Could be a simple region when irreducible loops are present. + return false; + } + + CountedLoopNode *cl = NULL; + if (loop->_head->is_CountedLoop()) { + cl = loop->_head->as_CountedLoop(); + // do nothing for iteration-splitted loops + if (!cl->is_normal_loop()) return false; + } + // Too many traps seen? bool tmt = C->too_many_traps(C->method(), 0, Deoptimization::Reason_predicate); int tc = C->trap_count(Deoptimization::Reason_predicate); @@ -2129,13 +2155,6 @@ return false; } - CountedLoopNode *cl = NULL; - if (loop->_head->is_CountedLoop()) { - cl = loop->_head->as_CountedLoop(); - // do nothing for iteration-splitted loops - if(!cl->is_normal_loop()) return false; - } - LoopNode *lpn = loop->_head->as_Loop(); Node* entry = lpn->in(LoopNode::EntryControl); @@ -2180,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(); @@ -2211,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; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/opto/loopnode.hpp --- a/hotspot/src/share/vm/opto/loopnode.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/opto/loopnode.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/opto/loopopts.cpp --- a/hotspot/src/share/vm/opto/loopopts.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/opto/loopopts.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -47,7 +47,7 @@ int offset = t_oop->offset(); phi = new (C,region->req()) PhiNode(region, type, NULL, iid, index, offset); } else { - phi = new (C,region->req()) PhiNode(region, type); + phi = PhiNode::make_blank(region, n); } uint old_unique = C->unique(); for( uint i = 1; i < region->req(); i++ ) { diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/opto/matcher.hpp --- a/hotspot/src/share/vm/opto/matcher.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/opto/matcher.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -373,8 +373,8 @@ // to implement the UseStrictFP mode. static const bool strict_fp_requires_explicit_rounding; - // Do floats take an entire double register or just half? - static const bool float_in_double; + // Are floats conerted to double when stored to stack during deoptimization? + static bool float_in_double(); // Do ints take an entire long register or just half? static const bool int_in_long; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/opto/output.cpp --- a/hotspot/src/share/vm/opto/output.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/opto/output.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -678,7 +678,7 @@ #endif //_LP64 else if( (t->base() == Type::FloatBot || t->base() == Type::FloatCon) && OptoReg::is_reg(regnum) ) { - array->append(new_loc_value( _regalloc, regnum, Matcher::float_in_double + array->append(new_loc_value( _regalloc, regnum, Matcher::float_in_double() ? Location::float_in_dbl : Location::normal )); } else if( t->base() == Type::Int && OptoReg::is_reg(regnum) ) { array->append(new_loc_value( _regalloc, regnum, Matcher::int_in_long @@ -795,6 +795,7 @@ int safepoint_pc_offset = current_offset; bool is_method_handle_invoke = false; + bool return_oop = false; // Add the safepoint in the DebugInfoRecorder if( !mach->is_MachCall() ) { @@ -804,9 +805,18 @@ mcall = mach->as_MachCall(); // Is the call a MethodHandle call? - if (mcall->is_MachCallJava()) - is_method_handle_invoke = mcall->as_MachCallJava()->_method_handle_invoke; - + if (mcall->is_MachCallJava()) { + if (mcall->as_MachCallJava()->_method_handle_invoke) { + assert(has_method_handle_invokes(), "must have been set during call generation"); + is_method_handle_invoke = true; + } + } + + // Check if a call returns an object. + if (mcall->return_value_is_used() && + mcall->tf()->range()->field_at(TypeFunc::Parms)->isa_ptr()) { + return_oop = true; + } safepoint_pc_offset += mcall->ret_addr_offset(); debug_info()->add_safepoint(safepoint_pc_offset, mcall->_oop_map); } @@ -919,7 +929,7 @@ assert(jvms->bci() >= InvocationEntryBci && jvms->bci() <= 0x10000, "must be a valid or entry BCI"); assert(!jvms->should_reexecute() || depth == max_depth, "reexecute allowed only for the youngest"); // Now we can describe the scope. - debug_info()->describe_scope(safepoint_pc_offset, scope_method, jvms->bci(), jvms->should_reexecute(), is_method_handle_invoke, locvals, expvals, monvals); + debug_info()->describe_scope(safepoint_pc_offset, scope_method, jvms->bci(), jvms->should_reexecute(), is_method_handle_invoke, return_oop, locvals, expvals, monvals); } // End jvms loop // Mark the end of the scope set. @@ -1086,9 +1096,21 @@ deopt_handler_req += MAX_stubs_size; // add marginal slop for handler stub_req += MAX_stubs_size; // ensure per-stub margin code_req += MAX_inst_size; // ensure per-instruction margin + if (StressCodeBuffers) code_req = const_req = stub_req = exception_handler_req = deopt_handler_req = 0x10; // force expansion - int total_req = code_req + pad_req + stub_req + exception_handler_req + deopt_handler_req + const_req; + + int total_req = + code_req + + pad_req + + stub_req + + exception_handler_req + + deopt_handler_req + // deopt handler + const_req; + + if (has_method_handle_invokes()) + total_req += deopt_handler_req; // deopt MH handler + CodeBuffer* cb = code_buffer(); cb->initialize(total_req, locs_req); @@ -1430,10 +1452,13 @@ _code_offsets.set_value(CodeOffsets::Exceptions, emit_exception_handler(*cb)); // Emit the deopt handler code. _code_offsets.set_value(CodeOffsets::Deopt, emit_deopt_handler(*cb)); - // Emit the MethodHandle deopt handler code. We can use the same - // code as for the normal deopt handler, we just need a different - // entry point address. - _code_offsets.set_value(CodeOffsets::DeoptMH, emit_deopt_handler(*cb)); + + // Emit the MethodHandle deopt handler code (if required). + if (has_method_handle_invokes()) { + // We can use the same code as for the normal deopt handler, we + // just need a different entry point address. + _code_offsets.set_value(CodeOffsets::DeoptMH, emit_deopt_handler(*cb)); + } } // One last check for failed CodeBuffer::expand: diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/opto/parse1.cpp --- a/hotspot/src/share/vm/opto/parse1.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/opto/parse1.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -237,7 +237,6 @@ C->record_method_not_compilable("OSR in empty or breakpointed method"); return; } - MethodLivenessResult raw_live_locals = method()->raw_liveness_at_bci(osr_bci()); // Extract the needed locals from the interpreter frame. Node *locals_addr = basic_plus_adr(osr_buf, osr_buf, (max_locals-1)*wordSize); @@ -306,6 +305,7 @@ SafePointNode* bad_type_exit = clone_map(); bad_type_exit->set_control(new (C, 1) RegionNode(1)); + assert(osr_block->flow()->jsrs()->size() == 0, "should be no jsrs live at osr point"); for (index = 0; index < max_locals; index++) { if (stopped()) break; Node* l = local(index); @@ -317,8 +317,18 @@ continue; } } - if (type->basic_type() == T_ADDRESS && !raw_live_locals.at(index)) { - // Skip type check for dead address locals + if (osr_block->flow()->local_type_at(index)->is_return_address()) { + // In our current system it's illegal for jsr addresses to be + // live into an OSR entry point because the compiler performs + // inlining of jsrs. ciTypeFlow has a bailout that detect this + // case and aborts the compile if addresses are live into an OSR + // entry point. Because of that we can assume that any address + // locals at the OSR entry point are dead. Method liveness + // isn't precise enought to figure out that they are dead in all + // cases so simply skip checking address locals all + // together. Any type check is guaranteed to fail since the + // interpreter type is the result of a load which might have any + // value and the expected type is a constant. continue; } set_local(index, check_interpreter_type(l, type, bad_type_exit)); @@ -824,7 +834,6 @@ case Bytecodes::_ddiv: case Bytecodes::_checkcast: case Bytecodes::_instanceof: - case Bytecodes::_athrow: case Bytecodes::_anewarray: case Bytecodes::_newarray: case Bytecodes::_multianewarray: @@ -834,6 +843,8 @@ return true; break; + // Don't rerun athrow since it's part of the exception path. + case Bytecodes::_athrow: case Bytecodes::_invokestatic: case Bytecodes::_invokedynamic: case Bytecodes::_invokespecial: diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/opto/parse3.cpp --- a/hotspot/src/share/vm/opto/parse3.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/opto/parse3.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -439,8 +439,18 @@ // Can use multianewarray instead of [a]newarray if only one dimension, // or if all non-final dimensions are small constants. - if (expand_count == 1 || (1 <= expand_count && expand_count <= expand_limit)) { - Node* obj = expand_multianewarray(array_klass, &length[0], ndimensions, ndimensions); + if (ndimensions == 1 || (1 <= expand_count && expand_count <= expand_limit)) { + Node* obj = NULL; + // Set the original stack and the reexecute bit for the interpreter + // to reexecute the multianewarray bytecode if deoptimization happens. + // Do it unconditionally even for one dimension multianewarray. + // Note: the reexecute bit will be set in GraphKit::add_safepoint_edges() + // when AllocateArray node for newarray is created. + { PreserveReexecuteState preexecs(this); + _sp += ndimensions; + // Pass 0 as nargs since uncommon trap code does not need to restore stack. + obj = expand_multianewarray(array_klass, &length[0], ndimensions, 0); + } //original reexecute and sp are set back here push(obj); return; } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/opto/runtime.cpp --- a/hotspot/src/share/vm/opto/runtime.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/opto/runtime.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -708,7 +708,7 @@ *(mdp + count_off) = DataLayout::counter_increment; } else { // Receiver did not match any saved receiver and there is no empty row for it. - // Increment total counter to indicate polimorphic case. + // Increment total counter to indicate polymorphic case. intptr_t* count_p = (intptr_t*)(((byte*)(data)) + in_bytes(CounterData::count_offset())); *count_p += DataLayout::counter_increment; } @@ -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); } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/opto/split_if.cpp --- a/hotspot/src/share/vm/opto/split_if.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/opto/split_if.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -187,10 +187,20 @@ } #endif + // ConvI2L may have type information on it which becomes invalid if + // it moves up in the graph so change any clones so widen the type + // to TypeLong::INT when pushing it up. + const Type* rtype = NULL; + if (n->Opcode() == Op_ConvI2L && n->bottom_type() != TypeLong::INT) { + rtype = TypeLong::INT; + } + // Now actually split-up this guy. One copy per control path merging. Node *phi = PhiNode::make_blank(blk1, n); for( uint j = 1; j < blk1->req(); j++ ) { Node *x = n->clone(); + // Widen the type of the ConvI2L when pushing up. + if (rtype != NULL) x->as_Type()->set_type(rtype); if( n->in(0) && n->in(0) == blk1 ) x->set_req( 0, blk1->in(j) ); for( uint i = 1; i < n->req(); i++ ) { diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/opto/stringopts.cpp --- a/hotspot/src/share/vm/opto/stringopts.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/opto/stringopts.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -1073,7 +1073,7 @@ kit.set_control(head); kit.set_memory(mem, char_adr_idx); - Node* q = __ DivI(kit.null(), i_phi, __ intcon(10)); + Node* q = __ DivI(NULL, i_phi, __ intcon(10)); Node* r = __ SubI(i_phi, __ AddI(__ LShiftI(q, __ intcon(3)), __ LShiftI(q, __ intcon(1)))); Node* m1 = __ SubI(charPos, __ intcon(1)); @@ -1270,14 +1270,15 @@ // length = length + (s.count - s.offset); RegionNode *r = new (C, 3) RegionNode(3); kit.gvn().set_type(r, Type::CONTROL); - Node *phi = new (C, 3) PhiNode(r, type->join(TypeInstPtr::NOTNULL)); + Node *phi = new (C, 3) PhiNode(r, type); kit.gvn().set_type(phi, phi->bottom_type()); Node* p = __ Bool(__ CmpP(arg, kit.null()), BoolTest::ne); IfNode* iff = kit.create_and_map_if(kit.control(), p, PROB_MIN, COUNT_UNKNOWN); Node* notnull = __ IfTrue(iff); Node* isnull = __ IfFalse(iff); + kit.set_control(notnull); // set control for the cast_not_null r->init_req(1, notnull); - phi->init_req(1, arg); + phi->init_req(1, kit.cast_not_null(arg, false)); r->init_req(2, isnull); phi->init_req(2, null_string); kit.set_control(r); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/opto/type.cpp --- a/hotspot/src/share/vm/opto/type.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/opto/type.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -2809,7 +2809,8 @@ // then we can subclass in the Java class hierarchy. if (klass()->equals(ciEnv::current()->Object_klass())) { // that is, tp's array type is a subtype of my klass - return TypeAryPtr::make(ptr, tp->ary(), tp->klass(), tp->klass_is_exact(), offset, instance_id); + return TypeAryPtr::make(ptr, (ptr == Constant ? tp->const_oop() : NULL), + tp->ary(), tp->klass(), tp->klass_is_exact(), offset, instance_id); } } // The other case cannot happen, since I cannot be a subtype of an array. @@ -3415,7 +3416,8 @@ // then we can subclass in the Java class hierarchy. if( tp->klass()->equals(ciEnv::current()->Object_klass()) ) { // that is, my array type is a subtype of 'tp' klass - return make( ptr, _ary, _klass, _klass_is_exact, offset, instance_id ); + return make( ptr, (ptr == Constant ? const_oop() : NULL), + _ary, _klass, _klass_is_exact, offset, instance_id ); } } // The other case cannot happen, since t cannot be a subtype of an array. diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/prims/jni.cpp --- a/hotspot/src/share/vm/prims/jni.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/prims/jni.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -3401,12 +3401,16 @@ thread->set_thread_state(_thread_in_vm); // Must do this before initialize_thread_local_storage thread->record_stack_base_and_size(); + thread->initialize_thread_local_storage(); if (!os::create_attached_thread(thread)) { delete thread; return JNI_ERR; } + // Enable stack overflow checks + thread->create_stack_guard_pages(); + thread->initialize_tlab(); // Crucial that we do not have a safepoint check for this thread, since it has @@ -3452,9 +3456,6 @@ // to regrab the threads_lock thread->set_attached(); - // Enable stack overflow checks - thread->create_stack_guard_pages(); - // Set java thread status. java_lang_Thread::set_thread_status(thread->threadObj(), java_lang_Thread::RUNNABLE); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/prims/jvmtiCodeBlobEvents.cpp --- a/hotspot/src/share/vm/prims/jvmtiCodeBlobEvents.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/prims/jvmtiCodeBlobEvents.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -402,7 +402,7 @@ address scopes_data = nm->scopes_data_begin(); for( pcd = nm->scopes_pcs_begin(); pcd < nm->scopes_pcs_end(); ++pcd ) { - ScopeDesc sc0(nm, pcd->scope_decode_offset(), pcd->should_reexecute()); + ScopeDesc sc0(nm, pcd->scope_decode_offset(), pcd->should_reexecute(), pcd->return_oop()); ScopeDesc *sd = &sc0; while( !sd->is_top() ) { sd = sd->sender(); } int bci = sd->bci(); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/prims/methodHandles.cpp --- a/hotspot/src/share/vm/prims/methodHandles.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/prims/methodHandles.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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"); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/prims/methodHandles.hpp --- a/hotspot/src/share/vm/prims/methodHandles.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/prims/methodHandles.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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(); +}; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/runtime/arguments.cpp --- a/hotspot/src/share/vm/runtime/arguments.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/runtime/arguments.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -1203,6 +1203,11 @@ if (!FLAG_IS_DEFAULT(CMSParPromoteBlocksToClaim) || !FLAG_IS_DEFAULT(OldPLABWeight)) { CFLS_LAB::modify_initialization(OldPLABSize, OldPLABWeight); } + if (PrintGCDetails && Verbose) { + tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk", + MarkStackSize / K, MarkStackSizeMax / K); + tty->print_cr("ConcGCThreads: %u", ConcGCThreads); + } } #endif // KERNEL @@ -1339,6 +1344,17 @@ if (FLAG_IS_DEFAULT(MaxGCPauseMillis)) { FLAG_SET_DEFAULT(MaxGCPauseMillis, 200); } + + 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()); + } + if (PrintGCDetails && Verbose) { + tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk", + MarkStackSize / K, MarkStackSizeMax / K); + tty->print_cr("ConcGCThreads: %u", ConcGCThreads); + } } void Arguments::set_heap_size() { @@ -1487,6 +1503,20 @@ //=========================================================================================================== // Parsing of main arguments +bool Arguments::verify_interval(uintx val, uintx min, + uintx max, const char* name) { + // Returns true iff value is in the inclusive interval [min..max] + // false, otherwise. + if (val >= min && val <= max) { + return true; + } + jio_fprintf(defaultStream::error_stream(), + "%s of " UINTX_FORMAT " is invalid; must be between " UINTX_FORMAT + " and " UINTX_FORMAT "\n", + name, val, min, max); + return false; +} + bool Arguments::verify_percentage(uintx value, const char* name) { if (value <= 100) { return true; @@ -1723,6 +1753,21 @@ status = false; } + if (UseG1GC) { + status = status && verify_percentage(InitiatingHeapOccupancyPercent, + "InitiatingHeapOccupancyPercent"); + } + + status = status && verify_interval(RefDiscoveryPolicy, + ReferenceProcessor::DiscoveryPolicyMin, + ReferenceProcessor::DiscoveryPolicyMax, + "RefDiscoveryPolicy"); + + // Limit the lower bound of this flag to 1 as it is used in a division + // expression. + status = status && verify_interval(TLABWasteTargetPercent, + 1, 100, "TLABWasteTargetPercent"); + return status; } @@ -1771,6 +1816,29 @@ return false; } +bool Arguments::parse_uintx(const char* value, + uintx* uintx_arg, + uintx min_size) { + + // Check the sign first since atomull() parses only unsigned values. + bool value_is_positive = !(*value == '-'); + + if (value_is_positive) { + julong n; + bool good_return = atomull(value, &n); + if (good_return) { + bool above_minimum = n >= min_size; + bool value_is_too_large = n > max_uintx; + + if (above_minimum && !value_is_too_large) { + *uintx_arg = n; + return true; + } + } + } + return false; +} + Arguments::ArgsRange Arguments::parse_memory_size(const char* s, julong* long_arg, julong min_size) { @@ -2429,6 +2497,37 @@ jio_fprintf(defaultStream::error_stream(), "Please use -XX:YoungPLABSize in place of " "-XX:ParallelGCToSpaceAllocBufferSize in the future\n"); + } else if (match_option(option, "-XX:CMSMarkStackSize=", &tail) || + match_option(option, "-XX:G1MarkStackSize=", &tail)) { + julong stack_size = 0; + ArgsRange errcode = parse_memory_size(tail, &stack_size, 1); + if (errcode != arg_in_range) { + jio_fprintf(defaultStream::error_stream(), + "Invalid mark stack size: %s\n", option->optionString); + describe_range_error(errcode); + return JNI_EINVAL; + } + FLAG_SET_CMDLINE(uintx, MarkStackSize, stack_size); + } else if (match_option(option, "-XX:CMSMarkStackSizeMax=", &tail)) { + julong max_stack_size = 0; + ArgsRange errcode = parse_memory_size(tail, &max_stack_size, 1); + if (errcode != arg_in_range) { + jio_fprintf(defaultStream::error_stream(), + "Invalid maximum mark stack size: %s\n", + option->optionString); + describe_range_error(errcode); + return JNI_EINVAL; + } + FLAG_SET_CMDLINE(uintx, MarkStackSizeMax, max_stack_size); + } else if (match_option(option, "-XX:ParallelMarkingThreads=", &tail) || + match_option(option, "-XX:ParallelCMSThreads=", &tail)) { + uintx conc_threads = 0; + if (!parse_uintx(tail, &conc_threads, 1)) { + jio_fprintf(defaultStream::error_stream(), + "Invalid concurrent threads: %s\n", option->optionString); + return JNI_EINVAL; + } + FLAG_SET_CMDLINE(uintx, ConcGCThreads, conc_threads); } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx // Skip -XX:Flags= since that case has already been handled if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) { @@ -2500,6 +2599,9 @@ SOLARIS_ONLY(FLAG_SET_DEFAULT(UseISM, false)); } + // Tiered compilation is undefined with C1. + TieredCompilation = false; + #else if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) { FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1); @@ -2757,6 +2859,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; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/runtime/arguments.hpp --- a/hotspot/src/share/vm/runtime/arguments.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/runtime/arguments.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -336,11 +336,19 @@ static bool is_bad_option(const JavaVMOption* option, jboolean ignore) { return is_bad_option(option, ignore, NULL); } + static bool verify_interval(uintx val, uintx min, + uintx max, const char* name); static bool verify_percentage(uintx value, const char* name); static void describe_range_error(ArgsRange errcode); static ArgsRange check_memory_size(julong size, julong min_size); static ArgsRange parse_memory_size(const char* s, julong* long_arg, julong min_size); + // Parse a string for a unsigned integer. Returns true if value + // is an unsigned integer greater than or equal to the minimum + // parameter passed and returns the value in uintx_arg. Returns + // false otherwise, with uintx_arg undefined. + static bool parse_uintx(const char* value, uintx* uintx_arg, + uintx min_size); // methods to build strings from individual args static void build_jvm_args(const char* arg); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/runtime/deoptimization.cpp --- a/hotspot/src/share/vm/runtime/deoptimization.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/runtime/deoptimization.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -145,6 +145,27 @@ if (EliminateAllocations) { assert (chunk->at(0)->scope() != NULL,"expect only compiled java frames"); GrowableArray* objects = chunk->at(0)->scope()->objects(); + + // The flag return_oop() indicates call sites which return oop + // in compiled code. Such sites include java method calls, + // runtime calls (for example, used to allocate new objects/arrays + // on slow code path) and any other calls generated in compiled code. + // It is not guaranteed that we can get such information here only + // by analyzing bytecode in deoptimized frames. This is why this flag + // is set during method compilation (see Compile::Process_OopMap_Node()). + bool save_oop_result = chunk->at(0)->scope()->return_oop(); + Handle return_value; + if (save_oop_result) { + // Reallocation may trigger GC. If deoptimization happened on return from + // call which returns oop we need to save it since it is not in oopmap. + oop result = deoptee.saved_oop_result(&map); + assert(result == NULL || result->is_oop(), "must be oop"); + return_value = Handle(thread, result); + assert(Universe::heap()->is_in_or_null(result), "must be heap pointer"); + if (TraceDeoptimization) { + tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, result, thread); + } + } bool reallocated = false; if (objects != NULL) { JRT_BLOCK @@ -158,8 +179,12 @@ ttyLocker ttyl; tty->print_cr("REALLOC OBJECTS in thread " INTPTR_FORMAT, thread); print_objects(objects); + } +#endif } -#endif + if (save_oop_result) { + // Restore result. + deoptee.set_saved_oop_result(&map, return_value()); } } if (EliminateLocks) { @@ -913,21 +938,6 @@ if (TraceDeoptimization) { ttyLocker ttyl; tty->print_cr(" Created vframeArray " INTPTR_FORMAT, array); - if (Verbose) { - int count = 0; - // this used to leak deoptimizedVFrame like it was going out of style!!! - for (int index = 0; index < array->frames(); index++ ) { - vframeArrayElement* e = array->element(index); - e->print(tty); - - /* - No printing yet. - array->vframe_at(index)->print_activation(count++); - // better as... - array->print_activation_for(index, count++); - */ - } - } } #endif // PRODUCT diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/runtime/frame.cpp --- a/hotspot/src/share/vm/runtime/frame.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/runtime/frame.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -606,12 +606,12 @@ for (BasicObjectLock* current = interpreter_frame_monitor_end(); current < interpreter_frame_monitor_begin(); current = next_monitor_in_interpreter_frame(current)) { - st->print_cr(" [ - obj "); + st->print(" - obj ["); current->obj()->print_value_on(st); - st->cr(); - st->print_cr(" - lock "); + st->print_cr("]"); + st->print(" - lock ["); current->lock()->print_on(st); - st->cr(); + st->print_cr("]"); } // monitor st->print_cr(" - monitor[" INTPTR_FORMAT "]", interpreter_frame_monitor_begin()); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/runtime/globals.hpp --- a/hotspot/src/share/vm/runtime/globals.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/runtime/globals.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -1245,9 +1245,6 @@ product(uintx, ParallelGCThreads, 0, \ "Number of parallel threads parallel gc will use") \ \ - product(uintx, ParallelCMSThreads, 0, \ - "Max number of threads CMS will use for concurrent work") \ - \ develop(bool, ParallelOldGCSplitALot, false, \ "Provoke splitting (copying data from a young gen space to" \ "multiple destination spaces)") \ @@ -1258,8 +1255,8 @@ develop(bool, TraceRegionTasksQueuing, false, \ "Trace the queuing of the region tasks") \ \ - product(uintx, ParallelMarkingThreads, 0, \ - "Number of marking threads concurrent gc will use") \ + product(uintx, ConcGCThreads, 0, \ + "Number of threads concurrent gc will use") \ \ product(uintx, YoungPLABSize, 4096, \ "Size of young gen promotion labs (in HeapWords)") \ @@ -1535,11 +1532,11 @@ develop(bool, CMSOverflowEarlyRestoration, false, \ "Whether preserved marks should be restored early") \ \ - product(uintx, CMSMarkStackSize, NOT_LP64(32*K) LP64_ONLY(4*M), \ - "Size of CMS marking stack") \ - \ - product(uintx, CMSMarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M), \ - "Max size of CMS marking stack") \ + product(uintx, MarkStackSize, NOT_LP64(32*K) LP64_ONLY(4*M), \ + "Size of marking stack") \ + \ + product(uintx, MarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M), \ + "Max size of marking stack") \ \ notproduct(bool, CMSMarkStackOverflowALot, false, \ "Whether we should simulate frequent marking stack / work queue" \ @@ -1724,6 +1721,13 @@ "Percentage CMS generation occupancy to start a CMS collection " \ "cycle. A negative value means that CMSTriggerRatio is used") \ \ + product(uintx, InitiatingHeapOccupancyPercent, 45, \ + "Percentage of the (entire) heap occupancy to start a " \ + "concurrent GC cycle. It us used by GCs that trigger a " \ + "concurrent GC cycle based on the occupancy of the entire heap, " \ + "not just one of the generations (e.g., G1). A value of 0 " \ + "denotes 'do constant GC cycles'.") \ + \ product(intx, CMSInitiatingPermOccupancyFraction, -1, \ "Percentage CMS perm generation occupancy to start a " \ "CMScollection cycle. A negative value means that " \ @@ -2925,7 +2929,7 @@ product(uintx, OldSize, ScaleForWordSize(4*M), \ "Initial tenured generation size (in bytes)") \ \ - product(uintx, NewSize, ScaleForWordSize(4*M), \ + product(uintx, NewSize, ScaleForWordSize(1*M), \ "Initial new generation size (in bytes)") \ \ product(uintx, MaxNewSize, max_uintx, \ diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/runtime/init.cpp --- a/hotspot/src/share/vm/runtime/init.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/runtime/init.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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. diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/runtime/safepoint.cpp --- a/hotspot/src/share/vm/runtime/safepoint.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/runtime/safepoint.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -30,8 +30,8 @@ SafepointSynchronize::SynchronizeState volatile SafepointSynchronize::_state = SafepointSynchronize::_not_synchronized; volatile int SafepointSynchronize::_waiting_to_block = 0; -jlong SafepointSynchronize::_last_safepoint = 0; volatile int SafepointSynchronize::_safepoint_counter = 0; +long SafepointSynchronize::_end_of_last_safepoint = 0; static volatile int PageArmed = 0 ; // safepoint polling page is RO|RW vs PROT_NONE static volatile int TryingToBlock = 0 ; // proximate value -- for advisory use only static bool timeout_error_printed = false; @@ -42,7 +42,10 @@ Thread* myThread = Thread::current(); assert(myThread->is_VM_thread(), "Only VM thread may execute a safepoint"); - _last_safepoint = os::javaTimeNanos(); + if (PrintSafepointStatistics || PrintSafepointStatisticsTimeout > 0) { + _safepoint_begin_time = os::javaTimeNanos(); + _ts_of_current_safepoint = tty->time_stamp().seconds(); + } #ifndef SERIALGC if (UseConcMarkSweepGC) { @@ -320,6 +323,11 @@ // Call stuff that needs to be run when a safepoint is just about to be completed do_cleanup_tasks(); + + if (PrintSafepointStatistics) { + // Record how much time spend on the above cleanup tasks + update_statistics_on_cleanup_end(os::javaTimeNanos()); + } } } @@ -411,6 +419,9 @@ ConcurrentGCThread::safepoint_desynchronize(); } #endif // SERIALGC + // record this time so VMThread can keep track how much time has elasped + // since last safepoint. + _end_of_last_safepoint = os::javaTimeMillis(); } bool SafepointSynchronize::is_cleanup_needed() { @@ -445,24 +456,23 @@ // Various cleaning tasks that should be done periodically at safepoints void SafepointSynchronize::do_cleanup_tasks() { - jlong cleanup_time; - - // Update fat-monitor pool, since this is a safepoint. - if (TraceSafepoint) { - cleanup_time = os::javaTimeNanos(); + { + TraceTime t1("deflating idle monitors", TraceSafepoint); + ObjectSynchronizer::deflate_idle_monitors(); } - ObjectSynchronizer::deflate_idle_monitors(); - InlineCacheBuffer::update_inline_caches(); + { + TraceTime t2("updating inline caches", TraceSafepoint); + InlineCacheBuffer::update_inline_caches(); + } + if(UseCounterDecay && CounterDecay::is_decay_needed()) { + TraceTime t3("decaying counter", TraceSafepoint); CounterDecay::decay(); } + + TraceTime t4("sweeping nmethods", TraceSafepoint); NMethodSweeper::sweep(); - - if (TraceSafepoint) { - tty->print_cr("do_cleanup_tasks takes "INT64_FORMAT_W(6) "ms", - (os::javaTimeNanos() - cleanup_time) / MICROUNITS); - } } @@ -979,17 +989,32 @@ // Statistics & Instrumentations // SafepointSynchronize::SafepointStats* SafepointSynchronize::_safepoint_stats = NULL; +jlong SafepointSynchronize::_safepoint_begin_time = 0; int SafepointSynchronize::_cur_stat_index = 0; julong SafepointSynchronize::_safepoint_reasons[VM_Operation::VMOp_Terminating]; julong SafepointSynchronize::_coalesced_vmop_count = 0; jlong SafepointSynchronize::_max_sync_time = 0; +jlong SafepointSynchronize::_max_vmop_time = 0; +float SafepointSynchronize::_ts_of_current_safepoint = 0.0f; -// last_safepoint_start_time records the start time of last safepoint. -static jlong last_safepoint_start_time = 0; -static jlong sync_end_time = 0; +static jlong cleanup_end_time = 0; static bool need_to_track_page_armed_status = false; static bool init_done = false; +// Helper method to print the header. +static void print_header() { + tty->print(" vmop " + "[threads: total initially_running wait_to_block] "); + tty->print("[time: spin block sync cleanup vmop] "); + + // no page armed status printed out if it is always armed. + if (need_to_track_page_armed_status) { + tty->print("page_armed "); + } + + tty->print_cr("page_trap_count"); +} + void SafepointSynchronize::deferred_initialize_stat() { if (init_done) return; @@ -1016,19 +1041,6 @@ if (UseCompilerSafepoints && DeferPollingPageLoopCount >= 0) { need_to_track_page_armed_status = true; } - - tty->print(" vmop_name " - "[threads: total initially_running wait_to_block] "); - tty->print("[time: spin block sync] " - "[vmop_time time_elapsed] "); - - // no page armed status printed out if it is always armed. - if (need_to_track_page_armed_status) { - tty->print("page_armed "); - } - - tty->print_cr("page_trap_count"); - init_done = true; } @@ -1036,6 +1048,8 @@ assert(init_done, "safepoint statistics array hasn't been initialized"); SafepointStats *spstat = &_safepoint_stats[_cur_stat_index]; + spstat->_time_stamp = _ts_of_current_safepoint; + VM_Operation *op = VMThread::vm_operation(); spstat->_vmop_type = (op != NULL ? op->type() : -1); if (op != NULL) { @@ -1054,14 +1068,6 @@ } else { spstat->_time_to_spin = 0; } - - if (last_safepoint_start_time == 0) { - spstat->_time_elapsed_since_last_safepoint = 0; - } else { - spstat->_time_elapsed_since_last_safepoint = _last_safepoint - - last_safepoint_start_time; - } - last_safepoint_start_time = _last_safepoint; } void SafepointSynchronize::update_statistics_on_spin_end() { @@ -1097,18 +1103,31 @@ // Records the end time of sync which will be used to calculate the total // vm operation time. Again, the real time spending in syncing will be deducted // from the start of the sync time later when end_statistics is called. - spstat->_time_to_sync = end_time - _last_safepoint; + spstat->_time_to_sync = end_time - _safepoint_begin_time; if (spstat->_time_to_sync > _max_sync_time) { _max_sync_time = spstat->_time_to_sync; } - sync_end_time = end_time; + + spstat->_time_to_do_cleanups = end_time; +} + +void SafepointSynchronize::update_statistics_on_cleanup_end(jlong end_time) { + SafepointStats *spstat = &_safepoint_stats[_cur_stat_index]; + + // Record how long spent in cleanup tasks. + spstat->_time_to_do_cleanups = end_time - spstat->_time_to_do_cleanups; + + cleanup_end_time = end_time; } void SafepointSynchronize::end_statistics(jlong vmop_end_time) { SafepointStats *spstat = &_safepoint_stats[_cur_stat_index]; // Update the vm operation time. - spstat->_time_to_exec_vmop = vmop_end_time - sync_end_time; + spstat->_time_to_exec_vmop = vmop_end_time - cleanup_end_time; + if (spstat->_time_to_exec_vmop > _max_vmop_time) { + _max_vmop_time = spstat->_time_to_exec_vmop; + } // Only the sync time longer than the specified // PrintSafepointStatisticsTimeout will be printed out right away. // By default, it is -1 meaning all samples will be put into the list. @@ -1119,40 +1138,42 @@ } else { // The safepoint statistics will be printed out when the _safepoin_stats // array fills up. - if (_cur_stat_index != PrintSafepointStatisticsCount - 1) { - _cur_stat_index ++; - } else { + if (_cur_stat_index == PrintSafepointStatisticsCount - 1) { print_statistics(); _cur_stat_index = 0; - tty->print_cr(""); + } else { + _cur_stat_index++; } } } void SafepointSynchronize::print_statistics() { - int index; SafepointStats* sstats = _safepoint_stats; - for (index = 0; index <= _cur_stat_index; index++) { + for (int index = 0; index <= _cur_stat_index; index++) { + if (index % 30 == 0) { + print_header(); + } sstats = &_safepoint_stats[index]; - tty->print("%-28s [" + tty->print("%.3f: ", sstats->_time_stamp); + tty->print("%-26s [" INT32_FORMAT_W(8)INT32_FORMAT_W(11)INT32_FORMAT_W(15) - "] ", + " ] ", sstats->_vmop_type == -1 ? "no vm operation" : VM_Operation::name(sstats->_vmop_type), sstats->_nof_total_threads, sstats->_nof_initial_running_threads, sstats->_nof_threads_wait_to_block); // "/ MICROUNITS " is to convert the unit from nanos to millis. - tty->print(" [" - INT64_FORMAT_W(6)INT64_FORMAT_W(6)INT64_FORMAT_W(6) - "] " - "["INT64_FORMAT_W(6)INT64_FORMAT_W(9) "] ", + tty->print(" [" + INT64_FORMAT_W(6)INT64_FORMAT_W(6) + INT64_FORMAT_W(6)INT64_FORMAT_W(6) + INT64_FORMAT_W(6)" ] ", sstats->_time_to_spin / MICROUNITS, sstats->_time_to_wait_to_block / MICROUNITS, sstats->_time_to_sync / MICROUNITS, - sstats->_time_to_exec_vmop / MICROUNITS, - sstats->_time_elapsed_since_last_safepoint / MICROUNITS); + sstats->_time_to_do_cleanups / MICROUNITS, + sstats->_time_to_exec_vmop / MICROUNITS); if (need_to_track_page_armed_status) { tty->print(INT32_FORMAT" ", sstats->_page_armed); @@ -1174,7 +1195,7 @@ // don't print it out. // Approximate the vm op time. _safepoint_stats[_cur_stat_index]._time_to_exec_vmop = - os::javaTimeNanos() - sync_end_time; + os::javaTimeNanos() - cleanup_end_time; if ( PrintSafepointStatisticsTimeout < 0 || spstat->_time_to_sync > PrintSafepointStatisticsTimeout * MICROUNITS) { @@ -1203,6 +1224,9 @@ _coalesced_vmop_count); tty->print_cr("Maximum sync time "INT64_FORMAT_W(5)" ms", _max_sync_time / MICROUNITS); + tty->print_cr("Maximum vm operation time (except for Exit VM operation) " + INT64_FORMAT_W(5)" ms", + _max_vmop_time / MICROUNITS); } // ------------------------------------------------------------------------------------------------ diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/runtime/safepoint.hpp --- a/hotspot/src/share/vm/runtime/safepoint.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/runtime/safepoint.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -65,6 +65,7 @@ }; typedef struct { + float _time_stamp; // record when the current safepoint occurs in seconds int _vmop_type; // type of VM operation triggers the safepoint int _nof_total_threads; // total number of Java threads int _nof_initial_running_threads; // total number of initially seen running threads @@ -73,14 +74,14 @@ int _nof_threads_hit_page_trap; // total number of threads hitting the page trap jlong _time_to_spin; // total time in millis spent in spinning jlong _time_to_wait_to_block; // total time in millis spent in waiting for to block + jlong _time_to_do_cleanups; // total time in millis spent in performing cleanups jlong _time_to_sync; // total time in millis spent in getting to _synchronized jlong _time_to_exec_vmop; // total time in millis spent in vm operation itself - jlong _time_elapsed_since_last_safepoint; // time elasped since last safepoint } SafepointStats; private: static volatile SynchronizeState _state; // Threads might read this flag directly, without acquireing the Threads_lock - static volatile int _waiting_to_block; // No. of threads we are waiting for to block. + static volatile int _waiting_to_block; // number of threads we are waiting for to block // This counter is used for fast versions of jni_GetField. // An even value means there is no ongoing safepoint operations. @@ -91,19 +92,22 @@ public: static volatile int _safepoint_counter; private: - - static jlong _last_safepoint; // Time of last safepoint + static long _end_of_last_safepoint; // Time of last safepoint in milliseconds // statistics - static SafepointStats* _safepoint_stats; // array of SafepointStats struct - static int _cur_stat_index; // current index to the above array - static julong _safepoint_reasons[]; // safepoint count for each VM op - static julong _coalesced_vmop_count;// coalesced vmop count - static jlong _max_sync_time; // maximum sync time in nanos + static jlong _safepoint_begin_time; // time when safepoint begins + static SafepointStats* _safepoint_stats; // array of SafepointStats struct + static int _cur_stat_index; // current index to the above array + static julong _safepoint_reasons[]; // safepoint count for each VM op + static julong _coalesced_vmop_count; // coalesced vmop count + static jlong _max_sync_time; // maximum sync time in nanos + static jlong _max_vmop_time; // maximum vm operation time in nanos + static float _ts_of_current_safepoint; // time stamp of current safepoint in seconds static void begin_statistics(int nof_threads, int nof_running); static void update_statistics_on_spin_end(); static void update_statistics_on_sync_end(jlong end_time); + static void update_statistics_on_cleanup_end(jlong end_time); static void end_statistics(jlong end_time); static void print_statistics(); inline static void inc_page_trap_count() { @@ -140,7 +144,9 @@ static void handle_polling_page_exception(JavaThread *thread); // VM Thread interface for determining safepoint rate - static long last_non_safepoint_interval() { return os::javaTimeMillis() - _last_safepoint; } + static long last_non_safepoint_interval() { + return os::javaTimeMillis() - _end_of_last_safepoint; + } static bool is_cleanup_needed(); static void do_cleanup_tasks(); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/runtime/sharedRuntime.cpp --- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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(); @@ -607,7 +602,9 @@ _implicit_null_throws++; #endif target_pc = nm->continuation_for_implicit_exception(pc); - guarantee(target_pc != 0, "must have a continuation point"); + // If there's an unexpected fault, target_pc might be NULL, + // in which case we want to fall through into the normal + // error handling code. } break; // fall through @@ -621,14 +618,15 @@ _implicit_div0_throws++; #endif target_pc = nm->continuation_for_implicit_exception(pc); - guarantee(target_pc != 0, "must have a continuation point"); + // If there's an unexpected fault, target_pc might be NULL, + // in which case we want to fall through into the normal + // error handling code. break; // fall through } default: ShouldNotReachHere(); } - guarantee(target_pc != NULL, "must have computed destination PC for implicit exception"); assert(exception_kind == IMPLICIT_NULL || exception_kind == IMPLICIT_DIVIDE_BY_ZERO, "wrong implicit exception kind"); // for AbortVMOnException flag @@ -889,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 @@ -926,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 @@ -937,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) { @@ -1944,7 +1949,7 @@ private: -#ifdef ASSERT +#ifndef PRODUCT static int _lookups; // number of calls to lookup static int _buckets; // number of buckets checked static int _equals; // number of buckets checked with matching hash @@ -1980,16 +1985,16 @@ // Find a entry with the same fingerprint if it exists AdapterHandlerEntry* lookup(int total_args_passed, BasicType* sig_bt) { - debug_only(_lookups++); + NOT_PRODUCT(_lookups++); AdapterFingerPrint fp(total_args_passed, sig_bt); unsigned int hash = fp.compute_hash(); int index = hash_to_index(hash); for (AdapterHandlerEntry* e = bucket(index); e != NULL; e = e->next()) { - debug_only(_buckets++); + NOT_PRODUCT(_buckets++); if (e->hash() == hash) { - debug_only(_equals++); + NOT_PRODUCT(_equals++); if (fp.equals(e->fingerprint())) { -#ifdef ASSERT +#ifndef PRODUCT if (fp.is_compact()) _compact++; _hits++; #endif @@ -2000,6 +2005,7 @@ return NULL; } +#ifndef PRODUCT void print_statistics() { ResourceMark rm; int longest = 0; @@ -2018,15 +2024,14 @@ } tty->print_cr("AdapterHandlerTable: empty %d longest %d total %d average %f", empty, longest, total, total / (double)nonempty); -#ifdef ASSERT tty->print_cr("AdapterHandlerTable: lookups %d buckets %d equals %d hits %d compact %d", _lookups, _buckets, _equals, _hits, _compact); + } #endif - } }; -#ifdef ASSERT +#ifndef PRODUCT int AdapterHandlerTable::_lookups; int AdapterHandlerTable::_buckets; @@ -2074,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; @@ -2126,7 +2130,7 @@ ResourceMark rm; NOT_PRODUCT(int code_size); - BufferBlob *B = NULL; + AdapterBlob* B = NULL; AdapterHandlerEntry* entry = NULL; AdapterFingerPrint* fingerprint = NULL; { @@ -2176,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]; @@ -2205,7 +2209,7 @@ } #endif - B = BufferBlob::create(AdapterHandlerEntry::name, &buffer); + B = AdapterBlob::create(&buffer); NOT_PRODUCT(code_size = buffer.code_size()); } if (B == NULL) { @@ -2237,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()); diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/runtime/sharedRuntime.hpp --- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -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; } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/runtime/stubRoutines.cpp --- a/hotspot/src/share/vm/runtime/stubRoutines.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/runtime/stubRoutines.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -196,11 +196,19 @@ // Default versions of arraycopy functions // +static void gen_arraycopy_barrier_pre(oop* dest, size_t count) { + assert(count != 0, "count should be non-zero"); + assert(count <= (size_t)max_intx, "count too large"); + BarrierSet* bs = Universe::heap()->barrier_set(); + assert(bs->has_write_ref_array_pre_opt(), "Must have pre-barrier opt"); + bs->write_ref_array_pre(dest, (int)count); +} + static void gen_arraycopy_barrier(oop* dest, size_t count) { assert(count != 0, "count should be non-zero"); BarrierSet* bs = Universe::heap()->barrier_set(); assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt"); - bs->write_ref_array(MemRegion((HeapWord*)dest, (HeapWord*)(dest + count))); + bs->write_ref_array((HeapWord*)dest, count); } JRT_LEAF(void, StubRoutines::jbyte_copy(jbyte* src, jbyte* dest, size_t count)) @@ -240,6 +248,7 @@ SharedRuntime::_oop_array_copy_ctr++; // Slow-path oop array copy #endif // !PRODUCT assert(count != 0, "count should be non-zero"); + gen_arraycopy_barrier_pre(dest, count); Copy::conjoint_oops_atomic(src, dest, count); gen_arraycopy_barrier(dest, count); JRT_END @@ -281,6 +290,7 @@ SharedRuntime::_oop_array_copy_ctr++; // Slow-path oop array copy #endif // !PRODUCT assert(count != 0, "count should be non-zero"); + gen_arraycopy_barrier_pre((oop *) dest, count); Copy::arrayof_conjoint_oops(src, dest, count); gen_arraycopy_barrier((oop *) dest, count); JRT_END diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/runtime/thread.cpp --- a/hotspot/src/share/vm/runtime/thread.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/runtime/thread.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -1637,6 +1637,9 @@ JNIHandleBlock::release_block(block); } + // These have to be removed while this is still a valid thread. + remove_stack_guard_pages(); + if (UseTLAB) { tlab().make_parsable(true); // retire TLAB, if any } diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/runtime/vframeArray.cpp --- a/hotspot/src/share/vm/runtime/vframeArray.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/runtime/vframeArray.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -186,7 +186,7 @@ int popframe_preserved_args_size_in_bytes = 0; int popframe_preserved_args_size_in_words = 0; if (is_top_frame) { - JvmtiThreadState *state = thread->jvmti_thread_state(); + JvmtiThreadState *state = thread->jvmti_thread_state(); if (JvmtiExport::can_pop_frame() && (thread->has_pending_popframe() || thread->popframe_forcing_deopt_reexecution())) { if (thread->has_pending_popframe()) { @@ -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. @@ -381,7 +381,6 @@ RegisterMap map(thread); vframe* f = vframe::new_vframe(iframe(), &map, thread); f->print(); - iframe()->interpreter_frame_print_on(tty); tty->print_cr("locals size %d", locals()->size()); tty->print_cr("expression size %d", expressions()->size()); @@ -582,7 +581,7 @@ } void vframeArrayElement::print(outputStream* st) { - st->print_cr(" - interpreter_frame -> sp: ", INTPTR_FORMAT, iframe()->sp()); + st->print_cr(" - interpreter_frame -> sp: " INTPTR_FORMAT, iframe()->sp()); } void vframeArray::print_value_on(outputStream* st) const { diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/runtime/vmThread.cpp --- a/hotspot/src/share/vm/runtime/vmThread.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/runtime/vmThread.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -426,11 +426,6 @@ // follow that also require a safepoint if (_cur_vm_operation->evaluate_at_safepoint()) { - if (PrintGCApplicationConcurrentTime) { - gclog_or_tty->print_cr("Application time: %3.7f seconds", - RuntimeService::last_application_time_sec()); - } - _vm_queue->set_drain_list(safepoint_ops); // ensure ops can be scanned SafepointSynchronize::begin(); @@ -477,12 +472,6 @@ // Complete safepoint synchronization SafepointSynchronize::end(); - if (PrintGCApplicationStoppedTime) { - gclog_or_tty->print_cr("Total time for which application threads " - "were stopped: %3.7f seconds", - RuntimeService::last_safepoint_time_sec()); - } - } else { // not a safepoint operation if (TraceLongCompiles) { elapsedTimer t; diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/services/runtimeService.cpp --- a/hotspot/src/share/vm/services/runtimeService.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/services/runtimeService.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -1,5 +1,5 @@ /* - * Copyright 2003-2006 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 @@ -104,6 +104,13 @@ void RuntimeService::record_safepoint_begin() { HS_DTRACE_PROBE(hs_private, safepoint__begin); + + // Print the time interval in which the app was executing + if (PrintGCApplicationConcurrentTime) { + gclog_or_tty->print_cr("Application time: %3.7f seconds", + last_application_time_sec()); + } + // update the time stamp to begin recording safepoint time _safepoint_timer.update(); if (UsePerfData) { @@ -122,6 +129,15 @@ void RuntimeService::record_safepoint_end() { HS_DTRACE_PROBE(hs_private, safepoint__end); + + // Print the time interval for which the app was stopped + // during the current safepoint operation. + if (PrintGCApplicationStoppedTime) { + gclog_or_tty->print_cr("Total time for which application threads " + "were stopped: %3.7f seconds", + last_safepoint_time_sec()); + } + // update the time stamp to begin recording app time _app_timer.update(); if (UsePerfData) { diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/utilities/globalDefinitions.hpp --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -139,6 +139,10 @@ const size_t G = M*K; const size_t HWperKB = K / sizeof(HeapWord); +const size_t LOG_K = 10; +const size_t LOG_M = 2 * LOG_K; +const size_t LOG_G = 2 * LOG_M; + const jint min_jint = (jint)1 << (sizeof(jint)*BitsPerByte-1); // 0x80000000 == smallest jint const jint max_jint = (juint)min_jint - 1; // 0x7FFFFFFF == largest jint diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/src/share/vm/utilities/taskqueue.hpp --- a/hotspot/src/share/vm/utilities/taskqueue.hpp Fri Mar 12 01:09:13 2010 +0000 +++ b/hotspot/src/share/vm/utilities/taskqueue.hpp Fri Mar 19 18:49:36 2010 -0700 @@ -133,6 +133,9 @@ // 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; } + + // Total size of queue. + static const uint total_size() { return N; } }; template class GenericTaskQueue: public TaskQueueSuper { diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/test/compiler/6663854/Test6663854.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/6663854/Test6663854.java Fri Mar 19 18:49:36 2010 -0700 @@ -0,0 +1,1521 @@ +/* + * 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 6663854 + * @summary assert(n != __null,"Bad immediate dominator info.") in C2 with -Xcomp + * + * @run main/othervm -Xcomp Test6663854 + */ + +// This is a randomly generated test that exposed a crash so don't try +// to make sense of what's it's doing. The output produced is likely +// to be stable but it is not being checked as part of this test. + +final class Test6663854_Class_0 { + final long var_1 = ((byte)1.2510591E38F & - ~ - - - ~3554133935918431232L) << 'g'; + final static long var_2 = 662144491976981504L; + static byte[] var_3; + static byte var_4; + static float var_5; + final short var_6 = 4156; + double var_7; + char var_8 = 'F'; + static long var_9; + char var_10; + + + public Test6663854_Class_0() + { + var_7 = (var_9 = (var_4 = (var_4 = (byte)~ -var_1))); + var_7 = (var_4 = (var_4 = (byte)(var_9 = 690685817))) + ~var_2; + long var_17 = 1755837857030316032L; + var_8 *= (var_7 = var_6); + { + var_4 = (var_4 = (byte)var_6); + } + var_5 = (var_4 = (var_4 = (var_4 = (var_4 = (byte)var_17)))); + if (false) + { + var_5 = var_6; + var_4 = (var_4 = (var_4 = (var_4 = (var_4 = (var_4 = (var_4 = (byte)3.2446162E38F)))))); + } + else + { + var_8 &= false ? var_6 : var_6; + } + ((new Test6663854_Class_0[(byte)+ (var_5 = (var_4 = (byte)'Q'))])[var_4 = (byte)396008820]).var_8++; + var_5 = (var_8 ^= var_6 >>> - (var_4 = (byte)var_6)) >= 360526660 ? var_8 : var_8; + } + + + + protected Object clone() + { + char var_11 = 'E'; + var_7 = 1.2181972357945285E308 + var_6 - + (var_7 = 1269180234) * 6.244754764669101E307; + var_7 = (var_4 = (var_4 = (var_4 = (var_4 = (var_4 = (byte)var_11))))); + { + var_4 = (var_4 = (var_4 = (byte)1016847968)); + (false & true ? "nmot" : "m").charAt((false || !true ? var_6 : var_6) * var_6); + var_8 |= var_8-- == (long)(var_7 = (byte)var_2 & ~var_2) ? (var_4 = (var_4 = (var_4 = (var_4 = (byte)1.5012703E38F)))) : (var_4 = (byte)4795604615834685440L); + ++var_11; + var_5 = (var_9 = (int)var_6 | 302324412 - 1720735728); + "yfkasl".replaceAll("xlvn" + "peedfph", "awfbuujts"); + } + var_9 = false ? var_6 : var_6; + { + final boolean var_12 = false; + } + var_5 = var_2; + { + var_9 = ((new byte[(byte)var_6][(byte)1.3719104187525612E308])[var_4 = (byte)var_1])[var_4 = (var_4 = (var_4 = (var_4 = (byte)2.2549062E38F)))] + 889886326; + } + var_9 = (var_2 | ~var_1) & 848602225; + { + var_4 = (var_4 = (var_4 = (var_4 = (byte)var_6))); + } + var_7 = var_6; + var_9 = var_6; + var_5 = (var_4 = (var_4 = (byte)var_8)); + var_7 = 964691433430251520L ^ var_6; + var_5 = ~2571981928559810560L; + return "yvetn".endsWith("dtgstxcu".toLowerCase()) | true | true ? (4.2416016638902373E307 != -3.1295498440444366E307 ? "p" : "ars") : (new Object[(byte)var_1])[(byte)(var_9 = 7519039949758987264L)]; + } + + public boolean equals(Object obj) + { + var_5 = 1445825238; + { + var_7 = 2.221982E38F; + } + { + var_9 = var_6; + } + var_7 = true ? (var_8 ^= (byte)3588201925057082368L) : (var_7 = var_8); + short var_13 = var_6; + var_4 = (var_4 = (var_4 = (var_4 = (var_4 = (byte)'L')))); + var_13--; + return true | !false; + } + + + protected char[] func_0() + { + if (!true ? !false : false) + { + var_8 %= -(new double[(byte)197311342][(byte)5.6183004E36F])[(byte)(var_5 = (var_9 = 'l'))][(byte)(var_7 = var_6)] * (1.9583867E38F * + (var_4 = (byte)1566742425)); + var_8 >>= ~6333520277515092992L | var_8; + } + else + { + new String(); + } + { + var_7 = (byte)5882830303456225280L % ((var_9 = var_6) << var_1); + } + var_7 = var_6; + float var_14; + var_14 = (var_4 = (var_4 = (byte)1081376784)); + var_8 -= 3.1929636E38F; + var_7 = 1.5931970715760934E308; + var_4 = true | (!false | (var_7 = 2.4773615E37F) < (byte)(short)825088022) ? (var_4 = (byte)4.3114896E37F) : (byte)var_8; + final int var_15 = var_6 >> 1197848918; + var_9 = var_15; + var_14 = 983699379; + var_9 = var_6; + return (new char[var_4 = (byte)3.593425789671245E307][(byte)1.6242754453980546E308])[var_4 = (byte)(var_9 = (var_4 = (byte)var_1))]; + } + + final void func_1(final int arg_0) + { + var_5 = 6370513305314412544L == -5.201821E37F ? 2.5220462E38F : (var_5 = (byte)'f'); + ((new Test6663854_Class_0[(byte)1250580004024059904L][(byte)(short)var_8])[(byte)(var_8 ^= 68680455462355968L)][var_4 = (var_4 = (byte)var_2)]).var_8 *= (char)(byte)(var_6 * var_6) <= - (var_7 = (var_7 = var_6)) ? ~5194741848806877184L : var_8; + var_5 = !"tshhykoap".endsWith("q") ? arg_0 : 'K'; + var_8 *= (var_8 -= (var_5 = - (var_5 = var_8))); + int var_16; + } + + public String toString() + { + String result = "[\n"; + result += "Test6663854_Class_0.var_8 = "; result += Test6663854.Printer.print(var_8); + result += "\n"; + result += "Test6663854_Class_0.var_10 = "; result += Test6663854.Printer.print(var_10); + result += "\n"; + result += "Test6663854_Class_0.var_3 = "; result += Test6663854.Printer.print(var_3); + result += "\n"; + result += "Test6663854_Class_0.var_1 = "; result += Test6663854.Printer.print(var_1); + result += "\n"; + result += "Test6663854_Class_0.var_2 = "; result += Test6663854.Printer.print(var_2); + result += "\n"; + result += "Test6663854_Class_0.var_9 = "; result += Test6663854.Printer.print(var_9); + result += "\n"; + result += "Test6663854_Class_0.var_7 = "; result += Test6663854.Printer.print(var_7); + result += "\n"; + result += "Test6663854_Class_0.var_5 = "; result += Test6663854.Printer.print(var_5); + result += "\n"; + result += "Test6663854_Class_0.var_6 = "; result += Test6663854.Printer.print(var_6); + result += "\n"; + result += "Test6663854_Class_0.var_4 = "; result += Test6663854.Printer.print(var_4); + result += ""; + result += "\n]"; + return result; + } +} + + +interface Test6663854_Interface_1 { + public boolean func_0(); + public String func_1(final String arg_0, final long arg_1, byte arg_2, char[][] arg_3); +} + + +interface Test6663854_Interface_2 extends Test6663854_Interface_1 { +} + + +final class Test6663854_Class_3 implements Test6663854_Interface_2, Test6663854_Interface_1 { + Object var_18; + long var_19; + static double var_20; + final static float var_21 = 2.0644203E38F; + Test6663854_Class_0 var_22; + final static byte var_23 = 110; + static boolean var_24 = false; + + + public Test6663854_Class_3() + { + Test6663854_Class_0.var_5 = new Test6663854_Class_0().var_6; + var_22 = (var_22 = (new Test6663854_Class_0[var_23])[var_23]); + Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = var_23)); + char var_37; + var_19 = var_23; + } + + + public boolean func_0() + { + if (var_24 = var_24) + { + Test6663854_Class_0.var_4 = var_24 ^ (var_24 || (var_24 = false)) ? var_23 : (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = var_23)); + } + else + { + ((Test6663854_Class_0)(var_18 = new Test6663854_Interface_1[Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = var_23)][var_23])).var_7 = ((var_22 = (var_22 = (Test6663854_Class_0)(var_18 = "uwt"))).var_8 >>>= (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = var_23))); + var_24 |= !false; + } + var_18 = (var_18 = "ymmk"); + if (var_24) + { + long var_25; + ((Test6663854_Class_0)(var_18 = "wsxqujs")).var_8 >>= 'F'; + var_24 ^= false; + } + else + { + { + (var_22 = (Test6663854_Class_0)(var_18 = (var_18 = (var_18 = "lrgiwpwet")))).var_8++; + } + { + var_18 = new String[Test6663854_Class_0.var_4 = var_23]; + } + { + new String(); + } + ((var_24 |= var_24) | true ^ false ? (var_22 = (Test6663854_Class_0)(var_18 = "rpmudju")) : (var_22 = (new Test6663854_Class_0[var_23])[var_23])).var_8--; + var_24 ^= var_24; + var_19 = 206416809; + var_20 = 1581809112; + Test6663854_Class_0 var_26; + Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = var_23); + } + byte var_27 = 29; + short var_28 = 24653; + var_22 = (var_22 = (var_22 = (Test6663854_Class_0)(var_18 = "umagt"))); + return var_24; + } + + public String func_1(final String arg_0, final long arg_1, byte arg_2, char[][] arg_3) + { + { + final Test6663854_Class_0 var_29 = (new Test6663854_Class_0[var_23])[arg_2]; + } + var_18 = (var_18 = (var_22 = (Test6663854_Class_0)(var_18 = arg_0))); + ++(var_22 = (Test6663854_Class_0)(var_18 = (Test6663854_Class_0)(var_18 = (var_18 = new char[var_23])))).var_8; + { + (var_22 = (var_22 = (Test6663854_Class_0)(var_18 = "xcj"))).var_8 |= arg_1 * (short)6.671469496987355E307; + Test6663854_Class_0.var_5 = false ? var_23 : 8012291795221583872L; + (var_24 ? (var_22 = (var_22 = (Test6663854_Class_0)(var_18 = arg_0))) : (var_22 = (Test6663854_Class_0)(var_18 = arg_3))).var_8--; + } + ((new String[var_23][var_23])[var_23][var_23]).compareTo(arg_0); + var_18 = (var_18 = arg_0); + var_24 &= (var_24 ^= true) & ! !false; + { + var_18 = "lok"; + } + float var_30 = 2.0346904E38F; + var_30 += ((Test6663854_Class_0)(var_18 = new float[var_23])).var_6 + 210775691; + final double var_31 = 8.865908414454469E307; + var_20 = 'm'; + var_22 = (Test6663854_Class_0)(var_18 = arg_0); + return arg_0; + } + + + protected Object clone() + { + ((Test6663854_Class_0)(var_18 = new short[var_23])).var_7 = 'M'; + if (var_24) + { + var_24 = false; + String var_32 = "luigad"; + ((Test6663854_Class_0.var_5 = 1.2920056E38F) > (Test6663854_Class_0.var_4 = var_23) ? (Test6663854_Class_0)(var_18 = new Test6663854_Interface_1[var_23][var_23]) : (var_22 = (var_22 = (Test6663854_Class_0)(var_18 = new byte[var_23])))).var_10 = 'A'; + (var_22 = (var_22 = (var_22 = (new Test6663854_Class_0[var_23][var_23])[var_23][var_23]))).var_8 /= ((var_22 = (Test6663854_Class_0)(var_18 = (new short[var_23][var_23][var_23])[var_23])).var_7 = 'h'); + (var_32 = var_32).toString(); + var_32.length(); + var_18 = (var_22 = (var_22 = new Test6663854_Class_0())); + } + else + { + Test6663854_Class_0.var_4 = var_23; + var_22 = (var_22 = (Test6663854_Class_0)(var_18 = "wbeuae")); + float var_33; + --(var_22 = (var_22 = (var_22 = (Test6663854_Class_0)(var_18 = (var_18 = "irl"))))).var_8; + } + Test6663854_Class_0.var_4 = var_23; + Test6663854_Class_0.var_5 = true ? ((Test6663854_Class_0)(var_18 = (var_18 = new boolean[Test6663854_Class_0.var_4 = var_23]))).var_8 : 'n'; + var_24 = (var_24 ^= ((var_22 = (Test6663854_Class_0)(var_18 = "g")).var_6 > ((Test6663854_Class_0)(var_18 = "")).var_6 ? var_24 : true) ? false : (var_24 = var_24)) ? var_24 : false; + var_22 = (var_22 = (var_22 = (Test6663854_Class_0)(var_18 = new Test6663854_Interface_2[var_23]))); + return var_18 = "qrlonljqj"; + } + + public boolean equals(Object obj) + { + Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = var_23))); + Test6663854_Class_0.var_5 = var_23 % (var_22 = (var_22 = (Test6663854_Class_0)obj)).var_6; + Test6663854_Class_0.var_5 = (((new Test6663854_Class_0[var_23][var_23][var_23])[var_23])[var_24 | (var_24 &= var_24) ? var_23 : (Test6663854_Class_0.var_4 = var_23)][var_23]).var_8; + var_22 = false ? (var_22 = (var_22 = (Test6663854_Class_0)obj)) : (var_22 = new Test6663854_Class_0()); + Test6663854_Class_0.var_5 = ((new Test6663854_Class_0[var_23])[Test6663854_Class_0.var_4 = var_23]).var_8; + if (! !var_24) + { + var_18 = ""; + (var_22 = (var_22 = (var_22 = (new Test6663854_Class_0[var_23])[Test6663854_Class_0.var_4 = var_23]))).var_8 >>= true ? ~ (Test6663854_Class_0.var_4 = var_23) : (var_22 = (Test6663854_Class_0)obj).var_8++; + (var_24 ? (Test6663854_Class_0)(var_18 = "") : (Test6663854_Class_0)obj).var_8 <<= var_23; + Test6663854_Class_0.var_4 = var_23; + var_20 = (var_22 = (var_22 = (var_22 = (var_22 = (Test6663854_Class_0)obj)))).var_8; + } + else + { + var_19 = ((Test6663854_Class_0)obj).var_6; + } + (var_24 ? "qyukxpui" : (new String[var_23])[Test6663854_Class_0.var_4 = var_23]).substring(612084215); + Test6663854_Class_0.var_5 = 'B'; + if (!false || false) + { + Test6663854_Class_0.var_4 = true & var_24 ? var_23 : var_23; + } + else + { + "eksoig".lastIndexOf('b' > (var_22 = (Test6663854_Class_0)obj).var_8 | 4782397447545636864L >= (short)'[' ? "qusgbf" : "kvmylvct"); + } + Test6663854_Class_0.var_5 = (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = var_23)) << var_23; + int var_34; + var_24 = (var_24 &= (var_24 &= true)); + var_22 = (var_22 = (var_22 = (var_22 = (Test6663854_Class_0)obj))); + Test6663854_Interface_1 var_35 = var_24 & ((var_24 &= var_24) ^ var_24) ? (new Test6663854_Interface_1[var_23])[var_23] : (new Test6663854_Interface_1[var_23][var_23])[var_23][var_23]; + long var_36 = 1042482863045573632L; + return var_24; + } + + + public String toString() + { + String result = "[\n"; + result += "Test6663854_Class_3.var_19 = "; result += Test6663854.Printer.print(var_19); + result += "\n"; + result += "Test6663854_Class_3.var_20 = "; result += Test6663854.Printer.print(var_20); + result += "\n"; + result += "Test6663854_Class_3.var_21 = "; result += Test6663854.Printer.print(var_21); + result += "\n"; + result += "Test6663854_Class_3.var_23 = "; result += Test6663854.Printer.print(var_23); + result += "\n"; + result += "Test6663854_Class_3.var_24 = "; result += Test6663854.Printer.print(var_24); + result += "\n"; + result += "Test6663854_Class_3.var_22 = "; result += Test6663854.Printer.print(var_22); + result += "\n"; + result += "Test6663854_Class_3.var_18 = "; result += Test6663854.Printer.print(var_18); + result += ""; + result += "\n]"; + return result; + } +} + + +final class Test6663854_Class_4 implements Test6663854_Interface_1, Test6663854_Interface_2 { + long var_38 = (Test6663854_Class_3.var_24 |= Test6663854_Class_3.var_23 < (short)+3417996718812544000L) ? ~543562136204028928L : 1593726438; + char var_39; + static Test6663854_Interface_2 var_40; + Test6663854_Class_3 var_41; + final short var_42 = false ? Test6663854_Class_3.var_23 : (short)~Test6663854_Class_0.var_2; + byte var_43; + static Test6663854_Interface_1[] var_44; + final char var_45 = 4.321821176880639E307 < var_42 ? 'o' : 'v'; + + + public Test6663854_Class_4() + { + Test6663854_Class_0.var_5 = 2137855185; + "nueqthqo".length(); + { + Test6663854_Class_0.var_9 = (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23)); + Object var_61; + } + String var_62 = "rirgfphe"; + ((new Test6663854_Class_3[Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23]).var_22 = ((var_41 = (var_41 = new Test6663854_Class_3())).var_22 = new Test6663854_Class_0()); + { + Test6663854_Class_0.var_5 = ((new Test6663854_Class_4[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_42; + new Test6663854_Class_0(); + var_41 = (var_41 = new Test6663854_Class_3()); + new Test6663854_Class_0().var_8 %= var_38; + (var_41 = ((new Test6663854_Class_3[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_22 = new Test6663854_Class_0(); + Test6663854_Class_0.var_4 = (Test6663854_Class_3.var_24 |= true) ? (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23) : Test6663854_Class_3.var_23; + Test6663854_Interface_1 var_63 = ((new Test6663854_Interface_1[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[var_43 = (var_43 = Test6663854_Class_3.var_23)])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23]; + (var_41 = (var_41 = (var_41 = (var_41 = (Test6663854_Class_3)var_63)))).var_18 = var_62; + } + if (Test6663854_Class_3.var_24 ^= false) + { + var_40 = (var_40 = new Test6663854_Class_3()); + } + else + { + var_62 = "agwqc"; + Test6663854_Class_3.var_24 ^= ((Test6663854_Class_3.var_24 ^= Test6663854_Class_3.var_24 && Test6663854_Class_3.var_24) & false ? false : !Test6663854_Class_3.var_24) ? false | (Test6663854_Class_3.var_24 &= Test6663854_Class_3.var_24) : (Test6663854_Class_3.var_24 &= (Test6663854_Class_3.var_24 |= ! (Test6663854_Class_3.var_24 |= true))); + var_38 *= (Test6663854_Class_3.var_20 = (Test6663854_Class_0.var_5 = var_42 + ((Test6663854_Class_3.var_20 = 5378782303770527744L) <= var_42 ? var_42 : var_42))); + } + var_38 &= ((var_41 = new Test6663854_Class_3()).var_22 = new Test6663854_Class_0()).var_6; + var_62 = var_62; + (var_41 = new Test6663854_Class_3()).var_18 = ((new Object[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = (var_43 = Test6663854_Class_3.var_23))]; + final short var_64 = (short)'C'; + ((var_41 = new Test6663854_Class_3()).var_22 = new Test6663854_Class_0()).var_8 /= ((var_41 = new Test6663854_Class_3()).var_22 = new Test6663854_Class_0()).var_6; + } + + + public boolean func_0() + { + final boolean var_46 = false; + return Test6663854_Class_3.var_24; + } + + public String func_1(final String arg_0, final long arg_1, byte arg_2, char[][] arg_3) + { + { + --(false ? new Test6663854_Class_0() : new Test6663854_Class_0()).var_8; + "d".substring(Test6663854_Class_3.var_23 - (arg_2 /= + (Test6663854_Class_3.var_20 = 1483190006) * (Test6663854_Class_3.var_20 = ~Test6663854_Class_3.var_23)), 496015226); + { + var_41 = new Test6663854_Class_3(); + } + var_38 ^= (! ((Test6663854_Class_3.var_24 = Test6663854_Class_3.var_24) && (new boolean[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]) ? arg_1 : (var_39 = var_45)) / var_45; + var_38 -= (Test6663854_Class_3.var_20 = (new short[Test6663854_Class_3.var_23])[arg_2]) != (arg_2 ^= new Test6663854_Class_0().var_6 & - (var_38 /= (Test6663854_Class_0.var_5 = var_38))) ? (Test6663854_Class_0.var_5 = - -Test6663854_Class_3.var_21) : arg_2; + var_41 = new Test6663854_Class_3(); + var_40 = Test6663854_Class_3.var_24 ? new Test6663854_Class_3() : new Test6663854_Class_3(); + } + int var_47; + (var_41 = new Test6663854_Class_3()).var_18 = "qvph"; + { + ++arg_2; + } + final Test6663854_Class_3 var_48 = new Test6663854_Class_3(); + { + var_48.var_22 = (Test6663854_Class_0)((var_41 = var_48).var_18 = (var_48.var_22 = (Test6663854_Class_0)(var_48.var_18 = new String[Test6663854_Class_3.var_23]))); + { + final float[] var_49 = (new float[Test6663854_Class_3.var_23][arg_2])[arg_2]; + } + "lcfxrlilw".replace(var_45, (char)(false ? (short)2998890687978943488L : var_42)); + arg_0.lastIndexOf("mx"); + final Test6663854_Class_0 var_50 = var_48.var_22 = (var_48.var_22 = (Test6663854_Class_0)((var_41 = var_48).var_18 = var_48)); + new String(); + ((Test6663854_Class_3)(var_40 = (var_40 = (var_41 = var_48)))).var_22 = var_50; + var_50.var_8 |= arg_2; + Test6663854_Class_3.var_20 = + - (Test6663854_Class_3.var_20 = var_42) - var_45 * Test6663854_Class_3.var_21; + double var_51 = false ? 1.6389923323715952E308 : (var_39 = var_45); + (((new Test6663854_Class_3[arg_2][arg_2])[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_18 = (var_48.var_18 = new Test6663854_Class_0[arg_2 %= 2090054678][arg_2]); + } + { + var_47 = (arg_2 |= (((new Test6663854_Class_4[arg_2][arg_2][arg_2])[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]).var_42); + } + ((new Test6663854_Class_4[arg_2][Test6663854_Class_3.var_23])[++arg_2][arg_2 <<= 'c']).var_41 = var_48; + var_41 = var_48; + Test6663854_Class_3.var_24 = Test6663854_Class_3.var_24 & Test6663854_Class_3.var_24; + final boolean var_52 = false; + { + var_40 = (var_41 = (var_41 = var_48)); + (false ? var_48 : var_48).var_18 = ((new Test6663854_Class_0[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23][arg_2])[arg_2])[++arg_2][(byte)203097731]; + var_41 = (var_41 = var_48); + } + var_38 |= (short)Test6663854_Class_3.var_23; + var_40 = var_48; + { + arg_0.indexOf("lnf", var_47 = (((Test6663854_Class_0)(var_48.var_18 = arg_0)).var_8 <<= (var_39 = var_45))); + } + final boolean var_53 = true & 1.4130067467800934E308 < (arg_2 |= 'W'); + var_48.var_18 = (var_41 = var_48); + (var_48.var_22 = new Test6663854_Class_0()).var_7 = Test6663854_Class_3.var_23; + Test6663854_Class_3.var_24 ^= (Test6663854_Class_3.var_24 || var_52) ^ ("axg".startsWith(arg_0, var_47 = (var_47 = var_45)) | var_52); + { + Test6663854_Class_0.var_5 = 275192701; + } + Test6663854_Interface_2 var_54; + if (true) + { + var_54 = (var_41 = (var_41 = (var_41 = var_48))); + } + else + { + ((Test6663854_Class_0)((var_41 = var_48).var_18 = (var_41 = var_48))).var_7 = var_42; + } + Test6663854_Class_0.var_5 = --arg_2; + ((new String[Test6663854_Class_3.var_23])[var_53 ? arg_2 : arg_2]).length(); + return arg_0 + "qj"; + } + + + + + final String func_0(byte arg_0, Test6663854_Class_0 arg_1, final Test6663854_Class_0 arg_2, final Object arg_3) + { + arg_2.var_7 = (new long[arg_0][arg_0])[Test6663854_Class_3.var_23][arg_0 >>>= 1960882886] % arg_0; + Object var_55 = (((new Test6663854_Class_4[Test6663854_Class_3.var_23])[--arg_0]).var_41 = new Test6663854_Class_3()).var_18 = (Test6663854_Class_3.var_24 = Test6663854_Class_3.var_24 ? (Test6663854_Class_3.var_24 |= (Test6663854_Class_3.var_24 &= true)) : Test6663854_Class_3.var_24 | Test6663854_Class_3.var_24) ? (var_41 = (var_41 = (Test6663854_Class_3)arg_3)) : arg_3; + var_38 >>= ((Test6663854_Class_3.var_24 = (Test6663854_Class_3.var_24 ^= Test6663854_Class_3.var_24)) | (Test6663854_Class_3.var_24 ^= Test6663854_Class_3.var_24) ? arg_2.var_6 : (arg_0 -= 1.2264686416488313E308)) != (((new Test6663854_Class_4[arg_0])[arg_0]).var_38 >>>= arg_2.var_8) ? Test6663854_Class_3.var_23 : arg_0; + arg_0 += 1826349110 / (Test6663854_Class_0.var_5 = arg_0) + Test6663854_Class_3.var_21; + (var_41 = !Test6663854_Class_3.var_24 ? (var_41 = (new Test6663854_Class_3[arg_0])[arg_0]) : (new Test6663854_Class_3[--arg_0])[arg_0]).var_22 = ((new Test6663854_Class_0[arg_0][(byte)9.18575257519393E307][Test6663854_Class_3.var_23])[arg_0])[Test6663854_Class_3.var_23][arg_0]; + (var_41 = new Test6663854_Class_3()).var_22 = ((var_41 = (var_41 = (var_41 = (var_41 = (var_41 = (Test6663854_Class_3)arg_3))))).var_22 = (arg_1 = arg_2)); + Test6663854_Class_3.var_20 = Test6663854_Class_3.var_21; + var_40 = (var_41 = (Test6663854_Class_3)(new Test6663854_Interface_2[Test6663854_Class_3.var_23])[arg_0]); + Test6663854_Class_0.var_5 = Test6663854_Class_3.var_24 || (Test6663854_Class_3.var_24 = (Test6663854_Class_3.var_24 &= true)) ? var_42 : arg_1.var_6; + Test6663854_Class_0.var_5 = arg_0; + { + arg_0 %= (short)var_45; + } + var_55 = arg_1; + var_40 = (var_41 = (Test6663854_Class_3.var_24 = false) ? (Test6663854_Class_3)var_55 : (Test6663854_Class_3)arg_3); + ((Test6663854_Class_3.var_24 &= (Test6663854_Class_3.var_20 = arg_0) == 2.2107098E38F) ? (Test6663854_Class_3)(new Test6663854_Interface_1[Test6663854_Class_3.var_23])[arg_0] : (Test6663854_Class_3)(var_55 = "unofratwy")).var_18 = var_55; + return ""; + } + + private static String func_1(final String arg_0, char arg_1, final boolean arg_2, Test6663854_Class_3 arg_3) + { + if (!false & Test6663854_Class_3.var_24) + { + char var_56 = 'C'; + } + else + { + var_40 = (var_40 = (var_40 = arg_3)); + } + ((new Test6663854_Class_0[Test6663854_Class_3.var_23][Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23][Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23]).var_7 = 2.4396145E38F + (((new Test6663854_Class_4[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23][(byte)Test6663854_Class_0.var_2]).var_43 = Test6663854_Class_3.var_23); + if (Test6663854_Class_3.var_24) + { + arg_3 = arg_3; + } + else + { + arg_3 = (arg_3 = arg_3); + } + ((new Test6663854_Class_4[Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23))])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23]).var_38 /= '`'; + arg_3 = (arg_3 = arg_3); + new Test6663854_Class_0().var_8++; + return "qd"; + } + + private Object func_2(short[][] arg_0, final Test6663854_Interface_2 arg_1) + { + boolean var_57 = false; + Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23; + var_40 = arg_1; + ((var_41 = (var_41 = (var_41 = (Test6663854_Class_3)arg_1))).var_22 = (Test6663854_Class_0)(((Test6663854_Class_3)arg_1).var_18 = "dxrwk")).var_7 = 'c'; + if (true) + { + var_40 = (var_40 = arg_1); + } + else + { + var_39 = 'Z'; + } + Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23; + var_41 = (Test6663854_Class_3)arg_1; + return (var_57 ? (Test6663854_Class_3.var_20 = Test6663854_Class_3.var_23) % 1271549437 : 1.1177259470512304E308) <= 1363316667 ? (new Test6663854_Class_3().var_18 = new String[var_43 = Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]) : new Test6663854_Class_0(); + } + + private short func_3() + { + int var_58 = true ? var_42 : 1438975079; + float var_59 = Test6663854_Class_3.var_21; + var_43 = Test6663854_Class_3.var_23; + (var_41 = (Test6663854_Class_3)(new Test6663854_Interface_1[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_22 = (Test6663854_Class_3.var_24 |= Test6663854_Class_3.var_24) ? new Test6663854_Class_0() : new Test6663854_Class_0(); + var_58++; + return Test6663854_Class_3.var_24 ? var_42 : (var_43 = Test6663854_Class_3.var_23); + } + + protected void func_4(final long arg_0, Test6663854_Class_0 arg_1, long arg_2) + { + ++arg_2; + (arg_1 = (arg_1 = (arg_1 = arg_1))).var_8 /= var_42; + --arg_2; + final Test6663854_Interface_1 var_60 = ((new Test6663854_Interface_1[Test6663854_Class_3.var_23][Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23])[var_43 = Test6663854_Class_3.var_23])[var_43 = Test6663854_Class_3.var_23]; + (true ? (Test6663854_Class_3)var_60 : (Test6663854_Class_3)var_60).var_22 = (Test6663854_Class_0)((var_41 = (Test6663854_Class_3)(var_40 = (Test6663854_Class_3)var_60)).var_18 = (Test6663854_Class_3.var_24 ^= Test6663854_Class_3.var_23 == var_38) ? "xo" : "uocm"); + var_38 >>= (((Test6663854_Class_3)(new Test6663854_Interface_2[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_22 = (new Test6663854_Class_0[Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23)]).var_8++; + } + + public String toString() + { + String result = "[\n"; + result += "Test6663854_Class_4.var_39 = "; result += Test6663854.Printer.print(var_39); + result += "\n"; + result += "Test6663854_Class_4.var_45 = "; result += Test6663854.Printer.print(var_45); + result += "\n"; + result += "Test6663854_Class_4.var_44 = "; result += Test6663854.Printer.print(var_44); + result += "\n"; + result += "Test6663854_Class_4.var_38 = "; result += Test6663854.Printer.print(var_38); + result += "\n"; + result += "Test6663854_Class_4.var_40 = "; result += Test6663854.Printer.print(var_40); + result += "\n"; + result += "Test6663854_Class_4.var_42 = "; result += Test6663854.Printer.print(var_42); + result += "\n"; + result += "Test6663854_Class_4.var_43 = "; result += Test6663854.Printer.print(var_43); + result += "\n"; + result += "Test6663854_Class_4.var_41 = "; result += Test6663854.Printer.print(var_41); + result += ""; + result += "\n]"; + return result; + } +} + + +class Test6663854_Class_5 implements Test6663854_Interface_1 { + final static char var_65 = 'S'; + static Test6663854_Interface_2 var_66; + static Test6663854_Class_3 var_67; + + + public Test6663854_Class_5() + { + { + ((new Test6663854_Class_4[Test6663854_Class_3.var_23][Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23)])[((Test6663854_Class_4)(new Object[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_43 = Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]).func_0(); + } + Test6663854_Class_0.var_5 = 1409421143; + Test6663854_Class_3.var_24 &= (Test6663854_Class_3.var_24 = false); + Test6663854_Class_0.var_5 = 3.1496384E38F / (((new Test6663854_Class_4[Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23]).var_45 - (Test6663854_Class_3.var_23 + Test6663854_Class_3.var_23)); + ((new Test6663854_Class_3[Test6663854_Class_3.var_23][Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]).var_18 = (new Object[Test6663854_Class_3.var_23][Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]; + var_66 = (Test6663854_Class_4.var_40 = (Test6663854_Class_3.var_24 = (Test6663854_Class_3.var_24 = Test6663854_Class_3.var_24)) || false ? new Test6663854_Class_3() : new Test6663854_Class_3()); + } + + + public boolean func_0() + { + { + Test6663854_Class_4.var_40 = (new Test6663854_Class_4[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]; + } + Test6663854_Class_0.var_5 = (new char[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]; + var_66 = (Test6663854_Class_4.var_40 = new Test6663854_Class_3()); + Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23; + ((var_67 = (var_67 = new Test6663854_Class_3())).var_22 = (Test6663854_Class_0)(new Test6663854_Class_3().var_18 = (new Test6663854_Class_3().var_22 = (new Test6663854_Class_3().var_22 = new Test6663854_Class_0())))).var_8++; + Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23; + return (Test6663854_Class_3.var_24 &= Test6663854_Class_3.var_24) ? (Test6663854_Class_3.var_24 = Test6663854_Class_3.var_24) : (Test6663854_Class_3.var_24 = true); + } + + public String func_1(final String arg_0, final long arg_1, byte arg_2, char[][] arg_3) + { + ((true | (Test6663854_Class_3.var_24 |= true)) ^ false ? (new Test6663854_Class_0[(byte)arg_1])[arg_2--] : new Test6663854_Class_0()).var_8 <<= 2320675830599883776L; + arg_2 -= ~ (Test6663854_Class_3.var_24 ? ~4954934861909065728L : 5155213238651986944L); + ((Test6663854_Class_4)((new Test6663854_Interface_1[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[arg_2 >>>= 1308733456])[Test6663854_Class_3.var_23]).var_43 = arg_2; + Test6663854_Class_0.var_5 = Test6663854_Class_3.var_21; + { + String var_68; + float var_69 = Test6663854_Class_3.var_21 * new Test6663854_Class_0().var_6; + ++arg_2; + Test6663854_Class_0.var_9 = arg_2; + --arg_2; + var_68 = arg_0; + final long[] var_70 = new long[arg_2 /= 8889610108908524544L]; + Test6663854_Class_4 var_71; + } + new Test6663854_Class_4().var_38++; + Test6663854_Class_3 var_72; + (((new Test6663854_Class_4[arg_2 *= var_65][Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[arg_2])[arg_2 ^= arg_2][Test6663854_Class_3.var_23]).var_38--; + new Test6663854_Class_3(); + (((new Test6663854_Class_4[arg_2 /= 7.692983E37F][Test6663854_Class_3.var_23])[arg_2])[Test6663854_Class_3.var_23]).var_38 |= arg_1; + Test6663854_Class_3.var_24 ^= "dlhn".startsWith(true ? "tad" : "bssdfvig", 1125165775) ? Test6663854_Class_3.var_24 : true; + Test6663854_Class_3.var_20 = new Test6663854_Class_0().var_8; + Test6663854_Class_4.var_40 = (Test6663854_Class_4.var_40 = (new Test6663854_Class_4[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]); + var_72 = (new Test6663854_Class_3[Test6663854_Class_3.var_23][arg_2])[arg_2][arg_2]; + Test6663854_Class_0.var_5 = 8634870161778523136L; + { + Test6663854_Class_0.var_5 = ~4420139622226571264L; + Test6663854_Class_3.var_24 &= (var_72 = (var_67 = (new Test6663854_Class_3[arg_2][Test6663854_Class_3.var_23])[arg_2][arg_2])).func_0(); + arg_2 >>= false ? 'H' : ']'; + } + switch (arg_2) + { + case 72: + String var_73 = arg_0; + break; + + default: + + } + ((Test6663854_Class_0)((var_72 = (Test6663854_Class_3)(new Test6663854_Interface_1[Test6663854_Class_3.var_23])[arg_2]).var_18 = (Test6663854_Class_4)(new Test6663854_Interface_2[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23])).var_7 = ((new Test6663854_Class_0[arg_2])[arg_2]).var_6 + Test6663854_Class_3.var_23; + var_67 = (var_67 = (new Test6663854_Class_3[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[(byte)7.184837949183326E307][arg_2 ^= 2188582676874919936L]); + return ((Test6663854_Class_3.var_24 = new Test6663854_Class_0().var_6 >= (short)3.4944631475014644E307) ? Test6663854_Class_3.var_24 : (Test6663854_Class_3.var_24 ? (Test6663854_Class_3.var_24 = false) : !Test6663854_Class_3.var_24)) ? "y" : arg_0; + } + + + + + private final static float func_0(boolean arg_0) + { + { + new String(); + { + new String(); + } + ((Test6663854_Class_3)(new Object[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[(new byte[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]][Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23]).var_18 = (new Object[Test6663854_Class_3.var_23][Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23])[(byte)1.577204008065932E308][Test6663854_Class_3.var_23]; + int var_74; + new String(); + Test6663854_Class_0.var_5 = ((Test6663854_Class_0)(new Object[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_1; + new String(); + new String(); + new String(); + var_74 = '_'; + new Test6663854_Class_0(); + Test6663854_Class_3 var_75 = var_67 = (((new Test6663854_Class_4[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_41 = (new Test6663854_Class_3[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]); + } + if (Test6663854_Class_3.var_24 &= (Test6663854_Class_3.var_24 &= Test6663854_Class_3.var_24)) + { + new String(); + arg_0 &= ~ (((new Test6663854_Class_4[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_38 /= Test6663854_Class_3.var_23) < 2.1129417E38F; + } + else + { + Test6663854_Class_3.var_24 &= false & arg_0 ? false : (Test6663854_Class_3.var_24 &= true); + } + new Test6663854_Class_0().var_8 ^= 682270015; + Test6663854_Class_4.var_40 = (Test6663854_Class_4)(new Test6663854_Interface_2[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]; + new Test6663854_Class_0(); + new String(); + new Test6663854_Class_0(); + new Test6663854_Class_3().var_22 = new Test6663854_Class_0(); + Test6663854_Class_4.var_40 = (new Test6663854_Class_4[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]; + new Test6663854_Class_0().var_8++; + new Test6663854_Class_0(); + Test6663854_Interface_1 var_76; + return Test6663854_Class_3.var_21; + } + + public String toString() + { + String result = "[\n"; + result += "Test6663854_Class_5.var_65 = "; result += Test6663854.Printer.print(var_65); + result += "\n"; + result += "Test6663854_Class_5.var_66 = "; result += Test6663854.Printer.print(var_66); + result += "\n"; + result += "Test6663854_Class_5.var_67 = "; result += Test6663854.Printer.print(var_67); + result += ""; + result += "\n]"; + return result; + } +} + + +class Test6663854_Class_6 implements Test6663854_Interface_1, Test6663854_Interface_2 { + static long var_77; + final byte var_78 = Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23; + long var_79; + static Test6663854_Class_4 var_80; + static long var_81 = 1365276905537306624L; + static Test6663854_Class_3 var_82; + + + public Test6663854_Class_6() + { + Test6663854_Class_0.var_5 = Test6663854_Class_3.var_24 ? "bdouannkn".charAt(373674594) : (char)2612074035904901120L; + if (Test6663854_Class_3.var_24) + { + ++var_81; + Test6663854_Class_0.var_4 = (new byte[Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23)])[var_78]; + var_81++; + } + else + { + (var_80 = (Test6663854_Class_4)(new Test6663854_Interface_1[Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = var_78]).var_41 = (((Test6663854_Class_4)(new Object[Test6663854_Class_3.var_23])[var_78]).var_41 = new Test6663854_Class_3()); + var_81--; + ((new Test6663854_Class_0[var_78])[var_78]).equals((Test6663854_Class_5.var_67 = (Test6663854_Class_3)(new Test6663854_Interface_2[var_78])[var_78]).var_18 = Test6663854_Class_3.var_23 <= var_78 ? "uvoxke" : new String()); + { + Test6663854_Class_5.var_66 = (new Test6663854_Interface_2[var_78])[((new Test6663854_Class_6[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_78]; + } + "huxqcdmii".compareTo("owtdmma"); + Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23))); + var_81--; + } + { + Test6663854_Class_5[][] var_85; + } + Test6663854_Class_5.var_66 = (new Test6663854_Interface_2[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]; + if (Test6663854_Class_3.var_24 || Test6663854_Class_3.var_24) + { + var_82 = (new Test6663854_Class_3[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[var_78][Test6663854_Class_3.var_23]; + Test6663854_Class_0.var_5 = ++var_81; + Test6663854_Class_0.var_5 = Test6663854_Class_3.var_24 ? 'n' : Test6663854_Class_5.var_65; + } + else + { + new Test6663854_Class_0(); + } + Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23); + Test6663854_Class_5.var_66 = new Test6663854_Class_3(); + Test6663854_Class_3 var_86 = (var_80 = (var_80 = (var_80 = (new Test6663854_Class_4[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]))).var_41 = (var_82 = (Test6663854_Class_5.var_67 = ((new Test6663854_Class_3[Test6663854_Class_3.var_23][var_78][Test6663854_Class_3.var_23])[var_78])[var_78][Test6663854_Class_3.var_23])); + Test6663854_Class_3.var_24 &= (Test6663854_Class_3.var_24 = Test6663854_Class_3.var_24) ? (Test6663854_Class_3.var_24 = Test6663854_Class_3.var_24) : (Test6663854_Class_3.var_24 &= Test6663854_Class_3.var_24); + var_86.var_22 = (new Test6663854_Class_0[var_78][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][var_78]; + (Test6663854_Class_3.var_24 ? "evayayw" : "ndcq").startsWith("hwlik" + "tnhfsky"); + var_86 = var_86; + } + + + public boolean func_0() + { + Test6663854_Class_4.var_40 = (Test6663854_Class_5.var_67 = (new Test6663854_Class_3[var_78])[Test6663854_Class_3.var_23]); + return Test6663854_Class_0.var_2 != (((new Test6663854_Class_0[var_78])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23]).var_7 = Test6663854_Class_3.var_23); + } + + public String func_1(final String arg_0, final long arg_1, byte arg_2, char[][] arg_3) + { + Test6663854_Class_3.var_24 |= Test6663854_Class_3.var_24; + Test6663854_Class_0.var_5 = var_78; + char var_83; + (Test6663854_Class_5.var_67 = (Test6663854_Class_5.var_67 = (Test6663854_Class_3)(new Test6663854_Interface_1[var_78])[Test6663854_Class_3.var_23])).var_18 = new Test6663854_Class_0[arg_2]; + Test6663854_Class_4 var_84; + var_81++; + return arg_0; + } + + + + public String toString() + { + String result = "[\n"; + result += "Test6663854_Class_6.var_77 = "; result += Test6663854.Printer.print(var_77); + result += "\n"; + result += "Test6663854_Class_6.var_79 = "; result += Test6663854.Printer.print(var_79); + result += "\n"; + result += "Test6663854_Class_6.var_81 = "; result += Test6663854.Printer.print(var_81); + result += "\n"; + result += "Test6663854_Class_6.var_78 = "; result += Test6663854.Printer.print(var_78); + result += "\n"; + result += "Test6663854_Class_6.var_80 = "; result += Test6663854.Printer.print(var_80); + result += "\n"; + result += "Test6663854_Class_6.var_82 = "; result += Test6663854.Printer.print(var_82); + result += ""; + result += "\n]"; + return result; + } +} + + +final class Test6663854_Class_7 extends Test6663854_Class_5 implements Test6663854_Interface_2 { + final float var_87 = 1.1671899E38F; + static char var_88 = var_65; + float var_89 = 2.166908E37F; + + + public Test6663854_Class_7() + { + var_88--; + (Test6663854_Class_5.var_67 = (new Test6663854_Class_3[Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23]).equals(((Test6663854_Class_3)(Test6663854_Class_4.var_40 = (new Test6663854_Class_4[Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23])).var_18 = "nycb"); + Test6663854_Class_3.var_24 = (Test6663854_Class_3.var_24 |= Test6663854_Class_3.var_24 ^ false); + Test6663854_Class_3.var_24 ^= true; + var_88--; + Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_4)(new Test6663854_Interface_1[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]); + if (false) + { + Test6663854_Class_4.var_40 = (new Test6663854_Interface_2[Test6663854_Class_3.var_23])[((new Test6663854_Class_6[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_78]; + } + else + { + --Test6663854_Class_6.var_81; + } + Test6663854_Class_6.var_81--; + ++Test6663854_Class_6.var_81; + if (Test6663854_Class_3.var_24 = !Test6663854_Class_3.var_24) + { + --var_88; + Test6663854_Class_5.var_66 = (new Test6663854_Class_4[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]; + Test6663854_Class_6.var_81 &= 1451013276; + var_88--; + } + else + { + var_88 >>= --var_88; + } + Test6663854_Class_3.var_24 &= Test6663854_Class_3.var_24; + Test6663854_Class_6.var_81--; + Test6663854_Class_6.var_81++; + --Test6663854_Class_6.var_81; + ((new Test6663854_Class_4[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]).var_41 = new Test6663854_Class_3(); + } + + + + + public final Test6663854_Class_4 func_0(int arg_0) + { + --arg_0; + { + switch ((char)var_89) + { + case 'R': + + } + ++(Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (new Test6663854_Class_4[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]))).var_38; + ++var_88; + Test6663854_Class_5.var_66 = ~Test6663854_Class_6.var_81 % Test6663854_Class_6.var_81 != (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23) ? (Test6663854_Class_6.var_82 = (var_67 = new Test6663854_Class_3())) : new Test6663854_Class_3(); + } + (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_4)(new Test6663854_Interface_2[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])).var_38 &= new Test6663854_Class_0().var_6; + Test6663854_Interface_1 var_90 = ((new Test6663854_Interface_1[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23]; + (Test6663854_Class_5.var_67 = (new Test6663854_Class_3[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_22 = new Test6663854_Class_0(); + if (true) + { + ((Test6663854_Class_3)(Test6663854_Interface_2)var_90).var_18 = (((Test6663854_Class_3)var_90).var_22 = new Test6663854_Class_0()); + } + else + { + ++((Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_4)var_90)).var_45 > 7.093005581228189E307 ? (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_4)var_90)) : (Test6663854_Class_4)(var_90 = (Test6663854_Class_3)var_90)).var_38; + } + var_67 = (Test6663854_Class_3.var_24 ^= true) ^ true ? (Test6663854_Class_6.var_82 = (Test6663854_Class_3)var_90) : (Test6663854_Class_3)var_90; + { + { + var_90 = (var_90 = (Test6663854_Class_5)var_90); + } + Test6663854_Class_3.var_24 ^= (Test6663854_Class_3.var_24 = (Test6663854_Class_3.var_24 ? !false : true) ? (Test6663854_Class_3.var_24 &= (Test6663854_Class_3.var_24 = (Test6663854_Class_3.var_24 = Test6663854_Class_3.var_24))) : ! !Test6663854_Class_3.var_24 && false); + Test6663854_Class_0 var_91; + Test6663854_Class_4.var_40 = (Test6663854_Class_3.var_24 |= (Test6663854_Class_3.var_24 |= Test6663854_Class_3.var_24) && (Test6663854_Class_3.var_24 |= Test6663854_Class_3.var_24) | ! (Test6663854_Class_3.var_24 ^= Test6663854_Class_3.var_24)) ? (+Test6663854_Class_3.var_21 != 4.6479454E37F ? (Test6663854_Class_6)(Test6663854_Interface_2)var_90 : (Test6663854_Class_6)var_90) : (new Test6663854_Class_6[Test6663854_Class_3.var_23])[((Test6663854_Class_6)(Test6663854_Class_5.var_66 = (Test6663854_Interface_2)var_90)).var_78]; + } + arg_0 |= ((((Test6663854_Class_6.var_80 = (Test6663854_Class_4)var_90).var_41 = (((Test6663854_Class_4)var_90).var_41 = (Test6663854_Class_3)var_90)).var_22 = new Test6663854_Class_0()).var_8 += (Test6663854_Class_3.var_20 = new Test6663854_Class_0().var_1)); + { + (Test6663854_Class_6.var_82 = (new Test6663854_Class_3[((Test6663854_Class_6)var_90).var_78])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23]).var_18 = ((Test6663854_Class_3.var_24 ^ (!false & Test6663854_Class_3.var_24 ? Test6663854_Class_3.var_24 : (Test6663854_Class_3.var_24 ^= true)) ? (Test6663854_Class_3)var_90 : (Test6663854_Class_3)(Test6663854_Interface_2)var_90).var_18 = ((Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_4)var_90)).var_41 = (Test6663854_Class_3)(((Test6663854_Class_3)(Test6663854_Class_5.var_66 = (Test6663854_Class_3)var_90)).var_18 = (((Test6663854_Class_3)(Test6663854_Interface_2)var_90).var_18 = (Test6663854_Class_3)var_90)))); + } + { + arg_0++; + } + Test6663854_Interface_2 var_92; + { + ((Test6663854_Class_5.var_67 = ((Test6663854_Class_6.var_80 = (Test6663854_Class_4)(var_92 = (Test6663854_Class_3)var_90)).var_41 = (Test6663854_Class_5.var_67 = (Test6663854_Class_3)var_90))).var_22 = ((Test6663854_Class_5.var_67 = (new Test6663854_Class_3[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_22 = ((Test6663854_Class_6.var_82 = (((Test6663854_Class_4)var_90).var_41 = (Test6663854_Class_3)var_90)).var_22 = (Test6663854_Class_0)((Test6663854_Class_5.var_67 = (Test6663854_Class_3)var_90).var_18 = (Test6663854_Class_5)var_90)))).var_7 = Test6663854_Class_3.var_21; + } + arg_0 &= ((var_67 = (var_67 = new Test6663854_Class_3())).var_22 = (new Test6663854_Class_0[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_1 / 2084775982; + Test6663854_Class_3.var_20 = (Test6663854_Class_3.var_24 = false) ^ true ? Test6663854_Class_0.var_2 : var_88; + return Test6663854_Class_6.var_80 = (new Test6663854_Class_4[Test6663854_Class_3.var_23])[((Test6663854_Class_6)var_90).var_78]; + } + + public String toString() + { + String result = "[\n"; + result += "Test6663854_Class_7.var_65 = "; result += Test6663854.Printer.print(var_65); + result += "\n"; + result += "Test6663854_Class_7.var_88 = "; result += Test6663854.Printer.print(var_88); + result += "\n"; + result += "Test6663854_Class_7.var_87 = "; result += Test6663854.Printer.print(var_87); + result += "\n"; + result += "Test6663854_Class_7.var_89 = "; result += Test6663854.Printer.print(var_89); + result += "\n"; + result += "Test6663854_Class_7.var_66 = "; result += Test6663854.Printer.print(var_66); + result += "\n"; + result += "Test6663854_Class_7.var_67 = "; result += Test6663854.Printer.print(var_67); + result += ""; + result += "\n]"; + return result; + } +} + + +final class Test6663854_Class_8 implements Test6663854_Interface_1 { + long var_93 = ++Test6663854_Class_6.var_81; + short var_94 = (short)'H'; + float var_95; + Test6663854_Interface_1 var_96; + final static float var_97 = 2.43397E38F; + final static long var_98 = 7461452158234510336L; + static Test6663854_Class_7[] var_99; + + + public Test6663854_Class_8() + { + Test6663854_Class_6 var_103; + Test6663854_Class_3.var_20 = (Test6663854_Class_3.var_20 = var_94 / ~Test6663854_Class_3.var_23); + if (false) + { + Test6663854_Class_3.var_24 = Test6663854_Class_3.var_24; + } + else + { + Test6663854_Class_3.var_20 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23); + --Test6663854_Class_7.var_88; + } + final boolean[] var_104 = new boolean[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23]; + Test6663854_Class_3.var_24 &= false & (Test6663854_Class_3.var_24 = Test6663854_Class_3.var_24); + } + + + public boolean func_0() + { + Test6663854_Class_7.var_88--; + Test6663854_Class_7.var_88--; + (((new Test6663854_Class_0[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_7 = 1.2337083709828518E307; + Test6663854_Class_7.var_88++; + if (Test6663854_Class_3.var_24) + { + byte var_100 = 25; + "lwmbav".toLowerCase(); + Test6663854_Class_3.var_24 |= (Test6663854_Class_3.var_24 |= false) & ((Test6663854_Class_3.var_24 = true) ^ Test6663854_Class_3.var_24 ? (Test6663854_Class_3.var_24 ^= Test6663854_Class_3.var_24) : Test6663854_Class_3.var_24); + } + else + { + long var_101; + new Test6663854_Class_0().var_7 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23); + Test6663854_Class_7.var_88++; + ++Test6663854_Class_6.var_81; + Test6663854_Class_7.var_88 |= 1083041050566936576L; + Test6663854_Class_7.var_88--; + } + var_94 ^= (var_94 = (var_94 *= 1.9072213520938263E307)); + var_94++; + boolean var_102 = true; + ++Test6663854_Class_7.var_88; + Test6663854_Class_7.var_88 += (((new Test6663854_Class_7[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]).var_87; + ((new Test6663854_Class_7[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_89 /= (new double[Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23] * var_97; + return (Test6663854_Class_3.var_24 = (var_102 &= Test6663854_Class_3.var_24 & true)) ? false : Test6663854_Class_3.var_24; + } + + public String func_1(final String arg_0, final long arg_1, byte arg_2, char[][] arg_3) + { + Test6663854_Class_7.var_88--; + --Test6663854_Class_7.var_88; + return arg_0; + } + + + + private Test6663854_Class_0 func_0(Test6663854_Class_0 arg_0) + { + if (!Test6663854_Class_3.var_24) + { + Test6663854_Class_7.var_88 ^= (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23) << ~Test6663854_Class_0.var_2; + } + else + { + (Test6663854_Class_6.var_82 = (Test6663854_Class_7.var_67 = (Test6663854_Class_3)(new Test6663854_Interface_1[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])).var_22 = (((new Test6663854_Class_3[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]).var_22 = (arg_0 = arg_0)); + } + if ((Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23))) < Test6663854_Class_3.var_21) + { + Test6663854_Class_3.var_24 ^= (Test6663854_Class_3.var_24 ^= (arg_0.var_6 ^ Test6663854_Class_7.var_88++) != (long)"y".codePointAt((int)var_94)) | false; + } + else + { + ++Test6663854_Class_7.var_88; + } + var_94 >>= (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23); + { + Test6663854_Class_7.var_66 = (Test6663854_Class_6)(var_96 = new Test6663854_Class_3()); + } + arg_0.var_8 = 'u'; + var_94 ^= arg_0.var_8; + ++var_94; + Test6663854_Class_7.var_88++; + var_94 += (Test6663854_Class_3.var_20 = '^'); + return arg_0; + } + + public String toString() + { + String result = "[\n"; + result += "Test6663854_Class_8.var_99 = "; result += Test6663854.Printer.print(var_99); + result += "\n"; + result += "Test6663854_Class_8.var_93 = "; result += Test6663854.Printer.print(var_93); + result += "\n"; + result += "Test6663854_Class_8.var_98 = "; result += Test6663854.Printer.print(var_98); + result += "\n"; + result += "Test6663854_Class_8.var_95 = "; result += Test6663854.Printer.print(var_95); + result += "\n"; + result += "Test6663854_Class_8.var_97 = "; result += Test6663854.Printer.print(var_97); + result += "\n"; + result += "Test6663854_Class_8.var_94 = "; result += Test6663854.Printer.print(var_94); + result += "\n"; + result += "Test6663854_Class_8.var_96 = "; result += Test6663854.Printer.print(var_96); + result += ""; + result += "\n]"; + return result; + } +} + +public class Test6663854 { + static short var_105 = 19709; + static int var_106 = (((Test6663854_Class_3.var_24 = (Test6663854_Class_3.var_24 = false)) | true) & (false || !false) ? ! (Test6663854_Class_3.var_24 |= Test6663854_Class_3.var_24) : Test6663854_Class_3.var_24 | false) ? (short)5430142769559462912L : Test6663854_Class_3.var_23 << Test6663854_Class_3.var_23; + boolean var_107 = false; + + + private static long func_0(final boolean arg_0) + { + { + Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_4)(new Test6663854_Interface_2[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]); + } + var_105++; + ((new Test6663854_Class_7[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23][Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23)][((new Test6663854_Class_6[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_78]).func_0(); + byte var_108 = 107; + return Test6663854_Class_8.var_98 << ((new Test6663854_Class_4[var_108][Test6663854_Class_3.var_23])[var_108][Test6663854_Class_3.var_24 ? var_108 : var_108--]).var_42; + } + + protected final long func_1(char[] arg_0, Object arg_1, String arg_2, final int arg_3) + { + (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_4)arg_1)))).var_43 = ((Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_4)arg_1)))))).var_43 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23)); + { + Test6663854_Class_6.var_82 = ((Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_4)arg_1)).var_41 = (((new Test6663854[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]).var_107 ^= var_107) ? (new Test6663854_Class_3[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23] : (Test6663854_Class_3)arg_1); + } + Test6663854_Class_7.var_88 += (Test6663854_Class_6.var_81 >>>= (var_107 &= var_107) | var_107 ? (int)- ~Test6663854_Class_6.var_81 : Test6663854_Class_3.var_23); + short var_109 = 11276; + final Test6663854_Class_8 var_110 = (Test6663854_Class_3.var_24 ^ (Test6663854_Class_3.var_24 = !true) ? 5788412835121658880L : var_109--) * (298795405395535872L << (((Test6663854_Class_0)arg_1).var_1 << (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23))) != (var_107 ? var_109 : var_105) ? (Test6663854_Class_8)(arg_1 = arg_1) : ((Test6663854_Class_3.var_24 &= ! !var_107) ? new Test6663854_Class_8() : new Test6663854_Class_8()); + new Test6663854_Class_4().var_43 = Test6663854_Class_3.var_24 ^ Test6663854_Class_3.var_24 ^ Test6663854_Class_3.var_24 ? (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23)) : (new byte[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]; + Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_4)arg_1))); + Test6663854_Class_3.var_20 = (var_105 ^= (var_106 *= ((Test6663854_Class_7)arg_1).var_87 - ~Test6663854_Class_3.var_23)); + Test6663854_Class_5 var_111; + Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_4)arg_1)); + { + (arg_2 = "eiprceumt").compareTo(arg_2 = (arg_2 = "roae")); + } + if (false) + { + final Test6663854_Class_8 var_112 = var_110; + (true | (false && false) ? (Test6663854_Class_3)arg_1 : ((Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_4)arg_1)).var_41 = (Test6663854_Class_6.var_82 = (Test6663854_Class_3)(var_110.var_96 = var_112)))).var_18 = var_110; + } + else + { + (Test6663854_Class_3.var_24 ? "jpunp" : "giappofq").concat(arg_2 = (arg_2 = arg_2)); + } + { + Test6663854_Class_3.var_24 &= Test6663854_Class_3.var_24; + } + var_110.var_96 = (Test6663854_Class_7)(var_110.var_96 = (Test6663854_Class_7)arg_1); + { + ((var_107 ^= !var_107) && (!Test6663854_Class_3.var_24 | (Test6663854_Class_3.var_24 |= true) ? !false : !true) ? (Test6663854_Class_4)arg_1 : (Test6663854_Class_6.var_80 = (Test6663854_Class_4)arg_1)).var_41 = (((var_107 &= (var_107 &= (var_107 &= (Test6663854_Class_3.var_24 ^= (Test6663854_Class_3.var_24 = Test6663854_Class_3.var_24))))) ? (Test6663854_Class_6.var_80 = (Test6663854_Class_4)arg_1) : (Test6663854_Class_4)(Test6663854_Class_4.var_40 = (Test6663854_Class_7)arg_1)).var_41 = ((Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_4)arg_1)))).var_41 = false || Test6663854_Class_3.var_24 ? (Test6663854_Class_3)arg_1 : (Test6663854_Class_3)arg_1)); + } + Test6663854_Class_5.var_66 = false ? (new Test6663854_Class_6[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23] : new Test6663854_Class_6(); + var_105++; + arg_1 = (var_111 = new Test6663854_Class_7()); + ((true ? (Test6663854_Class_3)arg_1 : (Test6663854_Class_3)arg_1).var_22 = (new Test6663854_Class_0[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]).var_8 >>= (var_106 /= ((Test6663854_Class_4)arg_1).var_42) - ((Test6663854_Class_3.var_24 ? (Test6663854_Class_4)arg_1 : (Test6663854_Class_4)arg_1).var_43 = ((Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_4)arg_1))).var_43 = new Test6663854_Class_6().var_78)); + return 5795172173382514688L | (((var_107 &= (Test6663854_Class_3.var_24 |= false) | Test6663854_Class_3.var_24) ? (Test6663854_Class_4)arg_1 : (Test6663854_Class_6.var_80 = (Test6663854_Class_4)arg_1)).var_43 = Test6663854_Class_3.var_23); + } + + public static String execute() + { + try { + Test6663854 t = new Test6663854(); + try { t.test(); } + catch(Throwable e) { } + try { return t.toString(); } + catch (Throwable e) { return "Error during result conversion to String"; } + } catch (Throwable e) { return "Error during test execution"; } + } + + public static void main(String[] args) + { + try { + Test6663854 t = new Test6663854(); + try { t.test(); } + catch(Throwable e) { } + try { System.out.println(t); } + catch(Throwable e) { } + } catch (Throwable e) { } + } + + private void test() + { + if ((true & (false ? !false : true) || var_107 ? (var_105 <<= Test6663854_Class_5.var_65) / (Test6663854_Class_0.var_5 = var_105) : 2509076152709535744L) >= (true ? new Test6663854_Class_8().var_93 : (Test6663854_Class_3.var_20 = Test6663854_Class_3.var_23))) + { + (true ? (new Test6663854_Class_6[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23] : (Test6663854_Class_7.var_66 = new Test6663854_Class_6())).func_0(); + (var_107 ? (new Test6663854_Class_4().var_41 = new Test6663854_Class_3()) : (Test6663854_Class_3)(new Test6663854_Class_3().var_18 = new Test6663854_Class_8())).var_18 = (new Test6663854_Class_4[new Test6663854_Class_4().var_43 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23)])[Test6663854_Class_3.var_23]; + { + ++var_106; + ((new Test6663854_Class_5().func_0() ? (Test6663854_Class_3.var_24 ^= true) : !false) ? (Test6663854_Class_7)new Test6663854_Class_5() : (Test6663854_Class_7)((Test6663854_Class_6.var_82 = new Test6663854_Class_3()).var_18 = (Test6663854_Class_6.var_80 = new Test6663854_Class_4()))).var_89 -= Test6663854_Class_3.var_23; + } + var_105 *= 4.59906108270682E307; + { + Test6663854_Class_0.var_4 = ((Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = new Test6663854_Class_4()))).var_43 = (Test6663854_Class_0.var_4 = false ? (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23) : Test6663854_Class_3.var_23)); + } + long var_113 = 0L; + var_106 %= (Test6663854_Class_7.var_88 = 'i'); + for (short var_114 = ((Test6663854_Class_8)(new Test6663854_Interface_1[Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23))])[Test6663854_Class_3.var_23]).var_94; var_113 < 4 && false; "dmmntw".length()) + { + var_114++; + var_113++; + Test6663854_Class_3.var_24 &= Test6663854_Class_3.var_24; + new String("kprvouugy"); + } + { + new Test6663854_Class_8().var_94 /= (long)5.719961906225282E307; + } + double var_115 = 0; + Test6663854_Class_3.var_24 |= var_107; + do + { + Test6663854_Class_3.var_24 ^= (Test6663854_Class_3.var_24 |= !Test6663854_Class_3.var_24 && var_107); + var_115++; + var_106++; + } while (var_115 < 29 && (var_107 = (Test6663854_Class_3.var_24 |= Test6663854_Class_3.var_24))); + Test6663854_Class_7.var_66 = new Test6663854_Class_7(); + Test6663854_Class_3.var_20 = (false ? (Test6663854_Class_6.var_80 = new Test6663854_Class_4()) : new Test6663854_Class_4()).var_42; + } + else + { + (((new Test6663854_Class_3[Test6663854_Class_3.var_23])[new Test6663854_Class_6().var_78]).var_22 = (new Test6663854_Class_3().var_22 = (new Test6663854_Class_3().var_22 = new Test6663854_Class_0()))).var_8 >>>= (var_106 &= new Test6663854_Class_0().var_8 << Test6663854_Class_7.var_65); + } + Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = new Test6663854_Class_4())); + { + Test6663854_Class_8 var_116; + (!true | (Test6663854_Class_3.var_24 &= true) ? new Test6663854_Class_7() : new Test6663854_Class_7()).var_89 /= Test6663854_Class_7.var_88--; + Test6663854_Class_6.var_81 &= ((new Test6663854_Class_6[Test6663854_Class_3.var_23][Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]).var_78; + } + if (true ? var_107 : (Test6663854_Class_3.var_24 &= (Test6663854_Class_3.var_24 |= false))) + { + Test6663854_Class_3.var_24 |= (Test6663854_Class_3.var_24 &= (Test6663854_Class_3.var_24 ^= (Test6663854_Class_3.var_24 &= !true))); + Test6663854_Class_7.var_66 = (Test6663854_Class_7)new Test6663854_Class_5(); + Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23))); + { + Test6663854_Class_7.var_88++; + float var_117 = 0F; + final long var_118 = 1388589135930756096L; + for (var_106++; ((Test6663854_Class_3.var_24 &= false) && (Test6663854_Class_3.var_24 |= true)) ^ true && (var_117 < 1 && Test6663854_Class_3.var_24); new Test6663854_Class_0().var_8 += !false || (new float[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23] <= Test6663854_Class_3.var_23 || Test6663854_Class_3.var_24 ? ((new Test6663854_Class_6[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_78 : Test6663854_Class_3.var_23) + { + Test6663854_Class_6.var_82 = (Test6663854_Class_7.var_67 = new Test6663854_Class_3()); + var_117++; + Test6663854_Class_5.var_66 = Test6663854_Class_3.var_24 & !Test6663854_Class_3.var_24 ^ var_107 ^ new Test6663854_Class_0().var_8 == new Test6663854_Class_0().var_1 ? new Test6663854_Class_6() : new Test6663854_Class_6(); + (Test6663854_Class_6.var_80 = (new Test6663854_Class_4[Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23)]).var_43 = (Test6663854_Class_0.var_4 = ((Test6663854_Class_6)(new Object[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]).var_78); + } + if (false & ((var_107 = true) || ! ((Test6663854_Class_3.var_24 ^= true || !var_107) ? false : Test6663854_Class_3.var_24 ^ var_107) ? (var_107 = Test6663854_Class_3.var_24) && Test6663854_Class_3.var_24 : true)) + { + "yvjk".toString(); + } + else + { + Test6663854_Class_4 var_119 = Test6663854_Class_6.var_80 = ((var_107 = true) ? (Test6663854_Class_6.var_81 |= var_106) : var_118) < (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23))) ? (Test6663854_Class_4)(new Test6663854_Class_3().var_18 = new float[Test6663854_Class_3.var_23]) : (new Test6663854_Class_4[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]; + } + (false | (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23) >= var_106 ? new Test6663854_Class_3() : (Test6663854_Class_7.var_67 = new Test6663854_Class_3())).var_18 = ((false ? (new Test6663854_Class_3[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23] : new Test6663854_Class_3()).var_22 = ((Test6663854_Class_7.var_67 = (Test6663854_Class_3)(new Test6663854_Class_3().var_18 = (Test6663854_Class_8)(new Test6663854_Class_8().var_96 = new Test6663854_Class_8()))).var_22 = ((Test6663854_Class_5.var_67 = new Test6663854_Class_3()).var_22 = new Test6663854_Class_0()))); + short var_120; + (Test6663854_Class_6.var_80 = new Test6663854_Class_4()).var_41 = new Test6663854_Class_3(); + ((new Test6663854_Class_8[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23]).var_96 = (Test6663854_Class_4.var_40 = !false & var_107 ? (Test6663854_Class_7)new Test6663854_Class_5() : new Test6663854_Class_7()); + } + if ((Test6663854_Class_3.var_24 &= (Test6663854_Class_3.var_24 = Test6663854_Class_3.var_24)) || Test6663854_Class_3.var_24) + { + { + var_106--; + Test6663854_Class_6.var_81 -= 2.5265952E38F; + Test6663854_Class_7.var_88++; + Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_4)(new Test6663854_Interface_1[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])); + Test6663854_Class_6.var_81++; + (((new Test6663854_Class_7[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[(byte)(var_105 &= var_106)])[Test6663854_Class_3.var_23]).equals(((new Test6663854_Class_3[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_18 = new Test6663854_Class_8()); + } + ((((new Test6663854_Class_4[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_41 = (Test6663854_Class_7.var_67 = (Test6663854_Class_7.var_67 = (new Test6663854_Class_3[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]))).var_18 = "mnxktbgv"; + var_105++; + ((Test6663854_Class_3.var_24 &= Test6663854_Class_3.var_24) ? (new Test6663854_Class_3().var_22 = new Test6663854_Class_0()) : new Test6663854_Class_0()).var_7 = new Test6663854_Class_0().var_6; + var_105 = (var_105 >>>= Test6663854_Class_3.var_23); + ++var_105; + { + Test6663854_Class_0.var_4 = ((Test6663854_Class_6.var_80 = (new Test6663854_Class_4[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_43 = ((new Test6663854_Class_6[Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23)]).var_78); + ((Test6663854_Class_8)(new Object[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]).var_96 = (Test6663854_Class_6.var_80 = (Test6663854_Class_4)(Test6663854_Class_5.var_66 = (new Test6663854_Class_6[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])); + } + if (2125632862 >= Test6663854_Class_5.var_65) + { + "nfdjgd".toLowerCase(); + ((new Test6663854_Class_8[Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23]).var_96 = new Test6663854_Class_8(); + Test6663854_Interface_2 var_121; + new Test6663854_Class_0().var_7 = Test6663854_Class_8.var_97; + --var_105; + --Test6663854_Class_7.var_88; + ((new Test6663854_Class_0[Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23)])[((Test6663854_Class_6)(Test6663854_Class_4.var_40 = (Test6663854_Class_3)(new Object[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23])).var_78]).var_7 = (((new Test6663854_Class_8[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_94 += (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23)); + } + else + { + --Test6663854_Class_6.var_81; + } + if (false) + { + Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23; + } + else + { + var_105--; + (true | (Test6663854_Class_3.var_24 |= var_107) ? (Test6663854_Class_7)(new Test6663854_Class_5[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23] : (new Test6663854_Class_7[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]).var_89 *= 2.5396491E38F; + var_107 = Test6663854_Class_3.var_24; + var_105++; + } + Test6663854_Class_6.var_81--; + new Test6663854_Class_5(); + } + else + { + Test6663854_Class_0 var_122; + } + var_107 = false; + (Test6663854_Class_3.var_24 ? new Test6663854_Class_7() : (Test6663854_Class_7)(new Test6663854_Class_3().var_18 = new Test6663854_Class_6())).var_89 *= (var_106 -= (new Test6663854_Class_3().var_22 = new Test6663854_Class_0()).var_6); + new Test6663854_Class_8().var_94 *= Test6663854_Class_7.var_88; + ((new String[new Test6663854_Class_6().var_78])[Test6663854_Class_3.var_23]).codePointAt(135817988); + final double var_123 = 7.395191963488875E307; + --var_105; + Test6663854_Class_7.var_88++; + } + else + { + (Test6663854_Class_6.var_80 = Test6663854_Class_3.var_24 ? (Test6663854_Class_6.var_80 = new Test6663854_Class_4()) : (Test6663854_Class_6.var_80 = new Test6663854_Class_4())).var_38 <<= (Test6663854_Class_7.var_88 <<= (new Test6663854_Class_4().var_43 = (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23))) >>> Test6663854_Class_3.var_23); + } + int var_124 = 0; + Test6663854_Class_7 var_125; + float var_126 = 2.5216562E38F; + int var_127 = 0; + Test6663854_Class_7.var_66 = (Test6663854_Class_5.var_66 = (Test6663854_Class_4)(new Test6663854_Interface_1[Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23]); + while (var_127 < 1 && (Test6663854_Class_3.var_24 ? (var_107 |= var_107) : false)) + { + short var_128; + var_127++; + var_125 = (var_125 = (var_125 = (var_125 = (Test6663854_Class_7)(new Test6663854_Interface_1[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]))); + "nkv".indexOf("ptrepiu" + "aljmjttym", var_106 << (new byte[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]); + } + { + Test6663854_Class_7.var_66 = (Test6663854_Class_7.var_67 = (new Test6663854_Class_3[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]); + } + var_125 = (new Test6663854_Class_7[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]; + var_126 += var_106; + while (var_124 < 537 && true) + { + Test6663854_Class_7.var_88 %= var_105; + var_124++; + var_106++; + Test6663854_Class_5.var_66 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (new Test6663854_Class_4[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])); + final long var_129 = 3230407753980990464L; + new Test6663854_Class_8(); + final Test6663854_Class_3 var_130 = (Test6663854_Class_3)((Test6663854_Class_3.var_24 |= !false) | (var_107 | !var_107) | (new Test6663854_Class_8().var_94++ >= 1015752753 | !true) ? (new Test6663854_Class_6[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23] : (new Test6663854_Interface_1[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23]); + Test6663854_Class_5.var_66 = (Test6663854_Class_7.var_66 = (Test6663854_Class_7.var_66 = (Test6663854_Class_7.var_67 = var_130))); + } + Test6663854_Class_7.var_66 = var_126 >= (Test6663854_Class_3.var_24 || (Test6663854_Class_3.var_24 = Test6663854_Class_3.var_24) ? var_106 : var_126) ? new Test6663854_Class_6() : new Test6663854_Class_6(); + var_107 &= true; + (new Test6663854_Class_8().var_96 = (var_125 = (var_125 = (var_125 = new Test6663854_Class_7())))).func_0(); + float var_131 = 0F; + Test6663854_Class_3 var_132 = new Test6663854_Class_3(); + do + { + long var_133; + var_131++; + Test6663854_Interface_2 var_134 = Test6663854_Class_7.var_66 = var_132; + } while ((Test6663854_Class_3.var_24 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23) == 1.2758309E38F) && (var_131 < 117 && ((new short[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23)] == ((var_107 &= ! (Test6663854_Class_3.var_24 ^= false)) ^ ! !false ? new Test6663854_Class_0().var_6 : new Test6663854_Class_4().var_42))); + (var_107 ? var_132 : (Test6663854_Class_3)(Test6663854_Class_7.var_66 = var_132)).var_18 = (Test6663854_Class_0)((Test6663854_Class_5.var_67 = (Test6663854_Class_7.var_67 = (var_132 = var_132))).var_18 = ((new Test6663854_Class_8[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23))])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23]); + long var_135 = 0L; + (((new Test6663854_Class_8[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = (byte)+ (Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23)]).var_96 = var_132; + for (((var_107 = ((new Test6663854_Class_0[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).equals(var_132.var_18 = (Test6663854_Class_8)(new Test6663854_Class_8().var_96 = var_132))) ? "oedsntb" : "ouspr").concat("t"); var_135 < 27; (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (new Test6663854_Class_4[Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23]))).var_38 %= (double)func_0(Test6663854_Class_3.var_24 = false ? !var_107 && ! !Test6663854_Class_3.var_24 : Test6663854_Class_3.var_24 ^ ! (Test6663854_Class_3.var_24 = Test6663854_Class_3.var_24))) + { + Test6663854_Class_6.var_80 = (Test6663854_Class_4)(new Test6663854_Class_8().var_96 = new Test6663854_Class_8()); + var_135++; + Test6663854_Class_3.var_24 &= !true; + new Test6663854_Class_0().var_8 += Test6663854_Class_7.var_65; + } + Test6663854_Class_3 var_136 = var_132; + if ((var_107 = ((Test6663854_Class_4)(Test6663854_Class_7.var_66 = (var_125 = (Test6663854_Class_7)(Test6663854_Class_7.var_66 = var_136)))).func_0() ^ true) && (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (Test6663854_Class_6.var_80 = (new Test6663854_Class_4[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]))).var_45 <= ((new Test6663854_Class_6[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23]).var_78) + { + var_126 %= ((var_107 = true) ? (var_105 *= 8272288534835139584L) : (var_105 |= var_105)) % new Test6663854_Class_7().var_89; + ((Test6663854_Class_3)(new Test6663854_Class_8().var_96 = (new Test6663854_Interface_1[Test6663854_Class_3.var_23])[Test6663854_Class_3.var_23])).var_18 = new Test6663854_Class_0(); + var_105 <<= ++((Test6663854_Class_3.var_24 |= false) ? new Test6663854_Class_8() : (Test6663854_Class_8)(new Test6663854_Class_8().var_96 = new Test6663854_Class_4())).var_94 % (Test6663854_Class_0.var_2 - var_106); + Test6663854_Interface_2 var_137; + var_137 = new Test6663854_Class_4(); + int var_138; + } + else + { + final Test6663854_Interface_2 var_139 = Test6663854_Class_4.var_40 = (var_136 = var_136); + new Test6663854_Class_8().var_93 -= new Test6663854_Class_6().var_78; + --((Test6663854_Class_3.var_24 ^= var_126 < Test6663854_Class_3.var_23 | !var_107) ? (new Test6663854_Class_8[Test6663854_Class_3.var_23][Test6663854_Class_3.var_23])[Test6663854_Class_0.var_4 = Test6663854_Class_3.var_23][new Test6663854_Class_6().var_78] : new Test6663854_Class_8()).var_93; + var_105 >>= ! (Test6663854_Class_3.var_24 = true) || ((Test6663854_Class_8)(! (Test6663854_Class_3.var_24 |= var_107) | (false ? Test6663854_Class_3.var_23 : new Test6663854_Class_6().var_78) != new Test6663854_Class_8().var_93 ? (Test6663854_Class_6.var_82 = var_136) : (new Test6663854_Class_8().var_96 = (var_132 = var_136)))).var_94 >= Test6663854_Class_6.var_81++ ? var_124 : '`'; + } + var_126 /= var_105; + var_105 *= var_127; + var_107 ^= (var_107 = true); + { + Test6663854_Class_7.var_66 = (var_125 = (Test6663854_Class_7)(new Test6663854_Class_5[Test6663854_Class_3.var_23])[new Test6663854_Class_6().var_78]); + } + (var_136.var_22 = ((var_136 = var_132).var_22 = new Test6663854_Class_0())).var_7 = ((!false ? var_132 : (Test6663854_Class_7.var_67 = var_132)).var_22 = (((Test6663854_Class_3)(var_136.var_18 = var_136)).var_22 = (Test6663854_Class_0)(var_132.var_18 = "sgybwy"))).var_6; + ((Test6663854_Class_3.var_20 = var_105--) >= ~Test6663854_Class_3.var_23 ? new String() : "lgcfkbsw").replace(new Test6663854_Class_0().var_8 |= 't', false ? (Test6663854_Class_7.var_88 -= var_105) : 'q'); + Test6663854_Class_7.var_88 <<= Test6663854_Class_7.var_88; + } + public String toString() + { + String result = "[\n"; + result += "Test6663854.var_105 = "; result += Printer.print(var_105); + result += "\n"; + result += "Test6663854.var_107 = "; result += Printer.print(var_107); + result += "\n"; + result += "Test6663854.var_106 = "; result += Printer.print(var_106); + result += ""; + result += "\n]"; + return result; + } + static class Printer + { + public static String print(boolean arg) { return String.valueOf(arg); } + public static String print(byte arg) { return String.valueOf(arg); } + public static String print(short arg) { return String.valueOf(arg); } + public static String print(char arg) { return String.valueOf((int)arg); } + public static String print(int arg) { return String.valueOf(arg); } + public static String print(long arg) { return String.valueOf(arg); } + public static String print(float arg) { return String.valueOf(arg); } + public static String print(double arg) { return String.valueOf(arg); } + + + public static String print(Object arg) + { + return print_r(new java.util.Stack(), arg); + } + + private static String print_r(java.util.Stack visitedObjects, Object arg) + { + String result = ""; + if (arg == null) + result += "null"; + else + if (arg.getClass().isArray()) + { + for (int i = 0; i < visitedObjects.size(); i++) + if (visitedObjects.elementAt(i) == arg) return ""; + + visitedObjects.push(arg); + + final String delimiter = ", "; + result += "["; + + if (arg instanceof Object[]) + { + Object[] array = (Object[]) arg; + for (int i = 0; i < array.length; i++) + { + result += print_r(visitedObjects, array[i]); + if (i < array.length - 1) result += delimiter; + } + } + else + if (arg instanceof boolean[]) + { + boolean[] array = (boolean[]) arg; + for (int i = 0; i < array.length; i++) + { + result += print(array[i]); + if (i < array.length - 1) result += delimiter; + } + } + else + if (arg instanceof byte[]) + { + byte[] array = (byte[]) arg; + for (int i = 0; i < array.length; i++) + { + result += print(array[i]); + if (i < array.length - 1) result += delimiter; + } + } + else + if (arg instanceof short[]) + { + short[] array = (short[]) arg; + for (int i = 0; i < array.length; i++) + { + result += print(array[i]); + if (i < array.length - 1) result += delimiter; + } + } + else + if (arg instanceof char[]) + { + char[] array = (char[]) arg; + for (int i = 0; i < array.length; i++) + { + result += print(array[i]); + if (i < array.length - 1) result += delimiter; + } + } + else + if (arg instanceof int[]) + { + int[] array = (int[]) arg; + for (int i = 0; i < array.length; i++) + { + result += print(array[i]); + if (i < array.length - 1) result += delimiter; + } + } + else + if (arg instanceof long[]) + { + long[] array = (long[]) arg; + for (int i = 0; i < array.length; i++) + { + result += print(array[i]); + if (i < array.length - 1) result += delimiter; + } + } + else + if (arg instanceof float[]) + { + float[] array = (float[]) arg; + for (int i = 0; i < array.length; i++) + { + result += print(array[i]); + if (i < array.length - 1) result += delimiter; + } + } + else + if (arg instanceof double[]) + { + double[] array = (double[]) arg; + for (int i = 0; i < array.length; i++) + { + result += print(array[i]); + if (i < array.length - 1) result += delimiter; + } + } + + result += "]"; + visitedObjects.pop(); + + } else + { + result += arg.toString(); + } + + return result; + } + } +} diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/test/compiler/6910605/Test.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/6910605/Test.java Fri Mar 19 18:49:36 2010 -0700 @@ -0,0 +1,78 @@ +/* + * 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 6910605 + * @summary C2: NullPointerException/ClassCaseException is thrown when C2 with DeoptimizeALot is used + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot -Xbatch Test + * + * original test: nsk/coverage/runtime/runtime007 + */ + +import java.io.*; + +public class Test { + public static int buf=0; + + public static void main( String argv[] ) { + System.exit(run(argv, System.out)+95); + } + + public static int run(String argv[],PrintStream out) { + int ret=0, retx=0, bad=0; + + for( int i=0; (i < 100000) && (bad < 10) ; i++ ) { + retx = OptoRuntime_f2i_Type(out); + ret += retx; + if( retx !=0 ) { + out.println("i="+i); + bad++; + } + } + return ret==0 ? 0 : 2 ; + } + + public static int OptoRuntime_f2i_Type(PrintStream out) { + int c1=2, c2=3, c3=4, c4=5, c5=6; + int j=0, k=0; + try { + int[][] iii=(int[][])(new int[c1][c2]); + + for( j=0; j= 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) { } + } + } +} diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/test/compiler/6932496/Test6932496.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/6932496/Test6932496.java Fri Mar 19 18:49:36 2010 -0700 @@ -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(); + } +} diff -r 9b1fde936a71 -r a491e7a776d5 hotspot/test/compiler/6935535/Test.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/6935535/Test.java Fri Mar 19 18:49:36 2010 -0700 @@ -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); + } + } +} + diff -r 9b1fde936a71 -r a491e7a776d5 jaxp/.hgtags --- a/jaxp/.hgtags Fri Mar 12 01:09:13 2010 +0000 +++ b/jaxp/.hgtags Fri Mar 19 18:49:36 2010 -0700 @@ -58,3 +58,6 @@ 204e59d488cdaa9eafa8cb7164ea955b5a9d4a51 jdk7-b81 c876ad22e4bf9d3c6460080db7ace478e29a3ff9 jdk7-b82 309a0a7fc6ceb1c9fc3a85b3608e97ef8f7b0dfd jdk7-b83 +32c0cf01d555747918529a6ff9e06b0090c7a474 jdk7-b84 +6c0ccabb430dacdcd4479f8b197980d5da4eeb66 jdk7-b85 +81c0f115bbe5d3bcf59864465b5eca5538567c79 jdk7-b86 diff -r 9b1fde936a71 -r a491e7a776d5 jaxws/.hgtags --- a/jaxws/.hgtags Fri Mar 12 01:09:13 2010 +0000 +++ b/jaxws/.hgtags Fri Mar 19 18:49:36 2010 -0700 @@ -58,3 +58,6 @@ f051045fe94a48fae1097f90cbd9227e6aae6b7e jdk7-b81 31573ae8eed15a6c170f3f0d1abd0b9109c0e086 jdk7-b82 371e3ded591d09112a9f231e37cb072781c486ac jdk7-b83 +8bc02839eee4ef02cd1b50e87638874368a26535 jdk7-b84 +8424512588ff95362c1f1e5f11c6efd4e7f7db6e jdk7-b85 +512b0e924a5ae0c0b7ad326182cae0dc0e4d1aa8 jdk7-b86 diff -r 9b1fde936a71 -r a491e7a776d5 jdk/.hgtags --- a/jdk/.hgtags Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/.hgtags Fri Mar 19 18:49:36 2010 -0700 @@ -59,3 +59,5 @@ 69ef657320ad5c35cfa12e4d8322d877e778f8b3 jdk7-b82 9027c6b9d7e2c9ca04a1add691b5b50d0f22b1aa jdk7-b83 7cb9388bb1a16365fa5118c5efa38b1cd58be40d jdk7-b84 +b396584a3e64988839cca21ea1f7fbdcc9248783 jdk7-b85 +eae6e9ab26064d9ba0e7665dd646a1fd2506fcc1 jdk7-b86 diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/Makefile --- a/jdk/make/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -240,7 +240,12 @@ all build:: sanity-all post-sanity-all -SUBDIRS = tools java javax org sun sunw com jpda mkdemo mksample launchers +SUBDIRS = tools java javax sun com +SUBDIRS_tools = launchers +SUBDIRS_misc = org sunw jpda mkdemo mksample + +include $(BUILDDIR)/common/Subdirs.gmk + all build:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/com/Makefile --- a/jdk/make/com/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/com/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -32,6 +32,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = sun +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/com/sun/Makefile --- a/jdk/make/com/sun/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/com/sun/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -38,10 +38,19 @@ endif endif +# jarsigner is part of JRE +SUBDIRS = java security net/ssl jarsigner + +SUBDIRS_management = jmx +SUBDIRS_desktop = image inputmethods +SUBDIRS_enterprise = crypto/provider jndi \ + org xml rowset net/httpserver +SUBDIRS_misc = $(SCRIPT_SUBDIR) tracing servicetag nio demo + # Omit mirror since it's built with the apt tool. -SUBDIRS = $(SCRIPT_SUBDIR) image security crypto/provider jndi jmx \ - java inputmethods org xml rowset net/httpserver net/ssl demo \ - tools jarsigner tracing servicetag nio +SUBDIRS_tools = tools + +include $(BUILDDIR)/common/Subdirs.gmk all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/com/sun/demo/Makefile --- a/jdk/make/com/sun/demo/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/com/sun/demo/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -38,6 +38,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = jvmti +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/com/sun/demo/jvmti/Makefile --- a/jdk/make/com/sun/demo/jvmti/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/com/sun/demo/jvmti/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -38,6 +38,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = hprof +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/com/sun/inputmethods/Makefile --- a/jdk/make/com/sun/inputmethods/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/com/sun/inputmethods/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -32,6 +32,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = indicim thaiim +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/com/sun/java/Makefile --- a/jdk/make/com/sun/java/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/com/sun/java/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -31,7 +31,10 @@ PRODUCT = plugin include $(BUILDDIR)/common/Defs.gmk -SUBDIRS = browser pack +SUBDIRS = pack +SUBDIRS_misc = browser +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/com/sun/java/browser/Makefile --- a/jdk/make/com/sun/java/browser/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/com/sun/java/browser/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -32,6 +32,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = dom net +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/com/sun/jmx/Makefile --- a/jdk/make/com/sun/jmx/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/com/sun/jmx/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -51,6 +51,8 @@ SUBDIRS = snmp endif +include $(BUILDDIR)/common/Subdirs.gmk + all build: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/com/sun/jndi/Makefile --- a/jdk/make/com/sun/jndi/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/com/sun/jndi/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -31,6 +31,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = toolkit cosnaming ldap rmi dns +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/com/sun/jndi/rmi/Makefile --- a/jdk/make/com/sun/jndi/rmi/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/com/sun/jndi/rmi/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -31,6 +31,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = registry +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/com/sun/nio/Makefile --- a/jdk/make/com/sun/nio/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/com/sun/nio/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -31,6 +31,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = sctp +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/com/sun/org/Makefile --- a/jdk/make/com/sun/org/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/com/sun/org/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -32,6 +32,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = apache +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/com/sun/org/apache/Makefile --- a/jdk/make/com/sun/org/apache/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/com/sun/org/apache/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -31,6 +31,7 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = xml +include $(BUILDDIR)/common/Subdirs.gmk all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/com/sun/security/Makefile --- a/jdk/make/com/sun/security/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/com/sun/security/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -30,7 +30,10 @@ BUILDDIR = ../../.. include $(BUILDDIR)/common/Defs.gmk -SUBDIRS = jgss sasl auth auth/module +SUBDIRS = auth +SUBDIRS_misc = jgss sasl auth/module +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/com/sun/tools/Makefile --- a/jdk/make/com/sun/tools/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/com/sun/tools/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -35,6 +35,8 @@ AUTO_FILES_JAVA_DIRS = com/sun/tools/extcheck SUBDIRS = attach +include $(BUILDDIR)/common/Subdirs.gmk + all build: $(SUBDIRS-loop) clean clobber:: diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/com/sun/tracing/Makefile --- a/jdk/make/com/sun/tracing/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/com/sun/tracing/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -33,6 +33,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = dtrace +include $(BUILDDIR)/common/Subdirs.gmk + all build: $(SUBDIRS-loop) clean clobber:: diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/common/Defs.gmk --- a/jdk/make/common/Defs.gmk Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/common/Defs.gmk Fri Mar 19 18:49:36 2010 -0700 @@ -576,17 +576,17 @@ define install-file $(prep-target) $(CP) $< $@ -$(install-module-file) +@$(install-module-file) endef define chmod-file $(CHMOD) $1 $@ -$(call chmod-module-file, $1) +@$(call chmod-module-file, $1) endef define install-sym-link $(LN) -s $1 $@ -$(call install-module-sym-link, $1) +@$(call install-module-sym-link, $1) endef # @@ -607,131 +607,9 @@ if [ -w $(HOTSPOT_LOG_NAME) ] ; then $(RM) $(HOTSPOT_LOG_NAME); fi endef -# Default make settings for processing SUBDIRS with clobber or clean names -SUBDIRS_MAKEFLAGS-clobber = INCREMENTAL_BUILD=false -SUBDIRS_MAKEFLAGS-clean = INCREMENTAL_BUILD=false - # Current directory CURRENT_DIRECTORY := $(shell $(PWD)) -# If no timing wanted, we need to define these as empty -ifdef NO_TIMING - -TIMING_ID:=NA - -define TIMING_start -t=0:0:0:0 -endef - -define TIMING_end -time_used=0 -endef - -else # NO_TIMING - -# Default timing id -TIMING_ID:=$(shell $(BASENAME) $(CURRENT_DIRECTORY)) - -# Timing start (must be used in same shell, e.g. same command line) -# Defines the shell variable $1 to have the start time. -define TIMING_start -$1=`$(DATE) +%j:%H:%M:%S` -endef - -# Timing end (must be used in same shell, e.g. same command line) -# Expects shell variable $1 to have been defined as the start time. -# Expects shell variable $2 to have timing id string -# Sets total_seconds shell variable as the total seconds used. -# Sets time_used shell variable to contain format "%dh%dm%ds" -define TIMING_end -begTime="$${$1}"; \ -timing_id="$${$2}"; \ -endTime=`$(DATE) +%j:%H:%M:%S`; \ -d1=`$(ECHO) $${begTime} | $(CUT) -d':' -f1 | $(SED) -e 's@^0*@@'`; \ -if [ "$${d1}" = "" ] ; then d1=0; fi; \ -h1=`$(ECHO) $${begTime} | $(CUT) -d':' -f2 | $(SED) -e 's@^0*@@'`; \ -if [ "$${h1}" = "" ] ; then h1=0; fi; \ -m1=`$(ECHO) $${begTime} | $(CUT) -d':' -f3 | $(SED) -e 's@^0*@@'`; \ -if [ "$${m1}" = "" ] ; then m1=0; fi; \ -s1=`$(ECHO) $${begTime} | $(CUT) -d':' -f4 | $(SED) -e 's@^0*@@'`; \ -if [ "$${s1}" = "" ] ; then s1=0; fi; \ -d2=`$(ECHO) $${endTime} | $(CUT) -d':' -f1 | $(SED) -e 's@^0*@@'`; \ -if [ "$${d2}" = "" ] ; then d2=0; fi; \ -h2=`$(ECHO) $${endTime} | $(CUT) -d':' -f2 | $(SED) -e 's@^0*@@'`; \ -if [ "$${h2}" = "" ] ; then h2=0; fi; \ -m2=`$(ECHO) $${endTime} | $(CUT) -d':' -f3 | $(SED) -e 's@^0*@@'`; \ -if [ "$${m2}" = "" ] ; then m2=0; fi; \ -s2=`$(ECHO) $${endTime} | $(CUT) -d':' -f4 | $(SED) -e 's@^0*@@'`; \ -if [ "$${s2}" = "" ] ; then s2=0; fi; \ -t1_secs=`$(EXPR) $${d1} '*' 60 '*' 60 '*' 24 '+' $${h1} '*' 60 '*' 60 \ - '+' $${m1} '*' 60 '+' $${s1}`; \ -t2_secs=`$(EXPR) $${d2} '*' 60 '*' 60 '*' 24 '+' $${h2} '*' 60 '*' 60 \ - '+' $${m2} '*' 60 '+' $${s2}`; \ -total_seconds=`$(EXPR) $${t2_secs} '-' $${t1_secs}`; \ -if [ "$${total_seconds}" -lt 0 ] ; then total_seconds=0; fi; \ -t_hour=`$(EXPR) $${total_seconds} '/' '(' 60 '*' 60 ')'`h; \ -t_min=`$(EXPR) '(' $${total_seconds} '%' '(' 60 '*' 60 ')' ')' '/' 60`m; \ -t_sec=`$(EXPR) $${total_seconds} '%' 60`s; \ -time_used=$${t_sec}; \ -if [ "$${t_hour}" != "0h" ] ; then \ -time_used=$${t_hour}$${t_min}$${t_sec}; \ -elif [ "$${t_min}" != "0m" ] ; then \ -time_used=$${t_min}$${t_sec}; \ -else \ -time_used=$${t_sec}; \ -fi; \ -$(PRINTF) " Timing: %05d seconds or %s for %s\n" \ - $${total_seconds} $${time_used} $${timing_id} -endef - -endif # NO_TIMING - -# Given a SUBDIRS list, cd into them and make them -# SUBDIRS_MAKEFLAGS Make settings for a subdir make -# SUBDIRS_MAKEFLAGS-$@ Make settings specific to this target -define SUBDIRS-loop -@$(ECHO) "Begin Processing SUBDIRS: $(SUBDIRS)" -@for i in DUMMY $(SUBDIRS) ; do \ - if [ "$$i" != "DUMMY" ] ; then \ - $(ECHO) ">>>Recursively making "$$i" "$@" @ `$(DATE)` ..."; \ - timing_id="$(TIMING_ID)-`$(BASENAME) $${i}`"; \ - $(call TIMING_start,startTime); \ - curDir=$(CURRENT_DIRECTORY); \ - $(CD) $$i; $(MAKE) $@ TIMING_ID=$${timing_id} \ - $(SUBDIRS_MAKEFLAGS) \ - $(SUBDIRS_MAKEFLAGS-$@) \ - FULL_VERSION=$(FULL_VERSION) \ - RELEASE=$(RELEASE) || exit 1; \ - $(CD) $${curDir}; \ - $(call TIMING_end,startTime,timing_id); \ - $(ECHO) "<<>>Recursively making "$$i" "$@" @ `$(DATE)` ..."; \ - timing_id="$(TIMING_ID)-`$(BASENAME) $${i}`"; \ - $(call TIMING_start,startTime); \ - curDir=$(CURRENT_DIRECTORY); \ - $(CD) $$i; $(MAKE) $@ TIMING_ID=$${timing_id} \ - $(OTHERSUBDIRS_MAKEFLAGS) \ - FULL_VERSION=$(FULL_VERSION) \ - RELEASE=$(RELEASE) || exit 1; \ - $(CD) $${curDir}; \ - $(call TIMING_end,startTime,timing_id); \ - $(ECHO) "<< subdirs for the named group +# +# By default, subdirs specified in the SUBDIRS and all SUBDIRS_* +# variables will be built. +# +# BUILD_MODULES variable can be used to specify one or more groups +# to be built (BUILD_MODULES=all will build all groups). +# +# Variables of the currently supported groups are: +# SUBDIRS_desktop +# SUBDIRS_management +# SUBDIRS_enterprise +# SUBDIRS_misc +# SUBDIRS_tools +# +# Change to the above list also need to update +# make/common/shared/Sanity.gmk. NOTE: this list is subject +# to change till the JDK 7 SE profiles/modules are finalized. +# +# Eventually we want to restructure the make directory +# according to these grouping (e.g. make/desktop/...) and +# the SUBDIRS_ variables would not be needed. +# +# To build the desktop and tools groups only, you can do: +# gnumake BUILD_MODULES="desktop tools" ... +# + +# Iterate the subdirectories specified in $1. +# - cd into each subdir and make them + +# Given a SUBDIRS* list (first argument), cd into them and make them +# SUBDIRS_MAKEFLAGS Make settings for a subdir make +# SUBDIRS_MAKEFLAGS-$@ Make settings specific to this target +# +define subdirs-group-loop +@$(ECHO) "Begin Processing SUBDIRS: $($1)" +@for i in DUMMY $($1) ; do \ + if [ "$$i" != "DUMMY" ] ; then \ + $(MAKE) -C $$i $@ $(SUBDIRS_MAKEFLAGS) $(SUBDIRS_MAKEFLAGS-$@) \ + FULL_VERSION=$(FULL_VERSION) RELEASE=$(RELEASE) || exit 1; \ + fi ; \ +done +@$(ECHO) "Done Processing SUBDIRS: $($1)" +endef + +# Given a OTHERSUBDIRS list, cd into them and make them (extra loop define) +# OTHERSUBDIRS_MAKEFLAGS Make settings for a subdir make +define OTHERSUBDIRS-loop +@$(ECHO) "Begin Processing OTHERSUBDIRS: $(OTHERSUBDIRS)" +@for i in DUMMY $(OTHERSUBDIRS) ; do \ + if [ "$$i" != "DUMMY" ] ; then \ + $(MAKE) -C $$i $@ $(OTHERSUBDIRS_MAKEFLAGS) \ + FULL_VERSION=$(FULL_VERSION) RELEASE=$(RELEASE) || exit 1; \ + fi ; \ +done +@$(ECHO) "Done Processing OTHERSUBDIRS: $(OTHERSUBDIRS)" +endef + +# +# Iterate the list specified in SUBDIRS_ only if +# SUBDIRS_ is set and or "all" is specified +# in the BUILD_MODULES variable +# +ifdef SUBDIRS_desktop + ifneq (,$(findstring desktop, $(BUILD_MODULES))) + define subdirs-desktop-loop + @$(call subdirs-group-loop,SUBDIRS_desktop) + endef + else + define subdirs-desktop-loop + endef + endif +else + define subdirs-desktop-loop + endef +endif # SUBDIRS_desktop + +ifdef SUBDIRS_enterprise + ifneq (,$(findstring enterprise, $(BUILD_MODULES))) + define subdirs-enterprise-loop + @$(call subdirs-group-loop,SUBDIRS_enterprise) + endef + else + define subdirs-enterprise-loop + endef + endif +else +define subdirs-enterprise-loop +endef +endif # SUBDIRS_enterprise + +ifdef SUBDIRS_management + ifneq (,$(findstring management, $(BUILD_MODULES))) + define subdirs-management-loop + @$(call subdirs-group-loop,SUBDIRS_management) + endef + else + define subdirs-management-loop + endef + endif +else +define subdirs-management-loop +endef +endif # SUBDIRS_management + +ifdef SUBDIRS_misc + ifneq (,$(findstring misc, $(BUILD_MODULES))) + define subdirs-misc-loop + @$(call subdirs-group-loop,SUBDIRS_misc) + endef + else + define subdirs-misc-loop + endef + endif +else +define subdirs-misc-loop +endef +endif # SUBDIRS_misc + +ifdef SUBDIRS_tools + ifneq (,$(findstring tools, $(BUILD_MODULES))) + define subdirs-tools-loop + @$(call subdirs-group-loop,SUBDIRS_tools) + endef + else + define subdirs-tools-loop + endef + endif +else +define subdirs-tools-loop +endef +endif # SUBDIRS_tools + +# +# If BUILD_MODULES is not set or it's set to "all", +# iterate all groups. +SUBDIRS_all = $(SUBDIRS) $(SUBDIRS_desktop) $(SUBDIRS_enterprise) \ + $(SUBDIRS_management) $(SUBDIRS_misc) $(SUBDIRS_tools) + +ifndef BUILD_MODULES +define SUBDIRS-loop + @$(call subdirs-group-loop,SUBDIRS_all) +endef + +else + +ifneq (,$(findstring all, $(BUILD_MODULES))) +define SUBDIRS-loop + @$(call subdirs-group-loop,SUBDIRS_all) +endef + +else # BUILD_MODULES set +# +# Iterate SUBDIRS and the groups specified in BUILD_MODULES +# +define SUBDIRS-loop + @$(call subdirs-group-loop,SUBDIRS) + @$(subdirs-desktop-loop) + @$(subdirs-enterprise-loop) + @$(subdirs-management-loop) + @$(subdirs-misc-loop) + @$(subdirs-tools-loop) +endef + +endif +endif # BUILD_MODULES diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/common/shared/Sanity.gmk --- a/jdk/make/common/shared/Sanity.gmk Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/common/shared/Sanity.gmk Fri Mar 19 18:49:36 2010 -0700 @@ -218,7 +218,8 @@ sane-zip_version \ sane-unzip_version \ sane-msvcrt_path \ - sane-freetype + sane-freetype \ + sane-build_modules ###################################################### # check for COPYRIGHT_YEAR variable @@ -686,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 @@ -741,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" \ @@ -771,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" \ @@ -788,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" \ @@ -845,6 +846,21 @@ endif ###################################################### +# if specified, BUILD_MODULES must contain valid values. +###################################################### +MODULES_REGEX="all|base|desktop|management|enterprise|misc|tools" +sane-build_modules: +ifdef BUILD_MODULES + @for m in $(BUILD_MODULES) ; do \ + valid=`$(ECHO) $$m | $(EGREP) $(MODULES_REGEX)`; \ + if [ "x$$valid" = "x" ] ; then \ + $(ECHO) "ERROR: $$m set in the BUILD_MODULES variable is invalid.\n" \ + "" >> $(ERROR_FILE); \ + fi \ + done +endif + +###################################################### # CUPS_HEADERS_PATH must be valid ###################################################### sane-cups: @@ -1522,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" \ diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/java/Makefile --- a/jdk/make/java/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/java/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -38,9 +38,13 @@ # Others # Note: java_crw_demo java_hprof_demo are demos but must be delivered built in sdk -SUBDIRS += security npt java_crw_demo java_hprof_demo \ - math awt util text applet net nio dyn \ - sql rmi jar beans logging management instrument + +SUBDIRS += security math util text net nio jar + +SUBDIRS_desktop = awt applet beans +SUBDIRS_management = management +SUBDIRS_misc = npt java_crw_demo java_hprof_demo \ + logging instrument dyn sql rmi ifeq ($(PLATFORM), solaris) @@ -53,6 +57,8 @@ SUBDIRS += jexec endif # PLATFORM +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/java/hpi/Makefile --- a/jdk/make/java/hpi/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/java/hpi/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -34,6 +34,8 @@ # Build specified the HPI implementations # SUBDIRS = $(HPIS) +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/java/java/Makefile --- a/jdk/make/java/java/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/java/java/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -218,6 +218,8 @@ endif SUBDIRS = reflect +include $(BUILDDIR)/common/Subdirs.gmk + all build: $(SUBDIRS-loop) clean clobber:: diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/java/java/genlocales.gmk --- a/jdk/make/java/java/genlocales.gmk Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/java/java/genlocales.gmk Fri Mar 19 18:49:36 2010 -0700 @@ -49,7 +49,7 @@ # $(BUILDDIR)/java/text/FILES_java.gmk contains the "sun.text.resources" for # European language support -include $(BUILDDIR)/java/text/FILES_java.gmk +include $(BUILDDIR)/java/text/base/FILES_java.gmk Euro_Resources_java += $(FILES_java) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/java/main/Makefile --- a/jdk/make/java/main/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/java/main/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -36,6 +36,8 @@ else SUBDIRS = java endif +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/java/nio/FILES_java.gmk --- a/jdk/make/java/nio/FILES_java.gmk Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/java/nio/FILES_java.gmk Fri Mar 19 18:49:36 2010 -0700 @@ -26,7 +26,6 @@ FILES_src = \ java/nio/Bits.java \ java/nio/Buffer.java \ - java/nio/BufferPoolMXBean.java \ java/nio/ByteOrder.java \ java/nio/MappedByteBuffer.java \ java/nio/StringCharBuffer.java \ diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/java/nio/Makefile --- a/jdk/make/java/nio/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/java/nio/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -304,7 +304,11 @@ # Rules # +SUBDIRS_management = mxbean +include $(BUILDDIR)/common/Subdirs.gmk + build: sources + $(SUBDIRS-loop) clean clobber:: $(RM) -r $(NIO_GEN) $(SNIO_GEN) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/java/nio/mxbean/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/make/java/nio/mxbean/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -0,0 +1,34 @@ +# +# 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. +# + +BUILDDIR = ../../.. +MODULE = management +PACKAGE = java.nio +PRODUCT = java +include $(BUILDDIR)/common/Defs.gmk + +FILES_java = java/nio/BufferPoolMXBean.java + +include $(BUILDDIR)/common/Classes.gmk diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/java/redist/Makefile --- a/jdk/make/java/redist/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/java/redist/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -62,7 +62,10 @@ # Needed to do file copy ABS_BUILDDIR :=$(call FullPath,$(BUILDDIR)) -SUBDIRS = fonts sajdi +SUBDIRS_desktop = fonts +SUBDIRS_tools = sajdi +include $(BUILDDIR)/common/Subdirs.gmk + all clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/java/text/FILES_java.gmk --- a/jdk/make/java/text/FILES_java.gmk Fri Mar 12 01:09:13 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,263 +0,0 @@ -# -# Copyright 1996-2007 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. -# - -FILES_java = \ - java/text/Annotation.java \ - java/text/AttributedCharacterIterator.java \ - java/text/AttributedString.java \ - java/text/BreakDictionary.java \ - java/text/BreakIterator.java \ - java/text/Bidi.java \ - java/text/CharacterIterator.java \ - java/text/CharacterIteratorFieldDelegate.java \ - java/text/ChoiceFormat.java \ - java/text/Collator.java \ - java/text/CollationElementIterator.java \ - java/text/CollationKey.java \ - java/text/CollationRules.java \ - java/text/DateFormat.java \ - java/text/DateFormatSymbols.java \ - java/text/DecimalFormat.java \ - java/text/DictionaryBasedBreakIterator.java \ - java/text/DigitList.java \ - java/text/EntryPair.java \ - java/text/Format.java \ - java/text/FieldPosition.java \ - java/text/DontCareFieldPosition.java \ - java/text/MergeCollation.java \ - java/text/MessageFormat.java \ - java/text/Normalizer.java \ - java/text/NumberFormat.java \ - java/text/DecimalFormatSymbols.java \ - java/text/ParseException.java \ - java/text/ParsePosition.java \ - java/text/PatternEntry.java \ - java/text/RBCollationTables.java \ - java/text/RBTableBuilder.java \ - java/text/RuleBasedBreakIterator.java \ - java/text/RuleBasedCollator.java \ - java/text/RuleBasedCollationKey.java \ - java/text/SimpleDateFormat.java \ - java/text/StringCharacterIterator.java \ - java/text/spi/BreakIteratorProvider.java \ - java/text/spi/CollatorProvider.java \ - java/text/spi/DateFormatProvider.java \ - java/text/spi/DateFormatSymbolsProvider.java \ - java/text/spi/DecimalFormatSymbolsProvider.java \ - java/text/spi/NumberFormatProvider.java \ - sun/text/SupplementaryCharacterData.java \ - sun/text/CodePointIterator.java \ - sun/text/CollatorUtilities.java \ - sun/text/CompactByteArray.java \ - sun/text/ComposedCharIter.java \ - sun/text/IntHashtable.java \ - sun/text/Normalizer.java \ - sun/text/SupplementaryCharacterData.java \ - sun/text/UCompactIntArray.java \ - sun/text/bidi/BidiBase.java \ - sun/text/bidi/BidiLine.java \ - sun/text/bidi/BidiRun.java \ - \ - sun/text/normalizer/CharTrie.java \ - sun/text/normalizer/CharacterIteratorWrapper.java \ - sun/text/normalizer/ICUBinary.java \ - sun/text/normalizer/ICUData.java \ - sun/text/normalizer/IntTrie.java \ - sun/text/normalizer/NormalizerBase.java \ - sun/text/normalizer/NormalizerDataReader.java \ - sun/text/normalizer/NormalizerImpl.java \ - sun/text/normalizer/RangeValueIterator.java \ - sun/text/normalizer/Replaceable.java \ - sun/text/normalizer/ReplaceableString.java \ - sun/text/normalizer/ReplaceableUCharacterIterator.java \ - sun/text/normalizer/RuleCharacterIterator.java \ - sun/text/normalizer/SymbolTable.java \ - sun/text/normalizer/Trie.java \ - sun/text/normalizer/TrieIterator.java \ - sun/text/normalizer/UBiDiProps.java \ - sun/text/normalizer/UCharacter.java \ - sun/text/normalizer/UCharacterIterator.java \ - sun/text/normalizer/UCharacterProperty.java \ - sun/text/normalizer/UCharacterPropertyReader.java \ - sun/text/normalizer/UTF16.java \ - sun/text/normalizer/UnicodeMatcher.java \ - sun/text/normalizer/UnicodeSet.java \ - sun/text/normalizer/UnicodeSetIterator.java \ - sun/text/normalizer/Utility.java \ - sun/text/normalizer/VersionInfo.java \ - \ - sun/text/resources/BreakIteratorInfo.java \ - \ - sun/text/resources/CollationData.java \ - sun/text/resources/CollationData_be.java \ - sun/text/resources/CollationData_bg.java \ - sun/text/resources/CollationData_ca.java \ - sun/text/resources/CollationData_cs.java \ - sun/text/resources/CollationData_da.java \ - sun/text/resources/CollationData_de.java \ - sun/text/resources/CollationData_el.java \ - sun/text/resources/CollationData_en.java \ - sun/text/resources/CollationData_es.java \ - sun/text/resources/CollationData_et.java \ - sun/text/resources/CollationData_fi.java \ - sun/text/resources/CollationData_fr.java \ - sun/text/resources/CollationData_hr.java \ - sun/text/resources/CollationData_hu.java \ - sun/text/resources/CollationData_is.java \ - sun/text/resources/CollationData_it.java \ - sun/text/resources/CollationData_lt.java \ - sun/text/resources/CollationData_lv.java \ - sun/text/resources/CollationData_mk.java \ - sun/text/resources/CollationData_nl.java \ - sun/text/resources/CollationData_no.java \ - sun/text/resources/CollationData_pl.java \ - sun/text/resources/CollationData_pt.java \ - sun/text/resources/CollationData_ro.java \ - sun/text/resources/CollationData_ru.java \ - sun/text/resources/CollationData_sk.java \ - sun/text/resources/CollationData_sl.java \ - sun/text/resources/CollationData_sq.java \ - sun/text/resources/CollationData_sr.java \ - sun/text/resources/CollationData_sv.java \ - sun/text/resources/CollationData_tr.java \ - sun/text/resources/CollationData_uk.java \ - \ - sun/text/resources/FormatData.java \ - sun/text/resources/FormatData_be.java \ - sun/text/resources/FormatData_be_BY.java \ - sun/text/resources/FormatData_bg.java \ - sun/text/resources/FormatData_bg_BG.java \ - sun/text/resources/FormatData_ca.java \ - sun/text/resources/FormatData_ca_ES.java \ - sun/text/resources/FormatData_cs.java \ - sun/text/resources/FormatData_cs_CZ.java \ - sun/text/resources/FormatData_da.java \ - sun/text/resources/FormatData_da_DK.java \ - sun/text/resources/FormatData_de.java \ - sun/text/resources/FormatData_de_AT.java \ - sun/text/resources/FormatData_de_CH.java \ - sun/text/resources/FormatData_de_DE.java \ - sun/text/resources/FormatData_de_LU.java \ - sun/text/resources/FormatData_el.java \ - sun/text/resources/FormatData_el_CY.java \ - sun/text/resources/FormatData_el_GR.java \ - sun/text/resources/FormatData_en.java \ - sun/text/resources/FormatData_en_US.java \ - sun/text/resources/FormatData_en_AU.java \ - sun/text/resources/FormatData_en_CA.java \ - sun/text/resources/FormatData_en_GB.java \ - sun/text/resources/FormatData_en_IE.java \ - sun/text/resources/FormatData_en_IN.java \ - sun/text/resources/FormatData_en_MT.java \ - sun/text/resources/FormatData_en_NZ.java \ - sun/text/resources/FormatData_en_PH.java \ - sun/text/resources/FormatData_en_SG.java \ - sun/text/resources/FormatData_en_ZA.java \ - sun/text/resources/FormatData_es.java \ - sun/text/resources/FormatData_es_BO.java \ - sun/text/resources/FormatData_es_AR.java \ - sun/text/resources/FormatData_es_CL.java \ - sun/text/resources/FormatData_es_CO.java \ - sun/text/resources/FormatData_es_CR.java \ - sun/text/resources/FormatData_es_DO.java \ - sun/text/resources/FormatData_es_EC.java \ - sun/text/resources/FormatData_es_ES.java \ - sun/text/resources/FormatData_es_GT.java \ - sun/text/resources/FormatData_es_HN.java \ - sun/text/resources/FormatData_es_MX.java \ - sun/text/resources/FormatData_es_NI.java \ - sun/text/resources/FormatData_es_PA.java \ - sun/text/resources/FormatData_es_PE.java \ - sun/text/resources/FormatData_es_PR.java \ - sun/text/resources/FormatData_es_PY.java \ - sun/text/resources/FormatData_es_SV.java \ - sun/text/resources/FormatData_es_US.java \ - sun/text/resources/FormatData_es_UY.java \ - sun/text/resources/FormatData_es_VE.java \ - sun/text/resources/FormatData_et.java \ - sun/text/resources/FormatData_et_EE.java \ - sun/text/resources/FormatData_fi.java \ - sun/text/resources/FormatData_fi_FI.java \ - sun/text/resources/FormatData_fr.java \ - sun/text/resources/FormatData_fr_BE.java \ - sun/text/resources/FormatData_fr_CA.java \ - sun/text/resources/FormatData_fr_CH.java \ - sun/text/resources/FormatData_fr_FR.java \ - sun/text/resources/FormatData_fr_LU.java \ - sun/text/resources/FormatData_ga.java \ - sun/text/resources/FormatData_ga_IE.java \ - sun/text/resources/FormatData_hr.java \ - sun/text/resources/FormatData_hr_HR.java \ - sun/text/resources/FormatData_hu.java \ - sun/text/resources/FormatData_hu_HU.java \ - sun/text/resources/FormatData_in.java \ - sun/text/resources/FormatData_in_ID.java \ - sun/text/resources/FormatData_is.java \ - sun/text/resources/FormatData_is_IS.java \ - sun/text/resources/FormatData_it.java \ - sun/text/resources/FormatData_it_CH.java \ - sun/text/resources/FormatData_it_IT.java \ - sun/text/resources/FormatData_lt.java \ - sun/text/resources/FormatData_lt_LT.java \ - sun/text/resources/FormatData_lv.java \ - sun/text/resources/FormatData_lv_LV.java \ - sun/text/resources/FormatData_mk.java \ - sun/text/resources/FormatData_mk_MK.java \ - sun/text/resources/FormatData_ms.java \ - sun/text/resources/FormatData_ms_MY.java \ - sun/text/resources/FormatData_mt.java \ - sun/text/resources/FormatData_mt_MT.java \ - sun/text/resources/FormatData_nl.java \ - sun/text/resources/FormatData_nl_BE.java \ - sun/text/resources/FormatData_nl_NL.java \ - sun/text/resources/FormatData_no.java \ - sun/text/resources/FormatData_no_NO.java \ - sun/text/resources/FormatData_no_NO_NY.java \ - sun/text/resources/FormatData_pl.java \ - sun/text/resources/FormatData_pl_PL.java \ - sun/text/resources/FormatData_pt.java \ - sun/text/resources/FormatData_pt_BR.java \ - sun/text/resources/FormatData_pt_PT.java \ - sun/text/resources/FormatData_ro.java \ - sun/text/resources/FormatData_ro_RO.java \ - sun/text/resources/FormatData_ru.java \ - sun/text/resources/FormatData_ru_RU.java \ - sun/text/resources/FormatData_sk.java \ - sun/text/resources/FormatData_sk_SK.java \ - sun/text/resources/FormatData_sl.java \ - sun/text/resources/FormatData_sl_SI.java \ - sun/text/resources/FormatData_sq.java \ - sun/text/resources/FormatData_sq_AL.java \ - sun/text/resources/FormatData_sr.java \ - sun/text/resources/FormatData_sr_BA.java \ - sun/text/resources/FormatData_sr_CS.java \ - sun/text/resources/FormatData_sr_ME.java \ - sun/text/resources/FormatData_sr_RS.java \ - sun/text/resources/FormatData_sv.java \ - sun/text/resources/FormatData_sv_SE.java \ - sun/text/resources/FormatData_tr.java \ - sun/text/resources/FormatData_tr_TR.java \ - sun/text/resources/FormatData_uk.java \ - sun/text/resources/FormatData_uk_UA.java diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/java/text/Makefile --- a/jdk/make/java/text/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/java/text/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -1,5 +1,5 @@ # -# Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved. +# 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 @@ -23,86 +23,19 @@ # have any questions. # +# +# Makefile for building all of java.text +# + BUILDDIR = ../.. -MODULE = base -PACKAGE = java.text PRODUCT = sun - include $(BUILDDIR)/common/Defs.gmk -# -# Files -# -include FILES_java.gmk - -# -# Include -# -include $(BUILDDIR)/common/Classes.gmk - -# -# Rules to add data files BreakIterator -# -TEXT_CLASSES = $(BUILDTOOLCLASSDIR)/java.text/classes - -# input -# -# Notes: sun.text.resources.BreakIteratorRules no longer goes to runtime. -# They are used at JDK build phase in order to create $(BIFILES) which -# are used on runtime instead. -# -TEXT_SRCDIR = $(SHARE_SRC)/classes/sun/text/resources -TEXT_SOURCES = $(TEXT_SRCDIR)/BreakIteratorRules.java \ - $(TEXT_SRCDIR)/BreakIteratorInfo.java -UNICODEDATA = $(BUILDDIR)/tools/UnicodeData - -# output -TEXT_CLASSDIR = $(CLASSBINDIR)/sun/text/resources -BIFILES = $(TEXT_CLASSDIR)/CharacterBreakIteratorData \ - $(TEXT_CLASSDIR)/WordBreakIteratorData \ - $(TEXT_CLASSDIR)/LineBreakIteratorData \ - $(TEXT_CLASSDIR)/SentenceBreakIteratorData - -ICU_FILES = $(TEXT_CLASSDIR)/unorm.icu \ - $(TEXT_CLASSDIR)/uprops.icu \ - $(TEXT_CLASSDIR)/ubidi.icu +SUBDIRS = base +SUBDIRS_desktop = bidi -# builder -GENERATEBREAKITERATORDATA_JARFILE = \ - $(BUILDTOOLJARDIR)/generatebreakiteratordata.jar - -$(BIFILES): $(GENERATEBREAKITERATORDATA_JARFILE) \ - $(UNICODEDATA)/UnicodeData.txt \ - $(TEXT_SOURCES) - $(prep-target) - $(RM) -r $(TEXT_CLASSES) - $(MKDIR) -p $(TEXT_CLASSES) - $(BOOT_JAVAC_CMD) -d $(TEXT_CLASSES) \ - -sourcepath $(TEXT_SRCDIR) \ - $(TEXT_SOURCES) - $(MKDIR) -p $(TEXT_CLASSDIR) - $(BOOT_JAVA_CMD) -Xbootclasspath/p:$(TEXT_CLASSES) \ - -jar $(GENERATEBREAKITERATORDATA_JARFILE) \ - -o $(TEXT_CLASSDIR) \ - -spec $(UNICODEDATA)/UnicodeData.txt - @$(java-vm-cleanup) +include $(BUILDDIR)/common/Subdirs.gmk -build: $(BIFILES) $(ICU_FILES) - -# -# Extra rules to copy unorm.icu, uprops.icu, and ubidi.icu -# -$(TEXT_CLASSDIR)/unorm.icu: $(TEXT_SRCDIR)/unorm.icu - $(install-file) +all build clean clobber:: + $(SUBDIRS-loop) -$(TEXT_CLASSDIR)/uprops.icu: $(TEXT_SRCDIR)/uprops.icu - $(install-file) - -$(TEXT_CLASSDIR)/ubidi.icu: $(TEXT_SRCDIR)/ubidi.icu - $(install-file) - -clean clobber:: - $(RM) -r $(TEXT_CLASSES) - $(RM) -r $(BIFILES) - $(RM) $(ICU_FILES) - diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/java/text/base/FILES_java.gmk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/make/java/text/base/FILES_java.gmk Fri Mar 19 18:49:36 2010 -0700 @@ -0,0 +1,258 @@ +# +# Copyright 1996-2007 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. +# + +FILES_java = \ + java/text/Annotation.java \ + java/text/AttributedCharacterIterator.java \ + java/text/AttributedString.java \ + java/text/BreakDictionary.java \ + java/text/BreakIterator.java \ + java/text/CharacterIterator.java \ + java/text/CharacterIteratorFieldDelegate.java \ + java/text/ChoiceFormat.java \ + java/text/Collator.java \ + java/text/CollationElementIterator.java \ + java/text/CollationKey.java \ + java/text/CollationRules.java \ + java/text/DateFormat.java \ + java/text/DateFormatSymbols.java \ + java/text/DecimalFormat.java \ + java/text/DictionaryBasedBreakIterator.java \ + java/text/DigitList.java \ + java/text/EntryPair.java \ + java/text/Format.java \ + java/text/FieldPosition.java \ + java/text/DontCareFieldPosition.java \ + java/text/MergeCollation.java \ + java/text/MessageFormat.java \ + java/text/Normalizer.java \ + java/text/NumberFormat.java \ + java/text/DecimalFormatSymbols.java \ + java/text/ParseException.java \ + java/text/ParsePosition.java \ + java/text/PatternEntry.java \ + java/text/RBCollationTables.java \ + java/text/RBTableBuilder.java \ + java/text/RuleBasedBreakIterator.java \ + java/text/RuleBasedCollator.java \ + java/text/RuleBasedCollationKey.java \ + java/text/SimpleDateFormat.java \ + java/text/StringCharacterIterator.java \ + java/text/spi/BreakIteratorProvider.java \ + java/text/spi/CollatorProvider.java \ + java/text/spi/DateFormatProvider.java \ + java/text/spi/DateFormatSymbolsProvider.java \ + java/text/spi/DecimalFormatSymbolsProvider.java \ + java/text/spi/NumberFormatProvider.java \ + sun/text/SupplementaryCharacterData.java \ + sun/text/CodePointIterator.java \ + sun/text/CollatorUtilities.java \ + sun/text/CompactByteArray.java \ + sun/text/ComposedCharIter.java \ + sun/text/IntHashtable.java \ + sun/text/Normalizer.java \ + sun/text/SupplementaryCharacterData.java \ + sun/text/UCompactIntArray.java \ + sun/text/normalizer/CharTrie.java \ + sun/text/normalizer/CharacterIteratorWrapper.java \ + sun/text/normalizer/ICUBinary.java \ + sun/text/normalizer/ICUData.java \ + sun/text/normalizer/IntTrie.java \ + sun/text/normalizer/NormalizerBase.java \ + sun/text/normalizer/NormalizerDataReader.java \ + sun/text/normalizer/NormalizerImpl.java \ + sun/text/normalizer/RangeValueIterator.java \ + sun/text/normalizer/Replaceable.java \ + sun/text/normalizer/ReplaceableString.java \ + sun/text/normalizer/ReplaceableUCharacterIterator.java \ + sun/text/normalizer/RuleCharacterIterator.java \ + sun/text/normalizer/SymbolTable.java \ + sun/text/normalizer/Trie.java \ + sun/text/normalizer/TrieIterator.java \ + sun/text/normalizer/UBiDiProps.java \ + sun/text/normalizer/UCharacter.java \ + sun/text/normalizer/UCharacterIterator.java \ + sun/text/normalizer/UCharacterProperty.java \ + sun/text/normalizer/UCharacterPropertyReader.java \ + sun/text/normalizer/UTF16.java \ + sun/text/normalizer/UnicodeMatcher.java \ + sun/text/normalizer/UnicodeSet.java \ + sun/text/normalizer/UnicodeSetIterator.java \ + sun/text/normalizer/Utility.java \ + sun/text/normalizer/VersionInfo.java \ + \ + sun/text/resources/BreakIteratorInfo.java \ + \ + sun/text/resources/CollationData.java \ + sun/text/resources/CollationData_be.java \ + sun/text/resources/CollationData_bg.java \ + sun/text/resources/CollationData_ca.java \ + sun/text/resources/CollationData_cs.java \ + sun/text/resources/CollationData_da.java \ + sun/text/resources/CollationData_de.java \ + sun/text/resources/CollationData_el.java \ + sun/text/resources/CollationData_en.java \ + sun/text/resources/CollationData_es.java \ + sun/text/resources/CollationData_et.java \ + sun/text/resources/CollationData_fi.java \ + sun/text/resources/CollationData_fr.java \ + sun/text/resources/CollationData_hr.java \ + sun/text/resources/CollationData_hu.java \ + sun/text/resources/CollationData_is.java \ + sun/text/resources/CollationData_it.java \ + sun/text/resources/CollationData_lt.java \ + sun/text/resources/CollationData_lv.java \ + sun/text/resources/CollationData_mk.java \ + sun/text/resources/CollationData_nl.java \ + sun/text/resources/CollationData_no.java \ + sun/text/resources/CollationData_pl.java \ + sun/text/resources/CollationData_pt.java \ + sun/text/resources/CollationData_ro.java \ + sun/text/resources/CollationData_ru.java \ + sun/text/resources/CollationData_sk.java \ + sun/text/resources/CollationData_sl.java \ + sun/text/resources/CollationData_sq.java \ + sun/text/resources/CollationData_sr.java \ + sun/text/resources/CollationData_sv.java \ + sun/text/resources/CollationData_tr.java \ + sun/text/resources/CollationData_uk.java \ + \ + sun/text/resources/FormatData.java \ + sun/text/resources/FormatData_be.java \ + sun/text/resources/FormatData_be_BY.java \ + sun/text/resources/FormatData_bg.java \ + sun/text/resources/FormatData_bg_BG.java \ + sun/text/resources/FormatData_ca.java \ + sun/text/resources/FormatData_ca_ES.java \ + sun/text/resources/FormatData_cs.java \ + sun/text/resources/FormatData_cs_CZ.java \ + sun/text/resources/FormatData_da.java \ + sun/text/resources/FormatData_da_DK.java \ + sun/text/resources/FormatData_de.java \ + sun/text/resources/FormatData_de_AT.java \ + sun/text/resources/FormatData_de_CH.java \ + sun/text/resources/FormatData_de_DE.java \ + sun/text/resources/FormatData_de_LU.java \ + sun/text/resources/FormatData_el.java \ + sun/text/resources/FormatData_el_CY.java \ + sun/text/resources/FormatData_el_GR.java \ + sun/text/resources/FormatData_en.java \ + sun/text/resources/FormatData_en_US.java \ + sun/text/resources/FormatData_en_AU.java \ + sun/text/resources/FormatData_en_CA.java \ + sun/text/resources/FormatData_en_GB.java \ + sun/text/resources/FormatData_en_IE.java \ + sun/text/resources/FormatData_en_IN.java \ + sun/text/resources/FormatData_en_MT.java \ + sun/text/resources/FormatData_en_NZ.java \ + sun/text/resources/FormatData_en_PH.java \ + sun/text/resources/FormatData_en_SG.java \ + sun/text/resources/FormatData_en_ZA.java \ + sun/text/resources/FormatData_es.java \ + sun/text/resources/FormatData_es_BO.java \ + sun/text/resources/FormatData_es_AR.java \ + sun/text/resources/FormatData_es_CL.java \ + sun/text/resources/FormatData_es_CO.java \ + sun/text/resources/FormatData_es_CR.java \ + sun/text/resources/FormatData_es_DO.java \ + sun/text/resources/FormatData_es_EC.java \ + sun/text/resources/FormatData_es_ES.java \ + sun/text/resources/FormatData_es_GT.java \ + sun/text/resources/FormatData_es_HN.java \ + sun/text/resources/FormatData_es_MX.java \ + sun/text/resources/FormatData_es_NI.java \ + sun/text/resources/FormatData_es_PA.java \ + sun/text/resources/FormatData_es_PE.java \ + sun/text/resources/FormatData_es_PR.java \ + sun/text/resources/FormatData_es_PY.java \ + sun/text/resources/FormatData_es_SV.java \ + sun/text/resources/FormatData_es_US.java \ + sun/text/resources/FormatData_es_UY.java \ + sun/text/resources/FormatData_es_VE.java \ + sun/text/resources/FormatData_et.java \ + sun/text/resources/FormatData_et_EE.java \ + sun/text/resources/FormatData_fi.java \ + sun/text/resources/FormatData_fi_FI.java \ + sun/text/resources/FormatData_fr.java \ + sun/text/resources/FormatData_fr_BE.java \ + sun/text/resources/FormatData_fr_CA.java \ + sun/text/resources/FormatData_fr_CH.java \ + sun/text/resources/FormatData_fr_FR.java \ + sun/text/resources/FormatData_fr_LU.java \ + sun/text/resources/FormatData_ga.java \ + sun/text/resources/FormatData_ga_IE.java \ + sun/text/resources/FormatData_hr.java \ + sun/text/resources/FormatData_hr_HR.java \ + sun/text/resources/FormatData_hu.java \ + sun/text/resources/FormatData_hu_HU.java \ + sun/text/resources/FormatData_in.java \ + sun/text/resources/FormatData_in_ID.java \ + sun/text/resources/FormatData_is.java \ + sun/text/resources/FormatData_is_IS.java \ + sun/text/resources/FormatData_it.java \ + sun/text/resources/FormatData_it_CH.java \ + sun/text/resources/FormatData_it_IT.java \ + sun/text/resources/FormatData_lt.java \ + sun/text/resources/FormatData_lt_LT.java \ + sun/text/resources/FormatData_lv.java \ + sun/text/resources/FormatData_lv_LV.java \ + sun/text/resources/FormatData_mk.java \ + sun/text/resources/FormatData_mk_MK.java \ + sun/text/resources/FormatData_ms.java \ + sun/text/resources/FormatData_ms_MY.java \ + sun/text/resources/FormatData_mt.java \ + sun/text/resources/FormatData_mt_MT.java \ + sun/text/resources/FormatData_nl.java \ + sun/text/resources/FormatData_nl_BE.java \ + sun/text/resources/FormatData_nl_NL.java \ + sun/text/resources/FormatData_no.java \ + sun/text/resources/FormatData_no_NO.java \ + sun/text/resources/FormatData_no_NO_NY.java \ + sun/text/resources/FormatData_pl.java \ + sun/text/resources/FormatData_pl_PL.java \ + sun/text/resources/FormatData_pt.java \ + sun/text/resources/FormatData_pt_BR.java \ + sun/text/resources/FormatData_pt_PT.java \ + sun/text/resources/FormatData_ro.java \ + sun/text/resources/FormatData_ro_RO.java \ + sun/text/resources/FormatData_ru.java \ + sun/text/resources/FormatData_ru_RU.java \ + sun/text/resources/FormatData_sk.java \ + sun/text/resources/FormatData_sk_SK.java \ + sun/text/resources/FormatData_sl.java \ + sun/text/resources/FormatData_sl_SI.java \ + sun/text/resources/FormatData_sq.java \ + sun/text/resources/FormatData_sq_AL.java \ + sun/text/resources/FormatData_sr.java \ + sun/text/resources/FormatData_sr_BA.java \ + sun/text/resources/FormatData_sr_CS.java \ + sun/text/resources/FormatData_sr_ME.java \ + sun/text/resources/FormatData_sr_RS.java \ + sun/text/resources/FormatData_sv.java \ + sun/text/resources/FormatData_sv_SE.java \ + sun/text/resources/FormatData_tr.java \ + sun/text/resources/FormatData_tr_TR.java \ + sun/text/resources/FormatData_uk.java \ + sun/text/resources/FormatData_uk_UA.java diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/java/text/base/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/make/java/text/base/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -0,0 +1,108 @@ +# +# Copyright 1996-2006 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. +# + +BUILDDIR = ../../.. +MODULE = base +PACKAGE = java.text +PRODUCT = sun + +include $(BUILDDIR)/common/Defs.gmk + +# +# Files +# +include FILES_java.gmk + +# +# Include +# +include $(BUILDDIR)/common/Classes.gmk + +# +# Rules to add data files BreakIterator +# +TEXT_CLASSES = $(BUILDTOOLCLASSDIR)/java.text/classes + +# input +# +# Notes: sun.text.resources.BreakIteratorRules no longer goes to runtime. +# They are used at JDK build phase in order to create $(BIFILES) which +# are used on runtime instead. +# +TEXT_SRCDIR = $(SHARE_SRC)/classes/sun/text/resources +TEXT_SOURCES = $(TEXT_SRCDIR)/BreakIteratorRules.java \ + $(TEXT_SRCDIR)/BreakIteratorInfo.java +UNICODEDATA = $(BUILDDIR)/tools/UnicodeData + +# output +TEXT_CLASSDIR = $(CLASSBINDIR)/sun/text/resources +BIFILES = $(TEXT_CLASSDIR)/CharacterBreakIteratorData \ + $(TEXT_CLASSDIR)/WordBreakIteratorData \ + $(TEXT_CLASSDIR)/LineBreakIteratorData \ + $(TEXT_CLASSDIR)/SentenceBreakIteratorData + +ICU_FILES = $(TEXT_CLASSDIR)/unorm.icu \ + $(TEXT_CLASSDIR)/uprops.icu \ + $(TEXT_CLASSDIR)/ubidi.icu + +# builder +GENERATEBREAKITERATORDATA_JARFILE = \ + $(BUILDTOOLJARDIR)/generatebreakiteratordata.jar + +$(BIFILES): $(GENERATEBREAKITERATORDATA_JARFILE) \ + $(UNICODEDATA)/UnicodeData.txt \ + $(TEXT_SOURCES) + $(prep-target) + $(RM) -r $(TEXT_CLASSES) + $(MKDIR) -p $(TEXT_CLASSES) + $(BOOT_JAVAC_CMD) -d $(TEXT_CLASSES) \ + -sourcepath $(TEXT_SRCDIR) \ + $(TEXT_SOURCES) + $(MKDIR) -p $(TEXT_CLASSDIR) + $(BOOT_JAVA_CMD) -Xbootclasspath/p:$(TEXT_CLASSES) \ + -jar $(GENERATEBREAKITERATORDATA_JARFILE) \ + -o $(TEXT_CLASSDIR) \ + -spec $(UNICODEDATA)/UnicodeData.txt + @$(java-vm-cleanup) + +build: $(BIFILES) $(ICU_FILES) + +# +# Extra rules to copy unorm.icu, uprops.icu, and ubidi.icu +# +$(TEXT_CLASSDIR)/unorm.icu: $(TEXT_SRCDIR)/unorm.icu + $(install-file) + +$(TEXT_CLASSDIR)/uprops.icu: $(TEXT_SRCDIR)/uprops.icu + $(install-file) + +$(TEXT_CLASSDIR)/ubidi.icu: $(TEXT_SRCDIR)/ubidi.icu + $(install-file) + +clean clobber:: + $(RM) -r $(TEXT_CLASSES) + $(RM) -r $(BIFILES) + $(RM) $(ICU_FILES) + diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/java/text/bidi/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/make/java/text/bidi/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -0,0 +1,44 @@ +# +# 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. +# + +BUILDDIR = ../../.. +PACKAGE = java.text +PRODUCT = sun +include $(BUILDDIR)/common/Defs.gmk + +# +# Files for Bidi that is not in the base module +# +FILES_java = \ + java/text/Bidi.java \ + sun/text/bidi/BidiBase.java \ + sun/text/bidi/BidiLine.java \ + sun/text/bidi/BidiRun.java \ + sun/text/CodePointIterator.java + +# +# Include +# +include $(BUILDDIR)/common/Classes.gmk diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/javax/Makefile --- a/jdk/make/javax/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/javax/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -30,19 +30,24 @@ BUILDDIR = .. include $(BUILDDIR)/common/Defs.gmk -# imageio uses xml, so build it last +SUBDIRS = others + +SUBDIRS_management = management + +SUBDIRS_misc = \ + crypto \ + sql \ + rmi -SUBDIRS = \ - others \ - accessibility \ - print \ - swing \ - crypto \ - sound \ - sql \ - rmi \ - management \ - imageio +# imageio uses xml, so build it last +SUBDIRS_desktop = \ + accessibility \ + print \ + swing \ + sound \ + imageio + +include $(BUILDDIR)/common/Subdirs.gmk all build: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/javax/rmi/Makefile --- a/jdk/make/javax/rmi/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/javax/rmi/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -31,6 +31,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = ssl +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/javax/sound/Makefile --- a/jdk/make/javax/sound/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/javax/sound/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -159,6 +159,7 @@ # Include rules # include $(BUILDDIR)/common/Library.gmk +include $(BUILDDIR)/common/Subdirs.gmk # # Rules that copy files. diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/javax/swing/Makefile --- a/jdk/make/javax/swing/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/javax/swing/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -40,6 +40,7 @@ SUBDIRS = html32dtd plaf include $(BUILDDIR)/common/Classes.gmk +include $(BUILDDIR)/common/Subdirs.gmk build: other_files $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/jpda/Makefile --- a/jdk/make/jpda/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/jpda/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -35,6 +35,7 @@ # Core. # SUBDIRS = jdwp back front transport expr tty bdi gui +include $(BUILDDIR)/common/Subdirs.gmk all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/jpda/transport/Makefile --- a/jdk/make/jpda/transport/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/jpda/transport/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -36,6 +36,8 @@ ifeq ($(PLATFORM), windows) SUBDIRS += shmem endif # PLATFORM + +include $(BUILDDIR)/common/Subdirs.gmk all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/mkdemo/Makefile --- a/jdk/make/mkdemo/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/mkdemo/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -31,7 +31,13 @@ PRODUCT = demos include $(BUILDDIR)/common/Defs.gmk -SUBDIRS = applets jfc jvmti management jni scripting jpda +SUBDIRS = jni +SUBDIRS_desktop = applets jfc +SUBDIRS_management = management +SUBDIRS_misc = scripting +SUBDIRS_tools = jpda jvmti + +include $(BUILDDIR)/common/Subdirs.gmk all build:: nbproject $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/mkdemo/applets/Makefile --- a/jdk/make/mkdemo/applets/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/mkdemo/applets/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -40,6 +40,7 @@ SUBDIRS_MAKEFLAGS += DEMO_IS_APPLET=true +include $(BUILDDIR)/common/Subdirs.gmk all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/mkdemo/jfc/Makefile --- a/jdk/make/mkdemo/jfc/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/mkdemo/jfc/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -46,6 +46,7 @@ SUBDIRS += Java2D SwingSet2 Stylepad endif +include $(BUILDDIR)/common/Subdirs.gmk all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/mkdemo/jni/Makefile --- a/jdk/make/mkdemo/jni/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/mkdemo/jni/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -37,6 +37,8 @@ SUBDIRS += Poller endif +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/mkdemo/jvmti/Makefile --- a/jdk/make/mkdemo/jvmti/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/mkdemo/jvmti/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -48,6 +48,8 @@ waiters \ hprof +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/mkdemo/management/Makefile --- a/jdk/make/mkdemo/management/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/mkdemo/management/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -38,6 +38,8 @@ MemoryMonitor \ JTop +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/mkdemo/scripting/Makefile --- a/jdk/make/mkdemo/scripting/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/mkdemo/scripting/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -32,6 +32,7 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = jconsole-plugin +include $(BUILDDIR)/common/Subdirs.gmk all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/mksample/Makefile --- a/jdk/make/mksample/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/mksample/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -37,13 +37,18 @@ WEBSERVICES_SUBDIR = webservices endif -SUBDIRS = nio jmx scripting $(WEBSERVICES_SUBDIR) nbproject +SUBDIRS = +SUBDIRS_misc = nio scripting nbproject +SUBDIRS_enterprise = $(WEBSERVICES_SUBDIR) +SUBDIRS_management = jmx # include dtrace samples in Solaris builds ifeq ($(PLATFORM), solaris) SUBDIRS += dtrace endif +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/mksample/jmx/Makefile --- a/jdk/make/mksample/jmx/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/mksample/jmx/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -32,6 +32,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = jmx-scandir +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/mksample/nio/Makefile --- a/jdk/make/mksample/nio/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/mksample/nio/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -32,6 +32,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = file multicast server +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/mksample/scripting/Makefile --- a/jdk/make/mksample/scripting/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/mksample/scripting/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -32,6 +32,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = scriptpad +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/mksample/webservices/Makefile --- a/jdk/make/mksample/webservices/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/mksample/webservices/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -32,6 +32,7 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = EbayClient EbayServer +include $(BUILDDIR)/common/Subdirs.gmk all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/modules/tools/Makefile --- a/jdk/make/modules/tools/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/modules/tools/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -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) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/org/Makefile --- a/jdk/make/org/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/org/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -32,6 +32,7 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = ietf jcp +include $(BUILDDIR)/common/Subdirs.gmk all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/org/ietf/Makefile --- a/jdk/make/org/ietf/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/org/ietf/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -31,6 +31,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = jgss +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/Makefile --- a/jdk/make/sun/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -58,13 +58,18 @@ else RENDER_SUBDIR = dcpr endif + # nio need to be compiled before awt to have all charsets ready -SUBDIRS = jar security javazic misc jkernel net audio $(RENDER_SUBDIR) image \ - nio awt splashscreen $(XAWT_SUBDIR) \ - $(HEADLESS_SUBDIR) $(DGA_SUBDIR) \ - font jpeg cmm applet rmi beans $(JDBC_SUBDIR) \ - jawt text launcher management $(ORG_SUBDIR) \ - native2ascii serialver tools jconsole tracing +SUBDIRS = jar security javazic misc net nio text launcher +SUBDIRS_desktop = audio $(RENDER_SUBDIR) image \ + awt splashscreen $(XAWT_SUBDIR) \ + $(HEADLESS_SUBDIR) $(DGA_SUBDIR) \ + jawt font jpeg cmm applet beans +SUBDIRS_management = management +SUBDIRS_misc = jkernel $(ORG_SUBDIR) \ + rmi $(JDBC_SUBDIR) tracing +SUBDIRS_tools = native2ascii serialver tools jconsole +include $(BUILDDIR)/common/Subdirs.gmk all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/cmm/Makefile --- a/jdk/make/sun/cmm/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/cmm/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -36,6 +36,8 @@ ICCPROFILE_SRC_DIR = $(CLOSED_SRC)/share/lib/cmm/kcms endif # OPENJDK +include $(BUILDDIR)/common/Subdirs.gmk + # # ICC Profiles used by the CMM. # diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/image/Makefile --- a/jdk/make/sun/image/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/image/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -43,6 +43,8 @@ endif endif +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/javazic/tzdata/VERSION --- a/jdk/make/sun/javazic/tzdata/VERSION Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/javazic/tzdata/VERSION Fri Mar 19 18:49:36 2010 -0700 @@ -21,4 +21,4 @@ # CA 95054 USA or visit www.sun.com if you need additional information or # have any questions. # -tzdata2009r +tzdata2010b diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/javazic/tzdata/antarctica --- a/jdk/make/sun/javazic/tzdata/antarctica Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/javazic/tzdata/antarctica Fri Mar 19 18:49:36 2010 -0700 @@ -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 diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/javazic/tzdata/asia --- a/jdk/make/sun/javazic/tzdata/asia Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/javazic/tzdata/asia Fri Mar 19 18:49:36 2010 -0700 @@ -218,6 +218,41 @@ # http://www.thaindian.com/newsportal/business/bangladesh-to-continue-indefinitely-with-advanced-time_100259987.html # +# 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. +# +# http://www.thedailystar.net/newDesign/news-details.php?nid=119228 +# +# and +# +# http://www.worldtimezone.com/dst_news/dst_news_bangladesh05.html +# +# +# "...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 +# +# http://www.fjysgl.gov.cn/show.aspx?id=2379&cid=39 +# +# (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 diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/javazic/tzdata/australasia --- a/jdk/make/sun/javazic/tzdata/australasia Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/javazic/tzdata/australasia Fri Mar 19 18:49:36 2010 -0700 @@ -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" +# +# http://www.radiofiji.com.fj/fullstory.php?id=23719 +# +# or +# +# http://www.worldtimezone.com/dst_news/dst_news_fiji01.html +# + +# From Steffen Thorsen (2009-11-10): +# The Fiji Government has posted some more details about the approved +# amendments: +# +# http://www.fiji.gov.fj/publish/page_16198.shtml +# # 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 diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/javazic/tzdata/europe --- a/jdk/make/sun/javazic/tzdata/europe Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/javazic/tzdata/europe Fri Mar 19 18:49:36 2010 -0700 @@ -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 diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/javazic/tzdata/northamerica --- a/jdk/make/sun/javazic/tzdata/northamerica Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/javazic/tzdata/northamerica Fri Mar 19 18:49:36 2010 -0700 @@ -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: +# +# http://www.signonsandiego.com/news/2009/dec/28/clocks-will-match-both-sides-border/ +# +# +# http://www.elmananarey.com/diario/noticia/nacional/noticias/empatan_horario_de_frontera_con_eu/621939 +# +# (Spanish) +# +# Could not find the new law text, but the proposed law text changes are here: +# +# http://gaceta.diputados.gob.mx/Gaceta/61/2009/dic/20091210-V.pdf +# +# (Gaceta Parlamentaria) +# +# There is also a list of the votes here: +# +# http://gaceta.diputados.gob.mx/Gaceta/61/2009/dic/V2-101209.html +# +# +# Our page: +# +# http://www.timeanddate.com/news/time/north-mexico-dst-change.html +# + +# From Arthur David Olson (2010-01-20): +# The page +# +# http://dof.gob.mx/nota_detalle.php?codigo=5127480&fecha=06/01/2010 +# +# includes this text: +# En los municipios fronterizos de Tijuana y Mexicali en Baja California; +# Juárez y Ojinaga en Chihuahua; Acuña y Piedras Negras en Coahuila; +# Anáhuac en Nuevo León; y Nuevo Laredo, Reynosa y Matamoros en +# Tamaulipas, la aplicación de este horario estacional surtirá efecto +# desde las dos horas del segundo domingo de marzo y concluirá 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ínea +# internacional y la línea paralela ubicada a una distancia de veinte +# kilómetros, así como la Ciudad de Ensenada, Baja California, hacia el +# interior del país, la aplicación de este horario estacional surtirá +# efecto desde las dos horas del segundo domingo de marzo y concluirá 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 diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/javazic/tzdata/zone.tab --- a/jdk/make/sun/javazic/tzdata/zone.tab Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/javazic/tzdata/zone.tab Fri Mar 19 18:49:36 2010 -0700 @@ -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 diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/management/Makefile --- a/jdk/make/sun/management/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/management/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -47,6 +47,8 @@ endif SUBDIRS += jmxremote +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/net/Makefile --- a/jdk/make/sun/net/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/net/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -29,6 +29,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = others spi +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/net/spi/Makefile --- a/jdk/make/sun/net/spi/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/net/spi/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -26,7 +26,9 @@ BUILDDIR = ../../.. include $(BUILDDIR)/common/Defs.gmk -SUBDIRS = nameservice +SUBDIRS_misc = nameservice +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/net/spi/nameservice/Makefile --- a/jdk/make/sun/net/spi/nameservice/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/net/spi/nameservice/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -27,6 +27,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = dns +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/nio/Makefile --- a/jdk/make/sun/nio/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/nio/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -29,6 +29,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = cs +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/org/Makefile --- a/jdk/make/sun/org/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/org/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -32,6 +32,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = mozilla +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/org/mozilla/Makefile --- a/jdk/make/sun/org/mozilla/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/org/mozilla/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -32,6 +32,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = javascript +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/rmi/Makefile --- a/jdk/make/sun/rmi/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/rmi/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -43,6 +43,8 @@ SUBDIRS += cgi endif # PLATFORM +include $(BUILDDIR)/common/Subdirs.gmk + # Then do the rest all build clean clobber :: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/security/Makefile --- a/jdk/make/sun/security/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/security/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -67,8 +67,10 @@ INTREE_EC = endif -SUBDIRS = $(INTREE_EC) other action util tools jgss krb5 smartcardio \ - $(PKCS11) $(JGSS_WRAPPER) $(MSCAPI) +SUBDIRS = $(INTREE_EC) other action util krb5 +SUBDIRS_misc = jgss $(PKCS11) $(JGSS_WRAPPER) $(MSCAPI) smartcardio +SUBDIRS_tools = tools +include $(BUILDDIR)/common/Subdirs.gmk all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/sun/tracing/Makefile --- a/jdk/make/sun/tracing/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/sun/tracing/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -33,6 +33,8 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = dtrace +include $(BUILDDIR)/common/Subdirs.gmk + all build: $(SUBDIRS-loop) clean clobber:: diff -r 9b1fde936a71 -r a491e7a776d5 jdk/make/tools/Makefile --- a/jdk/make/tools/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/make/tools/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -56,6 +56,8 @@ SUBDIRS += generate_nimbus endif +include $(BUILDDIR)/common/Subdirs.gmk + all build clean clobber:: $(SUBDIRS-loop) diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java --- a/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java Fri Mar 19 18:49:36 2010 -0700 @@ -27,7 +27,6 @@ import java.io.*; import java.util.*; -import java.util.logging.Level; import com.sun.java.util.jar.pack.Package.Class; import com.sun.java.util.jar.pack.Package.File; import com.sun.java.util.jar.pack.Package.InnerClass; @@ -162,7 +161,7 @@ ok = true; } catch (Exception ee) { - Utils.log.log(Level.WARNING, "Error on input: "+ee, ee); + Utils.log.warning("Error on input: "+ee, ee); if (verbose > 0) Utils.log.info("Stream offsets:"+ " served="+in.getBytesServed()+ diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java --- a/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java Fri Mar 19 18:49:36 2010 -0700 @@ -27,7 +27,6 @@ import java.io.*; import java.util.*; -import java.util.logging.Level; import com.sun.java.util.jar.pack.Package.Class; import com.sun.java.util.jar.pack.Package.File; import com.sun.java.util.jar.pack.Package.InnerClass; @@ -84,7 +83,7 @@ ok = true; } catch (Exception ee) { - Utils.log.log(Level.WARNING, "Error on output: "+ee, ee); + Utils.log.warning("Error on output: "+ee, ee); //if (verbose > 0) ee.printStackTrace(); // Write partial output only if we are verbose. if (verbose > 0) finalOut.close(); diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/com/sun/java/util/jar/pack/Utils.java --- a/jdk/src/share/classes/com/sun/java/util/jar/pack/Utils.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/Utils.java Fri Mar 19 18:49:36 2010 -0700 @@ -28,9 +28,10 @@ import java.util.*; import java.util.jar.*; import java.util.zip.*; -import java.util.logging.*; import java.io.*; +import sun.util.logging.PlatformLogger; + class Utils { static final String COM_PREFIX = "com.sun.java.util.jar.pack."; static final String METAINF = "META-INF"; @@ -130,31 +131,53 @@ = Boolean.getBoolean(Utils.COM_PREFIX+"nolog"); - static final Logger log - = new Logger("java.util.jar.Pack200", null) { - public void log(LogRecord record) { - int verbose = currentPropMap().getInteger(DEBUG_VERBOSE); - if (verbose > 0) { - if (nolog && - record.getLevel().intValue() < Level.WARNING.intValue()) { - System.out.println(record.getMessage()); - } else { - super.log(record); - } + static class Pack200Logger { + private final String name; + private PlatformLogger log; + Pack200Logger(String name) { + this.name = name; + } + + private synchronized PlatformLogger getLogger() { + if (log == null) { + log = PlatformLogger.getLogger(name); + } + return log; + } + + public void warning(String msg, Object param) { + int verbose = currentPropMap().getInteger(DEBUG_VERBOSE); + if (verbose > 0) { + getLogger().warning(msg, param); + } + } + + public void warning(String msg) { + warning(msg, null); + } + + public void info(String msg) { + int verbose = currentPropMap().getInteger(DEBUG_VERBOSE); + if (verbose > 0) { + if (nolog) { + System.out.println(msg); + } else { + getLogger().info(msg); } } + } - public void fine(String msg) { - int verbose = currentPropMap().getInteger(DEBUG_VERBOSE); - if (verbose > 0) { - System.out.println(msg); - } + public void fine(String msg) { + int verbose = currentPropMap().getInteger(DEBUG_VERBOSE); + if (verbose > 0) { + System.out.println(msg); } - }; - static { - LogManager.getLogManager().addLogger(log); + } } + static final Pack200Logger log + = new Pack200Logger("java.util.jar.Pack200"); + // Returns the Max Version String of this implementation static String getVersionString() { return "Pack200, Vendor: Sun Microsystems, Version: " + diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/com/sun/jndi/ldap/Filter.java --- a/jdk/src/share/classes/com/sun/jndi/ldap/Filter.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/Filter.java Fri Mar 19 18:49:36 2010 -0700 @@ -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) { diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/java/awt/FileDialog.java --- a/jdk/src/share/classes/java/awt/FileDialog.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/java/awt/FileDialog.java Fri Mar 19 18:49:36 2010 -0700 @@ -28,6 +28,8 @@ import java.io.FilenameFilter; import java.io.IOException; import java.io.ObjectInputStream; +import java.io.File; +import sun.awt.AWTAccessor; /** * The FileDialog class displays a dialog window @@ -93,6 +95,25 @@ */ String file; + /** + * Contains the File instances for all the files that the user selects. + * + * @serial + * @see getFiles + * @since 1.7 + */ + private File[] files; + + /** + * Represents whether the file dialog allows the multiple file selection. + * + * @serial + * @see #setMultipleMode + * @see #isMultipleMode + * @since 1.7 + */ + private boolean multipleMode = false; + /* * The filter used as the file dialog's filename filter. * The file dialog will only be displaying files whose @@ -123,6 +144,26 @@ } } + static { + AWTAccessor.setFileDialogAccessor( + new AWTAccessor.FileDialogAccessor() { + public void setFiles(FileDialog fileDialog, String directory, String files[]) { + fileDialog.setFiles(directory, files); + } + public void setFile(FileDialog fileDialog, String file) { + fileDialog.file = ("".equals(file)) ? null : file; + } + public void setDirectory(FileDialog fileDialog, String directory) { + fileDialog.dir = ("".equals(directory)) ? null : directory; + } + public boolean isMultipleMode(FileDialog fileDialog) { + synchronized (fileDialog.getObjectLock()) { + return fileDialog.multipleMode; + } + } + }); + } + /** * Initialize JNI field and method IDs for fields that may be accessed from C. @@ -371,6 +412,51 @@ } /** + * Returns files that the user selects. + *

+ * If the user cancels the file dialog, + * then the method returns an empty array. + * + * @return files that the user selects or an empty array + * if the user cancels the file dialog. + * @see #setFile(String) + * @see #getFile + * @since 1.7 + */ + public File[] getFiles() { + synchronized (getObjectLock()) { + if (files != null) { + return files.clone(); + } else { + return new File[0]; + } + } + } + + /** + * Stores the names of all the files that the user selects. + * + * Note that the method is private and it's intended to be used + * by the peers through the AWTAccessor API. + * + * @param directory the current directory + * @param files the array that contains the short names of + * all the files that the user selects. + * + * @see #getFiles + * @since 1.7 + */ + private void setFiles(String directory, String files[]) { + synchronized (getObjectLock()) { + int filesNumber = (files != null) ? files.length : 0; + this.files = new File[filesNumber]; + for (int i = 0; i < filesNumber; i++) { + this.files[i] = new File(directory, files[i]); + } + } + } + + /** * Sets the selected file for this file dialog window to be the * specified file. This file becomes the default file if it is set * before the file dialog window is first shown. @@ -380,7 +466,8 @@ * as the file. * * @param file the file being set - * @see java.awt.FileDialog#getFile + * @see #getFile + * @see #getFiles */ public void setFile(String file) { this.file = (file != null && file.equals("")) ? null : file; @@ -391,6 +478,34 @@ } /** + * Enables or disables multiple file selection for the file dialog. + * + * @param enable if {@code true}, multiple file selection is enabled; + * {@code false} - disabled. + * @see #isMultipleMode + * @since 1.7 + */ + public void setMultipleMode(boolean enable) { + synchronized (getObjectLock()) { + this.multipleMode = enable; + } + } + + /** + * Returns whether the file dialog allows the multiple file selection. + * + * @return {@code true} if the file dialog allows the multiple + * file selection; {@code false} otherwise. + * @see #setMultipleMode + * @since 1.7 + */ + public boolean isMultipleMode() { + synchronized (getObjectLock()) { + return multipleMode; + } + } + + /** * Determines this file dialog's filename filter. A filename filter * allows the user to specify which files appear in the file dialog * window. Filename filters do not function in Sun's reference diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/java/beans/BeanDescriptor.java --- a/jdk/src/share/classes/java/beans/BeanDescriptor.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/java/beans/BeanDescriptor.java Fri Mar 19 18:49:36 2010 -0700 @@ -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); + } } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/java/beans/EventSetDescriptor.java --- a/jdk/src/share/classes/java/beans/EventSetDescriptor.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/java/beans/EventSetDescriptor.java Fri Mar 19 18:49:36 2010 -0700 @@ -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; + } } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/java/beans/FeatureDescriptor.java --- a/jdk/src/share/classes/java/beans/FeatureDescriptor.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/java/beans/FeatureDescriptor.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 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 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); + } + } } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/java/beans/IndexedPropertyChangeEvent.java --- a/jdk/src/share/classes/java/beans/IndexedPropertyChangeEvent.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/java/beans/IndexedPropertyChangeEvent.java Fri Mar 19 18:49:36 2010 -0700 @@ -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()); + } } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java --- a/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java Fri Mar 19 18:49:36 2010 -0700 @@ -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); } - */ } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/java/beans/MethodDescriptor.java --- a/jdk/src/share/classes/java/beans/MethodDescriptor.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/java/beans/MethodDescriptor.java Fri Mar 19 18:49:36 2010 -0700 @@ -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("}"); + } + } } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/java/beans/PropertyChangeEvent.java --- a/jdk/src/share/classes/java/beans/PropertyChangeEvent.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/java/beans/PropertyChangeEvent.java Fri Mar 19 18:49:36 2010 -0700 @@ -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) { + } } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/java/beans/PropertyDescriptor.java --- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java Fri Mar 19 18:49:36 2010 -0700 @@ -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); } - */ } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/java/beans/XMLEncoder.java --- a/jdk/src/share/classes/java/beans/XMLEncoder.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/java/beans/XMLEncoder.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 valueToExpression; + private Map> 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(); + targetToStatementList = new IdentityHashMap>(); 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 statementList(Object target) { + List list = targetToStatementList.get(target); + if (list == null) { + list = new ArrayList(); + 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 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(""); - 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 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 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); } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/java/lang/Iterable.java --- a/jdk/src/share/classes/java/lang/Iterable.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/java/lang/Iterable.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 the type of elements returned by the iterator + * * @since 1.5 */ public interface Iterable { diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/java/lang/String.java --- a/jdk/src/share/classes/java/lang/String.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/java/lang/String.java Fri Mar 19 18:49:36 2010 -0700 @@ -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; diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/java/security/IdentityScope.java --- a/jdk/src/share/classes/java/security/IdentityScope.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/java/security/IdentityScope.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 */ diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/java/util/Collection.java --- a/jdk/src/share/classes/java/util/Collection.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/java/util/Collection.java Fri Mar 19 18:49:36 2010 -0700 @@ -103,6 +103,8 @@ * * Java Collections Framework. * + * @param the type of elements in this collection + * * @author Josh Bloch * @author Neal Gafter * @see Set diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/java/util/DualPivotQuicksort.java --- a/jdk/src/share/classes/java/util/DualPivotQuicksort.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/java/util/DualPivotQuicksort.java Fri Mar 19 18:49:36 2010 -0700 @@ -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). * *

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 diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/java/util/Iterator.java --- a/jdk/src/share/classes/java/util/Iterator.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/java/util/Iterator.java Fri Mar 19 18:49:36 2010 -0700 @@ -41,6 +41,8 @@ * * Java Collections Framework. * + * @param the type of elements returned by this iterator + * * @author Josh Bloch * @see Collection * @see ListIterator diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/java/util/List.java --- a/jdk/src/share/classes/java/util/List.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/java/util/List.java Fri Mar 19 18:49:36 2010 -0700 @@ -89,6 +89,8 @@ * * Java Collections Framework. * + * @param the type of elements in this list + * * @author Josh Bloch * @author Neal Gafter * @see Collection diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/javax/swing/JTable.java --- a/jdk/src/share/classes/javax/swing/JTable.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/javax/swing/JTable.java Fri Mar 19 18:49:36 2010 -0700 @@ -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(); } /** diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java Fri Mar 19 18:49:36 2010 -0700 @@ -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(); } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java Fri Mar 19 18:49:36 2010 -0700 @@ -62,6 +62,7 @@ (scrollbar.getLayout() instanceof UIResource)) { scrollbar.setLayout(this); } + configureScrollBarColors(); updateStyle(scrollbar); } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java Fri Mar 19 18:49:36 2010 -0700 @@ -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); diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java Fri Mar 19 18:49:36 2010 -0700 @@ -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, diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java Fri Mar 19 18:49:36 2010 -0700 @@ -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) {} diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java Fri Mar 19 18:49:36 2010 -0700 @@ -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. } /** diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java --- a/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 index. */ - 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; } /** diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/awt/AWTAccessor.java --- a/jdk/src/share/classes/sun/awt/AWTAccessor.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java Fri Mar 19 18:49:36 2010 -0700 @@ -390,6 +390,30 @@ boolean isTrayIconPopup(PopupMenu popupMenu); } + /* + * An accessor for the FileDialog class + */ + public interface FileDialogAccessor { + /* + * Sets the files the user selects + */ + void setFiles(FileDialog fileDialog, String directory, String files[]); + + /* + * Sets the file the user selects + */ + void setFile(FileDialog fileDialog, String file); + + /* + * Sets the directory the user selects + */ + void setDirectory(FileDialog fileDialog, String directory); + + /* + * Returns whether the file dialog allows the multiple file selection. + */ + boolean isMultipleMode(FileDialog fileDialog); + } /* * The java.awt.Component class accessor object. @@ -432,6 +456,11 @@ private static PopupMenuAccessor popupMenuAccessor; /* + * The java.awt.FileDialog class accessor object. + */ + private static FileDialogAccessor fileDialogAccessor; + + /* * Set an accessor object for the java.awt.Component class. */ public static void setComponentAccessor(ComponentAccessor ca) { @@ -567,4 +596,22 @@ } return popupMenuAccessor; } + + /* + * Set an accessor object for the java.awt.FileDialog class. + */ + public static void setFileDialogAccessor(FileDialogAccessor fda) { + fileDialogAccessor = fda; + } + + /* + * Retrieve the accessor object for the java.awt.FileDialog class. + */ + public static FileDialogAccessor getFileDialogAccessor() { + if (fileDialogAccessor == null) { + unsafe.ensureClassInitialized(FileDialog.class); + } + return fileDialogAccessor; + } + } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/management/Flag.java --- a/jdk/src/share/classes/sun/management/Flag.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/management/Flag.java Fri Mar 19 18:49:36 2010 -0700 @@ -68,27 +68,42 @@ } static Flag getFlag(String name) { - Flag[] fs = new Flag[1]; String[] names = new String[1]; names[0] = name; - int count = getFlags(names, fs, 1); - if (count == 1) { - return fs[0]; + + List flags = getFlags(names, 1); + if (flags.isEmpty()) { + return null; } else { - return null; + // flags should have only one element + return flags.get(0); } } static List getAllFlags() { int numFlags = getInternalFlagCount(); - Flag[] fs = new Flag[numFlags]; // Get all internal flags with names = null - int count = getFlags(null, fs, numFlags); - return Arrays.asList(fs); + return getFlags(null, numFlags); + } + + private static List getFlags(String[] names, int numFlags) { + Flag[] flags = new Flag[numFlags]; + int count = getFlags(names, flags, numFlags); + + List result = new ArrayList(); + for (Flag f : flags) { + if (f != null) { + result.add(f); + } + } + return result; } private static native String[] getAllFlagNames(); + // getFlags sets each element in the given flags array + // with a Flag object only if the name is valid and the + // type is supported. The flags array may contain null elements. private static native int getFlags(String[] names, Flag[] flags, int count); private static native int getInternalFlagCount(); diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java --- a/jdk/src/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java Fri Mar 19 18:49:36 2010 -0700 @@ -111,7 +111,7 @@ * at the same time, then all but the first will block until * the first completes its authentication. */ - static private HashMap requests = new HashMap (); + static private HashMap requests = new HashMap<>(); /* check if a request for this destination is in progress * return false immediately if not. Otherwise block until @@ -125,7 +125,7 @@ synchronized (requests) { Thread t, c; c = Thread.currentThread(); - if ((t=(Thread)requests.get(key))==null) { + if ((t = requests.get(key)) == null) { requests.put (key, c); return false; } @@ -147,8 +147,11 @@ */ static private void requestCompleted (String key) { synchronized (requests) { - boolean waspresent = requests.remove (key) != null; - assert waspresent; + Thread thread = requests.get(key); + if (thread != null && thread == Thread.currentThread()) { + boolean waspresent = requests.remove(key) != null; + assert waspresent; + } requests.notifyAll(); } } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java --- a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Fri Mar 19 18:49:36 2010 -0700 @@ -423,7 +423,7 @@ // Try keep-alive only on first attempt if (!failedOnce && http.getHttpKeepAliveSet()) { - if (http.usingProxy) { + if (http.usingProxy && tunnelState() != TunnelState.TUNNELING) { requests.setIfNotSet("Proxy-Connection", "keep-alive"); } else { requests.setIfNotSet("Connection", "keep-alive"); diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/nio/fs/AbstractWatchKey.java --- a/jdk/src/share/classes/sun/nio/fs/AbstractWatchKey.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/nio/fs/AbstractWatchKey.java Fri Mar 19 18:49:36 2010 -0700 @@ -59,10 +59,15 @@ // pending events private List> 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> lastModifyEvents; + protected AbstractWatchKey(AbstractWatchService watcher) { this.watcher = watcher; this.state = State.READY; this.events = new ArrayList>(); + this.lastModifyEvents = new HashMap>(); } 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((WatchEvent.Kind)kind, context)); + Event ev = + new Event((WatchEvent.Kind)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> result = events; events = new ArrayList>(); + lastModifyEvents.clear(); return result; } } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/security/krb5/internal/crypto/EType.java --- a/jdk/src/share/classes/sun/security/krb5/internal/crypto/EType.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/security/krb5/internal/crypto/EType.java Fri Mar 19 18:49:36 2010 -0700 @@ -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(); } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/security/provider/JavaKeyStore.java --- a/jdk/src/share/classes/sun/security/provider/JavaKeyStore.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/security/provider/JavaKeyStore.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 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(); diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/security/tools/KeyTool.java --- a/jdk/src/share/classes/sun/security/tools/KeyTool.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/security/tools/KeyTool.java Fri Mar 19 18:49:36 2010 -0700 @@ -151,7 +151,7 @@ enum Command { CERTREQ("Generates a certificate request", - ALIAS, SIGALG, FILEOUT, KEYPASS, KEYSTORE, + ALIAS, SIGALG, FILEOUT, KEYPASS, KEYSTORE, DNAME, STOREPASS, STORETYPE, PROVIDERNAME, PROVIDERCLASS, PROVIDERARG, PROVIDERPATH, V, PROTECTED), CHANGEALIAS("Changes an entry's alias", @@ -167,7 +167,7 @@ STORETYPE, PROVIDERNAME, PROVIDERCLASS, PROVIDERARG, PROVIDERPATH, V, PROTECTED), GENKEYPAIR("Generates a key pair", - ALIAS, KEYALG, KEYSIZE, SIGALG, DESTALIAS, + ALIAS, KEYALG, KEYSIZE, SIGALG, DESTALIAS, DNAME, STARTDATE, EXT, VALIDITY, KEYPASS, KEYSTORE, STOREPASS, STORETYPE, PROVIDERNAME, PROVIDERCLASS, PROVIDERARG, PROVIDERPATH, V, PROTECTED), @@ -176,7 +176,7 @@ STOREPASS, STORETYPE, PROVIDERNAME, PROVIDERCLASS, PROVIDERARG, PROVIDERPATH, V, PROTECTED), GENCERT("Generates certificate from a certificate request", - RFC, INFILE, OUTFILE, ALIAS, SIGALG, + RFC, INFILE, OUTFILE, ALIAS, SIGALG, DNAME, STARTDATE, EXT, VALIDITY, KEYPASS, KEYSTORE, STOREPASS, STORETYPE, PROVIDERNAME, PROVIDERCLASS, PROVIDERARG, PROVIDERPATH, V, PROTECTED), diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/security/tools/TimestampedSigner.java --- a/jdk/src/share/classes/sun/security/tools/TimestampedSigner.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/security/tools/TimestampedSigner.java Fri Mar 19 18:49:36 2010 -0700 @@ -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"); } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/util/resources/TimeZoneNames.java --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java Fri Mar 19 18:49:36 2010 -0700 @@ -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}, diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/util/resources/TimeZoneNames_de.java --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_de.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_de.java Fri Mar 19 18:49:36 2010 -0700 @@ -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}, diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/util/resources/TimeZoneNames_es.java --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_es.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_es.java Fri Mar 19 18:49:36 2010 -0700 @@ -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}, diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/util/resources/TimeZoneNames_fr.java --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_fr.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_fr.java Fri Mar 19 18:49:36 2010 -0700 @@ -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}, diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/util/resources/TimeZoneNames_it.java --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_it.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_it.java Fri Mar 19 18:49:36 2010 -0700 @@ -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}, diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/util/resources/TimeZoneNames_ja.java --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ja.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ja.java Fri Mar 19 18:49:36 2010 -0700 @@ -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}, diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/util/resources/TimeZoneNames_ko.java --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ko.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ko.java Fri Mar 19 18:49:36 2010 -0700 @@ -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}, diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java Fri Mar 19 18:49:36 2010 -0700 @@ -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}, diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java Fri Mar 19 18:49:36 2010 -0700 @@ -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}, diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java Fri Mar 19 18:49:36 2010 -0700 @@ -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}, diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/lib/security/java.security --- a/jdk/src/share/lib/security/java.security Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/lib/security/java.security Fri Mar 19 18:49:36 2010 -0700 @@ -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 diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/share/native/sun/management/Flag.c --- a/jdk/src/share/native/sun/management/Flag.c Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/share/native/sun/management/Flag.c Fri Mar 19 18:49:36 2010 -0700 @@ -84,6 +84,7 @@ jint num_flags, i, index; jmmVMGlobal* globals; + size_t gsize; const char* class_name = "sun/management/Flag"; const char* signature = "(Ljava/lang/String;Ljava/lang/Object;ZZLcom/sun/management/VMOption$Origin;)V"; jobject origin; @@ -100,12 +101,14 @@ return 0; } - globals = (jmmVMGlobal*) malloc(count * sizeof(jmmVMGlobal)); + gsize = count * sizeof(jmmVMGlobal); + globals = (jmmVMGlobal*) malloc(gsize); if (globals == NULL) { JNU_ThrowOutOfMemoryError(env, 0); return 0; } + memset(globals, 0, gsize); num_flags = jmm_interface->GetVMGlobals(env, names, globals, count); if (num_flags == 0) { free(globals); diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java --- a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java Fri Mar 19 18:49:36 2010 -0700 @@ -37,6 +37,7 @@ import java.security.AccessController; import java.security.PrivilegedAction; import sun.util.logging.PlatformLogger; +import sun.awt.AWTAccessor; class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListener, ItemListener, KeyEventDispatcher, XChoicePeerListener { private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XFileDialogPeer"); @@ -171,6 +172,10 @@ filterField = new TextField(); selectionField = new TextField(); + boolean isMultipleMode = + AWTAccessor.getFileDialogAccessor().isMultipleMode(target); + fileList.setMultipleMode(isMultipleMode); + // the insets used by the components in the fileDialog Insets noInset = new Insets(0, 0, 0, 0); Insets textFieldInset = new Insets(0, 8, 0, 8); @@ -380,7 +385,8 @@ * handle the selection event */ void handleSelection(String file) { - int index = file.lastIndexOf('/'); + + int index = file.lastIndexOf(java.io.File.separatorChar); if (index == -1) { savedDir = this.dir; @@ -389,8 +395,12 @@ savedDir = file.substring(0, index+1); savedFile = file.substring(index+1); } - target.setDirectory(savedDir); - target.setFile(savedFile); + + AWTAccessor.FileDialogAccessor fileDialogAccessor = AWTAccessor.getFileDialogAccessor(); + + fileDialogAccessor.setDirectory(target, savedDir); + fileDialogAccessor.setFile(target, savedFile); + fileDialogAccessor.setFiles(target, savedDir, fileList.getSelectedItems()); } /** @@ -404,8 +414,13 @@ setFilterField(null); directoryList.clear(); fileList.clear(); - target.setFile(null); - target.setDirectory(null); + + AWTAccessor.FileDialogAccessor fileDialogAccessor = AWTAccessor.getFileDialogAccessor(); + + fileDialogAccessor.setDirectory(target, null); + fileDialogAccessor.setFile(target, null); + fileDialogAccessor.setFiles(target, null, null); + handleQuitButton(); } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/solaris/classes/sun/nio/fs/UnixPath.java --- a/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java Fri Mar 19 18:49:36 2010 -0700 @@ -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; } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/solaris/native/java/io/UnixFileSystem_md.c --- a/jdk/src/solaris/native/java/io/UnixFileSystem_md.c Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/solaris/native/java/io/UnixFileSystem_md.c Fri Mar 19 18:49:36 2010 -0700 @@ -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), diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c --- a/jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c Fri Mar 19 18:49:36 2010 -0700 @@ -44,6 +44,7 @@ * The GConf-2 settings used are: * - /system/http_proxy/use_http_proxy boolean * - /system/http_proxy/use_authentcation boolean + * - /system/http_proxy/use_same_proxy boolean * - /system/http_proxy/host string * - /system/http_proxy/authentication_user string * - /system/http_proxy/authentication_password string @@ -158,6 +159,7 @@ char *mode = NULL; int pport = 0; int use_proxy; + int use_same_proxy = 0; const char* urlhost; jobject isa = NULL; jobject proxy = NULL; @@ -179,6 +181,15 @@ * entries. */ + use_same_proxy = (*my_get_bool_func)(gconf_client, "/system/http_proxy/use_same_proxy", NULL); + if (use_same_proxy) { + use_proxy = (*my_get_bool_func)(gconf_client, "/system/http_proxy/use_http_proxy", NULL); + if (use_proxy) { + phost = (*my_get_string_func)(gconf_client, "/system/http_proxy/host", NULL); + pport = (*my_get_int_func)(gconf_client, "/system/http_proxy/port", NULL); + } + } + /** * HTTP: * /system/http_proxy/use_http_proxy (boolean) @@ -188,8 +199,10 @@ if (strcasecmp(cproto, "http") == 0) { use_proxy = (*my_get_bool_func)(gconf_client, "/system/http_proxy/use_http_proxy", NULL); if (use_proxy) { - phost = (*my_get_string_func)(gconf_client, "/system/http_proxy/host", NULL); - pport = (*my_get_int_func)(gconf_client, "/system/http_proxy/port", NULL); + if (!use_same_proxy) { + phost = (*my_get_string_func)(gconf_client, "/system/http_proxy/host", NULL); + pport = (*my_get_int_func)(gconf_client, "/system/http_proxy/port", NULL); + } CHECK_NULL(type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID)); } } @@ -203,8 +216,10 @@ if (strcasecmp(cproto, "https") == 0) { mode = (*my_get_string_func)(gconf_client, "/system/proxy/mode", NULL); if (mode != NULL && (strcasecmp(mode,"manual") == 0)) { - phost = (*my_get_string_func)(gconf_client, "/system/proxy/secure_host", NULL); - pport = (*my_get_int_func)(gconf_client, "/system/proxy/secure_port", NULL); + if (!use_same_proxy) { + phost = (*my_get_string_func)(gconf_client, "/system/proxy/secure_host", NULL); + pport = (*my_get_int_func)(gconf_client, "/system/proxy/secure_port", NULL); + } use_proxy = (phost != NULL); if (use_proxy) type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID); @@ -220,8 +235,10 @@ if (strcasecmp(cproto, "ftp") == 0) { mode = (*my_get_string_func)(gconf_client, "/system/proxy/mode", NULL); if (mode != NULL && (strcasecmp(mode,"manual") == 0)) { - phost = (*my_get_string_func)(gconf_client, "/system/proxy/ftp_host", NULL); - pport = (*my_get_int_func)(gconf_client, "/system/proxy/ftp_port", NULL); + if (!use_same_proxy) { + phost = (*my_get_string_func)(gconf_client, "/system/proxy/ftp_host", NULL); + pport = (*my_get_int_func)(gconf_client, "/system/proxy/ftp_port", NULL); + } use_proxy = (phost != NULL); if (use_proxy) type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID); @@ -237,8 +254,10 @@ if (strcasecmp(cproto, "gopher") == 0) { mode = (*my_get_string_func)(gconf_client, "/system/proxy/mode", NULL); if (mode != NULL && (strcasecmp(mode,"manual") == 0)) { - phost = (*my_get_string_func)(gconf_client, "/system/proxy/gopher_host", NULL); - pport = (*my_get_int_func)(gconf_client, "/system/proxy/gopher_port", NULL); + if (!use_same_proxy) { + phost = (*my_get_string_func)(gconf_client, "/system/proxy/gopher_host", NULL); + pport = (*my_get_int_func)(gconf_client, "/system/proxy/gopher_port", NULL); + } use_proxy = (phost != NULL); if (use_proxy) type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID); @@ -254,8 +273,10 @@ if (strcasecmp(cproto, "socks") == 0) { mode = (*my_get_string_func)(gconf_client, "/system/proxy/mode", NULL); if (mode != NULL && (strcasecmp(mode,"manual") == 0)) { - phost = (*my_get_string_func)(gconf_client, "/system/proxy/socks_host", NULL); - pport = (*my_get_int_func)(gconf_client, "/system/proxy/socks_port", NULL); + if (!use_same_proxy) { + phost = (*my_get_string_func)(gconf_client, "/system/proxy/socks_host", NULL); + pport = (*my_get_int_func)(gconf_client, "/system/proxy/socks_port", NULL); + } use_proxy = (phost != NULL); if (use_proxy) type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_socksID); diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java --- a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java Fri Mar 19 18:49:36 2010 -0700 @@ -117,26 +117,57 @@ } } - // NOTE: This method is called by privileged threads. - // DO NOT INVOKE CLIENT CODE ON THIS THREAD! - void handleSelected(final String file) { - final FileDialog fileDialog = (FileDialog)target; - WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() { - public void run() { - int index = file.lastIndexOf(java.io.File.separatorChar);/*2509*//*ibm*/ - String dir; + /* + * The function converts the file names (the buffer parameter) + * in the Windows format into the Java format and saves the results + * into the FileDialog instance. + * + * If it's the multi-select mode, the buffer contains the current + * directory followed by the short names of the files. + * The directory and file name strings are NULL separated. + * If it's the single-select mode, the buffer doesn't have the NULL + * separator between the path and the file name. + * + * NOTE: This method is called by privileged threads. + * DO NOT INVOKE CLIENT CODE ON THIS THREAD! + */ + void handleSelected(final char[] buffer) + { + String[] wFiles = (new String(buffer)).split("\0"); // NULL is the delimiter + boolean multiple = (wFiles.length > 1); + + String jDirectory = null; + String jFile = null; + String jFiles[] = null; - if (index == -1) { - dir = "."+java.io.File.separator; - fileDialog.setFile(file); - } - else { - dir = file.substring(0, index + 1); - fileDialog.setFile(file.substring(index + 1)); - } - fileDialog.setDirectory(dir); - fileDialog.hide(); + if (multiple) { + jDirectory = wFiles[0]; + jFiles = new String[wFiles.length - 1]; + System.arraycopy(wFiles, 1, jFiles, 0, jFiles.length); + jFile = jFiles[1]; // choose any file + } else { + int index = wFiles[0].lastIndexOf(java.io.File.separatorChar); + if (index == -1) { + jDirectory = "."+java.io.File.separator; + jFile = wFiles[0]; + } else { + jDirectory = wFiles[0].substring(0, index + 1); + jFile = wFiles[0].substring(index + 1); } + jFiles = new String[] { jFile }; + } + + final FileDialog fileDialog = (FileDialog)target; + AWTAccessor.FileDialogAccessor fileDialogAccessor = AWTAccessor.getFileDialogAccessor(); + + fileDialogAccessor.setDirectory(fileDialog, jDirectory); + fileDialogAccessor.setFile(fileDialog, jFile); + fileDialogAccessor.setFiles(fileDialog, jDirectory, jFiles); + + WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() { + public void run() { + fileDialog.hide(); + } }); } // handleSelected() @@ -144,11 +175,14 @@ // DO NOT INVOKE CLIENT CODE ON THIS THREAD! void handleCancel() { final FileDialog fileDialog = (FileDialog)target; + + AWTAccessor.getFileDialogAccessor().setFile(fileDialog, null); + AWTAccessor.getFileDialogAccessor().setFiles(fileDialog, null, null); + WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() { - public void run() { - fileDialog.setFile(null); - fileDialog.hide(); - } + public void run() { + fileDialog.hide(); + } }); } // handleCancel() @@ -244,4 +278,9 @@ public void createScreenSurface(boolean isResize) {} @Override public void replaceSurfaceData() {} + + public boolean isMultipleMode() { + FileDialog fileDialog = (FileDialog)target; + return AWTAccessor.getFileDialogAccessor().isMultipleMode(fileDialog); + } } diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/windows/native/sun/windows/awt_FileDialog.cpp --- a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp Fri Mar 19 18:49:36 2010 -0700 @@ -44,6 +44,7 @@ jmethodID AwtFileDialog::handleSelectedMID; jmethodID AwtFileDialog::handleCancelMID; jmethodID AwtFileDialog::checkFilenameFilterMID; +jmethodID AwtFileDialog::isMultipleModeMID; /* FileDialog ids */ jfieldID AwtFileDialog::modeID; @@ -57,6 +58,13 @@ /* Non-localized suffix of the filter string */ static const TCHAR s_additionalString[] = TEXT(" (*.*)\0*.*\0"); +// Default limit of the output buffer. +#define SINGLE_MODE_BUFFER_LIMIT MAX_PATH+1 +#define MULTIPLE_MODE_BUFFER_LIMIT 32768 + +// The name of the property holding the pointer to the OPENFILENAME structure. +static LPCTSTR OpenFileNameProp = TEXT("AWT_OFN"); + /***********************************************************************/ void @@ -140,6 +148,8 @@ FileDialogWndProc); ::SetProp(parent, NativeDialogWndProcProp, reinterpret_cast(lpfnWndProc)); + ::SetProp(parent, OpenFileNameProp, (void *)lParam); + break; } case WM_DESTROY: { @@ -149,6 +159,7 @@ lpfnWndProc); ::RemoveProp(parent, ModalDialogPeerProp); ::RemoveProp(parent, NativeDialogWndProcProp); + ::RemoveProp(parent, OpenFileNameProp); break; } case WM_NOTIFY: { @@ -174,6 +185,30 @@ // to unblock all the windows blocked by this dialog as it will // be closed soon env->CallVoidMethod(peer, AwtFileDialog::setHWndMID, (jlong)0); + } else if (notifyEx->hdr.code == CDN_SELCHANGE) { + // reallocate the buffer if the buffer is too small + LPOPENFILENAME lpofn = (LPOPENFILENAME)GetProp(parent, OpenFileNameProp); + + UINT nLength = CommDlg_OpenSave_GetSpec(parent, NULL, 0) + + CommDlg_OpenSave_GetFolderPath(parent, NULL, 0); + + if (lpofn->nMaxFile < nLength) + { + // allocate new buffer + LPTSTR newBuffer = new TCHAR[nLength]; + + if (newBuffer) { + memset(newBuffer, 0, nLength * sizeof(TCHAR)); + LPTSTR oldBuffer = lpofn->lpstrFile; + lpofn->lpstrFile = newBuffer; + lpofn->nMaxFile = nLength; + // free the previously allocated buffer + if (oldBuffer) { + delete[] oldBuffer; + } + + } + } } } break; @@ -193,7 +228,6 @@ WCHAR unicodeChar = L' '; LPTSTR fileBuffer = NULL; LPTSTR currentDirectory = NULL; - OPENFILENAME ofn; jint mode = 0; BOOL result = FALSE; DWORD dlgerr; @@ -204,6 +238,10 @@ jobject target = NULL; jobject parent = NULL; AwtComponent* awtParent = NULL; + jboolean multipleMode = JNI_FALSE; + + OPENFILENAME ofn; + memset(&ofn, 0, sizeof(ofn)); /* * There's a situation (see bug 4906972) when InvokeFunction (by which this method is called) @@ -233,7 +271,16 @@ (jstring)env->GetObjectField(target, AwtFileDialog::dirID); JavaStringBuffer directoryBuffer(env, directory); - fileBuffer = new TCHAR[MAX_PATH+1]; + multipleMode = env->CallBooleanMethod(peer, AwtFileDialog::isMultipleModeMID); + + UINT bufferLimit; + if (multipleMode == JNI_TRUE) { + bufferLimit = MULTIPLE_MODE_BUFFER_LIMIT; + } else { + bufferLimit = SINGLE_MODE_BUFFER_LIMIT; + } + LPTSTR fileBuffer = new TCHAR[bufferLimit]; + memset(fileBuffer, 0, bufferLimit * sizeof(TCHAR)); file = (jstring)env->GetObjectField(target, AwtFileDialog::fileID); if (file != NULL) { @@ -244,8 +291,6 @@ fileBuffer[0] = _T('\0'); } - memset(&ofn, 0, sizeof(ofn)); - ofn.lStructSize = sizeof(ofn); ofn.lpstrFilter = s_fileFilterString; ofn.nFilterIndex = 1; @@ -265,19 +310,23 @@ ofn.hwndOwner = NULL; } ofn.lpstrFile = fileBuffer; - ofn.nMaxFile = MAX_PATH; + ofn.nMaxFile = bufferLimit; ofn.lpstrTitle = titleBuffer; ofn.lpstrInitialDir = directoryBuffer; ofn.Flags = OFN_LONGNAMES | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_ENABLEHOOK | OFN_EXPLORER | OFN_ENABLESIZING; fileFilter = env->GetObjectField(peer, AwtFileDialog::fileFilterID); - if (!JNU_IsNull(env,fileFilter)) { - ofn.Flags |= OFN_ENABLEINCLUDENOTIFY; - } + if (!JNU_IsNull(env,fileFilter)) { + ofn.Flags |= OFN_ENABLEINCLUDENOTIFY; + } ofn.lCustData = (LPARAM)peer; ofn.lpfnHook = (LPOFNHOOKPROC)FileDialogHookProc; + if (multipleMode == JNI_TRUE) { + ofn.Flags |= OFN_ALLOWMULTISELECT; + } + // Save current directory, so we can reset if it changes. currentDirectory = new TCHAR[MAX_PATH+1]; @@ -318,11 +367,12 @@ // Report result to peer. if (result) { - jstring tmpJString = (_tcslen(ofn.lpstrFile) == 0 ? - JNU_NewStringPlatform(env, L"") : - JNU_NewStringPlatform(env, ofn.lpstrFile)); - env->CallVoidMethod(peer, AwtFileDialog::handleSelectedMID, tmpJString); - env->DeleteLocalRef(tmpJString); + jint length = (jint)GetBufferLength(ofn.lpstrFile, ofn.nMaxFile); + jcharArray jnames = env->NewCharArray(length); + env->SetCharArrayRegion(jnames, 0, length, (jchar*)ofn.lpstrFile); + + env->CallVoidMethod(peer, AwtFileDialog::handleSelectedMID, jnames); + env->DeleteLocalRef(jnames); } else { env->CallVoidMethod(peer, AwtFileDialog::handleCancelMID); } @@ -338,7 +388,8 @@ env->DeleteGlobalRef(peer); delete[] currentDirectory; - delete[] fileBuffer; + if (ofn.lpstrFile) + delete[] ofn.lpstrFile; throw; } @@ -351,7 +402,8 @@ env->DeleteGlobalRef(peer); delete[] currentDirectory; - delete[] fileBuffer; + if (ofn.lpstrFile) + delete[] ofn.lpstrFile; } BOOL @@ -416,6 +468,18 @@ env->DeleteGlobalRef(self); } +// Returns the length of the double null terminated output buffer +UINT AwtFileDialog::GetBufferLength(LPTSTR buffer, UINT limit) +{ + UINT index = 0; + while ((index < limit) && + (buffer[index] != NULL || buffer[index+1] != NULL)) + { + index++; + } + return index; +} + /************************************************************************ * WFileDialogPeer native methods */ @@ -434,11 +498,12 @@ AwtFileDialog::setHWndMID = env->GetMethodID(cls, "setHWnd", "(J)V"); AwtFileDialog::handleSelectedMID = - env->GetMethodID(cls, "handleSelected", "(Ljava/lang/String;)V"); + env->GetMethodID(cls, "handleSelected", "([C)V"); AwtFileDialog::handleCancelMID = env->GetMethodID(cls, "handleCancel", "()V"); AwtFileDialog::checkFilenameFilterMID = env->GetMethodID(cls, "checkFilenameFilter", "(Ljava/lang/String;)Z"); + AwtFileDialog::isMultipleModeMID = env->GetMethodID(cls, "isMultipleMode", "()Z"); /* java.awt.FileDialog fields */ cls = env->FindClass("java/awt/FileDialog"); @@ -455,6 +520,7 @@ DASSERT(AwtFileDialog::setHWndMID != NULL); DASSERT(AwtFileDialog::handleSelectedMID != NULL); DASSERT(AwtFileDialog::handleCancelMID != NULL); + DASSERT(AwtFileDialog::isMultipleModeMID != NULL); DASSERT(AwtFileDialog::modeID != NULL); DASSERT(AwtFileDialog::dirID != NULL); diff -r 9b1fde936a71 -r a491e7a776d5 jdk/src/windows/native/sun/windows/awt_FileDialog.h --- a/jdk/src/windows/native/sun/windows/awt_FileDialog.h Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/src/windows/native/sun/windows/awt_FileDialog.h Fri Mar 19 18:49:36 2010 -0700 @@ -49,6 +49,7 @@ static jmethodID handleSelectedMID; static jmethodID handleCancelMID; static jmethodID checkFilenameFilterMID; + static jmethodID isMultipleModeMID; /* java.awt.FileDialog field and method ids */ static jfieldID modeID; @@ -68,6 +69,9 @@ static void _DisposeOrHide(void *param); static void _ToFront(void *param); static void _ToBack(void *param); + +private: + static UINT GetBufferLength(LPTSTR buffer, UINT limit); }; #endif /* FILE_DIALOG_H */ diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/Makefile --- a/jdk/test/Makefile Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/test/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -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 \ diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/ProblemList.txt --- a/jdk/test/ProblemList.txt Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/test/ProblemList.txt Fri Mar 19 18:49:36 2010 -0700 @@ -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 @@ -692,7 +701,6 @@ java/net/URLConnection/ZeroContentLength.java generic-all # Solaris 11 i586 fails with samevm, not sure why -java/net/Authenticator/B4769350.java generic-all java/net/HttpURLConnection/HttpResponseCode.java generic-all java/net/ResponseCache/B6181108.java generic-all java/net/ResponseCache/ResponseCacheTest.java generic-all @@ -737,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 @@ -933,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 @@ -1257,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 diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/com/sun/jndi/ldap/InvalidLdapFilters.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/com/sun/jndi/ldap/InvalidLdapFilters.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 env = new Hashtable(); + 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(); + } + +} diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/java/awt/FileDialog/MultipleMode/MultipleMode.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/FileDialog/MultipleMode/MultipleMode.html Fri Mar 19 18:49:36 2010 -0700 @@ -0,0 +1,20 @@ + + + + MultipleMode + + + +

MultipleMode
Bug ID: 6467204

+ +

See the dialog box (usually in upper left corner) for instructions

+ + + + diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/java/awt/FileDialog/MultipleMode/MultipleMode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/FileDialog/MultipleMode/MultipleMode.java Fri Mar 19 18:49:36 2010 -0700 @@ -0,0 +1,289 @@ +/* + * 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 6467204 + @summary Need to implement "extended" native FileDialog for JFileChooser + @author dmitry.cherepanov@sun.com area=awt.filedialog + @run applet/manual=yesno MultipleMode.html +*/ + +// Note there is no @ in front of test above. This is so that the +// harness will not mistake this file as a test file. It should +// only see the html file as a test file. (the harness runs all +// valid test files, so it would run this test twice if this file +// were valid as well as the html file.) +// Also, note the area= after Your Name in the author tag. Here, you +// should put which functional area the test falls in. See the +// AWT-core home page -> test areas and/or -> AWT team for a list of +// areas. +// There are several places where ManualYesNoTest appear. It is +// recommended that these be changed by a global search and replace, +// such as ESC-% in xemacs. + + + +/** + * MultipleMode.java + * + * summary: + */ + +import java.applet.Applet; +import java.awt.*; +import java.awt.event.*; +import java.io.File; + + +//Manual tests should run as applet tests if possible because they +// get their environments cleaned up, including AWT threads, any +// test created threads, and any system resources used by the test +// such as file descriptors. (This is normally not a problem as +// main tests usually run in a separate VM, however on some platforms +// such as the Mac, separate VMs are not possible and non-applet +// tests will cause problems). Also, you don't have to worry about +// synchronisation stuff in Applet tests the way you do in main +// tests... + + +public class MultipleMode extends Applet +{ + //Declare things used in the test, like buttons and labels here + + public void init() + { + //Create instructions for the user here, as well as set up + // the environment -- set the layout manager, add buttons, + // etc. + this.setLayout (new BorderLayout ()); + + String[] instructions = + { + " 1. Turn the 'multiple' checkbox off and press the 'open' button ", + " 2. Verify that the file dialog doesn't allow the multiple file selection ", + " 3. Select any file and close the file dialog ", + " 4. The results will be displayed, verify the results ", + " 5. Turn the 'multiple' checkbox on and press the 'open' button ", + " 6. Verify that the file dialog allows the multiple file selection ", + " 7. Select several files and close the file dialog ", + " 8. The results will be displayed, verify the results " + }; + Sysout.createDialogWithInstructions( instructions ); + + }//End init() + + public void start () + { + final Checkbox mode = new Checkbox("multiple", true); + Button open = new Button("open"); + open.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FileDialog d = new FileDialog((Frame)null); + d.setMultipleMode(mode.getState()); + d.setVisible(true); + + // print the results + Sysout.println("DIR:"); + Sysout.println(d.getDirectory()); + Sysout.println("FILE:"); + Sysout.println(d.getFile()); + Sysout.println("FILES:"); + File files[] = d.getFiles(); + for (File f : files) { + Sysout.println(String.valueOf(f)); + } + } + }); + + setLayout(new FlowLayout()); + add(mode); + add(open); + + //Get things going. Request focus, set size, et cetera + setSize (200,200); + setVisible(true); + validate(); + + }// start() + + //The rest of this class is the actions which perform the test... + + //Use Sysout.println to communicate with the user NOT System.out!! + //Sysout.println ("Something Happened!"); + +}// class ManualYesNoTest + +/* Place other classes related to the test after this line */ + + + + + +/**************************************************** + Standard Test Machinery + DO NOT modify anything below -- it's a standard + chunk of code whose purpose is to make user + interaction uniform, and thereby make it simpler + to read and understand someone else's test. + ****************************************************/ + +/** + This is part of the standard test machinery. + It creates a dialog (with the instructions), and is the interface + for sending text messages to the user. + To print the instructions, send an array of strings to Sysout.createDialog + WithInstructions method. Put one line of instructions per array entry. + To display a message for the tester to see, simply call Sysout.println + with the string to be displayed. + This mimics System.out.println but works within the test harness as well + as standalone. + */ + +class Sysout +{ + private static TestDialog dialog; + private static boolean numbering = false; + private static int messageNumber = 0; + + public static void createDialogWithInstructions( String[] instructions ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + dialog.printInstructions( instructions ); + dialog.setVisible(true); + println( "Any messages for the tester will display here." ); + } + + public static void createDialog( ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + String[] defInstr = { "Instructions will appear here. ", "" } ; + dialog.printInstructions( defInstr ); + dialog.setVisible(true); + println( "Any messages for the tester will display here." ); + } + + /* Enables message counting for the tester. */ + public static void enableNumbering(boolean enable){ + numbering = enable; + } + + public static void printInstructions( String[] instructions ) + { + dialog.printInstructions( instructions ); + } + + + public static void println( String messageIn ) + { + if (numbering) { + messageIn = "" + messageNumber + " " + messageIn; + messageNumber++; + } + dialog.displayMessage( messageIn ); + } + +}// Sysout class + +/** + This is part of the standard test machinery. It provides a place for the + test instructions to be displayed, and a place for interactive messages + to the user to be displayed. + To have the test instructions displayed, see Sysout. + To have a message to the user be displayed, see Sysout. + Do not call anything in this dialog directly. + */ +class TestDialog extends Dialog +{ + + TextArea instructionsText; + TextArea messageText; + int maxStringLength = 80; + + //DO NOT call this directly, go through Sysout + public TestDialog( Frame frame, String name ) + { + super( frame, name ); + int scrollBoth = TextArea.SCROLLBARS_BOTH; + instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth ); + add( "North", instructionsText ); + + messageText = new TextArea( "", 5, maxStringLength, scrollBoth ); + add("Center", messageText); + + pack(); + + setVisible(true); + }// TestDialog() + + //DO NOT call this directly, go through Sysout + public void printInstructions( String[] instructions ) + { + //Clear out any current instructions + instructionsText.setText( "" ); + + //Go down array of instruction strings + + String printStr, remainingStr; + for( int i=0; i < instructions.length; i++ ) + { + //chop up each into pieces maxSringLength long + remainingStr = instructions[ i ]; + while( remainingStr.length() > 0 ) + { + //if longer than max then chop off first max chars to print + if( remainingStr.length() >= maxStringLength ) + { + //Try to chop on a word boundary + int posOfSpace = remainingStr. + lastIndexOf( ' ', maxStringLength - 1 ); + + if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1; + + printStr = remainingStr.substring( 0, posOfSpace + 1 ); + remainingStr = remainingStr.substring( posOfSpace + 1 ); + } + //else just print + else + { + printStr = remainingStr; + remainingStr = ""; + } + + instructionsText.append( printStr + "\n" ); + + }// while + + }// for + + }//printInstructions() + + //DO NOT call this directly, go through Sysout + public void displayMessage( String messageIn ) + { + messageText.append( messageIn + "\n" ); + System.out.println(messageIn); + } + +}// TestDialog class diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/java/beans/Introspector/Test4498236.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/beans/Introspector/Test4498236.java Fri Mar 19 18:49:36 2010 -0700 @@ -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); + } + } +} diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/java/beans/XMLEncoder/Test5023550.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/beans/XMLEncoder/Test5023550.java Fri Mar 19 18:49:36 2010 -0700 @@ -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]); + } + } +} diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/java/beans/XMLEncoder/Test5023557.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/beans/XMLEncoder/Test5023557.java Fri Mar 19 18:49:36 2010 -0700 @@ -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() }); + } + } +} diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/java/beans/XMLEncoder/Test6921644.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/beans/XMLEncoder/Test6921644.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 o = new Owner(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 { + private int id; + private List list = new ArrayList(); + + @ConstructorProperties("id") + public Owner(int id) { + this.id = id; + } + + public int getId() { + return this.id; + } + + public List getList() { + return this.list; + } + + public void setList(List list) { + this.list = list; + } + } + + public static class Author { + private int id; + private int ref; + private Owner owner; + private List list = new ArrayList(); + + @ConstructorProperties("owner") + public Author(Owner 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 getList() { + return this.list; + } + + public void setList(List 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 list = new ArrayList(); + + @ConstructorProperties("owner") + public Category(Owner owner) { + this.owner = owner; + } + + public Owner getOwner() { + return this.owner; + } + + public List getList() { + return this.list; + } + + public void setList(List 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; + } + } +} diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/java/net/Authenticator/B4769350.java --- a/jdk/test/java/net/Authenticator/B4769350.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/test/java/net/Authenticator/B4769350.java Fri Mar 19 18:49:36 2010 -0700 @@ -26,9 +26,12 @@ * @bug 4769350 * @library ../../../sun/net/www/httptest/ * @build HttpCallback HttpServer ClosedChannelList HttpTransaction AbstractCallback - * @run main B4769350 server - * @run main B4769350 proxy + * @run main/othervm B4769350 server + * @run main/othervm B4769350 proxy * @summary proxy authentication username and password caching only works in serial case + * Run in othervm since the test sets system properties that are read by the + * networking stack and cached when the HTTP handler is invoked, and previous + * tests may already have invoked the HTTP handler. */ import java.io.*; diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/java/net/ProxySelector/SystemProxies.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/net/ProxySelector/SystemProxies.java Fri Mar 19 18:49:36 2010 -0700 @@ -0,0 +1,61 @@ +/* + * 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 is a manual test to determine the proxies set on the system for various + * protocols. See bug 6912868. + */ +import java.net.Proxy; +import java.net.ProxySelector; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; + +public class SystemProxies { + + static final String uriAuthority = "myMachine/"; + static final ProxySelector proxySel = ProxySelector.getDefault(); + + public static void main(String[] args) { + if (! "true".equals(System.getProperty("java.net.useSystemProxies"))) { + System.out.println("Usage: java -Djava.net.useSystemProxies SystemProxies"); + return; + } + + printProxies("http://"); + printProxies("https://"); + printProxies("ftp://"); + } + + static void printProxies(String proto) { + String uriStr = proto + uriAuthority; + try { + List proxies = proxySel.select(new URI(uriStr)); + System.out.println("Proxies returned for " + uriStr); + for (Proxy proxy : proxies) + System.out.println("\t" + proxy); + } catch (URISyntaxException e) { + System.err.println(e); + } + } +} diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/java/nio/file/Files/PrintFileTree.java --- a/jdk/test/java/nio/file/Files/PrintFileTree.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/test/java/nio/file/Files/PrintFileTree.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 options = new HashSet(); if (followLinks) options.add(FileVisitOption.FOLLOW_LINKS); + final boolean reportCycles = printCycles; Files.walkFileTree(dir, options, Integer.MAX_VALUE, new FileVisitor() { 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) { diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/java/nio/file/Files/walk_file_tree.sh --- a/jdk/test/java/nio/file/Files/walk_file_tree.sh Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/test/java/nio/file/Files/walk_file_tree.sh Fri Mar 19 18:49:36 2010 -0700 @@ -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" diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/java/nio/file/Path/CheckPermissions.java --- a/jdk/test/java/nio/file/Path/CheckPermissions.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/test/java/nio/file/Path/CheckPermissions.java Fri Mar 19 18:49:36 2010 -0700 @@ -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(); diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/java/nio/file/Path/PathOps.java --- a/jdk/test/java/nio/file/Path/PathOps.java Fri Mar 12 01:09:13 2010 +0000 +++ b/jdk/test/java/nio/file/Path/PathOps.java Fri Mar 19 18:49:36 2010 -0700 @@ -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") diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/java/nio/file/WatchService/LotsOfEvents.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/nio/file/WatchService/LotsOfEvents.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 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> 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 modified = new HashSet(); + 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(); + } + } + } + } + +} diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/java/nio/file/WatchService/OverflowEventIsLoner.java --- a/jdk/test/java/nio/file/WatchService/OverflowEventIsLoner.java Fri Mar 12 01:09:13 2010 +0000 +++ /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> 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 + + + + + + + +
  + + + TEST FOR JScrollPane BUG
+
+ +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+ + END OF TEST FOR JScrollPane BUG
+
+
+
 
+ + diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/javax/swing/JScrollBar/6924059/bug6924059.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/swing/JScrollBar/6924059/bug6924059.java Fri Mar 19 18:49:36 2010 -0700 @@ -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"); + } + } + }); + } +} diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/javax/swing/JSlider/6848475/bug6848475.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/swing/JSlider/6848475/bug6848475.java Fri Mar 19 18:49:36 2010 -0700 @@ -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); + } + } +} diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/javax/swing/JSlider/6918861/bug6918861.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/swing/JSlider/6918861/bug6918861.java Fri Mar 19 18:49:36 2010 -0700 @@ -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; + } + } +} diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/javax/swing/JSlider/6923305/bug6923305.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/swing/JSlider/6923305/bug6923305.java Fri Mar 19 18:49:36 2010 -0700 @@ -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()); + } + }); + } +} diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/javax/swing/JTable/6913768/bug6913768.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/swing/JTable/6913768/bug6913768.java Fri Mar 19 18:49:36 2010 -0700 @@ -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); + } + }); + } +} diff -r 9b1fde936a71 -r a491e7a776d5 jdk/test/sun/security/krb5/etype/WeakCrypto.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/sun/security/krb5/etype/WeakCrypto.java Fri Mar 19 18:49:36 2010 -0700 @@ -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> entry : + factoryToAnnotation.entrySet()) { + AnnotationProcessorFactory apFactory = entry.getKey(); + AnnotationProcessor processor = apFactory.getProcessorFor(entry.getValue(), trivAPE); if (processor != null) processors.add(processor); @@ -496,57 +498,12 @@ * won't match anything. */ Pattern importStringToPattern(String s) { - if (s.equals("*")) { - return allMatches; + if (com.sun.tools.javac.processing.JavacProcessingEnvironment.isValidImportString(s)) { + return com.sun.tools.javac.processing.JavacProcessingEnvironment.validImportStringToPattern(s); } else { - String t = s; - boolean star = false; - - /* - * Validate string from factory is legal. If the string - * has more than one asterisks or the asterisks does not - * appear as the last character (preceded by a period), - * the string is not legal. - */ - - boolean valid = true; - int index = t.indexOf('*'); - if (index != -1) { - // '*' must be last character... - if (index == t.length() -1) { - // ... and preceeding character must be '.' - if ( index-1 >= 0 ) { - valid = t.charAt(index-1) == '.'; - // Strip off ".*$" for identifier checks - t = t.substring(0, t.length()-2); - } - } else - valid = false; - } - - // Verify string is off the form (javaId \.)+ or javaId - if (valid) { - String[] javaIds = t.split("\\.", t.length()+2); - for(String javaId: javaIds) - valid &= isJavaIdentifier(javaId); - } - - if (!valid) { - Bark bark = Bark.instance(context); - bark.aptWarning("MalformedSupportedString", s); - return noMatches; // won't match any valid identifier - } - - String s_prime = s.replaceAll("\\.", "\\\\."); - - if (s_prime.endsWith("*")) { - s_prime = s_prime.substring(0, s_prime.length() - 1) + ".+"; - } - - return Pattern.compile(s_prime); + Bark bark = Bark.instance(context); + bark.aptWarning("MalformedSupportedString", s); + return com.sun.tools.javac.processing.JavacProcessingEnvironment.noMatches; } } - - private static final Pattern allMatches = Pattern.compile(".*"); - private static final Pattern noMatches = Pattern.compile("(\\P{all})+"); } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/apt/main/CommandLine.java --- a/langtools/src/share/classes/com/sun/tools/apt/main/CommandLine.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/apt/main/CommandLine.java Fri Mar 19 18:49:36 2010 -0700 @@ -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(); diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/apt/main/Main.java --- a/langtools/src/share/classes/com/sun/tools/apt/main/Main.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/apt/main/Main.java Fri Mar 19 18:49:36 2010 -0700 @@ -56,6 +56,8 @@ import com.sun.tools.apt.util.Bark; import com.sun.mirror.apt.AnnotationProcessorFactory; +import static com.sun.tools.javac.file.Paths.pathToURLs; + /** This class provides a commandline interface to the apt build-time * tool. * @@ -1276,59 +1278,4 @@ } } } - - // Borrowed from DocletInvoker - /** - * Utility method for converting a search path string to an array - * of directory and JAR file URLs. - * - * @param path the search path string - * @return the resulting array of directory and JAR file URLs - */ - static URL[] pathToURLs(String path) { - StringTokenizer st = new StringTokenizer(path, File.pathSeparator); - URL[] urls = new URL[st.countTokens()]; - int count = 0; - while (st.hasMoreTokens()) { - URL url = fileToURL(new File(st.nextToken())); - if (url != null) { - urls[count++] = url; - } - } - if (urls.length != count) { - URL[] tmp = new URL[count]; - System.arraycopy(urls, 0, tmp, 0, count); - urls = tmp; - } - return urls; - } - - /** - * Returns the directory or JAR file URL corresponding to the specified - * local file name. - * - * @param file the File object - * @return the resulting directory or JAR file URL, or null if unknown - */ - static URL fileToURL(File file) { - String name; - try { - name = file.getCanonicalPath(); - } catch (IOException e) { - name = file.getAbsolutePath(); - } - name = name.replace(File.separatorChar, '/'); - if (!name.startsWith("/")) { - name = "/" + name; - } - // If the file does not exist, then assume that it's a directory - if (!file.isFile()) { - name = name + "/"; - } - try { - return new URL("file", "", name); - } catch (MalformedURLException e) { - throw new IllegalArgumentException("file"); - } - } } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java --- a/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java Fri Mar 19 18:49:36 2010 -0700 @@ -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; diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/DeclarationImpl.java --- a/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/DeclarationImpl.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/DeclarationImpl.java Fri Mar 19 18:49:36 2010 -0700 @@ -58,7 +58,7 @@ protected final AptEnv env; public final Symbol sym; - protected static DeclarationFilter identityFilter = + protected static final DeclarationFilter identityFilter = new DeclarationFilter(); diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/apt/mirror/type/TypeMirrorImpl.java --- a/langtools/src/share/classes/com/sun/tools/apt/mirror/type/TypeMirrorImpl.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/apt/mirror/type/TypeMirrorImpl.java Fri Mar 19 18:49:36 2010 -0700 @@ -71,6 +71,6 @@ * {@inheritDoc} */ public int hashCode() { - return env.jctypes.hashCode(type); + return Types.hashCode(type); } } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java --- a/langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java Fri Mar 19 18:49:36 2010 -0700 @@ -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; diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/doclets/standard/Standard.java --- a/langtools/src/share/classes/com/sun/tools/doclets/standard/Standard.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/standard/Standard.java Fri Mar 19 18:49:36 2010 -0700 @@ -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(); } } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/Launcher.java --- a/langtools/src/share/classes/com/sun/tools/javac/Launcher.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/Launcher.java Fri Mar 19 18:49:36 2010 -0700 @@ -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); diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java --- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java Fri Mar 19 18:49:36 2010 -0700 @@ -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( diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/code/Lint.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java Fri Mar 19 18:49:36 2010 -0700 @@ -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); diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Fri Mar 19 18:49:36 2010 -0700 @@ -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; diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/code/Types.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Fri Mar 19 18:49:36 2010 -0700 @@ -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) && diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri Mar 19 18:49:36 2010 -0700 @@ -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; } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/comp/Check.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Fri Mar 19 18:49:36 2010 -0700 @@ -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. */ diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 env = topLevelEnv(tree); + Env topEnv = topLevelEnv(tree); // Save environment of package-info.java file. if (isPkgInfo) { Env 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 env = typeEnvs.get(tree); - if (env == null) - env = topLevelEnv(tree); - memberEnter.memberEnter(tree, env); + Env topEnv = topLevelEnv(tree); + memberEnter.memberEnter(tree, topEnv); log.useSource(prev); } } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Fri Mar 19 18:49:36 2010 -0700 @@ -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; } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java --- a/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java Fri Mar 19 18:49:36 2010 -0700 @@ -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(); + } } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/file/Paths.java --- a/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java Fri Mar 19 18:49:36 2010 -0700 @@ -27,6 +27,8 @@ import java.io.File; import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -34,6 +36,7 @@ import java.util.Collection; import java.util.Collections; import java.util.LinkedHashSet; +import java.util.StringTokenizer; import java.util.zip.ZipFile; import javax.tools.JavaFileManager.Location; @@ -317,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)); } } } @@ -449,4 +452,60 @@ return fsInfo.isFile(file) && (n.endsWith(".jar") || n.endsWith(".zip")); } + + /** + * Utility method for converting a search path string to an array + * of directory and JAR file URLs. + * + * Note that this method is called by apt and the DocletInvoker. + * + * @param path the search path string + * @return the resulting array of directory and JAR file URLs + */ + public static URL[] pathToURLs(String path) { + StringTokenizer st = new StringTokenizer(path, File.pathSeparator); + URL[] urls = new URL[st.countTokens()]; + int count = 0; + while (st.hasMoreTokens()) { + URL url = fileToURL(new File(st.nextToken())); + if (url != null) { + urls[count++] = url; + } + } + if (urls.length != count) { + URL[] tmp = new URL[count]; + System.arraycopy(urls, 0, tmp, 0, count); + urls = tmp; + } + return urls; + } + + /** + * Returns the directory or JAR file URL corresponding to the specified + * local file name. + * + * @param file the File object + * @return the resulting directory or JAR file URL, or null if unknown + */ + private static URL fileToURL(File file) { + String name; + try { + name = file.getCanonicalPath(); + } catch (IOException e) { + name = file.getAbsolutePath(); + } + name = name.replace(File.separatorChar, '/'); + if (!name.startsWith("/")) { + name = "/" + name; + } + // If the file does not exist, then assume that it's a directory + if (!file.isFile()) { + name = name + "/"; + } + try { + return new URL("file", "", name); + } catch (MalformedURLException e) { + throw new IllegalArgumentException(file.toString()); + } + } } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Fri Mar 19 18:49:36 2010 -0700 @@ -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); diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Fri Mar 19 18:49:36 2010 -0700 @@ -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; diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/jvm/Items.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Items.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Items.java Fri Mar 19 18:49:36 2010 -0700 @@ -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; } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/main/CommandLine.java --- a/langtools/src/share/classes/com/sun/tools/javac/main/CommandLine.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/main/CommandLine.java Fri Mar 19 18:49:36 2010 -0700 @@ -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(); diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java --- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Fri Mar 19 18:49:36 2010 -0700 @@ -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.nil(), null, List.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 sourceFileObject) throws Throwable { compile(sourceFileObject, List.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); diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java --- a/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 types; + private transient List types; private final String typeStrings; MirroredTypesExceptionProxy(List 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; + } } } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java --- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Fri Mar 19 18:49:36 2010 -0700 @@ -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. */ diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java --- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Fri Mar 19 18:49:36 2010 -0700 @@ -25,7 +25,6 @@ package com.sun.tools.javac.processing; - import java.lang.reflect.*; import java.util.*; import java.util.regex.*; @@ -691,10 +690,12 @@ ProcessorState ps = psi.next(); Set matchedNames = new HashSet(); Set typeElements = new LinkedHashSet(); - for (String unmatchedAnnotationName : unmatchedAnnotations.keySet()) { + + for (Map.Entry 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); } @@ -791,16 +792,13 @@ List roots, List classSymbols, Iterable 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 @@ -874,23 +872,12 @@ JavaFileManager fileManager = currentContext.get(JavaFileManager.class); - List fileObjects = List.nil(); - for (JavaFileObject jfo : filer.getGeneratedSourceFileObjects() ) { - fileObjects = fileObjects.prepend(jfo); - } - - compiler = JavaCompiler.instance(currentContext); - List parsedFiles = compiler.parseFiles(fileObjects); - roots = cleanTrees(roots).reverse(); - - - for (JCCompilationUnit unit : parsedFiles) - roots = roots.prepend(unit); - roots = roots.reverse(); + List parsedFiles = sourcesToParsedFiles(compiler); + roots = cleanTrees(roots).appendList(parsedFiles); // Check for errors after parsing - if (compiler.parseErrors()) { + if (log.unrecoverableError) { errorStatus = true; break runAround; } else { @@ -921,11 +908,16 @@ break runAround; // No new files } } - runLastRound(xout, roundNumber, errorStatus, taskListener); + roots = runLastRound(xout, roundNumber, errorStatus, compiler, roots, taskListener); + // Set error status for any files compiled and generated in + // the last round + if (log.unrecoverableError) + errorStatus = true; compiler.close(false); currentContext = contextForNextRound(currentContext, true); compiler = JavaCompiler.instance(currentContext); + filer.newRound(currentContext, true); filer.warnIfUnclosedFiles(); warnIfUnmatchedOptions(); @@ -979,10 +971,22 @@ return compiler; } + private List sourcesToParsedFiles(JavaCompiler compiler) + throws IOException { + List fileObjects = List.nil(); + for (JavaFileObject jfo : filer.getGeneratedSourceFileObjects() ) { + fileObjects = fileObjects.prepend(jfo); + } + + return compiler.parseFiles(fileObjects); + } + // Call the last round of annotation processing - private void runLastRound(PrintWriter xout, - int roundNumber, - boolean errorStatus, + private List runLastRound(PrintWriter xout, + int roundNumber, + boolean errorStatus, + JavaCompiler compiler, + List roots, TaskListener taskListener) throws IOException { roundNumber++; List noTopLevelClasses = List.nil(); @@ -1003,6 +1007,15 @@ if (taskListener != null) taskListener.finished(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING_ROUND)); } + + // Add any sources generated during the last round to the set + // of files to be compiled. + if (moreToDo()) { + List parsedFiles = sourcesToParsedFiles(compiler); + roots = cleanTrees(roots).appendList(parsedFiles); + } + + return roots; } private void updateProcessingState(Context currentContext, boolean lastRound) { @@ -1204,45 +1217,6 @@ return false; } - private class AnnotationCollector extends TreeScanner { - List path = List.nil(); - static final boolean verbose = false; - List annotations = List.nil(); - - public List findAnnotations(List nodes) { - annotations = List.nil(); - scan(nodes); - List 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 List cleanTrees(List nodes) { for (T node : nodes) treeCleaner.scan(node); @@ -1340,115 +1314,62 @@ return specifiedPackages; } - // Borrowed from DocletInvoker and apt - // TODO: remove from apt's Main + private static final Pattern allMatches = Pattern.compile(".*"); + public static final Pattern noMatches = Pattern.compile("(\\P{all})+"); + /** - * Utility method for converting a search path string to an array - * of directory and JAR file URLs. - * - * @param path the search path string - * @return the resulting array of directory and JAR file URLs + * Convert import-style string for supported annotations into a + * regex matching that string. If the string is a valid + * import-style string, return a regex that won't match anything. */ - public static URL[] pathToURLs(String path) { - StringTokenizer st = new StringTokenizer(path, File.pathSeparator); - URL[] urls = new URL[st.countTokens()]; - int count = 0; - while (st.hasMoreTokens()) { - URL url = fileToURL(new File(st.nextToken())); - if (url != null) { - urls[count++] = url; - } + private static Pattern importStringToPattern(String s, Processor p, Log log) { + if (isValidImportString(s)) { + return validImportStringToPattern(s); + } else { + log.warning("proc.malformed.supported.string", s, p.getClass().getName()); + return noMatches; // won't match any valid identifier } - if (urls.length != count) { - URL[] tmp = new URL[count]; - System.arraycopy(urls, 0, tmp, 0, count); - urls = tmp; - } - return urls; } /** - * Returns the directory or JAR file URL corresponding to the specified - * local file name. - * - * @param file the File object - * @return the resulting directory or JAR file URL, or null if unknown + * Return true if the argument string is a valid import-style + * string specifying claimed annotations; return false otherwise. */ - private static URL fileToURL(File file) { - String name; - try { - name = file.getCanonicalPath(); - } catch (IOException e) { - name = file.getAbsolutePath(); + public static boolean isValidImportString(String s) { + if (s.equals("*")) + return true; + + boolean valid = true; + String t = s; + int index = t.indexOf('*'); + + if (index != -1) { + // '*' must be last character... + if (index == t.length() -1) { + // ... any and preceding character must be '.' + if ( index-1 >= 0 ) { + valid = t.charAt(index-1) == '.'; + // Strip off ".*$" for identifier checks + t = t.substring(0, t.length()-2); + } + } else + return false; } - name = name.replace(File.separatorChar, '/'); - if (!name.startsWith("/")) { - name = "/" + name; + + // Verify string is off the form (javaId \.)+ or javaId + if (valid) { + String[] javaIds = t.split("\\.", t.length()+2); + for(String javaId: javaIds) + valid &= SourceVersion.isIdentifier(javaId); } - // If the file does not exist, then assume that it's a directory - if (!file.isFile()) { - name = name + "/"; - } - try { - return new URL("file", "", name); - } catch (MalformedURLException e) { - throw new IllegalArgumentException("file"); - } + return valid; } - - - private static final Pattern allMatches = Pattern.compile(".*"); - - private static final Pattern noMatches = Pattern.compile("(\\P{all})+"); - /** - * Convert import-style string to regex matching that string. If - * the string is a valid import-style string, return a regex that - * won't match anything. - */ - // TODO: remove version in Apt.java - public static Pattern importStringToPattern(String s, Processor p, Log log) { + public static Pattern validImportStringToPattern(String s) { if (s.equals("*")) { return allMatches; } else { - String t = s; - boolean star = false; - - /* - * Validate string from factory is legal. If the string - * has more than one asterisks or the asterisks does not - * appear as the last character (preceded by a period), - * the string is not legal. - */ - - boolean valid = true; - int index = t.indexOf('*'); - if (index != -1) { - // '*' must be last character... - if (index == t.length() -1) { - // ... and preceeding character must be '.' - if ( index-1 >= 0 ) { - valid = t.charAt(index-1) == '.'; - // Strip off ".*$" for identifier checks - t = t.substring(0, t.length()-2); - } - } else - valid = false; - } - - // Verify string is off the form (javaId \.)+ or javaId - if (valid) { - String[] javaIds = t.split("\\.", t.length()+2); - for(String javaId: javaIds) - valid &= SourceVersion.isIdentifier(javaId); - } - - if (!valid) { - log.warning("proc.malformed.supported.string", s, p.getClass().getName()); - return noMatches; // won't match any valid identifier - } - - String s_prime = s.replaceAll("\\.", "\\\\."); + String s_prime = s.replace(".", "\\."); if (s_prime.endsWith("*")) { s_prime = s_prime.substring(0, s_prime.length() - 1) + ".+"; diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties --- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Fri Mar 19 18:49:36 2010 -0700 @@ -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 diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 && diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javac/util/Log.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java Fri Mar 19 18:49:36 2010 -0700 @@ -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. diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java --- a/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java Fri Mar 19 18:49:36 2010 -0700 @@ -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); diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java --- a/langtools/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java Fri Mar 19 18:49:36 2010 -0700 @@ -81,7 +81,7 @@ cpString = appendPath(System.getProperty("env.class.path"), cpString); cpString = appendPath(System.getProperty("java.class.path"), cpString); cpString = appendPath(docletPath, cpString); - URL[] urls = pathToURLs(cpString); + URL[] urls = com.sun.tools.javac.file.Paths.pathToURLs(cpString); if (docletParentClassLoader == null) appClassLoader = new URLClassLoader(urls, getDelegationClassLoader(docletClassName)); else @@ -313,58 +313,4 @@ Thread.currentThread().setContextClassLoader(savedCCL); } } - - /** - * Utility method for converting a search path string to an array - * of directory and JAR file URLs. - * - * @param path the search path string - * @return the resulting array of directory and JAR file URLs - */ - static URL[] pathToURLs(String path) { - StringTokenizer st = new StringTokenizer(path, File.pathSeparator); - URL[] urls = new URL[st.countTokens()]; - int count = 0; - while (st.hasMoreTokens()) { - URL url = fileToURL(new File(st.nextToken())); - if (url != null) { - urls[count++] = url; - } - } - if (urls.length != count) { - URL[] tmp = new URL[count]; - System.arraycopy(urls, 0, tmp, 0, count); - urls = tmp; - } - return urls; - } - - /** - * Returns the directory or JAR file URL corresponding to the specified - * local file name. - * - * @param file the File object - * @return the resulting directory or JAR file URL, or null if unknown - */ - static URL fileToURL(File file) { - String name; - try { - name = file.getCanonicalPath(); - } catch (IOException e) { - name = file.getAbsolutePath(); - } - name = name.replace(File.separatorChar, '/'); - if (!name.startsWith("/")) { - name = "/" + name; - } - // If the file does not exist, then assume that it's a directory - if (!file.isFile()) { - name = name + "/"; - } - try { - return new URL("file", "", name); - } catch (MalformedURLException e) { - throw new IllegalArgumentException("file"); - } - } } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java --- a/langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java Fri Mar 19 18:49:36 2010 -0700 @@ -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; diff -r 9b1fde936a71 -r a491e7a776d5 langtools/src/share/classes/com/sun/tools/javah/JavahTask.java --- a/langtools/src/share/classes/com/sun/tools/javah/JavahTask.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javah/JavahTask.java Fri Mar 19 18:49:36 2010 -0700 @@ -255,9 +255,11 @@ } this.classes = new ArrayList(); - 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 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"); } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/4880220/T4880220.empty.out diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/4880220/T4880220.error.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/4880220/T4880220.error.out Fri Mar 19 18:49:36 2010 -0700 @@ -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 diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/4880220/T4880220.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/4880220/T4880220.java Fri Mar 19 18:49:36 2010 -0700 @@ -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; + } +} diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/4880220/T4880220.warn.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/4880220/T4880220.warn.out Fri Mar 19 18:49:36 2010 -0700 @@ -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 diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/6341866/Anno.java --- a/langtools/test/tools/javac/6341866/Anno.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/6341866/Anno.java Fri Mar 19 18:49:36 2010 -0700 @@ -27,7 +27,6 @@ import javax.lang.model.element.*; @SupportedAnnotationTypes("*") - @SupportedSourceVersion(SourceVersion.RELEASE_7) public class Anno extends AbstractProcessor { public boolean process(Set annotations, RoundEnvironment roundEnv) { @@ -35,4 +34,9 @@ // System.err.println("annotation processing"); return true; } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/EarlyAssert.java --- a/langtools/test/tools/javac/EarlyAssert.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/EarlyAssert.java Fri Mar 19 18:49:36 2010 -0700 @@ -27,6 +27,8 @@ * @summary Verify that assertions are enabled before the class is initialized * and not thereafter * @author gafter + * @build EarlyAssert EarlyAssertWrapper + * @run main EarlyAssertWrapper */ /* diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/EarlyAssertWrapper.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/EarlyAssertWrapper.java Fri Mar 19 18:49:36 2010 -0700 @@ -0,0 +1,83 @@ +/* + * 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 java.util.*; + +/* + * Wrapper for the EarlyAssert test to run the test in a JVM without assertions + * enabled. + */ +public class EarlyAssertWrapper { + public static void main(String... args) throws Exception { + EarlyAssertWrapper w = new EarlyAssertWrapper(); + w.run(); + } + + void run() throws Exception { + List cmd = new ArrayList(); + File java_home = new File(System.getProperty("java.home")); + if (java_home.getName().equals("jre")) + java_home = java_home.getParentFile(); + cmd.add(new File(new File(java_home, "bin"), "java").getPath()); + + // ensure we run with the same bootclasspath as this test, + // in case this test is being run with -Xbootclasspath + cmd.add("-Xbootclasspath:" + System.getProperty("sun.boot.class.path")); + + // propogate classpath + cmd.add("-classpath"); + cmd.add(System.getProperty("java.class.path")); + + // ensure all assertions disabled in target VM + cmd.add("-da"); + cmd.add("-dsa"); + + cmd.add("EarlyAssert"); + + System.err.println("Running command: " + cmd); + + ProcessBuilder pb = new ProcessBuilder(cmd); + pb.redirectErrorStream(true); + Process p = pb.start(); + p.getOutputStream().close(); + + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + + String line; + DataInputStream in = new DataInputStream(p.getInputStream()); + try { + while ((line = in.readLine()) != null) + pw.println(line); + } finally { + in.close(); + } + pw.close(); + + String out = sw.toString(); + int rc = p.waitFor(); + if (rc != 0 || out.length() > 0) + throw new Error("failed: rc=" + rc + (out.length() > 0 ? ": " + out : "")); + } +} diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/T6403466.java --- a/langtools/test/tools/javac/T6403466.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/T6403466.java Fri Mar 19 18:49:36 2010 -0700 @@ -41,7 +41,6 @@ @Wrap @SupportedAnnotationTypes("Wrap") -@SupportedSourceVersion(SourceVersion.RELEASE_6) public class T6403466 extends AbstractProcessor { static final String testSrcDir = System.getProperty("test.src"); @@ -73,24 +72,31 @@ } public boolean process(Set annos, RoundEnvironment rEnv) { - Filer filer = processingEnv.getFiler(); - for (TypeElement anno: annos) { - Set elts = rEnv.getElementsAnnotatedWith(anno); - System.err.println("anno: " + anno); - System.err.println("elts: " + elts); - for (TypeElement te: ElementFilter.typesIn(elts)) { - try { - Writer out = filer.createSourceFile(te.getSimpleName() + "Wrapper").openWriter(); - out.write("class " + te.getSimpleName() + "Wrapper { }"); - out.close(); - } catch (IOException ex) { - ex.printStackTrace(); + if (!rEnv.processingOver()) { + Filer filer = processingEnv.getFiler(); + for (TypeElement anno: annos) { + Set elts = rEnv.getElementsAnnotatedWith(anno); + System.err.println("anno: " + anno); + System.err.println("elts: " + elts); + for (TypeElement te: ElementFilter.typesIn(elts)) { + try { + Writer out = filer.createSourceFile(te.getSimpleName() + "Wrapper").openWriter(); + out.write("class " + te.getSimpleName() + "Wrapper { }"); + out.close(); + } catch (IOException ex) { + ex.printStackTrace(); + } } + } - } return true; } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } } @Retention(RetentionPolicy.SOURCE) diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/T6406771.java --- a/langtools/test/tools/javac/T6406771.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/T6406771.java Fri Mar 19 18:49:36 2010 -0700 @@ -17,7 +17,7 @@ import com.sun.source.util.*; import com.sun.tools.javac.tree.JCTree; -@SupportedSourceVersion(SourceVersion.RELEASE_6) + @SupportedAnnotationTypes("*") public class T6406771 extends AbstractProcessor { String[] tests = { @@ -95,4 +95,8 @@ return true; } + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/T6411379.java --- a/langtools/test/tools/javac/T6411379.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/T6411379.java Fri Mar 19 18:49:36 2010 -0700 @@ -37,7 +37,6 @@ import com.sun.source.util.*; @SupportedAnnotationTypes("*") -@SupportedSourceVersion(SourceVersion.RELEASE_6) public class T6411379 extends AbstractProcessor { public boolean process(Set annoElems, @@ -58,6 +57,11 @@ return true; } + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + public void checkNull(Object o) { if (o != null) throw new AssertionError("expected null"); diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/T6423583.java --- a/langtools/test/tools/javac/T6423583.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/T6423583.java Fri Mar 19 18:49:36 2010 -0700 @@ -37,7 +37,6 @@ import com.sun.source.util.*; @SupportedAnnotationTypes("*") -@SupportedSourceVersion(SourceVersion.RELEASE_6) public class T6423583 extends AbstractProcessor { boolean b1 = true; boolean b2 = false; @@ -59,6 +58,10 @@ return true; } + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } private static class Test extends TreeScanner { diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/T6855236.java --- a/langtools/test/tools/javac/T6855236.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/T6855236.java Fri Mar 19 18:49:36 2010 -0700 @@ -38,7 +38,6 @@ import com.sun.source.tree.*; import com.sun.source.util.*; -@SupportedSourceVersion(SourceVersion.RELEASE_6) @SupportedAnnotationTypes("*") public class T6855236 extends AbstractProcessor { @@ -63,6 +62,11 @@ return true; } + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + class CodeVisitor extends TreePathScanner { @Override diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/T6881645.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/T6881645.java Fri Mar 19 18:49:36 2010 -0700 @@ -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() { + void m (Class x) {} + void test() { + m((Class)null); + } + }; +} + diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/ThrowsIntersection_1.java --- a/langtools/test/tools/javac/ThrowsIntersection_1.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/ThrowsIntersection_1.java Fri Mar 19 18:49:36 2010 -0700 @@ -30,6 +30,8 @@ * @compile ThrowsIntersection_1.java */ +package ThrowsIntersection_1; + class Ex1 extends Exception {} class Ex2 extends Exception {} diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/ThrowsIntersection_2.java --- a/langtools/test/tools/javac/ThrowsIntersection_2.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/ThrowsIntersection_2.java Fri Mar 19 18:49:36 2010 -0700 @@ -30,6 +30,8 @@ * @compile ThrowsIntersection_2.java */ +package ThrowsIntersection_2; + class Ex1 extends Exception {} class Ex2 extends Exception {} class Ex3 extends Exception {} diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/ThrowsIntersection_3.java --- a/langtools/test/tools/javac/ThrowsIntersection_3.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/ThrowsIntersection_3.java Fri Mar 19 18:49:36 2010 -0700 @@ -30,6 +30,8 @@ * @run compile/fail ThrowsIntersection_3.java */ +package ThrowsIntersection_3; + class Ex1 extends Exception {} class Ex2 extends Exception {} diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/ThrowsIntersection_4.java --- a/langtools/test/tools/javac/ThrowsIntersection_4.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/ThrowsIntersection_4.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 {} diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/annotations/neg/Constant.java --- a/langtools/test/tools/javac/annotations/neg/Constant.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/annotations/neg/Constant.java Fri Mar 19 18:49:36 2010 -0700 @@ -30,7 +30,7 @@ * @compile/fail Constant.java */ -package test.tools.javac.annotation.Constant; +package Constant; @T(a = X.x) @interface T { diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/api/6421111/T6421111.java --- a/langtools/test/tools/javac/api/6421111/T6421111.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/api/6421111/T6421111.java Fri Mar 19 18:49:36 2010 -0700 @@ -76,7 +76,6 @@ throw new AssertionError("Annotation processor failed"); } @SupportedAnnotationTypes("*") - @SupportedSourceVersion(SourceVersion.RELEASE_6) static class MyProcessor extends AbstractProcessor { void test(TypeElement element, boolean fbound) { TypeParameterElement tpe = element.getTypeParameters().iterator().next(); @@ -96,6 +95,10 @@ test(processingEnv.getElementUtils().getTypeElement("Test2"), true); return false; } + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } } public static void main(String... args) { new T6421111().test(args); diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/api/6468404/T6468404.java --- a/langtools/test/tools/javac/api/6468404/T6468404.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/api/6468404/T6468404.java Fri Mar 19 18:49:36 2010 -0700 @@ -105,7 +105,6 @@ } @SupportedAnnotationTypes("*") -@SupportedSourceVersion(SourceVersion.RELEASE_6) class P extends AbstractProcessor { boolean ran = false; @@ -145,4 +144,9 @@ } return true; } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/api/T6412669.java --- a/langtools/test/tools/javac/api/T6412669.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/api/T6412669.java Fri Mar 19 18:49:36 2010 -0700 @@ -38,7 +38,6 @@ import com.sun.tools.javac.api.*; @SupportedAnnotationTypes("*") -@SupportedSourceVersion(SourceVersion.RELEASE_6) public class T6412669 extends AbstractProcessor { public static void main(String... args) throws IOException { String testSrc = System.getProperty("test.src", "."); @@ -72,4 +71,9 @@ } return true; } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/api/TestJavacTaskScanner.java --- a/langtools/test/tools/javac/api/TestJavacTaskScanner.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/api/TestJavacTaskScanner.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 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 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 { diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/api/TestResolveError.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/api/TestResolveError.java Fri Mar 19 18:49:36 2010 -0700 @@ -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", 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 compilationUnits = + fm.getJavaFileObjects(new File[] {file}); + task = (JavacTaskImpl)tool.getTask(pw, fm, null, null, null, compilationUnits); + elements = task.getElements(); + types = task.getTypes(); + + Iterable 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", 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; +} diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/enum/6424358/T6424358.java --- a/langtools/test/tools/javac/enum/6424358/T6424358.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/enum/6424358/T6424358.java Fri Mar 19 18:49:36 2010 -0700 @@ -34,13 +34,12 @@ import javax.annotation.processing.*; import javax.lang.model.element.*; import javax.lang.model.util.*; +import javax.lang.model.SourceVersion; import static javax.tools.Diagnostic.Kind.*; -import static javax.lang.model.SourceVersion.RELEASE_6; @interface TestMe {} @SupportedAnnotationTypes("*") -@SupportedSourceVersion(RELEASE_6) public class T6424358 extends AbstractProcessor { @TestMe enum Test { FOO; } @@ -66,4 +65,9 @@ scan.scan(e); return true; } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/generics/Casting.java --- a/langtools/test/tools/javac/generics/Casting.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/generics/Casting.java Fri Mar 19 18:49:36 2010 -0700 @@ -30,7 +30,7 @@ * @compile Casting.java */ -package test.tools.javac.generics.Casting; +package Casting; class Test {} diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/generics/Casting3.java --- a/langtools/test/tools/javac/generics/Casting3.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/generics/Casting3.java Fri Mar 19 18:49:36 2010 -0700 @@ -30,7 +30,7 @@ * @compile Casting3.java */ -package test.tools.javac.generics.Casting3; +package Casting3; class A> { > void f() { diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/generics/Casting4.java --- a/langtools/test/tools/javac/generics/Casting4.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/generics/Casting4.java Fri Mar 19 18:49:36 2010 -0700 @@ -30,7 +30,7 @@ * @compile -Werror -Xlint:unchecked Casting4.java */ -package test.tools.javac.generics.Casting4; +package Casting4; class Casting4 { Integer f(Comparable c) { diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/generics/InnerInterface1.java --- a/langtools/test/tools/javac/generics/InnerInterface1.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/generics/InnerInterface1.java Fri Mar 19 18:49:36 2010 -0700 @@ -30,7 +30,7 @@ * @compile InnerInterface1.java */ -package test.tools.javac.generics.InnerInterface1; +package InnerInterface1; interface Iterator { } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/generics/InnerInterface2.java --- a/langtools/test/tools/javac/generics/InnerInterface2.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/generics/InnerInterface2.java Fri Mar 19 18:49:36 2010 -0700 @@ -30,7 +30,7 @@ * @compile InnerInterface2.java */ -package test.tools.javac.generics.InnerInterface2; +package InnerInterface2; class Builder { diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/generics/Multibound1.java --- a/langtools/test/tools/javac/generics/Multibound1.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/generics/Multibound1.java Fri Mar 19 18:49:36 2010 -0700 @@ -30,7 +30,7 @@ * @compile/fail Multibound1.java */ -package test.tools.javac.generics.Multibound1; +package Multibound1; interface A {} interface B {} diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/generics/MultipleInheritance.java --- a/langtools/test/tools/javac/generics/MultipleInheritance.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/generics/MultipleInheritance.java Fri Mar 19 18:49:36 2010 -0700 @@ -30,7 +30,7 @@ * @compile MultipleInheritance.java */ -package test.tools.javac.generics.MultipleInheritance; +package MultipleInheritance; import java.util.*; diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/generics/NameOrder.java --- a/langtools/test/tools/javac/generics/NameOrder.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/generics/NameOrder.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 f(T t1, T t2) { return null; } void g() { - a x = f( new A(), new B() ); + a x = f( new AB(), new CA() ); } } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/generics/PermuteBound.java --- a/langtools/test/tools/javac/generics/PermuteBound.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/generics/PermuteBound.java Fri Mar 19 18:49:36 2010 -0700 @@ -30,7 +30,7 @@ * @compile PermuteBound.java */ -package test.tools.javac.generics.PermuteBound; +package PermuteBound; class C {} diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/generics/PrimitiveVariant.java --- a/langtools/test/tools/javac/generics/PrimitiveVariant.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/generics/PrimitiveVariant.java Fri Mar 19 18:49:36 2010 -0700 @@ -30,7 +30,7 @@ * @compile/fail PrimitiveVariant.java */ -package test.tools.javac.generics.PrimitiveVariant; +package PrimitiveVariant; interface I { double m(); diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/processing/6348499/A.java --- a/langtools/test/tools/javac/processing/6348499/A.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/processing/6348499/A.java Fri Mar 19 18:49:36 2010 -0700 @@ -28,7 +28,6 @@ import javax.lang.model.element.*; @SupportedAnnotationTypes("*") -@SupportedSourceVersion(SourceVersion.RELEASE_7) public class A extends AbstractProcessor { public boolean process(Set tes, RoundEnvironment renv) { Filer filer = processingEnv.getFiler(); @@ -40,4 +39,8 @@ } return true; } + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/processing/6414633/A.java --- a/langtools/test/tools/javac/processing/6414633/A.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/processing/6414633/A.java Fri Mar 19 18:49:36 2010 -0700 @@ -30,7 +30,6 @@ import javax.tools.*; @SupportedAnnotationTypes("*") -@SupportedSourceVersion(SourceVersion.RELEASE_7) public class A extends AbstractProcessor { public boolean process(Set annotations, RoundEnvironment roundEnv) { @@ -42,4 +41,9 @@ } return true; } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/processing/6430209/T6430209.java --- a/langtools/test/tools/javac/processing/6430209/T6430209.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/processing/6430209/T6430209.java Fri Mar 19 18:49:36 2010 -0700 @@ -63,7 +63,6 @@ new File(testSrc, "test0.java"), new File(testSrc, "test1.java"))); Iterable opts = Arrays.asList("-proc:only", "-processor", "b6341534", - "-source", "1.6", "-processorpath", testClasses); StringWriter out = new StringWriter(); JavacTask task = tool.getTask(out, fm, dl, opts, null, files); diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/processing/6430209/b6341534.java --- a/langtools/test/tools/javac/processing/6430209/b6341534.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/processing/6430209/b6341534.java Fri Mar 19 18:49:36 2010 -0700 @@ -22,6 +22,7 @@ */ import javax.annotation.processing.*; +import javax.lang.model.SourceVersion; import javax.lang.model.element.*; import javax.lang.model.util.*; import static javax.lang.model.util.ElementFilter.*; @@ -30,7 +31,6 @@ import java.util.Set; @SupportedAnnotationTypes({"*"}) -@SupportedSourceVersion(javax.lang.model.SourceVersion.RELEASE_7) public class b6341534 extends AbstractProcessor { static int r = 0; static Elements E = null; @@ -62,4 +62,9 @@ if( renv.errorRaised() ) { msgr.printMessage(ERROR, "FAILED");} return true; } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } } diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/processing/6511613/DummyProcessor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/processing/6511613/DummyProcessor.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 annotations, + RoundEnvironment roundEnv) { + return true; + } + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } +} + diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/processing/6511613/clss41701.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/processing/6511613/clss41701.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 { +} diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/processing/6634138/Dummy.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/processing/6634138/Dummy.java Fri Mar 19 18:49:36 2010 -0700 @@ -0,0 +1,27 @@ +/* + * 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. + */ + +/** + * A dummy class to be compiled. + */ +public class Dummy {} diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/processing/6634138/ExerciseDependency.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/processing/6634138/ExerciseDependency.java Fri Mar 19 18:49:36 2010 -0700 @@ -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. + */ + +/** + * Class to exercise dependencies on the two source files generated by + * T6634138.java, foo.WrittenAfterProcessing.java and + * foo.package-info.java. + */ +public class ExerciseDependency { + public static void main(String... args) { + foo.WrittenAfterProcessing wap = new foo.WrittenAfterProcessing(); + java.lang.Package pkg = wap.getClass().getPackage(); + Deprecated d = pkg.getAnnotation(Deprecated.class); + if (d == null) + throw new RuntimeException(); + } +} diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/processing/6634138/T6634138.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/processing/6634138/T6634138.java Fri Mar 19 18:49:36 2010 -0700 @@ -0,0 +1,93 @@ +/* + * 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 6634138 + * @author Joseph D. Darcy + * @summary Verify source files output after processing is over are compiled + * @compile T6634138.java + * @compile -processor T6634138 Dummy.java + * @run main ExerciseDependency + */ + +import java.lang.annotation.Annotation; +import java.io.*; +import java.util.Collections; +import java.util.Set; +import java.util.HashSet; +import java.util.List; +import java.util.ArrayList; +import java.util.Arrays; +import javax.annotation.processing.*; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.*; +import javax.lang.model.util.*; + +@SupportedAnnotationTypes("*") +public class T6634138 extends AbstractProcessor { + private Filer filer; + + public boolean process(Set annotations, + RoundEnvironment roundEnvironment) { + // Write out files *after* processing is over. + if (roundEnvironment.processingOver()) { + System.out.println("Writing out source files."); + try { + PrintWriter pw = new PrintWriter(filer.createSourceFile("foo.WrittenAfterProcessing").openWriter()); + try { + pw.println("package foo;"); + pw.println("public class WrittenAfterProcessing {"); + pw.println(" public WrittenAfterProcessing() {super();}"); + pw.println("}"); + } finally { + pw.close(); + } + + pw = new PrintWriter(filer.createSourceFile("foo.package-info").openWriter()); + try { + pw.println("@Deprecated"); + pw.println("package foo;"); + } finally { + pw.close(); + } + } catch(IOException io) { + throw new RuntimeException(io); + } + } + return true; + } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + + public void init(ProcessingEnvironment processingEnv) { + super.init(processingEnv); + filer = processingEnv.getFiler(); + } +} + + + diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/processing/T6439826.java --- a/langtools/test/tools/javac/processing/T6439826.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/processing/T6439826.java Fri Mar 19 18:49:36 2010 -0700 @@ -39,7 +39,6 @@ @SupportedAnnotationTypes("*") -@SupportedSourceVersion(SourceVersion.RELEASE_7 ) public class T6439826 extends AbstractProcessor { public static void main(String... args) { String testSrc = System.getProperty("test.src", "."); @@ -76,6 +75,11 @@ return false; } + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + private void writeBadFile() { Filer filer = processingEnv.getFiler(); Messager messager = processingEnv.getMessager(); diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/processing/model/element/TestAnonClassNames.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/processing/model/element/TestAnonClassNames.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 classNames = new ArrayList<>(); + classNames.add(className); + + List 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 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 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(); + } +} diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/processing/model/element/TestAnonSourceNames.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/processing/model/element/TestAnonSourceNames.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 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 { + 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(); + } +} diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/processing/model/element/TypeParamBounds.java --- a/langtools/test/tools/javac/processing/model/element/TypeParamBounds.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/processing/model/element/TypeParamBounds.java Fri Mar 19 18:49:36 2010 -0700 @@ -40,7 +40,6 @@ import javax.lang.model.type.*; import javax.lang.model.util.*; -@SupportedSourceVersion(SourceVersion.RELEASE_6) @SupportedAnnotationTypes("*") public class TypeParamBounds extends AbstractProcessor { @@ -60,6 +59,11 @@ return true; } + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + private void doit(Set annoTypes, RoundEnvironment round) { TypeElement gen = elements.getTypeElement("TypeParamBounds.Gen"); diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/processing/model/type/MirroredTypeEx/OverEager.java --- a/langtools/test/tools/javac/processing/model/type/MirroredTypeEx/OverEager.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/processing/model/type/MirroredTypeEx/OverEager.java Fri Mar 19 18:49:36 2010 -0700 @@ -38,7 +38,6 @@ import javax.lang.model.util.*; import static javax.lang.model.util.ElementFilter.*; -@SupportedSourceVersion(SourceVersion.RELEASE_6) @SupportedAnnotationTypes("IAm") @IAm(OverEager.class) public class OverEager extends AbstractProcessor { @@ -59,6 +58,11 @@ return true; } + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + private void doit(Set annoTypes, RoundEnvironment round) { for (TypeElement t : typesIn(round.getRootElements())) { diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/processing/model/type/NoTypes.java --- a/langtools/test/tools/javac/processing/model/type/NoTypes.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/processing/model/type/NoTypes.java Fri Mar 19 18:49:36 2010 -0700 @@ -39,8 +39,6 @@ import static javax.lang.model.type.TypeKind.*; - -@SupportedSourceVersion(SourceVersion.RELEASE_6) @SupportedAnnotationTypes("*") public class NoTypes extends AbstractProcessor { @@ -60,6 +58,11 @@ return true; } + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + private void doit(Set annoTypes, RoundEnvironment round) { diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/processing/model/util/GetTypeElemBadArg.java --- a/langtools/test/tools/javac/processing/model/util/GetTypeElemBadArg.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/processing/model/util/GetTypeElemBadArg.java Fri Mar 19 18:49:36 2010 -0700 @@ -37,7 +37,6 @@ import javax.lang.model.type.*; import javax.lang.model.util.*; -@SupportedSourceVersion(SourceVersion.RELEASE_6) @SupportedAnnotationTypes("*") public class GetTypeElemBadArg extends AbstractProcessor { @@ -64,6 +63,12 @@ return true; } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + private static void tellAbout(TypeElement t) { System.out.println(t); System.out.println(t.getClass()); diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/processing/model/util/OverridesSpecEx.java --- a/langtools/test/tools/javac/processing/model/util/OverridesSpecEx.java Fri Mar 12 01:09:13 2010 +0000 +++ b/langtools/test/tools/javac/processing/model/util/OverridesSpecEx.java Fri Mar 19 18:49:36 2010 -0700 @@ -40,7 +40,6 @@ import static javax.lang.model.util.ElementFilter.*; -@SupportedSourceVersion(SourceVersion.RELEASE_6) @SupportedAnnotationTypes("*") public class OverridesSpecEx extends AbstractProcessor { @@ -60,6 +59,11 @@ return true; } + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + private void doit(Set annoTypes, RoundEnvironment round) { TypeElement string = elements.getTypeElement("java.lang.String"); diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/tree/TestAnnotatedAnonClass.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/tree/TestAnnotatedAnonClass.java Fri Mar 19 18:49:36 2010 -0700 @@ -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() { }; + } +} diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/tree/TreePosTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/tree/TreePosTest.java Fri Mar 19 18:49:36 2010 -0700 @@ -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. + * + *

+ * 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 files = new ArrayList(); + 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 files = fm.getJavaFileObjects(file); + JavacTask task = tool.getTask(pw, fm, r, Collections.emptyList(), null, files); + Iterable trees = task.parse(); + pw.flush(); + if (r.errors > 0) + throw new ParseException(sw.toString()); + Iterator 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 tags = new HashSet(); + /** Set of files and directories to be excluded from analysis. */ + Set excludeFiles = new HashSet(); + /** Set of tag names to be excluded from analysis. */ + Set excludeTags = new HashSet(); + /** 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 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 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(); + 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 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 { + Reporter(PrintWriter out) { + this.out = out; + } + + public void report(Diagnostic 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; + } + } +} + diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javac/treepostests/TreePosTest.java --- a/langtools/test/tools/javac/treepostests/TreePosTest.java Fri Mar 12 01:09:13 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,752 +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. - * - *

- * 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 . - */ -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 files = new ArrayList(); - 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("-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(""); - 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 files = fm.getJavaFileObjects(file); - JavacTask task = tool.getTask(pw, fm, r, Collections.emptyList(), null, files); - Iterable trees = task.parse(); - pw.flush(); - if (r.errors > 0) - throw new ParseException(sw.toString()); - Iterator 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 tags = new HashSet(); - /** Set of files and directories to be excluded from analysis. */ - Set excludeFiles = new HashSet(); - /** 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(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 x) { - return tags.size() == 0 || tags.contains(tagNames.get(x.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 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 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(); - 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 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 { - Reporter(PrintWriter out) { - this.out = out; - } - - public void report(Diagnostic 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; - } - } -} - diff -r 9b1fde936a71 -r a491e7a776d5 langtools/test/tools/javah/T6893943.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javah/T6893943.java Fri Mar 19 18:49:36 2010 -0700 @@ -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 command = new ArrayList(); + 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); + } +} diff -r 9b1fde936a71 -r a491e7a776d5 make/jprt.properties --- a/make/jprt.properties Fri Mar 12 01:09:13 2010 +0000 +++ b/make/jprt.properties Fri Mar 19 18:49:36 2010 -0700 @@ -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 + diff -r 9b1fde936a71 -r a491e7a776d5 test/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/Makefile Fri Mar 19 18:49:36 2010 -0700 @@ -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) + +################################################################ +