309 // Update statistics
310 ZStatSample(ZSamplerHeapUsedAfterMark, used());
311 ZStatHeap::set_at_mark_end(capacity(), allocated(), used());
312
313 // Block resurrection of weak/phantom references
314 ZResurrection::block();
315
316 // Process weak roots
317 _weak_roots_processor.process_weak_roots();
318
319 // Prepare to unload stale metadata and nmethods
320 _unload.prepare();
321
322 return true;
323 }
324
325 void ZHeap::set_soft_reference_policy(bool clear) {
326 _reference_processor.set_soft_reference_policy(clear);
327 }
328
329 class ZRendezvousClosure : public ThreadClosure {
330 public:
331 virtual void do_thread(Thread* thread) {}
332 };
333
334 void ZHeap::process_non_strong_references() {
335 // Process Soft/Weak/Final/PhantomReferences
336 _reference_processor.process_references();
337
338 // Process concurrent weak roots
339 _weak_roots_processor.process_concurrent_weak_roots();
340
341 // Unlink stale metadata and nmethods
342 _unload.unlink();
343
344 // Perform a handshake. This is needed 1) to make sure that stale
345 // metadata and nmethods are no longer observable. And 2), to
346 // prevent the race where a mutator first loads an oop, which is
347 // logically null but not yet cleared. Then this oop gets cleared
348 // by the reference processor and resurrection is unblocked. At
349 // this point the mutator could see the unblocked state and pass
350 // this invalid oop through the normal barrier path, which would
351 // incorrectly try to mark the oop.
|
309 // Update statistics
310 ZStatSample(ZSamplerHeapUsedAfterMark, used());
311 ZStatHeap::set_at_mark_end(capacity(), allocated(), used());
312
313 // Block resurrection of weak/phantom references
314 ZResurrection::block();
315
316 // Process weak roots
317 _weak_roots_processor.process_weak_roots();
318
319 // Prepare to unload stale metadata and nmethods
320 _unload.prepare();
321
322 return true;
323 }
324
325 void ZHeap::set_soft_reference_policy(bool clear) {
326 _reference_processor.set_soft_reference_policy(clear);
327 }
328
329 class ZRendezvousClosure : public HandshakeClosure {
330 public:
331 ZRendezvousClosure() :
332 HandshakeClosure("ZRendezvous") {}
333
334 void do_thread(Thread* thread) {}
335 };
336
337 void ZHeap::process_non_strong_references() {
338 // Process Soft/Weak/Final/PhantomReferences
339 _reference_processor.process_references();
340
341 // Process concurrent weak roots
342 _weak_roots_processor.process_concurrent_weak_roots();
343
344 // Unlink stale metadata and nmethods
345 _unload.unlink();
346
347 // Perform a handshake. This is needed 1) to make sure that stale
348 // metadata and nmethods are no longer observable. And 2), to
349 // prevent the race where a mutator first loads an oop, which is
350 // logically null but not yet cleared. Then this oop gets cleared
351 // by the reference processor and resurrection is unblocked. At
352 // this point the mutator could see the unblocked state and pass
353 // this invalid oop through the normal barrier path, which would
354 // incorrectly try to mark the oop.
|