RFR[S] 8210289 ArchivedKlassSubGraphInfoRecord is incomplete
ioi.lam at oracle.com
Sun Sep 2 01:08:06 UTC 2018
I found this bug while trying to merge my code for CDS support of Lambda
When heapShared.cpp dumps a sub-graph of heap objects, it attempts to
record all the classes of all the objects that are referenced by
this sub-graph. However, if one of these objects have already been visited
while a previous sub-graph was dumped, then this object's class is not
recorded in the current sub-graph.
At runtime, if the current sub-graph is restored before any other
sub-graphs, we will end up with a live object in the Java heap with
an uninitialized class.
Now I create the sub-graph's klasses list after all sub-graphs have dumped.
For each class that has archived sub-graph(s), I do a heap walk to discover
all klasses that are reachable from this archived fields of this class.
This is sub-optimal but suffice for now because we just have a very small
number of sub-graphs. The worst case its O(N^2) where N is the number of
objects in the archived heap.
In the future, we might need to implement a more efficient algorithm that
walks the heap once and computes all the klasses lists of all the
sub-graphs at the same time.
More information about the hotspot-runtime-dev