Fwd: Tracking object relocations in Java 8

David Griffiths dgriffiths at undo.io
Fri Nov 20 21:41:07 UTC 2020

Thanks, I will look at your and Andrew’s suggestions and see if I can find
a good place to put a breakpoint. We have “fast conditional breakpoints” so
it’s possible I could set the “from” address as a condition and then
trigger further breakpoints to get the “to” address. I think tracking (say)
95% of moves might be good enough.

On Fri, 20 Nov 2020 at 10:52, Thomas Schatzl <thomas.schatzl at oracle.com>

> 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
David Griffiths, Senior Software Engineer

Undo <https://undo.io> | Accelerate software defect resolution by
eliminating the guesswork in failure diagnosis

More information about the hotspot-gc-dev mailing list