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 *
497 // Separated the asserts so that we know which one fires.
498 assert(_heap_start != NULL, "heap bounds should look ok");
499 assert(_heap_end != NULL, "heap bounds should look ok");
500 assert(_heap_start < _heap_end, "heap bounds should look ok");
501
502 // Reset all the marking data structures and any necessary flags
503 reset_marking_state();
504
505 // We reset all of them, since different phases will use
506 // different number of active threads. So, it's easiest to have all
507 // of them ready.
508 for (uint i = 0; i < _max_num_tasks; ++i) {
509 _tasks[i]->reset(_next_mark_bitmap);
510 }
511
512 // we need this to make sure that the flag is on during the evac
513 // pause with initial mark piggy-backed
514 set_concurrent_marking_in_progress();
515 }
516
517
518 void G1ConcurrentMark::reset_marking_state() {
519 _global_mark_stack.set_empty();
520
521 // Expand the marking stack, if we have to and if we can.
522 if (has_overflown()) {
523 _global_mark_stack.expand();
524 }
525
526 clear_has_overflown();
527 _finger = _heap_start;
528
529 for (uint i = 0; i < _max_num_tasks; ++i) {
530 G1CMTaskQueue* queue = _task_queues->queue(i);
531 queue->set_empty();
532 }
533 }
534
535 void G1ConcurrentMark::set_concurrency(uint active_tasks) {
536 assert(active_tasks <= _max_num_tasks, "we should not have more");
|
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 *
497 // Separated the asserts so that we know which one fires.
498 assert(_heap_start != NULL, "heap bounds should look ok");
499 assert(_heap_end != NULL, "heap bounds should look ok");
500 assert(_heap_start < _heap_end, "heap bounds should look ok");
501
502 // Reset all the marking data structures and any necessary flags
503 reset_marking_state();
504
505 // We reset all of them, since different phases will use
506 // different number of active threads. So, it's easiest to have all
507 // of them ready.
508 for (uint i = 0; i < _max_num_tasks; ++i) {
509 _tasks[i]->reset(_next_mark_bitmap);
510 }
511
512 // we need this to make sure that the flag is on during the evac
513 // pause with initial mark piggy-backed
514 set_concurrent_marking_in_progress();
515 }
516
517 void G1ConcurrentMark::humongous_object_eagerly_reclaimed(HeapRegion* r) {
518 assert(SafepointSynchronize::is_at_safepoint(), "May only be called at a safepoint.");
519
520 // Need to clear mark bit of the humongous object if already set and during a marking cycle.
521 if (_next_mark_bitmap->is_marked(r->bottom())) {
522 _next_mark_bitmap->clear(r->bottom());
523 }
524 }
525
526 void G1ConcurrentMark::reset_marking_state() {
527 _global_mark_stack.set_empty();
528
529 // Expand the marking stack, if we have to and if we can.
530 if (has_overflown()) {
531 _global_mark_stack.expand();
532 }
533
534 clear_has_overflown();
535 _finger = _heap_start;
536
537 for (uint i = 0; i < _max_num_tasks; ++i) {
538 G1CMTaskQueue* queue = _task_queues->queue(i);
539 queue->set_empty();
540 }
541 }
542
543 void G1ConcurrentMark::set_concurrency(uint active_tasks) {
544 assert(active_tasks <= _max_num_tasks, "we should not have more");
|