Skip to content

Conversation

@merykitty
Copy link
Member

@merykitty merykitty commented Nov 21, 2025

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.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (1 review required, with at least 1 Committer)

Issue

  • JDK-8372113: [lworld] Fix various issues with TypeAryPtr and TypeAryKlassPtr (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/1755/head:pull/1755
$ git checkout pull/1755

Update a local copy of the PR:
$ git checkout pull/1755
$ git pull https://git.openjdk.org/valhalla.git pull/1755/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1755

View PR using the GUI difftool:
$ git pr show -t 1755

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1755.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 21, 2025

👋 Welcome back qamai! A progress list of the required criteria for merging this PR into lworld will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Nov 21, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 21, 2025
@mlbridge
Copy link

mlbridge bot commented Nov 21, 2025

Webrevs

@TobiHartmann
Copy link
Member

Thanks for working on this!

Unfortunately, it triggers a lot of failures in testing. Here's a few, I can provide more details next week.

compiler/c2/TestMergeStores.java#id0
-ea -esa -XX:CompileThreshold=100 -XX:+UnlockExperimentalVMOptions -server -XX:+TieredCompilation

#  Error: assert(klass_is_exact()) failed

Current CompileTask:
C2:6719 1466    b  4       compiler.c2.TestMergeStores::test600a (165 bytes)

Stack: [0x00007f992c11b000,0x00007f992c21b000],  sp=0x00007f992c216b40,  free space=1006k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xbc272a]  Compile::flatten_alias_type(TypePtr const*) const+0xeba  (type.hpp:1467)
V  [libjvm.so+0xbc2f5c]  Compile::find_alias_type(TypePtr const*, bool, ciField*, bool) [clone .part.0]+0x8c  (compile.cpp:1677)
V  [libjvm.so+0x1590623]  LibraryCallKit::inline_unsafe_access(bool, BasicType, LibraryCallKit::AccessKind, bool, bool)+0x9e3  (compile.hpp:1005)
V  [libjvm.so+0x15c211a]  LibraryIntrinsic::generate(JVMState*)+0x22a  (library_call.cpp:130)
V  [libjvm.so+0xdc5f4f]  Parse::do_call()+0xebf  (doCall.cpp:771)
V  [libjvm.so+0x190ded8]  Parse::do_one_bytecode()+0x458  (parse2.cpp:3526)
V  [libjvm.so+0x18f4f9c]  Parse::do_one_block()+0x24c  (parse1.cpp:1713)
V  [libjvm.so+0x18f63a0]  Parse::do_all_blocks()+0x130  (parse1.cpp:770)
V  [libjvm.so+0x18f9f01]  Parse::Parse(JVMState*, ciMethod*, float)+0xea1  (parse1.cpp:674)
V  [libjvm.so+0x9e1205]  ParseGenerator::generate(JVMState*)+0x135  (callGenerator.cpp:99)
V  [libjvm.so+0xbe7ee3]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x15e3  (compile.cpp:824)
V  [libjvm.so+0x9ddd30]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x4c0  (c2compiler.cpp:149)
V  [libjvm.so+0xbf7f40]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x780  (compileBroker.cpp:2345)
V  [libjvm.so+0xbf97a0]  CompileBroker::compiler_thread_loop()+0x530  (compileBroker.cpp:1989)
V  [libjvm.so+0x119c49b]  JavaThread::thread_main_inner()+0x13b  (javaThread.cpp:777)
V  [libjvm.so+0x1c7c0b6]  Thread::call_run()+0xb6  (thread.cpp:242)
V  [libjvm.so+0x18a2a78]  thread_native_entry(Thread*)+0x118  (os_linux.cpp:879)
compiler/codegen/TestRedundantLea.java#StoreNParallel
-XX:UseAVX=0 -XX:UseSSE=3

Multiple IR failures
compiler/valhalla/inlinetypes/TestArrays.java
-Xcomp -XX:-TieredCompilation -DIgnoreCompilerControls=true


#  assert(_base >= KlassPtr && _base <= AryKlassPtr) failed: Not a klass pointer
#
# JRE version: Java(TM) SE Runtime Environment (26.0) (fastdebug build 26-jep401ea2-2025-11-21-1039511.tobias.hartmann.valhalla2)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-jep401ea2-2025-11-21-1039511.tobias.hartmann.valhalla2, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x15a40b7]  LibraryCallKit::inline_arraycopy()+0x1337
compiler/valhalla/inlinetypes/TestIntrinsics.java#id2
-XX:Tier0BackedgeNotifyFreqLog=0 -XX:Tier2BackedgeNotifyFreqLog=0 -XX:Tier3BackedgeNotifyFreqLog=0 -XX:Tier2BackEdgeThreshold=1 -XX:Tier3BackEdgeThreshold=1 -XX:Tier4BackEdgeThreshold=1 -XX:CompileCommand=MemLimit,*.*,0 -Xbatch

#  assert(UseArrayFlattening && is_reference_type(bt) && element_ptr->can_be_inline_type() && (!element_ptr->is_inlinetypeptr() || element_ptr->inline_klass()->maybe_flat_in_array())) failed: array can't be flat
#
# JRE version: Java(TM) SE Runtime Environment (26.0) (fastdebug build 26-jep401ea2-2025-11-21-1039511.tobias.hartmann.valhalla2)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-jep401ea2-2025-11-21-1039511.tobias.hartmann.valhalla2, mixed mode, tiered, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x18fe2ba]  Parse::array_load(BasicType)+0x14a

@merykitty
Copy link
Member Author

@TobiHartmann Thanks a lot, I have fixed the failure you mentioned here. It also seems to reveal an issue with C2 alias analysis.

@TobiHartmann
Copy link
Member

TobiHartmann commented Nov 24, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants