RFR: 8347006: LoadRangeNode floats above array guard in arraycopy intrinsic [v2]
Roland Westrelin
roland at openjdk.org
Wed Jan 8 14:16:37 UTC 2025
On Wed, 8 Jan 2025 13:59:00 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:
>>> 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
> 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?
Maybe the methods need to take an extra parameter (the object to cast)?
Having the cast in the method would lead to less code duplication and a lower risk of forgetting the cast when new calls of the method are added so that's what I would go with unless it's really a pain.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22967#discussion_r1907249957
More information about the hotspot-compiler-dev
mailing list