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

Per Minborg pminborg at openjdk.org
Mon Aug 7 09:33:51 UTC 2023


On Mon, 7 Aug 2023 09:18:41 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Per Minborg has updated the pull request incrementally with three additional commits since the last revision:
>> 
>>  - Remove redundant check
>>  - Use strnlen
>>  - Improve exception handling
>
> 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.

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

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


More information about the panama-dev mailing list