< prev index next >

src/hotspot/share/runtime/lockStack.inline.hpp

Print this page

196   return removed;
197 }
198 
199 inline bool LockStack::contains(oop o) const {
200   verify("pre-contains");
201 
202   // Can't poke around in thread oops without having started stack watermark processing.
203   assert(StackWatermarkSet::processing_started(get_thread()), "Processing must have started!");
204 
205   int end = to_index(_top);
206   for (int i = end - 1; i >= 0; i--) {
207     if (_base[i] == o) {
208       verify("post-contains");
209       return true;
210     }
211   }
212   verify("post-contains");
213   return false;
214 }
215 







































216 inline void LockStack::oops_do(OopClosure* cl) {
217   verify("pre-oops-do");
218   int end = to_index(_top);
219   for (int i = 0; i < end; i++) {
220     cl->do_oop(&_base[i]);
221   }
222   verify("post-oops-do");
223 }
224 
225 #endif // SHARE_RUNTIME_LOCKSTACK_INLINE_HPP

196   return removed;
197 }
198 
199 inline bool LockStack::contains(oop o) const {
200   verify("pre-contains");
201 
202   // Can't poke around in thread oops without having started stack watermark processing.
203   assert(StackWatermarkSet::processing_started(get_thread()), "Processing must have started!");
204 
205   int end = to_index(_top);
206   for (int i = end - 1; i >= 0; i--) {
207     if (_base[i] == o) {
208       verify("post-contains");
209       return true;
210     }
211   }
212   verify("post-contains");
213   return false;
214 }
215 
216 inline int LockStack::monitor_count() const {
217   int end = to_index(_top);
218   assert(end <= CAPACITY, "invariant");
219   return end;
220 }
221 
222 inline void LockStack::move_to_address(oop* start) {
223   int end = to_index(_top);
224   for (int i = 0; i < end; i++) {
225     start[i] = _base[i];
226     DEBUG_ONLY(_base[i] = nullptr;)
227   }
228   _top = lock_stack_base_offset;
229 }
230 
231 inline void LockStack::move_from_address(oop* start, int count) {
232   assert(to_index(_top) == 0, "lockstack should be empty");
233   for (int i = 0; i < count; i++) {
234     _base[i] = start[i];
235     _top += oopSize;
236   }
237 }
238 
239 #ifdef ASSERT
240 inline int LockStack::unique_count() const {
241   int end = to_index(_top);
242   oop previous = nullptr;
243   int count = 0;
244   for (int i = 0; i < end; i++) {
245     assert(_base[i] != nullptr, "invariant");
246     if (_base[i] != previous) {
247       previous = _base[i];
248       count++;
249     }
250   }
251   return count;
252 }
253 #endif
254 
255 inline void LockStack::oops_do(OopClosure* cl) {
256   verify("pre-oops-do");
257   int end = to_index(_top);
258   for (int i = 0; i < end; i++) {
259     cl->do_oop(&_base[i]);
260   }
261   verify("post-oops-do");
262 }
263 
264 #endif // SHARE_RUNTIME_LOCKSTACK_INLINE_HPP
< prev index next >