RFR: 8181147: JNI_GetStringPlatformChars should have a fast path for UTF-8

Claes Redestad claes.redestad at oracle.com
Fri May 26 18:16:17 UTC 2017


On 2017-05-26 20:07, Aleksey Shipilev wrote:
> On 05/26/2017 07:58 PM, Claes Redestad wrote:
>> However, UTF-8 is missing, which is a shame since we have optimized
>> utilities for converting from a String to UTF-8-encoded char* (since
>> this is the native encoding used by HotSpot internally).
>>
>> Webrev: http://cr.openjdk.java.net/~redestad/8181147/jdk.00/
> This looks okay to me, except:
>
> *) Don't you miss "result[len] = 0;" at the end of getStringUTF8()?

I think we're covered:

GetStringUTFRegion meanders into UNICODE::as_utf8 in
vm/utilities/utf8.cpp, which does the equivalent of setting
result[len] = 0 by means of doing  *p = '\0'; after the loop.

Thanks!

/Claes

>
> -Aleksey
>



More information about the core-libs-dev mailing list