176
177 void ZPage::print_on_msg(outputStream* st, const char* msg) const {
178 st->print_cr("%-6s " PTR_FORMAT " " PTR_FORMAT " " PTR_FORMAT " %s/%-4u %s%s%s%s",
179 type_to_string(), untype(start()), untype(top()), untype(end()),
180 is_young() ? "Y" : "O",
181 seqnum(),
182 is_relocatable() ? " Relocatable" : "",
183 is_allocating() ? " Allocating" : "",
184 is_allocating() && msg != nullptr ? " " : "",
185 msg != nullptr ? msg : "");
186 }
187
188 void ZPage::print_on(outputStream* st) const {
189 print_on_msg(st, nullptr);
190 }
191
192 void ZPage::print() const {
193 print_on(tty);
194 }
195
196 void ZPage::verify_live(uint32_t live_objects, size_t live_bytes, bool in_place) const {
197 if (!in_place) {
198 // In-place relocation has changed the page to allocating
199 assert_zpage_mark_state();
200 }
201 guarantee(live_objects == _livemap.live_objects(), "Invalid number of live objects");
202 guarantee(live_bytes == _livemap.live_bytes(), "Invalid number of live bytes");
203 }
204
205 void ZPage::fatal_msg(const char* msg) const {
206 stringStream ss;
207 print_on_msg(&ss, msg);
208 fatal("%s", ss.base());
209 }
|
176
177 void ZPage::print_on_msg(outputStream* st, const char* msg) const {
178 st->print_cr("%-6s " PTR_FORMAT " " PTR_FORMAT " " PTR_FORMAT " %s/%-4u %s%s%s%s",
179 type_to_string(), untype(start()), untype(top()), untype(end()),
180 is_young() ? "Y" : "O",
181 seqnum(),
182 is_relocatable() ? " Relocatable" : "",
183 is_allocating() ? " Allocating" : "",
184 is_allocating() && msg != nullptr ? " " : "",
185 msg != nullptr ? msg : "");
186 }
187
188 void ZPage::print_on(outputStream* st) const {
189 print_on_msg(st, nullptr);
190 }
191
192 void ZPage::print() const {
193 print_on(tty);
194 }
195
196 void ZPage::verify_live(uint32_t live_objects, size_t live_bytes, uint32_t no_move_expand_count, bool in_place) const {
197 if (!in_place) {
198 // In-place relocation has changed the page to allocating
199 assert_zpage_mark_state();
200 }
201 guarantee(live_objects == _livemap.live_objects(), "Invalid number of live objects");
202 // live_bytes is computed from TO-space sizes. Expanding objects (is_hashed_not_expanded at
203 // mark time, expand_for_hash) contribute one extra HeapWord each in TO space. Non-moving
204 // in-place objects that would expand but stayed at the same address did NOT expand, so they
205 // are excluded via no_move_expand_count.
206 const size_t expected_live_bytes = _livemap.live_bytes()
207 + ((size_t)(_livemap.will_expand_objects() - no_move_expand_count)) * HeapWordSize;
208 guarantee(live_bytes == expected_live_bytes, "Invalid number of live bytes");
209 }
210
211 void ZPage::fatal_msg(const char* msg) const {
212 stringStream ss;
213 print_on_msg(&ss, msg);
214 fatal("%s", ss.base());
215 }
|