RFR (XXS): 8040792: G1CodeRootChunkManager::static_mem_size returns the wrong size

Bengt Rutisson bengt.rutisson at oracle.com
Thu Apr 17 11:36:00 UTC 2014


Hi Thomas,

On 2014-04-17 12:42, Thomas Schatzl wrote:
> Hi all,
>
>    can I have reviews for this tiny change that fixes one error that
> Mikael Gerdin found in the review for "8038930: G1CodeRootSet::test()
> fails with assert(...)" just a few minutes after I pushed the change?
>
> It's about changing the following line in G1CodeRootSet.cpp:
>
>    86 size_t G1CodeRootChunkManager::static_mem_size() {
>    87   return sizeof(this);
>    88 }
>
> to
>
>    87   return sizeof(*this);

I would kind of prefer

  return sizeof(G1CodeRootChunkManager);

since it would be faster for me to read.

Also, there are more places in the G1 code where we do sizeof(this). At 
a first glance it looks to me like all of them are wrong.

$ grep -r "sizeof(this)" src/share/vm/gc_implementation/g1/
src/share/vm/gc_implementation/g1/sparsePRT.cpp:  return sizeof(this) +
src/share/vm/gc_implementation/g1/sparsePRT.cpp:  return sizeof(this) + 
_next->mem_size();
src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp:  return 
sizeof(this);
src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp:  return 
sizeof(this) + _list.count() * _list.size();
src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp:      + 
(sizeof(this) - sizeof(OtherRegionsTable))
src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp:    return 
sizeof(this) + _bm.size_in_words() * HeapWordSize;

Can you verify these at the same time?

Thanks,
Bengt

>
> CR:
> https://bugs.openjdk.java.net/browse/JDK-8040792
>
> Webrev:
> http://cr.openjdk.java.net/~tschatzl/8040792/webrev/
>
> Testing:
> Internal test, jprt
>
> Thanks,
> Thomas
>




More information about the hotspot-gc-dev mailing list