SA needs memory regions to generate class histogram. So it is difficult to use
visitor model for it.
I want to back to this issue when class unloading is implemented.
On 2018/08/08 20:45, Per Liden wrote:
On 08/08/2018 10:34 AM, Yasumasa Suenaga wrote:
On 2018/08/08 17:07, Per Liden wrote:
On 08/08/2018 10:02 AM, Per Liden wrote:
On 08/08/2018 10:00 AM, Yasumasa Suenaga wrote:
Will class unloading be occurred after relocation?
No, before relocation.
But it doesn't really matter when it happens, since there can still be
unreachable objects with dead class pointers in ZPages that were not relocated.
I think we can include all unreachable objects in the histogram.
For example, ParallelScavengeHeap in SA collects all objects between bottom()
and top() in all spaces like `jcmd GC.class_histogram` with -all option.
So I think we can fix Object Histogram for ZGC if we resolve dead class pointer.
If SA can know ZGC phase, we might resolve it as following:
* GC is working:
Check colored pointer to collect oops.
* GC is NOT working:
Collect all oops in ZPage.
Unfortunately that's not good enough. It doesn't matter if the GC is "working"
or not, there might be unreachable objects from several GC cycles back which you can't
touch. The only safe way to do this is to walk the live graph, which means starting from
the roots. As you might have noticed, ZCollectedHeap::object_iterate() is implemented
like this, for this exact reason.