62 static InstanceRefKlass* cast(Klass* k) { |
62 static InstanceRefKlass* cast(Klass* k) { |
63 assert(k->oop_is_instanceRef(), "cast to InstanceRefKlass"); |
63 assert(k->oop_is_instanceRef(), "cast to InstanceRefKlass"); |
64 return (InstanceRefKlass*) k; |
64 return (InstanceRefKlass*) k; |
65 } |
65 } |
66 |
66 |
67 // Garbage collection |
67 // GC specific object visitors |
68 int oop_adjust_pointers(oop obj); |
68 // |
69 void oop_follow_contents(oop obj); |
69 // Mark Sweep |
|
70 void oop_ms_follow_contents(oop obj); |
|
71 int oop_ms_adjust_pointers(oop obj); |
|
72 #if INCLUDE_ALL_GCS |
|
73 // Parallel Scavenge |
|
74 void oop_ps_push_contents( oop obj, PSPromotionManager* pm); |
|
75 // Parallel Compact |
|
76 void oop_pc_follow_contents(oop obj, ParCompactionManager* cm); |
|
77 void oop_pc_update_pointers(oop obj); |
|
78 #endif |
70 |
79 |
71 // Parallel Scavenge and Parallel Old |
80 // Oop fields (and metadata) iterators |
72 PARALLEL_GC_DECLS |
81 // [nv = true] Use non-virtual calls to do_oop_nv. |
|
82 // [nv = false] Use virtual calls to do_oop. |
|
83 // |
|
84 // The InstanceRefKlass iterators also support reference processing. |
73 |
85 |
74 int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) { |
|
75 return oop_oop_iterate_v(obj, blk); |
|
76 } |
|
77 int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) { |
|
78 return oop_oop_iterate_v_m(obj, blk, mr); |
|
79 } |
|
80 |
86 |
81 #define InstanceRefKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ |
87 // Forward iteration |
82 int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \ |
88 private: |
83 int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, MemRegion mr); |
89 // Iterate over all oop fields and metadata. |
|
90 template <bool nv, class OopClosureType> |
|
91 inline int oop_oop_iterate(oop obj, OopClosureType* closure); |
|
92 |
|
93 // Reverse iteration |
|
94 #if INCLUDE_ALL_GCS |
|
95 // Iterate over all oop fields and metadata. |
|
96 template <bool nv, class OopClosureType> |
|
97 inline int oop_oop_iterate_reverse(oop obj, OopClosureType* closure); |
|
98 #endif // INCLUDE_ALL_GCS |
|
99 |
|
100 // Bounded range iteration |
|
101 // Iterate over all oop fields and metadata. |
|
102 template <bool nv, class OopClosureType> |
|
103 inline int oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr); |
|
104 |
|
105 // Reference processing part of the iterators. |
|
106 |
|
107 // Specialized for [T = oop] or [T = narrowOop]. |
|
108 template <bool nv, typename T, class OopClosureType, class Contains> |
|
109 inline void oop_oop_iterate_ref_processing_specialized(oop obj, OopClosureType* closure, Contains& contains); |
|
110 |
|
111 // Only perform reference processing if the referent object is within mr. |
|
112 template <bool nv, class OopClosureType> |
|
113 inline void oop_oop_iterate_ref_processing_bounded(oop obj, OopClosureType* closure, MemRegion mr); |
|
114 |
|
115 // Reference processing |
|
116 template <bool nv, class OopClosureType> |
|
117 inline void oop_oop_iterate_ref_processing(oop obj, OopClosureType* closure); |
|
118 |
|
119 |
|
120 public: |
|
121 |
|
122 #define InstanceRefKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ |
|
123 int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure); \ |
|
124 int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* closure, MemRegion mr); |
84 |
125 |
85 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DECL) |
126 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DECL) |
86 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DECL) |
127 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DECL) |
87 |
128 |
88 #if INCLUDE_ALL_GCS |
129 #if INCLUDE_ALL_GCS |
89 #define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ |
130 #define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ |
90 int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk); |
131 int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure); |
91 |
132 |
92 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
133 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
93 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
134 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
94 #endif // INCLUDE_ALL_GCS |
135 #endif // INCLUDE_ALL_GCS |
95 |
136 |