// Write the string space. The string space contains one or multiple GC(G1) regions. // When the total string space size is smaller than one GC region of the dump time, // only one string region is used for shared strings. // // If the total string space size is bigger than one GC region, there would be more // than one GC regions allocated for shared strings. The first/bottom GC region might // be a partial GC region with the empty portion at the higher address within that region. // The non-empty portion of the first region is written into the archive as one string // region. The rest are consecutive full GC regions if they exist, which can be written // out in one chunk as another string region. void FileMapInfo::write_string_regions(GrowableArray<MemRegion> *regions) { for (int i = MetaspaceShared::first_string; i < MetaspaceShared::first_string + MetaspaceShared::max_strings; i++) { char* start = NULL; size_t size = 0; if (regions->is_nonempty()) { if (i == MetaspaceShared::first_string) { MemRegion first = regions->first(); start = (char*)first.start(); size = first.byte_size(); } else { int len = regions->length(); if (len > 1) { start = (char*)regions->at(1).start(); size = (char*)regions->at(len - 1).end() - start; } } } write_region(i, start, size, size, false, false); } }
void CardTableRS::clear(MemRegion mr) { for (int i = 0; i < _ct_bs._cur_covered_regions; i++) { MemRegion mri = mr.intersection(_ct_bs._covered[i]); if (mri.byte_size() > 0) clear_MemRegion(mri); } }
void CountNonCleanMemRegionClosure::do_MemRegion(MemRegion mr) { if (_g1->is_in_g1_reserved(mr.start())) { _n += (int) ((mr.byte_size() / CardTableModRefBS::card_size)); if (_start_first == NULL) _start_first = mr.start(); } }