# HG changeset patch # User never # Date 1214067811 25200 # Node ID 411c61adc994089a9e74d79a1597054c8dc9d7f5 # Parent 337e0e51cd6b6eaa9bb3033e13dabe65572cdc6a# Parent 8d191a7697e2258c90addaf9de2774f4d4897737 Merge diff -r 8d191a7697e2 -r 411c61adc994 .hgtags --- a/.hgtags Fri Jun 20 11:10:05 2008 -0700 +++ b/.hgtags Sat Jun 21 10:03:31 2008 -0700 @@ -2,3 +2,4 @@ 7836be3e92d0a4f9ee7566f602c91f5609534e66 jdk7-b25 ad0b851458ff9d1d490ed2d79bb84f75a9fdb753 jdk7-b26 e3d2692f8442e2d951166dc9bd9a330684754438 jdk7-b27 +c14dab40ed9bf45ad21150bd70c9c80cdf655415 jdk7-b28 diff -r 8d191a7697e2 -r 411c61adc994 make/defs.make --- a/make/defs.make Fri Jun 20 11:10:05 2008 -0700 +++ b/make/defs.make Sat Jun 21 10:03:31 2008 -0700 @@ -261,3 +261,21 @@ EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jni.h EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jmm.h + +# A list of object files built without the platform specific PIC flags, e.g. +# -fPIC on linux. Performance measurements show that by compiling GC related +# code, we could significantly reduce the GC pause time on 32 bit Linux/Unix +# platforms. See 6454213 for more details. +include $(GAMMADIR)/make/scm.make + +ifneq ($(OSNAME), windows) + ifndef LP64 + NONPIC_DIRS = memory oops gc_implementation gc_interface + NONPIC_DIRS := $(foreach dir,$(NONPIC_DIRS), $(GAMMADIR)/src/share/vm/$(dir)) + # Look for source files under NONPIC_DIRS + NONPIC_FILES := $(foreach dir,$(NONPIC_DIRS),\ + $(shell find $(dir) \( $(SCM_DIRS) \) -prune -o \ + -name '*.cpp' -print)) + NONPIC_OBJ_FILES := $(notdir $(subst .cpp,.o,$(NONPIC_FILES))) + endif +endif diff -r 8d191a7697e2 -r 411c61adc994 make/hotspot_version --- a/make/hotspot_version Fri Jun 20 11:10:05 2008 -0700 +++ b/make/hotspot_version Sat Jun 21 10:03:31 2008 -0700 @@ -33,9 +33,9 @@ # Don't put quotes (fail windows build). HOTSPOT_VM_COPYRIGHT=Copyright 2008 -HS_MAJOR_VER=13 +HS_MAJOR_VER=14 HS_MINOR_VER=0 -HS_BUILD_NUMBER=02 +HS_BUILD_NUMBER=01 JDK_MAJOR_VER=1 JDK_MINOR_VER=7 diff -r 8d191a7697e2 -r 411c61adc994 make/linux/makefiles/gcc.make --- a/make/linux/makefiles/gcc.make Fri Jun 20 11:10:05 2008 -0700 +++ b/make/linux/makefiles/gcc.make Sat Jun 21 10:03:31 2008 -0700 @@ -50,14 +50,7 @@ VM_PICFLAG/LIBJVM = $(PICFLAG) VM_PICFLAG/AOUT = - -ifneq ($(BUILDARCH), i486) VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) -else -# PIC has significant overhead on x86, build nonpic VM for now. -# Link JVM at a "good" base location to avoid unnecessary .text patching. -JVM_BASE_ADDR = 0x06000000 -endif CFLAGS += $(VM_PICFLAG) CFLAGS += -fno-rtti diff -r 8d191a7697e2 -r 411c61adc994 make/linux/makefiles/rules.make --- a/make/linux/makefiles/rules.make Fri Jun 20 11:10:05 2008 -0700 +++ b/make/linux/makefiles/rules.make Sat Jun 21 10:03:31 2008 -0700 @@ -133,10 +133,22 @@ COMPILE_DONE = && { echo Done with $<; } endif +include $(GAMMADIR)/make/defs.make + +# The non-PIC object files are only generated for 32 bit platforms. +ifdef LP64 %.o: %.cpp @echo Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE) +else +%.o: %.cpp + @echo Compiling $< + $(QUIETLY) $(REMOVE_TARGET) + $(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \ + $(subst $(VM_PICFLAG), ,$(COMPILE.CC)) -o $@ $< $(COMPILE_DONE), \ + $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)) +endif %.o: %.s @echo Assembling $< diff -r 8d191a7697e2 -r 411c61adc994 make/solaris/makefiles/jvmg.make --- a/make/solaris/makefiles/jvmg.make Fri Jun 20 11:10:05 2008 -0700 +++ b/make/solaris/makefiles/jvmg.make Sat Jun 21 10:03:31 2008 -0700 @@ -30,7 +30,7 @@ ifeq ("${Platform_compiler}", "sparcWorks") -ifeq ($(COMPILER_REV),5.8)) +ifeq ($(COMPILER_REV),5.8) # SS11 SEGV when compiling with -g and -xarch=v8, using different backend DEBUG_CFLAGS/compileBroker.o = $(DEBUG_CFLAGS) -xO0 DEBUG_CFLAGS/jvmtiTagMap.o = $(DEBUG_CFLAGS) -xO0 diff -r 8d191a7697e2 -r 411c61adc994 make/solaris/makefiles/rules.make --- a/make/solaris/makefiles/rules.make Fri Jun 20 11:10:05 2008 -0700 +++ b/make/solaris/makefiles/rules.make Sat Jun 21 10:03:31 2008 -0700 @@ -133,19 +133,7 @@ COMPILE_DONE = && { echo Done with $<; } endif -# A list of directories under which all source code are built without -KPIC/-Kpic -# flag. Performance measurements show that compiling GC related code will -# dramatically reduce the gc pause time. See bug 6454213 for more details. - -include $(GAMMADIR)/make/scm.make - -NONPIC_DIRS = memory oops gc_implementation gc_interface -NONPIC_DIRS := $(foreach dir,$(NONPIC_DIRS), $(GAMMADIR)/src/share/vm/$(dir)) -# Look for source code under NONPIC_DIRS -NONPIC_FILES := $(foreach dir,$(NONPIC_DIRS),\ - $(shell find $(dir) \( $(SCM_DIRS) \) -prune -o \ - -name '*.cpp' -print)) -NONPIC_OBJ_FILES := $(notdir $(subst .cpp,.o,$(NONPIC_FILES))) +include $(GAMMADIR)/make/defs.make # Sun compiler for 64 bit Solaris does not support building non-PIC object files. ifdef LP64 diff -r 8d191a7697e2 -r 411c61adc994 src/os/linux/vm/jvm_linux.cpp --- a/src/os/linux/vm/jvm_linux.cpp Fri Jun 20 11:10:05 2008 -0700 +++ b/src/os/linux/vm/jvm_linux.cpp Sat Jun 21 10:03:31 2008 -0700 @@ -132,7 +132,7 @@ */ struct siglabel { - char *name; + const char *name; int number; }; diff -r 8d191a7697e2 -r 411c61adc994 src/os/linux/vm/os_linux.cpp --- a/src/os/linux/vm/os_linux.cpp Fri Jun 20 11:10:05 2008 -0700 +++ b/src/os/linux/vm/os_linux.cpp Sat Jun 21 10:03:31 2008 -0700 @@ -75,8 +75,8 @@ bool os::Linux::_is_floating_stack = false; bool os::Linux::_is_NPTL = false; bool os::Linux::_supports_fast_thread_cpu_time = false; -char * os::Linux::_glibc_version = NULL; -char * os::Linux::_libpthread_version = NULL; +const char * os::Linux::_glibc_version = NULL; +const char * os::Linux::_libpthread_version = NULL; static jlong initial_time_count=0; @@ -213,9 +213,9 @@ // the system call returns 1. This causes the VM to act as if it is // a single processor and elide locking (see is_MP() call). static bool unsafe_chroot_detected = false; -static char *unstable_chroot_error = "/proc file system not found.\n" - "Java may be unstable running multithreaded in a chroot " - "environment on Linux when /proc filesystem is not mounted."; +static const char *unstable_chroot_error = "/proc file system not found.\n" + "Java may be unstable running multithreaded in a chroot " + "environment on Linux when /proc filesystem is not mounted."; void os::Linux::initialize_system_info() { _processor_count = sysconf(_SC_NPROCESSORS_CONF); @@ -544,26 +544,23 @@ if (n > 0) { char *str = (char *)malloc(n); confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n); - // Vanilla RH-9 (glibc 2.3.2) has a bug that confstr() always tells // us "NPTL-0.29" even we are running with LinuxThreads. Check if this - // is the case: + // is the case. LinuxThreads has a hard limit on max number of threads. + // So sysconf(_SC_THREAD_THREADS_MAX) will return a positive value. + // On the other hand, NPTL does not have such a limit, sysconf() + // will return -1 and errno is not changed. Check if it is really NPTL. if (strcmp(os::Linux::glibc_version(), "glibc 2.3.2") == 0 && - strstr(str, "NPTL")) { - // LinuxThreads has a hard limit on max number of threads. So - // sysconf(_SC_THREAD_THREADS_MAX) will return a positive value. - // On the other hand, NPTL does not have such a limit, sysconf() - // will return -1 and errno is not changed. Check if it is really - // NPTL: - if (sysconf(_SC_THREAD_THREADS_MAX) > 0) { - free(str); - str = "linuxthreads"; - } + strstr(str, "NPTL") && + sysconf(_SC_THREAD_THREADS_MAX) > 0) { + free(str); + os::Linux::set_libpthread_version("linuxthreads"); + } else { + os::Linux::set_libpthread_version(str); } - os::Linux::set_libpthread_version(str); } else { - // glibc before 2.3.2 only has LinuxThreads. - os::Linux::set_libpthread_version("linuxthreads"); + // glibc before 2.3.2 only has LinuxThreads. + os::Linux::set_libpthread_version("linuxthreads"); } if (strstr(libpthread_version(), "NPTL")) { @@ -4632,11 +4629,7 @@ // Unlike system(), this function can be called from signal handler. It // doesn't block SIGINT et al. int os::fork_and_exec(char* cmd) { - char * argv[4]; - argv[0] = "sh"; - argv[1] = "-c"; - argv[2] = cmd; - argv[3] = NULL; + const char * argv[4] = {"sh", "-c", cmd, NULL}; // fork() in LinuxThreads/NPTL is not async-safe. It needs to run // pthread_atfork handlers and reset pthread library. All we need is a @@ -4661,7 +4654,7 @@ // IA64 should use normal execve() from glibc to match the glibc fork() // above. NOT_IA64(syscall(__NR_execve, "/bin/sh", argv, environ);) - IA64_ONLY(execve("/bin/sh", argv, environ);) + IA64_ONLY(execve("/bin/sh", (char* const*)argv, environ);) // execve failed _exit(-1); diff -r 8d191a7697e2 -r 411c61adc994 src/os/linux/vm/os_linux.hpp --- a/src/os/linux/vm/os_linux.hpp Fri Jun 20 11:10:05 2008 -0700 +++ b/src/os/linux/vm/os_linux.hpp Sat Jun 21 10:03:31 2008 -0700 @@ -52,8 +52,8 @@ static address _initial_thread_stack_bottom; static uintptr_t _initial_thread_stack_size; - static char *_glibc_version; - static char *_libpthread_version; + static const char *_glibc_version; + static const char *_libpthread_version; static bool _is_floating_stack; static bool _is_NPTL; @@ -72,8 +72,8 @@ static julong physical_memory() { return _physical_memory; } static void initialize_system_info(); - static void set_glibc_version(char *s) { _glibc_version = s; } - static void set_libpthread_version(char *s) { _libpthread_version = s; } + static void set_glibc_version(const char *s) { _glibc_version = s; } + static void set_libpthread_version(const char *s) { _libpthread_version = s; } static bool supports_variable_stack_size(); @@ -134,8 +134,8 @@ static bool chained_handler(int sig, siginfo_t* siginfo, void* context); // GNU libc and libpthread version strings - static char *glibc_version() { return _glibc_version; } - static char *libpthread_version() { return _libpthread_version; } + static const char *glibc_version() { return _glibc_version; } + static const char *libpthread_version() { return _libpthread_version; } // NPTL or LinuxThreads? static bool is_LinuxThreads() { return !_is_NPTL; } diff -r 8d191a7697e2 -r 411c61adc994 src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp --- a/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Fri Jun 20 11:10:05 2008 -0700 +++ b/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Sat Jun 21 10:03:31 2008 -0700 @@ -1004,6 +1004,9 @@ DEBUG_ONLY(mark_bitmap()->verify_clear();) DEBUG_ONLY(summary_data().verify_clear();) + + // Have worker threads release resources the next time they run a task. + gc_task_manager()->release_all_resources(); } void PSParallelCompact::post_compact() @@ -1949,12 +1952,6 @@ TimeStamp compaction_start; TimeStamp collection_exit; - // "serial_CM" is needed until the parallel implementation - // of the move and update is done. - ParCompactionManager* serial_CM = new ParCompactionManager(); - // Don't initialize more than once. - // serial_CM->initialize(&summary_data(), mark_bitmap()); - ParallelScavengeHeap* heap = gc_heap(); GCCause::Cause gc_cause = heap->gc_cause(); PSYoungGen* young_gen = heap->young_gen(); @@ -1969,6 +1966,10 @@ PreGCValues pre_gc_values; pre_compact(&pre_gc_values); + // Get the compaction manager reserved for the VM thread. + ParCompactionManager* const vmthread_cm = + ParCompactionManager::manager_array(gc_task_manager()->workers()); + // Place after pre_compact() where the number of invocations is incremented. AdaptiveSizePolicyOutput(size_policy, heap->total_collections()); @@ -2008,7 +2009,7 @@ bool marked_for_unloading = false; marking_start.update(); - marking_phase(serial_CM, maximum_heap_compaction); + marking_phase(vmthread_cm, maximum_heap_compaction); #ifndef PRODUCT if (TraceParallelOldGCMarkingPhase) { @@ -2039,7 +2040,7 @@ #endif bool max_on_system_gc = UseMaximumCompactionOnSystemGC && is_system_gc; - summary_phase(serial_CM, maximum_heap_compaction || max_on_system_gc); + summary_phase(vmthread_cm, maximum_heap_compaction || max_on_system_gc); #ifdef ASSERT if (VerifyParallelOldWithMarkSweep && @@ -2067,13 +2068,13 @@ // code can use the the forwarding pointers to // check the new pointer calculation. The restore_marks() // has to be done before the real compact. - serial_CM->set_action(ParCompactionManager::VerifyUpdate); - compact_perm(serial_CM); - compact_serial(serial_CM); - serial_CM->set_action(ParCompactionManager::ResetObjects); - compact_perm(serial_CM); - compact_serial(serial_CM); - serial_CM->set_action(ParCompactionManager::UpdateAndCopy); + vmthread_cm->set_action(ParCompactionManager::VerifyUpdate); + compact_perm(vmthread_cm); + compact_serial(vmthread_cm); + vmthread_cm->set_action(ParCompactionManager::ResetObjects); + compact_perm(vmthread_cm); + compact_serial(vmthread_cm); + vmthread_cm->set_action(ParCompactionManager::UpdateAndCopy); // For debugging only PSMarkSweep::restore_marks(); @@ -2084,16 +2085,14 @@ compaction_start.update(); // Does the perm gen always have to be done serially because // klasses are used in the update of an object? - compact_perm(serial_CM); + compact_perm(vmthread_cm); if (UseParallelOldGCCompacting) { compact(); } else { - compact_serial(serial_CM); + compact_serial(vmthread_cm); } - delete serial_CM; - // Reset the mark bitmap, summary data, and do other bookkeeping. Must be // done before resizing. post_compact(); diff -r 8d191a7697e2 -r 411c61adc994 src/share/vm/memory/cardTableModRefBS.cpp --- a/src/share/vm/memory/cardTableModRefBS.cpp Fri Jun 20 11:10:05 2008 -0700 +++ b/src/share/vm/memory/cardTableModRefBS.cpp Sat Jun 21 10:03:31 2008 -0700 @@ -196,6 +196,8 @@ assert(_whole_heap.contains(new_region), "attempt to cover area not in reserved area"); debug_only(verify_guard();) + // collided is true if the expansion would push into another committed region + debug_only(bool collided = false;) int const ind = find_covering_region_by_base(new_region.start()); MemRegion const old_region = _covered[ind]; assert(old_region.start() == new_region.start(), "just checking"); @@ -211,12 +213,36 @@ } // Align the end up to a page size (starts are already aligned). jbyte* const new_end = byte_after(new_region.last()); - HeapWord* const new_end_aligned = + HeapWord* new_end_aligned = (HeapWord*) align_size_up((uintptr_t)new_end, _page_size); assert(new_end_aligned >= (HeapWord*) new_end, "align up, but less"); + int ri = 0; + for (ri = 0; ri < _cur_covered_regions; ri++) { + if (ri != ind) { + if (_committed[ri].contains(new_end_aligned)) { + assert((new_end_aligned >= _committed[ri].start()) && + (_committed[ri].start() > _committed[ind].start()), + "New end of committed region is inconsistent"); + new_end_aligned = _committed[ri].start(); + assert(new_end_aligned > _committed[ind].start(), + "New end of committed region is before start"); + debug_only(collided = true;) + // Should only collide with 1 region + break; + } + } + } +#ifdef ASSERT + for (++ri; ri < _cur_covered_regions; ri++) { + assert(!_committed[ri].contains(new_end_aligned), + "New end of committed region is in a second committed region"); + } +#endif // The guard page is always committed and should not be committed over. - HeapWord* const new_end_for_commit = MIN2(new_end_aligned, _guard_region.start()); + HeapWord* const new_end_for_commit = MIN2(new_end_aligned, + _guard_region.start()); + if (new_end_for_commit > cur_committed.end()) { // Must commit new pages. MemRegion const new_committed = @@ -239,9 +265,11 @@ if (!uncommit_region.is_empty()) { if (!os::uncommit_memory((char*)uncommit_region.start(), uncommit_region.byte_size())) { - // Do better than this for Merlin - vm_exit_out_of_memory(uncommit_region.byte_size(), - "card table contraction"); + assert(false, "Card table contraction failed"); + // The call failed so don't change the end of the + // committed region. This is better than taking the + // VM down. + new_end_aligned = _committed[ind].end(); } } } @@ -257,8 +285,25 @@ } assert(index_for(new_region.last()) < (int) _guard_index, "The guard card will be overwritten"); - jbyte* const end = byte_after(new_region.last()); + // This line commented out cleans the newly expanded region and + // not the aligned up expanded region. + // jbyte* const end = byte_after(new_region.last()); + jbyte* const end = (jbyte*) new_end_for_commit; + assert((end >= byte_after(new_region.last())) || collided, + "Expect to be beyond new region unless impacting another region"); // do nothing if we resized downward. +#ifdef ASSERT + for (int ri = 0; ri < _cur_covered_regions; ri++) { + if (ri != ind) { + // The end of the new committed region should not + // be in any existing region unless it matches + // the start of the next region. + assert(!_committed[ri].contains(end) || + (_committed[ri].start() == (HeapWord*) end), + "Overlapping committed regions"); + } + } +#endif if (entry < end) { memset(entry, clean_card, pointer_delta(end, entry, sizeof(jbyte))); }