On Thu, 1 May 2025 21:08:29 GMT, Roger Riggs <rri...@openjdk.org> wrote:
>> Refactor AbstractStringBuilder to maintain consistency among count, coder, >> and value buffers while the buffer capacity is being expanded and/or >> inflated from Latin1 to UTF16 representations. >> The refactoring pattern is to read and write AbstractStringBuilder fields >> once using locals for all intermediate values. >> Support methods are static, designed to pass all values as arguments and >> return a value. >> >> The value byte array is reallocated under 3 conditions: >> - Increasing the capacity with the same encoder >> - Increasing the capacity and inflation to change the coder from LATIN1 to >> UTF16 >> - Inflation with the same capacity >> >> Added StressSBTest to exercise public instance methods of StringBuilder. > > Roger Riggs has updated the pull request incrementally with one additional > commit since the last revision: > > Added missing bugid to tests > Applied review suggestions. > Added convenience methods to StringLatin1 for 4 and 5 character literals to > leverage optimizations for merged stores. > Updated missing copyright years. The test code in java/lang/Helper.java needs to be changed to fix the build error // test/hotspot/jtreg/compiler/patches/java.base/java/lang/Helper.java package java.lang; class Helper { public static int putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4) { int end = i + 4; StringUTF16.checkBoundsBeginEnd(i, end, value); StringUTF16.putCharsAt(value, i, c1, c2, c3, c4); return end; } public static int putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4, char c5) { int end = i + 5; StringUTF16.checkBoundsBeginEnd(i, end, value); StringUTF16.putCharsAt(value, i, c1, c2, c3, c4, c5); return end; } } ------------- PR Comment: https://git.openjdk.org/jdk/pull/24967#issuecomment-2846432424