[jdk19] RFR: 8290250: Shenandoah: disable Loom for iu mode

Erik Österlund eosterlund at openjdk.org
Thu Jul 14 17:44:09 UTC 2022


On Thu, 14 Jul 2022 17:17:49 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

> > > > Speaking of IU mode, how does Shenandoah IU mode deal with barrier elision on newly allocated objects? It was only valid in CMS because the entire young generation was traversed when terminating the concurrent marking, so that unvisited pointers could be found.
> 
> > > 
> 
> > > 
> 
> > > Shenandoah SATB/IU both elide barrier on newly allocated objects. SATB barrier should guarantee they can only refer marked objects. Do I miss anything?
> 
> > 
> 
> > Yes, I believe so. For a SATB collector, it is okay to elide the barrier on newly allocated objects, because they were not part of the snapshot-of-the-beginning, and all new objects are implicitly alive and don't need to be visited.
> 
> > 
> 
> > However, with an IU scheme, that property does not translate.
> 
> > 
> 
> > Consider that you have a particular object graph when marking starts, then one mutator loads an object from the graph, and clears the field such that it is only reachable from the roots of said murator thread. Then the mutator writes the object to a newly allocated object without barriers and discards the root. Now, the reference is only reachable from the newly allocated object.
> 
> > 
> 
> > So for this elision to be valid with IU, the GC has to visit newly allocated objects again before terminating, which e.g. CMS indeed did, by doing a young collection in the safepoint that terminated old marking, but I don't know that Shenandoah does anything like that.
> 
> 
> 
> Unfortunately, IU problem is beyond the barrier elision. Even I don't elide the barrier for IU, I still see failures.

Right. Loom assumes that write barriers are not needed on newly allocated objects, so that it can copy oops from the stack to the heap. Shenandoah with IU mode is the only collector where that is not true, due to the reason I outlined. What I'm saying isn't that turning off barrier elision in IU mode will fix your current loom crash. I'm saying that even without loom, the barrier elision is invalid in general. I thought I'd let you know, in case you want Shenandoah with IU mode to work reliably at all.

-------------

PR: https://git.openjdk.org/jdk19/pull/140



More information about the hotspot-gc-dev mailing list