1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Fri Aug 31 16:39:35 2012 -0700 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Sat Sep 01 13:25:18 2012 -0400 1.3 @@ -45,9 +45,9 @@ 1.4 1.5 class HeapRegion; 1.6 class HRRSCleanupTask; 1.7 -class PermanentGenerationSpec; 1.8 class GenerationSpec; 1.9 class OopsInHeapRegionClosure; 1.10 +class G1KlassScanClosure; 1.11 class G1ScanHeapEvacClosure; 1.12 class ObjectClosure; 1.13 class SpaceClosure; 1.14 @@ -190,7 +190,6 @@ 1.15 1.16 class G1CollectedHeap : public SharedHeap { 1.17 friend class VM_G1CollectForAllocation; 1.18 - friend class VM_GenCollectForPermanentAllocation; 1.19 friend class VM_G1CollectFull; 1.20 friend class VM_G1IncCollectionPause; 1.21 friend class VMStructs; 1.22 @@ -225,7 +224,7 @@ 1.23 1.24 static size_t _humongous_object_threshold_in_words; 1.25 1.26 - // Storage for the G1 heap (excludes the permanent generation). 1.27 + // Storage for the G1 heap. 1.28 VirtualSpace _g1_storage; 1.29 MemRegion _g1_reserved; 1.30 1.31 @@ -630,7 +629,7 @@ 1.32 1.33 // Callback from VM_G1CollectFull operation. 1.34 // Perform a full collection. 1.35 - void do_full_collection(bool clear_all_soft_refs); 1.36 + virtual void do_full_collection(bool clear_all_soft_refs); 1.37 1.38 // Resize the heap if necessary after a full collection. If this is 1.39 // after a collect-for allocation, "word_size" is the allocation size, 1.40 @@ -805,17 +804,17 @@ 1.41 1.42 // Applies "scan_non_heap_roots" to roots outside the heap, 1.43 // "scan_rs" to roots inside the heap (having done "set_region" to 1.44 - // indicate the region in which the root resides), and does "scan_perm" 1.45 - // (setting the generation to the perm generation.) If "scan_rs" is 1.46 + // indicate the region in which the root resides), 1.47 + // and does "scan_metadata" If "scan_rs" is 1.48 // NULL, then this step is skipped. The "worker_i" 1.49 // param is for use with parallel roots processing, and should be 1.50 // the "i" of the calling parallel worker thread's work(i) function. 1.51 // In the sequential case this param will be ignored. 1.52 - void g1_process_strong_roots(bool collecting_perm_gen, 1.53 + void g1_process_strong_roots(bool is_scavenging, 1.54 ScanningOption so, 1.55 OopClosure* scan_non_heap_roots, 1.56 OopsInHeapRegionClosure* scan_rs, 1.57 - OopsInGenClosure* scan_perm, 1.58 + G1KlassScanClosure* scan_klasses, 1.59 int worker_i); 1.60 1.61 // Apply "blk" to all the weak roots of the system. These include 1.62 @@ -1071,7 +1070,7 @@ 1.63 G1CollectedHeap(G1CollectorPolicy* policy); 1.64 1.65 // Initialize the G1CollectedHeap to have the initial and 1.66 - // maximum sizes, permanent generation, and remembered and barrier sets 1.67 + // maximum sizes and remembered and barrier sets 1.68 // specified by the policy object. 1.69 jint initialize(); 1.70 1.71 @@ -1100,6 +1099,8 @@ 1.72 // The current policy object for the collector. 1.73 G1CollectorPolicy* g1_policy() const { return _g1_policy; } 1.74 1.75 + virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) g1_policy(); } 1.76 + 1.77 // Adaptive size policy. No such thing for g1. 1.78 virtual AdaptiveSizePolicy* size_policy() { return NULL; } 1.79 1.80 @@ -1278,12 +1279,6 @@ 1.81 // The same as above but assume that the caller holds the Heap_lock. 1.82 void collect_locked(GCCause::Cause cause); 1.83 1.84 - // This interface assumes that it's being called by the 1.85 - // vm thread. It collects the heap assuming that the 1.86 - // heap lock is already held and that we are executing in 1.87 - // the context of the vm thread. 1.88 - virtual void collect_as_vm_thread(GCCause::Cause cause); 1.89 - 1.90 // True iff a evacuation has failed in the most-recent collection. 1.91 bool evacuation_failed() { return _evacuation_failed; } 1.92 1.93 @@ -1317,7 +1312,7 @@ 1.94 inline bool obj_in_cs(oop obj); 1.95 1.96 // Return "TRUE" iff the given object address is in the reserved 1.97 - // region of g1 (excluding the permanent generation). 1.98 + // region of g1. 1.99 bool is_in_g1_reserved(const void* p) const { 1.100 return _g1_reserved.contains(p); 1.101 } 1.102 @@ -1344,25 +1339,17 @@ 1.103 1.104 // Iterate over all the ref-containing fields of all objects, calling 1.105 // "cl.do_oop" on each. 1.106 - virtual void oop_iterate(OopClosure* cl) { 1.107 - oop_iterate(cl, true); 1.108 - } 1.109 - void oop_iterate(OopClosure* cl, bool do_perm); 1.110 + virtual void oop_iterate(ExtendedOopClosure* cl); 1.111 1.112 // Same as above, restricted to a memory region. 1.113 - virtual void oop_iterate(MemRegion mr, OopClosure* cl) { 1.114 - oop_iterate(mr, cl, true); 1.115 - } 1.116 - void oop_iterate(MemRegion mr, OopClosure* cl, bool do_perm); 1.117 + void oop_iterate(MemRegion mr, ExtendedOopClosure* cl); 1.118 1.119 // Iterate over all objects, calling "cl.do_object" on each. 1.120 - virtual void object_iterate(ObjectClosure* cl) { 1.121 - object_iterate(cl, true); 1.122 + virtual void object_iterate(ObjectClosure* cl); 1.123 + 1.124 + virtual void safe_object_iterate(ObjectClosure* cl) { 1.125 + object_iterate(cl); 1.126 } 1.127 - virtual void safe_object_iterate(ObjectClosure* cl) { 1.128 - object_iterate(cl, true); 1.129 - } 1.130 - void object_iterate(ObjectClosure* cl, bool do_perm); 1.131 1.132 // Iterate over all objects allocated since the last collection, calling 1.133 // "cl.do_object" on each. The heap must have been initialized properly 1.134 @@ -1524,15 +1511,6 @@ 1.135 return is_in_young(new_obj); 1.136 } 1.137 1.138 - // Can a compiler elide a store barrier when it writes 1.139 - // a permanent oop into the heap? Applies when the compiler 1.140 - // is storing x to the heap, where x->is_perm() is true. 1.141 - virtual bool can_elide_permanent_oop_store_barriers() const { 1.142 - // At least until perm gen collection is also G1-ified, at 1.143 - // which point this should return false. 1.144 - return true; 1.145 - } 1.146 - 1.147 // Returns "true" iff the given word_size is "very large". 1.148 static bool isHumongous(size_t word_size) { 1.149 // Note this has to be strictly greater-than as the TLABs 1.150 @@ -1657,15 +1635,12 @@ 1.151 // This will find the region to which the object belongs and 1.152 // then call the region version of the same function. 1.153 1.154 - // Added if it is in permanent gen it isn't dead. 1.155 // Added if it is NULL it isn't dead. 1.156 1.157 bool is_obj_dead(const oop obj) const { 1.158 const HeapRegion* hr = heap_region_containing(obj); 1.159 if (hr == NULL) { 1.160 - if (Universe::heap()->is_in_permanent(obj)) 1.161 - return false; 1.162 - else if (obj == NULL) return false; 1.163 + if (obj == NULL) return false; 1.164 else return true; 1.165 } 1.166 else return is_obj_dead(obj, hr); 1.167 @@ -1674,9 +1649,7 @@ 1.168 bool is_obj_ill(const oop obj) const { 1.169 const HeapRegion* hr = heap_region_containing(obj); 1.170 if (hr == NULL) { 1.171 - if (Universe::heap()->is_in_permanent(obj)) 1.172 - return false; 1.173 - else if (obj == NULL) return false; 1.174 + if (obj == NULL) return false; 1.175 else return true; 1.176 } 1.177 else return is_obj_ill(obj, hr);