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

Roland Westrelin roland at openjdk.org
Wed Jun 4 09:26:20 UTC 2025


On Wed, 28 May 2025 07:34:36 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:

> In the common case where allocations are not eliminated, matching transforms the introduced `NarrowMemProj` nodes into a sequence of redundant, raw `MemProj` nodes, see e.g. B6 here: [after-gcm.pdf](https://github.com/user-attachments/files/20477560/after-gcm.pdf). Would it be possible to clean them up during matching (or perhaps already during, or right after, macro expansion)?

Thanks for looking at this @robcasloz 
I made the change you requested.

> src/hotspot/share/opto/multnode.cpp line 49:
> 
>> 47:   assert((Opcode() != Op_If && Opcode() != Op_RangeCheck) || which_proj == (uint)true || which_proj == (uint)false, "must be 1 or 0");
>> 48:   assert(number_of_projs(which_proj) <= 1, "only when there's a single projection");
>> 49:   auto find_proj = [which_proj, this](ProjNode* proj) {
> 
> This does not build on macosx-aarch64:
> 
> 
> src/hotspot/share/opto/multnode.cpp:49:21: error: lambda capture 'which_proj' is not used [-Werror,-Wunused-lambda-capture]
>    auto find_proj = [which_proj, this](ProjNode* proj) {

Thanks for the report. This should be fixed now.

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

PR Comment: https://git.openjdk.org/jdk/pull/24570#issuecomment-2939277421
PR Review Comment: https://git.openjdk.org/jdk/pull/24570#discussion_r2126123810


More information about the hotspot-compiler-dev mailing list