Parallel GC and array object layout: way off the base and laid out in reverse?

Aleksey Shipilev aleksey.shipilev at
Wed Sep 4 13:44:30 PDT 2013

Thanks Tony!

On 05.09.2013, at 0:33, Tony Printezis <tprintezis at> wrote:

> G1 should also have depth-first copying (Igor, didn't you implement it?) so it should behave similarly to PS.
G1 seems unaffected, i.e. laying out the elements in forward order.

> Performance of forward array iteration might or might not be important. For hash tables, it's all about look-ups, so the order should not matter. It should only matter if you do a lot of whole array traversals. It might be important for something like ArrayLists.

Still have to do this on non-x86; I would suspect the behavior on ARM is quite different for forward and backward traversal.

> Regarding "I don't like surprises" : Thomas' reply was spot on. The expectation that all GCs should always copy objects in the same way and lay out objects graphs in the same order is very misguided, IMHO. Different GCs will behave differently (due to different allocation strategies, parallelism, PLABs, work stealing, array chunking, etc.). It might be possible to make the GCs behave a bit more similarly then they do now, but that's about it. :-)

Well, d'uh! The second part of that "no surprises" is "where possible". Overly generalizing (the absence of common sense in object layout) is also misguided. This quirk does look surprising and seems relatively simple to fix ;) Of course, users are oblivious of the exact layouts, as they should be. 


More information about the hotspot-gc-dev mailing list