src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp

Print this page
rev 6324 : 8037344: Use the "next" field to iterate over fine remembered instead of using the hash table
Summary: After changes to the PerRegionTable where all these PRTs are linked together in an additional field, simplify iterating over all PRTs by using these links instead of walki
Reviewed-by: mgerdin, jwilhelm, brutisso
rev 6325 : 8039596: Remove HeapRegionRemSet::clear_incoming_entry
Summary: The mentioned method is never used and out of date. So it is removed.
Reviewed-by: mgerdin, brutisso
rev 6329 : 8040792: G1: Memory usage calculation uses sizeof(this) instead of sizeof(classname)
Summary: A few locations in the code use sizeof(this) which returns the size of the pointer instead of sizeof(classname) which returns the size of the sum of its members. This change fixes these errors and adds a few tests.
Reviewed-by: mgerdin, brutisso

*** 167,177 **** bm->set_union(_bm); } // Mem size in bytes. size_t mem_size() const { ! return sizeof(this) + _bm.size_in_words() * HeapWordSize; } // Requires "from" to be in "hr()". bool contains_reference(OopOrNarrowOopStar from) const { assert(hr()->is_in_reserved(from), "Precondition."); --- 167,177 ---- bm->set_union(_bm); } // Mem size in bytes. size_t mem_size() const { ! return sizeof(PerRegionTable) + _bm.size_in_words() * HeapWordSize; } // Requires "from" to be in "hr()". bool contains_reference(OopOrNarrowOopStar from) const { assert(hr()->is_in_reserved(from), "Precondition.");
*** 733,743 **** sum += _first_all_fine_prts->mem_size() * _n_fine_entries; } sum += (sizeof(PerRegionTable*) * _max_fine_entries); sum += (_coarse_map.size_in_words() * HeapWordSize); sum += (_sparse_table.mem_size()); ! sum += sizeof(*this) - sizeof(_sparse_table); // Avoid double counting above. return sum; } size_t OtherRegionsTable::static_mem_size() { return FromCardCache::static_mem_size(); --- 733,743 ---- sum += _first_all_fine_prts->mem_size() * _n_fine_entries; } sum += (sizeof(PerRegionTable*) * _max_fine_entries); sum += (_coarse_map.size_in_words() * HeapWordSize); sum += (_sparse_table.mem_size()); ! sum += sizeof(OtherRegionsTable) - sizeof(_sparse_table); // Avoid double counting above. return sum; } size_t OtherRegionsTable::static_mem_size() { return FromCardCache::static_mem_size();
*** 1247,1256 **** --- 1247,1261 ---- } #ifndef PRODUCT void PerRegionTable::test_fl_mem_size() { PerRegionTable* dummy = alloc(NULL); + + size_t min_prt_size = sizeof(void*) + dummy->bm()->size_in_words() * HeapWordSize; + assert(dummy->mem_size() > min_prt_size, + err_msg("PerRegionTable memory usage is suspiciously small, only has "SIZE_FORMAT" bytes. " + "Should be at least "SIZE_FORMAT" bytes.", dummy->mem_size(), min_prt_size)); free(dummy); guarantee(dummy->mem_size() == fl_mem_size(), "fl_mem_size() does not return the correct element size"); // try to reset the state _free_list = NULL; delete dummy;