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 *
524 // OtherRegionsTable for why this is OK.
525 assert(prt != NULL, "Inv");
526
527 prt->add_reference(from);
528
529 if (G1RecordHRRSOops) {
530 HeapRegionRemSet::record(_hr, from);
531 if (G1TraceHeapRegionRememberedSet) {
532 gclog_or_tty->print("Added card " PTR_FORMAT " to region "
533 "[" PTR_FORMAT "...) for ref " PTR_FORMAT ".\n",
534 align_size_down(uintptr_t(from),
535 CardTableModRefBS::card_size),
536 _hr->bottom(), from);
537 }
538 }
539 assert(contains_reference(from), "We just added it!");
540 }
541
542 PerRegionTable*
543 OtherRegionsTable::find_region_table(size_t ind, HeapRegion* hr) const {
544 assert(0 <= ind && ind < _max_fine_entries, "Preconditions.");
545 PerRegionTable* prt = _fine_grain_regions[ind];
546 while (prt != NULL && prt->hr() != hr) {
547 prt = prt->collision_list_next();
548 }
549 // Loop postcondition is the method postcondition.
550 return prt;
551 }
552
553 jint OtherRegionsTable::_n_coarsenings = 0;
554
555 PerRegionTable* OtherRegionsTable::delete_region_table() {
556 assert(_m->owned_by_self(), "Precondition");
557 assert(_n_fine_entries == _max_fine_entries, "Precondition");
558 PerRegionTable* max = NULL;
559 jint max_occ = 0;
560 PerRegionTable** max_prev;
561 size_t max_ind;
562
563 size_t i = _fine_eviction_start;
564 for (size_t k = 0; k < _fine_eviction_sample_size; k++) {
|
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 *
524 // OtherRegionsTable for why this is OK.
525 assert(prt != NULL, "Inv");
526
527 prt->add_reference(from);
528
529 if (G1RecordHRRSOops) {
530 HeapRegionRemSet::record(_hr, from);
531 if (G1TraceHeapRegionRememberedSet) {
532 gclog_or_tty->print("Added card " PTR_FORMAT " to region "
533 "[" PTR_FORMAT "...) for ref " PTR_FORMAT ".\n",
534 align_size_down(uintptr_t(from),
535 CardTableModRefBS::card_size),
536 _hr->bottom(), from);
537 }
538 }
539 assert(contains_reference(from), "We just added it!");
540 }
541
542 PerRegionTable*
543 OtherRegionsTable::find_region_table(size_t ind, HeapRegion* hr) const {
544 assert(ind < _max_fine_entries, "Preconditions.");
545 PerRegionTable* prt = _fine_grain_regions[ind];
546 while (prt != NULL && prt->hr() != hr) {
547 prt = prt->collision_list_next();
548 }
549 // Loop postcondition is the method postcondition.
550 return prt;
551 }
552
553 jint OtherRegionsTable::_n_coarsenings = 0;
554
555 PerRegionTable* OtherRegionsTable::delete_region_table() {
556 assert(_m->owned_by_self(), "Precondition");
557 assert(_n_fine_entries == _max_fine_entries, "Precondition");
558 PerRegionTable* max = NULL;
559 jint max_occ = 0;
560 PerRegionTable** max_prev;
561 size_t max_ind;
562
563 size_t i = _fine_eviction_start;
564 for (size_t k = 0; k < _fine_eviction_sample_size; k++) {
|