Tue, 19 Aug 2014 07:28:23 -0700
Merge
1.1 --- a/src/share/vm/gc_implementation/g1/dirtyCardQueue.hpp Tue Aug 19 06:06:22 2014 -0700 1.2 +++ b/src/share/vm/gc_implementation/g1/dirtyCardQueue.hpp Tue Aug 19 07:28:23 2014 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -47,6 +47,13 @@ 1.11 // active field set to true. 1.12 PtrQueue(qset_, perm, true /* active */) { } 1.13 1.14 + // Flush before destroying; queue may be used to capture pending work while 1.15 + // doing something else, with auto-flush on completion. 1.16 + ~DirtyCardQueue() { if (!is_permanent()) flush(); } 1.17 + 1.18 + // Process queue entries and release resources. 1.19 + void flush() { flush_impl(); } 1.20 + 1.21 // Apply the closure to all elements, and reset the index to make the 1.22 // buffer empty. If a closure application returns "false", return 1.23 // "false" immediately, halting the iteration. If "consume" is true,
2.1 --- a/src/share/vm/gc_implementation/g1/ptrQueue.cpp Tue Aug 19 06:06:22 2014 -0700 2.2 +++ b/src/share/vm/gc_implementation/g1/ptrQueue.cpp Tue Aug 19 07:28:23 2014 -0700 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -31,11 +31,15 @@ 2.11 #include "runtime/thread.inline.hpp" 2.12 2.13 PtrQueue::PtrQueue(PtrQueueSet* qset, bool perm, bool active) : 2.14 - _qset(qset), _buf(NULL), _index(0), _active(active), 2.15 + _qset(qset), _buf(NULL), _index(0), _sz(0), _active(active), 2.16 _perm(perm), _lock(NULL) 2.17 {} 2.18 2.19 -void PtrQueue::flush() { 2.20 +PtrQueue::~PtrQueue() { 2.21 + assert(_perm || (_buf == NULL), "queue must be flushed before delete"); 2.22 +} 2.23 + 2.24 +void PtrQueue::flush_impl() { 2.25 if (!_perm && _buf != NULL) { 2.26 if (_index == _sz) { 2.27 // No work to do.
3.1 --- a/src/share/vm/gc_implementation/g1/ptrQueue.hpp Tue Aug 19 06:06:22 2014 -0700 3.2 +++ b/src/share/vm/gc_implementation/g1/ptrQueue.hpp Tue Aug 19 07:28:23 2014 -0700 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 3.6 + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. 3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 * 3.9 * This code is free software; you can redistribute it and/or modify it 3.10 @@ -65,15 +65,18 @@ 3.11 Mutex* _lock; 3.12 3.13 PtrQueueSet* qset() { return _qset; } 3.14 + bool is_permanent() const { return _perm; } 3.15 + 3.16 + // Process queue entries and release resources, if not permanent. 3.17 + void flush_impl(); 3.18 3.19 public: 3.20 // Initialize this queue to contain a null buffer, and be part of the 3.21 // given PtrQueueSet. 3.22 PtrQueue(PtrQueueSet* qset, bool perm = false, bool active = false); 3.23 - // Release any contained resources. 3.24 - virtual void flush(); 3.25 - // Calls flush() when destroyed. 3.26 - ~PtrQueue() { flush(); } 3.27 + 3.28 + // Requires queue flushed or permanent. 3.29 + ~PtrQueue(); 3.30 3.31 // Associate a lock with a ptr queue. 3.32 void set_lock(Mutex* lock) { _lock = lock; }
4.1 --- a/src/share/vm/gc_implementation/g1/satbQueue.cpp Tue Aug 19 06:06:22 2014 -0700 4.2 +++ b/src/share/vm/gc_implementation/g1/satbQueue.cpp Tue Aug 19 07:28:23 2014 -0700 4.3 @@ -39,7 +39,7 @@ 4.4 // first before we flush it, otherwise we might end up with an 4.5 // enqueued buffer with refs into the CSet which breaks our invariants. 4.6 filter(); 4.7 - PtrQueue::flush(); 4.8 + flush_impl(); 4.9 } 4.10 4.11 // This method removes entries from an SATB buffer that will not be
5.1 --- a/src/share/vm/gc_implementation/g1/satbQueue.hpp Tue Aug 19 06:06:22 2014 -0700 5.2 +++ b/src/share/vm/gc_implementation/g1/satbQueue.hpp Tue Aug 19 07:28:23 2014 -0700 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -58,9 +58,8 @@ 5.11 // field to true. This is done in JavaThread::initialize_queues(). 5.12 PtrQueue(qset, perm, false /* active */) { } 5.13 5.14 - // Overrides PtrQueue::flush() so that it can filter the buffer 5.15 - // before it is flushed. 5.16 - virtual void flush(); 5.17 + // Process queue entries and free resources. 5.18 + void flush(); 5.19 5.20 // Overrides PtrQueue::should_enqueue_buffer(). See the method's 5.21 // definition for more information.