RFR: 8321122: Shenandoah: Remove ShenandoahLoopOptsAfterExpansion flag

Roland Westrelin roland at openjdk.org
Mon Dec 4 15:55:40 UTC 2023


On Mon, 4 Dec 2023 15:45:14 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> I thought late barrier insertion basically avoids dealing with any optimizer questions, as we insert the barriers close to emit. So if we are to do late barrier insertion, we don't need the bulk of barrier optimization code? Maybe I misunderstand where late barrier insertion fits in C2.

But the flag you're removing controls optimizations of the barrier code once expanded. For instance:
1)

a' = barrier(a);
b' = barrier(b);

is expanded to:
2)

if (heap_stable) {
  a' = a;
}  else {
  a' = slow_case(a);
}
if (heap_stable) {
  b' = b;
}  else {
  b' = slow_case(b);
}

which is then optimized under the `ShenandoahLoopOptsAfterExpansion` flag to:
3)

if (heap_stable) {
  a' = a;
  b' = b;
}  else {
  a' = slow_case(a);
  b' = slow_case(b);
}

Late insertion gives 2) without 1) but it doesn't give you 3). Depending where insertion happens (I haven't looked at zgc code) you could still do 3) next or it would be too late.

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

PR Comment: https://git.openjdk.org/jdk/pull/16908#issuecomment-1838935805


More information about the shenandoah-dev mailing list