Mercurial > hg > graal-compiler
comparison src/share/vm/gc_implementation/g1/g1MarkSweep.cpp @ 1836:894b1d7c7e01
6423256: GC stacks should use a better data structure
6942771: SEGV in ParScanThreadState::take_from_overflow_stack
Reviewed-by: apetrusenko, ysr, pbk
author | jcoomes |
---|---|
date | Tue, 28 Sep 2010 15:56:15 -0700 |
parents | c18cbe5936b8 |
children | f95d63e2154a |
comparison
equal
deleted
inserted
replaced
1835:4805b9f4779e | 1836:894b1d7c7e01 |
---|---|
99 | 99 |
100 void G1MarkSweep::allocate_stacks() { | 100 void G1MarkSweep::allocate_stacks() { |
101 GenMarkSweep::_preserved_count_max = 0; | 101 GenMarkSweep::_preserved_count_max = 0; |
102 GenMarkSweep::_preserved_marks = NULL; | 102 GenMarkSweep::_preserved_marks = NULL; |
103 GenMarkSweep::_preserved_count = 0; | 103 GenMarkSweep::_preserved_count = 0; |
104 GenMarkSweep::_preserved_mark_stack = NULL; | |
105 GenMarkSweep::_preserved_oop_stack = NULL; | |
106 | |
107 GenMarkSweep::_marking_stack = | |
108 new (ResourceObj::C_HEAP) GrowableArray<oop>(4000, true); | |
109 GenMarkSweep::_objarray_stack = | |
110 new (ResourceObj::C_HEAP) GrowableArray<ObjArrayTask>(50, true); | |
111 | |
112 int size = SystemDictionary::number_of_classes() * 2; | |
113 GenMarkSweep::_revisit_klass_stack = | |
114 new (ResourceObj::C_HEAP) GrowableArray<Klass*>(size, true); | |
115 // (#klass/k)^2 for k ~ 10 appears a better fit, but this will have to do | |
116 // for now until we have a chance to work out a more optimal setting. | |
117 GenMarkSweep::_revisit_mdo_stack = | |
118 new (ResourceObj::C_HEAP) GrowableArray<DataLayout*>(size*2, true); | |
119 | |
120 } | 104 } |
121 | 105 |
122 void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading, | 106 void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading, |
123 bool clear_all_softrefs) { | 107 bool clear_all_softrefs) { |
124 // Recursively traverse all live objects and mark them | 108 // Recursively traverse all live objects and mark them |
143 &GenMarkSweep::follow_stack_closure, | 127 &GenMarkSweep::follow_stack_closure, |
144 NULL); | 128 NULL); |
145 | 129 |
146 // Follow system dictionary roots and unload classes | 130 // Follow system dictionary roots and unload classes |
147 bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive); | 131 bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive); |
148 assert(GenMarkSweep::_marking_stack->is_empty(), | 132 assert(GenMarkSweep::_marking_stack.is_empty(), |
149 "stack should be empty by now"); | 133 "stack should be empty by now"); |
150 | 134 |
151 // Follow code cache roots (has to be done after system dictionary, | 135 // Follow code cache roots (has to be done after system dictionary, |
152 // assumes all live klasses are marked) | 136 // assumes all live klasses are marked) |
153 CodeCache::do_unloading(&GenMarkSweep::is_alive, | 137 CodeCache::do_unloading(&GenMarkSweep::is_alive, |
155 purged_class); | 139 purged_class); |
156 GenMarkSweep::follow_stack(); | 140 GenMarkSweep::follow_stack(); |
157 | 141 |
158 // Update subklass/sibling/implementor links of live klasses | 142 // Update subklass/sibling/implementor links of live klasses |
159 GenMarkSweep::follow_weak_klass_links(); | 143 GenMarkSweep::follow_weak_klass_links(); |
160 assert(GenMarkSweep::_marking_stack->is_empty(), | 144 assert(GenMarkSweep::_marking_stack.is_empty(), |
161 "stack should be empty by now"); | 145 "stack should be empty by now"); |
162 | 146 |
163 // Visit memoized MDO's and clear any unmarked weak refs | 147 // Visit memoized MDO's and clear any unmarked weak refs |
164 GenMarkSweep::follow_mdo_weak_refs(); | 148 GenMarkSweep::follow_mdo_weak_refs(); |
165 assert(GenMarkSweep::_marking_stack->is_empty(), "just drained"); | 149 assert(GenMarkSweep::_marking_stack.is_empty(), "just drained"); |
166 | 150 |
167 | 151 |
168 // Visit symbol and interned string tables and delete unmarked oops | 152 // Visit symbol and interned string tables and delete unmarked oops |
169 SymbolTable::unlink(&GenMarkSweep::is_alive); | 153 SymbolTable::unlink(&GenMarkSweep::is_alive); |
170 StringTable::unlink(&GenMarkSweep::is_alive); | 154 StringTable::unlink(&GenMarkSweep::is_alive); |
171 | 155 |
172 assert(GenMarkSweep::_marking_stack->is_empty(), | 156 assert(GenMarkSweep::_marking_stack.is_empty(), |
173 "stack should be empty by now"); | 157 "stack should be empty by now"); |
174 } | 158 } |
175 | 159 |
176 class G1PrepareCompactClosure: public HeapRegionClosure { | 160 class G1PrepareCompactClosure: public HeapRegionClosure { |
177 ModRefBarrierSet* _mrbs; | 161 ModRefBarrierSet* _mrbs; |