[foreign-memaccess+abi] RFR: 8313238: Improve the performance of strlen for null-terminated strings [v2]

Jorn Vernee jvernee at openjdk.org
Mon Aug 7 09:36:53 UTC 2023


On Mon, 7 Aug 2023 09:30:50 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/foreign/StringSupport.java line 137:
>> 
>>> 135:                     // to a Java method. It is possible to use a reduction of several STRNLEN invocations
>>> 136:                     // in a future optimization.
>>> 137:                     len = strlen_byte(segment);
>> 
>> Can't we just always throw here? `len` is not allowed to be larger than an `int` any ways.
>
> It might be the case that we have a very large segment but there is a zero byte early in the segment.

Ok, thanks. That makes sense.

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

PR Review Comment: https://git.openjdk.org/panama-foreign/pull/857#discussion_r1285622027


More information about the panama-dev mailing list