On Tue, 25 Nov 2025 14:00:58 GMT, Maurizio Cimadamore <[email protected]> 
wrote:

>> Liam Miller-Cushon has updated the pull request incrementally with two 
>> additional commits since the last revision:
>> 
>>  - Update discussion of truncated reads of strings containing \0
>>  - Return the number of copied bytes
>
> src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 2669:
> 
>> 2667:      * @throws IllegalArgumentException if {@code dst} is {@linkplain 
>> #isReadOnly() read-only}
>> 2668:      * @throws IndexOutOfBoundsException if {@code dstOffset > 
>> dstSegment.byteSize() - B} where {@code B} is the size,
>> 2669:      *         in bytes, of the string encoded using the given charset.
> 
> Nit pick: this says "the size... of the string... encoded..."... which 
> string? It might suggest we're talking about `src`, but in reality we're 
> talking about a *substring* of `src`

Thanks, rephrased as "substring of {@code src}"

> test/micro/org/openjdk/bench/java/lang/foreign/FromJavaStringTest.java line 
> 71:
> 
>> 69: 
>> 70:     @Benchmark
>> 71:     public void panama_setString() {
> 
> I'd suggest to maybe avoid "panama" here and in the other benchmark. Maybe:
> * segment_setString
> * segment_copyStringRaw
> * segment_copyStringBytes

Done

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28043#discussion_r2561037226
PR Review Comment: https://git.openjdk.org/jdk/pull/28043#discussion_r2561086681

Reply via email to