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 *
429 G1CMTask* task(uint id) {
430 assert(id < _num_active_tasks, "Task id %u not within active bounds up to %u", id, _num_active_tasks);
431 return _tasks[id];
432 }
433
434 // Access / manipulation of the overflow flag which is set to
435 // indicate that the global stack has overflown
436 bool has_overflown() { return _has_overflown; }
437 void set_has_overflown() { _has_overflown = true; }
438 void clear_has_overflown() { _has_overflown = false; }
439 bool restart_for_overflow() { return _restart_for_overflow; }
440
441 // Methods to enter the two overflow sync barriers
442 void enter_first_sync_barrier(uint worker_id);
443 void enter_second_sync_barrier(uint worker_id);
444
445 // Clear the given bitmap in parallel using the given WorkGang. If may_yield is
446 // true, periodically insert checks to see if this method should exit prematurely.
447 void clear_bitmap(G1CMBitMap* bitmap, WorkGang* workers, bool may_yield);
448 public:
449 // Manipulation of the global mark stack.
450 // The push and pop operations are used by tasks for transfers
451 // between task-local queues and the global mark stack.
452 bool mark_stack_push(G1TaskQueueEntry* arr) {
453 if (!_global_mark_stack.par_push_chunk(arr)) {
454 set_has_overflown();
455 return false;
456 }
457 return true;
458 }
459 bool mark_stack_pop(G1TaskQueueEntry* arr) {
460 return _global_mark_stack.par_pop_chunk(arr);
461 }
462 size_t mark_stack_size() const { return _global_mark_stack.size(); }
463 size_t partial_mark_stack_size_target() const { return _global_mark_stack.capacity() / 3; }
464 bool mark_stack_empty() const { return _global_mark_stack.is_empty(); }
465
466 G1CMRootRegions* root_regions() { return &_root_regions; }
467
468 bool concurrent_marking_in_progress() const {
|
1 /*
2 * Copyright (c) 2001, 2018, 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 *
429 G1CMTask* task(uint id) {
430 assert(id < _num_active_tasks, "Task id %u not within active bounds up to %u", id, _num_active_tasks);
431 return _tasks[id];
432 }
433
434 // Access / manipulation of the overflow flag which is set to
435 // indicate that the global stack has overflown
436 bool has_overflown() { return _has_overflown; }
437 void set_has_overflown() { _has_overflown = true; }
438 void clear_has_overflown() { _has_overflown = false; }
439 bool restart_for_overflow() { return _restart_for_overflow; }
440
441 // Methods to enter the two overflow sync barriers
442 void enter_first_sync_barrier(uint worker_id);
443 void enter_second_sync_barrier(uint worker_id);
444
445 // Clear the given bitmap in parallel using the given WorkGang. If may_yield is
446 // true, periodically insert checks to see if this method should exit prematurely.
447 void clear_bitmap(G1CMBitMap* bitmap, WorkGang* workers, bool may_yield);
448 public:
449 // Notification for eagerly reclaimed regions to clean up.
450 void humongous_object_eagerly_reclaimed(HeapRegion* r);
451 // Manipulation of the global mark stack.
452 // The push and pop operations are used by tasks for transfers
453 // between task-local queues and the global mark stack.
454 bool mark_stack_push(G1TaskQueueEntry* arr) {
455 if (!_global_mark_stack.par_push_chunk(arr)) {
456 set_has_overflown();
457 return false;
458 }
459 return true;
460 }
461 bool mark_stack_pop(G1TaskQueueEntry* arr) {
462 return _global_mark_stack.par_pop_chunk(arr);
463 }
464 size_t mark_stack_size() const { return _global_mark_stack.size(); }
465 size_t partial_mark_stack_size_target() const { return _global_mark_stack.capacity() / 3; }
466 bool mark_stack_empty() const { return _global_mark_stack.is_empty(); }
467
468 G1CMRootRegions* root_regions() { return &_root_regions; }
469
470 bool concurrent_marking_in_progress() const {
|