On Thu, 4 Dec 2025 06:41:33 GMT, Quan Anh Mai <[email protected]> wrote:
>> 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 five commits:
>>
>> - whitespace
>> - fix more issues
>> - Merge branch 'lworld' into AryKlassPtrfactory
>> - Fix test failures
>> - Tighten the type system around array properties and fix related issues
>
> I have fixed the first and the third issue.
>
> The first one is because while we process a `MergeMemNode`, the IGVN can kill
> other nodes, including yet-to-process `MergeMemNode`s, just skipping dead
> nodes, then.
>
> The third one is kind of interesting. When creating a refined
> `ObjArrayKlass`, we fall back to ref array if the corresponding flat layout
> is not present, which means that if the element type is not a
> `LooselyConsistentValue`, `ValueClass::newNullRestrictedNonAtomicArray` will
> make a ref array. This seems counter-intuitive, it should have fallen back to
> a null-restricted atomic array instead. This kind of falling back also makes
> reasoning about arrays easier, as we will have fewer states to think about.
> It also makes the logic more intuitive, because it raised my eyebrows when
> `ciObjArrayKlass::make` creates a ref (and obviously atomic) array when asked
> for a non-atomic array, but a flat (and also atomic) array when asked for an
> atomic array. As a result, I think it is reasonable to adapt
> `ValueClass::newNullRestrictedNonAtomicArray` to return a null-restricted
> atomic array when the non-atomic layout is not present.
>
> Unfortunately, I have not been able to reproduce or had any clue about the
> second issue :(
Thanks for the updates @merykitty. Looks better now but I still see these:
compiler/valhalla/inlinetypes/TestLWorld.java
-XX:+UnlockDiagnosticVMOptions -XX:ForceNonTearable=*
Custom Run Test: @Run: runFlatArrayInexactLoadAndStore - @Tests:
{testFlatArrayInexactObjectStore,testFlatArrayInexactObjectLoad,testFlatArrayInexactAbstractValueClassStore,testFlatArrayInexactAbstractValueClassLoad}:
compiler.lib.ir_framework.shared.TestRunException: There was an error while
invoking @Run method static void
compiler.valhalla.inlinetypes.TestLWorld.runFlatArrayInexactLoadAndStore()
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:
compiler.valhalla.inlinetypes.TestLWorld$SubValueClassWithInt@66aaf14d but was:
compiler.valhalla.inlinetypes.TestLWorld$SubValueClassWithInt@66aaf143
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 jdk.test.lib.Asserts.assertEQ(Asserts.java:172)
at
compiler.valhalla.inlinetypes.TestLWorld.runFlatArrayInexactLoadAndStore(TestLWorld.java:4754)
at
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
... 7 more
These ones might be unrelated to your changes but I haven't seen them without:
runtime/valhalla/inlinetypes/AcmpTest.java
-XX:-UseCompressedOops -XX:+UseG1GC -XX:InitiatingHeapOccupancyPercent=0
-Xmx20m -Xmn1m -XX:G1HeapRegionSize=1m -XX:-ReduceInitialCardMarks
java.lang.OutOfMemoryError: Java heap space
at java.base/java.util.Arrays.copyOf(Arrays.java:3514)
at java.base/java.util.Arrays.copyOf(Arrays.java:3479)
at java.base/java.util.ArrayList.grow(ArrayList.java:238)
at java.base/java.util.ArrayList.grow(ArrayList.java:245)
at java.base/java.util.ArrayList.add(ArrayList.java:484)
at java.base/java.util.ArrayList.add(ArrayList.java:497)
at
runtime.valhalla.inlinetypes.AcmpTest.generateTestCases(AcmpTest.java:184)
at runtime.valhalla.inlinetypes.AcmpTest.main(AcmpTest.java:199)
at
java.base/java.lang.invoke.LambdaForm$DMH/0x0000000026080c00.invokeStatic(LambdaForm$DMH)
at
java.base/java.lang.invoke.LambdaForm$MH/0x0000000026083000.invoke(LambdaForm$MH)
at
java.base/java.lang.invoke.Invokers$Holder.invokeExact_MT(Invokers$Holder)
at
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invokeImpl(DirectMethodHandleAccessor.java:155)
at
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at
com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
at java.base/java.lang.Thread.runWith(Thread.java:1487)
at java.base/java.lang.Thread.run(Thread.java:1474)
serviceability/jvmti/valhalla/Heapwalking/ValueHeapwalkingTest.java
-Xcomp -XX:-TieredCompilation -DIgnoreCompilerControls=true
# Internal Error (workspace/open/src/hotspot/share/ci/ciMetadata.hpp:112),
pid=2968284, tid=2968304
# assert(is_inlinetype()) failed: bad cast
#
# JRE version: Java(TM) SE Runtime Environment (26.0) (fastdebug build
26-jep401ea2-2025-12-04-0955402.tobias.hartmann.valhallatesting)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug
26-jep401ea2-2025-12-04-0955402.tobias.hartmann.valhallatesting, compiled mode,
sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x74cb72] Type::inline_klass() const+0x152
Current CompileTask:
C2:12976 3041 b ValueHeapwalkingTest::createValue2Array (49 bytes)
Stack: [0x00007fcdaf6f8000,0x00007fcdaf7f8000], sp=0x00007fcdaf7f2b70, free
space=1002k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x74cb72] Type::inline_klass() const+0x152 (ciMetadata.hpp:112)
V [libjvm.so+0x1698c3d] PhaseMacroExpand::value_from_mem(Node*, Node*,
BasicType, Type const*, TypeOopPtr const*, AllocateNode*)+0x5dd (macro.cpp:548)
V [libjvm.so+0x169a1e5]
PhaseMacroExpand::inline_type_from_mem(ciInlineKlass*, TypeAryPtr const*, int,
int, bool, AllocateNode*, SafePointNode*)+0x1a5 (macro.cpp:640)
V [libjvm.so+0x169a0f3]
PhaseMacroExpand::inline_type_from_mem(ciInlineKlass*, TypeAryPtr const*, int,
int, bool, AllocateNode*, SafePointNode*)+0xb3 (macro.cpp:630)
V [libjvm.so+0x169a9a8]
PhaseMacroExpand::add_array_elems_to_safepoint(AllocateNode*, TypeAryPtr
const*, SafePointNode*, Unique_Node_List*)+0x1e8 (macro.cpp:967)
V [libjvm.so+0x169b868]
PhaseMacroExpand::create_scalarized_object_description(AllocateNode*,
SafePointNode*, Unique_Node_List*)+0x2e8 (macro.cpp:1114)
V [libjvm.so+0x169d8f6] PhaseMacroExpand::scalar_replacement(AllocateNode*,
GrowableArray<SafePointNode*>&)+0x286 (macro.cpp:1146)
V [libjvm.so+0x169e1a8]
PhaseMacroExpand::eliminate_allocate_node(AllocateNode*)+0x1c8 (macro.cpp:1405)
V [libjvm.so+0x169ee89] PhaseMacroExpand::eliminate_macro_nodes(bool)+0x7c9
(macro.cpp:3095)
V [libjvm.so+0xbe5ae4] Compile::Optimize()+0xe14 (compile.cpp:2933)
V [libjvm.so+0xbe8a35] Compile::Compile(ciEnv*, ciMethod*, int, Options,
DirectiveSet*)+0x1d95 (compile.cpp:879)
V [libjvm.so+0x9ddf70] C2Compiler::compile_method(ciEnv*, ciMethod*, int,
bool, DirectiveSet*)+0x4c0 (c2compiler.cpp:149)
V [libjvm.so+0xbf8280]
CompileBroker::invoke_compiler_on_method(CompileTask*)+0x780
(compileBroker.cpp:2345)
V [libjvm.so+0xbf9ae0] CompileBroker::compiler_thread_loop()+0x530
(compileBroker.cpp:1989)
V [libjvm.so+0x119c77b] JavaThread::thread_main_inner()+0x13b
(javaThread.cpp:777)
V [libjvm.so+0x1c7c0b6] Thread::call_run()+0xb6 (thread.cpp:242)
V [libjvm.so+0x18a2ef8] thread_native_entry(Thread*)+0x118 (os_linux.cpp:879)
Unfortunately, the failures with
`compiler/valhalla/inlinetypes/TestArrayNullMarkers.java#nAVF` also still
reproduces but only on Linux AArch64 and with `-XX:+IgnoreUnrecognizedVMOptions
-XX:-TieredCompilation -XX:-DoEscapeAnalysis -XX:+AlwaysIncrementalInline`.
Here are the replay and hs_err files, maybe they help:
[hs_err_pid1353592.log](https://github.com/user-attachments/files/23937516/hs_err_pid1353592.log)
[replay_pid1353592.log](https://github.com/user-attachments/files/23937517/replay_pid1353592.log)
-------------
PR Comment: https://git.openjdk.org/valhalla/pull/1755#issuecomment-3612785988