RFR: 8344116: C2: remove slice parameter from LoadNode::make [v13]

Zihao Lin duke at openjdk.org
Fri Nov 28 08:57:53 UTC 2025


On Fri, 28 Nov 2025 08:47:13 GMT, Zihao Lin <duke at openjdk.org> wrote:

>> src/hotspot/share/opto/escape.cpp line 4488:
>> 
>>> 4486:           const TypePtr* adr_type = proj->adr_type();
>>> 4487:           const TypePtr* new_adr_type = tinst->add_offset(adr_type->offset());
>>> 4488:           if (adr_type != new_adr_type) {
>> 
>> Can you explain that change? Did something go wrong in a merge?
>
> Here is a assert failed
> 
> command: main -XX:CompileCommand=dontinline,compiler.arraycopy.TestArrayCopyMemoryChain::test* -Xbatch compiler.arraycopy.TestArrayCopyMemoryChain
> reason: User specified action: run main/othervm -XX:CompileCommand=dontinline,compiler.arraycopy.TestArrayCopyMemoryChain::test* -Xbatch compiler.arraycopy.TestArrayCopyMemoryChain 
> started: Fri Nov 28 16:36:37.189 CST 2025
> Mode: othervm [/othervm specified]
> Process id: 16782
> finished: Fri Nov 28 16:36:37.350 CST 2025
> elapsed time (seconds): 0.161
> configuration:
> STDOUT:
> CompileCommand: dontinline compiler/arraycopy/TestArrayCopyMemoryChain.test* bool dontinline = true
> #
> # A fatal error has been detected by the Java Runtime Environment:
> #
> #  Internal Error (/Users/linzihao/Desktop/jdk-dev/src/hotspot/share/opto/escape.cpp:4184), pid=16782, tid=26115
> #  assert(result != nullptr) failed: new projection should have been allocated
> #
> # JRE version: OpenJDK Runtime Environment (26.0) (fastdebug build 26-internal-adhoc.linzihao.jdk-dev)
> # Java VM: OpenJDK 64-Bit Server VM (fastdebug 26-internal-adhoc.linzihao.jdk-dev, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
> # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
> #
> # An error report file with more information is saved as:
> # /Users/linzihao/Desktop/jdk-dev/build/macosx-aarch64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_compiler_arraycopy_TestArrayCopyMemoryChain_java/scratch/0/hs_err_pid16782.log
> #
> # Compiler replay data is saved as:
> # /Users/linzihao/Desktop/jdk-dev/build/macosx-aarch64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_compiler_arraycopy_TestArrayCopyMemoryChain_java/scratch/0/replay_pid16782.log
> #
> # If you would like to submit a bug report, please visit:
> #   https://bugreport.java.com/bugreport/crash.jsp
> #

The assert failed because `find_inst_mem()` skipped an Initialize memory projection whose `adr_type` was still the general slice, then tried to fetch the instance-specific projection from `_node_map` and got nullptr. That happens when a precise `NarrowMemProj` already exists: the code doesn’t create a new one and also never records the mapping, so later lookup fails.

The fix records the mapping even if the precise `NarrowMemProj` is already present (not newly created).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24258#discussion_r2570873232


More information about the hotspot-dev mailing list