On Tue, 22 Apr 2025 08:03:19 GMT, Viktor Klang <vkl...@openjdk.org> wrote:

>> Chen Liang has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Simplify FFM linker warmup
>
> src/java.base/share/classes/jdk/internal/foreign/abi/AbstractLinker.java line 
> 78:
> 
>> 76:         @Override
>> 77:         public boolean equals(Object obj) {
>> 78:             return obj instanceof LinkRequest other &&
> 
> Might be worth checking `obj == this || obj instanceof ...`

No. We are always using `new LinkRequest` so this "fast path" will 100% miss.

> src/java.base/share/classes/jdk/internal/foreign/abi/NativeEntryPoint.java 
> line 56:
> 
>> 54:         public boolean equals(Object o) {
>> 55:             if (!(o instanceof CacheKey other)) return false;
>> 56: 
> 
> Might be worth checking `o == this`

Always used with `new CacheKey` in `NativeEntryPoint.make`, no benefit too.

> src/java.base/share/classes/jdk/internal/foreign/abi/VMStorage.java line 55:
> 
>> 53:     @Override
>> 54:     public boolean equals(Object obj) {
>> 55:         return obj instanceof VMStorage that &&
> 
> Might be worth checking `obj == this || obj instanceof ...`

This one seems created each time when a particular downcall function shape is 
requested too; so no point of identity checks either.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24742#discussion_r2054294141
PR Review Comment: https://git.openjdk.org/jdk/pull/24742#discussion_r2054300716
PR Review Comment: https://git.openjdk.org/jdk/pull/24742#discussion_r2054299075

Reply via email to