On Wed, 19 Nov 2025 12:30:00 GMT, ExE Boss <[email protected]> wrote:

>> Harald Eilertsen has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   use suggested solution by bsdkurt
>
> src/java.base/share/classes/jdk/internal/foreign/SegmentFactories.java line 
> 215:
> 
>> 213:             result = Utils.alignUp(allocationBase, byteAlignment);
>> 214:         } else {
>> 215:             allocationSize = (alignedSize < byteAlignment) ? 
>> byteAlignment : alignedSize;
> 
> This can probably use [`Math​::max​(long, long)`], which is an intrinsic[^1].
> Suggestion:
> 
>             allocationSize = Math.max(alignedSize, byteAlignment);
> 
> 
> [^1]: For whatever reason, [`StrictMath​::max​(long, long)`] is the only 
> overload which doesn’t have `@IntrinsicCandidate`, even though it’s just a 
> simple call to `Math​::max​(long, long)`, and so gets intrisified anyway 
> after inlining; same with [`StrictMath​::min​(long, long)`] and 
> [`Math​::min​(long, long)`].
> 
> [`Math​::max​(long, long)`]: 
> https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Math.html#max%28long%2Clong%29
> [`Math​::min​(long, long)`]: 
> https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Math.html#min%28long%2Clong%29
> [`StrictMath​::max​(long, long)`]: 
> https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/StrictMath.html#max%28long%2Clong%29
> [`StrictMath​::min​(long, long)`]: 
> https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/StrictMath.html#min%28long%2Clong%29

That makes sense, thanks!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28235#discussion_r2542003220

Reply via email to