Mon, 03 May 2010 17:23:58 -0400
Merge
1.1 --- a/src/cpu/sparc/vm/vm_version_sparc.cpp Mon May 03 16:31:07 2010 -0400 1.2 +++ b/src/cpu/sparc/vm/vm_version_sparc.cpp Mon May 03 17:23:58 2010 -0400 1.3 @@ -104,6 +104,12 @@ 1.4 if (FLAG_IS_DEFAULT(OptoLoopAlignment)) { 1.5 FLAG_SET_DEFAULT(OptoLoopAlignment, 4); 1.6 } 1.7 + // When using CMS, we cannot use memset() in BOT updates because 1.8 + // the sun4v/CMT version in libc_psr uses BIS which exposes 1.9 + // "phantom zeros" to concurrent readers. See 6948537. 1.10 + if (FLAG_IS_DEFAULT(UseMemSetInBOT) && UseConcMarkSweepGC) { 1.11 + FLAG_SET_DEFAULT(UseMemSetInBOT, false); 1.12 + } 1.13 } 1.14 1.15 // Use hardware population count instruction if available.
2.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Mon May 03 16:31:07 2010 -0400 2.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Mon May 03 17:23:58 2010 -0400 2.3 @@ -789,6 +789,14 @@ 2.4 _gc_counters = new CollectorCounters("CMS", 1); 2.5 _completed_initialization = true; 2.6 _inter_sweep_timer.start(); // start of time 2.7 +#ifdef SPARC 2.8 + // Issue a stern warning, but allow use for experimentation and debugging. 2.9 + if (VM_Version::is_sun4v() && UseMemSetInBOT) { 2.10 + assert(!FLAG_IS_DEFAULT(UseMemSetInBOT), "Error"); 2.11 + warning("Experimental flag -XX:+UseMemSetInBOT is known to cause instability" 2.12 + " on sun4v; please understand that you are using at your own risk!"); 2.13 + } 2.14 +#endif 2.15 } 2.16 2.17 const char* ConcurrentMarkSweepGeneration::name() const {
3.1 --- a/src/share/vm/memory/blockOffsetTable.hpp Mon May 03 16:31:07 2010 -0400 3.2 +++ b/src/share/vm/memory/blockOffsetTable.hpp Mon May 03 17:23:58 2010 -0400 3.3 @@ -140,14 +140,38 @@ 3.4 "right address out of range"); 3.5 assert(left < right, "Heap addresses out of order"); 3.6 size_t num_cards = pointer_delta(right, left) >> LogN_words; 3.7 - memset(&_offset_array[index_for(left)], offset, num_cards); 3.8 + 3.9 + // Below, we may use an explicit loop instead of memset() 3.10 + // because on certain platforms memset() can give concurrent 3.11 + // readers "out-of-thin-air," phantom zeros; see 6948537. 3.12 + if (UseMemSetInBOT) { 3.13 + memset(&_offset_array[index_for(left)], offset, num_cards); 3.14 + } else { 3.15 + size_t i = index_for(left); 3.16 + const size_t end = i + num_cards; 3.17 + for (; i < end; i++) { 3.18 + _offset_array[i] = offset; 3.19 + } 3.20 + } 3.21 } 3.22 3.23 void set_offset_array(size_t left, size_t right, u_char offset) { 3.24 assert(right < _vs.committed_size(), "right address out of range"); 3.25 assert(left <= right, "indexes out of order"); 3.26 size_t num_cards = right - left + 1; 3.27 - memset(&_offset_array[left], offset, num_cards); 3.28 + 3.29 + // Below, we may use an explicit loop instead of memset 3.30 + // because on certain platforms memset() can give concurrent 3.31 + // readers "out-of-thin-air," phantom zeros; see 6948537. 3.32 + if (UseMemSetInBOT) { 3.33 + memset(&_offset_array[left], offset, num_cards); 3.34 + } else { 3.35 + size_t i = left; 3.36 + const size_t end = i + num_cards; 3.37 + for (; i < end; i++) { 3.38 + _offset_array[i] = offset; 3.39 + } 3.40 + } 3.41 } 3.42 3.43 void check_offset_array(size_t index, HeapWord* high, HeapWord* low) const {
4.1 --- a/src/share/vm/runtime/globals.hpp Mon May 03 16:31:07 2010 -0400 4.2 +++ b/src/share/vm/runtime/globals.hpp Mon May 03 17:23:58 2010 -0400 4.3 @@ -327,6 +327,10 @@ 4.4 product(bool, UseMembar, false, \ 4.5 "(Unstable) Issues membars on thread state transitions") \ 4.6 \ 4.7 + /* Temporary: See 6948537 */ \ 4.8 + experimental(bool, UseMemSetInBOT, true, \ 4.9 + "(Unstable) uses memset in BOT updates in GC code") \ 4.10 + \ 4.11 diagnostic(bool, UnlockDiagnosticVMOptions, trueInDebug, \ 4.12 "Enable normal processing of flags relating to field diagnostics")\ 4.13 \