Mon, 22 Jul 2013 14:01:39 +0100
Merge
src/share/vm/memory/klassInfoClosure.hpp | file | annotate | diff | comparison | revisions | |
src/share/vm/runtime/aprofiler.cpp | file | annotate | diff | comparison | revisions | |
src/share/vm/runtime/aprofiler.hpp | file | annotate | diff | comparison | revisions |
1.1 --- a/.hgtags Mon Jul 15 11:07:03 2013 +0100 1.2 +++ b/.hgtags Mon Jul 22 14:01:39 2013 +0100 1.3 @@ -358,3 +358,5 @@ 1.4 d197d377ab2e016d024e8c86cb06a57bd7eae590 jdk8-b97 1.5 c9dd82da51ed34a28f7c6b3245163ee962e94572 hs25-b40 1.6 30b5b75c42ac5174b640fbef8aa87527668e8400 jdk8-b98 1.7 +2b9946e10587f74ef75ae8145bea484df4a2738b hs25-b41 1.8 +81b6cb70717c66375846b78bb174594ec3aa998e jdk8-b99
2.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java Mon Jul 15 11:07:03 2013 +0100 2.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java Mon Jul 22 14:01:39 2013 +0100 2.3 @@ -49,7 +49,6 @@ 2.4 higherDimension = new MetadataField(type.getAddressField("_higher_dimension"), 0); 2.5 lowerDimension = new MetadataField(type.getAddressField("_lower_dimension"), 0); 2.6 vtableLen = new CIntField(type.getCIntegerField("_vtable_len"), 0); 2.7 - allocSize = new CIntField(type.getCIntegerField("_alloc_size"), 0); 2.8 componentMirror = new OopField(type.getOopField("_component_mirror"), 0); 2.9 javaLangCloneableName = null; 2.10 javaLangObjectName = null; 2.11 @@ -64,7 +63,6 @@ 2.12 private static MetadataField higherDimension; 2.13 private static MetadataField lowerDimension; 2.14 private static CIntField vtableLen; 2.15 - private static CIntField allocSize; 2.16 private static OopField componentMirror; 2.17 2.18 public Klass getJavaSuper() { 2.19 @@ -76,7 +74,6 @@ 2.20 public Klass getHigherDimension() { return (Klass) higherDimension.getValue(this); } 2.21 public Klass getLowerDimension() { return (Klass) lowerDimension.getValue(this); } 2.22 public long getVtableLen() { return vtableLen.getValue(this); } 2.23 - public long getAllocSize() { return allocSize.getValue(this); } 2.24 public Oop getComponentMirror() { return componentMirror.getValue(this); } 2.25 2.26 // constant class names - javaLangCloneable, javaIoSerializable, javaLangObject 2.27 @@ -147,7 +144,6 @@ 2.28 visitor.doMetadata(higherDimension, true); 2.29 visitor.doMetadata(lowerDimension, true); 2.30 visitor.doCInt(vtableLen, true); 2.31 - visitor.doCInt(allocSize, true); 2.32 visitor.doOop(componentMirror, true); 2.33 } 2.34 }
3.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java Mon Jul 15 11:07:03 2013 +0100 3.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java Mon Jul 22 14:01:39 2013 +0100 3.3 @@ -57,7 +57,6 @@ 3.4 accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0); 3.5 subklass = new MetadataField(type.getAddressField("_subklass"), 0); 3.6 nextSibling = new MetadataField(type.getAddressField("_next_sibling"), 0); 3.7 - allocCount = new CIntField(type.getCIntegerField("_alloc_count"), 0); 3.8 3.9 LH_INSTANCE_SLOW_PATH_BIT = db.lookupIntConstant("Klass::_lh_instance_slow_path_bit").intValue(); 3.10 LH_LOG2_ELEMENT_SIZE_SHIFT = db.lookupIntConstant("Klass::_lh_log2_element_size_shift").intValue(); 3.11 @@ -87,7 +86,6 @@ 3.12 private static CIntField accessFlags; 3.13 private static MetadataField subklass; 3.14 private static MetadataField nextSibling; 3.15 - private static CIntField allocCount; 3.16 3.17 private Address getValue(AddressField field) { 3.18 return addr.getAddressAt(field.getOffset()); 3.19 @@ -108,7 +106,6 @@ 3.20 public AccessFlags getAccessFlagsObj(){ return new AccessFlags(getAccessFlags()); } 3.21 public Klass getSubklassKlass() { return (Klass) subklass.getValue(this); } 3.22 public Klass getNextSiblingKlass() { return (Klass) nextSibling.getValue(this); } 3.23 - public long getAllocCount() { return allocCount.getValue(this); } 3.24 3.25 // computed access flags - takes care of inner classes etc. 3.26 // This is closer to actual source level than getAccessFlags() etc. 3.27 @@ -172,7 +169,6 @@ 3.28 visitor.doCInt(accessFlags, true); 3.29 visitor.doMetadata(subklass, true); 3.30 visitor.doMetadata(nextSibling, true); 3.31 - visitor.doCInt(allocCount, true); 3.32 } 3.33 3.34 public long getObjectSize() {
4.1 --- a/make/bsd/makefiles/mapfile-vers-debug Mon Jul 15 11:07:03 2013 +0100 4.2 +++ b/make/bsd/makefiles/mapfile-vers-debug Mon Jul 22 14:01:39 2013 +0100 4.3 @@ -221,7 +221,6 @@ 4.4 _JVM_SetLength 4.5 _JVM_SetNativeThreadName 4.6 _JVM_SetPrimitiveArrayElement 4.7 - _JVM_SetProtectionDomain 4.8 _JVM_SetSockOpt 4.9 _JVM_SetThreadPriority 4.10 _JVM_Sleep
5.1 --- a/make/bsd/makefiles/mapfile-vers-product Mon Jul 15 11:07:03 2013 +0100 5.2 +++ b/make/bsd/makefiles/mapfile-vers-product Mon Jul 22 14:01:39 2013 +0100 5.3 @@ -221,7 +221,6 @@ 5.4 _JVM_SetLength 5.5 _JVM_SetNativeThreadName 5.6 _JVM_SetPrimitiveArrayElement 5.7 - _JVM_SetProtectionDomain 5.8 _JVM_SetSockOpt 5.9 _JVM_SetThreadPriority 5.10 _JVM_Sleep
6.1 --- a/make/hotspot_version Mon Jul 15 11:07:03 2013 +0100 6.2 +++ b/make/hotspot_version Mon Jul 22 14:01:39 2013 +0100 6.3 @@ -35,7 +35,7 @@ 6.4 6.5 HS_MAJOR_VER=25 6.6 HS_MINOR_VER=0 6.7 -HS_BUILD_NUMBER=40 6.8 +HS_BUILD_NUMBER=41 6.9 6.10 JDK_MAJOR_VER=1 6.11 JDK_MINOR_VER=8
7.1 --- a/make/linux/makefiles/mapfile-vers-debug Mon Jul 15 11:07:03 2013 +0100 7.2 +++ b/make/linux/makefiles/mapfile-vers-debug Mon Jul 22 14:01:39 2013 +0100 7.3 @@ -223,7 +223,6 @@ 7.4 JVM_SetLength; 7.5 JVM_SetNativeThreadName; 7.6 JVM_SetPrimitiveArrayElement; 7.7 - JVM_SetProtectionDomain; 7.8 JVM_SetSockOpt; 7.9 JVM_SetThreadPriority; 7.10 JVM_Sleep;
8.1 --- a/make/linux/makefiles/mapfile-vers-product Mon Jul 15 11:07:03 2013 +0100 8.2 +++ b/make/linux/makefiles/mapfile-vers-product Mon Jul 22 14:01:39 2013 +0100 8.3 @@ -223,7 +223,6 @@ 8.4 JVM_SetLength; 8.5 JVM_SetNativeThreadName; 8.6 JVM_SetPrimitiveArrayElement; 8.7 - JVM_SetProtectionDomain; 8.8 JVM_SetSockOpt; 8.9 JVM_SetThreadPriority; 8.10 JVM_Sleep;
9.1 --- a/make/solaris/makefiles/mapfile-vers Mon Jul 15 11:07:03 2013 +0100 9.2 +++ b/make/solaris/makefiles/mapfile-vers Mon Jul 22 14:01:39 2013 +0100 9.3 @@ -223,7 +223,6 @@ 9.4 JVM_SetLength; 9.5 JVM_SetNativeThreadName; 9.6 JVM_SetPrimitiveArrayElement; 9.7 - JVM_SetProtectionDomain; 9.8 JVM_SetSockOpt; 9.9 JVM_SetThreadPriority; 9.10 JVM_Sleep;
10.1 --- a/src/os/bsd/vm/os_bsd.cpp Mon Jul 15 11:07:03 2013 +0100 10.2 +++ b/src/os/bsd/vm/os_bsd.cpp Mon Jul 22 14:01:39 2013 +0100 10.3 @@ -1234,12 +1234,13 @@ 10.4 Dl_info dlinfo; 10.5 10.6 if (libjvm_base_addr == NULL) { 10.7 - dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo); 10.8 - libjvm_base_addr = (address)dlinfo.dli_fbase; 10.9 + if (dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo) != 0) { 10.10 + libjvm_base_addr = (address)dlinfo.dli_fbase; 10.11 + } 10.12 assert(libjvm_base_addr !=NULL, "Cannot obtain base address for libjvm"); 10.13 } 10.14 10.15 - if (dladdr((void *)addr, &dlinfo)) { 10.16 + if (dladdr((void *)addr, &dlinfo) != 0) { 10.17 if (libjvm_base_addr == (address)dlinfo.dli_fbase) return true; 10.18 } 10.19 10.20 @@ -1251,55 +1252,67 @@ 10.21 10.22 bool os::dll_address_to_function_name(address addr, char *buf, 10.23 int buflen, int *offset) { 10.24 + // buf is not optional, but offset is optional 10.25 + assert(buf != NULL, "sanity check"); 10.26 + 10.27 Dl_info dlinfo; 10.28 char localbuf[MACH_MAXSYMLEN]; 10.29 10.30 - // dladdr will find names of dynamic functions only, but does 10.31 - // it set dli_fbase with mach_header address when it "fails" ? 10.32 - if (dladdr((void*)addr, &dlinfo) && dlinfo.dli_sname != NULL) { 10.33 - if (buf != NULL) { 10.34 - if(!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { 10.35 + if (dladdr((void*)addr, &dlinfo) != 0) { 10.36 + // see if we have a matching symbol 10.37 + if (dlinfo.dli_saddr != NULL && dlinfo.dli_sname != NULL) { 10.38 + if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { 10.39 jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname); 10.40 } 10.41 + if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; 10.42 + return true; 10.43 } 10.44 - if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; 10.45 - return true; 10.46 - } else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) { 10.47 - if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), 10.48 - buf, buflen, offset, dlinfo.dli_fname)) { 10.49 - return true; 10.50 + // no matching symbol so try for just file info 10.51 + if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) { 10.52 + if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), 10.53 + buf, buflen, offset, dlinfo.dli_fname)) { 10.54 + return true; 10.55 + } 10.56 + } 10.57 + 10.58 + // Handle non-dynamic manually: 10.59 + if (dlinfo.dli_fbase != NULL && 10.60 + Decoder::decode(addr, localbuf, MACH_MAXSYMLEN, offset, 10.61 + dlinfo.dli_fbase)) { 10.62 + if (!Decoder::demangle(localbuf, buf, buflen)) { 10.63 + jio_snprintf(buf, buflen, "%s", localbuf); 10.64 + } 10.65 + return true; 10.66 } 10.67 } 10.68 - 10.69 - // Handle non-dymanic manually: 10.70 - if (dlinfo.dli_fbase != NULL && 10.71 - Decoder::decode(addr, localbuf, MACH_MAXSYMLEN, offset, dlinfo.dli_fbase)) { 10.72 - if(!Decoder::demangle(localbuf, buf, buflen)) { 10.73 - jio_snprintf(buf, buflen, "%s", localbuf); 10.74 + buf[0] = '\0'; 10.75 + if (offset != NULL) *offset = -1; 10.76 + return false; 10.77 +} 10.78 + 10.79 +// ported from solaris version 10.80 +bool os::dll_address_to_library_name(address addr, char* buf, 10.81 + int buflen, int* offset) { 10.82 + // buf is not optional, but offset is optional 10.83 + assert(buf != NULL, "sanity check"); 10.84 + 10.85 + Dl_info dlinfo; 10.86 + 10.87 + if (dladdr((void*)addr, &dlinfo) != 0) { 10.88 + if (dlinfo.dli_fname != NULL) { 10.89 + jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); 10.90 + } 10.91 + if (dlinfo.dli_fbase != NULL && offset != NULL) { 10.92 + *offset = addr - (address)dlinfo.dli_fbase; 10.93 } 10.94 return true; 10.95 } 10.96 - if (buf != NULL) buf[0] = '\0'; 10.97 - if (offset != NULL) *offset = -1; 10.98 + 10.99 + buf[0] = '\0'; 10.100 + if (offset) *offset = -1; 10.101 return false; 10.102 } 10.103 10.104 -// ported from solaris version 10.105 -bool os::dll_address_to_library_name(address addr, char* buf, 10.106 - int buflen, int* offset) { 10.107 - Dl_info dlinfo; 10.108 - 10.109 - if (dladdr((void*)addr, &dlinfo)){ 10.110 - if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); 10.111 - if (offset) *offset = addr - (address)dlinfo.dli_fbase; 10.112 - return true; 10.113 - } else { 10.114 - if (buf) buf[0] = '\0'; 10.115 - if (offset) *offset = -1; 10.116 - return false; 10.117 - } 10.118 -} 10.119 - 10.120 // Loads .dll/.so and 10.121 // in case of error it checks if .dll/.so was built for the 10.122 // same architecture as Hotspot is running on 10.123 @@ -1520,49 +1533,50 @@ 10.124 } 10.125 10.126 void os::print_dll_info(outputStream *st) { 10.127 - st->print_cr("Dynamic libraries:"); 10.128 + st->print_cr("Dynamic libraries:"); 10.129 #ifdef RTLD_DI_LINKMAP 10.130 - Dl_info dli; 10.131 - void *handle; 10.132 - Link_map *map; 10.133 - Link_map *p; 10.134 - 10.135 - if (!dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli)) { 10.136 - st->print_cr("Error: Cannot print dynamic libraries."); 10.137 - return; 10.138 - } 10.139 - handle = dlopen(dli.dli_fname, RTLD_LAZY); 10.140 - if (handle == NULL) { 10.141 - st->print_cr("Error: Cannot print dynamic libraries."); 10.142 - return; 10.143 - } 10.144 - dlinfo(handle, RTLD_DI_LINKMAP, &map); 10.145 - if (map == NULL) { 10.146 - st->print_cr("Error: Cannot print dynamic libraries."); 10.147 - return; 10.148 - } 10.149 - 10.150 - while (map->l_prev != NULL) 10.151 - map = map->l_prev; 10.152 - 10.153 - while (map != NULL) { 10.154 - st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name); 10.155 - map = map->l_next; 10.156 - } 10.157 - 10.158 - dlclose(handle); 10.159 + Dl_info dli; 10.160 + void *handle; 10.161 + Link_map *map; 10.162 + Link_map *p; 10.163 + 10.164 + if (dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli) == 0 || 10.165 + dli.dli_fname == NULL) { 10.166 + st->print_cr("Error: Cannot print dynamic libraries."); 10.167 + return; 10.168 + } 10.169 + handle = dlopen(dli.dli_fname, RTLD_LAZY); 10.170 + if (handle == NULL) { 10.171 + st->print_cr("Error: Cannot print dynamic libraries."); 10.172 + return; 10.173 + } 10.174 + dlinfo(handle, RTLD_DI_LINKMAP, &map); 10.175 + if (map == NULL) { 10.176 + st->print_cr("Error: Cannot print dynamic libraries."); 10.177 + return; 10.178 + } 10.179 + 10.180 + while (map->l_prev != NULL) 10.181 + map = map->l_prev; 10.182 + 10.183 + while (map != NULL) { 10.184 + st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name); 10.185 + map = map->l_next; 10.186 + } 10.187 + 10.188 + dlclose(handle); 10.189 #elif defined(__APPLE__) 10.190 - uint32_t count; 10.191 - uint32_t i; 10.192 - 10.193 - count = _dyld_image_count(); 10.194 - for (i = 1; i < count; i++) { 10.195 - const char *name = _dyld_get_image_name(i); 10.196 - intptr_t slide = _dyld_get_image_vmaddr_slide(i); 10.197 - st->print_cr(PTR_FORMAT " \t%s", slide, name); 10.198 - } 10.199 + uint32_t count; 10.200 + uint32_t i; 10.201 + 10.202 + count = _dyld_image_count(); 10.203 + for (i = 1; i < count; i++) { 10.204 + const char *name = _dyld_get_image_name(i); 10.205 + intptr_t slide = _dyld_get_image_vmaddr_slide(i); 10.206 + st->print_cr(PTR_FORMAT " \t%s", slide, name); 10.207 + } 10.208 #else 10.209 - st->print_cr("Error: Cannot print dynamic libraries."); 10.210 + st->print_cr("Error: Cannot print dynamic libraries."); 10.211 #endif 10.212 } 10.213 10.214 @@ -1707,8 +1721,11 @@ 10.215 bool ret = dll_address_to_library_name( 10.216 CAST_FROM_FN_PTR(address, os::jvm_path), 10.217 dli_fname, sizeof(dli_fname), NULL); 10.218 - assert(ret != 0, "cannot locate libjvm"); 10.219 - char *rp = realpath(dli_fname, buf); 10.220 + assert(ret, "cannot locate libjvm"); 10.221 + char *rp = NULL; 10.222 + if (ret && dli_fname[0] != '\0') { 10.223 + rp = realpath(dli_fname, buf); 10.224 + } 10.225 if (rp == NULL) 10.226 return; 10.227 10.228 @@ -3747,20 +3764,20 @@ 10.229 bool os::find(address addr, outputStream* st) { 10.230 Dl_info dlinfo; 10.231 memset(&dlinfo, 0, sizeof(dlinfo)); 10.232 - if (dladdr(addr, &dlinfo)) { 10.233 + if (dladdr(addr, &dlinfo) != 0) { 10.234 st->print(PTR_FORMAT ": ", addr); 10.235 - if (dlinfo.dli_sname != NULL) { 10.236 + if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) { 10.237 st->print("%s+%#x", dlinfo.dli_sname, 10.238 addr - (intptr_t)dlinfo.dli_saddr); 10.239 - } else if (dlinfo.dli_fname) { 10.240 + } else if (dlinfo.dli_fbase != NULL) { 10.241 st->print("<offset %#x>", addr - (intptr_t)dlinfo.dli_fbase); 10.242 } else { 10.243 st->print("<absolute address>"); 10.244 } 10.245 - if (dlinfo.dli_fname) { 10.246 + if (dlinfo.dli_fname != NULL) { 10.247 st->print(" in %s", dlinfo.dli_fname); 10.248 } 10.249 - if (dlinfo.dli_fbase) { 10.250 + if (dlinfo.dli_fbase != NULL) { 10.251 st->print(" at " PTR_FORMAT, dlinfo.dli_fbase); 10.252 } 10.253 st->cr(); 10.254 @@ -3773,7 +3790,7 @@ 10.255 if (!lowest) lowest = (address) dlinfo.dli_fbase; 10.256 if (begin < lowest) begin = lowest; 10.257 Dl_info dlinfo2; 10.258 - if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr 10.259 + if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr 10.260 && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) 10.261 end = (address) dlinfo2.dli_saddr; 10.262 Disassembler::decode(begin, end, st);
11.1 --- a/src/os/linux/vm/os_linux.cpp Mon Jul 15 11:07:03 2013 +0100 11.2 +++ b/src/os/linux/vm/os_linux.cpp Mon Jul 22 14:01:39 2013 +0100 11.3 @@ -1682,12 +1682,13 @@ 11.4 Dl_info dlinfo; 11.5 11.6 if (libjvm_base_addr == NULL) { 11.7 - dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo); 11.8 - libjvm_base_addr = (address)dlinfo.dli_fbase; 11.9 + if (dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo) != 0) { 11.10 + libjvm_base_addr = (address)dlinfo.dli_fbase; 11.11 + } 11.12 assert(libjvm_base_addr !=NULL, "Cannot obtain base address for libjvm"); 11.13 } 11.14 11.15 - if (dladdr((void *)addr, &dlinfo)) { 11.16 + if (dladdr((void *)addr, &dlinfo) != 0) { 11.17 if (libjvm_base_addr == (address)dlinfo.dli_fbase) return true; 11.18 } 11.19 11.20 @@ -1696,24 +1697,30 @@ 11.21 11.22 bool os::dll_address_to_function_name(address addr, char *buf, 11.23 int buflen, int *offset) { 11.24 + // buf is not optional, but offset is optional 11.25 + assert(buf != NULL, "sanity check"); 11.26 + 11.27 Dl_info dlinfo; 11.28 11.29 - if (dladdr((void*)addr, &dlinfo) && dlinfo.dli_sname != NULL) { 11.30 - if (buf != NULL) { 11.31 - if(!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { 11.32 + if (dladdr((void*)addr, &dlinfo) != 0) { 11.33 + // see if we have a matching symbol 11.34 + if (dlinfo.dli_saddr != NULL && dlinfo.dli_sname != NULL) { 11.35 + if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { 11.36 jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname); 11.37 } 11.38 + if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; 11.39 + return true; 11.40 } 11.41 - if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; 11.42 - return true; 11.43 - } else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) { 11.44 - if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), 11.45 - buf, buflen, offset, dlinfo.dli_fname)) { 11.46 - return true; 11.47 + // no matching symbol so try for just file info 11.48 + if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) { 11.49 + if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), 11.50 + buf, buflen, offset, dlinfo.dli_fname)) { 11.51 + return true; 11.52 + } 11.53 } 11.54 } 11.55 11.56 - if (buf != NULL) buf[0] = '\0'; 11.57 + buf[0] = '\0'; 11.58 if (offset != NULL) *offset = -1; 11.59 return false; 11.60 } 11.61 @@ -1764,6 +1771,9 @@ 11.62 11.63 bool os::dll_address_to_library_name(address addr, char* buf, 11.64 int buflen, int* offset) { 11.65 + // buf is not optional, but offset is optional 11.66 + assert(buf != NULL, "sanity check"); 11.67 + 11.68 Dl_info dlinfo; 11.69 struct _address_to_library_name data; 11.70 11.71 @@ -1782,15 +1792,20 @@ 11.72 // buf already contains library name 11.73 if (offset) *offset = addr - data.base; 11.74 return true; 11.75 - } else if (dladdr((void*)addr, &dlinfo)){ 11.76 - if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); 11.77 - if (offset) *offset = addr - (address)dlinfo.dli_fbase; 11.78 - return true; 11.79 - } else { 11.80 - if (buf) buf[0] = '\0'; 11.81 - if (offset) *offset = -1; 11.82 - return false; 11.83 - } 11.84 + } 11.85 + if (dladdr((void*)addr, &dlinfo) != 0) { 11.86 + if (dlinfo.dli_fname != NULL) { 11.87 + jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); 11.88 + } 11.89 + if (dlinfo.dli_fbase != NULL && offset != NULL) { 11.90 + *offset = addr - (address)dlinfo.dli_fbase; 11.91 + } 11.92 + return true; 11.93 + } 11.94 + 11.95 + buf[0] = '\0'; 11.96 + if (offset) *offset = -1; 11.97 + return false; 11.98 } 11.99 11.100 // Loads .dll/.so and 11.101 @@ -2317,8 +2332,11 @@ 11.102 bool ret = dll_address_to_library_name( 11.103 CAST_FROM_FN_PTR(address, os::jvm_path), 11.104 dli_fname, sizeof(dli_fname), NULL); 11.105 - assert(ret != 0, "cannot locate libjvm"); 11.106 - char *rp = realpath(dli_fname, buf); 11.107 + assert(ret, "cannot locate libjvm"); 11.108 + char *rp = NULL; 11.109 + if (ret && dli_fname[0] != '\0') { 11.110 + rp = realpath(dli_fname, buf); 11.111 + } 11.112 if (rp == NULL) 11.113 return; 11.114 11.115 @@ -4730,20 +4748,20 @@ 11.116 bool os::find(address addr, outputStream* st) { 11.117 Dl_info dlinfo; 11.118 memset(&dlinfo, 0, sizeof(dlinfo)); 11.119 - if (dladdr(addr, &dlinfo)) { 11.120 + if (dladdr(addr, &dlinfo) != 0) { 11.121 st->print(PTR_FORMAT ": ", addr); 11.122 - if (dlinfo.dli_sname != NULL) { 11.123 + if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) { 11.124 st->print("%s+%#x", dlinfo.dli_sname, 11.125 addr - (intptr_t)dlinfo.dli_saddr); 11.126 - } else if (dlinfo.dli_fname) { 11.127 + } else if (dlinfo.dli_fbase != NULL) { 11.128 st->print("<offset %#x>", addr - (intptr_t)dlinfo.dli_fbase); 11.129 } else { 11.130 st->print("<absolute address>"); 11.131 } 11.132 - if (dlinfo.dli_fname) { 11.133 + if (dlinfo.dli_fname != NULL) { 11.134 st->print(" in %s", dlinfo.dli_fname); 11.135 } 11.136 - if (dlinfo.dli_fbase) { 11.137 + if (dlinfo.dli_fbase != NULL) { 11.138 st->print(" at " PTR_FORMAT, dlinfo.dli_fbase); 11.139 } 11.140 st->cr(); 11.141 @@ -4756,7 +4774,7 @@ 11.142 if (!lowest) lowest = (address) dlinfo.dli_fbase; 11.143 if (begin < lowest) begin = lowest; 11.144 Dl_info dlinfo2; 11.145 - if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr 11.146 + if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr 11.147 && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) 11.148 end = (address) dlinfo2.dli_saddr; 11.149 Disassembler::decode(begin, end, st);
12.1 --- a/src/os/solaris/vm/globals_solaris.hpp Mon Jul 15 11:07:03 2013 +0100 12.2 +++ b/src/os/solaris/vm/globals_solaris.hpp Mon Jul 22 14:01:39 2013 +0100 12.3 @@ -30,15 +30,6 @@ 12.4 // 12.5 #define RUNTIME_OS_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct) \ 12.6 \ 12.7 - product(bool, UseISM, false, \ 12.8 - "Use Intimate Shared Memory (Solaris Only)") \ 12.9 - \ 12.10 - product(bool, UsePermISM, false, \ 12.11 - "Obsolete flag for compatibility (same as UseISM)") \ 12.12 - \ 12.13 - product(bool, UseMPSS, true, \ 12.14 - "Use Multiple Page Size Support (Solaris 9 Only)") \ 12.15 - \ 12.16 product(bool, UseExtendedFileIO, true, \ 12.17 "Enable workaround for limitations of stdio FILE structure") 12.18
13.1 --- a/src/os/solaris/vm/os_solaris.cpp Mon Jul 15 11:07:03 2013 +0100 13.2 +++ b/src/os/solaris/vm/os_solaris.cpp Mon Jul 22 14:01:39 2013 +0100 13.3 @@ -115,45 +115,6 @@ 13.4 // for timer info max values which include all bits 13.5 #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF) 13.6 13.7 -#ifdef _GNU_SOURCE 13.8 -// See bug #6514594 13.9 -extern "C" int madvise(caddr_t, size_t, int); 13.10 -extern "C" int memcntl(caddr_t addr, size_t len, int cmd, caddr_t arg, 13.11 - int attr, int mask); 13.12 -#endif //_GNU_SOURCE 13.13 - 13.14 -/* 13.15 - MPSS Changes Start. 13.16 - The JVM binary needs to be built and run on pre-Solaris 9 13.17 - systems, but the constants needed by MPSS are only in Solaris 9 13.18 - header files. They are textually replicated here to allow 13.19 - building on earlier systems. Once building on Solaris 8 is 13.20 - no longer a requirement, these #defines can be replaced by ordinary 13.21 - system .h inclusion. 13.22 - 13.23 - In earlier versions of the JDK and Solaris, we used ISM for large pages. 13.24 - But ISM requires shared memory to achieve this and thus has many caveats. 13.25 - MPSS is a fully transparent and is a cleaner way to get large pages. 13.26 - Although we still require keeping ISM for backward compatiblitiy as well as 13.27 - giving the opportunity to use large pages on older systems it is 13.28 - recommended that MPSS be used for Solaris 9 and above. 13.29 - 13.30 -*/ 13.31 - 13.32 -#ifndef MC_HAT_ADVISE 13.33 - 13.34 -struct memcntl_mha { 13.35 - uint_t mha_cmd; /* command(s) */ 13.36 - uint_t mha_flags; 13.37 - size_t mha_pagesize; 13.38 -}; 13.39 -#define MC_HAT_ADVISE 7 /* advise hat map size */ 13.40 -#define MHA_MAPSIZE_VA 0x1 /* set preferred page size */ 13.41 -#define MAP_ALIGN 0x200 /* addr specifies alignment */ 13.42 - 13.43 -#endif 13.44 -// MPSS Changes End. 13.45 - 13.46 13.47 // Here are some liblgrp types from sys/lgrp_user.h to be able to 13.48 // compile on older systems without this header file. 13.49 @@ -172,32 +133,6 @@ 13.50 # define LGRP_RSRC_MEM 1 /* memory resources */ 13.51 #endif 13.52 13.53 -// Some more macros from sys/mman.h that are not present in Solaris 8. 13.54 - 13.55 -#ifndef MAX_MEMINFO_CNT 13.56 -/* 13.57 - * info_req request type definitions for meminfo 13.58 - * request types starting with MEMINFO_V are used for Virtual addresses 13.59 - * and should not be mixed with MEMINFO_PLGRP which is targeted for Physical 13.60 - * addresses 13.61 - */ 13.62 -# define MEMINFO_SHIFT 16 13.63 -# define MEMINFO_MASK (0xFF << MEMINFO_SHIFT) 13.64 -# define MEMINFO_VPHYSICAL (0x01 << MEMINFO_SHIFT) /* get physical addr */ 13.65 -# define MEMINFO_VLGRP (0x02 << MEMINFO_SHIFT) /* get lgroup */ 13.66 -# define MEMINFO_VPAGESIZE (0x03 << MEMINFO_SHIFT) /* size of phys page */ 13.67 -# define MEMINFO_VREPLCNT (0x04 << MEMINFO_SHIFT) /* no. of replica */ 13.68 -# define MEMINFO_VREPL (0x05 << MEMINFO_SHIFT) /* physical replica */ 13.69 -# define MEMINFO_VREPL_LGRP (0x06 << MEMINFO_SHIFT) /* lgrp of replica */ 13.70 -# define MEMINFO_PLGRP (0x07 << MEMINFO_SHIFT) /* lgroup for paddr */ 13.71 - 13.72 -/* maximum number of addresses meminfo() can process at a time */ 13.73 -# define MAX_MEMINFO_CNT 256 13.74 - 13.75 -/* maximum number of request types */ 13.76 -# define MAX_MEMINFO_REQ 31 13.77 -#endif 13.78 - 13.79 // see thr_setprio(3T) for the basis of these numbers 13.80 #define MinimumPriority 0 13.81 #define NormalPriority 64 13.82 @@ -1924,12 +1859,13 @@ 13.83 Dl_info dlinfo; 13.84 13.85 if (libjvm_base_addr == NULL) { 13.86 - dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo); 13.87 - libjvm_base_addr = (address)dlinfo.dli_fbase; 13.88 + if (dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo) != 0) { 13.89 + libjvm_base_addr = (address)dlinfo.dli_fbase; 13.90 + } 13.91 assert(libjvm_base_addr !=NULL, "Cannot obtain base address for libjvm"); 13.92 } 13.93 13.94 - if (dladdr((void *)addr, &dlinfo)) { 13.95 + if (dladdr((void *)addr, &dlinfo) != 0) { 13.96 if (libjvm_base_addr == (address)dlinfo.dli_fbase) return true; 13.97 } 13.98 13.99 @@ -1941,114 +1877,133 @@ 13.100 13.101 bool os::dll_address_to_function_name(address addr, char *buf, 13.102 int buflen, int * offset) { 13.103 + // buf is not optional, but offset is optional 13.104 + assert(buf != NULL, "sanity check"); 13.105 + 13.106 Dl_info dlinfo; 13.107 13.108 // dladdr1_func was initialized in os::init() 13.109 - if (dladdr1_func){ 13.110 - // yes, we have dladdr1 13.111 - 13.112 - // Support for dladdr1 is checked at runtime; it may be 13.113 - // available even if the vm is built on a machine that does 13.114 - // not have dladdr1 support. Make sure there is a value for 13.115 - // RTLD_DL_SYMENT. 13.116 - #ifndef RTLD_DL_SYMENT 13.117 - #define RTLD_DL_SYMENT 1 13.118 - #endif 13.119 + if (dladdr1_func != NULL) { 13.120 + // yes, we have dladdr1 13.121 + 13.122 + // Support for dladdr1 is checked at runtime; it may be 13.123 + // available even if the vm is built on a machine that does 13.124 + // not have dladdr1 support. Make sure there is a value for 13.125 + // RTLD_DL_SYMENT. 13.126 + #ifndef RTLD_DL_SYMENT 13.127 + #define RTLD_DL_SYMENT 1 13.128 + #endif 13.129 #ifdef _LP64 13.130 - Elf64_Sym * info; 13.131 + Elf64_Sym * info; 13.132 #else 13.133 - Elf32_Sym * info; 13.134 + Elf32_Sym * info; 13.135 #endif 13.136 - if (dladdr1_func((void *)addr, &dlinfo, (void **)&info, 13.137 - RTLD_DL_SYMENT)) { 13.138 - if ((char *)dlinfo.dli_saddr + info->st_size > (char *)addr) { 13.139 - if (buf != NULL) { 13.140 - if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) 13.141 - jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname); 13.142 - } 13.143 - if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; 13.144 - return true; 13.145 - } 13.146 - } 13.147 - if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) { 13.148 - if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), 13.149 - buf, buflen, offset, dlinfo.dli_fname)) { 13.150 + if (dladdr1_func((void *)addr, &dlinfo, (void **)&info, 13.151 + RTLD_DL_SYMENT) != 0) { 13.152 + // see if we have a matching symbol that covers our address 13.153 + if (dlinfo.dli_saddr != NULL && 13.154 + (char *)dlinfo.dli_saddr + info->st_size > (char *)addr) { 13.155 + if (dlinfo.dli_sname != NULL) { 13.156 + if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { 13.157 + jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname); 13.158 + } 13.159 + if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; 13.160 return true; 13.161 } 13.162 } 13.163 - if (buf != NULL) buf[0] = '\0'; 13.164 - if (offset != NULL) *offset = -1; 13.165 - return false; 13.166 - } else { 13.167 - // no, only dladdr is available 13.168 - if (dladdr((void *)addr, &dlinfo)) { 13.169 - if (buf != NULL) { 13.170 - if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) 13.171 - jio_snprintf(buf, buflen, dlinfo.dli_sname); 13.172 - } 13.173 - if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; 13.174 - return true; 13.175 - } else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) { 13.176 + // no matching symbol so try for just file info 13.177 + if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) { 13.178 if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), 13.179 - buf, buflen, offset, dlinfo.dli_fname)) { 13.180 + buf, buflen, offset, dlinfo.dli_fname)) { 13.181 return true; 13.182 } 13.183 } 13.184 - if (buf != NULL) buf[0] = '\0'; 13.185 - if (offset != NULL) *offset = -1; 13.186 - return false; 13.187 - } 13.188 + } 13.189 + buf[0] = '\0'; 13.190 + if (offset != NULL) *offset = -1; 13.191 + return false; 13.192 + } 13.193 + 13.194 + // no, only dladdr is available 13.195 + if (dladdr((void *)addr, &dlinfo) != 0) { 13.196 + // see if we have a matching symbol 13.197 + if (dlinfo.dli_saddr != NULL && dlinfo.dli_sname != NULL) { 13.198 + if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { 13.199 + jio_snprintf(buf, buflen, dlinfo.dli_sname); 13.200 + } 13.201 + if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; 13.202 + return true; 13.203 + } 13.204 + // no matching symbol so try for just file info 13.205 + if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) { 13.206 + if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), 13.207 + buf, buflen, offset, dlinfo.dli_fname)) { 13.208 + return true; 13.209 + } 13.210 + } 13.211 + } 13.212 + buf[0] = '\0'; 13.213 + if (offset != NULL) *offset = -1; 13.214 + return false; 13.215 } 13.216 13.217 bool os::dll_address_to_library_name(address addr, char* buf, 13.218 int buflen, int* offset) { 13.219 + // buf is not optional, but offset is optional 13.220 + assert(buf != NULL, "sanity check"); 13.221 + 13.222 Dl_info dlinfo; 13.223 13.224 - if (dladdr((void*)addr, &dlinfo)){ 13.225 - if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); 13.226 - if (offset) *offset = addr - (address)dlinfo.dli_fbase; 13.227 - return true; 13.228 - } else { 13.229 - if (buf) buf[0] = '\0'; 13.230 - if (offset) *offset = -1; 13.231 - return false; 13.232 - } 13.233 + if (dladdr((void*)addr, &dlinfo) != 0) { 13.234 + if (dlinfo.dli_fname != NULL) { 13.235 + jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); 13.236 + } 13.237 + if (dlinfo.dli_fbase != NULL && offset != NULL) { 13.238 + *offset = addr - (address)dlinfo.dli_fbase; 13.239 + } 13.240 + return true; 13.241 + } 13.242 + 13.243 + buf[0] = '\0'; 13.244 + if (offset) *offset = -1; 13.245 + return false; 13.246 } 13.247 13.248 // Prints the names and full paths of all opened dynamic libraries 13.249 // for current process 13.250 void os::print_dll_info(outputStream * st) { 13.251 - Dl_info dli; 13.252 - void *handle; 13.253 - Link_map *map; 13.254 - Link_map *p; 13.255 - 13.256 - st->print_cr("Dynamic libraries:"); st->flush(); 13.257 - 13.258 - if (!dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli)) { 13.259 - st->print_cr("Error: Cannot print dynamic libraries."); 13.260 - return; 13.261 - } 13.262 - handle = dlopen(dli.dli_fname, RTLD_LAZY); 13.263 - if (handle == NULL) { 13.264 - st->print_cr("Error: Cannot print dynamic libraries."); 13.265 - return; 13.266 - } 13.267 - dlinfo(handle, RTLD_DI_LINKMAP, &map); 13.268 - if (map == NULL) { 13.269 - st->print_cr("Error: Cannot print dynamic libraries."); 13.270 - return; 13.271 - } 13.272 - 13.273 - while (map->l_prev != NULL) 13.274 - map = map->l_prev; 13.275 - 13.276 - while (map != NULL) { 13.277 - st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name); 13.278 - map = map->l_next; 13.279 - } 13.280 - 13.281 - dlclose(handle); 13.282 + Dl_info dli; 13.283 + void *handle; 13.284 + Link_map *map; 13.285 + Link_map *p; 13.286 + 13.287 + st->print_cr("Dynamic libraries:"); st->flush(); 13.288 + 13.289 + if (dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli) == 0 || 13.290 + dli.dli_fname == NULL) { 13.291 + st->print_cr("Error: Cannot print dynamic libraries."); 13.292 + return; 13.293 + } 13.294 + handle = dlopen(dli.dli_fname, RTLD_LAZY); 13.295 + if (handle == NULL) { 13.296 + st->print_cr("Error: Cannot print dynamic libraries."); 13.297 + return; 13.298 + } 13.299 + dlinfo(handle, RTLD_DI_LINKMAP, &map); 13.300 + if (map == NULL) { 13.301 + st->print_cr("Error: Cannot print dynamic libraries."); 13.302 + return; 13.303 + } 13.304 + 13.305 + while (map->l_prev != NULL) 13.306 + map = map->l_prev; 13.307 + 13.308 + while (map != NULL) { 13.309 + st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name); 13.310 + map = map->l_next; 13.311 + } 13.312 + 13.313 + dlclose(handle); 13.314 } 13.315 13.316 // Loads .dll/.so and 13.317 @@ -2475,7 +2430,12 @@ 13.318 Dl_info dlinfo; 13.319 int ret = dladdr(CAST_FROM_FN_PTR(void *, os::jvm_path), &dlinfo); 13.320 assert(ret != 0, "cannot locate libjvm"); 13.321 - realpath((char *)dlinfo.dli_fname, buf); 13.322 + if (ret != 0 && dlinfo.dli_fname != NULL) { 13.323 + realpath((char *)dlinfo.dli_fname, buf); 13.324 + } else { 13.325 + buf[0] = '\0'; 13.326 + return; 13.327 + } 13.328 13.329 if (Arguments::created_by_gamma_launcher()) { 13.330 // Support for the gamma launcher. Typical value for buf is 13.331 @@ -2859,7 +2819,7 @@ 13.332 size_t alignment_hint, bool exec) { 13.333 int err = Solaris::commit_memory_impl(addr, bytes, exec); 13.334 if (err == 0) { 13.335 - if (UseMPSS && alignment_hint > (size_t)vm_page_size()) { 13.336 + if (UseLargePages && (alignment_hint > (size_t)vm_page_size())) { 13.337 // If the large page size has been set and the VM 13.338 // is using large pages, use the large page size 13.339 // if it is smaller than the alignment hint. This is 13.340 @@ -2878,7 +2838,7 @@ 13.341 page_size = alignment_hint; 13.342 } 13.343 // Since this is a hint, ignore any failures. 13.344 - (void)Solaris::set_mpss_range(addr, bytes, page_size); 13.345 + (void)Solaris::setup_large_pages(addr, bytes, page_size); 13.346 } 13.347 } 13.348 return err; 13.349 @@ -2921,8 +2881,8 @@ 13.350 void os::pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint) { 13.351 assert((intptr_t)addr % alignment_hint == 0, "Address should be aligned."); 13.352 assert((intptr_t)(addr + bytes) % alignment_hint == 0, "End should be aligned."); 13.353 - if (UseLargePages && UseMPSS) { 13.354 - Solaris::set_mpss_range(addr, bytes, alignment_hint); 13.355 + if (UseLargePages) { 13.356 + Solaris::setup_large_pages(addr, bytes, alignment_hint); 13.357 } 13.358 } 13.359 13.360 @@ -3321,47 +3281,8 @@ 13.361 } 13.362 13.363 // Large page support 13.364 - 13.365 -// UseLargePages is the master flag to enable/disable large page memory. 13.366 -// UseMPSS and UseISM are supported for compatibility reasons. Their combined 13.367 -// effects can be described in the following table: 13.368 -// 13.369 -// UseLargePages UseMPSS UseISM 13.370 -// false * * => UseLargePages is the master switch, turning 13.371 -// it off will turn off both UseMPSS and 13.372 -// UseISM. VM will not use large page memory 13.373 -// regardless the settings of UseMPSS/UseISM. 13.374 -// true false false => Unless future Solaris provides other 13.375 -// mechanism to use large page memory, this 13.376 -// combination is equivalent to -UseLargePages, 13.377 -// VM will not use large page memory 13.378 -// true true false => JVM will use MPSS for large page memory. 13.379 -// This is the default behavior. 13.380 -// true false true => JVM will use ISM for large page memory. 13.381 -// true true true => JVM will use ISM if it is available. 13.382 -// Otherwise, JVM will fall back to MPSS. 13.383 -// Becaues ISM is now available on all 13.384 -// supported Solaris versions, this combination 13.385 -// is equivalent to +UseISM -UseMPSS. 13.386 - 13.387 static size_t _large_page_size = 0; 13.388 13.389 -bool os::Solaris::ism_sanity_check(bool warn, size_t * page_size) { 13.390 - // x86 uses either 2M or 4M page, depending on whether PAE (Physical Address 13.391 - // Extensions) mode is enabled. AMD64/EM64T uses 2M page in 64bit mode. Sparc 13.392 - // can support multiple page sizes. 13.393 - 13.394 - // Don't bother to probe page size because getpagesizes() comes with MPSS. 13.395 - // ISM is only recommended on old Solaris where there is no MPSS support. 13.396 - // Simply choose a conservative value as default. 13.397 - *page_size = LargePageSizeInBytes ? LargePageSizeInBytes : 13.398 - SPARC_ONLY(4 * M) IA32_ONLY(4 * M) AMD64_ONLY(2 * M) 13.399 - ARM_ONLY(2 * M); 13.400 - 13.401 - // ISM is available on all supported Solaris versions 13.402 - return true; 13.403 -} 13.404 - 13.405 // Insertion sort for small arrays (descending order). 13.406 static void insertion_sort_descending(size_t* array, int len) { 13.407 for (int i = 0; i < len; i++) { 13.408 @@ -3374,7 +3295,7 @@ 13.409 } 13.410 } 13.411 13.412 -bool os::Solaris::mpss_sanity_check(bool warn, size_t * page_size) { 13.413 +bool os::Solaris::mpss_sanity_check(bool warn, size_t* page_size) { 13.414 const unsigned int usable_count = VM_Version::page_size_count(); 13.415 if (usable_count == 1) { 13.416 return false; 13.417 @@ -3440,41 +3361,24 @@ 13.418 } 13.419 13.420 void os::large_page_init() { 13.421 - if (!UseLargePages) { 13.422 - UseISM = false; 13.423 - UseMPSS = false; 13.424 - return; 13.425 - } 13.426 - 13.427 - // print a warning if any large page related flag is specified on command line 13.428 - bool warn_on_failure = !FLAG_IS_DEFAULT(UseLargePages) || 13.429 - !FLAG_IS_DEFAULT(UseISM) || 13.430 - !FLAG_IS_DEFAULT(UseMPSS) || 13.431 - !FLAG_IS_DEFAULT(LargePageSizeInBytes); 13.432 - UseISM = UseISM && 13.433 - Solaris::ism_sanity_check(warn_on_failure, &_large_page_size); 13.434 - if (UseISM) { 13.435 - // ISM disables MPSS to be compatible with old JDK behavior 13.436 - UseMPSS = false; 13.437 - _page_sizes[0] = _large_page_size; 13.438 - _page_sizes[1] = vm_page_size(); 13.439 - } 13.440 - 13.441 - UseMPSS = UseMPSS && 13.442 - Solaris::mpss_sanity_check(warn_on_failure, &_large_page_size); 13.443 - 13.444 - UseLargePages = UseISM || UseMPSS; 13.445 -} 13.446 - 13.447 -bool os::Solaris::set_mpss_range(caddr_t start, size_t bytes, size_t align) { 13.448 + if (UseLargePages) { 13.449 + // print a warning if any large page related flag is specified on command line 13.450 + bool warn_on_failure = !FLAG_IS_DEFAULT(UseLargePages) || 13.451 + !FLAG_IS_DEFAULT(LargePageSizeInBytes); 13.452 + 13.453 + UseLargePages = Solaris::mpss_sanity_check(warn_on_failure, &_large_page_size); 13.454 + } 13.455 +} 13.456 + 13.457 +bool os::Solaris::setup_large_pages(caddr_t start, size_t bytes, size_t align) { 13.458 // Signal to OS that we want large pages for addresses 13.459 // from addr, addr + bytes 13.460 struct memcntl_mha mpss_struct; 13.461 mpss_struct.mha_cmd = MHA_MAPSIZE_VA; 13.462 mpss_struct.mha_pagesize = align; 13.463 mpss_struct.mha_flags = 0; 13.464 - if (memcntl(start, bytes, MC_HAT_ADVISE, 13.465 - (caddr_t) &mpss_struct, 0, 0) < 0) { 13.466 + // Upon successful completion, memcntl() returns 0 13.467 + if (memcntl(start, bytes, MC_HAT_ADVISE, (caddr_t) &mpss_struct, 0, 0)) { 13.468 debug_only(warning("Attempt to use MPSS failed.")); 13.469 return false; 13.470 } 13.471 @@ -3482,72 +3386,13 @@ 13.472 } 13.473 13.474 char* os::reserve_memory_special(size_t size, char* addr, bool exec) { 13.475 - // "exec" is passed in but not used. Creating the shared image for 13.476 - // the code cache doesn't have an SHM_X executable permission to check. 13.477 - assert(UseLargePages && UseISM, "only for ISM large pages"); 13.478 - 13.479 - char* retAddr = NULL; 13.480 - int shmid; 13.481 - key_t ismKey; 13.482 - 13.483 - bool warn_on_failure = UseISM && 13.484 - (!FLAG_IS_DEFAULT(UseLargePages) || 13.485 - !FLAG_IS_DEFAULT(UseISM) || 13.486 - !FLAG_IS_DEFAULT(LargePageSizeInBytes) 13.487 - ); 13.488 - char msg[128]; 13.489 - 13.490 - ismKey = IPC_PRIVATE; 13.491 - 13.492 - // Create a large shared memory region to attach to based on size. 13.493 - // Currently, size is the total size of the heap 13.494 - shmid = shmget(ismKey, size, SHM_R | SHM_W | IPC_CREAT); 13.495 - if (shmid == -1){ 13.496 - if (warn_on_failure) { 13.497 - jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno); 13.498 - warning(msg); 13.499 - } 13.500 - return NULL; 13.501 - } 13.502 - 13.503 - // Attach to the region 13.504 - retAddr = (char *) shmat(shmid, 0, SHM_SHARE_MMU | SHM_R | SHM_W); 13.505 - int err = errno; 13.506 - 13.507 - // Remove shmid. If shmat() is successful, the actual shared memory segment 13.508 - // will be deleted when it's detached by shmdt() or when the process 13.509 - // terminates. If shmat() is not successful this will remove the shared 13.510 - // segment immediately. 13.511 - shmctl(shmid, IPC_RMID, NULL); 13.512 - 13.513 - if (retAddr == (char *) -1) { 13.514 - if (warn_on_failure) { 13.515 - jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err); 13.516 - warning(msg); 13.517 - } 13.518 - return NULL; 13.519 - } 13.520 - if ((retAddr != NULL) && UseNUMAInterleaving) { 13.521 - numa_make_global(retAddr, size); 13.522 - } 13.523 - 13.524 - // The memory is committed 13.525 - MemTracker::record_virtual_memory_reserve_and_commit((address)retAddr, size, mtNone, CURRENT_PC); 13.526 - 13.527 - return retAddr; 13.528 + fatal("os::reserve_memory_special should not be called on Solaris."); 13.529 + return NULL; 13.530 } 13.531 13.532 bool os::release_memory_special(char* base, size_t bytes) { 13.533 - MemTracker::Tracker tkr = MemTracker::get_virtual_memory_release_tracker(); 13.534 - // detaching the SHM segment will also delete it, see reserve_memory_special() 13.535 - int rslt = shmdt(base); 13.536 - if (rslt == 0) { 13.537 - tkr.record((address)base, bytes); 13.538 - return true; 13.539 - } else { 13.540 - tkr.discard(); 13.541 - return false; 13.542 - } 13.543 + fatal("os::release_memory_special should not be called on Solaris."); 13.544 + return false; 13.545 } 13.546 13.547 size_t os::large_page_size() { 13.548 @@ -3557,11 +3402,11 @@ 13.549 // MPSS allows application to commit large page memory on demand; with ISM 13.550 // the entire memory region must be allocated as shared memory. 13.551 bool os::can_commit_large_page_memory() { 13.552 - return UseISM ? false : true; 13.553 + return true; 13.554 } 13.555 13.556 bool os::can_execute_large_page_memory() { 13.557 - return UseISM ? false : true; 13.558 + return true; 13.559 } 13.560 13.561 static int os_sleep(jlong millis, bool interruptible) { 13.562 @@ -3835,28 +3680,6 @@ 13.563 static const int criticalPrio = 60; // FX/60 is critical thread class/priority on T4 13.564 static int java_MaxPriority_to_os_priority = 0; // Saved mapping 13.565 13.566 -// Call the version of priocntl suitable for all supported versions 13.567 -// of Solaris. We need to call through this wrapper so that we can 13.568 -// build on Solaris 9 and run on Solaris 8, 9 and 10. 13.569 -// 13.570 -// This code should be removed if we ever stop supporting Solaris 8 13.571 -// and earlier releases. 13.572 - 13.573 -static long priocntl_stub(int pcver, idtype_t idtype, id_t id, int cmd, caddr_t arg); 13.574 -typedef long (*priocntl_type)(int pcver, idtype_t idtype, id_t id, int cmd, caddr_t arg); 13.575 -static priocntl_type priocntl_ptr = priocntl_stub; 13.576 - 13.577 -// Stub to set the value of the real pointer, and then call the real 13.578 -// function. 13.579 - 13.580 -static long priocntl_stub(int pcver, idtype_t idtype, id_t id, int cmd, caddr_t arg) { 13.581 - // Try Solaris 8- name only. 13.582 - priocntl_type tmp = (priocntl_type)dlsym(RTLD_DEFAULT, "__priocntl"); 13.583 - guarantee(tmp != NULL, "priocntl function not found."); 13.584 - priocntl_ptr = tmp; 13.585 - return (*priocntl_ptr)(PC_VERSION, idtype, id, cmd, arg); 13.586 -} 13.587 - 13.588 13.589 // lwp_priocntl_init 13.590 // 13.591 @@ -3864,9 +3687,7 @@ 13.592 // 13.593 // Return errno or 0 if OK. 13.594 // 13.595 -static 13.596 -int lwp_priocntl_init () 13.597 -{ 13.598 +static int lwp_priocntl_init () { 13.599 int rslt; 13.600 pcinfo_t ClassInfo; 13.601 pcparms_t ParmInfo; 13.602 @@ -3906,7 +3727,7 @@ 13.603 13.604 strcpy(ClassInfo.pc_clname, "TS"); 13.605 ClassInfo.pc_cid = -1; 13.606 - rslt = (*priocntl_ptr)(PC_VERSION, P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo); 13.607 + rslt = priocntl(P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo); 13.608 if (rslt < 0) return errno; 13.609 assert(ClassInfo.pc_cid != -1, "cid for TS class is -1"); 13.610 tsLimits.schedPolicy = ClassInfo.pc_cid; 13.611 @@ -3915,7 +3736,7 @@ 13.612 13.613 strcpy(ClassInfo.pc_clname, "IA"); 13.614 ClassInfo.pc_cid = -1; 13.615 - rslt = (*priocntl_ptr)(PC_VERSION, P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo); 13.616 + rslt = priocntl(P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo); 13.617 if (rslt < 0) return errno; 13.618 assert(ClassInfo.pc_cid != -1, "cid for IA class is -1"); 13.619 iaLimits.schedPolicy = ClassInfo.pc_cid; 13.620 @@ -3924,7 +3745,7 @@ 13.621 13.622 strcpy(ClassInfo.pc_clname, "RT"); 13.623 ClassInfo.pc_cid = -1; 13.624 - rslt = (*priocntl_ptr)(PC_VERSION, P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo); 13.625 + rslt = priocntl(P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo); 13.626 if (rslt < 0) return errno; 13.627 assert(ClassInfo.pc_cid != -1, "cid for RT class is -1"); 13.628 rtLimits.schedPolicy = ClassInfo.pc_cid; 13.629 @@ -3933,7 +3754,7 @@ 13.630 13.631 strcpy(ClassInfo.pc_clname, "FX"); 13.632 ClassInfo.pc_cid = -1; 13.633 - rslt = (*priocntl_ptr)(PC_VERSION, P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo); 13.634 + rslt = priocntl(P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo); 13.635 if (rslt < 0) return errno; 13.636 assert(ClassInfo.pc_cid != -1, "cid for FX class is -1"); 13.637 fxLimits.schedPolicy = ClassInfo.pc_cid; 13.638 @@ -3944,7 +3765,7 @@ 13.639 // This will normally be IA, TS or, rarely, FX or RT. 13.640 memset(&ParmInfo, 0, sizeof(ParmInfo)); 13.641 ParmInfo.pc_cid = PC_CLNULL; 13.642 - rslt = (*priocntl_ptr) (PC_VERSION, P_PID, P_MYID, PC_GETPARMS, (caddr_t)&ParmInfo); 13.643 + rslt = priocntl(P_PID, P_MYID, PC_GETPARMS, (caddr_t)&ParmInfo); 13.644 if (rslt < 0) return errno; 13.645 myClass = ParmInfo.pc_cid; 13.646 13.647 @@ -3952,7 +3773,7 @@ 13.648 // about the class. 13.649 ClassInfo.pc_cid = myClass; 13.650 ClassInfo.pc_clname[0] = 0; 13.651 - rslt = (*priocntl_ptr) (PC_VERSION, (idtype)0, 0, PC_GETCLINFO, (caddr_t)&ClassInfo); 13.652 + rslt = priocntl((idtype)0, 0, PC_GETCLINFO, (caddr_t)&ClassInfo); 13.653 if (rslt < 0) return errno; 13.654 13.655 if (ThreadPriorityVerbose) { 13.656 @@ -3961,7 +3782,7 @@ 13.657 13.658 memset(&ParmInfo, 0, sizeof(pcparms_t)); 13.659 ParmInfo.pc_cid = PC_CLNULL; 13.660 - rslt = (*priocntl_ptr)(PC_VERSION, P_PID, P_MYID, PC_GETPARMS, (caddr_t)&ParmInfo); 13.661 + rslt = priocntl(P_PID, P_MYID, PC_GETPARMS, (caddr_t)&ParmInfo); 13.662 if (rslt < 0) return errno; 13.663 13.664 if (ParmInfo.pc_cid == rtLimits.schedPolicy) { 13.665 @@ -4065,7 +3886,7 @@ 13.666 13.667 memset(&ParmInfo, 0, sizeof(pcparms_t)); 13.668 ParmInfo.pc_cid = PC_CLNULL; 13.669 - rslt = (*priocntl_ptr)(PC_VERSION, P_LWPID, lwpid, PC_GETPARMS, (caddr_t)&ParmInfo); 13.670 + rslt = priocntl(P_LWPID, lwpid, PC_GETPARMS, (caddr_t)&ParmInfo); 13.671 if (rslt < 0) return errno; 13.672 13.673 int cur_class = ParmInfo.pc_cid; 13.674 @@ -4133,7 +3954,7 @@ 13.675 return EINVAL; // no clue, punt 13.676 } 13.677 13.678 - rslt = (*priocntl_ptr)(PC_VERSION, P_LWPID, lwpid, PC_SETPARMS, (caddr_t)&ParmInfo); 13.679 + rslt = priocntl(P_LWPID, lwpid, PC_SETPARMS, (caddr_t)&ParmInfo); 13.680 if (ThreadPriorityVerbose && rslt) { 13.681 tty->print_cr ("PC_SETPARMS ->%d %d\n", rslt, errno); 13.682 } 13.683 @@ -4152,7 +3973,7 @@ 13.684 13.685 memset(&ReadBack, 0, sizeof(pcparms_t)); 13.686 ReadBack.pc_cid = PC_CLNULL; 13.687 - rslt = (*priocntl_ptr)(PC_VERSION, P_LWPID, lwpid, PC_GETPARMS, (caddr_t)&ReadBack); 13.688 + rslt = priocntl(P_LWPID, lwpid, PC_GETPARMS, (caddr_t)&ReadBack); 13.689 assert(rslt >= 0, "priocntl failed"); 13.690 Actual = Expected = 0xBAD; 13.691 assert(ParmInfo.pc_cid == ReadBack.pc_cid, "cid's don't match"); 13.692 @@ -5244,11 +5065,6 @@ 13.693 return _getisax(array, n); 13.694 } 13.695 13.696 -// Symbol doesn't exist in Solaris 8 pset.h 13.697 -#ifndef PS_MYID 13.698 -#define PS_MYID -3 13.699 -#endif 13.700 - 13.701 // int pset_getloadavg(psetid_t pset, double loadavg[], int nelem); 13.702 typedef long (*pset_getloadavg_type)(psetid_t pset, double loadavg[], int nelem); 13.703 static pset_getloadavg_type pset_getloadavg_ptr = NULL; 13.704 @@ -5418,20 +5234,6 @@ 13.705 UseNUMA = false; 13.706 } 13.707 } 13.708 - // ISM is not compatible with the NUMA allocator - it always allocates 13.709 - // pages round-robin across the lgroups. 13.710 - if (UseNUMA && UseLargePages && UseISM) { 13.711 - if (!FLAG_IS_DEFAULT(UseNUMA)) { 13.712 - if (FLAG_IS_DEFAULT(UseLargePages) && FLAG_IS_DEFAULT(UseISM)) { 13.713 - UseLargePages = false; 13.714 - } else { 13.715 - warning("UseNUMA is not compatible with ISM large pages, disabling NUMA allocator"); 13.716 - UseNUMA = false; 13.717 - } 13.718 - } else { 13.719 - UseNUMA = false; 13.720 - } 13.721 - } 13.722 if (!UseNUMA && ForceNUMA) { 13.723 UseNUMA = true; 13.724 } 13.725 @@ -6077,24 +5879,20 @@ 13.726 bool os::find(address addr, outputStream* st) { 13.727 Dl_info dlinfo; 13.728 memset(&dlinfo, 0, sizeof(dlinfo)); 13.729 - if (dladdr(addr, &dlinfo)) { 13.730 -#ifdef _LP64 13.731 - st->print("0x%016lx: ", addr); 13.732 -#else 13.733 - st->print("0x%08x: ", addr); 13.734 -#endif 13.735 - if (dlinfo.dli_sname != NULL) 13.736 + if (dladdr(addr, &dlinfo) != 0) { 13.737 + st->print(PTR_FORMAT ": ", addr); 13.738 + if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) { 13.739 st->print("%s+%#lx", dlinfo.dli_sname, addr-(intptr_t)dlinfo.dli_saddr); 13.740 - else if (dlinfo.dli_fname) 13.741 + } else if (dlinfo.dli_fbase != NULL) 13.742 st->print("<offset %#lx>", addr-(intptr_t)dlinfo.dli_fbase); 13.743 else 13.744 st->print("<absolute address>"); 13.745 - if (dlinfo.dli_fname) st->print(" in %s", dlinfo.dli_fname); 13.746 -#ifdef _LP64 13.747 - if (dlinfo.dli_fbase) st->print(" at 0x%016lx", dlinfo.dli_fbase); 13.748 -#else 13.749 - if (dlinfo.dli_fbase) st->print(" at 0x%08x", dlinfo.dli_fbase); 13.750 -#endif 13.751 + if (dlinfo.dli_fname != NULL) { 13.752 + st->print(" in %s", dlinfo.dli_fname); 13.753 + } 13.754 + if (dlinfo.dli_fbase != NULL) { 13.755 + st->print(" at " PTR_FORMAT, dlinfo.dli_fbase); 13.756 + } 13.757 st->cr(); 13.758 13.759 if (Verbose) { 13.760 @@ -6105,7 +5903,7 @@ 13.761 if (!lowest) lowest = (address) dlinfo.dli_fbase; 13.762 if (begin < lowest) begin = lowest; 13.763 Dl_info dlinfo2; 13.764 - if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr 13.765 + if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr 13.766 && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) 13.767 end = (address) dlinfo2.dli_saddr; 13.768 Disassembler::decode(begin, end, st);
14.1 --- a/src/os/solaris/vm/os_solaris.hpp Mon Jul 15 11:07:03 2013 +0100 14.2 +++ b/src/os/solaris/vm/os_solaris.hpp Mon Jul 22 14:01:39 2013 +0100 14.3 @@ -106,8 +106,8 @@ 14.4 14.5 static meminfo_func_t _meminfo; 14.6 14.7 - // Large Page Support--mpss. 14.8 - static bool set_mpss_range(caddr_t start, size_t bytes, size_t align); 14.9 + // Large Page Support 14.10 + static bool setup_large_pages(caddr_t start, size_t bytes, size_t align); 14.11 14.12 static void init_thread_fpu_state(void); 14.13 14.14 @@ -174,7 +174,6 @@ 14.15 static char* mmap_chunk(char *addr, size_t size, int flags, int prot); 14.16 static char* anon_mmap(char* requested_addr, size_t bytes, size_t alignment_hint, bool fixed); 14.17 static bool mpss_sanity_check(bool warn, size_t * page_size); 14.18 - static bool ism_sanity_check (bool warn, size_t * page_size); 14.19 14.20 // Workaround for 4352906. thr_stksegment sometimes returns 14.21 // a bad value for the primordial thread's stack base when
15.1 --- a/src/os/windows/vm/os_windows.cpp Mon Jul 15 11:07:03 2013 +0100 15.2 +++ b/src/os/windows/vm/os_windows.cpp Mon Jul 22 14:01:39 2013 +0100 15.3 @@ -1420,34 +1420,40 @@ 15.4 15.5 bool os::dll_address_to_library_name(address addr, char* buf, 15.6 int buflen, int* offset) { 15.7 + // buf is not optional, but offset is optional 15.8 + assert(buf != NULL, "sanity check"); 15.9 + 15.10 // NOTE: the reason we don't use SymGetModuleInfo() is it doesn't always 15.11 // return the full path to the DLL file, sometimes it returns path 15.12 // to the corresponding PDB file (debug info); sometimes it only 15.13 // returns partial path, which makes life painful. 15.14 15.15 - struct _modinfo mi; 15.16 - mi.addr = addr; 15.17 - mi.full_path = buf; 15.18 - mi.buflen = buflen; 15.19 - int pid = os::current_process_id(); 15.20 - if (enumerate_modules(pid, _locate_module_by_addr, (void *)&mi)) { 15.21 - // buf already contains path name 15.22 - if (offset) *offset = addr - mi.base_addr; 15.23 - return true; 15.24 - } else { 15.25 - if (buf) buf[0] = '\0'; 15.26 - if (offset) *offset = -1; 15.27 - return false; 15.28 - } 15.29 + struct _modinfo mi; 15.30 + mi.addr = addr; 15.31 + mi.full_path = buf; 15.32 + mi.buflen = buflen; 15.33 + int pid = os::current_process_id(); 15.34 + if (enumerate_modules(pid, _locate_module_by_addr, (void *)&mi)) { 15.35 + // buf already contains path name 15.36 + if (offset) *offset = addr - mi.base_addr; 15.37 + return true; 15.38 + } 15.39 + 15.40 + buf[0] = '\0'; 15.41 + if (offset) *offset = -1; 15.42 + return false; 15.43 } 15.44 15.45 bool os::dll_address_to_function_name(address addr, char *buf, 15.46 int buflen, int *offset) { 15.47 + // buf is not optional, but offset is optional 15.48 + assert(buf != NULL, "sanity check"); 15.49 + 15.50 if (Decoder::decode(addr, buf, buflen, offset)) { 15.51 return true; 15.52 } 15.53 if (offset != NULL) *offset = -1; 15.54 - if (buf != NULL) buf[0] = '\0'; 15.55 + buf[0] = '\0'; 15.56 return false; 15.57 } 15.58 15.59 @@ -2689,6 +2695,19 @@ 15.60 } 15.61 #endif 15.62 15.63 +#ifndef PRODUCT 15.64 +void os::win32::call_test_func_with_wrapper(void (*funcPtr)(void)) { 15.65 + // Install a win32 structured exception handler around the test 15.66 + // function call so the VM can generate an error dump if needed. 15.67 + __try { 15.68 + (*funcPtr)(); 15.69 + } __except(topLevelExceptionFilter( 15.70 + (_EXCEPTION_POINTERS*)_exception_info())) { 15.71 + // Nothing to do. 15.72 + } 15.73 +} 15.74 +#endif 15.75 + 15.76 // Virtual Memory 15.77 15.78 int os::vm_page_size() { return os::win32::vm_page_size(); }
16.1 --- a/src/os/windows/vm/os_windows.hpp Mon Jul 15 11:07:03 2013 +0100 16.2 +++ b/src/os/windows/vm/os_windows.hpp Mon Jul 22 14:01:39 2013 +0100 16.3 @@ -1,5 +1,5 @@ 16.4 /* 16.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 16.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 16.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.8 * 16.9 * This code is free software; you can redistribute it and/or modify it 16.10 @@ -94,6 +94,10 @@ 16.11 static address fast_jni_accessor_wrapper(BasicType); 16.12 #endif 16.13 16.14 +#ifndef PRODUCT 16.15 + static void call_test_func_with_wrapper(void (*funcPtr)(void)); 16.16 +#endif 16.17 + 16.18 // filter function to ignore faults on serializations page 16.19 static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e); 16.20 };
17.1 --- a/src/os/windows/vm/os_windows.inline.hpp Mon Jul 15 11:07:03 2013 +0100 17.2 +++ b/src/os/windows/vm/os_windows.inline.hpp Mon Jul 22 14:01:39 2013 +0100 17.3 @@ -106,4 +106,10 @@ 17.4 inline int os::close(int fd) { 17.5 return ::close(fd); 17.6 } 17.7 + 17.8 +#ifndef PRODUCT 17.9 + #define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) \ 17.10 + os::win32::call_test_func_with_wrapper(f) 17.11 +#endif 17.12 + 17.13 #endif // OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP
18.1 --- a/src/share/vm/adlc/forms.hpp Mon Jul 15 11:07:03 2013 +0100 18.2 +++ b/src/share/vm/adlc/forms.hpp Mon Jul 22 14:01:39 2013 +0100 18.3 @@ -1,5 +1,5 @@ 18.4 /* 18.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 18.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 18.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.8 * 18.9 * This code is free software; you can redistribute it and/or modify it 18.10 @@ -146,7 +146,7 @@ 18.11 // Public Methods 18.12 Form(int formType=0, int line=0) 18.13 : _next(NULL), _linenum(line), _ftype(formType) { }; 18.14 - ~Form() {}; 18.15 + virtual ~Form() {}; 18.16 18.17 virtual bool ideal_only() const { 18.18 assert(0,"Check of ideal status on non-instruction/operand form.\n");
19.1 --- a/src/share/vm/classfile/defaultMethods.cpp Mon Jul 15 11:07:03 2013 +0100 19.2 +++ b/src/share/vm/classfile/defaultMethods.cpp Mon Jul 22 14:01:39 2013 +0100 19.3 @@ -318,17 +318,17 @@ 19.4 } 19.5 }; 19.6 19.7 + 19.8 // A method family contains a set of all methods that implement a single 19.9 -// language-level method. Because of erasure, these methods may have different 19.10 -// signatures. As members of the set are collected while walking over the 19.11 +// erased method. As members of the set are collected while walking over the 19.12 // hierarchy, they are tagged with a qualification state. The qualification 19.13 // state for an erased method is set to disqualified if there exists a path 19.14 // from the root of hierarchy to the method that contains an interleaving 19.15 -// language-equivalent method defined in an interface. 19.16 +// erased method defined in an interface. 19.17 + 19.18 class MethodFamily : public ResourceObj { 19.19 private: 19.20 19.21 - generic::MethodDescriptor* _descriptor; // language-level description 19.22 GrowableArray<Pair<Method*,QualifiedState> > _members; 19.23 ResourceHashtable<Method*, int> _member_index; 19.24 19.25 @@ -358,15 +358,8 @@ 19.26 19.27 public: 19.28 19.29 - MethodFamily(generic::MethodDescriptor* canonical_desc) 19.30 - : _descriptor(canonical_desc), _selected_target(NULL), 19.31 - _exception_message(NULL) {} 19.32 - 19.33 - generic::MethodDescriptor* descriptor() const { return _descriptor; } 19.34 - 19.35 - bool descriptor_matches(generic::MethodDescriptor* md, generic::Context* ctx) { 19.36 - return descriptor()->covariant_match(md, ctx); 19.37 - } 19.38 + MethodFamily() 19.39 + : _selected_target(NULL), _exception_message(NULL) {} 19.40 19.41 void set_target_if_empty(Method* m) { 19.42 if (_selected_target == NULL && !m->is_overpass()) { 19.43 @@ -441,16 +434,10 @@ 19.44 } 19.45 19.46 #ifndef PRODUCT 19.47 - void print_on(outputStream* str) const { 19.48 - print_on(str, 0); 19.49 - } 19.50 - 19.51 - void print_on(outputStream* str, int indent) const { 19.52 + void print_sig_on(outputStream* str, Symbol* signature, int indent) const { 19.53 streamIndentor si(str, indent * 2); 19.54 19.55 - generic::Context ctx(NULL); // empty, as _descriptor already canonicalized 19.56 - TempNewSymbol family = descriptor()->reify_signature(&ctx, Thread::current()); 19.57 - str->indent().print_cr("Logical Method %s:", family->as_C_string()); 19.58 + str->indent().print_cr("Logical Method %s:", signature->as_C_string()); 19.59 19.60 streamIndentor si2(str); 19.61 for (int i = 0; i < _members.length(); ++i) { 19.62 @@ -516,36 +503,92 @@ 19.63 return SymbolTable::new_symbol(ss.base(), (int)ss.size(), CHECK_NULL); 19.64 } 19.65 19.66 +// A generic method family contains a set of all methods that implement a single 19.67 +// language-level method. Because of erasure, these methods may have different 19.68 +// signatures. As members of the set are collected while walking over the 19.69 +// hierarchy, they are tagged with a qualification state. The qualification 19.70 +// state for an erased method is set to disqualified if there exists a path 19.71 +// from the root of hierarchy to the method that contains an interleaving 19.72 +// language-equivalent method defined in an interface. 19.73 +class GenericMethodFamily : public MethodFamily { 19.74 + private: 19.75 + 19.76 + generic::MethodDescriptor* _descriptor; // language-level description 19.77 + 19.78 + public: 19.79 + 19.80 + GenericMethodFamily(generic::MethodDescriptor* canonical_desc) 19.81 + : _descriptor(canonical_desc) {} 19.82 + 19.83 + generic::MethodDescriptor* descriptor() const { return _descriptor; } 19.84 + 19.85 + bool descriptor_matches(generic::MethodDescriptor* md, generic::Context* ctx) { 19.86 + return descriptor()->covariant_match(md, ctx); 19.87 + } 19.88 + 19.89 +#ifndef PRODUCT 19.90 + Symbol* get_generic_sig() const { 19.91 + 19.92 + generic::Context ctx(NULL); // empty, as _descriptor already canonicalized 19.93 + TempNewSymbol sig = descriptor()->reify_signature(&ctx, Thread::current()); 19.94 + return sig; 19.95 + } 19.96 +#endif // ndef PRODUCT 19.97 +}; 19.98 + 19.99 class StateRestorer; 19.100 19.101 -// StatefulMethodFamily is a wrapper around MethodFamily that maintains the 19.102 +// StatefulMethodFamily is a wrapper around a MethodFamily that maintains the 19.103 // qualification state during hierarchy visitation, and applies that state 19.104 -// when adding members to the MethodFamily. 19.105 +// when adding members to the MethodFamily 19.106 class StatefulMethodFamily : public ResourceObj { 19.107 friend class StateRestorer; 19.108 private: 19.109 - MethodFamily* _method; 19.110 QualifiedState _qualification_state; 19.111 19.112 void set_qualification_state(QualifiedState state) { 19.113 _qualification_state = state; 19.114 } 19.115 19.116 + protected: 19.117 + MethodFamily* _method_family; 19.118 + 19.119 public: 19.120 - StatefulMethodFamily(generic::MethodDescriptor* md, generic::Context* ctx) { 19.121 - _method = new MethodFamily(md->canonicalize(ctx)); 19.122 - _qualification_state = QUALIFIED; 19.123 + StatefulMethodFamily() { 19.124 + _method_family = new MethodFamily(); 19.125 + _qualification_state = QUALIFIED; 19.126 } 19.127 19.128 - void set_target_if_empty(Method* m) { _method->set_target_if_empty(m); } 19.129 + StatefulMethodFamily(MethodFamily* mf) { 19.130 + _method_family = mf; 19.131 + _qualification_state = QUALIFIED; 19.132 + } 19.133 19.134 - MethodFamily* get_method_family() { return _method; } 19.135 + void set_target_if_empty(Method* m) { _method_family->set_target_if_empty(m); } 19.136 + 19.137 + MethodFamily* get_method_family() { return _method_family; } 19.138 + 19.139 + StateRestorer* record_method_and_dq_further(Method* mo); 19.140 +}; 19.141 + 19.142 + 19.143 +// StatefulGenericMethodFamily is a wrapper around GenericMethodFamily that maintains the 19.144 +// qualification state during hierarchy visitation, and applies that state 19.145 +// when adding members to the GenericMethodFamily. 19.146 +class StatefulGenericMethodFamily : public StatefulMethodFamily { 19.147 + 19.148 + public: 19.149 + StatefulGenericMethodFamily(generic::MethodDescriptor* md, generic::Context* ctx) 19.150 + : StatefulMethodFamily(new GenericMethodFamily(md->canonicalize(ctx))) { 19.151 + 19.152 + } 19.153 + GenericMethodFamily* get_method_family() { 19.154 + return (GenericMethodFamily*)_method_family; 19.155 + } 19.156 19.157 bool descriptor_matches(generic::MethodDescriptor* md, generic::Context* ctx) { 19.158 - return _method->descriptor_matches(md, ctx); 19.159 + return get_method_family()->descriptor_matches(md, ctx); 19.160 } 19.161 - 19.162 - StateRestorer* record_method_and_dq_further(Method* mo); 19.163 }; 19.164 19.165 class StateRestorer : public PseudoScopeMark { 19.166 @@ -563,9 +606,9 @@ 19.167 StateRestorer* StatefulMethodFamily::record_method_and_dq_further(Method* mo) { 19.168 StateRestorer* mark = new StateRestorer(this, _qualification_state); 19.169 if (_qualification_state == QUALIFIED) { 19.170 - _method->record_qualified_method(mo); 19.171 + _method_family->record_qualified_method(mo); 19.172 } else { 19.173 - _method->record_disqualified_method(mo); 19.174 + _method_family->record_disqualified_method(mo); 19.175 } 19.176 // Everything found "above"??? this method in the hierarchy walk is set to 19.177 // disqualified 19.178 @@ -573,15 +616,15 @@ 19.179 return mark; 19.180 } 19.181 19.182 -class StatefulMethodFamilies : public ResourceObj { 19.183 +class StatefulGenericMethodFamilies : public ResourceObj { 19.184 private: 19.185 - GrowableArray<StatefulMethodFamily*> _methods; 19.186 + GrowableArray<StatefulGenericMethodFamily*> _methods; 19.187 19.188 public: 19.189 - StatefulMethodFamily* find_matching( 19.190 + StatefulGenericMethodFamily* find_matching( 19.191 generic::MethodDescriptor* md, generic::Context* ctx) { 19.192 for (int i = 0; i < _methods.length(); ++i) { 19.193 - StatefulMethodFamily* existing = _methods.at(i); 19.194 + StatefulGenericMethodFamily* existing = _methods.at(i); 19.195 if (existing->descriptor_matches(md, ctx)) { 19.196 return existing; 19.197 } 19.198 @@ -589,17 +632,17 @@ 19.199 return NULL; 19.200 } 19.201 19.202 - StatefulMethodFamily* find_matching_or_create( 19.203 + StatefulGenericMethodFamily* find_matching_or_create( 19.204 generic::MethodDescriptor* md, generic::Context* ctx) { 19.205 - StatefulMethodFamily* method = find_matching(md, ctx); 19.206 + StatefulGenericMethodFamily* method = find_matching(md, ctx); 19.207 if (method == NULL) { 19.208 - method = new StatefulMethodFamily(md, ctx); 19.209 + method = new StatefulGenericMethodFamily(md, ctx); 19.210 _methods.append(method); 19.211 } 19.212 return method; 19.213 } 19.214 19.215 - void extract_families_into(GrowableArray<MethodFamily*>* array) { 19.216 + void extract_families_into(GrowableArray<GenericMethodFamily*>* array) { 19.217 for (int i = 0; i < _methods.length(); ++i) { 19.218 array->append(_methods.at(i)->get_method_family()); 19.219 } 19.220 @@ -683,26 +726,79 @@ 19.221 return slots; 19.222 } 19.223 19.224 +// Iterates over the superinterface type hierarchy looking for all methods 19.225 +// with a specific erased signature. 19.226 +class FindMethodsByErasedSig : public HierarchyVisitor<FindMethodsByErasedSig> { 19.227 + private: 19.228 + // Context data 19.229 + Symbol* _method_name; 19.230 + Symbol* _method_signature; 19.231 + StatefulMethodFamily* _family; 19.232 + 19.233 + public: 19.234 + FindMethodsByErasedSig(Symbol* name, Symbol* signature) : 19.235 + _method_name(name), _method_signature(signature), 19.236 + _family(NULL) {} 19.237 + 19.238 + void get_discovered_family(MethodFamily** family) { 19.239 + if (_family != NULL) { 19.240 + *family = _family->get_method_family(); 19.241 + } else { 19.242 + *family = NULL; 19.243 + } 19.244 + } 19.245 + 19.246 + void* new_node_data(InstanceKlass* cls) { return new PseudoScope(); } 19.247 + void free_node_data(void* node_data) { 19.248 + PseudoScope::cast(node_data)->destroy(); 19.249 + } 19.250 + 19.251 + // Find all methods on this hierarchy that match this 19.252 + // method's erased (name, signature) 19.253 + bool visit() { 19.254 + PseudoScope* scope = PseudoScope::cast(current_data()); 19.255 + InstanceKlass* iklass = current_class(); 19.256 + 19.257 + Method* m = iklass->find_method(_method_name, _method_signature); 19.258 + if (m != NULL) { 19.259 + if (_family == NULL) { 19.260 + _family = new StatefulMethodFamily(); 19.261 + } 19.262 + 19.263 + if (iklass->is_interface()) { 19.264 + StateRestorer* restorer = _family->record_method_and_dq_further(m); 19.265 + scope->add_mark(restorer); 19.266 + } else { 19.267 + // This is the rule that methods in classes "win" (bad word) over 19.268 + // methods in interfaces. This works because of single inheritance 19.269 + _family->set_target_if_empty(m); 19.270 + } 19.271 + } 19.272 + return true; 19.273 + } 19.274 + 19.275 +}; 19.276 + 19.277 // Iterates over the type hierarchy looking for all methods with a specific 19.278 // method name. The result of this is a set of method families each of 19.279 // which is populated with a set of methods that implement the same 19.280 // language-level signature. 19.281 -class FindMethodsByName : public HierarchyVisitor<FindMethodsByName> { 19.282 +class FindMethodsByGenericSig : public HierarchyVisitor<FindMethodsByGenericSig> { 19.283 private: 19.284 // Context data 19.285 Thread* THREAD; 19.286 generic::DescriptorCache* _cache; 19.287 Symbol* _method_name; 19.288 generic::Context* _ctx; 19.289 - StatefulMethodFamilies _families; 19.290 + StatefulGenericMethodFamilies _families; 19.291 19.292 public: 19.293 19.294 - FindMethodsByName(generic::DescriptorCache* cache, Symbol* name, 19.295 + FindMethodsByGenericSig(generic::DescriptorCache* cache, Symbol* name, 19.296 generic::Context* ctx, Thread* thread) : 19.297 _cache(cache), _method_name(name), _ctx(ctx), THREAD(thread) {} 19.298 19.299 - void get_discovered_families(GrowableArray<MethodFamily*>* methods) { 19.300 + void get_discovered_families(GrowableArray<GenericMethodFamily*>* methods) { 19.301 _families.extract_families_into(methods); 19.302 } 19.303 19.304 @@ -733,7 +829,7 @@ 19.305 // Find all methods on this hierarchy that match this method 19.306 // (name, signature). This class collects other families of this 19.307 // method name. 19.308 - StatefulMethodFamily* family = 19.309 + StatefulGenericMethodFamily* family = 19.310 _families.find_matching_or_create(md, _ctx); 19.311 19.312 if (klass->is_interface()) { 19.313 @@ -752,8 +848,8 @@ 19.314 }; 19.315 19.316 #ifndef PRODUCT 19.317 -static void print_families( 19.318 - GrowableArray<MethodFamily*>* methods, Symbol* match) { 19.319 +static void print_generic_families( 19.320 + GrowableArray<GenericMethodFamily*>* methods, Symbol* match) { 19.321 streamIndentor si(tty, 4); 19.322 if (methods->length() == 0) { 19.323 tty->indent(); 19.324 @@ -761,21 +857,86 @@ 19.325 } 19.326 for (int i = 0; i < methods->length(); ++i) { 19.327 tty->indent(); 19.328 - MethodFamily* lm = methods->at(i); 19.329 + GenericMethodFamily* lm = methods->at(i); 19.330 if (lm->contains_signature(match)) { 19.331 tty->print_cr("<Matching>"); 19.332 } else { 19.333 tty->print_cr("<Non-Matching>"); 19.334 } 19.335 - lm->print_on(tty, 1); 19.336 + lm->print_sig_on(tty, lm->get_generic_sig(), 1); 19.337 } 19.338 } 19.339 #endif // ndef PRODUCT 19.340 19.341 +static void create_overpasses( 19.342 + GrowableArray<EmptyVtableSlot*>* slots, InstanceKlass* klass, TRAPS); 19.343 + 19.344 +static void generate_generic_defaults( 19.345 + InstanceKlass* klass, GrowableArray<EmptyVtableSlot*>* empty_slots, 19.346 + EmptyVtableSlot* slot, int current_slot_index, TRAPS) { 19.347 + 19.348 + if (slot->is_bound()) { 19.349 +#ifndef PRODUCT 19.350 + if (TraceDefaultMethods) { 19.351 + streamIndentor si(tty, 4); 19.352 + tty->indent().print_cr("Already bound to logical method:"); 19.353 + GenericMethodFamily* lm = (GenericMethodFamily*)(slot->get_binding()); 19.354 + lm->print_sig_on(tty, lm->get_generic_sig(), 1); 19.355 + } 19.356 +#endif // ndef PRODUCT 19.357 + return; // covered by previous processing 19.358 + } 19.359 + 19.360 + generic::DescriptorCache cache; 19.361 + 19.362 + generic::Context ctx(&cache); 19.363 + FindMethodsByGenericSig visitor(&cache, slot->name(), &ctx, CHECK); 19.364 + visitor.run(klass); 19.365 + 19.366 + GrowableArray<GenericMethodFamily*> discovered_families; 19.367 + visitor.get_discovered_families(&discovered_families); 19.368 + 19.369 +#ifndef PRODUCT 19.370 + if (TraceDefaultMethods) { 19.371 + print_generic_families(&discovered_families, slot->signature()); 19.372 + } 19.373 +#endif // ndef PRODUCT 19.374 + 19.375 + // Find and populate any other slots that match the discovered families 19.376 + for (int j = current_slot_index; j < empty_slots->length(); ++j) { 19.377 + EmptyVtableSlot* open_slot = empty_slots->at(j); 19.378 + 19.379 + if (slot->name() == open_slot->name()) { 19.380 + for (int k = 0; k < discovered_families.length(); ++k) { 19.381 + GenericMethodFamily* lm = discovered_families.at(k); 19.382 + 19.383 + if (lm->contains_signature(open_slot->signature())) { 19.384 + lm->determine_target(klass, CHECK); 19.385 + open_slot->bind_family(lm); 19.386 + } 19.387 + } 19.388 + } 19.389 + } 19.390 +} 19.391 + 19.392 +static void generate_erased_defaults( 19.393 + InstanceKlass* klass, GrowableArray<EmptyVtableSlot*>* empty_slots, 19.394 + EmptyVtableSlot* slot, TRAPS) { 19.395 + 19.396 + // sets up a set of methods with the same exact erased signature 19.397 + FindMethodsByErasedSig visitor(slot->name(), slot->signature()); 19.398 + visitor.run(klass); 19.399 + 19.400 + MethodFamily* family; 19.401 + visitor.get_discovered_family(&family); 19.402 + if (family != NULL) { 19.403 + family->determine_target(klass, CHECK); 19.404 + slot->bind_family(family); 19.405 + } 19.406 +} 19.407 + 19.408 static void merge_in_new_methods(InstanceKlass* klass, 19.409 GrowableArray<Method*>* new_methods, TRAPS); 19.410 -static void create_overpasses( 19.411 - GrowableArray<EmptyVtableSlot*>* slots, InstanceKlass* klass, TRAPS); 19.412 19.413 // This is the guts of the default methods implementation. This is called just 19.414 // after the classfile has been parsed if some ancestor has default methods. 19.415 @@ -807,8 +968,6 @@ 19.416 // whatever scope it's in. 19.417 ResourceMark rm(THREAD); 19.418 19.419 - generic::DescriptorCache cache; 19.420 - 19.421 // Keep entire hierarchy alive for the duration of the computation 19.422 KeepAliveRegistrar keepAlive(THREAD); 19.423 KeepAliveVisitor loadKeepAlive(&keepAlive); 19.424 @@ -837,47 +996,13 @@ 19.425 tty->print_cr(""); 19.426 } 19.427 #endif // ndef PRODUCT 19.428 - if (slot->is_bound()) { 19.429 -#ifndef PRODUCT 19.430 - if (TraceDefaultMethods) { 19.431 - streamIndentor si(tty, 4); 19.432 - tty->indent().print_cr("Already bound to logical method:"); 19.433 - slot->get_binding()->print_on(tty, 1); 19.434 - } 19.435 -#endif // ndef PRODUCT 19.436 - continue; // covered by previous processing 19.437 + 19.438 + if (ParseGenericDefaults) { 19.439 + generate_generic_defaults(klass, empty_slots, slot, i, CHECK); 19.440 + } else { 19.441 + generate_erased_defaults(klass, empty_slots, slot, CHECK); 19.442 } 19.443 - 19.444 - generic::Context ctx(&cache); 19.445 - FindMethodsByName visitor(&cache, slot->name(), &ctx, CHECK); 19.446 - visitor.run(klass); 19.447 - 19.448 - GrowableArray<MethodFamily*> discovered_families; 19.449 - visitor.get_discovered_families(&discovered_families); 19.450 - 19.451 -#ifndef PRODUCT 19.452 - if (TraceDefaultMethods) { 19.453 - print_families(&discovered_families, slot->signature()); 19.454 - } 19.455 -#endif // ndef PRODUCT 19.456 - 19.457 - // Find and populate any other slots that match the discovered families 19.458 - for (int j = i; j < empty_slots->length(); ++j) { 19.459 - EmptyVtableSlot* open_slot = empty_slots->at(j); 19.460 - 19.461 - if (slot->name() == open_slot->name()) { 19.462 - for (int k = 0; k < discovered_families.length(); ++k) { 19.463 - MethodFamily* lm = discovered_families.at(k); 19.464 - 19.465 - if (lm->contains_signature(open_slot->signature())) { 19.466 - lm->determine_target(klass, CHECK); 19.467 - open_slot->bind_family(lm); 19.468 - } 19.469 - } 19.470 - } 19.471 - } 19.472 - } 19.473 - 19.474 + } 19.475 #ifndef PRODUCT 19.476 if (TraceDefaultMethods) { 19.477 tty->print_cr("Creating overpasses..."); 19.478 @@ -893,7 +1018,6 @@ 19.479 #endif // ndef PRODUCT 19.480 } 19.481 19.482 - 19.483 /** 19.484 * Generic analysis was used upon interface '_target' and found a unique 19.485 * default method candidate with generic signature '_method_desc'. This 19.486 @@ -912,16 +1036,84 @@ 19.487 * the selected method along that path. 19.488 */ 19.489 class ShadowChecker : public HierarchyVisitor<ShadowChecker> { 19.490 - private: 19.491 - generic::DescriptorCache* _cache; 19.492 + protected: 19.493 Thread* THREAD; 19.494 19.495 InstanceKlass* _target; 19.496 19.497 Symbol* _method_name; 19.498 InstanceKlass* _method_holder; 19.499 + bool _found_shadow; 19.500 + 19.501 + 19.502 + public: 19.503 + 19.504 + ShadowChecker(Thread* thread, Symbol* name, InstanceKlass* holder, 19.505 + InstanceKlass* target) 19.506 + : THREAD(thread), _method_name(name), _method_holder(holder), 19.507 + _target(target), _found_shadow(false) {} 19.508 + 19.509 + void* new_node_data(InstanceKlass* cls) { return NULL; } 19.510 + void free_node_data(void* data) { return; } 19.511 + 19.512 + bool visit() { 19.513 + InstanceKlass* ik = current_class(); 19.514 + if (ik == _target && current_depth() == 1) { 19.515 + return false; // This was the specified super -- no need to search it 19.516 + } 19.517 + if (ik == _method_holder || ik == _target) { 19.518 + // We found a path that should be examined to see if it shadows _method 19.519 + if (path_has_shadow()) { 19.520 + _found_shadow = true; 19.521 + cancel_iteration(); 19.522 + } 19.523 + return false; // no need to continue up hierarchy 19.524 + } 19.525 + return true; 19.526 + } 19.527 + 19.528 + virtual bool path_has_shadow() = 0; 19.529 + bool found_shadow() { return _found_shadow; } 19.530 +}; 19.531 + 19.532 +// Used for Invokespecial. 19.533 +// Invokespecial is allowed to invoke a concrete interface method 19.534 +// and can be used to disambuiguate among qualified candidates, 19.535 +// which are methods in immediate superinterfaces, 19.536 +// but may not be used to invoke a candidate that would be shadowed 19.537 +// from the perspective of the caller. 19.538 +// Invokespecial is also used in the overpass generation today 19.539 +// We re-run the shadowchecker because we can't distinguish this case, 19.540 +// but it should return the same answer, since the overpass target 19.541 +// is now the invokespecial caller. 19.542 +class ErasedShadowChecker : public ShadowChecker { 19.543 + private: 19.544 + bool path_has_shadow() { 19.545 + 19.546 + for (int i = current_depth() - 1; i > 0; --i) { 19.547 + InstanceKlass* ik = class_at_depth(i); 19.548 + 19.549 + if (ik->is_interface()) { 19.550 + int end; 19.551 + int start = ik->find_method_by_name(_method_name, &end); 19.552 + if (start != -1) { 19.553 + return true; 19.554 + } 19.555 + } 19.556 + } 19.557 + return false; 19.558 + } 19.559 + public: 19.560 + 19.561 + ErasedShadowChecker(Thread* thread, Symbol* name, InstanceKlass* holder, 19.562 + InstanceKlass* target) 19.563 + : ShadowChecker(thread, name, holder, target) {} 19.564 +}; 19.565 + 19.566 +class GenericShadowChecker : public ShadowChecker { 19.567 + private: 19.568 + generic::DescriptorCache* _cache; 19.569 generic::MethodDescriptor* _method_desc; 19.570 - bool _found_shadow; 19.571 19.572 bool path_has_shadow() { 19.573 generic::Context ctx(_cache); 19.574 @@ -950,104 +1142,42 @@ 19.575 19.576 public: 19.577 19.578 - ShadowChecker(generic::DescriptorCache* cache, Thread* thread, 19.579 + GenericShadowChecker(generic::DescriptorCache* cache, Thread* thread, 19.580 Symbol* name, InstanceKlass* holder, generic::MethodDescriptor* desc, 19.581 InstanceKlass* target) 19.582 - : _cache(cache), THREAD(thread), _method_name(name), _method_holder(holder), 19.583 - _method_desc(desc), _target(target), _found_shadow(false) {} 19.584 + : ShadowChecker(thread, name, holder, target) { 19.585 + _cache = cache; 19.586 + _method_desc = desc; 19.587 + } 19.588 +}; 19.589 19.590 - void* new_node_data(InstanceKlass* cls) { return NULL; } 19.591 - void free_node_data(void* data) { return; } 19.592 19.593 - bool visit() { 19.594 - InstanceKlass* ik = current_class(); 19.595 - if (ik == _target && current_depth() == 1) { 19.596 - return false; // This was the specified super -- no need to search it 19.597 - } 19.598 - if (ik == _method_holder || ik == _target) { 19.599 - // We found a path that should be examined to see if it shadows _method 19.600 - if (path_has_shadow()) { 19.601 - _found_shadow = true; 19.602 - cancel_iteration(); 19.603 - } 19.604 - return false; // no need to continue up hierarchy 19.605 - } 19.606 - return true; 19.607 + 19.608 +// Find the unique qualified candidate from the perspective of the super_class 19.609 +// which is the resolved_klass, which must be an immediate superinterface 19.610 +// of klass 19.611 +Method* find_erased_super_default(InstanceKlass* current_class, InstanceKlass* super_class, Symbol* method_name, Symbol* sig, TRAPS) { 19.612 + 19.613 + FindMethodsByErasedSig visitor(method_name, sig); 19.614 + visitor.run(super_class); // find candidates from resolved_klass 19.615 + 19.616 + MethodFamily* family; 19.617 + visitor.get_discovered_family(&family); 19.618 + 19.619 + if (family != NULL) { 19.620 + family->determine_target(current_class, CHECK_NULL); // get target from current_class 19.621 } 19.622 19.623 - bool found_shadow() { return _found_shadow; } 19.624 -}; 19.625 - 19.626 -// This is called during linktime when we find an invokespecial call that 19.627 -// refers to a direct superinterface. It indicates that we should find the 19.628 -// default method in the hierarchy of that superinterface, and if that method 19.629 -// would have been a candidate from the point of view of 'this' class, then we 19.630 -// return that method. 19.631 -Method* DefaultMethods::find_super_default( 19.632 - Klass* cls, Klass* super, Symbol* method_name, Symbol* sig, TRAPS) { 19.633 - 19.634 - ResourceMark rm(THREAD); 19.635 - 19.636 - assert(cls != NULL && super != NULL, "Need real classes"); 19.637 - 19.638 - InstanceKlass* current_class = InstanceKlass::cast(cls); 19.639 - InstanceKlass* direction = InstanceKlass::cast(super); 19.640 - 19.641 - // Keep entire hierarchy alive for the duration of the computation 19.642 - KeepAliveRegistrar keepAlive(THREAD); 19.643 - KeepAliveVisitor loadKeepAlive(&keepAlive); 19.644 - loadKeepAlive.run(current_class); 19.645 - 19.646 -#ifndef PRODUCT 19.647 - if (TraceDefaultMethods) { 19.648 - tty->print_cr("Finding super default method %s.%s%s from %s", 19.649 - direction->name()->as_C_string(), 19.650 - method_name->as_C_string(), sig->as_C_string(), 19.651 - current_class->name()->as_C_string()); 19.652 - } 19.653 -#endif // ndef PRODUCT 19.654 - 19.655 - if (!direction->is_interface()) { 19.656 - // We should not be here 19.657 - return NULL; 19.658 - } 19.659 - 19.660 - generic::DescriptorCache cache; 19.661 - generic::Context ctx(&cache); 19.662 - 19.663 - // Prime the initial generic context for current -> direction 19.664 - ctx.apply_type_arguments(current_class, direction, CHECK_NULL); 19.665 - 19.666 - FindMethodsByName visitor(&cache, method_name, &ctx, CHECK_NULL); 19.667 - visitor.run(direction); 19.668 - 19.669 - GrowableArray<MethodFamily*> families; 19.670 - visitor.get_discovered_families(&families); 19.671 - 19.672 -#ifndef PRODUCT 19.673 - if (TraceDefaultMethods) { 19.674 - print_families(&families, sig); 19.675 - } 19.676 -#endif // ndef PRODUCT 19.677 - 19.678 - MethodFamily* selected_family = NULL; 19.679 - 19.680 - for (int i = 0; i < families.length(); ++i) { 19.681 - MethodFamily* lm = families.at(i); 19.682 - if (lm->contains_signature(sig)) { 19.683 - lm->determine_target(current_class, CHECK_NULL); 19.684 - selected_family = lm; 19.685 - } 19.686 - } 19.687 - 19.688 - if (selected_family->has_target()) { 19.689 - Method* target = selected_family->get_selected_target(); 19.690 + if (family->has_target()) { 19.691 + Method* target = family->get_selected_target(); 19.692 InstanceKlass* holder = InstanceKlass::cast(target->method_holder()); 19.693 19.694 // Verify that the identified method is valid from the context of 19.695 - // the current class 19.696 - ShadowChecker checker(&cache, THREAD, target->name(), 19.697 - holder, selected_family->descriptor(), direction); 19.698 + // the current class, which is the caller class for invokespecial 19.699 + // link resolution, i.e. ensure there it is not shadowed. 19.700 + // You can use invokespecial to disambiguate interface methods, but 19.701 + // you can not use it to skip over an interface method that would shadow it. 19.702 + ErasedShadowChecker checker(THREAD, target->name(), holder, super_class); 19.703 checker.run(current_class); 19.704 19.705 if (checker.found_shadow()) { 19.706 @@ -1061,20 +1191,143 @@ 19.707 } else { 19.708 #ifndef PRODUCT 19.709 if (TraceDefaultMethods) { 19.710 - tty->print(" Returning "); 19.711 - print_method(tty, target, true); 19.712 - tty->print_cr(""); 19.713 + family->print_sig_on(tty, target->signature(), 1); 19.714 } 19.715 #endif // ndef PRODUCT 19.716 return target; 19.717 } 19.718 } else { 19.719 + assert(family->throws_exception(), "must have target or throw"); 19.720 + THROW_MSG_(vmSymbols::java_lang_AbstractMethodError(), 19.721 + family->get_exception_message()->as_C_string(), NULL); 19.722 + } 19.723 +} 19.724 + 19.725 +// super_class is assumed to be the direct super of current_class 19.726 +Method* find_generic_super_default( InstanceKlass* current_class, 19.727 + InstanceKlass* super_class, 19.728 + Symbol* method_name, Symbol* sig, TRAPS) { 19.729 + generic::DescriptorCache cache; 19.730 + generic::Context ctx(&cache); 19.731 + 19.732 + // Prime the initial generic context for current -> super_class 19.733 + ctx.apply_type_arguments(current_class, super_class, CHECK_NULL); 19.734 + 19.735 + FindMethodsByGenericSig visitor(&cache, method_name, &ctx, CHECK_NULL); 19.736 + visitor.run(super_class); 19.737 + 19.738 + GrowableArray<GenericMethodFamily*> families; 19.739 + visitor.get_discovered_families(&families); 19.740 + 19.741 +#ifndef PRODUCT 19.742 + if (TraceDefaultMethods) { 19.743 + print_generic_families(&families, sig); 19.744 + } 19.745 +#endif // ndef PRODUCT 19.746 + 19.747 + GenericMethodFamily* selected_family = NULL; 19.748 + 19.749 + for (int i = 0; i < families.length(); ++i) { 19.750 + GenericMethodFamily* lm = families.at(i); 19.751 + if (lm->contains_signature(sig)) { 19.752 + lm->determine_target(current_class, CHECK_NULL); 19.753 + selected_family = lm; 19.754 + } 19.755 + } 19.756 + 19.757 + if (selected_family->has_target()) { 19.758 + Method* target = selected_family->get_selected_target(); 19.759 + InstanceKlass* holder = InstanceKlass::cast(target->method_holder()); 19.760 + 19.761 + // Verify that the identified method is valid from the context of 19.762 + // the current class 19.763 + GenericShadowChecker checker(&cache, THREAD, target->name(), 19.764 + holder, selected_family->descriptor(), super_class); 19.765 + checker.run(current_class); 19.766 + 19.767 + if (checker.found_shadow()) { 19.768 +#ifndef PRODUCT 19.769 + if (TraceDefaultMethods) { 19.770 + tty->print_cr(" Only candidate found was shadowed."); 19.771 + } 19.772 +#endif // ndef PRODUCT 19.773 + THROW_MSG_(vmSymbols::java_lang_AbstractMethodError(), 19.774 + "Accessible default method not found", NULL); 19.775 + } else { 19.776 + return target; 19.777 + } 19.778 + } else { 19.779 assert(selected_family->throws_exception(), "must have target or throw"); 19.780 THROW_MSG_(vmSymbols::java_lang_AbstractMethodError(), 19.781 selected_family->get_exception_message()->as_C_string(), NULL); 19.782 } 19.783 } 19.784 19.785 +// This is called during linktime when we find an invokespecial call that 19.786 +// refers to a direct superinterface. It indicates that we should find the 19.787 +// default method in the hierarchy of that superinterface, and if that method 19.788 +// would have been a candidate from the point of view of 'this' class, then we 19.789 +// return that method. 19.790 +// This logic assumes that the super is a direct superclass of the caller 19.791 +Method* DefaultMethods::find_super_default( 19.792 + Klass* cls, Klass* super, Symbol* method_name, Symbol* sig, TRAPS) { 19.793 + 19.794 + ResourceMark rm(THREAD); 19.795 + 19.796 + assert(cls != NULL && super != NULL, "Need real classes"); 19.797 + 19.798 + InstanceKlass* current_class = InstanceKlass::cast(cls); 19.799 + InstanceKlass* super_class = InstanceKlass::cast(super); 19.800 + 19.801 + // Keep entire hierarchy alive for the duration of the computation 19.802 + KeepAliveRegistrar keepAlive(THREAD); 19.803 + KeepAliveVisitor loadKeepAlive(&keepAlive); 19.804 + loadKeepAlive.run(current_class); // get hierarchy from current class 19.805 + 19.806 +#ifndef PRODUCT 19.807 + if (TraceDefaultMethods) { 19.808 + tty->print_cr("Finding super default method %s.%s%s from %s", 19.809 + super_class->name()->as_C_string(), 19.810 + method_name->as_C_string(), sig->as_C_string(), 19.811 + current_class->name()->as_C_string()); 19.812 + } 19.813 +#endif // ndef PRODUCT 19.814 + 19.815 + assert(super_class->is_interface(), "only call for default methods"); 19.816 + 19.817 + Method* target = NULL; 19.818 + if (ParseGenericDefaults) { 19.819 + target = find_generic_super_default(current_class, super_class, 19.820 + method_name, sig, CHECK_NULL); 19.821 + } else { 19.822 + target = find_erased_super_default(current_class, super_class, 19.823 + method_name, sig, CHECK_NULL); 19.824 + } 19.825 + 19.826 +#ifndef PRODUCT 19.827 + if (target != NULL) { 19.828 + if (TraceDefaultMethods) { 19.829 + tty->print(" Returning "); 19.830 + print_method(tty, target, true); 19.831 + tty->print_cr(""); 19.832 + } 19.833 + } 19.834 +#endif // ndef PRODUCT 19.835 + return target; 19.836 +} 19.837 + 19.838 +#ifndef PRODUCT 19.839 +// Return true is broad type is a covariant return of narrow type 19.840 +static bool covariant_return_type(BasicType narrow, BasicType broad) { 19.841 + if (narrow == broad) { 19.842 + return true; 19.843 + } 19.844 + if (broad == T_OBJECT) { 19.845 + return true; 19.846 + } 19.847 + return false; 19.848 +} 19.849 +#endif // ndef PRODUCT 19.850 19.851 static int assemble_redirect( 19.852 BytecodeConstantPool* cp, BytecodeBuffer* buffer, 19.853 @@ -1103,7 +1356,7 @@ 19.854 out.next(); 19.855 } 19.856 assert(out.at_return_type(), "Parameter counts do not match"); 19.857 - assert(in.type() == out.type(), "Return types are not compatible"); 19.858 + assert(covariant_return_type(out.type(), in.type()), "Return types are not compatible"); 19.859 19.860 if (parameter_count == 1 && (in.type() == T_LONG || in.type() == T_DOUBLE)) { 19.861 ++parameter_count; // need room for return value 19.862 @@ -1144,10 +1397,15 @@ 19.863 Symbol* sig, AccessFlags flags, int max_stack, int params, 19.864 ConstMethod::MethodType mt, TRAPS) { 19.865 19.866 - address code_start = static_cast<address>(bytecodes->adr_at(0)); 19.867 - int code_length = bytecodes->length(); 19.868 + address code_start = 0; 19.869 + int code_length = 0; 19.870 InlineTableSizes sizes; 19.871 19.872 + if (bytecodes != NULL && bytecodes->length() > 0) { 19.873 + code_start = static_cast<address>(bytecodes->adr_at(0)); 19.874 + code_length = bytecodes->length(); 19.875 + } 19.876 + 19.877 Method* m = Method::allocate(cp->pool_holder()->class_loader_data(), 19.878 code_length, flags, &sizes, 19.879 mt, CHECK_NULL);
20.1 --- a/src/share/vm/classfile/javaClasses.hpp Mon Jul 15 11:07:03 2013 +0100 20.2 +++ b/src/share/vm/classfile/javaClasses.hpp Mon Jul 22 14:01:39 2013 +0100 20.3 @@ -234,6 +234,7 @@ 20.4 static GrowableArray<Klass*>* _fixup_mirror_list; 20.5 20.6 static void set_init_lock(oop java_class, oop init_lock); 20.7 + static void set_protection_domain(oop java_class, oop protection_domain); 20.8 public: 20.9 static void compute_offsets(); 20.10 20.11 @@ -272,7 +273,6 @@ 20.12 20.13 // Support for embedded per-class oops 20.14 static oop protection_domain(oop java_class); 20.15 - static void set_protection_domain(oop java_class, oop protection_domain); 20.16 static oop init_lock(oop java_class); 20.17 static objArrayOop signers(oop java_class); 20.18 static void set_signers(oop java_class, objArrayOop signers);
21.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Mon Jul 15 11:07:03 2013 +0100 21.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Mon Jul 22 14:01:39 2013 +0100 21.3 @@ -2017,12 +2017,6 @@ 21.4 21.5 ALL_SINCE_SAVE_MARKS_CLOSURES(CFLS_OOP_SINCE_SAVE_MARKS_DEFN) 21.6 21.7 - 21.8 -void CompactibleFreeListSpace::object_iterate_since_last_GC(ObjectClosure* cl) { 21.9 - // ugghh... how would one do this efficiently for a non-contiguous space? 21.10 - guarantee(false, "NYI"); 21.11 -} 21.12 - 21.13 bool CompactibleFreeListSpace::linearAllocationWouldFail() const { 21.14 return _smallLinearAllocBlock._word_size == 0; 21.15 }
22.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp Mon Jul 15 11:07:03 2013 +0100 22.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp Mon Jul 22 14:01:39 2013 +0100 22.3 @@ -396,7 +396,6 @@ 22.4 // iteration support for promotion 22.5 void save_marks(); 22.6 bool no_allocs_since_save_marks(); 22.7 - void object_iterate_since_last_GC(ObjectClosure* cl); 22.8 22.9 // iteration support for sweeping 22.10 void save_sweep_limit() {
23.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Mon Jul 15 11:07:03 2013 +0100 23.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Mon Jul 22 14:01:39 2013 +0100 23.3 @@ -3130,26 +3130,6 @@ 23.4 ALL_SINCE_SAVE_MARKS_CLOSURES(CMS_SINCE_SAVE_MARKS_DEFN) 23.5 23.6 void 23.7 -ConcurrentMarkSweepGeneration::object_iterate_since_last_GC(ObjectClosure* blk) 23.8 -{ 23.9 - // Not currently implemented; need to do the following. -- ysr. 23.10 - // dld -- I think that is used for some sort of allocation profiler. So it 23.11 - // really means the objects allocated by the mutator since the last 23.12 - // GC. We could potentially implement this cheaply by recording only 23.13 - // the direct allocations in a side data structure. 23.14 - // 23.15 - // I think we probably ought not to be required to support these 23.16 - // iterations at any arbitrary point; I think there ought to be some 23.17 - // call to enable/disable allocation profiling in a generation/space, 23.18 - // and the iterator ought to return the objects allocated in the 23.19 - // gen/space since the enable call, or the last iterator call (which 23.20 - // will probably be at a GC.) That way, for gens like CM&S that would 23.21 - // require some extra data structure to support this, we only pay the 23.22 - // cost when it's in use... 23.23 - cmsSpace()->object_iterate_since_last_GC(blk); 23.24 -} 23.25 - 23.26 -void 23.27 ConcurrentMarkSweepGeneration::younger_refs_iterate(OopsInGenClosure* cl) { 23.28 cl->set_generation(this); 23.29 younger_refs_in_space_iterate(_cmsSpace, cl);
24.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp Mon Jul 15 11:07:03 2013 +0100 24.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp Mon Jul 22 14:01:39 2013 +0100 24.3 @@ -1273,7 +1273,6 @@ 24.4 // Iteration support and related enquiries 24.5 void save_marks(); 24.6 bool no_allocs_since_save_marks(); 24.7 - void object_iterate_since_last_GC(ObjectClosure* cl); 24.8 void younger_refs_iterate(OopsInGenClosure* cl); 24.9 24.10 // Iteration support specific to CMS generations
25.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Mon Jul 15 11:07:03 2013 +0100 25.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Mon Jul 22 14:01:39 2013 +0100 25.3 @@ -54,7 +54,6 @@ 25.4 #include "memory/referenceProcessor.hpp" 25.5 #include "oops/oop.inline.hpp" 25.6 #include "oops/oop.pcgc.inline.hpp" 25.7 -#include "runtime/aprofiler.hpp" 25.8 #include "runtime/vmThread.hpp" 25.9 25.10 size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0; 25.11 @@ -2665,11 +2664,6 @@ 25.12 heap_region_iterate(&blk); 25.13 } 25.14 25.15 -void G1CollectedHeap::object_iterate_since_last_GC(ObjectClosure* cl) { 25.16 - // FIXME: is this right? 25.17 - guarantee(false, "object_iterate_since_last_GC not supported by G1 heap"); 25.18 -} 25.19 - 25.20 // Calls a SpaceClosure on a HeapRegion. 25.21 25.22 class SpaceClosureRegionClosure: public HeapRegionClosure { 25.23 @@ -3598,8 +3592,6 @@ 25.24 void G1CollectedHeap::gc_prologue(bool full /* Ignored */) { 25.25 // always_do_update_barrier = false; 25.26 assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer"); 25.27 - // Call allocation profiler 25.28 - AllocationProfiler::iterate_since_last_gc(); 25.29 // Fill TLAB's and such 25.30 ensure_parsability(true); 25.31 }
26.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Mon Jul 15 11:07:03 2013 +0100 26.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Mon Jul 22 14:01:39 2013 +0100 26.3 @@ -1360,11 +1360,6 @@ 26.4 object_iterate(cl); 26.5 } 26.6 26.7 - // Iterate over all objects allocated since the last collection, calling 26.8 - // "cl.do_object" on each. The heap must have been initialized properly 26.9 - // to support this function, or else this call will fail. 26.10 - virtual void object_iterate_since_last_GC(ObjectClosure* cl); 26.11 - 26.12 // Iterate over all spaces in use in the heap, in ascending address order. 26.13 virtual void space_iterate(SpaceClosure* cl); 26.14
27.1 --- a/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Mon Jul 15 11:07:03 2013 +0100 27.2 +++ b/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Mon Jul 22 14:01:39 2013 +0100 27.3 @@ -43,7 +43,6 @@ 27.4 #include "oops/instanceRefKlass.hpp" 27.5 #include "oops/oop.inline.hpp" 27.6 #include "prims/jvmtiExport.hpp" 27.7 -#include "runtime/aprofiler.hpp" 27.8 #include "runtime/biasedLocking.hpp" 27.9 #include "runtime/fprofiler.hpp" 27.10 #include "runtime/synchronizer.hpp"
28.1 --- a/src/share/vm/gc_implementation/shared/gcTrace.cpp Mon Jul 15 11:07:03 2013 +0100 28.2 +++ b/src/share/vm/gc_implementation/shared/gcTrace.cpp Mon Jul 22 14:01:39 2013 +0100 28.3 @@ -23,12 +23,14 @@ 28.4 */ 28.5 28.6 #include "precompiled.hpp" 28.7 +#include "gc_implementation/shared/copyFailedInfo.hpp" 28.8 #include "gc_implementation/shared/gcHeapSummary.hpp" 28.9 #include "gc_implementation/shared/gcTimer.hpp" 28.10 #include "gc_implementation/shared/gcTrace.hpp" 28.11 -#include "gc_implementation/shared/copyFailedInfo.hpp" 28.12 +#include "gc_implementation/shared/objectCountEventSender.hpp" 28.13 #include "memory/heapInspection.hpp" 28.14 #include "memory/referenceProcessorStats.hpp" 28.15 +#include "runtime/os.hpp" 28.16 #include "utilities/globalDefinitions.hpp" 28.17 28.18 #if INCLUDE_ALL_GCS 28.19 @@ -38,7 +40,7 @@ 28.20 #define assert_unset_gc_id() assert(_shared_gc_info.id() == SharedGCInfo::UNSET_GCID, "GC already started?") 28.21 #define assert_set_gc_id() assert(_shared_gc_info.id() != SharedGCInfo::UNSET_GCID, "GC not started?") 28.22 28.23 -static jlong GCTracer_next_gc_id = 0; 28.24 +static GCId GCTracer_next_gc_id = 0; 28.25 static GCId create_new_gc_id() { 28.26 return GCTracer_next_gc_id++; 28.27 } 28.28 @@ -91,26 +93,38 @@ 28.29 } 28.30 28.31 #if INCLUDE_SERVICES 28.32 -void ObjectCountEventSenderClosure::do_cinfo(KlassInfoEntry* entry) { 28.33 - if (should_send_event(entry)) { 28.34 - send_event(entry); 28.35 +class ObjectCountEventSenderClosure : public KlassInfoClosure { 28.36 + const GCId _gc_id; 28.37 + const double _size_threshold_percentage; 28.38 + const size_t _total_size_in_words; 28.39 + const jlong _timestamp; 28.40 + 28.41 + public: 28.42 + ObjectCountEventSenderClosure(GCId gc_id, size_t total_size_in_words, jlong timestamp) : 28.43 + _gc_id(gc_id), 28.44 + _size_threshold_percentage(ObjectCountCutOffPercent / 100), 28.45 + _total_size_in_words(total_size_in_words), 28.46 + _timestamp(timestamp) 28.47 + {} 28.48 + 28.49 + virtual void do_cinfo(KlassInfoEntry* entry) { 28.50 + if (should_send_event(entry)) { 28.51 + ObjectCountEventSender::send(entry, _gc_id, _timestamp); 28.52 + } 28.53 } 28.54 -} 28.55 28.56 -void ObjectCountEventSenderClosure::send_event(KlassInfoEntry* entry) { 28.57 - _gc_tracer->send_object_count_after_gc_event(entry->klass(), entry->count(), 28.58 - entry->words() * BytesPerWord); 28.59 -} 28.60 - 28.61 -bool ObjectCountEventSenderClosure::should_send_event(KlassInfoEntry* entry) const { 28.62 - double percentage_of_heap = ((double) entry->words()) / _total_size_in_words; 28.63 - return percentage_of_heap > _size_threshold_percentage; 28.64 -} 28.65 + private: 28.66 + bool should_send_event(const KlassInfoEntry* entry) const { 28.67 + double percentage_of_heap = ((double) entry->words()) / _total_size_in_words; 28.68 + return percentage_of_heap >= _size_threshold_percentage; 28.69 + } 28.70 +}; 28.71 28.72 void GCTracer::report_object_count_after_gc(BoolObjectClosure* is_alive_cl) { 28.73 assert_set_gc_id(); 28.74 + assert(is_alive_cl != NULL, "Must supply function to check liveness"); 28.75 28.76 - if (should_send_object_count_after_gc_event()) { 28.77 + if (ObjectCountEventSender::should_send_event()) { 28.78 ResourceMark rm; 28.79 28.80 KlassInfoTable cit(false); 28.81 @@ -118,12 +132,13 @@ 28.82 HeapInspection hi(false, false, false, NULL); 28.83 hi.populate_table(&cit, is_alive_cl); 28.84 28.85 - ObjectCountEventSenderClosure event_sender(this, cit.size_of_instances_in_words()); 28.86 + jlong timestamp = os::elapsed_counter(); 28.87 + ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words(), timestamp); 28.88 cit.iterate(&event_sender); 28.89 } 28.90 } 28.91 } 28.92 -#endif 28.93 +#endif // INCLUDE_SERVICES 28.94 28.95 void GCTracer::report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const MetaspaceSummary& meta_space_summary) const { 28.96 assert_set_gc_id();
29.1 --- a/src/share/vm/gc_implementation/shared/gcTrace.hpp Mon Jul 15 11:07:03 2013 +0100 29.2 +++ b/src/share/vm/gc_implementation/shared/gcTrace.hpp Mon Jul 22 14:01:39 2013 +0100 29.3 @@ -30,7 +30,6 @@ 29.4 #include "gc_implementation/shared/gcWhen.hpp" 29.5 #include "gc_implementation/shared/copyFailedInfo.hpp" 29.6 #include "memory/allocation.hpp" 29.7 -#include "memory/klassInfoClosure.hpp" 29.8 #include "memory/referenceType.hpp" 29.9 #if INCLUDE_ALL_GCS 29.10 #include "gc_implementation/g1/g1YCTypes.hpp" 29.11 @@ -113,7 +112,6 @@ 29.12 #endif // INCLUDE_ALL_GCS 29.13 29.14 class GCTracer : public ResourceObj { 29.15 - friend class ObjectCountEventSenderClosure; 29.16 protected: 29.17 SharedGCInfo _shared_gc_info; 29.18 29.19 @@ -123,7 +121,6 @@ 29.20 void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const MetaspaceSummary& meta_space_summary) const; 29.21 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const; 29.22 void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN; 29.23 - 29.24 bool has_reported_gc_start() const; 29.25 29.26 protected: 29.27 @@ -137,25 +134,6 @@ 29.28 void send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const; 29.29 void send_reference_stats_event(ReferenceType type, size_t count) const; 29.30 void send_phase_events(TimePartitions* time_partitions) const; 29.31 - void send_object_count_after_gc_event(Klass* klass, jlong count, julong total_size) const NOT_SERVICES_RETURN; 29.32 - bool should_send_object_count_after_gc_event() const; 29.33 -}; 29.34 - 29.35 -class ObjectCountEventSenderClosure : public KlassInfoClosure { 29.36 - GCTracer* _gc_tracer; 29.37 - const double _size_threshold_percentage; 29.38 - const size_t _total_size_in_words; 29.39 - public: 29.40 - ObjectCountEventSenderClosure(GCTracer* gc_tracer, size_t total_size_in_words) : 29.41 - _gc_tracer(gc_tracer), 29.42 - _size_threshold_percentage(ObjectCountCutOffPercent / 100), 29.43 - _total_size_in_words(total_size_in_words) 29.44 - {} 29.45 - virtual void do_cinfo(KlassInfoEntry* entry); 29.46 - protected: 29.47 - virtual void send_event(KlassInfoEntry* entry); 29.48 - private: 29.49 - bool should_send_event(KlassInfoEntry* entry) const; 29.50 }; 29.51 29.52 class YoungGCTracer : public GCTracer {
30.1 --- a/src/share/vm/gc_implementation/shared/gcTraceSend.cpp Mon Jul 15 11:07:03 2013 +0100 30.2 +++ b/src/share/vm/gc_implementation/shared/gcTraceSend.cpp Mon Jul 22 14:01:39 2013 +0100 30.3 @@ -123,27 +123,6 @@ 30.4 } 30.5 } 30.6 30.7 -#if INCLUDE_SERVICES 30.8 -void GCTracer::send_object_count_after_gc_event(Klass* klass, jlong count, julong total_size) const { 30.9 - EventObjectCountAfterGC e; 30.10 - if (e.should_commit()) { 30.11 - e.set_gcId(_shared_gc_info.id()); 30.12 - e.set_class(klass); 30.13 - e.set_count(count); 30.14 - e.set_totalSize(total_size); 30.15 - e.commit(); 30.16 - } 30.17 -} 30.18 -#endif 30.19 - 30.20 -bool GCTracer::should_send_object_count_after_gc_event() const { 30.21 -#if INCLUDE_TRACE 30.22 - return Tracing::is_event_enabled(EventObjectCountAfterGC::eventId); 30.23 -#else 30.24 - return false; 30.25 -#endif 30.26 -} 30.27 - 30.28 #if INCLUDE_ALL_GCS 30.29 void G1NewTracer::send_g1_young_gc_event() { 30.30 EventGCG1GarbageCollection e(UNTIMED);
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 31.2 +++ b/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp Mon Jul 22 14:01:39 2013 +0100 31.3 @@ -0,0 +1,55 @@ 31.4 +/* 31.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 31.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 31.7 + * 31.8 + * This code is free software; you can redistribute it and/or modify it 31.9 + * under the terms of the GNU General Public License version 2 only, as 31.10 + * published by the Free Software Foundation. 31.11 + * 31.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 31.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 31.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 31.15 + * version 2 for more details (a copy is included in the LICENSE file that 31.16 + * accompanied this code). 31.17 + * 31.18 + * You should have received a copy of the GNU General Public License version 31.19 + * 2 along with this work; if not, write to the Free Software Foundation, 31.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 31.21 + * 31.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 31.23 + * or visit www.oracle.com if you need additional information or have any 31.24 + * questions. 31.25 + * 31.26 + */ 31.27 + 31.28 + 31.29 +#include "precompiled.hpp" 31.30 +#include "gc_implementation/shared/objectCountEventSender.hpp" 31.31 +#include "memory/heapInspection.hpp" 31.32 +#include "trace/tracing.hpp" 31.33 +#include "utilities/globalDefinitions.hpp" 31.34 + 31.35 +#if INCLUDE_SERVICES 31.36 + 31.37 +void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id, jlong timestamp) { 31.38 + assert(Tracing::is_event_enabled(EventObjectCountAfterGC::eventId), 31.39 + "Only call this method if the event is enabled"); 31.40 + 31.41 + EventObjectCountAfterGC event(UNTIMED); 31.42 + event.set_gcId(gc_id); 31.43 + event.set_class(entry->klass()); 31.44 + event.set_count(entry->count()); 31.45 + event.set_totalSize(entry->words() * BytesPerWord); 31.46 + event.set_endtime(timestamp); 31.47 + event.commit(); 31.48 +} 31.49 + 31.50 +bool ObjectCountEventSender::should_send_event() { 31.51 +#if INCLUDE_TRACE 31.52 + return Tracing::is_event_enabled(EventObjectCountAfterGC::eventId); 31.53 +#else 31.54 + return false; 31.55 +#endif // INCLUDE_TRACE 31.56 +} 31.57 + 31.58 +#endif // INCLUDE_SERVICES
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 32.2 +++ b/src/share/vm/gc_implementation/shared/objectCountEventSender.hpp Mon Jul 22 14:01:39 2013 +0100 32.3 @@ -0,0 +1,44 @@ 32.4 +/* 32.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 32.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 32.7 + * 32.8 + * This code is free software; you can redistribute it and/or modify it 32.9 + * under the terms of the GNU General Public License version 2 only, as 32.10 + * published by the Free Software Foundation. 32.11 + * 32.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 32.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 32.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 32.15 + * version 2 for more details (a copy is included in the LICENSE file that 32.16 + * accompanied this code). 32.17 + * 32.18 + * You should have received a copy of the GNU General Public License version 32.19 + * 2 along with this work; if not, write to the Free Software Foundation, 32.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 32.21 + * 32.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 32.23 + * or visit www.oracle.com if you need additional information or have any 32.24 + * questions. 32.25 + * 32.26 + */ 32.27 + 32.28 +#ifndef SHARE_VM_OBJECT_COUNT_EVENT_SENDER_HPP 32.29 +#define SHARE_VM_OBJECT_COUNT_EVENT_SENDER_HPP 32.30 + 32.31 +#include "gc_implementation/shared/gcTrace.hpp" 32.32 +#include "memory/allocation.hpp" 32.33 +#include "utilities/macros.hpp" 32.34 + 32.35 +#if INCLUDE_SERVICES 32.36 + 32.37 +class KlassInfoEntry; 32.38 + 32.39 +class ObjectCountEventSender : public AllStatic { 32.40 + public: 32.41 + static void send(const KlassInfoEntry* entry, GCId gc_id, jlong timestamp); 32.42 + static bool should_send_event(); 32.43 +}; 32.44 + 32.45 +#endif // INCLUDE_SERVICES 32.46 + 32.47 +#endif // SHARE_VM_OBJECT_COUNT_EVENT_SENDER
33.1 --- a/src/share/vm/gc_interface/collectedHeap.cpp Mon Jul 15 11:07:03 2013 +0100 33.2 +++ b/src/share/vm/gc_interface/collectedHeap.cpp Mon Jul 22 14:01:39 2013 +0100 33.3 @@ -85,16 +85,16 @@ 33.4 33.5 MetaspaceSummary CollectedHeap::create_metaspace_summary() { 33.6 const MetaspaceSizes meta_space( 33.7 - 0, /*MetaspaceAux::capacity_in_bytes(),*/ 33.8 - 0, /*MetaspaceAux::used_in_bytes(),*/ 33.9 + MetaspaceAux::allocated_capacity_bytes(), 33.10 + MetaspaceAux::allocated_used_bytes(), 33.11 MetaspaceAux::reserved_in_bytes()); 33.12 const MetaspaceSizes data_space( 33.13 - 0, /*MetaspaceAux::capacity_in_bytes(Metaspace::NonClassType),*/ 33.14 - 0, /*MetaspaceAux::used_in_bytes(Metaspace::NonClassType),*/ 33.15 + MetaspaceAux::allocated_capacity_bytes(Metaspace::NonClassType), 33.16 + MetaspaceAux::allocated_used_bytes(Metaspace::NonClassType), 33.17 MetaspaceAux::reserved_in_bytes(Metaspace::NonClassType)); 33.18 const MetaspaceSizes class_space( 33.19 - 0, /*MetaspaceAux::capacity_in_bytes(Metaspace::ClassType),*/ 33.20 - 0, /*MetaspaceAux::used_in_bytes(Metaspace::ClassType),*/ 33.21 + MetaspaceAux::allocated_capacity_bytes(Metaspace::ClassType), 33.22 + MetaspaceAux::allocated_used_bytes(Metaspace::ClassType), 33.23 MetaspaceAux::reserved_in_bytes(Metaspace::ClassType)); 33.24 33.25 return MetaspaceSummary(meta_space, data_space, class_space);
34.1 --- a/src/share/vm/memory/allocation.cpp Mon Jul 15 11:07:03 2013 +0100 34.2 +++ b/src/share/vm/memory/allocation.cpp Mon Jul 22 14:01:39 2013 +0100 34.3 @@ -236,10 +236,11 @@ 34.4 size_t _num_used; // number of chunks currently checked out 34.5 const size_t _size; // size of each chunk (must be uniform) 34.6 34.7 - // Our three static pools 34.8 + // Our four static pools 34.9 static ChunkPool* _large_pool; 34.10 static ChunkPool* _medium_pool; 34.11 static ChunkPool* _small_pool; 34.12 + static ChunkPool* _tiny_pool; 34.13 34.14 // return first element or null 34.15 void* get_first() { 34.16 @@ -319,15 +320,18 @@ 34.17 static ChunkPool* large_pool() { assert(_large_pool != NULL, "must be initialized"); return _large_pool; } 34.18 static ChunkPool* medium_pool() { assert(_medium_pool != NULL, "must be initialized"); return _medium_pool; } 34.19 static ChunkPool* small_pool() { assert(_small_pool != NULL, "must be initialized"); return _small_pool; } 34.20 + static ChunkPool* tiny_pool() { assert(_tiny_pool != NULL, "must be initialized"); return _tiny_pool; } 34.21 34.22 static void initialize() { 34.23 _large_pool = new ChunkPool(Chunk::size + Chunk::aligned_overhead_size()); 34.24 _medium_pool = new ChunkPool(Chunk::medium_size + Chunk::aligned_overhead_size()); 34.25 _small_pool = new ChunkPool(Chunk::init_size + Chunk::aligned_overhead_size()); 34.26 + _tiny_pool = new ChunkPool(Chunk::tiny_size + Chunk::aligned_overhead_size()); 34.27 } 34.28 34.29 static void clean() { 34.30 enum { BlocksToKeep = 5 }; 34.31 + _tiny_pool->free_all_but(BlocksToKeep); 34.32 _small_pool->free_all_but(BlocksToKeep); 34.33 _medium_pool->free_all_but(BlocksToKeep); 34.34 _large_pool->free_all_but(BlocksToKeep); 34.35 @@ -337,6 +341,7 @@ 34.36 ChunkPool* ChunkPool::_large_pool = NULL; 34.37 ChunkPool* ChunkPool::_medium_pool = NULL; 34.38 ChunkPool* ChunkPool::_small_pool = NULL; 34.39 +ChunkPool* ChunkPool::_tiny_pool = NULL; 34.40 34.41 void chunkpool_init() { 34.42 ChunkPool::initialize(); 34.43 @@ -376,6 +381,7 @@ 34.44 case Chunk::size: return ChunkPool::large_pool()->allocate(bytes, alloc_failmode); 34.45 case Chunk::medium_size: return ChunkPool::medium_pool()->allocate(bytes, alloc_failmode); 34.46 case Chunk::init_size: return ChunkPool::small_pool()->allocate(bytes, alloc_failmode); 34.47 + case Chunk::tiny_size: return ChunkPool::tiny_pool()->allocate(bytes, alloc_failmode); 34.48 default: { 34.49 void* p = os::malloc(bytes, mtChunk, CALLER_PC); 34.50 if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) { 34.51 @@ -392,6 +398,7 @@ 34.52 case Chunk::size: ChunkPool::large_pool()->free(c); break; 34.53 case Chunk::medium_size: ChunkPool::medium_pool()->free(c); break; 34.54 case Chunk::init_size: ChunkPool::small_pool()->free(c); break; 34.55 + case Chunk::tiny_size: ChunkPool::tiny_pool()->free(c); break; 34.56 default: os::free(c, mtChunk); 34.57 } 34.58 }
35.1 --- a/src/share/vm/memory/allocation.hpp Mon Jul 15 11:07:03 2013 +0100 35.2 +++ b/src/share/vm/memory/allocation.hpp Mon Jul 22 14:01:39 2013 +0100 35.3 @@ -353,7 +353,8 @@ 35.4 slack = 20, // suspected sizeof(Chunk) + internal malloc headers 35.5 #endif 35.6 35.7 - init_size = 1*K - slack, // Size of first chunk 35.8 + tiny_size = 256 - slack, // Size of first chunk (tiny) 35.9 + init_size = 1*K - slack, // Size of first chunk (normal aka small) 35.10 medium_size= 10*K - slack, // Size of medium-sized chunk 35.11 size = 32*K - slack, // Default size of an Arena chunk (following the first) 35.12 non_pool_size = init_size + 32 // An initial size which is not one of above
36.1 --- a/src/share/vm/memory/defNewGeneration.cpp Mon Jul 15 11:07:03 2013 +0100 36.2 +++ b/src/share/vm/memory/defNewGeneration.cpp Mon Jul 22 14:01:39 2013 +0100 36.3 @@ -450,11 +450,6 @@ 36.4 } 36.5 } 36.6 36.7 -void DefNewGeneration::object_iterate_since_last_GC(ObjectClosure* cl) { 36.8 - // $$$ This may be wrong in case of "scavenge failure"? 36.9 - eden()->object_iterate(cl); 36.10 -} 36.11 - 36.12 void DefNewGeneration::younger_refs_iterate(OopsInGenClosure* cl) { 36.13 assert(false, "NYI -- are you sure you want to call this?"); 36.14 }
37.1 --- a/src/share/vm/memory/defNewGeneration.hpp Mon Jul 15 11:07:03 2013 +0100 37.2 +++ b/src/share/vm/memory/defNewGeneration.hpp Mon Jul 22 14:01:39 2013 +0100 37.3 @@ -252,7 +252,6 @@ 37.4 37.5 // Iteration 37.6 void object_iterate(ObjectClosure* blk); 37.7 - void object_iterate_since_last_GC(ObjectClosure* cl); 37.8 37.9 void younger_refs_iterate(OopsInGenClosure* cl); 37.10
38.1 --- a/src/share/vm/memory/genCollectedHeap.cpp Mon Jul 15 11:07:03 2013 +0100 38.2 +++ b/src/share/vm/memory/genCollectedHeap.cpp Mon Jul 22 14:01:39 2013 +0100 38.3 @@ -42,7 +42,6 @@ 38.4 #include "memory/space.hpp" 38.5 #include "oops/oop.inline.hpp" 38.6 #include "oops/oop.inline2.hpp" 38.7 -#include "runtime/aprofiler.hpp" 38.8 #include "runtime/biasedLocking.hpp" 38.9 #include "runtime/fprofiler.hpp" 38.10 #include "runtime/handles.hpp" 38.11 @@ -873,12 +872,6 @@ 38.12 } 38.13 } 38.14 38.15 -void GenCollectedHeap::object_iterate_since_last_GC(ObjectClosure* cl) { 38.16 - for (int i = 0; i < _n_gens; i++) { 38.17 - _gens[i]->object_iterate_since_last_GC(cl); 38.18 - } 38.19 -} 38.20 - 38.21 Space* GenCollectedHeap::space_containing(const void* addr) const { 38.22 for (int i = 0; i < _n_gens; i++) { 38.23 Space* res = _gens[i]->space_containing(addr); 38.24 @@ -1186,8 +1179,6 @@ 38.25 CollectedHeap::accumulate_statistics_all_tlabs(); 38.26 ensure_parsability(true); // retire TLABs 38.27 38.28 - // Call allocation profiler 38.29 - AllocationProfiler::iterate_since_last_gc(); 38.30 // Walk generations 38.31 GenGCPrologueClosure blk(full); 38.32 generation_iterate(&blk, false); // not old-to-young.
39.1 --- a/src/share/vm/memory/genCollectedHeap.hpp Mon Jul 15 11:07:03 2013 +0100 39.2 +++ b/src/share/vm/memory/genCollectedHeap.hpp Mon Jul 22 14:01:39 2013 +0100 39.3 @@ -222,7 +222,6 @@ 39.4 void oop_iterate(MemRegion mr, ExtendedOopClosure* cl); 39.5 void object_iterate(ObjectClosure* cl); 39.6 void safe_object_iterate(ObjectClosure* cl); 39.7 - void object_iterate_since_last_GC(ObjectClosure* cl); 39.8 Space* space_containing(const void* addr) const; 39.9 39.10 // A CollectedHeap is divided into a dense sequence of "blocks"; that is,
40.1 --- a/src/share/vm/memory/generation.cpp Mon Jul 15 11:07:03 2013 +0100 40.2 +++ b/src/share/vm/memory/generation.cpp Mon Jul 22 14:01:39 2013 +0100 40.3 @@ -811,16 +811,6 @@ 40.4 blk->do_space(_the_space); 40.5 } 40.6 40.7 -void OneContigSpaceCardGeneration::object_iterate_since_last_GC(ObjectClosure* blk) { 40.8 - // Deal with delayed initialization of _the_space, 40.9 - // and lack of initialization of _last_gc. 40.10 - if (_last_gc.space() == NULL) { 40.11 - assert(the_space() != NULL, "shouldn't be NULL"); 40.12 - _last_gc = the_space()->bottom_mark(); 40.13 - } 40.14 - the_space()->object_iterate_from(_last_gc, blk); 40.15 -} 40.16 - 40.17 void OneContigSpaceCardGeneration::younger_refs_iterate(OopsInGenClosure* blk) { 40.18 blk->set_generation(this); 40.19 younger_refs_in_space_iterate(_the_space, blk);
41.1 --- a/src/share/vm/memory/generation.hpp Mon Jul 15 11:07:03 2013 +0100 41.2 +++ b/src/share/vm/memory/generation.hpp Mon Jul 22 14:01:39 2013 +0100 41.3 @@ -551,12 +551,6 @@ 41.4 // the heap. This defaults to object_iterate() unless overridden. 41.5 virtual void safe_object_iterate(ObjectClosure* cl); 41.6 41.7 - // Iterate over all objects allocated in the generation since the last 41.8 - // collection, calling "cl.do_object" on each. The generation must have 41.9 - // been initialized properly to support this function, or else this call 41.10 - // will fail. 41.11 - virtual void object_iterate_since_last_GC(ObjectClosure* cl) = 0; 41.12 - 41.13 // Apply "cl->do_oop" to (the address of) all and only all the ref fields 41.14 // in the current generation that contain pointers to objects in younger 41.15 // generations. Objects allocated since the last "save_marks" call are 41.16 @@ -724,7 +718,6 @@ 41.17 // Iteration 41.18 void object_iterate(ObjectClosure* blk); 41.19 void space_iterate(SpaceClosure* blk, bool usedOnly = false); 41.20 - void object_iterate_since_last_GC(ObjectClosure* cl); 41.21 41.22 void younger_refs_iterate(OopsInGenClosure* blk); 41.23
42.1 --- a/src/share/vm/memory/heapInspection.hpp Mon Jul 15 11:07:03 2013 +0100 42.2 +++ b/src/share/vm/memory/heapInspection.hpp Mon Jul 22 14:01:39 2013 +0100 42.3 @@ -26,7 +26,6 @@ 42.4 #define SHARE_VM_MEMORY_HEAPINSPECTION_HPP 42.5 42.6 #include "memory/allocation.inline.hpp" 42.7 -#include "memory/klassInfoClosure.hpp" 42.8 #include "oops/oop.inline.hpp" 42.9 #include "oops/annotations.hpp" 42.10 #include "utilities/macros.hpp" 42.11 @@ -204,6 +203,12 @@ 42.12 const char* name() const; 42.13 }; 42.14 42.15 +class KlassInfoClosure : public StackObj { 42.16 + public: 42.17 + // Called for each KlassInfoEntry. 42.18 + virtual void do_cinfo(KlassInfoEntry* cie) = 0; 42.19 +}; 42.20 + 42.21 class KlassInfoBucket: public CHeapObj<mtInternal> { 42.22 private: 42.23 KlassInfoEntry* _list;
43.1 --- a/src/share/vm/memory/klassInfoClosure.hpp Mon Jul 15 11:07:03 2013 +0100 43.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 43.3 @@ -1,36 +0,0 @@ 43.4 -/* 43.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 43.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 43.7 - * 43.8 - * This code is free software; you can redistribute it and/or modify it 43.9 - * under the terms of the GNU General Public License version 2 only, as 43.10 - * published by the Free Software Foundation. 43.11 - * 43.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 43.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 43.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 43.15 - * version 2 for more details (a copy is included in the LICENSE file that 43.16 - * accompanied this code). 43.17 - * 43.18 - * You should have received a copy of the GNU General Public License version 43.19 - * 2 along with this work; if not, write to the Free Software Foundation, 43.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 43.21 - * 43.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 43.23 - * or visit www.oracle.com if you need additional information or have any 43.24 - * questions. 43.25 - * 43.26 - */ 43.27 - 43.28 -#ifndef SHARE_VM_MEMORY_KLASSINFOCLOSURE_HPP 43.29 -#define SHARE_VM_MEMORY_KLASSINFOCLOSURE_HPP 43.30 - 43.31 -class KlassInfoEntry; 43.32 - 43.33 -class KlassInfoClosure : public StackObj { 43.34 - public: 43.35 - // Called for each KlassInfoEntry. 43.36 - virtual void do_cinfo(KlassInfoEntry* cie) = 0; 43.37 -}; 43.38 - 43.39 -#endif // SHARE_VM_MEMORY_KLASSINFOCLOSURE_HPP
44.1 --- a/src/share/vm/memory/sharedHeap.hpp Mon Jul 15 11:07:03 2013 +0100 44.2 +++ b/src/share/vm/memory/sharedHeap.hpp Mon Jul 22 14:01:39 2013 +0100 44.3 @@ -166,11 +166,6 @@ 44.4 // Same as above, restricted to a memory region. 44.5 virtual void oop_iterate(MemRegion mr, ExtendedOopClosure* cl) = 0; 44.6 44.7 - // Iterate over all objects allocated since the last collection, calling 44.8 - // "cl->do_object" on each. The heap must have been initialized properly 44.9 - // to support this function, or else this call will fail. 44.10 - virtual void object_iterate_since_last_GC(ObjectClosure* cl) = 0; 44.11 - 44.12 // Iterate over all spaces in use in the heap, in an undefined order. 44.13 virtual void space_iterate(SpaceClosure* cl) = 0; 44.14
45.1 --- a/src/share/vm/memory/universe.cpp Mon Jul 15 11:07:03 2013 +0100 45.2 +++ b/src/share/vm/memory/universe.cpp Mon Jul 22 14:01:39 2013 +0100 45.3 @@ -52,7 +52,6 @@ 45.4 #include "oops/oop.inline.hpp" 45.5 #include "oops/typeArrayKlass.hpp" 45.6 #include "prims/jvmtiRedefineClassesTrace.hpp" 45.7 -#include "runtime/aprofiler.hpp" 45.8 #include "runtime/arguments.hpp" 45.9 #include "runtime/deoptimization.hpp" 45.10 #include "runtime/fprofiler.hpp"
46.1 --- a/src/share/vm/oops/arrayKlass.cpp Mon Jul 15 11:07:03 2013 +0100 46.2 +++ b/src/share/vm/oops/arrayKlass.cpp Mon Jul 22 14:01:39 2013 +0100 46.3 @@ -71,7 +71,6 @@ 46.4 } 46.5 46.6 ArrayKlass::ArrayKlass(Symbol* name) { 46.7 - set_alloc_size(0); 46.8 set_name(name); 46.9 46.10 set_super(Universe::is_bootstrapping() ? (Klass*)NULL : SystemDictionary::Object_klass()); 46.11 @@ -161,12 +160,6 @@ 46.12 } 46.13 } 46.14 46.15 - 46.16 -void ArrayKlass::with_array_klasses_do(void f(Klass* k)) { 46.17 - array_klasses_do(f); 46.18 -} 46.19 - 46.20 - 46.21 // GC support 46.22 46.23 void ArrayKlass::oops_do(OopClosure* cl) {
47.1 --- a/src/share/vm/oops/arrayKlass.hpp Mon Jul 15 11:07:03 2013 +0100 47.2 +++ b/src/share/vm/oops/arrayKlass.hpp Mon Jul 22 14:01:39 2013 +0100 47.3 @@ -39,7 +39,6 @@ 47.4 Klass* volatile _higher_dimension; // Refers the (n+1)'th-dimensional array (if present). 47.5 Klass* volatile _lower_dimension; // Refers the (n-1)'th-dimensional array (if present). 47.6 int _vtable_len; // size of vtable for this klass 47.7 - juint _alloc_size; // allocation profiling support 47.8 oop _component_mirror; // component type, as a java/lang/Class 47.9 47.10 protected: 47.11 @@ -65,10 +64,6 @@ 47.12 void set_lower_dimension(Klass* k) { _lower_dimension = k; } 47.13 Klass** adr_lower_dimension() { return (Klass**)&this->_lower_dimension;} 47.14 47.15 - // Allocation profiling support 47.16 - juint alloc_size() const { return _alloc_size; } 47.17 - void set_alloc_size(juint n) { _alloc_size = n; } 47.18 - 47.19 // offset of first element, including any padding for the sake of alignment 47.20 int array_header_in_bytes() const { return layout_helper_header_size(layout_helper()); } 47.21 int log2_element_size() const { return layout_helper_log2_element_size(layout_helper()); } 47.22 @@ -126,7 +121,6 @@ 47.23 // Iterators 47.24 void array_klasses_do(void f(Klass* k)); 47.25 void array_klasses_do(void f(Klass* k, TRAPS), TRAPS); 47.26 - void with_array_klasses_do(void f(Klass* k)); 47.27 47.28 // GC support 47.29 virtual void oops_do(OopClosure* cl);
48.1 --- a/src/share/vm/oops/instanceKlass.cpp Mon Jul 15 11:07:03 2013 +0100 48.2 +++ b/src/share/vm/oops/instanceKlass.cpp Mon Jul 22 14:01:39 2013 +0100 48.3 @@ -1321,12 +1321,6 @@ 48.4 ArrayKlass::cast(array_klasses())->array_klasses_do(f); 48.5 } 48.6 48.7 - 48.8 -void InstanceKlass::with_array_klasses_do(void f(Klass* k)) { 48.9 - f(this); 48.10 - array_klasses_do(f); 48.11 -} 48.12 - 48.13 #ifdef ASSERT 48.14 static int linear_search(Array<Method*>* methods, Symbol* name, Symbol* signature) { 48.15 int len = methods->length();
49.1 --- a/src/share/vm/oops/instanceKlass.hpp Mon Jul 15 11:07:03 2013 +0100 49.2 +++ b/src/share/vm/oops/instanceKlass.hpp Mon Jul 22 14:01:39 2013 +0100 49.3 @@ -794,7 +794,6 @@ 49.4 void methods_do(void f(Method* method)); 49.5 void array_klasses_do(void f(Klass* k)); 49.6 void array_klasses_do(void f(Klass* k, TRAPS), TRAPS); 49.7 - void with_array_klasses_do(void f(Klass* k)); 49.8 bool super_types_do(SuperTypeClosure* blk); 49.9 49.10 // Casting from Klass* 49.11 @@ -874,10 +873,6 @@ 49.12 } 49.13 } 49.14 49.15 - // Allocation profiling support 49.16 - juint alloc_size() const { return _alloc_count * size_helper(); } 49.17 - void set_alloc_size(juint n) {} 49.18 - 49.19 // Use this to return the size of an instance in heap words: 49.20 int size_helper() const { 49.21 return layout_helper_to_size_helper(layout_helper());
50.1 --- a/src/share/vm/oops/klass.cpp Mon Jul 15 11:07:03 2013 +0100 50.2 +++ b/src/share/vm/oops/klass.cpp Mon Jul 22 14:01:39 2013 +0100 50.3 @@ -168,7 +168,6 @@ 50.4 set_subklass(NULL); 50.5 set_next_sibling(NULL); 50.6 set_next_link(NULL); 50.7 - set_alloc_count(0); 50.8 TRACE_INIT_ID(this); 50.9 50.10 set_prototype_header(markOopDesc::prototype()); 50.11 @@ -543,12 +542,6 @@ 50.12 return NULL; 50.13 } 50.14 50.15 - 50.16 -void Klass::with_array_klasses_do(void f(Klass* k)) { 50.17 - f(this); 50.18 -} 50.19 - 50.20 - 50.21 oop Klass::class_loader() const { return class_loader_data()->class_loader(); } 50.22 50.23 const char* Klass::external_name() const {
51.1 --- a/src/share/vm/oops/klass.hpp Mon Jul 15 11:07:03 2013 +0100 51.2 +++ b/src/share/vm/oops/klass.hpp Mon Jul 22 14:01:39 2013 +0100 51.3 @@ -79,7 +79,6 @@ 51.4 // [last_biased_lock_bulk_revocation_time] (64 bits) 51.5 // [prototype_header] 51.6 // [biased_lock_revocation_count] 51.7 -// [alloc_count ] 51.8 // [_modified_oops] 51.9 // [_accumulated_modified_oops] 51.10 // [trace_id] 51.11 @@ -171,8 +170,6 @@ 51.12 markOop _prototype_header; // Used when biased locking is both enabled and disabled for this type 51.13 jint _biased_lock_revocation_count; 51.14 51.15 - juint _alloc_count; // allocation profiling support 51.16 - 51.17 TRACE_DEFINE_KLASS_TRACE_ID; 51.18 51.19 // Remembered sets support for the oops in the klasses. 51.20 @@ -290,11 +287,6 @@ 51.21 void set_next_sibling(Klass* s); 51.22 51.23 public: 51.24 - // Allocation profiling support 51.25 - juint alloc_count() const { return _alloc_count; } 51.26 - void set_alloc_count(juint n) { _alloc_count = n; } 51.27 - virtual juint alloc_size() const = 0; 51.28 - virtual void set_alloc_size(juint n) = 0; 51.29 51.30 // Compiler support 51.31 static ByteSize super_offset() { return in_ByteSize(offset_of(Klass, _super)); } 51.32 @@ -677,7 +669,6 @@ 51.33 #endif // INCLUDE_ALL_GCS 51.34 51.35 virtual void array_klasses_do(void f(Klass* k)) {} 51.36 - virtual void with_array_klasses_do(void f(Klass* k)); 51.37 51.38 // Return self, except for abstract classes with exactly 1 51.39 // implementor. Then return the 1 concrete implementation.
52.1 --- a/src/share/vm/prims/jni.cpp Mon Jul 15 11:07:03 2013 +0100 52.2 +++ b/src/share/vm/prims/jni.cpp Mon Jul 22 14:01:39 2013 +0100 52.3 @@ -5097,7 +5097,7 @@ 52.4 // function used to determine this will always return false. Atomic::xchg 52.5 // does not have this problem. 52.6 if (Atomic::xchg(1, &vm_created) == 1) { 52.7 - return JNI_ERR; // already created, or create attempt in progress 52.8 + return JNI_EEXIST; // already created, or create attempt in progress 52.9 } 52.10 if (Atomic::xchg(0, &safe_to_recreate_vm) == 0) { 52.11 return JNI_ERR; // someone tried and failed and retry not allowed. 52.12 @@ -5138,9 +5138,21 @@ 52.13 event.commit(); 52.14 } 52.15 52.16 +#ifndef PRODUCT 52.17 + #ifndef TARGET_OS_FAMILY_windows 52.18 + #define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) f() 52.19 + #endif 52.20 + 52.21 // Check if we should compile all classes on bootclasspath 52.22 - NOT_PRODUCT(if (CompileTheWorld) ClassLoader::compile_the_world();) 52.23 - NOT_PRODUCT(if (ReplayCompiles) ciReplay::replay(thread);) 52.24 + if (CompileTheWorld) ClassLoader::compile_the_world(); 52.25 + if (ReplayCompiles) ciReplay::replay(thread); 52.26 + 52.27 + // Some platforms (like Win*) need a wrapper around these test 52.28 + // functions in order to properly handle error conditions. 52.29 + CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(test_error_handler); 52.30 + CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(execute_internal_vm_tests); 52.31 +#endif 52.32 + 52.33 // Since this is not a JVM_ENTRY we have to set the thread state manually before leaving. 52.34 ThreadStateTransition::transition_and_fence(thread, _thread_in_vm, _thread_in_native); 52.35 } else { 52.36 @@ -5157,8 +5169,6 @@ 52.37 OrderAccess::release_store(&vm_created, 0); 52.38 } 52.39 52.40 - NOT_PRODUCT(test_error_handler(ErrorHandlerTest)); 52.41 - NOT_PRODUCT(execute_internal_vm_tests()); 52.42 return result; 52.43 } 52.44
53.1 --- a/src/share/vm/prims/jvm.cpp Mon Jul 15 11:07:03 2013 +0100 53.2 +++ b/src/share/vm/prims/jvm.cpp Mon Jul 22 14:01:39 2013 +0100 53.3 @@ -1121,26 +1121,6 @@ 53.4 JVM_END 53.5 53.6 53.7 -// Obsolete since 1.2 (Class.setProtectionDomain removed), although 53.8 -// still defined in core libraries as of 1.5. 53.9 -JVM_ENTRY(void, JVM_SetProtectionDomain(JNIEnv *env, jclass cls, jobject protection_domain)) 53.10 - JVMWrapper("JVM_SetProtectionDomain"); 53.11 - if (JNIHandles::resolve(cls) == NULL) { 53.12 - THROW(vmSymbols::java_lang_NullPointerException()); 53.13 - } 53.14 - if (!java_lang_Class::is_primitive(JNIHandles::resolve(cls))) { 53.15 - // Call is ignored for primitive types 53.16 - Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls)); 53.17 - 53.18 - // cls won't be an array, as this called only from ClassLoader.defineClass 53.19 - if (k->oop_is_instance()) { 53.20 - oop pd = JNIHandles::resolve(protection_domain); 53.21 - assert(pd == NULL || pd->is_oop(), "just checking"); 53.22 - java_lang_Class::set_protection_domain(k->java_mirror(), pd); 53.23 - } 53.24 - } 53.25 -JVM_END 53.26 - 53.27 static bool is_authorized(Handle context, instanceKlassHandle klass, TRAPS) { 53.28 // If there is a security manager and protection domain, check the access 53.29 // in the protection domain, otherwise it is authorized.
54.1 --- a/src/share/vm/prims/jvm.h Mon Jul 15 11:07:03 2013 +0100 54.2 +++ b/src/share/vm/prims/jvm.h Mon Jul 22 14:01:39 2013 +0100 54.3 @@ -471,9 +471,6 @@ 54.4 JNIEXPORT jobject JNICALL 54.5 JVM_GetProtectionDomain(JNIEnv *env, jclass cls); 54.6 54.7 -JNIEXPORT void JNICALL 54.8 -JVM_SetProtectionDomain(JNIEnv *env, jclass cls, jobject protection_domain); 54.9 - 54.10 JNIEXPORT jboolean JNICALL 54.11 JVM_IsArrayClass(JNIEnv *env, jclass cls); 54.12
55.1 --- a/src/share/vm/runtime/aprofiler.cpp Mon Jul 15 11:07:03 2013 +0100 55.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 55.3 @@ -1,143 +0,0 @@ 55.4 -/* 55.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 55.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 55.7 - * 55.8 - * This code is free software; you can redistribute it and/or modify it 55.9 - * under the terms of the GNU General Public License version 2 only, as 55.10 - * published by the Free Software Foundation. 55.11 - * 55.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 55.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 55.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 55.15 - * version 2 for more details (a copy is included in the LICENSE file that 55.16 - * accompanied this code). 55.17 - * 55.18 - * You should have received a copy of the GNU General Public License version 55.19 - * 2 along with this work; if not, write to the Free Software Foundation, 55.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 55.21 - * 55.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 55.23 - * or visit www.oracle.com if you need additional information or have any 55.24 - * questions. 55.25 - * 55.26 - */ 55.27 - 55.28 -#include "precompiled.hpp" 55.29 -#include "classfile/systemDictionary.hpp" 55.30 -#include "gc_interface/collectedHeap.inline.hpp" 55.31 -#include "memory/resourceArea.hpp" 55.32 -#include "memory/space.hpp" 55.33 -#include "oops/oop.inline.hpp" 55.34 -#include "oops/oop.inline2.hpp" 55.35 -#include "runtime/aprofiler.hpp" 55.36 - 55.37 - 55.38 -bool AllocationProfiler::_active = false; 55.39 -GrowableArray<Klass*>* AllocationProfiler::_print_array = NULL; 55.40 - 55.41 - 55.42 -class AllocProfClosure : public ObjectClosure { 55.43 - public: 55.44 - void do_object(oop obj) { 55.45 - Klass* k = obj->klass(); 55.46 - k->set_alloc_count(k->alloc_count() + 1); 55.47 - k->set_alloc_size(k->alloc_size() + obj->size()); 55.48 - } 55.49 -}; 55.50 - 55.51 - 55.52 -void AllocationProfiler::iterate_since_last_gc() { 55.53 - if (is_active()) { 55.54 - AllocProfClosure blk; 55.55 - GenCollectedHeap* heap = GenCollectedHeap::heap(); 55.56 - heap->object_iterate_since_last_GC(&blk); 55.57 - } 55.58 -} 55.59 - 55.60 - 55.61 -void AllocationProfiler::engage() { 55.62 - _active = true; 55.63 -} 55.64 - 55.65 - 55.66 -void AllocationProfiler::disengage() { 55.67 - _active = false; 55.68 -} 55.69 - 55.70 - 55.71 -void AllocationProfiler::add_class_to_array(Klass* k) { 55.72 - _print_array->append(k); 55.73 -} 55.74 - 55.75 - 55.76 -void AllocationProfiler::add_classes_to_array(Klass* k) { 55.77 - // Iterate over klass and all array klasses for klass 55.78 - k->with_array_klasses_do(&AllocationProfiler::add_class_to_array); 55.79 -} 55.80 - 55.81 - 55.82 -int AllocationProfiler::compare_classes(Klass** k1, Klass** k2) { 55.83 - // Sort by total allocation size 55.84 - return (*k2)->alloc_size() - (*k1)->alloc_size(); 55.85 -} 55.86 - 55.87 - 55.88 -int AllocationProfiler::average(size_t alloc_size, int alloc_count) { 55.89 - return (int) ((double) (alloc_size * BytesPerWord) / MAX2(alloc_count, 1) + 0.5); 55.90 -} 55.91 - 55.92 - 55.93 -void AllocationProfiler::sort_and_print_array(size_t cutoff) { 55.94 - _print_array->sort(&AllocationProfiler::compare_classes); 55.95 - tty->print_cr("________________Size" 55.96 - "__Instances" 55.97 - "__Average" 55.98 - "__Class________________"); 55.99 - size_t total_alloc_size = 0; 55.100 - int total_alloc_count = 0; 55.101 - for (int index = 0; index < _print_array->length(); index++) { 55.102 - Klass* k = _print_array->at(index); 55.103 - size_t alloc_size = k->alloc_size(); 55.104 - if (alloc_size > cutoff) { 55.105 - int alloc_count = k->alloc_count(); 55.106 -#ifdef PRODUCT 55.107 - const char* name = k->external_name(); 55.108 -#else 55.109 - const char* name = k->internal_name(); 55.110 -#endif 55.111 - tty->print_cr("%20u %10u %8u %s", 55.112 - alloc_size * BytesPerWord, 55.113 - alloc_count, 55.114 - average(alloc_size, alloc_count), 55.115 - name); 55.116 - total_alloc_size += alloc_size; 55.117 - total_alloc_count += alloc_count; 55.118 - } 55.119 - k->set_alloc_count(0); 55.120 - k->set_alloc_size(0); 55.121 - } 55.122 - tty->print_cr("%20u %10u %8u --total--", 55.123 - total_alloc_size * BytesPerWord, 55.124 - total_alloc_count, 55.125 - average(total_alloc_size, total_alloc_count)); 55.126 - tty->cr(); 55.127 -} 55.128 - 55.129 - 55.130 -void AllocationProfiler::print(size_t cutoff) { 55.131 - ResourceMark rm; 55.132 - assert(!is_active(), "AllocationProfiler cannot be active while printing profile"); 55.133 - 55.134 - tty->cr(); 55.135 - tty->print_cr("Allocation profile (sizes in bytes, cutoff = " SIZE_FORMAT " bytes):", cutoff * BytesPerWord); 55.136 - tty->cr(); 55.137 - 55.138 - // Print regular instance klasses and basic type array klasses 55.139 - _print_array = new GrowableArray<Klass*>(SystemDictionary::number_of_classes()*2); 55.140 - SystemDictionary::classes_do(&add_classes_to_array); 55.141 - Universe::basic_type_classes_do(&add_classes_to_array); 55.142 - sort_and_print_array(cutoff); 55.143 - 55.144 - // This used to print metadata in the permgen but since there isn't a permgen 55.145 - // anymore, it is not yet implemented. 55.146 -}
56.1 --- a/src/share/vm/runtime/aprofiler.hpp Mon Jul 15 11:07:03 2013 +0100 56.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 56.3 @@ -1,71 +0,0 @@ 56.4 -/* 56.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 56.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 56.7 - * 56.8 - * This code is free software; you can redistribute it and/or modify it 56.9 - * under the terms of the GNU General Public License version 2 only, as 56.10 - * published by the Free Software Foundation. 56.11 - * 56.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 56.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 56.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 56.15 - * version 2 for more details (a copy is included in the LICENSE file that 56.16 - * accompanied this code). 56.17 - * 56.18 - * You should have received a copy of the GNU General Public License version 56.19 - * 2 along with this work; if not, write to the Free Software Foundation, 56.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 56.21 - * 56.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 56.23 - * or visit www.oracle.com if you need additional information or have any 56.24 - * questions. 56.25 - * 56.26 - */ 56.27 - 56.28 -#ifndef SHARE_VM_RUNTIME_APROFILER_HPP 56.29 -#define SHARE_VM_RUNTIME_APROFILER_HPP 56.30 - 56.31 -#include "memory/allocation.hpp" 56.32 -#include "memory/universe.hpp" 56.33 -#include "oops/klass.hpp" 56.34 -#include "utilities/top.hpp" 56.35 - 56.36 -// A simple allocation profiler for Java. The profiler collects and prints 56.37 -// the number and total size of instances allocated per class, including 56.38 -// array classes. 56.39 -// 56.40 -// The profiler is currently global for all threads. It can be changed to a 56.41 -// per threads profiler by keeping a more elaborate data structure and calling 56.42 -// iterate_since_last_scavenge at thread switches. 56.43 - 56.44 - 56.45 -class AllocationProfiler: AllStatic { 56.46 - friend class GenCollectedHeap; 56.47 - friend class G1CollectedHeap; 56.48 - friend class MarkSweep; 56.49 - private: 56.50 - static bool _active; // tells whether profiler is active 56.51 - static GrowableArray<Klass*>* _print_array; // temporary array for printing 56.52 - 56.53 - // Utility printing functions 56.54 - static void add_class_to_array(Klass* k); 56.55 - static void add_classes_to_array(Klass* k); 56.56 - static int compare_classes(Klass** k1, Klass** k2); 56.57 - static int average(size_t alloc_size, int alloc_count); 56.58 - static void sort_and_print_array(size_t cutoff); 56.59 - 56.60 - // Call for collecting allocation information. Called at scavenge, mark-sweep and disengage. 56.61 - static void iterate_since_last_gc(); 56.62 - 56.63 - public: 56.64 - // Start profiler 56.65 - static void engage(); 56.66 - // Stop profiler 56.67 - static void disengage(); 56.68 - // Tells whether profiler is active 56.69 - static bool is_active() { return _active; } 56.70 - // Print profile 56.71 - static void print(size_t cutoff); // Cutoff in total allocation size (in words) 56.72 -}; 56.73 - 56.74 -#endif // SHARE_VM_RUNTIME_APROFILER_HPP
57.1 --- a/src/share/vm/runtime/arguments.cpp Mon Jul 15 11:07:03 2013 +0100 57.2 +++ b/src/share/vm/runtime/arguments.cpp Mon Jul 22 14:01:39 2013 +0100 57.3 @@ -68,7 +68,6 @@ 57.4 SystemProperty* Arguments::_system_properties = NULL; 57.5 const char* Arguments::_gc_log_filename = NULL; 57.6 bool Arguments::_has_profile = false; 57.7 -bool Arguments::_has_alloc_profile = false; 57.8 uintx Arguments::_min_heap_size = 0; 57.9 Arguments::Mode Arguments::_mode = _mixed; 57.10 bool Arguments::_java_compiler = false; 57.11 @@ -261,6 +260,9 @@ 57.12 { "PrintRevisitStats", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 57.13 { "UseVectoredExceptions", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 57.14 { "UseSplitVerifier", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 57.15 + { "UseISM", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 57.16 + { "UsePermISM", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 57.17 + { "UseMPSS", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 57.18 #ifdef PRODUCT 57.19 { "DesiredMethodLimit", 57.20 JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) }, 57.21 @@ -1855,8 +1857,13 @@ 57.22 "please refer to the release notes for the combinations " 57.23 "allowed\n"); 57.24 status = false; 57.25 + } else if (ReservedCodeCacheSize > 2*G) { 57.26 + // Code cache size larger than MAXINT is not supported. 57.27 + jio_fprintf(defaultStream::error_stream(), 57.28 + "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M, 57.29 + (2*G)/M); 57.30 + status = false; 57.31 } 57.32 - 57.33 return status; 57.34 } 57.35 57.36 @@ -1986,23 +1993,6 @@ 57.37 status = status && check_gc_consistency(); 57.38 status = status && check_stack_pages(); 57.39 57.40 - if (_has_alloc_profile) { 57.41 - if (UseParallelGC || UseParallelOldGC) { 57.42 - jio_fprintf(defaultStream::error_stream(), 57.43 - "error: invalid argument combination.\n" 57.44 - "Allocation profiling (-Xaprof) cannot be used together with " 57.45 - "Parallel GC (-XX:+UseParallelGC or -XX:+UseParallelOldGC).\n"); 57.46 - status = false; 57.47 - } 57.48 - if (UseConcMarkSweepGC) { 57.49 - jio_fprintf(defaultStream::error_stream(), 57.50 - "error: invalid argument combination.\n" 57.51 - "Allocation profiling (-Xaprof) cannot be used together with " 57.52 - "the CMS collector (-XX:+UseConcMarkSweepGC).\n"); 57.53 - status = false; 57.54 - } 57.55 - } 57.56 - 57.57 if (CMSIncrementalMode) { 57.58 if (!UseConcMarkSweepGC) { 57.59 jio_fprintf(defaultStream::error_stream(), 57.60 @@ -2239,8 +2229,13 @@ 57.61 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K, 57.62 min_code_cache_size/K); 57.63 status = false; 57.64 + } else if (ReservedCodeCacheSize > 2*G) { 57.65 + // Code cache size larger than MAXINT is not supported. 57.66 + jio_fprintf(defaultStream::error_stream(), 57.67 + "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M, 57.68 + (2*G)/M); 57.69 + status = false; 57.70 } 57.71 - 57.72 return status; 57.73 } 57.74 57.75 @@ -2700,9 +2695,6 @@ 57.76 "Flat profiling is not supported in this VM.\n"); 57.77 return JNI_ERR; 57.78 #endif // INCLUDE_FPROF 57.79 - // -Xaprof 57.80 - } else if (match_option(option, "-Xaprof", &tail)) { 57.81 - _has_alloc_profile = true; 57.82 // -Xconcurrentio 57.83 } else if (match_option(option, "-Xconcurrentio", &tail)) { 57.84 FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true); 57.85 @@ -2957,13 +2949,6 @@ 57.86 FLAG_SET_CMDLINE(bool, UseTLAB, true); 57.87 } else if (match_option(option, "-XX:-UseTLE", &tail)) { 57.88 FLAG_SET_CMDLINE(bool, UseTLAB, false); 57.89 -SOLARIS_ONLY( 57.90 - } else if (match_option(option, "-XX:+UsePermISM", &tail)) { 57.91 - warning("-XX:+UsePermISM is obsolete."); 57.92 - FLAG_SET_CMDLINE(bool, UseISM, true); 57.93 - } else if (match_option(option, "-XX:-UsePermISM", &tail)) { 57.94 - FLAG_SET_CMDLINE(bool, UseISM, false); 57.95 -) 57.96 } else if (match_option(option, "-XX:+DisplayVMOutputToStderr", &tail)) { 57.97 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, false); 57.98 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, true); 57.99 @@ -3136,8 +3121,6 @@ 57.100 // Note that large pages are enabled/disabled for both the 57.101 // Java heap and the code cache. 57.102 FLAG_SET_DEFAULT(UseLargePages, false); 57.103 - SOLARIS_ONLY(FLAG_SET_DEFAULT(UseMPSS, false)); 57.104 - SOLARIS_ONLY(FLAG_SET_DEFAULT(UseISM, false)); 57.105 } 57.106 57.107 // Tiered compilation is undefined with C1.
58.1 --- a/src/share/vm/runtime/arguments.hpp Mon Jul 15 11:07:03 2013 +0100 58.2 +++ b/src/share/vm/runtime/arguments.hpp Mon Jul 22 14:01:39 2013 +0100 58.3 @@ -262,7 +262,6 @@ 58.4 58.5 // Option flags 58.6 static bool _has_profile; 58.7 - static bool _has_alloc_profile; 58.8 static const char* _gc_log_filename; 58.9 static uintx _min_heap_size; 58.10 58.11 @@ -464,9 +463,8 @@ 58.12 // -Xloggc:<file>, if not specified will be NULL 58.13 static const char* gc_log_filename() { return _gc_log_filename; } 58.14 58.15 - // -Xprof/-Xaprof 58.16 + // -Xprof 58.17 static bool has_profile() { return _has_profile; } 58.18 - static bool has_alloc_profile() { return _has_alloc_profile; } 58.19 58.20 // -Xms, -Xmx 58.21 static uintx min_heap_size() { return _min_heap_size; }
59.1 --- a/src/share/vm/runtime/globals.hpp Mon Jul 15 11:07:03 2013 +0100 59.2 +++ b/src/share/vm/runtime/globals.hpp Mon Jul 22 14:01:39 2013 +0100 59.3 @@ -175,6 +175,7 @@ 59.4 define_pd_global(intx, ReservedCodeCacheSize, 32*M); 59.5 define_pd_global(intx, CodeCacheExpansionSize, 32*K); 59.6 define_pd_global(intx, CodeCacheMinBlockLength, 1); 59.7 +define_pd_global(intx, CodeCacheMinimumUseSpace, 200*K); 59.8 define_pd_global(uintx,MetaspaceSize, ScaleForWordSize(4*M)); 59.9 define_pd_global(bool, NeverActAsServerClassMachine, true); 59.10 define_pd_global(uint64_t,MaxRAM, 1ULL*G); 59.11 @@ -3679,6 +3680,9 @@ 59.12 develop(bool, VerifyGenericSignatures, false, \ 59.13 "Abort VM on erroneous or inconsistent generic signatures") \ 59.14 \ 59.15 + product(bool, ParseGenericDefaults, false, \ 59.16 + "Parse generic signatures for default method handling") \ 59.17 + \ 59.18 product(bool, UseVMInterruptibleIO, false, \ 59.19 "(Unstable, Solaris-specific) Thread interrupt before or with " \ 59.20 "EINTR for I/O operations results in OS_INTRPT. The default value"\
60.1 --- a/src/share/vm/runtime/handles.hpp Mon Jul 15 11:07:03 2013 +0100 60.2 +++ b/src/share/vm/runtime/handles.hpp Mon Jul 22 14:01:39 2013 +0100 60.3 @@ -227,7 +227,7 @@ 60.4 HandleArea* _prev; // link to outer (older) area 60.5 public: 60.6 // Constructor 60.7 - HandleArea(HandleArea* prev) { 60.8 + HandleArea(HandleArea* prev) : Arena(Chunk::tiny_size) { 60.9 debug_only(_handle_mark_nesting = 0); 60.10 debug_only(_no_handle_mark_nesting = 0); 60.11 _prev = prev;
61.1 --- a/src/share/vm/runtime/java.cpp Mon Jul 15 11:07:03 2013 +0100 61.2 +++ b/src/share/vm/runtime/java.cpp Mon Jul 22 14:01:39 2013 +0100 61.3 @@ -42,7 +42,6 @@ 61.4 #include "oops/oop.inline.hpp" 61.5 #include "oops/symbol.hpp" 61.6 #include "prims/jvmtiExport.hpp" 61.7 -#include "runtime/aprofiler.hpp" 61.8 #include "runtime/arguments.hpp" 61.9 #include "runtime/biasedLocking.hpp" 61.10 #include "runtime/compilationPolicy.hpp" 61.11 @@ -509,16 +508,6 @@ 61.12 } 61.13 } 61.14 61.15 - 61.16 - if (Arguments::has_alloc_profile()) { 61.17 - HandleMark hm; 61.18 - // Do one last collection to enumerate all the objects 61.19 - // allocated since the last one. 61.20 - Universe::heap()->collect(GCCause::_allocation_profiler); 61.21 - AllocationProfiler::disengage(); 61.22 - AllocationProfiler::print(0); 61.23 - } 61.24 - 61.25 if (PrintBytecodeHistogram) { 61.26 BytecodeHistogram::print(); 61.27 }
62.1 --- a/src/share/vm/runtime/os.hpp Mon Jul 15 11:07:03 2013 +0100 62.2 +++ b/src/share/vm/runtime/os.hpp Mon Jul 22 14:01:39 2013 +0100 62.3 @@ -507,16 +507,16 @@ 62.4 62.5 // Symbol lookup, find nearest function name; basically it implements 62.6 // dladdr() for all platforms. Name of the nearest function is copied 62.7 - // to buf. Distance from its base address is returned as offset. 62.8 + // to buf. Distance from its base address is optionally returned as offset. 62.9 // If function name is not found, buf[0] is set to '\0' and offset is 62.10 - // set to -1. 62.11 + // set to -1 (if offset is non-NULL). 62.12 static bool dll_address_to_function_name(address addr, char* buf, 62.13 int buflen, int* offset); 62.14 62.15 // Locate DLL/DSO. On success, full path of the library is copied to 62.16 - // buf, and offset is set to be the distance between addr and the 62.17 - // library's base address. On failure, buf[0] is set to '\0' and 62.18 - // offset is set to -1. 62.19 + // buf, and offset is optionally set to be the distance between addr 62.20 + // and the library's base address. On failure, buf[0] is set to '\0' 62.21 + // and offset is set to -1 (if offset is non-NULL). 62.22 static bool dll_address_to_library_name(address addr, char* buf, 62.23 int buflen, int* offset); 62.24
63.1 --- a/src/share/vm/runtime/thread.cpp Mon Jul 15 11:07:03 2013 +0100 63.2 +++ b/src/share/vm/runtime/thread.cpp Mon Jul 22 14:01:39 2013 +0100 63.3 @@ -45,7 +45,6 @@ 63.4 #include "prims/jvmtiExport.hpp" 63.5 #include "prims/jvmtiThreadState.hpp" 63.6 #include "prims/privilegedStack.hpp" 63.7 -#include "runtime/aprofiler.hpp" 63.8 #include "runtime/arguments.hpp" 63.9 #include "runtime/biasedLocking.hpp" 63.10 #include "runtime/deoptimization.hpp" 63.11 @@ -3677,7 +3676,6 @@ 63.12 } 63.13 63.14 if (Arguments::has_profile()) FlatProfiler::engage(main_thread, true); 63.15 - if (Arguments::has_alloc_profile()) AllocationProfiler::engage(); 63.16 if (MemProfiling) MemProfiler::engage(); 63.17 StatSampler::engage(); 63.18 if (CheckJNICalls) JniPeriodicChecker::engage();
64.1 --- a/src/share/vm/runtime/vmStructs.cpp Mon Jul 15 11:07:03 2013 +0100 64.2 +++ b/src/share/vm/runtime/vmStructs.cpp Mon Jul 22 14:01:39 2013 +0100 64.3 @@ -263,7 +263,7 @@ 64.4 unchecked_c2_static_field) \ 64.5 \ 64.6 /******************************************************************/ \ 64.7 - /* OopDesc and Klass hierarchies (NOTE: MethodData* incomplete) */ \ 64.8 + /* OopDesc and Klass hierarchies (NOTE: MethodData* incomplete) */ \ 64.9 /******************************************************************/ \ 64.10 \ 64.11 volatile_nonstatic_field(oopDesc, _mark, markOop) \ 64.12 @@ -274,21 +274,20 @@ 64.13 volatile_nonstatic_field(ArrayKlass, _higher_dimension, Klass*) \ 64.14 volatile_nonstatic_field(ArrayKlass, _lower_dimension, Klass*) \ 64.15 nonstatic_field(ArrayKlass, _vtable_len, int) \ 64.16 - nonstatic_field(ArrayKlass, _alloc_size, juint) \ 64.17 nonstatic_field(ArrayKlass, _component_mirror, oop) \ 64.18 - nonstatic_field(CompiledICHolder, _holder_method, Method*) \ 64.19 + nonstatic_field(CompiledICHolder, _holder_method, Method*) \ 64.20 nonstatic_field(CompiledICHolder, _holder_klass, Klass*) \ 64.21 nonstatic_field(ConstantPool, _tags, Array<u1>*) \ 64.22 - nonstatic_field(ConstantPool, _cache, ConstantPoolCache*) \ 64.23 + nonstatic_field(ConstantPool, _cache, ConstantPoolCache*) \ 64.24 nonstatic_field(ConstantPool, _pool_holder, InstanceKlass*) \ 64.25 nonstatic_field(ConstantPool, _operands, Array<u2>*) \ 64.26 nonstatic_field(ConstantPool, _length, int) \ 64.27 nonstatic_field(ConstantPool, _resolved_references, jobject) \ 64.28 nonstatic_field(ConstantPool, _reference_map, Array<u2>*) \ 64.29 nonstatic_field(ConstantPoolCache, _length, int) \ 64.30 - nonstatic_field(ConstantPoolCache, _constant_pool, ConstantPool*) \ 64.31 + nonstatic_field(ConstantPoolCache, _constant_pool, ConstantPool*) \ 64.32 nonstatic_field(InstanceKlass, _array_klasses, Klass*) \ 64.33 - nonstatic_field(InstanceKlass, _methods, Array<Method*>*) \ 64.34 + nonstatic_field(InstanceKlass, _methods, Array<Method*>*) \ 64.35 nonstatic_field(InstanceKlass, _local_interfaces, Array<Klass*>*) \ 64.36 nonstatic_field(InstanceKlass, _transitive_interfaces, Array<Klass*>*) \ 64.37 nonstatic_field(InstanceKlass, _fields, Array<u2>*) \ 64.38 @@ -336,9 +335,8 @@ 64.39 nonstatic_field(Klass, _access_flags, AccessFlags) \ 64.40 nonstatic_field(Klass, _subklass, Klass*) \ 64.41 nonstatic_field(Klass, _next_sibling, Klass*) \ 64.42 - nonstatic_field(Klass, _alloc_count, juint) \ 64.43 nonstatic_field(MethodData, _size, int) \ 64.44 - nonstatic_field(MethodData, _method, Method*) \ 64.45 + nonstatic_field(MethodData, _method, Method*) \ 64.46 nonstatic_field(MethodData, _data_size, int) \ 64.47 nonstatic_field(MethodData, _data[0], intptr_t) \ 64.48 nonstatic_field(MethodData, _nof_decompiles, uint) \
65.1 --- a/src/share/vm/services/memBaseline.cpp Mon Jul 15 11:07:03 2013 +0100 65.2 +++ b/src/share/vm/services/memBaseline.cpp Mon Jul 22 14:01:39 2013 +0100 65.3 @@ -486,7 +486,7 @@ 65.4 const MemPointerRecord* mp1 = (const MemPointerRecord*)p1; 65.5 const MemPointerRecord* mp2 = (const MemPointerRecord*)p2; 65.6 int delta = UNSIGNED_COMPARE(mp1->addr(), mp2->addr()); 65.7 - assert(delta != 0, "dup pointer"); 65.8 + assert(p1 == p2 || delta != 0, "dup pointer"); 65.9 return delta; 65.10 } 65.11
66.1 --- a/src/share/vm/services/memTracker.hpp Mon Jul 15 11:07:03 2013 +0100 66.2 +++ b/src/share/vm/services/memTracker.hpp Mon Jul 22 14:01:39 2013 +0100 66.3 @@ -470,7 +470,21 @@ 66.4 static void check_NMT_load(Thread* thr) { 66.5 assert(thr != NULL, "Sanity check"); 66.6 if (_slowdown_calling_thread && thr != _worker_thread) { 66.7 +#ifdef _WINDOWS 66.8 + // On Windows, os::NakedYield() does not work as well 66.9 + // as os::yield_all() 66.10 os::yield_all(); 66.11 +#else 66.12 + // On Solaris, os::yield_all() depends on os::sleep() 66.13 + // which requires JavaTherad in _thread_in_vm state. 66.14 + // Transits thread to _thread_in_vm state can be dangerous 66.15 + // if caller holds lock, as it may deadlock with Threads_lock. 66.16 + // So use NaKedYield instead. 66.17 + // 66.18 + // Linux and BSD, NakedYield() and yield_all() implementations 66.19 + // are the same. 66.20 + os::NakedYield(); 66.21 +#endif 66.22 } 66.23 } 66.24
67.1 --- a/src/share/vm/utilities/debug.cpp Mon Jul 15 11:07:03 2013 +0100 67.2 +++ b/src/share/vm/utilities/debug.cpp Mon Jul 22 14:01:39 2013 +0100 67.3 @@ -314,8 +314,8 @@ 67.4 #ifndef PRODUCT 67.5 #include <signal.h> 67.6 67.7 -void test_error_handler(size_t test_num) 67.8 -{ 67.9 +void test_error_handler() { 67.10 + uintx test_num = ErrorHandlerTest; 67.11 if (test_num == 0) return; 67.12 67.13 // If asserts are disabled, use the corresponding guarantee instead. 67.14 @@ -327,6 +327,8 @@ 67.15 67.16 const char* const eol = os::line_separator(); 67.17 const char* const msg = "this message should be truncated during formatting"; 67.18 + char * const dataPtr = NULL; // bad data pointer 67.19 + const void (*funcPtr)(void) = (const void(*)()) 0xF; // bad function pointer 67.20 67.21 // Keep this in sync with test/runtime/6888954/vmerrors.sh. 67.22 switch (n) { 67.23 @@ -348,11 +350,16 @@ 67.24 case 9: ShouldNotCallThis(); 67.25 case 10: ShouldNotReachHere(); 67.26 case 11: Unimplemented(); 67.27 - // This is last because it does not generate an hs_err* file on Windows. 67.28 - case 12: os::signal_raise(SIGSEGV); 67.29 + // There's no guarantee the bad data pointer will crash us 67.30 + // so "break" out to the ShouldNotReachHere(). 67.31 + case 12: *dataPtr = '\0'; break; 67.32 + // There's no guarantee the bad function pointer will crash us 67.33 + // so "break" out to the ShouldNotReachHere(). 67.34 + case 13: (*funcPtr)(); break; 67.35 67.36 - default: ShouldNotReachHere(); 67.37 + default: tty->print_cr("ERROR: %d: unexpected test_num value.", n); 67.38 } 67.39 + ShouldNotReachHere(); 67.40 } 67.41 #endif // !PRODUCT 67.42
68.1 --- a/src/share/vm/utilities/debug.hpp Mon Jul 15 11:07:03 2013 +0100 68.2 +++ b/src/share/vm/utilities/debug.hpp Mon Jul 22 14:01:39 2013 +0100 68.3 @@ -1,5 +1,5 @@ 68.4 /* 68.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 68.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 68.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 68.8 * 68.9 * This code is free software; you can redistribute it and/or modify it 68.10 @@ -243,7 +243,7 @@ 68.11 void set_error_reported(); 68.12 68.13 /* Test assert(), fatal(), guarantee(), etc. */ 68.14 -NOT_PRODUCT(void test_error_handler(size_t test_num);) 68.15 +NOT_PRODUCT(void test_error_handler();) 68.16 68.17 void pd_ps(frame f); 68.18 void pd_obfuscate_location(char *buf, size_t buflen);
69.1 --- a/src/share/vm/utilities/vmError.cpp Mon Jul 15 11:07:03 2013 +0100 69.2 +++ b/src/share/vm/utilities/vmError.cpp Mon Jul 22 14:01:39 2013 +0100 69.3 @@ -908,10 +908,11 @@ 69.4 // This is not the first error, see if it happened in a different thread 69.5 // or in the same thread during error reporting. 69.6 if (first_error_tid != mytid) { 69.7 - jio_snprintf(buffer, sizeof(buffer), 69.8 + char msgbuf[64]; 69.9 + jio_snprintf(msgbuf, sizeof(msgbuf), 69.10 "[thread " INT64_FORMAT " also had an error]", 69.11 mytid); 69.12 - out.print_raw_cr(buffer); 69.13 + out.print_raw_cr(msgbuf); 69.14 69.15 // error reporting is not MT-safe, block current thread 69.16 os::infinite_sleep();
70.1 --- a/test/compiler/8005956/PolynomialRoot.java Mon Jul 15 11:07:03 2013 +0100 70.2 +++ b/test/compiler/8005956/PolynomialRoot.java Mon Jul 22 14:01:39 2013 +0100 70.3 @@ -15,7 +15,7 @@ 70.4 * @bug 8005956 70.5 * @summary C2: assert(!def_outside->member(r)) failed: Use of external LRG overlaps the same LRG defined in this block 70.6 * 70.7 -* @run main PolynomialRoot 70.8 +* @run main/timeout=300 PolynomialRoot 70.9 */ 70.10 70.11 public class PolynomialRoot { 70.12 @@ -757,19 +757,26 @@ 70.13 70.14 public static void main(final String [] args) 70.15 { 70.16 - final long t0=System.currentTimeMillis(); 70.17 - final double eps=1e-6; 70.18 - //checkRoots(); 70.19 - final java.util.Random r=new java.util.Random(-1381923); 70.20 - printSpecialValues(); 70.21 + if (System.getProperty("os.arch").equals("x86") || 70.22 + System.getProperty("os.arch").equals("amd64") || 70.23 + System.getProperty("os.arch").equals("x86_64")){ 70.24 + final long t0=System.currentTimeMillis(); 70.25 + final double eps=1e-6; 70.26 + //checkRoots(); 70.27 + final java.util.Random r=new java.util.Random(-1381923); 70.28 + printSpecialValues(); 70.29 70.30 - final int n_tests=10000000; 70.31 - //testRoots(2,n_tests,r,eps); 70.32 - //testRoots(3,n_tests,r,eps); 70.33 - testRoots(4,n_tests,r,eps); 70.34 - final long t1=System.currentTimeMillis(); 70.35 - System.err.println("PolynomialRoot.main: "+n_tests+" tests OK done in "+(t1-t0)+" milliseconds. ver=$Id: PolynomialRoot.java,v 1.105 2012/08/18 00:00:05 mal Exp $"); 70.36 - } 70.37 + final int n_tests=100000; 70.38 + //testRoots(2,n_tests,r,eps); 70.39 + //testRoots(3,n_tests,r,eps); 70.40 + testRoots(4,n_tests,r,eps); 70.41 + final long t1=System.currentTimeMillis(); 70.42 + System.err.println("PolynomialRoot.main: "+n_tests+" tests OK done in "+(t1-t0)+" milliseconds. ver=$Id: PolynomialRoot.java,v 1.105 2012/08/18 00:00:05 mal Exp $"); 70.43 + System.out.println("PASSED"); 70.44 + } else { 70.45 + System.out.println("PASS test for non-x86"); 70.46 + } 70.47 + } 70.48 70.49 70.50
71.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 71.2 +++ b/test/compiler/codecache/CheckUpperLimit.java Mon Jul 22 14:01:39 2013 +0100 71.3 @@ -0,0 +1,47 @@ 71.4 +/* 71.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 71.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 71.7 + * 71.8 + * This code is free software; you can redistribute it and/or modify it 71.9 + * under the terms of the GNU General Public License version 2 only, as 71.10 + * published by the Free Software Foundation. 71.11 + * 71.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 71.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 71.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 71.15 + * version 2 for more details (a copy is included in the LICENSE file that 71.16 + * accompanied this code). 71.17 + * 71.18 + * You should have received a copy of the GNU General Public License version 71.19 + * 2 along with this work; if not, write to the Free Software Foundation, 71.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 71.21 + * 71.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 71.23 + * or visit www.oracle.com if you need additional information or have any 71.24 + * questions. 71.25 + */ 71.26 + 71.27 +/* 71.28 + * @test 71.29 + * @bug 8015635 71.30 + * @summary Test ensures that the ReservedCodeCacheSize is at most MAXINT 71.31 + * @library /testlibrary 71.32 + * 71.33 + */ 71.34 +import com.oracle.java.testlibrary.*; 71.35 + 71.36 +public class CheckUpperLimit { 71.37 + public static void main(String[] args) throws Exception { 71.38 + ProcessBuilder pb; 71.39 + OutputAnalyzer out; 71.40 + 71.41 + pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=2048m", "-version"); 71.42 + out = new OutputAnalyzer(pb.start()); 71.43 + out.shouldHaveExitValue(0); 71.44 + 71.45 + pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=2049m", "-version"); 71.46 + out = new OutputAnalyzer(pb.start()); 71.47 + out.shouldContain("Invalid ReservedCodeCacheSize="); 71.48 + out.shouldHaveExitValue(1); 71.49 + } 71.50 +}
72.1 --- a/test/runtime/6888954/vmerrors.sh Mon Jul 15 11:07:03 2013 +0100 72.2 +++ b/test/runtime/6888954/vmerrors.sh Mon Jul 22 14:01:39 2013 +0100 72.3 @@ -1,5 +1,6 @@ 72.4 # @test 72.5 # @bug 6888954 72.6 +# @bug 8015884 72.7 # @summary exercise HotSpot error handling code 72.8 # @author John Coomes 72.9 # @run shell vmerrors.sh 72.10 @@ -27,9 +28,24 @@ 72.11 rc=0 72.12 72.13 assert_re='(assert|guarantee)[(](str|num).*failed: *' 72.14 +# for bad_data_ptr_re: 72.15 +# EXCEPTION_ACCESS_VIOLATION - Win-* 72.16 +# SIGILL - MacOS X 72.17 +# SIGSEGV - Linux-*, Solaris SPARC-*, Solaris X86-* 72.18 +# 72.19 +bad_data_ptr_re='(SIGILL|SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc=' 72.20 +# 72.21 +# for bad_func_ptr_re: 72.22 +# EXCEPTION_ACCESS_VIOLATION - Win-* 72.23 +# SIGBUS - Solaris SPARC-64 72.24 +# SIGSEGV - Linux-*, Solaris SPARC-32, Solaris X86-* 72.25 +# 72.26 +# Note: would like to use "pc=0x00*0f," in the pattern, but Solaris SPARC-* 72.27 +# gets its signal at a PC in test_error_handler(). 72.28 +# 72.29 +bad_func_ptr_re='(SIGBUS|SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc=' 72.30 guarantee_re='guarantee[(](str|num).*failed: *' 72.31 fatal_re='fatal error: *' 72.32 -signal_re='(SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc=' 72.33 tail_1='.*expected null' 72.34 tail_2='.*num=' 72.35 72.36 @@ -39,8 +55,9 @@ 72.37 "${fatal_re}${tail_1}" "${fatal_re}${tail_2}" \ 72.38 "${fatal_re}.*truncated" "ChunkPool::allocate" \ 72.39 "ShouldNotCall" "ShouldNotReachHere" \ 72.40 - "Unimplemented" "$signal_re" 72.41 - 72.42 + "Unimplemented" "$bad_data_ptr_re" \ 72.43 + "$bad_func_ptr_re" 72.44 + 72.45 do 72.46 i2=$i 72.47 [ $i -lt 10 ] && i2=0$i
73.1 --- a/test/runtime/8001071/Test8001071.sh Mon Jul 15 11:07:03 2013 +0100 73.2 +++ b/test/runtime/8001071/Test8001071.sh Mon Jul 22 14:01:39 2013 +0100 73.3 @@ -2,21 +2,21 @@ 73.4 73.5 # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 73.6 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 73.7 - 73.8 +# 73.9 # This code is free software; you can redistribute it and/or modify it 73.10 # under the terms of the GNU General Public License version 2 only, as 73.11 # published by the Free Software Foundation. 73.12 - 73.13 +# 73.14 # This code is distributed in the hope that it will be useful, but WITHOUT 73.15 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 73.16 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 73.17 # version 2 for more details (a copy is included in the LICENSE file that 73.18 # accompanied this code). 73.19 - 73.20 +# 73.21 # You should have received a copy of the GNU General Public License version 73.22 # 2 along with this work; if not, write to the Free Software Foundation, 73.23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 73.24 - 73.25 +# 73.26 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 73.27 # or visit www.oracle.com if you need additional information or have any 73.28 # questions.