comparison src/share/vm/gc_implementation/shared/markSweep.hpp @ 941:8b46c4d82093

4957990: Perm heap bloat in JVM Summary: Treat ProfileData in MDO's as a source of weak, not strong, roots. Fixes the bug for stop-world collection -- the case of concurrent collection will be fixed separately. Reviewed-by: jcoomes, jmasa, kvn, never
author ysr
date Wed, 02 Sep 2009 00:04:29 -0700
parents d1605aabd0a1
children 89e0543e1737 54b3b351d6f9
comparison
equal deleted inserted replaced
940:8624da129f0b 941:8b46c4d82093
21 * have any questions. 21 * have any questions.
22 * 22 *
23 */ 23 */
24 24
25 class ReferenceProcessor; 25 class ReferenceProcessor;
26 class DataLayout;
26 27
27 // MarkSweep takes care of global mark-compact garbage collection for a 28 // MarkSweep takes care of global mark-compact garbage collection for a
28 // GenCollectedHeap using a four-phase pointer forwarding algorithm. All 29 // GenCollectedHeap using a four-phase pointer forwarding algorithm. All
29 // generations are assumed to support marking; those that can also support 30 // generations are assumed to support marking; those that can also support
30 // compaction. 31 // compaction.
63 class MarkAndPushClosure: public OopClosure { 64 class MarkAndPushClosure: public OopClosure {
64 public: 65 public:
65 virtual void do_oop(oop* p); 66 virtual void do_oop(oop* p);
66 virtual void do_oop(narrowOop* p); 67 virtual void do_oop(narrowOop* p);
67 virtual const bool do_nmethods() const { return true; } 68 virtual const bool do_nmethods() const { return true; }
69 virtual const bool should_remember_mdo() const { return true; }
70 virtual void remember_mdo(DataLayout* p) { MarkSweep::revisit_mdo(p); }
68 }; 71 };
69 72
70 class FollowStackClosure: public VoidClosure { 73 class FollowStackClosure: public VoidClosure {
71 public: 74 public:
72 virtual void do_void(); 75 virtual void do_void();
101 // 104 //
102 friend class AdjustPointerClosure; 105 friend class AdjustPointerClosure;
103 friend class KeepAliveClosure; 106 friend class KeepAliveClosure;
104 friend class VM_MarkSweep; 107 friend class VM_MarkSweep;
105 friend void marksweep_init(); 108 friend void marksweep_init();
109 friend class DataLayout;
106 110
107 // 111 //
108 // Vars 112 // Vars
109 // 113 //
110 protected: 114 protected:
111 // Traversal stack used during phase1 115 // Traversal stack used during phase1
112 static GrowableArray<oop>* _marking_stack; 116 static GrowableArray<oop>* _marking_stack;
113 // Stack for live klasses to revisit at end of marking phase 117 // Stack for live klasses to revisit at end of marking phase
114 static GrowableArray<Klass*>* _revisit_klass_stack; 118 static GrowableArray<Klass*>* _revisit_klass_stack;
119 // Set (stack) of MDO's to revisit at end of marking phase
120 static GrowableArray<DataLayout*>* _revisit_mdo_stack;
115 121
116 // Space for storing/restoring mark word 122 // Space for storing/restoring mark word
117 static GrowableArray<markOop>* _preserved_mark_stack; 123 static GrowableArray<markOop>* _preserved_mark_stack;
118 static GrowableArray<oop>* _preserved_oop_stack; 124 static GrowableArray<oop>* _preserved_oop_stack;
119 static size_t _preserved_count; 125 static size_t _preserved_count;
155 static KeepAliveClosure keep_alive; 161 static KeepAliveClosure keep_alive;
156 162
157 // Class unloading. Update subklass/sibling/implementor links at end of marking phase. 163 // Class unloading. Update subklass/sibling/implementor links at end of marking phase.
158 static void follow_weak_klass_links(); 164 static void follow_weak_klass_links();
159 165
166 // Class unloading. Clear weak refs in MDO's (ProfileData)
167 // at the end of the marking phase.
168 static void follow_mdo_weak_refs();
169
160 // Debugging 170 // Debugging
161 static void trace(const char* msg) PRODUCT_RETURN; 171 static void trace(const char* msg) PRODUCT_RETURN;
162 172
163 public: 173 public:
164 // Public closures 174 // Public closures
211 // tracking down heap stomps. 221 // tracking down heap stomps.
212 static void print_new_location_of_heap_address(HeapWord* q); 222 static void print_new_location_of_heap_address(HeapWord* q);
213 #endif 223 #endif
214 224
215 // Call backs for class unloading 225 // Call backs for class unloading
216 static void revisit_weak_klass_link(Klass* k); // Update subklass/sibling/implementor links at end of marking. 226 // Update subklass/sibling/implementor links at end of marking.
227 static void revisit_weak_klass_link(Klass* k);
228 // For weak refs clearing in MDO's
229 static void revisit_mdo(DataLayout* p);
217 }; 230 };
218 231
219 class PreservedMark VALUE_OBJ_CLASS_SPEC { 232 class PreservedMark VALUE_OBJ_CLASS_SPEC {
220 private: 233 private:
221 oop _obj; 234 oop _obj;