[lworld] RFR: 8372113: [lworld] Fix various issues with TypeAryPtr and TypeAryKlassPtr [v2]

Tobias Hartmann thartmann at openjdk.org
Mon Nov 24 15:36:18 UTC 2025


On Sun, 23 Nov 2025 08:40:09 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> Hi,
>> 
>> This PR fixes various issues with `TypeAryPtr` and `TypeAryKlassPtr`. It starts with me trying to tighten the properties (`flat`, `null_free`, etc) of these classes, then fixing all the revealed issues until there are no crashes or wrong results left.
>> 
>> Please take a look and leave your reviews, thanks a lot.
>
> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix test failures

Thanks for fixing these issues. I see a few more:

compiler/valhalla/inlinetypes/TestArrays.java#id3
-XX:+UseSerialGC

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f467ff3db95, pid=220856, tid=220868
#
# JRE version: Java(TM) SE Runtime Environment (26.0) (fastdebug build 26-jep401ea2-2025-11-24-0633401.tobias.hartmann.valhalla2)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-jep401ea2-2025-11-24-0633401.tobias.hartmann.valhalla2, mixed mode, tiered, compressed oops, compressed class ptrs, serial gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x74cb95]  Node::is_top() const+0x75

Current CompileTask:
C2:23916 1769    b  4       compiler.valhalla.inlinetypes.TestArrays::test132 (14 bytes)

Stack: [0x00007f467e262000,0x00007f467e362000],  sp=0x00007f467e35cdf0,  free space=1003k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x74cb95]  Node::is_top() const+0x75  (node.hpp:512)
V  [libjvm.so+0x175e4e2]  MergeMemNode::memory_at(unsigned int) const+0xa2  (memnode.hpp:1499)
V  [libjvm.so+0xbd81ea]  Compile::adjust_flat_array_access_aliases(PhaseIterGVN&) [clone .part.0]+0xa9a  (compile.cpp:2177)
V  [libjvm.so+0xbe4f9f]  Compile::Optimize()+0x5cf  (compile.cpp:2092)
V  [libjvm.so+0xbe8755]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1d95  (compile.cpp:879)
V  [libjvm.so+0x9ddd30]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x4c0  (c2compiler.cpp:149)
V  [libjvm.so+0xbf8000]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x780  (compileBroker.cpp:2345)
V  [libjvm.so+0xbf9860]  CompileBroker::compiler_thread_loop()+0x530  (compileBroker.cpp:1989)
V  [libjvm.so+0x119c55b]  JavaThread::thread_main_inner()+0x13b  (javaThread.cpp:777)
V  [libjvm.so+0x1c7c176]  Thread::call_run()+0xb6  (thread.cpp:242)
V  [libjvm.so+0x18a2b38]  thread_native_entry(Thread*)+0x118  (os_linux.cpp:879)



compiler/valhalla/inlinetypes/TestArrayNullMarkers.java
-XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-DoEscapeAnalysis -XX:+AlwaysIncrementalInline

Seems to only fail on AArch64.

# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/workspace/open/src/hotspot/share/opto/cfgnode.cpp:2176), pid=194975, tid=194996
#  assert(input->adr_type() == TypePtr::BOTTOM) failed: should only visit bottom memory
#
# JRE version: Java(TM) SE Runtime Environment (26.0) (fastdebug build 26-jep401ea2-2025-11-24-0633401.tobias.hartmann.valhalla2)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-jep401ea2-2025-11-24-0633401.tobias.hartmann.valhalla2, mixed mode, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
# Problematic frame:
# V  [libjvm.so+0x879bf0]  PhiNode::is_split_through_mergemem_terminating() const::{lambda(Node*)#1}::operator()(Node*) const [clone .part.0]+0x30

Current CompileTask:
C2:10437  378 % !b        compiler.valhalla.inlinetypes.TestArrayNullMarkers::main @ 698 (2967 bytes)

Stack: [0x0000ffff7832f000,0x0000ffff7852d000],  sp=0x0000ffff78527680,  free space=2017k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x879bf0]  PhiNode::is_split_through_mergemem_terminating() const::{lambda(Node*)#1}::operator()(Node*) const [clone .part.0]+0x30  (cfgnode.cpp:2176)
V  [libjvm.so+0x8889b0]  PhiNode::is_split_through_mergemem_terminating() const+0x388  (cfgnode.cpp:2176)
V  [libjvm.so+0x88c80c]  PhiNode::Ideal(PhaseGVN*, bool)+0x2de0  (cfgnode.cpp:2581)
V  [libjvm.so+0x1671838]  PhaseIterGVN::transform_old(Node*)+0xe8  (phaseX.cpp:668)
V  [libjvm.so+0x1675b7c]  PhaseIterGVN::optimize()+0xdc  (phaseX.cpp:1054)
V  [libjvm.so+0x140bcf0]  PhaseMacroExpand::eliminate_macro_nodes(bool)+0x164  (macro.cpp:3154)
V  [libjvm.so+0xa11630]  Compile::Optimize()+0xe68  (compile.cpp:3039)
V  [libjvm.so+0xa13788]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1548  (compile.cpp:879)
V  [libjvm.so+0x81b7a4]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x2e0  (c2compiler.cpp:149)
V  [libjvm.so+0xa2268c]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xb08  (compileBroker.cpp:2345)
V  [libjvm.so+0xa235b8]  CompileBroker::compiler_thread_loop()+0x638  (compileBroker.cpp:1989)
V  [libjvm.so+0xf64668]  JavaThread::thread_main_inner()+0x108  (javaThread.cpp:777)
V  [libjvm.so+0x193b59c]  Thread::call_run()+0xac  (thread.cpp:242)
V  [libjvm.so+0x15dc4ec]  thread_native_entry(Thread*)+0x11c  (os_linux.cpp:879)
C  [libc.so.6+0x80b50]  start_thread+0x300



compiler/valhalla/inlinetypes/TestIntrinsics.java
-XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation -XX:+StressArrayCopyMacroNode -XX:+StressCallingConvention -XX:+StressLCM -XX:+StressGCM -XX:+StressCCP -XX:+StressIGVN -XX:+StressReflectiveCode -XX:+StressMethodHandleLinkerInlining -XX:+StressCompiledExceptionHandlers -XX:MaxNodeLimit=100000

Custom Run Test: @Run: test92_verifier - @Test: test92:
compiler.lib.ir_framework.shared.TestRunException: There was an error while invoking @Run method public void compiler.valhalla.inlinetypes.TestIntrinsics.test92_verifier()
	at compiler.lib.ir_framework.test.CustomRunTest.invokeTest(CustomRunTest.java:162)
	at compiler.lib.ir_framework.test.AbstractTest.run(AbstractTest.java:105)
	at compiler.lib.ir_framework.test.CustomRunTest.run(CustomRunTest.java:89)
	at compiler.lib.ir_framework.test.TestVM.runTests(TestVM.java:869)
	at compiler.lib.ir_framework.test.TestVM.start(TestVM.java:256)
	at compiler.lib.ir_framework.test.TestVM.main(TestVM.java:169)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
	at compiler.lib.ir_framework.test.CustomRunTest.invokeTest(CustomRunTest.java:159)
	... 5 more
Caused by: java.lang.RuntimeException: assertEquals expected: 2 but was: 4
	at jdk.test.lib.Asserts.fail(Asserts.java:715)
	at jdk.test.lib.Asserts.assertEquals(Asserts.java:208)
	at jdk.test.lib.Asserts.assertEquals(Asserts.java:195)
	at compiler.valhalla.inlinetypes.TestIntrinsics.test92_verifier(TestIntrinsics.java:2102)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	... 7 more

Custom Run Test: @Run: test94_verifier - @Test: test94:
compiler.lib.ir_framework.shared.TestRunException: There was an error while invoking @Run method public void compiler.valhalla.inlinetypes.TestIntrinsics.test94_verifier()
	at compiler.lib.ir_framework.test.CustomRunTest.invokeTest(CustomRunTest.java:162)
	at compiler.lib.ir_framework.test.AbstractTest.run(AbstractTest.java:105)
	at compiler.lib.ir_framework.test.CustomRunTest.run(CustomRunTest.java:89)
	at compiler.lib.ir_framework.test.TestVM.runTests(TestVM.java:869)
	at compiler.lib.ir_framework.test.TestVM.start(TestVM.java:256)
	at compiler.lib.ir_framework.test.TestVM.main(TestVM.java:169)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
	at compiler.lib.ir_framework.test.CustomRunTest.invokeTest(CustomRunTest.java:159)
	... 5 more
Caused by: java.lang.RuntimeException: assertEquals expected: 3 but was: 0
	at jdk.test.lib.Asserts.fail(Asserts.java:715)
	at jdk.test.lib.Asserts.assertEquals(Asserts.java:208)
	at jdk.test.lib.Asserts.assertEquals(Asserts.java:195)
	at compiler.valhalla.inlinetypes.TestIntrinsics.test94_verifier(TestIntrinsics.java:2128)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	... 7 more

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

PR Comment: https://git.openjdk.org/valhalla/pull/1755#issuecomment-3571412852


More information about the valhalla-dev mailing list