RFR: 8373591: C2: Fix the memory around some intrinsics nodes

Quan Anh Mai qamai at openjdk.org
Fri Dec 12 14:50:14 UTC 2025


On Fri, 12 Dec 2025 14:12:40 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> Hi,
>> 
>> This is extracted from #28570 , there are 2 issues here:
>> 
>> - Some intrinsics nodes advertise incorrect `adr_type`. For example, `AryEqNode` reports `adr_type` being `TypeAryPtr::BYTES` (it inherits this from `StrIntrinsicNode`). This is incorrect, however, as it can accept `char[]` inputs, too. Another case is `VectorizedHashCodeNode`, which reports its `adr_type` being `TypePtr::BOTTOM`, but it actually extracts a memory slice and does not consume the whole memory.
>> - For nodes such as `StrInflatedCopyNode`, as they consume more than they produce, during scheduling, we need to compute anti-dependencies. This is not the case, so we should fix it by making the nodes kill all the memory they consume. This issue is often not present because these intrinsics are not exposed bare to general usage.
>> 
>> Please kindly review, thanks a lot.
>
> src/hotspot/share/opto/graphKit.cpp line 4191:
> 
>> 4189:   Node* res_mem = _gvn.transform(new SCMemProjNode(_gvn.transform(str)));
>> 4190:   if (adr_type == TypePtr::BOTTOM) {
>> 4191:     set_all_memory(res_mem);
> 
> I'm confused by this. Doesn't `StrCompressedCopyNode` only write to dst? So the only part of the memory state that it updates is the one for `TypeAryPtr::BYTES`?

It is because if a node consumes more memory than it produces, we need to compute its anti-dependencies. And since we do not compute anti-dependencies of these nodes, it is safer to make them kill all the memory they consume. What do you think?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28789#discussion_r2614460937


More information about the hotspot-compiler-dev mailing list