RFR: 8271600: C2: CheckCastPP which should closely follow Allocate is sunk of a loop [v2]

Vladimir Ivanov vlivanov at openjdk.java.net
Mon Aug 23 13:16:49 UTC 2021


> `PhaseIdealLoop::try_sink_out_of_loop()` tries to move nodes outside a loop. It doesn't work well for cast nodes which accompany `Allocate` nodes:  the cast reifies the effect instance initialization and turns a raw pointer into an oop. Once the cast node doesn't immediately follow the corresponding `Initialize`, it creates a window where the raw pointer is observed. And it can become so wide that the raw pointer crosses a safepoint and has to be recorded in the oop map (that's the case when the reported assertion failure happens). 
> 
> Proposed fix is to keep such cast nodes intact. Moreover, I propose to disable the optimization for all flavors of cast nodes. 
> Cast nodes usually accompany runtime checks and I don't see much benefit in moving the cast node away while leaving the runtime check inside the loop.  
> 
> Testing: hs-tier1 - hs-tier6

Vladimir Ivanov has updated the pull request incrementally with one additional commit since the last revision:

  Limit the fix to raw-to-oop casts only.

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/5199/files
  - new: https://git.openjdk.java.net/jdk/pull/5199/files/4081f893..f863f8d2

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=5199&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=5199&range=00-01

  Stats: 4 lines in 1 file changed: 3 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5199.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5199/head:pull/5199

PR: https://git.openjdk.java.net/jdk/pull/5199


More information about the hotspot-compiler-dev mailing list