1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Thu Aug 15 10:05:50 2013 +0200 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Thu Aug 15 10:52:18 2013 +0200 1.3 @@ -46,6 +46,7 @@ 1.4 // may combine concurrent marking with parallel, incremental compaction of 1.5 // heap subsets that will yield large amounts of garbage. 1.6 1.7 +// Forward declarations 1.8 class HeapRegion; 1.9 class HRRSCleanupTask; 1.10 class GenerationSpec; 1.11 @@ -69,6 +70,7 @@ 1.12 class G1NewTracer; 1.13 class G1OldTracer; 1.14 class EvacuationFailedInfo; 1.15 +class nmethod; 1.16 1.17 typedef OverflowTaskQueue<StarTask, mtGC> RefToScanQueue; 1.18 typedef GenericTaskQueueSet<RefToScanQueue, mtGC> RefToScanQueueSet; 1.19 @@ -163,18 +165,6 @@ 1.20 : G1AllocRegion("Mutator Alloc Region", false /* bot_updates */) { } 1.21 }; 1.22 1.23 -// The G1 STW is alive closure. 1.24 -// An instance is embedded into the G1CH and used as the 1.25 -// (optional) _is_alive_non_header closure in the STW 1.26 -// reference processor. It is also extensively used during 1.27 -// reference processing during STW evacuation pauses. 1.28 -class G1STWIsAliveClosure: public BoolObjectClosure { 1.29 - G1CollectedHeap* _g1; 1.30 -public: 1.31 - G1STWIsAliveClosure(G1CollectedHeap* g1) : _g1(g1) {} 1.32 - bool do_object_b(oop p); 1.33 -}; 1.34 - 1.35 class SurvivorGCAllocRegion : public G1AllocRegion { 1.36 protected: 1.37 virtual HeapRegion* allocate_new_region(size_t word_size, bool force); 1.38 @@ -193,6 +183,18 @@ 1.39 : G1AllocRegion("Old GC Alloc Region", true /* bot_updates */) { } 1.40 }; 1.41 1.42 +// The G1 STW is alive closure. 1.43 +// An instance is embedded into the G1CH and used as the 1.44 +// (optional) _is_alive_non_header closure in the STW 1.45 +// reference processor. It is also extensively used during 1.46 +// reference processing during STW evacuation pauses. 1.47 +class G1STWIsAliveClosure: public BoolObjectClosure { 1.48 + G1CollectedHeap* _g1; 1.49 +public: 1.50 + G1STWIsAliveClosure(G1CollectedHeap* g1) : _g1(g1) {} 1.51 + bool do_object_b(oop p); 1.52 +}; 1.53 + 1.54 class RefineCardTableEntryClosure; 1.55 1.56 class G1CollectedHeap : public SharedHeap { 1.57 @@ -1549,42 +1551,6 @@ 1.58 1.59 virtual jlong millis_since_last_gc(); 1.60 1.61 - // Perform any cleanup actions necessary before allowing a verification. 1.62 - virtual void prepare_for_verify(); 1.63 - 1.64 - // Perform verification. 1.65 - 1.66 - // vo == UsePrevMarking -> use "prev" marking information, 1.67 - // vo == UseNextMarking -> use "next" marking information 1.68 - // vo == UseMarkWord -> use the mark word in the object header 1.69 - // 1.70 - // NOTE: Only the "prev" marking information is guaranteed to be 1.71 - // consistent most of the time, so most calls to this should use 1.72 - // vo == UsePrevMarking. 1.73 - // Currently, there is only one case where this is called with 1.74 - // vo == UseNextMarking, which is to verify the "next" marking 1.75 - // information at the end of remark. 1.76 - // Currently there is only one place where this is called with 1.77 - // vo == UseMarkWord, which is to verify the marking during a 1.78 - // full GC. 1.79 - void verify(bool silent, VerifyOption vo); 1.80 - 1.81 - // Override; it uses the "prev" marking information 1.82 - virtual void verify(bool silent); 1.83 - 1.84 - virtual void print_on(outputStream* st) const; 1.85 - virtual void print_extended_on(outputStream* st) const; 1.86 - virtual void print_on_error(outputStream* st) const; 1.87 - 1.88 - virtual void print_gc_threads_on(outputStream* st) const; 1.89 - virtual void gc_threads_do(ThreadClosure* tc) const; 1.90 - 1.91 - // Override 1.92 - void print_tracing_info() const; 1.93 - 1.94 - // The following two methods are helpful for debugging RSet issues. 1.95 - void print_cset_rsets() PRODUCT_RETURN; 1.96 - void print_all_rsets() PRODUCT_RETURN; 1.97 1.98 // Convenience function to be used in situations where the heap type can be 1.99 // asserted to be this type. 1.100 @@ -1661,13 +1627,86 @@ 1.101 else return is_obj_ill(obj, hr); 1.102 } 1.103 1.104 + bool allocated_since_marking(oop obj, HeapRegion* hr, VerifyOption vo); 1.105 + HeapWord* top_at_mark_start(HeapRegion* hr, VerifyOption vo); 1.106 + bool is_marked(oop obj, VerifyOption vo); 1.107 + const char* top_at_mark_start_str(VerifyOption vo); 1.108 + 1.109 + ConcurrentMark* concurrent_mark() const { return _cm; } 1.110 + 1.111 + // Refinement 1.112 + 1.113 + ConcurrentG1Refine* concurrent_g1_refine() const { return _cg1r; } 1.114 + 1.115 + // The dirty cards region list is used to record a subset of regions 1.116 + // whose cards need clearing. The list if populated during the 1.117 + // remembered set scanning and drained during the card table 1.118 + // cleanup. Although the methods are reentrant, population/draining 1.119 + // phases must not overlap. For synchronization purposes the last 1.120 + // element on the list points to itself. 1.121 + HeapRegion* _dirty_cards_region_list; 1.122 + void push_dirty_cards_region(HeapRegion* hr); 1.123 + HeapRegion* pop_dirty_cards_region(); 1.124 + 1.125 + // Optimized nmethod scanning support routines 1.126 + 1.127 + // Register the given nmethod with the G1 heap 1.128 + virtual void register_nmethod(nmethod* nm); 1.129 + 1.130 + // Unregister the given nmethod from the G1 heap 1.131 + virtual void unregister_nmethod(nmethod* nm); 1.132 + 1.133 + // Migrate the nmethods in the code root lists of the regions 1.134 + // in the collection set to regions in to-space. In the event 1.135 + // of an evacuation failure, nmethods that reference objects 1.136 + // that were not successfullly evacuated are not migrated. 1.137 + void migrate_strong_code_roots(); 1.138 + 1.139 + // During an initial mark pause, mark all the code roots that 1.140 + // point into regions *not* in the collection set. 1.141 + void mark_strong_code_roots(uint worker_id); 1.142 + 1.143 + // Rebuild the stong code root lists for each region 1.144 + // after a full GC 1.145 + void rebuild_strong_code_roots(); 1.146 + 1.147 + // Verification 1.148 + 1.149 + // The following is just to alert the verification code 1.150 + // that a full collection has occurred and that the 1.151 + // remembered sets are no longer up to date. 1.152 + bool _full_collection; 1.153 + void set_full_collection() { _full_collection = true;} 1.154 + void clear_full_collection() {_full_collection = false;} 1.155 + bool full_collection() {return _full_collection;} 1.156 + 1.157 + // Perform any cleanup actions necessary before allowing a verification. 1.158 + virtual void prepare_for_verify(); 1.159 + 1.160 + // Perform verification. 1.161 + 1.162 + // vo == UsePrevMarking -> use "prev" marking information, 1.163 + // vo == UseNextMarking -> use "next" marking information 1.164 + // vo == UseMarkWord -> use the mark word in the object header 1.165 + // 1.166 + // NOTE: Only the "prev" marking information is guaranteed to be 1.167 + // consistent most of the time, so most calls to this should use 1.168 + // vo == UsePrevMarking. 1.169 + // Currently, there is only one case where this is called with 1.170 + // vo == UseNextMarking, which is to verify the "next" marking 1.171 + // information at the end of remark. 1.172 + // Currently there is only one place where this is called with 1.173 + // vo == UseMarkWord, which is to verify the marking during a 1.174 + // full GC. 1.175 + void verify(bool silent, VerifyOption vo); 1.176 + 1.177 + // Override; it uses the "prev" marking information 1.178 + virtual void verify(bool silent); 1.179 + 1.180 // The methods below are here for convenience and dispatch the 1.181 // appropriate method depending on value of the given VerifyOption 1.182 - // parameter. The options for that parameter are: 1.183 - // 1.184 - // vo == UsePrevMarking -> use "prev" marking information, 1.185 - // vo == UseNextMarking -> use "next" marking information, 1.186 - // vo == UseMarkWord -> use mark word from object header 1.187 + // parameter. The values for that parameter, and their meanings, 1.188 + // are the same as those above. 1.189 1.190 bool is_obj_dead_cond(const oop obj, 1.191 const HeapRegion* hr, 1.192 @@ -1692,31 +1731,21 @@ 1.193 return false; // keep some compilers happy 1.194 } 1.195 1.196 - bool allocated_since_marking(oop obj, HeapRegion* hr, VerifyOption vo); 1.197 - HeapWord* top_at_mark_start(HeapRegion* hr, VerifyOption vo); 1.198 - bool is_marked(oop obj, VerifyOption vo); 1.199 - const char* top_at_mark_start_str(VerifyOption vo); 1.200 + // Printing 1.201 1.202 - // The following is just to alert the verification code 1.203 - // that a full collection has occurred and that the 1.204 - // remembered sets are no longer up to date. 1.205 - bool _full_collection; 1.206 - void set_full_collection() { _full_collection = true;} 1.207 - void clear_full_collection() {_full_collection = false;} 1.208 - bool full_collection() {return _full_collection;} 1.209 + virtual void print_on(outputStream* st) const; 1.210 + virtual void print_extended_on(outputStream* st) const; 1.211 + virtual void print_on_error(outputStream* st) const; 1.212 1.213 - ConcurrentMark* concurrent_mark() const { return _cm; } 1.214 - ConcurrentG1Refine* concurrent_g1_refine() const { return _cg1r; } 1.215 + virtual void print_gc_threads_on(outputStream* st) const; 1.216 + virtual void gc_threads_do(ThreadClosure* tc) const; 1.217 1.218 - // The dirty cards region list is used to record a subset of regions 1.219 - // whose cards need clearing. The list if populated during the 1.220 - // remembered set scanning and drained during the card table 1.221 - // cleanup. Although the methods are reentrant, population/draining 1.222 - // phases must not overlap. For synchronization purposes the last 1.223 - // element on the list points to itself. 1.224 - HeapRegion* _dirty_cards_region_list; 1.225 - void push_dirty_cards_region(HeapRegion* hr); 1.226 - HeapRegion* pop_dirty_cards_region(); 1.227 + // Override 1.228 + void print_tracing_info() const; 1.229 + 1.230 + // The following two methods are helpful for debugging RSet issues. 1.231 + void print_cset_rsets() PRODUCT_RETURN; 1.232 + void print_all_rsets() PRODUCT_RETURN; 1.233 1.234 public: 1.235 void stop_conc_gc_threads();