equal
deleted
inserted
replaced
38 #include "oops/objArrayKlass.inline.hpp" |
38 #include "oops/objArrayKlass.inline.hpp" |
39 #include "oops/oop.inline.hpp" |
39 #include "oops/oop.inline.hpp" |
40 #include "oops/typeArrayOop.inline.hpp" |
40 #include "oops/typeArrayOop.inline.hpp" |
41 #include "utilities/macros.hpp" |
41 #include "utilities/macros.hpp" |
42 #include "utilities/stack.inline.hpp" |
42 #include "utilities/stack.inline.hpp" |
43 #if INCLUDE_ALL_GCS |
|
44 #include "gc/g1/g1StringDedup.hpp" |
|
45 #endif // INCLUDE_ALL_GCS |
|
46 |
43 |
47 uint MarkSweep::_total_invocations = 0; |
44 uint MarkSweep::_total_invocations = 0; |
48 |
45 |
49 Stack<oop, mtGC> MarkSweep::_marking_stack; |
46 Stack<oop, mtGC> MarkSweep::_marking_stack; |
50 Stack<ObjArrayTask, mtGC> MarkSweep::_objarray_stack; |
47 Stack<ObjArrayTask, mtGC> MarkSweep::_objarray_stack; |
77 |
74 |
78 template <class T> inline void MarkSweep::mark_and_push(T* p) { |
75 template <class T> inline void MarkSweep::mark_and_push(T* p) { |
79 T heap_oop = oopDesc::load_heap_oop(p); |
76 T heap_oop = oopDesc::load_heap_oop(p); |
80 if (!oopDesc::is_null(heap_oop)) { |
77 if (!oopDesc::is_null(heap_oop)) { |
81 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
78 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
82 if (!obj->mark()->is_marked() && |
79 if (!obj->mark()->is_marked()) { |
83 !is_closed_archive_object(obj)) { |
|
84 mark_object(obj); |
80 mark_object(obj); |
85 _marking_stack.push(obj); |
81 _marking_stack.push(obj); |
86 } |
82 } |
87 } |
83 } |
88 } |
84 } |
174 assert(!Universe::heap()->is_in_reserved(p), |
170 assert(!Universe::heap()->is_in_reserved(p), |
175 "roots shouldn't be things within the heap"); |
171 "roots shouldn't be things within the heap"); |
176 T heap_oop = oopDesc::load_heap_oop(p); |
172 T heap_oop = oopDesc::load_heap_oop(p); |
177 if (!oopDesc::is_null(heap_oop)) { |
173 if (!oopDesc::is_null(heap_oop)) { |
178 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
174 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
179 if (!obj->mark()->is_marked() && |
175 if (!obj->mark()->is_marked()) { |
180 !is_closed_archive_object(obj)) { |
|
181 mark_object(obj); |
176 mark_object(obj); |
182 follow_object(obj); |
177 follow_object(obj); |
183 } |
178 } |
184 } |
179 } |
185 follow_stack(); |
180 follow_stack(); |
259 } |
254 } |
260 } |
255 } |
261 |
256 |
262 MarkSweep::IsAliveClosure MarkSweep::is_alive; |
257 MarkSweep::IsAliveClosure MarkSweep::is_alive; |
263 |
258 |
264 bool MarkSweep::IsAliveClosure::do_object_b(oop p) { return p->is_gc_marked() || is_closed_archive_object(p); } |
259 bool MarkSweep::IsAliveClosure::do_object_b(oop p) { return p->is_gc_marked(); } |
265 |
260 |
266 MarkSweep::KeepAliveClosure MarkSweep::keep_alive; |
261 MarkSweep::KeepAliveClosure MarkSweep::keep_alive; |
267 |
262 |
268 void MarkSweep::KeepAliveClosure::do_oop(oop* p) { MarkSweep::KeepAliveClosure::do_oop_work(p); } |
263 void MarkSweep::KeepAliveClosure::do_oop(oop* p) { MarkSweep::KeepAliveClosure::do_oop_work(p); } |
269 void MarkSweep::KeepAliveClosure::do_oop(narrowOop* p) { MarkSweep::KeepAliveClosure::do_oop_work(p); } |
264 void MarkSweep::KeepAliveClosure::do_oop(narrowOop* p) { MarkSweep::KeepAliveClosure::do_oop_work(p); } |