RFR: 8327963: C2: fix construction of memory graph around Initialize node to prevent incorrect execution if allocation is removed [v8]

Roberto Castañeda Lozano rcastanedalo at openjdk.org
Wed Sep 10 08:31:48 UTC 2025


On Fri, 11 Jul 2025 18:20:19 GMT, John R Rose <jrose at openjdk.org> wrote:

> Specifically, if we are using narrow memory projections sometimes, we should be prepared to respect them always.

@rose00 I fully agree with your general argument, but note that my request refers to avoiding redundant MachProj memory projections arising after matching narrow memory projections (such as nodes 56-39 in B6 in the following CFG: https://github.com/user-attachments/files/20477560/after-gcm.pdf), not narrow memory projections per se. I do not see any use in allowing redundant MachProj memory projections in the IR, while due to their ambiguity they increase the risk of introducing new bugs or unveiling latent bugs, e.g. in anti-dependency analysis. So I am happy that Roland has found a cheap way to prevent them from ever appearing in the IR.

> @rose00 @robcasloz I updated the change with a new way to avoid redundant projections. At matching time, before a `NarrowMemProj` is matched into a `MachProj`, new logic checks whether a `MachProj` already exists. That guarantees that no redundant `MachProj` are ever added. It also performs the new normalization at a major cut-point. What do you think?

That sounds good to me, thank you for enforcing this Roland! I will re-run testing and have a new look at the changeset within the next days.

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

PR Comment: https://git.openjdk.org/jdk/pull/24570#issuecomment-3273887804
PR Comment: https://git.openjdk.org/jdk/pull/24570#issuecomment-3273891349


More information about the hotspot-compiler-dev mailing list