RFR: 8342650: Move getChars to DecimalDigits [v2]

Shaojin Wen swen at openjdk.org
Wed Nov 6 05:16:56 UTC 2024


On Wed, 6 Nov 2024 01:44:38 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Shaojin Wen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision:
>> 
>>  - Merge remote-tracking branch 'upstream/master' into int_get_chars_dedup_202410
>>  - fix Helper
>>  - fix Helper
>>  - fix Helper
>>  - unsafe putByte
>>  - remove digitPair
>>  - fix import
>>  - remove JLA
>>  - remove unused code
>>  - add comments
>>  - ... and 1 more: https://git.openjdk.org/jdk/compare/1355efc1...73b32004
>
> src/java.base/share/classes/jdk/internal/util/DecimalDigits.java line 415:
> 
>> 413:         int packed = DIGITS[v];
>> 414:         putCharLatin1(buf, charPos, packed & 0xFF);
>> 415:         putCharLatin1(buf, charPos + 1, packed >> 8);
> 
> Does merge store work here?  Original code in StringLatin1 uses direct array writes, not sure about this version.

Tests show that the current version of MergeStore also works


[TraceMergeStores] found:
    0-->  114  StoreB  === 80 91 113 95  [[ 18 ]]  @byte[int:>=0] (java/lang/Cloneable,java/io/Serializable):exact+any *, idx=5; unsafe  Memory: @byte[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact+any *, idx=5; !jvms: DecimalDigits::putCharLatin1 @ bci:12 (line 430) DecimalDigits::putPairLatin1 @ bci:24 (line 413)
    1-->   91  StoreB  === 80 7 90 51  [[ 114 ]]  @byte[int:>=0] (java/lang/Cloneable,java/io/Serializable):exact+any *, idx=5; unsafe  Memory: @byte[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact+any *, idx=5; !jvms: DecimalDigits::putCharLatin1 @ bci:12 (line 430) DecimalDigits::putPairLatin1 @ bci:13 (line 412)
[TraceMergeStores] truncated:
    0-->  114  StoreB  === 80 91 113 95  [[ 18 ]]  @byte[int:>=0] (java/lang/Cloneable,java/io/Serializable):exact+any *, idx=5; unsafe  Memory: @byte[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact+any *, idx=5; !jvms: DecimalDigits::putCharLatin1 @ bci:12 (line 430) DecimalDigits::putPairLatin1 @ bci:24 (line 413)
    1-->   91  StoreB  === 80 7 90 51  [[ 114 ]]  @byte[int:>=0] (java/lang/Cloneable,java/io/Serializable):exact+any *, idx=5; unsafe  Memory: @byte[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact+any *, idx=5; !jvms: DecimalDigits::putCharLatin1 @ bci:12 (line 430) DecimalDigits::putPairLatin1 @ bci:13 (line 412)
[TraceMergeStores]: Replace
  91  StoreB  === 80 7 90 51  [[ 114 ]]  @byte[int:>=0] (java/lang/Cloneable,java/io/Serializable):exact+any *, idx=5; unsafe  Memory: @byte[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact+any *, idx=5; !jvms: DecimalDigits::putCharLatin1 @ bci:12 (line 430) DecimalDigits::putPairLatin1 @ bci:13 (line 412)
 114  StoreB  === 80 91 113 95  [[ 18 ]]  @byte[int:>=0] (java/lang/Cloneable,java/io/Serializable):exact+any *, idx=5; unsafe  Memory: @byte[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact+any *, idx=5; !jvms: DecimalDigits::putCharLatin1 @ bci:12 (line 430) DecimalDigits::putPairLatin1 @ bci:24 (line 413)
[TraceMergeStores]: with
  51  LoadS  === 33 7 49  [[ 91 85 95 70 118 ]]  @short[int:>=0] (java/lang/Cloneable,java/io/Serializable):exact+any *, idx=4; #short !jvms: DecimalDigits::putPairLatin1 @ bci:4 (line 411)
 118  StoreC  === 80 7 90 51  [[ ]]  @byte[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact+any *, idx=5; mismatched  Memory: @byte[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact+any *, idx=5;
[TraceMergeStores] MergePrimitiveStores::run:  118  StoreC  === 80 7 90 51  [[ 18 ]]  @byte[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact+any *, idx=5; mismatched  Memory: @byte[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact+any *, idx=5; !orig=[114] !jvms: DecimalDigits::putCharLatin1 @ bci:12 (line 430) DecimalDigits::putPairLatin1 @ bci:24 (line 413)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21593#discussion_r1830398810


More information about the core-libs-dev mailing list