RFR: JDK-8310502 : Optimization for j.l.Long.fastUUID() [v21]

温绍锦 duke at openjdk.org
Fri Jun 23 23:28:22 UTC 2023


On Fri, 23 Jun 2023 19:30:31 GMT, ExE Boss <duke at openjdk.org> wrote:

>> 温绍锦 has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   format code
>
> src/java.base/share/classes/java/lang/Long.java line 493:
> 
>> 491:                         | H256[((int) lsb) & 0xff]);
>> 492: 
>> 493:         return new String(buf, LATIN1);
> 
> Note that this isn’t correct when `COMPACT_STRINGS` is `false`, as then `buf` is always interpreted as having a `coder` of `UTF16`.

where COMPACT_STRINGS is false,  jdk.internal.access.JavaLangAccess#fastUUID will use fastUUIDUTF16


 public String fastUUID(long lsb, long msb) {
         return String.COMPACT_STRINGS ? Long.fastUUID(lsb, msb) : Long.fastUUIDUTF16(lsb, msb);
}

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14578#discussion_r1240501371


More information about the core-libs-dev mailing list