Skip to content

Conversation

@merykitty
Copy link
Member

@merykitty merykitty commented Nov 15, 2025

Hi,

This PR splits ciObjArrayKlass into ciRefArrayKlass and ciFlatArrayKlass, aligns the hierarchy with the corresponding types of the VM.

Please kindly review, 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-8370880: [lworld] Split ciObjArrayKlass into ciRefArrayKlass and ciFlatArrayKlass (Enhancement - P2)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1739

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 15, 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 15, 2025

@merykitty This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8370880: [lworld] Split ciObjArrayKlass into ciRefArrayKlass and ciFlatArrayKlass

Reviewed-by: thartmann

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been no new commits pushed to the lworld branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the lworld branch, type /integrate in a new comment.

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

mlbridge bot commented Nov 15, 2025

Webrevs

@merykitty
Copy link
Member Author

There are still a lot of refactoring to be done regarding moving elements from ciArrayKlass to ciObjArrayKlass since now it is the new common ancestor of all arrays of objects.

Copy link
Member

@TobiHartmann TobiHartmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this, Quan-Anh! Testing looks good except for this:

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

# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/workspace/open/src/hotspot/share/ci/ciMetadata.hpp:105), pid=418142, tid=418159
#  assert(is_flat_array_klass()) failed: bad cast
#
# JRE version: Java(TM) SE Runtime Environment (26.0) (fastdebug build 26-jep401ea2-2025-11-17-0811237.tobias.hartmann.valhalla2)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-jep401ea2-2025-11-17-0811237.tobias.hartmann.valhalla2, mixed mode, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x1ca876a]  TypeAryPtr::flat_layout_helper() const+0x7a

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

Stack: [0x00007f5639cfe000,0x00007f5639dfe000],  sp=0x00007f5639df8240,  free space=1000k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x1ca876a]  TypeAryPtr::flat_layout_helper() const+0x7a  (ciMetadata.hpp:105)
V  [libjvm.so+0x102a8a9]  GraphKit::get_layout_helper(Node*, int&)+0x299  (graphKit.cpp:4100)
V  [libjvm.so+0x102cd43]  GraphKit::new_array(Node*, Node*, int, Node**, bool, Node*)+0x43  (graphKit.cpp:4345)
V  [libjvm.so+0x158b712]  LibraryCallKit::inline_newArray(bool, bool)+0x242  (library_call.cpp:4904)
V  [libjvm.so+0x15b2c6a]  LibraryIntrinsic::generate(JVMState*)+0x22a  (library_call.cpp:130)
V  [libjvm.so+0xdbc50f]  Parse::do_call()+0xebf  (doCall.cpp:771)
V  [libjvm.so+0x18fee88]  Parse::do_one_bytecode()+0x4c8  (parse2.cpp:3526)
V  [libjvm.so+0x18e6007]  Parse::do_one_block()+0x357  (parse1.cpp:1703)
V  [libjvm.so+0x18e7300]  Parse::do_all_blocks()+0x130  (parse1.cpp:760)
V  [libjvm.so+0x18eae81]  Parse::Parse(JVMState*, ciMethod*, float)+0xea1  (parse1.cpp:664)
V  [libjvm.so+0x9e1975]  ParseGenerator::generate(JVMState*)+0x135  (callGenerator.cpp:99)
V  [libjvm.so+0x9e6ba3]  CallGenerator::do_late_inline_helper()+0xa03  (callGenerator.cpp:751)
V  [libjvm.so+0xbdc968]  Compile::inline_incrementally_one()+0x1b8  (compile.cpp:2614)
V  [libjvm.so+0xbde0ab]  Compile::inline_incrementally(PhaseIterGVN&)+0x38b  (compile.cpp:2707)
V  [libjvm.so+0xbe0c9e]  Compile::Optimize()+0x47e  (compile.cpp:2843)
V  [libjvm.so+0xbe45c5]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1da5  (compile.cpp:879)
V  [libjvm.so+0x9de490]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x4e0  (c2compiler.cpp:149)
V  [libjvm.so+0xbf3e20]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x780  (compileBroker.cpp:2345)
V  [libjvm.so+0xbf5680]  CompileBroker::compiler_thread_loop()+0x530  (compileBroker.cpp:1989)
V  [libjvm.so+0x118d15b]  JavaThread::thread_main_inner()+0x13b  (javaThread.cpp:772)
V  [libjvm.so+0x1c68ee6]  Thread::call_run()+0xb6  (thread.cpp:243)
V  [libjvm.so+0x1893bc8]  thread_native_entry(Thread*)+0x128  (os_linux.cpp:883)

@merykitty
Copy link
Member Author

merykitty commented Nov 17, 2025

Thanks for your testing. Unfortunately, the issue cuts pretty deep. We have multiple potential inconsistencies when dealing with _klass such as when trying to obtain a flat TypeAryPtr from a non-flat TypeAryPtr. I think it can be addressed as follow-up issues. To fix the immediate crash, I choose to fix a particular issue, that is we can only compute the _klass if we have klass_is_exact.

@merykitty
Copy link
Member Author

Too bad it seems pretty hard to walk on the thin line right now. I think it is better to tighten the type system around arrays first.

@merykitty merykitty marked this pull request as draft November 17, 2025 16:34
@openjdk openjdk bot removed the rfr Pull request is ready for review label Nov 17, 2025
@TobiHartmann
Copy link
Member

Right, I think so too, the latest version hits more issues :(

@openjdk
Copy link

openjdk bot commented Dec 18, 2025

@merykitty this pull request can not be integrated into lworld due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout ciRefArray
git fetch https://git.openjdk.org/valhalla.git lworld
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge lworld"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Dec 18, 2025
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Dec 18, 2025
@merykitty merykitty marked this pull request as ready for review December 19, 2025 03:06
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 19, 2025
@merykitty
Copy link
Member Author

I think this PR is ready for review again.

Copy link
Member

@TobiHartmann TobiHartmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me otherwise. Thanks!

}
_is_ptr_to_narrowoop = UseCompressedOops && ::is_reference_type(field_bt);
} else if (klass()->is_obj_array_klass()) {
_is_ptr_to_narrowoop = UseCompressedOops;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UseCompressedOops is always true here, right? It's checked in line 3685. Also above.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I have removed those check.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 5, 2026
Copy link
Member

@TobiHartmann TobiHartmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good!

@merykitty
Copy link
Member Author

Thanks a lot for your reviews!

/integrate

@openjdk
Copy link

openjdk bot commented Jan 6, 2026

Going to push as commit 9aff0ae.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 6, 2026
@openjdk openjdk bot closed this Jan 6, 2026
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 6, 2026
@openjdk
Copy link

openjdk bot commented Jan 6, 2026

@merykitty Pushed as commit 9aff0ae.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

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

Labels

integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

2 participants