< prev index next >

src/hotspot/share/gc/g1/heapRegionRemSet.inline.hpp

Print this page

 1 /*
 2  * Copyright (c) 2018, 2019, 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  *

56     CardIdx_t from_card = OtherRegionsTable::card_within_region(from, loc_hr);
57     return add_card(from_card);
58   }
59   return false;
60 }
61 
62 inline void PerRegionTable::init(HeapRegion* hr, bool clear_links_to_all_list) {
63   if (clear_links_to_all_list) {
64     set_next(NULL);
65   }
66   _collision_list_next = NULL;
67   _occupied = 0;
68   _bm.clear();
69   // Make sure that the bitmap clearing above has been finished before publishing
70   // this PRT to concurrent threads.
71   Atomic::release_store(&_hr, hr);
72 }
73 
74 template <class Closure>
75 void OtherRegionsTable::iterate(Closure& cl) {
76   if (_n_coarse_entries > 0) {
77     BitMap::idx_t cur = _coarse_map.get_next_one_offset(0);
78     while (cur != _coarse_map.size()) {
79       cl.next_coarse_prt((uint)cur);
80       cur = _coarse_map.get_next_one_offset(cur + 1);
81     }
82   }
83   {
84     PerRegionTable* cur = _first_all_fine_prts;
85     while (cur != NULL) {
86       cl.next_fine_prt(cur->hr()->hrm_index(), cur->bm());
87       cur = cur->next();
88     }
89   }
90   {
91     SparsePRTBucketIter iter(&_sparse_table);
92     SparsePRTEntry* cur;
93     while (iter.has_next(cur)) {
94       cl.next_sparse_prt(cur->r_ind(), cur->cards(), cur->num_valid_cards());
95     }
96   }

 1 /*
 2  * Copyright (c) 2018, 2020, 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  *

56     CardIdx_t from_card = OtherRegionsTable::card_within_region(from, loc_hr);
57     return add_card(from_card);
58   }
59   return false;
60 }
61 
62 inline void PerRegionTable::init(HeapRegion* hr, bool clear_links_to_all_list) {
63   if (clear_links_to_all_list) {
64     set_next(NULL);
65   }
66   _collision_list_next = NULL;
67   _occupied = 0;
68   _bm.clear();
69   // Make sure that the bitmap clearing above has been finished before publishing
70   // this PRT to concurrent threads.
71   Atomic::release_store(&_hr, hr);
72 }
73 
74 template <class Closure>
75 void OtherRegionsTable::iterate(Closure& cl) {
76   if (Atomic::load(&_has_coarse_entries)) {
77     BitMap::idx_t cur = _coarse_map.get_next_one_offset(0);
78     while (cur != _coarse_map.size()) {
79       cl.next_coarse_prt((uint)cur);
80       cur = _coarse_map.get_next_one_offset(cur + 1);
81     }
82   }
83   {
84     PerRegionTable* cur = _first_all_fine_prts;
85     while (cur != NULL) {
86       cl.next_fine_prt(cur->hr()->hrm_index(), cur->bm());
87       cur = cur->next();
88     }
89   }
90   {
91     SparsePRTBucketIter iter(&_sparse_table);
92     SparsePRTEntry* cur;
93     while (iter.has_next(cur)) {
94       cl.next_sparse_prt(cur->r_ind(), cur->cards(), cur->num_valid_cards());
95     }
96   }
< prev index next >