JDK-8212610 : Fix handling of memory in PhaseIdealLoop::clone_loop_predicates()
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 12
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-10-17
  • Updated: 2019-08-23
  • Resolved: 2018-11-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 12
12 b19Fixed
Related Reports
Relates :  
Description
We have:

Predicate 1
..
Predicate n

profile predicate 1
..
profile predicate n

loop head

Shenandoah write barriers produce memory, can be hoisted out of loop but
can also depend on some predicate so may end up with:

Predicate 1
..
Predicate n

profile predicate 1
..
write barrier
...
profile predicate n

loop head

In that case, all predicates branch to a region that dominates the
uncommon trap call. Same is true for profile predicates. Because of the
write barrier, the region for profile predicates has a memory phi to
merge memory state before the barrier and after the barrier. Now when
clone_loop_predicates() is called:

Predicate 1
..
Predicate n

profile predicate 1
..
write barrier
...
profile predicate n

cloned predicate

cloned profile predicate

loop head

the cloned predicate branches to the region shared by all
predicates. Same goes for the cloned profile predicate and the profile
predicates. The memory state for the cloned predicate should be the one
following the barrier but after cloning it's the one from the predicate
n, before the barrier. That memory state needs to be adjusted.
Comments
ILW = Loop predicates may use wrong memory with GC write barriers, with Shenandoah, use different GC = HLM = P3
18-10-2018