Wed, 15 Oct 2008 18:51:04 -0700
Merge
1.1 --- a/make/hotspot_distro Wed Oct 15 18:49:57 2008 -0700 1.2 +++ b/make/hotspot_distro Wed Oct 15 18:51:04 2008 -0700 1.3 @@ -1,4 +1,4 @@ 1.4 -# 1.5 +# 1.6 # Copyright 2006-2008 Sun Microsystems, Inc. All Rights Reserved. 1.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 # 1.9 @@ -19,7 +19,7 @@ 1.10 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.11 # CA 95054 USA or visit www.sun.com if you need additional information or 1.12 # have any questions. 1.13 -# 1.14 +# 1.15 1.16 # 1.17 # This file format must remain compatible with both
2.1 --- a/src/os/linux/launcher/java.c Wed Oct 15 18:49:57 2008 -0700 2.2 +++ b/src/os/linux/launcher/java.c Wed Oct 15 18:51:04 2008 -0700 2.3 @@ -1110,7 +1110,7 @@ 2.4 if (propname) { 2.5 jclass cls; 2.6 jmethodID mid; 2.7 - NULL_CHECK0 (cls = (*env)->FindClass(env, "java/lang/System")); 2.8 + NULL_CHECK0 (cls = FindBootStrapClass(env, "java/lang/System")); 2.9 NULL_CHECK0 (mid = (*env)->GetStaticMethodID( 2.10 env, cls, 2.11 "getProperty", 2.12 @@ -1125,7 +1125,7 @@ 2.13 static jboolean isEncodingSupported(JNIEnv *env, jstring enc) { 2.14 jclass cls; 2.15 jmethodID mid; 2.16 - NULL_CHECK0 (cls = (*env)->FindClass(env, "java/nio/charset/Charset")); 2.17 + NULL_CHECK0 (cls = FindBootStrapClass(env, "java/nio/charset/Charset")); 2.18 NULL_CHECK0 (mid = (*env)->GetStaticMethodID( 2.19 env, cls, 2.20 "isSupported", 2.21 @@ -1161,7 +1161,7 @@ 2.22 #else 2.23 if (isEncodingSupported(env, enc) == JNI_TRUE) { 2.24 #endif 2.25 - NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String")); 2.26 + NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String")); 2.27 NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>", 2.28 "([BLjava/lang/String;)V")); 2.29 str = (*env)->NewObject(env, cls, mid, ary, enc); 2.30 @@ -1172,7 +1172,7 @@ 2.31 the encoding name, in which the StringCoding class will 2.32 pickup the iso-8859-1 as the fallback converter for us. 2.33 */ 2.34 - NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String")); 2.35 + NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String")); 2.36 NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>", 2.37 "([B)V")); 2.38 str = (*env)->NewObject(env, cls, mid, ary); 2.39 @@ -1195,7 +1195,7 @@ 2.40 jarray ary; 2.41 int i; 2.42 2.43 - NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String")); 2.44 + NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String")); 2.45 NULL_CHECK0(ary = (*env)->NewObjectArray(env, strc, cls, 0)); 2.46 for (i = 0; i < strc; i++) { 2.47 jstring str = NewPlatformString(env, *strv++); 2.48 @@ -1224,6 +1224,7 @@ 2.49 c = *t++; 2.50 *s++ = (c == '.') ? '/' : c; 2.51 } while (c != '\0'); 2.52 + // use the application class loader for main-class 2.53 cls = (*env)->FindClass(env, buf); 2.54 free(buf); 2.55 2.56 @@ -1250,7 +1251,7 @@ 2.57 jobject jar, man, attr; 2.58 jstring str, result = 0; 2.59 2.60 - NULL_CHECK0(cls = (*env)->FindClass(env, "java/util/jar/JarFile")); 2.61 + NULL_CHECK0(cls = FindBootStrapClass(env, "java/util/jar/JarFile")); 2.62 NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>", 2.63 "(Ljava/lang/String;)V")); 2.64 NULL_CHECK0(str = NewPlatformString(env, jarname)); 2.65 @@ -1471,7 +1472,7 @@ 2.66 jclass ver; 2.67 jmethodID print; 2.68 2.69 - NULL_CHECK(ver = (*env)->FindClass(env, "sun/misc/Version")); 2.70 + NULL_CHECK(ver = FindBootStrapClass(env, "sun/misc/Version")); 2.71 NULL_CHECK(print = (*env)->GetStaticMethodID(env, ver, "print", "()V")); 2.72 2.73 (*env)->CallStaticVoidMethod(env, ver, print);
3.1 --- a/src/os/linux/launcher/java.h Wed Oct 15 18:49:57 2008 -0700 3.2 +++ b/src/os/linux/launcher/java.h Wed Oct 15 18:51:04 2008 -0700 3.3 @@ -100,5 +100,15 @@ 3.4 * Make launcher spit debug output. 3.5 */ 3.6 extern jboolean _launcher_debug; 3.7 +/* 3.8 + * This allows for finding classes from the VM's bootstrap class loader 3.9 + * directly, FindClass uses the application class loader internally, this will 3.10 + * cause unnecessary searching of the classpath for the required classes. 3.11 + */ 3.12 +typedef jclass (JNICALL FindClassFromBootLoader_t(JNIEnv *env, 3.13 + const char *name, 3.14 + jboolean throwError)); 3.15 + 3.16 +jclass FindBootStrapClass(JNIEnv *env, const char *classname); 3.17 3.18 #endif /* _JAVA_H_ */
4.1 --- a/src/os/linux/launcher/java_md.c Wed Oct 15 18:49:57 2008 -0700 4.2 +++ b/src/os/linux/launcher/java_md.c Wed Oct 15 18:51:04 2008 -0700 4.3 @@ -1826,3 +1826,23 @@ 4.4 { 4.5 return(borrowed_unsetenv(name)); 4.6 } 4.7 +/* 4.8 + * The implementation for finding classes from the bootstrap 4.9 + * class loader, refer to java.h 4.10 + */ 4.11 +static FindClassFromBootLoader_t *findBootClass = NULL; 4.12 + 4.13 +jclass 4.14 +FindBootStrapClass(JNIEnv *env, const char* classname) 4.15 +{ 4.16 + if (findBootClass == NULL) { 4.17 + findBootClass = (FindClassFromBootLoader_t *)dlsym(RTLD_DEFAULT, 4.18 + "JVM_FindClassFromBootLoader"); 4.19 + if (findBootClass == NULL) { 4.20 + fprintf(stderr, "Error: could load method JVM_FindClassFromBootLoader"); 4.21 + return NULL; 4.22 + } 4.23 + } 4.24 + return findBootClass(env, classname, JNI_FALSE); 4.25 +} 4.26 +
5.1 --- a/src/os/linux/vm/globals_linux.hpp Wed Oct 15 18:49:57 2008 -0700 5.2 +++ b/src/os/linux/vm/globals_linux.hpp Wed Oct 15 18:51:04 2008 -0700 5.3 @@ -38,5 +38,6 @@ 5.4 // platforms, but they may have different default values on other platforms. 5.5 // 5.6 define_pd_global(bool, UseLargePages, false); 5.7 +define_pd_global(bool, UseLargePagesIndividualAllocation, false); 5.8 define_pd_global(bool, UseOSErrorReporting, false); 5.9 define_pd_global(bool, UseThreadPriorities, true) ;
6.1 --- a/src/os/solaris/launcher/java.c Wed Oct 15 18:49:57 2008 -0700 6.2 +++ b/src/os/solaris/launcher/java.c Wed Oct 15 18:51:04 2008 -0700 6.3 @@ -1110,7 +1110,7 @@ 6.4 if (propname) { 6.5 jclass cls; 6.6 jmethodID mid; 6.7 - NULL_CHECK0 (cls = (*env)->FindClass(env, "java/lang/System")); 6.8 + NULL_CHECK0 (cls = FindBootStrapClass(env, "java/lang/System")); 6.9 NULL_CHECK0 (mid = (*env)->GetStaticMethodID( 6.10 env, cls, 6.11 "getProperty", 6.12 @@ -1125,7 +1125,7 @@ 6.13 static jboolean isEncodingSupported(JNIEnv *env, jstring enc) { 6.14 jclass cls; 6.15 jmethodID mid; 6.16 - NULL_CHECK0 (cls = (*env)->FindClass(env, "java/nio/charset/Charset")); 6.17 + NULL_CHECK0 (cls = FindBootStrapClass(env, "java/nio/charset/Charset")); 6.18 NULL_CHECK0 (mid = (*env)->GetStaticMethodID( 6.19 env, cls, 6.20 "isSupported", 6.21 @@ -1161,7 +1161,7 @@ 6.22 #else 6.23 if (isEncodingSupported(env, enc) == JNI_TRUE) { 6.24 #endif 6.25 - NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String")); 6.26 + NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String")); 6.27 NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>", 6.28 "([BLjava/lang/String;)V")); 6.29 str = (*env)->NewObject(env, cls, mid, ary, enc); 6.30 @@ -1172,7 +1172,7 @@ 6.31 the encoding name, in which the StringCoding class will 6.32 pickup the iso-8859-1 as the fallback converter for us. 6.33 */ 6.34 - NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String")); 6.35 + NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String")); 6.36 NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>", 6.37 "([B)V")); 6.38 str = (*env)->NewObject(env, cls, mid, ary); 6.39 @@ -1195,7 +1195,7 @@ 6.40 jarray ary; 6.41 int i; 6.42 6.43 - NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String")); 6.44 + NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String")); 6.45 NULL_CHECK0(ary = (*env)->NewObjectArray(env, strc, cls, 0)); 6.46 for (i = 0; i < strc; i++) { 6.47 jstring str = NewPlatformString(env, *strv++); 6.48 @@ -1224,6 +1224,7 @@ 6.49 c = *t++; 6.50 *s++ = (c == '.') ? '/' : c; 6.51 } while (c != '\0'); 6.52 + // use the application class loader for the main-class 6.53 cls = (*env)->FindClass(env, buf); 6.54 free(buf); 6.55 6.56 @@ -1250,7 +1251,7 @@ 6.57 jobject jar, man, attr; 6.58 jstring str, result = 0; 6.59 6.60 - NULL_CHECK0(cls = (*env)->FindClass(env, "java/util/jar/JarFile")); 6.61 + NULL_CHECK0(cls = FindBootStrapClass(env, "java/util/jar/JarFile")); 6.62 NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>", 6.63 "(Ljava/lang/String;)V")); 6.64 NULL_CHECK0(str = NewPlatformString(env, jarname)); 6.65 @@ -1471,7 +1472,7 @@ 6.66 jclass ver; 6.67 jmethodID print; 6.68 6.69 - NULL_CHECK(ver = (*env)->FindClass(env, "sun/misc/Version")); 6.70 + NULL_CHECK(ver = FindBootStrapClass(env, "sun/misc/Version")); 6.71 NULL_CHECK(print = (*env)->GetStaticMethodID(env, ver, "print", "()V")); 6.72 6.73 (*env)->CallStaticVoidMethod(env, ver, print);
7.1 --- a/src/os/solaris/launcher/java.h Wed Oct 15 18:49:57 2008 -0700 7.2 +++ b/src/os/solaris/launcher/java.h Wed Oct 15 18:51:04 2008 -0700 7.3 @@ -101,4 +101,15 @@ 7.4 */ 7.5 extern jboolean _launcher_debug; 7.6 7.7 +/* 7.8 + * This allows for finding classes from the VM's bootstrap class loader 7.9 + * directly, FindClass uses the application class loader internally, this will 7.10 + * cause unnecessary searching of the classpath for the required classes. 7.11 + */ 7.12 +typedef jclass (JNICALL FindClassFromBootLoader_t(JNIEnv *env, 7.13 + const char *name, 7.14 + jboolean throwError)); 7.15 + 7.16 +jclass FindBootStrapClass(JNIEnv *env, const char *classname); 7.17 + 7.18 #endif /* _JAVA_H_ */
8.1 --- a/src/os/solaris/launcher/java_md.c Wed Oct 15 18:49:57 2008 -0700 8.2 +++ b/src/os/solaris/launcher/java_md.c Wed Oct 15 18:51:04 2008 -0700 8.3 @@ -1826,3 +1826,24 @@ 8.4 { 8.5 return(borrowed_unsetenv(name)); 8.6 } 8.7 + 8.8 +/* 8.9 + * The implementation for finding classes from the bootstrap 8.10 + * class loader, refer to java.h 8.11 + */ 8.12 +static FindClassFromBootLoader_t *findBootClass = NULL; 8.13 + 8.14 +jclass 8.15 +FindBootStrapClass(JNIEnv *env, const char* classname) 8.16 +{ 8.17 + if (findBootClass == NULL) { 8.18 + findBootClass = (FindClassFromBootLoader_t *)dlsym(RTLD_DEFAULT, 8.19 + "JVM_FindClassFromBootLoader"); 8.20 + if (findBootClass == NULL) { 8.21 + fprintf(stderr, "Error: could not load method JVM_FindClassFromBootLoader"); 8.22 + return NULL; 8.23 + } 8.24 + } 8.25 + return findBootClass(env, classname, JNI_FALSE); 8.26 +} 8.27 +
9.1 --- a/src/os/solaris/vm/globals_solaris.hpp Wed Oct 15 18:49:57 2008 -0700 9.2 +++ b/src/os/solaris/vm/globals_solaris.hpp Wed Oct 15 18:51:04 2008 -0700 9.3 @@ -44,5 +44,6 @@ 9.4 // platforms, but they may have different default values on other platforms. 9.5 // 9.6 define_pd_global(bool, UseLargePages, true); 9.7 +define_pd_global(bool, UseLargePagesIndividualAllocation, false); 9.8 define_pd_global(bool, UseOSErrorReporting, false); 9.9 define_pd_global(bool, UseThreadPriorities, false);
10.1 --- a/src/os/solaris/vm/os_solaris.cpp Wed Oct 15 18:49:57 2008 -0700 10.2 +++ b/src/os/solaris/vm/os_solaris.cpp Wed Oct 15 18:51:04 2008 -0700 10.3 @@ -462,16 +462,14 @@ 10.4 int online_cpus = sysconf(_SC_NPROCESSORS_ONLN); 10.5 pid_t pid = getpid(); 10.6 psetid_t pset = PS_NONE; 10.7 - // Are we running in a processor set? 10.8 + // Are we running in a processor set or is there any processor set around? 10.9 if (pset_bind(PS_QUERY, P_PID, pid, &pset) == 0) { 10.10 - if (pset != PS_NONE) { 10.11 - uint_t pset_cpus; 10.12 - // Query number of cpus in processor set 10.13 - if (pset_info(pset, NULL, &pset_cpus, NULL) == 0) { 10.14 - assert(pset_cpus > 0 && pset_cpus <= online_cpus, "sanity check"); 10.15 - _processors_online = pset_cpus; 10.16 - return pset_cpus; 10.17 - } 10.18 + uint_t pset_cpus; 10.19 + // Query the number of cpus available to us. 10.20 + if (pset_info(pset, NULL, &pset_cpus, NULL) == 0) { 10.21 + assert(pset_cpus > 0 && pset_cpus <= online_cpus, "sanity check"); 10.22 + _processors_online = pset_cpus; 10.23 + return pset_cpus; 10.24 } 10.25 } 10.26 // Otherwise return number of online cpus
11.1 --- a/src/os/windows/vm/globals_windows.hpp Wed Oct 15 18:49:57 2008 -0700 11.2 +++ b/src/os/windows/vm/globals_windows.hpp Wed Oct 15 18:51:04 2008 -0700 11.3 @@ -37,5 +37,6 @@ 11.4 // platforms, but they may have different default values on other platforms. 11.5 // 11.6 define_pd_global(bool, UseLargePages, false); 11.7 +define_pd_global(bool, UseLargePagesIndividualAllocation, true); 11.8 define_pd_global(bool, UseOSErrorReporting, false); // for now. 11.9 define_pd_global(bool, UseThreadPriorities, true) ;
12.1 --- a/src/os/windows/vm/os_windows.cpp Wed Oct 15 18:49:57 2008 -0700 12.2 +++ b/src/os/windows/vm/os_windows.cpp Wed Oct 15 18:51:04 2008 -0700 12.3 @@ -2593,9 +2593,104 @@ 12.4 } 12.5 12.6 char* os::reserve_memory_special(size_t bytes) { 12.7 - DWORD flag = MEM_RESERVE | MEM_COMMIT | MEM_LARGE_PAGES; 12.8 - char * res = (char *)VirtualAlloc(NULL, bytes, flag, PAGE_EXECUTE_READWRITE); 12.9 - return res; 12.10 + 12.11 + if (UseLargePagesIndividualAllocation) { 12.12 + if (TracePageSizes && Verbose) { 12.13 + tty->print_cr("Reserving large pages individually."); 12.14 + } 12.15 + char * p_buf; 12.16 + // first reserve enough address space in advance since we want to be 12.17 + // able to break a single contiguous virtual address range into multiple 12.18 + // large page commits but WS2003 does not allow reserving large page space 12.19 + // so we just use 4K pages for reserve, this gives us a legal contiguous 12.20 + // address space. then we will deallocate that reservation, and re alloc 12.21 + // using large pages 12.22 + const size_t size_of_reserve = bytes + _large_page_size; 12.23 + if (bytes > size_of_reserve) { 12.24 + // Overflowed. 12.25 + warning("Individually allocated large pages failed, " 12.26 + "use -XX:-UseLargePagesIndividualAllocation to turn off"); 12.27 + return NULL; 12.28 + } 12.29 + p_buf = (char *) VirtualAlloc(NULL, 12.30 + size_of_reserve, // size of Reserve 12.31 + MEM_RESERVE, 12.32 + PAGE_EXECUTE_READWRITE); 12.33 + // If reservation failed, return NULL 12.34 + if (p_buf == NULL) return NULL; 12.35 + 12.36 + release_memory(p_buf, bytes + _large_page_size); 12.37 + // round up to page boundary. If the size_of_reserve did not 12.38 + // overflow and the reservation did not fail, this align up 12.39 + // should not overflow. 12.40 + p_buf = (char *) align_size_up((size_t)p_buf, _large_page_size); 12.41 + 12.42 + // now go through and allocate one page at a time until all bytes are 12.43 + // allocated 12.44 + size_t bytes_remaining = align_size_up(bytes, _large_page_size); 12.45 + // An overflow of align_size_up() would have been caught above 12.46 + // in the calculation of size_of_reserve. 12.47 + char * next_alloc_addr = p_buf; 12.48 + 12.49 +#ifdef ASSERT 12.50 + // Variable for the failure injection 12.51 + long ran_num = os::random(); 12.52 + size_t fail_after = ran_num % bytes; 12.53 +#endif 12.54 + 12.55 + while (bytes_remaining) { 12.56 + size_t bytes_to_rq = MIN2(bytes_remaining, _large_page_size); 12.57 + // Note allocate and commit 12.58 + char * p_new; 12.59 + 12.60 +#ifdef ASSERT 12.61 + bool inject_error = LargePagesIndividualAllocationInjectError && 12.62 + (bytes_remaining <= fail_after); 12.63 +#else 12.64 + const bool inject_error = false; 12.65 +#endif 12.66 + 12.67 + if (inject_error) { 12.68 + p_new = NULL; 12.69 + } else { 12.70 + p_new = (char *) VirtualAlloc(next_alloc_addr, 12.71 + bytes_to_rq, 12.72 + MEM_RESERVE | MEM_COMMIT | MEM_LARGE_PAGES, 12.73 + PAGE_EXECUTE_READWRITE); 12.74 + } 12.75 + 12.76 + if (p_new == NULL) { 12.77 + // Free any allocated pages 12.78 + if (next_alloc_addr > p_buf) { 12.79 + // Some memory was committed so release it. 12.80 + size_t bytes_to_release = bytes - bytes_remaining; 12.81 + release_memory(p_buf, bytes_to_release); 12.82 + } 12.83 +#ifdef ASSERT 12.84 + if (UseLargePagesIndividualAllocation && 12.85 + LargePagesIndividualAllocationInjectError) { 12.86 + if (TracePageSizes && Verbose) { 12.87 + tty->print_cr("Reserving large pages individually failed."); 12.88 + } 12.89 + } 12.90 +#endif 12.91 + return NULL; 12.92 + } 12.93 + bytes_remaining -= bytes_to_rq; 12.94 + next_alloc_addr += bytes_to_rq; 12.95 + } 12.96 + 12.97 + return p_buf; 12.98 + 12.99 + } else { 12.100 + // normal policy just allocate it all at once 12.101 + DWORD flag = MEM_RESERVE | MEM_COMMIT | MEM_LARGE_PAGES; 12.102 + char * res = (char *)VirtualAlloc(NULL, 12.103 + bytes, 12.104 + flag, 12.105 + PAGE_EXECUTE_READWRITE); 12.106 + return res; 12.107 + } 12.108 } 12.109 12.110 bool os::release_memory_special(char* base, size_t bytes) { 12.111 @@ -2983,6 +3078,7 @@ 12.112 volatile intx os::win32::_os_thread_count = 0; 12.113 12.114 bool os::win32::_is_nt = false; 12.115 +bool os::win32::_is_windows_2003 = false; 12.116 12.117 12.118 void os::win32::initialize_system_info() { 12.119 @@ -3005,7 +3101,15 @@ 12.120 GetVersionEx(&oi); 12.121 switch(oi.dwPlatformId) { 12.122 case VER_PLATFORM_WIN32_WINDOWS: _is_nt = false; break; 12.123 - case VER_PLATFORM_WIN32_NT: _is_nt = true; break; 12.124 + case VER_PLATFORM_WIN32_NT: 12.125 + _is_nt = true; 12.126 + { 12.127 + int os_vers = oi.dwMajorVersion * 1000 + oi.dwMinorVersion; 12.128 + if (os_vers == 5002) { 12.129 + _is_windows_2003 = true; 12.130 + } 12.131 + } 12.132 + break; 12.133 default: fatal("Unknown platform"); 12.134 } 12.135 12.136 @@ -3103,9 +3207,13 @@ 12.137 NoYieldsInMicrolock = true; 12.138 } 12.139 #endif 12.140 + // This may be overridden later when argument processing is done. 12.141 + FLAG_SET_ERGO(bool, UseLargePagesIndividualAllocation, 12.142 + os::win32::is_windows_2003()); 12.143 + 12.144 // Initialize main_process and main_thread 12.145 main_process = GetCurrentProcess(); // Remember main_process is a pseudo handle 12.146 - if (!DuplicateHandle(main_process, GetCurrentThread(), main_process, 12.147 + if (!DuplicateHandle(main_process, GetCurrentThread(), main_process, 12.148 &main_thread, THREAD_ALL_ACCESS, false, 0)) { 12.149 fatal("DuplicateHandle failed\n"); 12.150 }
13.1 --- a/src/os/windows/vm/os_windows.hpp Wed Oct 15 18:49:57 2008 -0700 13.2 +++ b/src/os/windows/vm/os_windows.hpp Wed Oct 15 18:51:04 2008 -0700 13.3 @@ -34,6 +34,7 @@ 13.4 static julong _physical_memory; 13.5 static size_t _default_stack_size; 13.6 static bool _is_nt; 13.7 + static bool _is_windows_2003; 13.8 13.9 public: 13.10 // Windows-specific interface: 13.11 @@ -60,6 +61,9 @@ 13.12 // Tells whether the platform is NT or Windown95 13.13 static bool is_nt() { return _is_nt; } 13.14 13.15 + // Tells whether the platform is Windows 2003 13.16 + static bool is_windows_2003() { return _is_windows_2003; } 13.17 + 13.18 // Returns the byte size of a virtual memory page 13.19 static int vm_page_size() { return _vm_page_size; } 13.20
14.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Wed Oct 15 18:49:57 2008 -0700 14.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Wed Oct 15 18:51:04 2008 -0700 14.3 @@ -1398,7 +1398,7 @@ 14.4 _g1_storage.initialize(g1_rs, 0); 14.5 _g1_committed = MemRegion((HeapWord*)_g1_storage.low(), (size_t) 0); 14.6 _g1_max_committed = _g1_committed; 14.7 - _hrs = new HeapRegionSeq(); 14.8 + _hrs = new HeapRegionSeq(_expansion_regions); 14.9 guarantee(_hrs != NULL, "Couldn't allocate HeapRegionSeq"); 14.10 guarantee(_cur_alloc_region == NULL, "from constructor"); 14.11 14.12 @@ -1789,6 +1789,20 @@ 14.13 } 14.14 } 14.15 14.16 +class ResetClaimValuesClosure: public HeapRegionClosure { 14.17 +public: 14.18 + bool doHeapRegion(HeapRegion* r) { 14.19 + r->set_claim_value(HeapRegion::InitialClaimValue); 14.20 + return false; 14.21 + } 14.22 +}; 14.23 + 14.24 +void 14.25 +G1CollectedHeap::reset_heap_region_claim_values() { 14.26 + ResetClaimValuesClosure blk; 14.27 + heap_region_iterate(&blk); 14.28 +} 14.29 + 14.30 #ifdef ASSERT 14.31 // This checks whether all regions in the heap have the correct claim 14.32 // value. I also piggy-backed on this a check to ensure that the 14.33 @@ -2031,10 +2045,12 @@ 14.34 class VerifyRegionClosure: public HeapRegionClosure { 14.35 public: 14.36 bool _allow_dirty; 14.37 - VerifyRegionClosure(bool allow_dirty) 14.38 - : _allow_dirty(allow_dirty) {} 14.39 + bool _par; 14.40 + VerifyRegionClosure(bool allow_dirty, bool par = false) 14.41 + : _allow_dirty(allow_dirty), _par(par) {} 14.42 bool doHeapRegion(HeapRegion* r) { 14.43 - guarantee(r->claim_value() == 0, "Should be unclaimed at verify points."); 14.44 + guarantee(_par || r->claim_value() == HeapRegion::InitialClaimValue, 14.45 + "Should be unclaimed at verify points."); 14.46 if (r->isHumongous()) { 14.47 if (r->startsHumongous()) { 14.48 // Verify the single H object. 14.49 @@ -2082,6 +2098,25 @@ 14.50 } 14.51 }; 14.52 14.53 +// This is the task used for parallel heap verification. 14.54 + 14.55 +class G1ParVerifyTask: public AbstractGangTask { 14.56 +private: 14.57 + G1CollectedHeap* _g1h; 14.58 + bool _allow_dirty; 14.59 + 14.60 +public: 14.61 + G1ParVerifyTask(G1CollectedHeap* g1h, bool allow_dirty) : 14.62 + AbstractGangTask("Parallel verify task"), 14.63 + _g1h(g1h), _allow_dirty(allow_dirty) { } 14.64 + 14.65 + void work(int worker_i) { 14.66 + VerifyRegionClosure blk(_allow_dirty, true); 14.67 + _g1h->heap_region_par_iterate_chunked(&blk, worker_i, 14.68 + HeapRegion::ParVerifyClaimValue); 14.69 + } 14.70 +}; 14.71 + 14.72 void G1CollectedHeap::verify(bool allow_dirty, bool silent) { 14.73 if (SafepointSynchronize::is_at_safepoint() || ! UseTLAB) { 14.74 if (!silent) { gclog_or_tty->print("roots "); } 14.75 @@ -2092,8 +2127,27 @@ 14.76 &rootsCl); 14.77 rem_set()->invalidate(perm_gen()->used_region(), false); 14.78 if (!silent) { gclog_or_tty->print("heapRegions "); } 14.79 - VerifyRegionClosure blk(allow_dirty); 14.80 - _hrs->iterate(&blk); 14.81 + if (GCParallelVerificationEnabled && ParallelGCThreads > 1) { 14.82 + assert(check_heap_region_claim_values(HeapRegion::InitialClaimValue), 14.83 + "sanity check"); 14.84 + 14.85 + G1ParVerifyTask task(this, allow_dirty); 14.86 + int n_workers = workers()->total_workers(); 14.87 + set_par_threads(n_workers); 14.88 + workers()->run_task(&task); 14.89 + set_par_threads(0); 14.90 + 14.91 + assert(check_heap_region_claim_values(HeapRegion::ParVerifyClaimValue), 14.92 + "sanity check"); 14.93 + 14.94 + reset_heap_region_claim_values(); 14.95 + 14.96 + assert(check_heap_region_claim_values(HeapRegion::InitialClaimValue), 14.97 + "sanity check"); 14.98 + } else { 14.99 + VerifyRegionClosure blk(allow_dirty); 14.100 + _hrs->iterate(&blk); 14.101 + } 14.102 if (!silent) gclog_or_tty->print("remset "); 14.103 rem_set()->verify(); 14.104 guarantee(!rootsCl.failures(), "should not have had failures");
15.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Wed Oct 15 18:49:57 2008 -0700 15.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Wed Oct 15 18:51:04 2008 -0700 15.3 @@ -890,6 +890,9 @@ 15.4 int worker, 15.5 jint claim_value); 15.6 15.7 + // It resets all the region claim values to the default. 15.8 + void reset_heap_region_claim_values(); 15.9 + 15.10 #ifdef ASSERT 15.11 bool check_heap_region_claim_values(jint claim_value); 15.12 #endif // ASSERT
16.1 --- a/src/share/vm/gc_implementation/g1/heapRegion.hpp Wed Oct 15 18:49:57 2008 -0700 16.2 +++ b/src/share/vm/gc_implementation/g1/heapRegion.hpp Wed Oct 15 18:51:04 2008 -0700 16.3 @@ -317,7 +317,8 @@ 16.4 InitialClaimValue = 0, 16.5 FinalCountClaimValue = 1, 16.6 NoteEndClaimValue = 2, 16.7 - ScrubRemSetClaimValue = 3 16.8 + ScrubRemSetClaimValue = 3, 16.9 + ParVerifyClaimValue = 4 16.10 }; 16.11 16.12 // Concurrent refinement requires contiguous heap regions (in which TLABs
17.1 --- a/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp Wed Oct 15 18:49:57 2008 -0700 17.2 +++ b/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp Wed Oct 15 18:51:04 2008 -0700 17.3 @@ -37,7 +37,7 @@ 17.4 return 0; 17.5 } 17.6 17.7 -HeapRegionSeq::HeapRegionSeq() : 17.8 +HeapRegionSeq::HeapRegionSeq(const size_t max_size) : 17.9 _alloc_search_start(0), 17.10 // The line below is the worst bit of C++ hackery I've ever written 17.11 // (Detlefs, 11/23). You should think of it as equivalent to 17.12 @@ -50,7 +50,7 @@ 17.13 _regions((ResourceObj::operator new (sizeof(GrowableArray<HeapRegion*>), 17.14 (void*)&_regions, 17.15 ResourceObj::C_HEAP), 17.16 - 100), 17.17 + (int)max_size), 17.18 true), 17.19 _next_rr_candidate(0), 17.20 _seq_bottom(NULL) 17.21 @@ -167,6 +167,7 @@ 17.22 // Public methods. 17.23 17.24 void HeapRegionSeq::insert(HeapRegion* hr) { 17.25 + assert(!_regions.is_full(), "Too many elements in HeapRegionSeq"); 17.26 if (_regions.length() == 0 17.27 || _regions.top()->end() <= hr->bottom()) { 17.28 hr->set_hrs_index(_regions.length());
18.1 --- a/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp Wed Oct 15 18:49:57 2008 -0700 18.2 +++ b/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp Wed Oct 15 18:51:04 2008 -0700 18.3 @@ -49,7 +49,7 @@ 18.4 18.5 public: 18.6 // Initializes "this" to the empty sequence of regions. 18.7 - HeapRegionSeq(); 18.8 + HeapRegionSeq(const size_t max_size); 18.9 18.10 // Adds "hr" to "this" sequence. Requires "hr" not to overlap with 18.11 // any region already in "this". (Will perform better if regions are
19.1 --- a/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp Wed Oct 15 18:49:57 2008 -0700 19.2 +++ b/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp Wed Oct 15 18:51:04 2008 -0700 19.3 @@ -391,6 +391,8 @@ 19.4 } 19.5 19.6 // Produce a new chunk size. page_size() aligned. 19.7 +// This function is expected to be called on sequence of i's from 0 to 19.8 +// lgrp_spaces()->length(). 19.9 size_t MutableNUMASpace::adaptive_chunk_size(int i, size_t limit) { 19.10 size_t pages_available = base_space_size(); 19.11 for (int j = 0; j < i; j++) { 19.12 @@ -405,7 +407,7 @@ 19.13 size_t chunk_size = 0; 19.14 if (alloc_rate > 0) { 19.15 LGRPSpace *ls = lgrp_spaces()->at(i); 19.16 - chunk_size = (size_t)(ls->alloc_rate()->average() * pages_available / alloc_rate) * page_size(); 19.17 + chunk_size = (size_t)(ls->alloc_rate()->average() / alloc_rate * pages_available) * page_size(); 19.18 } 19.19 chunk_size = MAX2(chunk_size, page_size()); 19.20
20.1 --- a/src/share/vm/prims/jvm.cpp Wed Oct 15 18:49:57 2008 -0700 20.2 +++ b/src/share/vm/prims/jvm.cpp Wed Oct 15 18:51:04 2008 -0700 20.3 @@ -628,6 +628,32 @@ 20.4 if (PrintJVMWarnings) warning("JVM_ResolveClass not implemented"); 20.5 JVM_END 20.6 20.7 +// Common implementation for JVM_FindClassFromBootLoader and 20.8 +// JVM_FindClassFromLoader 20.9 +static jclass jvm_find_class_from_class_loader(JNIEnv* env, const char* name, 20.10 + jboolean init, jobject loader, 20.11 + jboolean throwError, TRAPS) { 20.12 + // Java libraries should ensure that name is never null... 20.13 + if (name == NULL || (int)strlen(name) > symbolOopDesc::max_length()) { 20.14 + // It's impossible to create this class; the name cannot fit 20.15 + // into the constant pool. 20.16 + if (throwError) { 20.17 + THROW_MSG_0(vmSymbols::java_lang_NoClassDefFoundError(), name); 20.18 + } else { 20.19 + THROW_MSG_0(vmSymbols::java_lang_ClassNotFoundException(), name); 20.20 + } 20.21 + } 20.22 + symbolHandle h_name = oopFactory::new_symbol_handle(name, CHECK_NULL); 20.23 + Handle h_loader(THREAD, JNIHandles::resolve(loader)); 20.24 + jclass result = find_class_from_class_loader(env, h_name, init, h_loader, 20.25 + Handle(), throwError, THREAD); 20.26 + 20.27 + if (TraceClassResolution && result != NULL) { 20.28 + trace_class_resolution(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(result))); 20.29 + } 20.30 + return result; 20.31 +} 20.32 + 20.33 // Rationale behind JVM_FindClassFromBootLoader 20.34 // a> JVM_FindClassFromClassLoader was never exported in the export tables. 20.35 // b> because of (a) java.dll has a direct dependecy on the unexported 20.36 @@ -649,8 +675,8 @@ 20.37 jboolean throwError)) 20.38 JVMWrapper3("JVM_FindClassFromBootLoader %s throw %s", name, 20.39 throwError ? "error" : "exception"); 20.40 - return JVM_FindClassFromClassLoader(env, name, JNI_FALSE, 20.41 - (jobject)NULL, throwError); 20.42 + return jvm_find_class_from_class_loader(env, name, JNI_FALSE, 20.43 + (jobject)NULL, throwError, THREAD); 20.44 JVM_END 20.45 20.46 JVM_ENTRY(jclass, JVM_FindClassFromClassLoader(JNIEnv* env, const char* name, 20.47 @@ -658,26 +684,8 @@ 20.48 jboolean throwError)) 20.49 JVMWrapper3("JVM_FindClassFromClassLoader %s throw %s", name, 20.50 throwError ? "error" : "exception"); 20.51 - // Java libraries should ensure that name is never null... 20.52 - if (name == NULL || (int)strlen(name) > symbolOopDesc::max_length()) { 20.53 - // It's impossible to create this class; the name cannot fit 20.54 - // into the constant pool. 20.55 - if (throwError) { 20.56 - THROW_MSG_0(vmSymbols::java_lang_NoClassDefFoundError(), name); 20.57 - } else { 20.58 - THROW_MSG_0(vmSymbols::java_lang_ClassNotFoundException(), name); 20.59 - } 20.60 - } 20.61 - symbolHandle h_name = oopFactory::new_symbol_handle(name, CHECK_NULL); 20.62 - Handle h_loader(THREAD, JNIHandles::resolve(loader)); 20.63 - jclass result = find_class_from_class_loader(env, h_name, init, h_loader, 20.64 - Handle(), throwError, thread); 20.65 - 20.66 - if (TraceClassResolution && result != NULL) { 20.67 - trace_class_resolution(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(result))); 20.68 - } 20.69 - 20.70 - return result; 20.71 + return jvm_find_class_from_class_loader(env, name, init, loader, 20.72 + throwError, THREAD); 20.73 JVM_END 20.74 20.75
21.1 --- a/src/share/vm/runtime/globals.hpp Wed Oct 15 18:49:57 2008 -0700 21.2 +++ b/src/share/vm/runtime/globals.hpp Wed Oct 15 18:51:04 2008 -0700 21.3 @@ -330,6 +330,12 @@ 21.4 product_pd(bool, UseLargePages, \ 21.5 "Use large page memory") \ 21.6 \ 21.7 + product_pd(bool, UseLargePagesIndividualAllocation, \ 21.8 + "Allocate large pages individually for better affinity") \ 21.9 + \ 21.10 + develop(bool, LargePagesIndividualAllocationInjectError, false, \ 21.11 + "Fail large pages individual allocation") \ 21.12 + \ 21.13 develop(bool, TracePageSizes, false, \ 21.14 "Trace page size selection and usage.") \ 21.15 \ 21.16 @@ -1819,6 +1825,9 @@ 21.17 diagnostic(bool, VerifyDuringGC, false, \ 21.18 "Verify memory system during GC (between phases)") \ 21.19 \ 21.20 + diagnostic(bool, GCParallelVerificationEnabled, true, \ 21.21 + "Enable parallel memory system verification") \ 21.22 + \ 21.23 diagnostic(bool, VerifyRememberedSets, false, \ 21.24 "Verify GC remembered sets") \ 21.25 \
22.1 --- a/src/share/vm/runtime/thread.cpp Wed Oct 15 18:49:57 2008 -0700 22.2 +++ b/src/share/vm/runtime/thread.cpp Wed Oct 15 18:51:04 2008 -0700 22.3 @@ -2985,10 +2985,6 @@ 22.4 if (UseStringCache) { 22.5 // Forcibly initialize java/lang/String and mutate the private 22.6 // static final "stringCacheEnabled" field before we start creating instances 22.7 -#ifdef ASSERT 22.8 - klassOop tmp_k = SystemDictionary::find(vmSymbolHandles::java_lang_String(), Handle(), Handle(), CHECK_0); 22.9 - assert(tmp_k == NULL, "java/lang/String should not be loaded yet"); 22.10 -#endif 22.11 klassOop k_o = SystemDictionary::resolve_or_null(vmSymbolHandles::java_lang_String(), Handle(), Handle(), CHECK_0); 22.12 KlassHandle k = KlassHandle(THREAD, k_o); 22.13 guarantee(k.not_null(), "Must find java/lang/String");
23.1 --- a/test/compiler/6646019/Test.java Wed Oct 15 18:49:57 2008 -0700 23.2 +++ b/test/compiler/6646019/Test.java Wed Oct 15 18:51:04 2008 -0700 23.3 @@ -19,7 +19,6 @@ 23.4 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 23.5 * CA 95054 USA or visit www.sun.com if you need additional information or 23.6 * have any questions. 23.7 - * 23.8 */ 23.9 23.10 /*
24.1 --- a/test/compiler/6689060/Test.java Wed Oct 15 18:49:57 2008 -0700 24.2 +++ b/test/compiler/6689060/Test.java Wed Oct 15 18:51:04 2008 -0700 24.3 @@ -19,7 +19,6 @@ 24.4 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 24.5 * CA 95054 USA or visit www.sun.com if you need additional information or 24.6 * have any questions. 24.7 - * 24.8 */ 24.9 24.10 /*
25.1 --- a/test/compiler/6695810/Test.java Wed Oct 15 18:49:57 2008 -0700 25.2 +++ b/test/compiler/6695810/Test.java Wed Oct 15 18:51:04 2008 -0700 25.3 @@ -19,7 +19,6 @@ 25.4 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 25.5 * CA 95054 USA or visit www.sun.com if you need additional information or 25.6 * have any questions. 25.7 - * 25.8 */ 25.9 25.10 /*