[lworld] RFR: 8364191: [lworld] Accesses to atomic flat fields prevent scalar replacement [v4]

Tobias Hartmann thartmann at openjdk.org
Mon Oct 20 08:10:40 UTC 2025


On Sat, 18 Oct 2025 19:31:20 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> Hi,
>> 
>> Flat accesses prevent scalar replacement because they are mismatched accesses. It is also generally not possible to look through them, because the payload may contain an oop in the form of raw bits. As a result, this PR adds `LoadFlatNode` and `StoreFlatNode`, which act as high-level abstractions for atomic accesses on flat fields. When it is determined that there is no racing access on the flat field (e.g. because the holder object does not escape), these flat access nodes can be expanded into multiple accesses to each flattened fields, otherwise, they will be expanded into a sequence of inferring a payload and accessing memory with that payload.
>> 
>> I also fix an issue with deoptimization reallocation where we miss assigning the null marker of elements in a nullable flat array.
>> 
>> Please take a look and leave your reviews, thanks a lot.
>
> Quan Anh Mai has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains eight commits:
> 
>  - Several fixes
>  - fix gc barrier
>  - Merge branch 'lworld' into flatfield
>  - fix merge, assert GC barriers
>  - Merge branch 'lworld' into flatfield
>  - fix release build
>  - small fix StoreFlatNode::size_of
>  - add LoadFlatNode and StoreFlatNode

I did some quick testing and I'm seeing this failure:


runtime/valhalla/inlinetypes/verifier/RedefineStrictFieldsTest.java
-Xcomp -XX:-TieredCompilation

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f195cbd8da5, pid=1416875, tid=1416894
#
# JRE version: Java(TM) SE Runtime Environment (26.0) (fastdebug build 26-jep401ea2-2025-10-20-0458161.tobias.hartmann.valhalla2)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-jep401ea2-2025-10-20-0458161.tobias.hartmann.valhalla2, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xdcada5]  ConnectionGraph::has_ea_local_in_scope(SafePointNode*)+0x115

Current CompileTask:
C2:7013 1605    b        java.lang.VersionProps::parseVersionNumbers (154 bytes)

Stack: [0x00007f1948721000,0x00007f1948821000],  sp=0x00007f194881ba70,  free space=1002k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xdcada5]  ConnectionGraph::has_ea_local_in_scope(SafePointNode*)+0x115  (callnode.hpp:383)
V  [libjvm.so+0xde6e68]  ConnectionGraph::compute_escape()+0x2e88  (escape.cpp:469)
V  [libjvm.so+0xde734a]  ConnectionGraph::do_analysis(Compile*, PhaseIterGVN*)+0x15a  (escape.cpp:120)
V  [libjvm.so+0xbcbe4d]  Compile::Optimize()+0x65d  (compile.cpp:2942)
V  [libjvm.so+0xbcf86f]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x207f  (compile.cpp:878)
V  [libjvm.so+0x9dc0b3]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x483  (c2compiler.cpp:149)
V  [libjvm.so+0xbdee38]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xb48  (compileBroker.cpp:2345)
V  [libjvm.so+0xbdffc0]  CompileBroker::compiler_thread_loop()+0x530  (compileBroker.cpp:1989)
V  [libjvm.so+0x11701db]  JavaThread::thread_main_inner()+0x13b  (javaThread.cpp:776)
V  [libjvm.so+0x1c23c56]  Thread::call_run()+0xb6  (thread.cpp:243)
V  [libjvm.so+0x185eb58]  thread_native_entry(Thread*)+0x128  (os_linux.cpp:898)


The `serviceability/jvmti/valhalla/` tests also fail with the same SIGSEGV when executed with `-Xcomp -XX:-TieredCompilation`.

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

PR Comment: https://git.openjdk.org/valhalla/pull/1518#issuecomment-3420985354


More information about the valhalla-dev mailing list