109 // Shrink
110 size_t shrink_by = current_blocks_size_in_bytes - requested_blocks_size_in_bytes;
111 _virtual_space.shrink_by(shrink_by);
112 }
113
114 _blocks_region.set_word_size(requested_blocks_size_in_bytes / sizeof(HeapWord));
115
116 assert(requested_blocks_size_in_bytes % sizeof(HeapWord) == 0, "Block table not expanded in word sized increment");
117 assert(requested_blocks_size_in_bytes == _blocks_region.byte_size(), "Sanity");
118 assert(block_for_addr(low_bound) == &_raw_base[0], "Checking start of map");
119 assert(block_for_addr(high_bound-1) <= &_raw_base[_blocks_region.byte_size()-1], "Checking end of map");
120 }
121
122 void ObjectStartArray::reset() {
123 memset(_blocks_region.start(), clean_block, _blocks_region.byte_size());
124 }
125
126
127 bool ObjectStartArray::object_starts_in_range(HeapWord* start_addr,
128 HeapWord* end_addr) const {
129 assert(start_addr <= end_addr, "range is wrong");
130 if (start_addr > end_addr) {
131 return false;
132 }
133
134 jbyte* start_block = block_for_addr(start_addr);
135 jbyte* end_block = block_for_addr(end_addr);
136
137 for (jbyte* block = start_block; block <= end_block; block++) {
138 if (*block != clean_block) {
139 return true;
140 }
141 }
142
143 return false;
144 }
|
109 // Shrink
110 size_t shrink_by = current_blocks_size_in_bytes - requested_blocks_size_in_bytes;
111 _virtual_space.shrink_by(shrink_by);
112 }
113
114 _blocks_region.set_word_size(requested_blocks_size_in_bytes / sizeof(HeapWord));
115
116 assert(requested_blocks_size_in_bytes % sizeof(HeapWord) == 0, "Block table not expanded in word sized increment");
117 assert(requested_blocks_size_in_bytes == _blocks_region.byte_size(), "Sanity");
118 assert(block_for_addr(low_bound) == &_raw_base[0], "Checking start of map");
119 assert(block_for_addr(high_bound-1) <= &_raw_base[_blocks_region.byte_size()-1], "Checking end of map");
120 }
121
122 void ObjectStartArray::reset() {
123 memset(_blocks_region.start(), clean_block, _blocks_region.byte_size());
124 }
125
126
127 bool ObjectStartArray::object_starts_in_range(HeapWord* start_addr,
128 HeapWord* end_addr) const {
129 assert(start_addr <= end_addr,
130 err_msg("Range is wrong. start_addr (" PTR_FORMAT ") is after end_addr (" PTR_FORMAT ")",
131 p2i(start_addr), p2i(end_addr)));
132 if (start_addr > end_addr) {
133 return false;
134 }
135
136 jbyte* start_block = block_for_addr(start_addr);
137 jbyte* end_block = block_for_addr(end_addr);
138
139 for (jbyte* block = start_block; block <= end_block; block++) {
140 if (*block != clean_block) {
141 return true;
142 }
143 }
144
145 return false;
146 }
|