diff src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp @ 17947:1772223a25a2

8037112: gc/g1/TestHumongousAllocInitialMark.java caused SIGSEGV Reviewed-by: brutisso, mgerdin
author pliden
date Fri, 11 Apr 2014 11:00:12 +0200
parents 595c0f60d50d
children
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp	Thu May 22 09:12:29 2014 +0200
+++ b/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp	Fri Apr 11 11:00:12 2014 +0200
@@ -35,6 +35,7 @@
 
 G1StringDedupQueue::G1StringDedupQueue() :
   _cursor(0),
+  _cancel(false),
   _empty(true),
   _dropped(0) {
   _nqueues = MAX2(ParallelGCThreads, (size_t)1);
@@ -55,11 +56,17 @@
 
 void G1StringDedupQueue::wait() {
   MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
-  while (_queue->_empty) {
+  while (_queue->_empty && !_queue->_cancel) {
     ml.wait(Mutex::_no_safepoint_check_flag);
   }
 }
 
+void G1StringDedupQueue::cancel_wait() {
+  MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
+  _queue->_cancel = true;
+  ml.notify();
+}
+
 void G1StringDedupQueue::push(uint worker_id, oop java_string) {
   assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint");
   assert(worker_id < _queue->_nqueues, "Invalid queue");