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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc_implementation/g1/g1CardCounts.hpp"
27 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
28 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
29 #include "gc_implementation/g1/g1GCPhaseTimes.hpp"
30 #include "memory/cardTableModRefBS.hpp"
31 #include "services/memTracker.hpp"
32 #include "utilities/copy.hpp"
33
34 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
35
36 void G1CardCountsMappingChangedListener::on_commit(uint start_idx, size_t num_regions) {
37 MemRegion mr(G1CollectedHeap::heap()->bottom_addr_for_region(start_idx), num_regions * HeapRegion::GrainWords);
38 _counts->clear_range(mr);
39 }
40
41 void G1CardCounts::clear_range(size_t from_card_num, size_t to_card_num) {
42 if (has_count_table()) {
43 assert(from_card_num < to_card_num,
44 err_msg("Wrong order? from: " SIZE_FORMAT ", to: "SIZE_FORMAT,
45 from_card_num, to_card_num));
46 Copy::fill_to_bytes(&_card_counts[from_card_num], (to_card_num - from_card_num));
47 }
48 }
49
50 G1CardCounts::G1CardCounts(G1CollectedHeap *g1h):
51 _listener(), _g1h(g1h), _card_counts(NULL), _reserved_max_card_num(0) {
52 _listener.set_cardcounts(this);
53 }
54
55 void G1CardCounts::initialize(G1RegionToSpaceMapper* mapper) {
56 assert(_g1h->max_capacity() > 0, "initialization order");
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc_implementation/g1/g1CardCounts.hpp"
27 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
28 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
29 #include "gc_implementation/g1/g1GCPhaseTimes.hpp"
30 #include "memory/cardTableModRefBS.hpp"
31 #include "services/memTracker.hpp"
32 #include "utilities/copy.hpp"
33
34 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
35
36 void G1CardCountsMappingChangedListener::on_commit(uint start_idx, size_t num_regions, bool zero_filled) {
37 if (zero_filled) {
38 return;
39 }
40 MemRegion mr(G1CollectedHeap::heap()->bottom_addr_for_region(start_idx), num_regions * HeapRegion::GrainWords);
41 _counts->clear_range(mr);
42 }
43
44 void G1CardCounts::clear_range(size_t from_card_num, size_t to_card_num) {
45 if (has_count_table()) {
46 assert(from_card_num < to_card_num,
47 err_msg("Wrong order? from: " SIZE_FORMAT ", to: "SIZE_FORMAT,
48 from_card_num, to_card_num));
49 Copy::fill_to_bytes(&_card_counts[from_card_num], (to_card_num - from_card_num));
50 }
51 }
52
53 G1CardCounts::G1CardCounts(G1CollectedHeap *g1h):
54 _listener(), _g1h(g1h), _card_counts(NULL), _reserved_max_card_num(0) {
55 _listener.set_cardcounts(this);
56 }
57
58 void G1CardCounts::initialize(G1RegionToSpaceMapper* mapper) {
59 assert(_g1h->max_capacity() > 0, "initialization order");
|