Fwd: Tracking object relocations in Java 8
Thomas Schatzl
thomas.schatzl at oracle.com
Fri Nov 20 10:50:42 UTC 2020
Hi,
On 19.11.20 10:47, David Griffiths wrote:
> BTW doesn't have to be a call to a "copy(from, to)" style function - if
> there is some convenient place where a list of pointers is traversed to do
> the update to the new location I'm quite happy to duplicate that code to do
> the same traversal. I'm not yet familiar with the code so just a nudge in
> the general direction would be great.
In Java 8, parallel gc is default. The relevant method is
PSPromotionManager::copy_to_survivor_space() there for young gc.
There is no general task list that is guaranteed to contain all objects
that are copied in any collector I'm aware of although there is some
"task queue". Objects are copied without going to that queue in some
cases though (e.g. if they are directly referenced by some VM internal
pointer, i.e. a "root").
So hooking into these "copy(from, to)" methods is your best bet.
Apart from that, traversal of objects occurs in several different places
("OopClosures") dependent on where that object is processed from. E.g.
the do_oop() methods in PSRootsClosure, PSScavengeFromCLDClosure,
PSKeepAliveClosure and others, so that's fairly inconvenient to hook into.
>
> Another alternative - don't suppose there is any option to force hashcodes
> to always be stored in the mark word (i.e. even if the hash code is not
> requested)? Couldn't see any sign of one in the code but just thought I'd
> ask. I guess -XX:hashCode=4 is just going to use the current address and
> only if hash code requested so of no use to me.
>
I am not aware of such an option but maybe others can help.
Hth,
Thomas
More information about the hotspot-gc-dev
mailing list