--- /dev/null 2013-02-04 16:14:14.000000000 +0100 +++ new/src/share/vm/gc_implementation/g1/g1PreservedMarksQueue.hpp 2013-02-04 16:14:14.000000000 +0100 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_PRESERVEDMARKSQUEUE_HPP +#define SHARE_VM_GC_IMPLEMENTATION_G1_PRESERVEDMARKSQUEUE_HPP + +#include "oops/oopsHierarchy.hpp" + +struct G1PreservedMarksQueueEntry { + oop obj; + markOop mark; +}; + +class G1PreservedMarksChunk; + +class G1PreservedMarksQueue { + const size_t _initial_chunk_capacity; + const size_t _max_chunk_capacity; + size_t _current_capacity; + G1PreservedMarksChunk* _current_write_chunk; + G1PreservedMarksChunk* _current_read_chunk; + + size_t new_chunk_capacity(); + G1PreservedMarksChunk* new_chunk(); + + public: + G1PreservedMarksQueue(size_t initial_chunk_capacity, size_t max_chunk_capacity) : + _initial_chunk_capacity(initial_chunk_capacity), _current_capacity(0), _max_chunk_capacity(max_chunk_capacity), + _current_write_chunk(NULL), _current_read_chunk(NULL) { + assert(_initial_chunk_capacity <= _max_chunk_capacity, "initial must be <= max"); + } + + bool has_data(); + void append(const oop& obj, const markOop& mark); + G1PreservedMarksQueueEntry remove_first(); + + NOT_PRODUCT(void verify_empty()); +}; + +NOT_PRODUCT(void g1PreservedMarksChunkTests()); +NOT_PRODUCT(void g1PreservedMarksQueueTests()); + +#endif // SHARE_VM_GC_IMPLEMENTATION_G1_PRESERVEDMARKSQUEUE_HPP