Tue, 28 Dec 2010 09:54:09 -0500
Merge
1.1 --- a/.hgtags Mon Dec 27 09:56:29 2010 -0500 1.2 +++ b/.hgtags Tue Dec 28 09:54:09 2010 -0500 1.3 @@ -136,3 +136,5 @@ 1.4 3f3653ab7af8dc1ddb9fa75dad56bf94f89e81a8 jdk7-b121 1.5 3a548dc9cb456110ca8fc1514441a8c3bda0014d jdk7-b122 1.6 5484e7c53fa7da5e869902437ee08a9ae10c1c69 hs20-b03 1.7 +9669f9b284108a9ee0a0ccbe215c37a130c9dcf5 jdk7-b123 1.8 +9669f9b284108a9ee0a0ccbe215c37a130c9dcf5 hs20-b04
2.1 --- a/make/hotspot_version Mon Dec 27 09:56:29 2010 -0500 2.2 +++ b/make/hotspot_version Tue Dec 28 09:54:09 2010 -0500 2.3 @@ -35,7 +35,7 @@ 2.4 2.5 HS_MAJOR_VER=20 2.6 HS_MINOR_VER=0 2.7 -HS_BUILD_NUMBER=04 2.8 +HS_BUILD_NUMBER=05 2.9 2.10 JDK_MAJOR_VER=1 2.11 JDK_MINOR_VER=7
3.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp Mon Dec 27 09:56:29 2010 -0500 3.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp Tue Dec 28 09:54:09 2010 -0500 3.3 @@ -1825,23 +1825,11 @@ 3.4 } 3.5 } 3.6 3.7 - 3.8 -class G1CMIsAliveClosure: public BoolObjectClosure { 3.9 - G1CollectedHeap* _g1; 3.10 - public: 3.11 - G1CMIsAliveClosure(G1CollectedHeap* g1) : 3.12 - _g1(g1) 3.13 - {} 3.14 - 3.15 - void do_object(oop obj) { 3.16 - assert(false, "not to be invoked"); 3.17 - } 3.18 - bool do_object_b(oop obj) { 3.19 - HeapWord* addr = (HeapWord*)obj; 3.20 - return addr != NULL && 3.21 - (!_g1->is_in_g1_reserved(addr) || !_g1->is_obj_ill(obj)); 3.22 - } 3.23 -}; 3.24 +bool G1CMIsAliveClosure::do_object_b(oop obj) { 3.25 + HeapWord* addr = (HeapWord*)obj; 3.26 + return addr != NULL && 3.27 + (!_g1->is_in_g1_reserved(addr) || !_g1->is_obj_ill(obj)); 3.28 +} 3.29 3.30 class G1CMKeepAliveClosure: public OopClosure { 3.31 G1CollectedHeap* _g1; 3.32 @@ -1896,16 +1884,15 @@ 3.33 rp->setup_policy(clear_all_soft_refs); 3.34 assert(_markStack.isEmpty(), "mark stack should be empty"); 3.35 3.36 - G1CMIsAliveClosure g1IsAliveClosure (g1h); 3.37 - G1CMKeepAliveClosure g1KeepAliveClosure(g1h, this, nextMarkBitMap()); 3.38 + G1CMIsAliveClosure g1_is_alive(g1h); 3.39 + G1CMKeepAliveClosure g1_keep_alive(g1h, this, nextMarkBitMap()); 3.40 G1CMDrainMarkingStackClosure 3.41 - g1DrainMarkingStackClosure(nextMarkBitMap(), &_markStack, 3.42 - &g1KeepAliveClosure); 3.43 + g1_drain_mark_stack(nextMarkBitMap(), &_markStack, &g1_keep_alive); 3.44 3.45 // XXXYYY Also: copy the parallel ref processing code from CMS. 3.46 - rp->process_discovered_references(&g1IsAliveClosure, 3.47 - &g1KeepAliveClosure, 3.48 - &g1DrainMarkingStackClosure, 3.49 + rp->process_discovered_references(&g1_is_alive, 3.50 + &g1_keep_alive, 3.51 + &g1_drain_mark_stack, 3.52 NULL); 3.53 assert(_markStack.overflow() || _markStack.isEmpty(), 3.54 "mark stack should be empty (unless it overflowed)"); 3.55 @@ -1918,8 +1905,8 @@ 3.56 assert(!rp->discovery_enabled(), "should have been disabled"); 3.57 3.58 // Now clean up stale oops in SymbolTable and StringTable 3.59 - SymbolTable::unlink(&g1IsAliveClosure); 3.60 - StringTable::unlink(&g1IsAliveClosure); 3.61 + SymbolTable::unlink(&g1_is_alive); 3.62 + StringTable::unlink(&g1_is_alive); 3.63 } 3.64 3.65 void ConcurrentMark::swapMarkBitMaps() {
4.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.hpp Mon Dec 27 09:56:29 2010 -0500 4.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.hpp Tue Dec 28 09:54:09 2010 -0500 4.3 @@ -33,6 +33,25 @@ 4.4 typedef GenericTaskQueue<oop> CMTaskQueue; 4.5 typedef GenericTaskQueueSet<CMTaskQueue> CMTaskQueueSet; 4.6 4.7 +// Closure used by CM during concurrent reference discovery 4.8 +// and reference processing (during remarking) to determine 4.9 +// if a particular object is alive. It is primarily used 4.10 +// to determine if referents of discovered reference objects 4.11 +// are alive. An instance is also embedded into the 4.12 +// reference processor as the _is_alive_non_header field 4.13 +class G1CMIsAliveClosure: public BoolObjectClosure { 4.14 + G1CollectedHeap* _g1; 4.15 + public: 4.16 + G1CMIsAliveClosure(G1CollectedHeap* g1) : 4.17 + _g1(g1) 4.18 + {} 4.19 + 4.20 + void do_object(oop obj) { 4.21 + ShouldNotCallThis(); 4.22 + } 4.23 + bool do_object_b(oop obj); 4.24 +}; 4.25 + 4.26 // A generic CM bit map. This is essentially a wrapper around the BitMap 4.27 // class, with one bit per (1<<_shifter) HeapWords. 4.28
5.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Mon Dec 27 09:56:29 2010 -0500 5.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Tue Dec 28 09:54:09 2010 -0500 5.3 @@ -1192,6 +1192,7 @@ 5.4 return false; 5.5 } 5.6 5.7 + DTraceGCProbeMarker gc_probe_marker(true /* full */); 5.8 ResourceMark rm; 5.9 5.10 if (PrintHeapAtGC) { 5.11 @@ -1768,6 +1769,7 @@ 5.12 _g1_policy(policy_), 5.13 _dirty_card_queue_set(false), 5.14 _into_cset_dirty_card_queue_set(false), 5.15 + _is_alive_closure(this), 5.16 _ref_processor(NULL), 5.17 _process_strong_tasks(new SubTasksDone(G1H_PS_NumElements)), 5.18 _bot_shared(NULL), 5.19 @@ -2061,7 +2063,8 @@ 5.20 mr, // span 5.21 false, // Reference discovery is not atomic 5.22 true, // mt_discovery 5.23 - NULL, // is alive closure: need to fill this in for efficiency 5.24 + &_is_alive_closure, // is alive closure 5.25 + // for efficiency 5.26 ParallelGCThreads, 5.27 ParallelRefProcEnabled, 5.28 true); // Setting next fields of discovered 5.29 @@ -3211,13 +3214,14 @@ 5.30 return false; 5.31 } 5.32 5.33 + DTraceGCProbeMarker gc_probe_marker(false /* full */); 5.34 + ResourceMark rm; 5.35 + 5.36 if (PrintHeapAtGC) { 5.37 Universe::print_heap_before_gc(); 5.38 } 5.39 5.40 { 5.41 - ResourceMark rm; 5.42 - 5.43 // This call will decide whether this pause is an initial-mark 5.44 // pause. If it is, during_initial_mark_pause() will return true 5.45 // for the duration of this pause. 5.46 @@ -3956,8 +3960,6 @@ 5.47 // Now restore saved marks, if any. 5.48 if (_objs_with_preserved_marks != NULL) { 5.49 assert(_preserved_marks_of_objs != NULL, "Both or none."); 5.50 - assert(_objs_with_preserved_marks->length() == 5.51 - _preserved_marks_of_objs->length(), "Both or none."); 5.52 guarantee(_objs_with_preserved_marks->length() == 5.53 _preserved_marks_of_objs->length(), "Both or none."); 5.54 for (int i = 0; i < _objs_with_preserved_marks->length(); i++) { 5.55 @@ -4052,7 +4054,10 @@ 5.56 } 5.57 5.58 void G1CollectedHeap::preserve_mark_if_necessary(oop obj, markOop m) { 5.59 - if (m != markOopDesc::prototype()) { 5.60 + assert(evacuation_failed(), "Oversaving!"); 5.61 + // We want to call the "for_promotion_failure" version only in the 5.62 + // case of a promotion failure. 5.63 + if (m->must_be_preserved_for_promotion_failure(obj)) { 5.64 if (_objs_with_preserved_marks == NULL) { 5.65 assert(_preserved_marks_of_objs == NULL, "Both or none."); 5.66 _objs_with_preserved_marks =
6.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Mon Dec 27 09:56:29 2010 -0500 6.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Tue Dec 28 09:54:09 2010 -0500 6.3 @@ -849,6 +849,12 @@ 6.4 void print_gc_alloc_regions(); 6.5 #endif // !PRODUCT 6.6 6.7 + // Instance of the concurrent mark is_alive closure for embedding 6.8 + // into the reference processor as the is_alive_non_header. This 6.9 + // prevents unnecessary additions to the discovered lists during 6.10 + // concurrent discovery. 6.11 + G1CMIsAliveClosure _is_alive_closure; 6.12 + 6.13 // ("Weak") Reference processing support 6.14 ReferenceProcessor* _ref_processor; 6.15 6.16 @@ -893,7 +899,7 @@ 6.17 // specified by the policy object. 6.18 jint initialize(); 6.19 6.20 - void ref_processing_init(); 6.21 + virtual void ref_processing_init(); 6.22 6.23 void set_par_threads(int t) { 6.24 SharedHeap::set_par_threads(t);
7.1 --- a/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp Mon Dec 27 09:56:29 2010 -0500 7.2 +++ b/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp Tue Dec 28 09:54:09 2010 -0500 7.3 @@ -1058,10 +1058,11 @@ 7.4 #endif 7.5 7.6 void ParNewGeneration::preserve_mark_if_necessary(oop obj, markOop m) { 7.7 - if ((m != markOopDesc::prototype()) && 7.8 - (!UseBiasedLocking || (m != markOopDesc::biased_locking_prototype()))) { 7.9 + if (m->must_be_preserved_for_promotion_failure(obj)) { 7.10 + // We should really have separate per-worker stacks, rather 7.11 + // than use locking of a common pair of stacks. 7.12 MutexLocker ml(ParGCRareEvent_lock); 7.13 - DefNewGeneration::preserve_mark_if_necessary(obj, m); 7.14 + preserve_mark(obj, m); 7.15 } 7.16 } 7.17
8.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp Mon Dec 27 09:56:29 2010 -0500 8.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp Tue Dec 28 09:54:09 2010 -0500 8.3 @@ -694,6 +694,8 @@ 8.4 void PSScavenge::oop_promotion_failed(oop obj, markOop obj_mark) { 8.5 _promotion_failed = true; 8.6 if (obj_mark->must_be_preserved_for_promotion_failure(obj)) { 8.7 + // Should use per-worker private stakcs hetre rather than 8.8 + // locking a common pair of stacks. 8.9 ThreadCritical tc; 8.10 _preserved_oop_stack.push(obj); 8.11 _preserved_mark_stack.push(obj_mark);
9.1 --- a/src/share/vm/gc_implementation/shared/vmGCOperations.hpp Mon Dec 27 09:56:29 2010 -0500 9.2 +++ b/src/share/vm/gc_implementation/shared/vmGCOperations.hpp Tue Dec 28 09:54:09 2010 -0500 9.3 @@ -209,4 +209,15 @@ 9.4 HeapWord* result() const { return _res; } 9.5 }; 9.6 9.7 +class DTraceGCProbeMarker : public StackObj { 9.8 +public: 9.9 + DTraceGCProbeMarker(bool full) { 9.10 + VM_GC_Operation::notify_gc_begin(full); 9.11 + } 9.12 + 9.13 + ~DTraceGCProbeMarker() { 9.14 + VM_GC_Operation::notify_gc_end(); 9.15 + } 9.16 +}; 9.17 + 9.18 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_VMGCOPERATIONS_HPP
10.1 --- a/src/share/vm/memory/defNewGeneration.cpp Mon Dec 27 09:56:29 2010 -0500 10.2 +++ b/src/share/vm/memory/defNewGeneration.cpp Tue Dec 28 09:54:09 2010 -0500 10.3 @@ -684,23 +684,28 @@ 10.4 _preserved_marks_of_objs.clear(true); 10.5 } 10.6 10.7 +void DefNewGeneration::preserve_mark(oop obj, markOop m) { 10.8 + assert(promotion_failed() && m->must_be_preserved_for_promotion_failure(obj), 10.9 + "Oversaving!"); 10.10 + _objs_with_preserved_marks.push(obj); 10.11 + _preserved_marks_of_objs.push(m); 10.12 +} 10.13 + 10.14 void DefNewGeneration::preserve_mark_if_necessary(oop obj, markOop m) { 10.15 if (m->must_be_preserved_for_promotion_failure(obj)) { 10.16 - _objs_with_preserved_marks.push(obj); 10.17 - _preserved_marks_of_objs.push(m); 10.18 + preserve_mark(obj, m); 10.19 } 10.20 } 10.21 10.22 void DefNewGeneration::handle_promotion_failure(oop old) { 10.23 - preserve_mark_if_necessary(old, old->mark()); 10.24 - if (!_promotion_failed && PrintPromotionFailure) { 10.25 + if (PrintPromotionFailure && !_promotion_failed) { 10.26 gclog_or_tty->print(" (promotion failure size = " SIZE_FORMAT ") ", 10.27 old->size()); 10.28 } 10.29 - 10.30 + _promotion_failed = true; 10.31 + preserve_mark_if_necessary(old, old->mark()); 10.32 // forward to self 10.33 old->forward_to(old); 10.34 - _promotion_failed = true; 10.35 10.36 _promo_failure_scan_stack.push(old); 10.37
11.1 --- a/src/share/vm/memory/defNewGeneration.hpp Mon Dec 27 09:56:29 2010 -0500 11.2 +++ b/src/share/vm/memory/defNewGeneration.hpp Tue Dec 28 09:54:09 2010 -0500 11.3 @@ -85,6 +85,7 @@ 11.4 // Preserve the mark of "obj", if necessary, in preparation for its mark 11.5 // word being overwritten with a self-forwarding-pointer. 11.6 void preserve_mark_if_necessary(oop obj, markOop m); 11.7 + void preserve_mark(oop obj, markOop m); // work routine used by the above 11.8 11.9 // Together, these keep <object with a preserved mark, mark value> pairs. 11.10 // They should always contain the same number of elements.
12.1 --- a/src/share/vm/oops/markOop.inline.hpp Mon Dec 27 09:56:29 2010 -0500 12.2 +++ b/src/share/vm/oops/markOop.inline.hpp Tue Dec 28 09:54:09 2010 -0500 12.3 @@ -30,7 +30,7 @@ 12.4 #include "oops/markOop.hpp" 12.5 #include "runtime/globals.hpp" 12.6 12.7 -// Should this header be preserved during GC? 12.8 +// Should this header be preserved during GC (when biased locking is enabled)? 12.9 inline bool markOopDesc::must_be_preserved_with_bias(oop obj_containing_mark) const { 12.10 assert(UseBiasedLocking, "unexpected"); 12.11 if (has_bias_pattern()) { 12.12 @@ -47,14 +47,15 @@ 12.13 return (!is_unlocked() || !has_no_hash()); 12.14 } 12.15 12.16 +// Should this header be preserved during GC? 12.17 inline bool markOopDesc::must_be_preserved(oop obj_containing_mark) const { 12.18 if (!UseBiasedLocking) 12.19 return (!is_unlocked() || !has_no_hash()); 12.20 return must_be_preserved_with_bias(obj_containing_mark); 12.21 } 12.22 12.23 -// Should this header (including its age bits) be preserved in the 12.24 -// case of a promotion failure during scavenge? 12.25 +// Should this header be preserved in the case of a promotion failure 12.26 +// during scavenge (when biased locking is enabled)? 12.27 inline bool markOopDesc::must_be_preserved_with_bias_for_promotion_failure(oop obj_containing_mark) const { 12.28 assert(UseBiasedLocking, "unexpected"); 12.29 // We don't explicitly save off the mark words of biased and 12.30 @@ -70,18 +71,20 @@ 12.31 prototype_for_object(obj_containing_mark)->has_bias_pattern()) { 12.32 return true; 12.33 } 12.34 - return (this != prototype()); 12.35 + return (!is_unlocked() || !has_no_hash()); 12.36 } 12.37 12.38 +// Should this header be preserved in the case of a promotion failure 12.39 +// during scavenge? 12.40 inline bool markOopDesc::must_be_preserved_for_promotion_failure(oop obj_containing_mark) const { 12.41 if (!UseBiasedLocking) 12.42 - return (this != prototype()); 12.43 + return (!is_unlocked() || !has_no_hash()); 12.44 return must_be_preserved_with_bias_for_promotion_failure(obj_containing_mark); 12.45 } 12.46 12.47 12.48 -// Should this header (including its age bits) be preserved in the 12.49 -// case of a scavenge in which CMS is the old generation? 12.50 +// Same as must_be_preserved_with_bias_for_promotion_failure() except that 12.51 +// it takes a klassOop argument, instead of the object of which this is the mark word. 12.52 inline bool markOopDesc::must_be_preserved_with_bias_for_cms_scavenge(klassOop klass_of_obj_containing_mark) const { 12.53 assert(UseBiasedLocking, "unexpected"); 12.54 // CMS scavenges preserve mark words in similar fashion to promotion failures; see above 12.55 @@ -89,11 +92,14 @@ 12.56 klass_of_obj_containing_mark->klass_part()->prototype_header()->has_bias_pattern()) { 12.57 return true; 12.58 } 12.59 - return (this != prototype()); 12.60 + return (!is_unlocked() || !has_no_hash()); 12.61 } 12.62 + 12.63 +// Same as must_be_preserved_for_promotion_failure() except that 12.64 +// it takes a klassOop argument, instead of the object of which this is the mark word. 12.65 inline bool markOopDesc::must_be_preserved_for_cms_scavenge(klassOop klass_of_obj_containing_mark) const { 12.66 if (!UseBiasedLocking) 12.67 - return (this != prototype()); 12.68 + return (!is_unlocked() || !has_no_hash()); 12.69 return must_be_preserved_with_bias_for_cms_scavenge(klass_of_obj_containing_mark); 12.70 } 12.71