117 // the use of is-alive closures and OopClosures for iteration.
118 // Assume p is of type oop*. Then
119 //
120 // - cl->do_oop(p) must be a valid expression whose value is ignored.
121 //
122 // - is_alive->do_object_b(*p) must be a valid expression whose value
123 // is convertible to bool.
124 //
125 // If *p == NULL then neither is_alive nor cl will be invoked for p.
126 // If is_alive->do_object_b(*p) is false, then cl will not be
127 // invoked on p.
128
129 class OopStorage::BasicParState {
130 const OopStorage* _storage;
131 ActiveArray* _active_array;
132 size_t _block_count;
133 volatile size_t _next_block;
134 uint _estimated_thread_count;
135 bool _concurrent;
136
137 // Noncopyable.
138 BasicParState(const BasicParState&);
139 BasicParState& operator=(const BasicParState&);
140
141 struct IterationData;
142
143 void update_concurrent_iteration_count(int value);
144 bool claim_next_segment(IterationData* data);
145 bool finish_iteration(const IterationData* data) const;
146
147 // Wrapper for iteration handler; ignore handler result and return true.
148 template<typename F> class AlwaysTrueFn;
149
150 public:
151 BasicParState(const OopStorage* storage,
152 uint estimated_thread_count,
153 bool concurrent);
154 ~BasicParState();
155
156 const OopStorage* storage() const { return _storage; }
157
158 template<bool is_const, typename F> void iterate(F f);
159
|
117 // the use of is-alive closures and OopClosures for iteration.
118 // Assume p is of type oop*. Then
119 //
120 // - cl->do_oop(p) must be a valid expression whose value is ignored.
121 //
122 // - is_alive->do_object_b(*p) must be a valid expression whose value
123 // is convertible to bool.
124 //
125 // If *p == NULL then neither is_alive nor cl will be invoked for p.
126 // If is_alive->do_object_b(*p) is false, then cl will not be
127 // invoked on p.
128
129 class OopStorage::BasicParState {
130 const OopStorage* _storage;
131 ActiveArray* _active_array;
132 size_t _block_count;
133 volatile size_t _next_block;
134 uint _estimated_thread_count;
135 bool _concurrent;
136
137 NONCOPYABLE(BasicParState);
138
139 struct IterationData;
140
141 void update_concurrent_iteration_count(int value);
142 bool claim_next_segment(IterationData* data);
143 bool finish_iteration(const IterationData* data) const;
144
145 // Wrapper for iteration handler; ignore handler result and return true.
146 template<typename F> class AlwaysTrueFn;
147
148 public:
149 BasicParState(const OopStorage* storage,
150 uint estimated_thread_count,
151 bool concurrent);
152 ~BasicParState();
153
154 const OopStorage* storage() const { return _storage; }
155
156 template<bool is_const, typename F> void iterate(F f);
157
|