13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/shared/ptrQueue.hpp"
27 #include "logging/log.hpp"
28 #include "memory/allocation.hpp"
29 #include "memory/allocation.inline.hpp"
30 #include "runtime/atomic.hpp"
31 #include "runtime/mutex.hpp"
32 #include "runtime/mutexLocker.hpp"
33 #include "runtime/orderAccess.hpp"
34 #include "runtime/thread.inline.hpp"
35 #include "utilities/globalCounter.inline.hpp"
36
37 #include <new>
38
39 PtrQueue::PtrQueue(PtrQueueSet* qset, bool active) :
40 _qset(qset),
41 _active(active),
42 _index(0),
43 _capacity_in_bytes(index_to_byte_index(qset->buffer_size())),
44 _buf(NULL)
45 {}
46
47 PtrQueue::~PtrQueue() {
48 assert(_buf == NULL, "queue must be flushed before delete");
49 }
50
51 void PtrQueue::flush_impl() {
52 if (_buf != NULL) {
53 BufferNode* node = BufferNode::make_node_from_buffer(_buf, index());
|
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/shared/ptrQueue.hpp"
27 #include "logging/log.hpp"
28 #include "memory/allocation.hpp"
29 #include "memory/allocation.inline.hpp"
30 #include "runtime/atomic.hpp"
31 #include "runtime/mutex.hpp"
32 #include "runtime/mutexLocker.hpp"
33 #include "runtime/thread.inline.hpp"
34 #include "utilities/globalCounter.inline.hpp"
35
36 #include <new>
37
38 PtrQueue::PtrQueue(PtrQueueSet* qset, bool active) :
39 _qset(qset),
40 _active(active),
41 _index(0),
42 _capacity_in_bytes(index_to_byte_index(qset->buffer_size())),
43 _buf(NULL)
44 {}
45
46 PtrQueue::~PtrQueue() {
47 assert(_buf == NULL, "queue must be flushed before delete");
48 }
49
50 void PtrQueue::flush_impl() {
51 if (_buf != NULL) {
52 BufferNode* node = BufferNode::make_node_from_buffer(_buf, index());
|