30 #include "oops/objArrayOop.hpp" |
30 #include "oops/objArrayOop.hpp" |
31 #include "oops/oop.inline.hpp" |
31 #include "oops/oop.inline.hpp" |
32 #include "utilities/debug.hpp" |
32 #include "utilities/debug.hpp" |
33 #include "utilities/globalDefinitions.hpp" |
33 #include "utilities/globalDefinitions.hpp" |
34 |
34 |
|
35 inline void ParCompactionManager::push(oop obj) { |
|
36 _marking_stack.push(obj); |
|
37 } |
|
38 |
35 void ParCompactionManager::push_objarray(oop obj, size_t index) |
39 void ParCompactionManager::push_objarray(oop obj, size_t index) |
36 { |
40 { |
37 ObjArrayTask task(obj, index); |
41 ObjArrayTask task(obj, index); |
38 assert(task.is_valid(), "bad ObjArrayTask"); |
42 assert(task.is_valid(), "bad ObjArrayTask"); |
39 _objarray_stack.push(task); |
43 _objarray_stack.push(task); |
46 ParallelCompactData::RegionData* const region_ptr = sd.region(index); |
50 ParallelCompactData::RegionData* const region_ptr = sd.region(index); |
47 assert(region_ptr->claimed(), "must be claimed"); |
51 assert(region_ptr->claimed(), "must be claimed"); |
48 assert(region_ptr->_pushed++ == 0, "should only be pushed once"); |
52 assert(region_ptr->_pushed++ == 0, "should only be pushed once"); |
49 #endif |
53 #endif |
50 region_stack()->push(index); |
54 region_stack()->push(index); |
|
55 } |
|
56 |
|
57 template <typename T> |
|
58 inline void ParCompactionManager::mark_and_push(T* p) { |
|
59 T heap_oop = oopDesc::load_heap_oop(p); |
|
60 if (!oopDesc::is_null(heap_oop)) { |
|
61 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
|
62 assert(ParallelScavengeHeap::heap()->is_in(obj), "should be in heap"); |
|
63 |
|
64 if (mark_bitmap()->is_unmarked(obj) && PSParallelCompact::mark_obj(obj)) { |
|
65 push(obj); |
|
66 } |
|
67 } |
|
68 } |
|
69 |
|
70 template <typename T> |
|
71 inline void ParCompactionManager::MarkAndPushClosure::do_oop_nv(T* p) { |
|
72 _compaction_manager->mark_and_push(p); |
|
73 } |
|
74 |
|
75 inline void ParCompactionManager::MarkAndPushClosure::do_oop(oop* p) { do_oop_nv(p); } |
|
76 inline void ParCompactionManager::MarkAndPushClosure::do_oop(narrowOop* p) { do_oop_nv(p); } |
|
77 |
|
78 inline void ParCompactionManager::follow_klass(Klass* klass) { |
|
79 oop holder = klass->klass_holder(); |
|
80 mark_and_push(&holder); |
|
81 } |
|
82 |
|
83 inline void ParCompactionManager::FollowStackClosure::do_void() { |
|
84 _compaction_manager->follow_marking_stacks(); |
|
85 } |
|
86 |
|
87 inline void ParCompactionManager::FollowKlassClosure::do_klass(Klass* klass) { |
|
88 klass->oops_do(_mark_and_push_closure); |
|
89 } |
|
90 |
|
91 inline void ParCompactionManager::follow_class_loader(ClassLoaderData* cld) { |
|
92 MarkAndPushClosure mark_and_push_closure(this); |
|
93 FollowKlassClosure follow_klass_closure(&mark_and_push_closure); |
|
94 |
|
95 cld->oops_do(&mark_and_push_closure, &follow_klass_closure, true); |
51 } |
96 } |
52 |
97 |
53 inline void ParCompactionManager::follow_contents(oop obj) { |
98 inline void ParCompactionManager::follow_contents(oop obj) { |
54 assert(PSParallelCompact::mark_bitmap()->is_marked(obj), "should be marked"); |
99 assert(PSParallelCompact::mark_bitmap()->is_marked(obj), "should be marked"); |
55 obj->pc_follow_contents(this); |
100 obj->pc_follow_contents(this); |
67 T* const beg = base + beg_index; |
112 T* const beg = base + beg_index; |
68 T* const end = base + end_index; |
113 T* const end = base + end_index; |
69 |
114 |
70 // Push the non-NULL elements of the next stride on the marking stack. |
115 // Push the non-NULL elements of the next stride on the marking stack. |
71 for (T* e = beg; e < end; e++) { |
116 for (T* e = beg; e < end; e++) { |
72 PSParallelCompact::mark_and_push<T>(cm, e); |
117 cm->mark_and_push<T>(e); |
73 } |
118 } |
74 |
119 |
75 if (end_index < len) { |
120 if (end_index < len) { |
76 cm->push_objarray(obj, end_index); // Push the continuation. |
121 cm->push_objarray(obj, end_index); // Push the continuation. |
77 } |
122 } |