1 /*
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
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 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_DIRTYCARDQUEUE_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_DIRTYCARDQUEUE_HPP
27
28 #include "gc_implementation/g1/ptrQueue.hpp"
29 #include "memory/allocation.hpp"
30
31 class FreeIdSet;
32
33 // A closure class for processing card table entries. Note that we don't
34 // require these closure objects to be stack-allocated.
35 class CardTableEntryClosure: public CHeapObj<mtGC> {
36 public:
37 // Process the card whose card table entry is "card_ptr". If returns
38 // "false", terminate the iteration early.
39 virtual bool do_card_ptr(jbyte* card_ptr, uint worker_i = 0) = 0;
40 };
41
42 // A ptrQueue whose elements are "oops", pointers to object heads.
43 class DirtyCardQueue: public PtrQueue {
44 public:
45 DirtyCardQueue(PtrQueueSet* qset_, bool perm = false) :
46 // Dirty card queues are always active, so we create them with their
47 // active field set to true.
48 PtrQueue(qset_, perm, true /* active */) { }
155 // Deallocate any completed log buffers
156 void clear();
157
158 // If a full collection is happening, reset partial logs, and ignore
159 // completed ones: the full collection will make them all irrelevant.
160 void abandon_logs();
161
162 // If any threads have partial logs, add them to the global list of logs.
163 void concatenate_logs();
164 void clear_n_completed_buffers() { _n_completed_buffers = 0;}
165
166 jint processed_buffers_mut() {
167 return _processed_buffers_mut;
168 }
169 jint processed_buffers_rs_thread() {
170 return _processed_buffers_rs_thread;
171 }
172
173 };
174
175 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_DIRTYCARDQUEUE_HPP
|
1 /*
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
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 #ifndef SHARE_VM_GC_G1_DIRTYCARDQUEUE_HPP
26 #define SHARE_VM_GC_G1_DIRTYCARDQUEUE_HPP
27
28 #include "gc/g1/ptrQueue.hpp"
29 #include "memory/allocation.hpp"
30
31 class FreeIdSet;
32
33 // A closure class for processing card table entries. Note that we don't
34 // require these closure objects to be stack-allocated.
35 class CardTableEntryClosure: public CHeapObj<mtGC> {
36 public:
37 // Process the card whose card table entry is "card_ptr". If returns
38 // "false", terminate the iteration early.
39 virtual bool do_card_ptr(jbyte* card_ptr, uint worker_i = 0) = 0;
40 };
41
42 // A ptrQueue whose elements are "oops", pointers to object heads.
43 class DirtyCardQueue: public PtrQueue {
44 public:
45 DirtyCardQueue(PtrQueueSet* qset_, bool perm = false) :
46 // Dirty card queues are always active, so we create them with their
47 // active field set to true.
48 PtrQueue(qset_, perm, true /* active */) { }
155 // Deallocate any completed log buffers
156 void clear();
157
158 // If a full collection is happening, reset partial logs, and ignore
159 // completed ones: the full collection will make them all irrelevant.
160 void abandon_logs();
161
162 // If any threads have partial logs, add them to the global list of logs.
163 void concatenate_logs();
164 void clear_n_completed_buffers() { _n_completed_buffers = 0;}
165
166 jint processed_buffers_mut() {
167 return _processed_buffers_mut;
168 }
169 jint processed_buffers_rs_thread() {
170 return _processed_buffers_rs_thread;
171 }
172
173 };
174
175 #endif // SHARE_VM_GC_G1_DIRTYCARDQUEUE_HPP
|