1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Tue Jul 17 12:24:05 2012 -0700 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Thu Jul 19 15:15:54 2012 -0700 1.3 @@ -375,6 +375,13 @@ 1.4 // this method will be found dead by the marking cycle). 1.5 void allocate_dummy_regions() PRODUCT_RETURN; 1.6 1.7 + // Clear RSets after a compaction. It also resets the GC time stamps. 1.8 + void clear_rsets_post_compaction(); 1.9 + 1.10 + // If the HR printer is active, dump the state of the regions in the 1.11 + // heap after a compaction. 1.12 + void print_hrs_post_compaction(); 1.13 + 1.14 // These are macros so that, if the assert fires, we get the correct 1.15 // line number, file, etc. 1.16 1.17 @@ -1061,11 +1068,18 @@ 1.18 clear_cset_start_regions(); 1.19 } 1.20 1.21 + void check_gc_time_stamps() PRODUCT_RETURN; 1.22 + 1.23 void increment_gc_time_stamp() { 1.24 ++_gc_time_stamp; 1.25 OrderAccess::fence(); 1.26 } 1.27 1.28 + // Reset the given region's GC timestamp. If it's starts humongous, 1.29 + // also reset the GC timestamp of its corresponding 1.30 + // continues humongous regions too. 1.31 + void reset_gc_time_stamps(HeapRegion* hr); 1.32 + 1.33 void iterate_dirty_card_closure(CardTableEntryClosure* cl, 1.34 DirtyCardQueue* into_cset_dcq, 1.35 bool concurrent, int worker_i); 1.36 @@ -1302,11 +1316,6 @@ 1.37 // iteration early if the "doHeapRegion" method returns "true". 1.38 void heap_region_iterate(HeapRegionClosure* blk) const; 1.39 1.40 - // Iterate over heap regions starting with r (or the first region if "r" 1.41 - // is NULL), in address order, terminating early if the "doHeapRegion" 1.42 - // method returns "true". 1.43 - void heap_region_iterate_from(HeapRegion* r, HeapRegionClosure* blk) const; 1.44 - 1.45 // Return the region with the given index. It assumes the index is valid. 1.46 HeapRegion* region_at(uint index) const { return _hrs.at(index); } 1.47 1.48 @@ -1351,6 +1360,11 @@ 1.49 // starting region for iterating over the current collection set. 1.50 HeapRegion* start_cset_region_for_worker(int worker_i); 1.51 1.52 + // This is a convenience method that is used by the 1.53 + // HeapRegionIterator classes to calculate the starting region for 1.54 + // each worker so that they do not all start from the same region. 1.55 + HeapRegion* start_region_for_worker(uint worker_i, uint no_of_par_workers); 1.56 + 1.57 // Iterate over the regions (if any) in the current collection set. 1.58 void collection_set_iterate(HeapRegionClosure* blk); 1.59 1.60 @@ -1558,24 +1572,6 @@ 1.61 bool isMarkedPrev(oop obj) const; 1.62 bool isMarkedNext(oop obj) const; 1.63 1.64 - // vo == UsePrevMarking -> use "prev" marking information, 1.65 - // vo == UseNextMarking -> use "next" marking information, 1.66 - // vo == UseMarkWord -> use mark word from object header 1.67 - bool is_obj_dead_cond(const oop obj, 1.68 - const HeapRegion* hr, 1.69 - const VerifyOption vo) const { 1.70 - 1.71 - switch (vo) { 1.72 - case VerifyOption_G1UsePrevMarking: 1.73 - return is_obj_dead(obj, hr); 1.74 - case VerifyOption_G1UseNextMarking: 1.75 - return is_obj_ill(obj, hr); 1.76 - default: 1.77 - assert(vo == VerifyOption_G1UseMarkWord, "must be"); 1.78 - return !obj->is_gc_marked(); 1.79 - } 1.80 - } 1.81 - 1.82 // Determine if an object is dead, given the object and also 1.83 // the region to which the object belongs. An object is dead 1.84 // iff a) it was not allocated since the last mark and b) it 1.85 @@ -1587,15 +1583,6 @@ 1.86 !isMarkedPrev(obj); 1.87 } 1.88 1.89 - // This is used when copying an object to survivor space. 1.90 - // If the object is marked live, then we mark the copy live. 1.91 - // If the object is allocated since the start of this mark 1.92 - // cycle, then we mark the copy live. 1.93 - // If the object has been around since the previous mark 1.94 - // phase, and hasn't been marked yet during this phase, 1.95 - // then we don't mark it, we just wait for the 1.96 - // current marking cycle to get to it. 1.97 - 1.98 // This function returns true when an object has been 1.99 // around since the previous marking and hasn't yet 1.100 // been marked during this marking. 1.101 @@ -1613,23 +1600,6 @@ 1.102 // Added if it is in permanent gen it isn't dead. 1.103 // Added if it is NULL it isn't dead. 1.104 1.105 - // vo == UsePrevMarking -> use "prev" marking information, 1.106 - // vo == UseNextMarking -> use "next" marking information, 1.107 - // vo == UseMarkWord -> use mark word from object header 1.108 - bool is_obj_dead_cond(const oop obj, 1.109 - const VerifyOption vo) const { 1.110 - 1.111 - switch (vo) { 1.112 - case VerifyOption_G1UsePrevMarking: 1.113 - return is_obj_dead(obj); 1.114 - case VerifyOption_G1UseNextMarking: 1.115 - return is_obj_ill(obj); 1.116 - default: 1.117 - assert(vo == VerifyOption_G1UseMarkWord, "must be"); 1.118 - return !obj->is_gc_marked(); 1.119 - } 1.120 - } 1.121 - 1.122 bool is_obj_dead(const oop obj) const { 1.123 const HeapRegion* hr = heap_region_containing(obj); 1.124 if (hr == NULL) { 1.125 @@ -1652,6 +1622,42 @@ 1.126 else return is_obj_ill(obj, hr); 1.127 } 1.128 1.129 + // The methods below are here for convenience and dispatch the 1.130 + // appropriate method depending on value of the given VerifyOption 1.131 + // parameter. The options for that parameter are: 1.132 + // 1.133 + // vo == UsePrevMarking -> use "prev" marking information, 1.134 + // vo == UseNextMarking -> use "next" marking information, 1.135 + // vo == UseMarkWord -> use mark word from object header 1.136 + 1.137 + bool is_obj_dead_cond(const oop obj, 1.138 + const HeapRegion* hr, 1.139 + const VerifyOption vo) const { 1.140 + switch (vo) { 1.141 + case VerifyOption_G1UsePrevMarking: return is_obj_dead(obj, hr); 1.142 + case VerifyOption_G1UseNextMarking: return is_obj_ill(obj, hr); 1.143 + case VerifyOption_G1UseMarkWord: return !obj->is_gc_marked(); 1.144 + default: ShouldNotReachHere(); 1.145 + } 1.146 + return false; // keep some compilers happy 1.147 + } 1.148 + 1.149 + bool is_obj_dead_cond(const oop obj, 1.150 + const VerifyOption vo) const { 1.151 + switch (vo) { 1.152 + case VerifyOption_G1UsePrevMarking: return is_obj_dead(obj); 1.153 + case VerifyOption_G1UseNextMarking: return is_obj_ill(obj); 1.154 + case VerifyOption_G1UseMarkWord: return !obj->is_gc_marked(); 1.155 + default: ShouldNotReachHere(); 1.156 + } 1.157 + return false; // keep some compilers happy 1.158 + } 1.159 + 1.160 + bool allocated_since_marking(oop obj, HeapRegion* hr, VerifyOption vo); 1.161 + HeapWord* top_at_mark_start(HeapRegion* hr, VerifyOption vo); 1.162 + bool is_marked(oop obj, VerifyOption vo); 1.163 + const char* top_at_mark_start_str(VerifyOption vo); 1.164 + 1.165 // The following is just to alert the verification code 1.166 // that a full collection has occurred and that the 1.167 // remembered sets are no longer up to date.