24
25 #include "precompiled.hpp"
26 #include "gc/g1/heapRegion.hpp"
27 #include "gc/g1/heapRegionBounds.inline.hpp"
28 #include "gc/g1/heapRegionRemSet.hpp"
29 #include "gc/g1/sparsePRT.hpp"
30 #include "gc/shared/cardTableModRefBS.hpp"
31 #include "gc/shared/space.inline.hpp"
32 #include "memory/allocation.inline.hpp"
33 #include "runtime/atomic.hpp"
34 #include "runtime/mutexLocker.hpp"
35
36 // Check that the size of the SparsePRTEntry is evenly divisible by the maximum
37 // member type to avoid SIGBUS when accessing them.
38 STATIC_ASSERT(sizeof(SparsePRTEntry) % sizeof(int) == 0);
39
40 void SparsePRTEntry::init(RegionIdx_t region_ind) {
41 // Check that the card array element type can represent all cards in the region.
42 // Choose a large SparsePRTEntry::card_elem_t (e.g. CardIdx_t) if required.
43 assert(((size_t)1 << (sizeof(SparsePRTEntry::card_elem_t) * BitsPerByte)) *
44 G1SATBCardTableModRefBS::card_size >= HeapRegionBounds::max_size(), "precondition");
45 assert(G1RSetSparseRegionEntries > 0, "precondition");
46 _region_ind = region_ind;
47 _next_index = RSHashTable::NullEntry;
48 _next_null = 0;
49 }
50
51 bool SparsePRTEntry::contains_card(CardIdx_t card_index) const {
52 for (int i = 0; i < num_valid_cards(); i++) {
53 if (card(i) == card_index) {
54 return true;
55 }
56 }
57 return false;
58 }
59
60 SparsePRTEntry::AddCardResult SparsePRTEntry::add_card(CardIdx_t card_index) {
61 for (int i = 0; i < num_valid_cards(); i++) {
62 if (card(i) == card_index) {
63 return found;
64 }
|
24
25 #include "precompiled.hpp"
26 #include "gc/g1/heapRegion.hpp"
27 #include "gc/g1/heapRegionBounds.inline.hpp"
28 #include "gc/g1/heapRegionRemSet.hpp"
29 #include "gc/g1/sparsePRT.hpp"
30 #include "gc/shared/cardTableModRefBS.hpp"
31 #include "gc/shared/space.inline.hpp"
32 #include "memory/allocation.inline.hpp"
33 #include "runtime/atomic.hpp"
34 #include "runtime/mutexLocker.hpp"
35
36 // Check that the size of the SparsePRTEntry is evenly divisible by the maximum
37 // member type to avoid SIGBUS when accessing them.
38 STATIC_ASSERT(sizeof(SparsePRTEntry) % sizeof(int) == 0);
39
40 void SparsePRTEntry::init(RegionIdx_t region_ind) {
41 // Check that the card array element type can represent all cards in the region.
42 // Choose a large SparsePRTEntry::card_elem_t (e.g. CardIdx_t) if required.
43 assert(((size_t)1 << (sizeof(SparsePRTEntry::card_elem_t) * BitsPerByte)) *
44 G1CardTable::card_size >= HeapRegionBounds::max_size(), "precondition");
45 assert(G1RSetSparseRegionEntries > 0, "precondition");
46 _region_ind = region_ind;
47 _next_index = RSHashTable::NullEntry;
48 _next_null = 0;
49 }
50
51 bool SparsePRTEntry::contains_card(CardIdx_t card_index) const {
52 for (int i = 0; i < num_valid_cards(); i++) {
53 if (card(i) == card_index) {
54 return true;
55 }
56 }
57 return false;
58 }
59
60 SparsePRTEntry::AddCardResult SparsePRTEntry::add_card(CardIdx_t card_index) {
61 for (int i = 0; i < num_valid_cards(); i++) {
62 if (card(i) == card_index) {
63 return found;
64 }
|