1 /*
2 * Copyright (c) 2001, 2016, 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 *
284 BufferNode* nd = buffers_to_delete;
285 buffers_to_delete = nd->next();
286 deallocate_buffer(nd);
287 }
288
289 }
290
291 void DirtyCardQueueSet::abandon_logs() {
292 assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
293 clear();
294 // Since abandon is done only at safepoints, we can safely manipulate
295 // these queues.
296 for (JavaThread* t = Threads::first(); t; t = t->next()) {
297 t->dirty_card_queue().reset();
298 }
299 shared_dirty_card_queue()->reset();
300 }
301
302 void DirtyCardQueueSet::concatenate_log(DirtyCardQueue& dcq) {
303 if (!dcq.is_empty()) {
304 enqueue_complete_buffer(
305 BufferNode::make_node_from_buffer(dcq.get_buf(), dcq.get_index()));
306 dcq.reinitialize();
307 }
308 }
309
310 void DirtyCardQueueSet::concatenate_logs() {
311 // Iterate over all the threads, if we find a partial log add it to
312 // the global list of logs. Temporarily turn off the limit on the number
313 // of outstanding buffers.
314 int save_max_completed_queue = _max_completed_queue;
315 _max_completed_queue = max_jint;
316 assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
317 for (JavaThread* t = Threads::first(); t; t = t->next()) {
318 concatenate_log(t->dirty_card_queue());
319 }
320 concatenate_log(_shared_dirty_card_queue);
321 // Restore the completed buffer queue limit.
322 _max_completed_queue = save_max_completed_queue;
323 }
|
1 /*
2 * Copyright (c) 2001, 2017, 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 *
284 BufferNode* nd = buffers_to_delete;
285 buffers_to_delete = nd->next();
286 deallocate_buffer(nd);
287 }
288
289 }
290
291 void DirtyCardQueueSet::abandon_logs() {
292 assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
293 clear();
294 // Since abandon is done only at safepoints, we can safely manipulate
295 // these queues.
296 for (JavaThread* t = Threads::first(); t; t = t->next()) {
297 t->dirty_card_queue().reset();
298 }
299 shared_dirty_card_queue()->reset();
300 }
301
302 void DirtyCardQueueSet::concatenate_log(DirtyCardQueue& dcq) {
303 if (!dcq.is_empty()) {
304 dcq.flush();
305 }
306 }
307
308 void DirtyCardQueueSet::concatenate_logs() {
309 // Iterate over all the threads, if we find a partial log add it to
310 // the global list of logs. Temporarily turn off the limit on the number
311 // of outstanding buffers.
312 int save_max_completed_queue = _max_completed_queue;
313 _max_completed_queue = max_jint;
314 assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
315 for (JavaThread* t = Threads::first(); t; t = t->next()) {
316 concatenate_log(t->dirty_card_queue());
317 }
318 concatenate_log(_shared_dirty_card_queue);
319 // Restore the completed buffer queue limit.
320 _max_completed_queue = save_max_completed_queue;
321 }
|