35 class G1BlockOffsetTable;
36 class G1ContiguousSpace;
37
38 // This implementation of "G1BlockOffsetTable" divides the covered region
39 // into "N"-word subregions (where "N" = 2^"LogN". An array with an entry
40 // for each such subregion indicates how far back one must go to find the
41 // start of the chunk that includes the first word of the subregion.
42 //
43 // Each G1BlockOffsetTablePart is owned by a G1ContiguousSpace.
44
45 class G1BlockOffsetTable: public CHeapObj<mtGC> {
46 friend class G1BlockOffsetTablePart;
47 friend class VMStructs;
48
49 private:
50 // The reserved region covered by the table.
51 MemRegion _reserved;
52
53 // Array for keeping offsets for retrieving object start fast given an
54 // address.
55 u_char* _offset_array; // byte array keeping backwards offsets
56
57 void check_offset(size_t offset, const char* msg) const {
58 assert(offset <= BOTConstants::N_words,
59 "%s - offset: " SIZE_FORMAT ", N_words: %u",
60 msg, offset, BOTConstants::N_words);
61 }
62
63 // Bounds checking accessors:
64 // For performance these have to devolve to array accesses in product builds.
65 inline u_char offset_array(size_t index) const;
66
67 void set_offset_array_raw(size_t index, u_char offset) {
68 _offset_array[index] = offset;
69 }
70
71 inline void set_offset_array(size_t index, u_char offset);
72
73 inline void set_offset_array(size_t index, HeapWord* high, HeapWord* low);
74
75 inline void set_offset_array(size_t left, size_t right, u_char offset);
76
77 bool is_card_boundary(HeapWord* p) const;
78
79 void check_index(size_t index, const char* msg) const NOT_DEBUG_RETURN;
80
81 public:
82
83 // Return the number of slots needed for an offset array
84 // that covers mem_region_words words.
85 static size_t compute_size(size_t mem_region_words) {
86 size_t number_of_slots = (mem_region_words / BOTConstants::N_words);
87 return ReservedSpace::allocation_align_size_up(number_of_slots);
88 }
89
90 // Returns how many bytes of the heap a single byte of the BOT corresponds to.
|
35 class G1BlockOffsetTable;
36 class G1ContiguousSpace;
37
38 // This implementation of "G1BlockOffsetTable" divides the covered region
39 // into "N"-word subregions (where "N" = 2^"LogN". An array with an entry
40 // for each such subregion indicates how far back one must go to find the
41 // start of the chunk that includes the first word of the subregion.
42 //
43 // Each G1BlockOffsetTablePart is owned by a G1ContiguousSpace.
44
45 class G1BlockOffsetTable: public CHeapObj<mtGC> {
46 friend class G1BlockOffsetTablePart;
47 friend class VMStructs;
48
49 private:
50 // The reserved region covered by the table.
51 MemRegion _reserved;
52
53 // Array for keeping offsets for retrieving object start fast given an
54 // address.
55 volatile u_char* _offset_array; // byte array keeping backwards offsets
56
57 void check_offset(size_t offset, const char* msg) const {
58 assert(offset <= BOTConstants::N_words,
59 "%s - offset: " SIZE_FORMAT ", N_words: %u",
60 msg, offset, BOTConstants::N_words);
61 }
62
63 // Bounds checking accessors:
64 // For performance these have to devolve to array accesses in product builds.
65 inline u_char offset_array(size_t index) const;
66
67 inline void set_offset_array_raw(size_t index, u_char offset);
68 inline void set_offset_array(size_t index, u_char offset);
69
70 inline void set_offset_array(size_t index, HeapWord* high, HeapWord* low);
71
72 inline void set_offset_array(size_t left, size_t right, u_char offset);
73
74 bool is_card_boundary(HeapWord* p) const;
75
76 void check_index(size_t index, const char* msg) const NOT_DEBUG_RETURN;
77
78 public:
79
80 // Return the number of slots needed for an offset array
81 // that covers mem_region_words words.
82 static size_t compute_size(size_t mem_region_words) {
83 size_t number_of_slots = (mem_region_words / BOTConstants::N_words);
84 return ReservedSpace::allocation_align_size_up(number_of_slots);
85 }
86
87 // Returns how many bytes of the heap a single byte of the BOT corresponds to.
|