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
Mon Jun 9 06:58:52 UTC 2025


On Fri, 6 Jun 2025 09:02:53 GMT, Roland Westrelin <roland at openjdk.org> wrote:

> Thanks for the report. Should be fixed in new commit.

Thanks, the new commit (3b5b54a3) passes Oracle's tier1-tier5 testing.

> There are rare cases where C2 can't go from the `Allocate` to the `Initialize` because the IR graph doesn't match the expected pattern (some transformation introduced a region in between). In that case, `NarrowMemProj`s are not removed. That seems reasonable as there's no requirement to remove them and guaranteeing they are always removed would require a bit more code AFAICT.

I think it would be good (although not necessarily in the context of this PR) to establish the "no duplicate memory projection" invariant in the back-end, for sanity and to make sure we do not break any logic that might be implicitly relying on it. If you agree, could you file a follow-up RFE, ideally with a reproducer where the current logic fails to remove `NarrowMemProj`s?

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

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


More information about the hotspot-compiler-dev mailing list