On Wed, 2 Dec 2026 02:14:42 GMT, xiaotaonan <[email protected]> wrote:
>> In `LoadNode::Ideal_load_common`, the code checks whether the address type >> is either an oopptr or a narrowoop, then casts it to `TypePtr` and checks >> the offset. >> >> However, a narrowoop is not a pointer: casting to `TypePtr` asserts that the >> type's base is between `AnyPtr` and `AryKlassPtr`, while `isa_narrowoop()` >> checks for `NarrowOop` base. These are mutually exclusive, so >> `isa_narrowoop()` can never be true here without triggering the cast >> assertion. >> >> Since the address of a load must be a pointer (a narrow oop would need to be >> decoded first), the `isa_narrowoop()` check is redundant and can be safely >> removed. >> >> Testing: >> - Ran `tier1` and `tier2` hotspot compiler tests. >> - Built and ran with `-XX:+UseCompressedOops` and `-XX:-UseCompressedOops` >> to exercise both oop and narrow oop paths. >> >> >> >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > xiaotaonan has updated the pull request incrementally with two additional > commits since the last revision: > > - fix: Modify according to the review comments. > - fix: Modify according to the review comments. This currently fails to build: /home/runner/work/jdk/jdk/src/hotspot/share/opto/memnode.cpp: In member function ‘Node* LoadNode::Ideal_load_common(PhaseGVN*, bool)’: /home/runner/work/jdk/jdk/src/hotspot/share/opto/memnode.cpp:2150:95: error: expected ‘)’ before ‘;’ token 2150 | phase->type(address)->as_ptr()->offset() == oopDesc::mark_offset_in_bytes(); | ^ | ) /home/runner/work/jdk/jdk/src/hotspot/share/opto/memnode.cpp:2149:20: note: to match this ‘(’ 2149 | bool addr_mark = (phase->type(address)->is_oopptr() && | ^ src/hotspot/share/opto/memnode.cpp line 2149: > 2147: Node* address = in(MemNode::Address); > 2148: > 2149: bool addr_mark = (phase->type(address)->is_oopptr() && Suggestion: bool addr_mark = phase->type(address)->is_oopptr() && ------------- Changes requested by thartmann (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/34156#pullrequestreview-6164730358 PR Review Comment: https://git.openjdk.org/jdk/pull/34156#discussion_r4780790105
