RFR: 8347006: LoadRangeNode floats above array guard in arraycopy intrinsic [v2]
Tobias Hartmann
thartmann at openjdk.org
Wed Jan 8 14:03:37 UTC 2025
On Wed, 8 Jan 2025 13:53:20 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:
>>> But we need to set up the `slow_region` path, right?
>>
>> By that you mean have the `slow_region` feed into the uncommon trap that's only created later. It does feel weird that we know we have reached a dead end and we keep trying to add stuff, but ok then.
>> The other thing is shouldn't the cast be added in `generate_non_array_guard()`? I see it's used elsewhere (`LibraryCallKit::inline_native_getLength()`): couldn't the same bug occur there?
>
>> By that you mean have the slow_region feed into the uncommon trap that's only created later.
>
> Right. It's a bit weird but probably still the best solution in terms of complexity. The trap will lead to recompilation and then the `too_many_traps` check will trigger.
>
>> The other thing is shouldn't the cast be added in generate_non_array_guard()? I see it's used elsewhere (LibraryCallKit::inline_native_getLength()): couldn't the same bug occur there?
>
> Right, good catch. I think the use in `LibraryCallKit::inline_native_getLength` has the same problem. We can't easily put the cast into `generate_non_array_guard` though because it operates on the Klass and not on the object. The other `generate*array*guard` methods potentially have the same issue but current uses look good. I guess it's best to fix the `LibraryCallKit::inline_native_getLength` as well, i.e., make it the caller's responsibility to add a cast. What do you think?
Hmm, maybe `inline_getObjectSize` is affected as well:
https://github.com/openjdk/jdk/blob/afe543414f58a04832d4f07dea88881d64954a0b/src/hotspot/share/opto/library_call.cpp#L8535-L8543
And `LibraryCallKit::inline_native_clone` as well:
https://github.com/openjdk/jdk/blob/afe543414f58a04832d4f07dea88881d64954a0b/src/hotspot/share/opto/library_call.cpp#L5257-L5262
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22967#discussion_r1907228186
More information about the hotspot-compiler-dev
mailing list