From duke at openjdk.org Sun Feb 1 06:28:49 2026 From: duke at openjdk.org (Tatsunori Uchino) Date: Sun, 1 Feb 2026 06:28:49 GMT Subject: RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v20] In-Reply-To: References: Message-ID: > Adds `codePointCount()` overloads to `String`, `Character`, `(Abstract)StringBuilder`, and `StringBuffer` to make it possible to conveniently retrieve the length of a string as code points without extra boundary checks. > > > if (superTremendouslyLongExpressionYieldingAString().codePointCount() > limit) { > throw new Exception("exceeding length"); > } > > > Is a CSR required to this change? Tatsunori Uchino has updated the pull request incrementally with two additional commits since the last revision: - Update JavaDoc - Fix broken test methods calls ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26461/files - new: https://git.openjdk.org/jdk/pull/26461/files/81245159..8b5db22c Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26461&range=19 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26461&range=18-19 Stats: 7 lines in 2 files changed: 3 ins; 0 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/26461.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26461/head:pull/26461 PR: https://git.openjdk.org/jdk/pull/26461 From alanb at openjdk.org Sun Feb 1 08:29:05 2026 From: alanb at openjdk.org (Alan Bateman) Date: Sun, 1 Feb 2026 08:29:05 GMT Subject: RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v11] In-Reply-To: References: <0Ix-aiMznxsuePv7iSAqOId1aV2zTFOsW96OeD2D5cg=.fbd08430-b244-4170-8736-517ce84e08d4@github.com> Message-ID: On Wed, 28 Jan 2026 23:55:50 GMT, Tatsunori Uchino wrote: >> Tatsunori Uchino has updated the pull request incrementally with one additional commit since the last revision: >> >> Update year in copyright > > "Create sysroot" fails: > > s390x: > > > Run sudo debootstrap --no-merged-usr --arch=s390x --verbose --include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype-dev,libpng-dev --resolve-deps --variant=minbase bullseye sysroot https://httpredir.debian.org/debian/ > W: Cannot check Release signature; keyring file not available /usr/share/keyrings/debian-archive-keyring.gpg > I: Retrieving InRelease > E: Invalid Release file, no entry for main/binary-s390x/Packages > Error: Process completed with exit code 1. > > > ppc64le: > > > Run sudo debootstrap --no-merged-usr --arch=ppc64el --verbose --include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype-dev,libpng-dev --resolve-deps --variant=minbase bullseye sysroot https://httpredir.debian.org/debian/ > W: Cannot check Release signature; keyring file not available /usr/share/keyrings/debian-archive-keyring.gpg > I: Retrieving InRelease > E: Invalid Release file, no entry for main/binary-ppc64el/Packages > Error: Process completed with exit code 1. @tats-u The tests in test/jdk/java/nio/Buffer will need to be updated to add coverage for the new method. It's really important that the method is exercises with CharBuffer views that are backed by heap/direct buffers and char sequences. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26461#issuecomment-3830610479 From alanb at openjdk.org Sun Feb 1 08:33:11 2026 From: alanb at openjdk.org (Alan Bateman) Date: Sun, 1 Feb 2026 08:33:11 GMT Subject: RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v20] In-Reply-To: References: Message-ID: On Sun, 1 Feb 2026 06:28:49 GMT, Tatsunori Uchino wrote: >> Adds `codePointCount()` overloads to `String`, `Character`, `(Abstract)StringBuilder`, and `StringBuffer` to make it possible to conveniently retrieve the length of a string as code points without extra boundary checks. >> >> >> if (superTremendouslyLongExpressionYieldingAString().codePointCount() > limit) { >> throw new Exception("exceeding length"); >> } >> >> >> Is a CSR required to this change? > > Tatsunori Uchino has updated the pull request incrementally with two additional commits since the last revision: > > - Update JavaDoc > - Fix broken test methods calls src/java.base/share/classes/java/nio/X-Buffer.java.template line 2062: > 2060: /** > 2061: * {@return the number of Unicode code points in this character buffer} > 2062: *

The number of Unicode code points in this character buffer is Keep it consistent with the existing methods if you can, meaning put a blank after before the second paragraph, space after the `

` and drop the trailing `

`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26461#discussion_r2750747902 From duke at openjdk.org Sun Feb 1 10:20:46 2026 From: duke at openjdk.org (Tatsunori Uchino) Date: Sun, 1 Feb 2026 10:20:46 GMT Subject: RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v21] In-Reply-To: References: Message-ID: > Adds `codePointCount()` overloads to `String`, `Character`, `(Abstract)StringBuilder`, and `StringBuffer` to make it possible to conveniently retrieve the length of a string as code points without extra boundary checks. > > > if (superTremendouslyLongExpressionYieldingAString().codePointCount() > limit) { > throw new Exception("exceeding length"); > } > > > Is a CSR required to this change? Tatsunori Uchino has updated the pull request incrementally with one additional commit since the last revision: Reformat JavaDoc ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26461/files - new: https://git.openjdk.org/jdk/pull/26461/files/8b5db22c..43eb577a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26461&range=20 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26461&range=19-20 Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/26461.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26461/head:pull/26461 PR: https://git.openjdk.org/jdk/pull/26461 From duke at openjdk.org Sun Feb 1 10:20:46 2026 From: duke at openjdk.org (Tatsunori Uchino) Date: Sun, 1 Feb 2026 10:20:46 GMT Subject: RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v11] In-Reply-To: References: <0Ix-aiMznxsuePv7iSAqOId1aV2zTFOsW96OeD2D5cg=.fbd08430-b244-4170-8736-517ce84e08d4@github.com> Message-ID: On Sun, 1 Feb 2026 08:26:28 GMT, Alan Bateman wrote: >> "Create sysroot" fails: >> >> s390x: >> >> >> Run sudo debootstrap --no-merged-usr --arch=s390x --verbose --include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype-dev,libpng-dev --resolve-deps --variant=minbase bullseye sysroot https://httpredir.debian.org/debian/ >> W: Cannot check Release signature; keyring file not available /usr/share/keyrings/debian-archive-keyring.gpg >> I: Retrieving InRelease >> E: Invalid Release file, no entry for main/binary-s390x/Packages >> Error: Process completed with exit code 1. >> >> >> ppc64le: >> >> >> Run sudo debootstrap --no-merged-usr --arch=ppc64el --verbose --include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype-dev,libpng-dev --resolve-deps --variant=minbase bullseye sysroot https://httpredir.debian.org/debian/ >> W: Cannot check Release signature; keyring file not available /usr/share/keyrings/debian-archive-keyring.gpg >> I: Retrieving InRelease >> E: Invalid Release file, no entry for main/binary-ppc64el/Packages >> Error: Process completed with exit code 1. > > @tats-u The tests in test/jdk/java/nio/Buffer will need to be updated to add coverage for the new method. It's really important that the method is exercises with CharBuffer views that are backed by heap/direct buffers and char sequences. @AlanBateman Fixed, but you might want to use from next time: image ------------- PR Comment: https://git.openjdk.org/jdk/pull/26461#issuecomment-3830816082 From duke at openjdk.org Sun Feb 1 10:31:07 2026 From: duke at openjdk.org (Tatsunori Uchino) Date: Sun, 1 Feb 2026 10:31:07 GMT Subject: RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v11] In-Reply-To: References: <0Ix-aiMznxsuePv7iSAqOId1aV2zTFOsW96OeD2D5cg=.fbd08430-b244-4170-8736-517ce84e08d4@github.com> Message-ID: <7DMT6Cy1trgRJjQCRCbQ0BfDdoatf6l1kLl8ph30onA=.04c311dd-08b8-4765-8181-8b567d878a2d@github.com> On Sun, 1 Feb 2026 08:26:28 GMT, Alan Bateman wrote: >> "Create sysroot" fails: >> >> s390x: >> >> >> Run sudo debootstrap --no-merged-usr --arch=s390x --verbose --include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype-dev,libpng-dev --resolve-deps --variant=minbase bullseye sysroot https://httpredir.debian.org/debian/ >> W: Cannot check Release signature; keyring file not available /usr/share/keyrings/debian-archive-keyring.gpg >> I: Retrieving InRelease >> E: Invalid Release file, no entry for main/binary-s390x/Packages >> Error: Process completed with exit code 1. >> >> >> ppc64le: >> >> >> Run sudo debootstrap --no-merged-usr --arch=ppc64el --verbose --include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype-dev,libpng-dev --resolve-deps --variant=minbase bullseye sysroot https://httpredir.debian.org/debian/ >> W: Cannot check Release signature; keyring file not available /usr/share/keyrings/debian-archive-keyring.gpg >> I: Retrieving InRelease >> E: Invalid Release file, no entry for main/binary-ppc64el/Packages >> Error: Process completed with exit code 1. > > @tats-u The tests in test/jdk/java/nio/Buffer will need to be updated to add coverage for the new method. It's really important that the method is exercises with CharBuffer views that are backed by heap/direct buffers and char sequences. @AlanBateman > The tests in test/jdk/java/nio/Buffer will need to be updated to add coverage for the new method. Do you know which files new tests should be added to? test/jdk/java/nio/Buffer/CharBufferAsCharSequenceTest.java? ------------- PR Comment: https://git.openjdk.org/jdk/pull/26461#issuecomment-3830829293 From duke at openjdk.org Sun Feb 1 11:00:41 2026 From: duke at openjdk.org (Tatsunori Uchino) Date: Sun, 1 Feb 2026 11:00:41 GMT Subject: RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v22] In-Reply-To: References: Message-ID: > Adds `codePointCount()` overloads to `String`, `Character`, `(Abstract)StringBuilder`, and `StringBuffer` to make it possible to conveniently retrieve the length of a string as code points without extra boundary checks. > > > if (superTremendouslyLongExpressionYieldingAString().codePointCount() > limit) { > throw new Exception("exceeding length"); > } > > > Is a CSR required to this change? Tatsunori Uchino has updated the pull request incrementally with one additional commit since the last revision: Add test ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26461/files - new: https://git.openjdk.org/jdk/pull/26461/files/43eb577a..b640e68d Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26461&range=21 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26461&range=20-21 Stats: 12 lines in 1 file changed: 12 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/26461.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26461/head:pull/26461 PR: https://git.openjdk.org/jdk/pull/26461 From duke at openjdk.org Sun Feb 1 12:55:29 2026 From: duke at openjdk.org (Tatsunori Uchino) Date: Sun, 1 Feb 2026 12:55:29 GMT Subject: RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v23] In-Reply-To: References: Message-ID: > Adds `codePointCount()` overloads to `String`, `Character`, `(Abstract)StringBuilder`, and `StringBuffer` to make it possible to conveniently retrieve the length of a string as code points without extra boundary checks. > > > if (superTremendouslyLongExpressionYieldingAString().codePointCount() > limit) { > throw new Exception("exceeding length"); > } > > > Is a CSR required to this change? Tatsunori Uchino has updated the pull request incrementally with two additional commits since the last revision: - Add comment - Fix logic error ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26461/files - new: https://git.openjdk.org/jdk/pull/26461/files/b640e68d..e7d33b94 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26461&range=22 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26461&range=21-22 Stats: 8 lines in 2 files changed: 5 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/26461.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26461/head:pull/26461 PR: https://git.openjdk.org/jdk/pull/26461 From duke at openjdk.org Sun Feb 1 15:10:12 2026 From: duke at openjdk.org (Tatsunori Uchino) Date: Sun, 1 Feb 2026 15:10:12 GMT Subject: RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v23] In-Reply-To: References: Message-ID: On Sun, 1 Feb 2026 12:55:29 GMT, Tatsunori Uchino wrote: >> Adds `codePointCount()` overloads to `String`, `Character`, `(Abstract)StringBuilder`, and `StringBuffer` to make it possible to conveniently retrieve the length of a string as code points without extra boundary checks. >> >> >> if (superTremendouslyLongExpressionYieldingAString().codePointCount() > limit) { >> throw new Exception("exceeding length"); >> } >> >> >> Is a CSR required to this change? > > Tatsunori Uchino has updated the pull request incrementally with two additional commits since the last revision: > > - Add comment > - Fix logic error I don't know how to fix the offending "tools/javac/patterns/Exhaustiveness" error. https://github.com/tats-u/jdk/actions/runs/21563196651#summary-62131220808 ------------- PR Comment: https://git.openjdk.org/jdk/pull/26461#issuecomment-3831173111 From liach at openjdk.org Sun Feb 1 15:16:08 2026 From: liach at openjdk.org (Chen Liang) Date: Sun, 1 Feb 2026 15:16:08 GMT Subject: RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v23] In-Reply-To: References: Message-ID: On Sun, 1 Feb 2026 12:55:29 GMT, Tatsunori Uchino wrote: >> Adds `codePointCount()` overloads to `String`, `Character`, `(Abstract)StringBuilder`, and `StringBuffer` to make it possible to conveniently retrieve the length of a string as code points without extra boundary checks. >> >> >> if (superTremendouslyLongExpressionYieldingAString().codePointCount() > limit) { >> throw new Exception("exceeding length"); >> } >> >> >> Is a CSR required to this change? > > Tatsunori Uchino has updated the pull request incrementally with two additional commits since the last revision: > > - Add comment > - Fix logic error Oh, it's just a timeout on some special build configuration. It is sometimes due to GitHub Actions machines being not powerful enough. You can safely ignore that. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26461#issuecomment-3831183326 From alanb at openjdk.org Sun Feb 1 16:58:09 2026 From: alanb at openjdk.org (Alan Bateman) Date: Sun, 1 Feb 2026 16:58:09 GMT Subject: RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v11] In-Reply-To: <7DMT6Cy1trgRJjQCRCbQ0BfDdoatf6l1kLl8ph30onA=.04c311dd-08b8-4765-8181-8b567d878a2d@github.com> References: <0Ix-aiMznxsuePv7iSAqOId1aV2zTFOsW96OeD2D5cg=.fbd08430-b244-4170-8736-517ce84e08d4@github.com> <7DMT6Cy1trgRJjQCRCbQ0BfDdoatf6l1kLl8ph30onA=.04c311dd-08b8-4765-8181-8b567d878a2d@github.com> Message-ID: On Sun, 1 Feb 2026 10:28:12 GMT, Tatsunori Uchino wrote: > Do you know which files new tests should be added to? Look at Basic-X.java.template (need to run genBasic.sh to generate the tests when you change it). ------------- PR Comment: https://git.openjdk.org/jdk/pull/26461#issuecomment-3831388783 From dfenacci at openjdk.org Mon Feb 2 09:31:40 2026 From: dfenacci at openjdk.org (Damon Fenacci) Date: Mon, 2 Feb 2026 09:31:40 GMT Subject: RFR: 8374582: [REDO] Move input validation checks to Java for java.lang.StringCoding intrinsics [v9] In-Reply-To: <3ci9RXEra2BlQPhYl-M0Wnu3hRpWaDvxPnMRzFnJA_k=.67795fb3-95d1-449b-a7a9-44b3776aa626@github.com> References: <3ci9RXEra2BlQPhYl-M0Wnu3hRpWaDvxPnMRzFnJA_k=.67795fb3-95d1-449b-a7a9-44b3776aa626@github.com> Message-ID: > ## Issue > > This is a redo of [JDK-8361842](https://bugs.openjdk.org/browse/JDK-8361842) which was backed out by [JDK-8374210](https://bugs.openjdk.org/browse/JDK-8374210) due to C2-related regressions. The original change moved input validation checks for java.lang.StringCoding from the intrinsic to Java code (leaving the intrinsic check only with the `VerifyIntrinsicChecks` flag). Refer to the [original PR](https://github.com/openjdk/jdk/pull/25998) for details. > > This additional issue happens because, in some cases, for instance when the Java checking code is not inlined and we give an out-of-range constant as input, we fold the data path but not the control path and we crash in the backend. > > ## Causes > > The cause of this is that the out-of-range constant (e.g. -1) floats into the intrinsic and there (assuming the input is valid) we add a constraint to its type to positive integers (e.g. to compute the array address) which makes it top. > > ## Fix > > A possible fix is to introduce an opaque node (OpaqueGuardNode) similar to what we do in `must_be_not_null` for values that we know cannot be null: > https://github.com/openjdk/jdk/blob/ce721665cd61d9a319c667d50d9917c359d6c104/src/hotspot/share/opto/graphKit.cpp#L1484 > This will temporarily add the range check to ensure that C2 figures that out-of-range values cannot reach the intrinsic. Then, during macro expansion, we replace the opaque node with the corresponding constant (true/false) in product builds such that the actually unneeded guards are folded and do not end up in the emitted code. > > # Testing > > * Tier 1-3+ > * 2 JTReg tests added > * `TestRangeCheck.java` as regression test for the reported issue > * `TestOpaqueGuardNodes.java` to check that opaque guard nodes are added when parsing and removed at macro expansion Damon Fenacci has updated the pull request incrementally with two additional commits since the last revision: - Merge branch 'JDK-8374582' of https://github.com/dafedafe/jdk into JDK-8374582 - JDK-8374582: add assert in opaque constructor ------------- Changes: - all: https://git.openjdk.org/jdk/pull/29164/files - new: https://git.openjdk.org/jdk/pull/29164/files/c5390e4a..5e7df6f4 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=29164&range=08 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29164&range=07-08 Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/29164.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29164/head:pull/29164 PR: https://git.openjdk.org/jdk/pull/29164 From dfenacci at openjdk.org Mon Feb 2 09:55:37 2026 From: dfenacci at openjdk.org (Damon Fenacci) Date: Mon, 2 Feb 2026 09:55:37 GMT Subject: RFR: 8374582: [REDO] Move input validation checks to Java for java.lang.StringCoding intrinsics [v10] In-Reply-To: <3ci9RXEra2BlQPhYl-M0Wnu3hRpWaDvxPnMRzFnJA_k=.67795fb3-95d1-449b-a7a9-44b3776aa626@github.com> References: <3ci9RXEra2BlQPhYl-M0Wnu3hRpWaDvxPnMRzFnJA_k=.67795fb3-95d1-449b-a7a9-44b3776aa626@github.com> Message-ID: > ## Issue > > This is a redo of [JDK-8361842](https://bugs.openjdk.org/browse/JDK-8361842) which was backed out by [JDK-8374210](https://bugs.openjdk.org/browse/JDK-8374210) due to C2-related regressions. The original change moved input validation checks for java.lang.StringCoding from the intrinsic to Java code (leaving the intrinsic check only with the `VerifyIntrinsicChecks` flag). Refer to the [original PR](https://github.com/openjdk/jdk/pull/25998) for details. > > This additional issue happens because, in some cases, for instance when the Java checking code is not inlined and we give an out-of-range constant as input, we fold the data path but not the control path and we crash in the backend. > > ## Causes > > The cause of this is that the out-of-range constant (e.g. -1) floats into the intrinsic and there (assuming the input is valid) we add a constraint to its type to positive integers (e.g. to compute the array address) which makes it top. > > ## Fix > > A possible fix is to introduce an opaque node (OpaqueGuardNode) similar to what we do in `must_be_not_null` for values that we know cannot be null: > https://github.com/openjdk/jdk/blob/ce721665cd61d9a319c667d50d9917c359d6c104/src/hotspot/share/opto/graphKit.cpp#L1484 > This will temporarily add the range check to ensure that C2 figures that out-of-range values cannot reach the intrinsic. Then, during macro expansion, we replace the opaque node with the corresponding constant (true/false) in product builds such that the actually unneeded guards are folded and do not end up in the emitted code. > > # Testing > > * Tier 1-3+ > * 2 JTReg tests added > * `TestRangeCheck.java` as regression test for the reported issue > * `TestOpaqueGuardNodes.java` to check that opaque guard nodes are added when parsing and removed at macro expansion Damon Fenacci has updated the pull request incrementally with one additional commit since the last revision: JDK-8374582: revert wrong copyright change ------------- Changes: - all: https://git.openjdk.org/jdk/pull/29164/files - new: https://git.openjdk.org/jdk/pull/29164/files/5e7df6f4..5ac3e6e3 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=29164&range=09 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29164&range=08-09 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/29164.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29164/head:pull/29164 PR: https://git.openjdk.org/jdk/pull/29164 From thartmann at openjdk.org Mon Feb 2 11:40:03 2026 From: thartmann at openjdk.org (Tobias Hartmann) Date: Mon, 2 Feb 2026 11:40:03 GMT Subject: RFR: 8374582: [REDO] Move input validation checks to Java for java.lang.StringCoding intrinsics [v10] In-Reply-To: References: <3ci9RXEra2BlQPhYl-M0Wnu3hRpWaDvxPnMRzFnJA_k=.67795fb3-95d1-449b-a7a9-44b3776aa626@github.com> Message-ID: On Mon, 2 Feb 2026 09:55:37 GMT, Damon Fenacci wrote: >> ## Issue >> >> This is a redo of [JDK-8361842](https://bugs.openjdk.org/browse/JDK-8361842) which was backed out by [JDK-8374210](https://bugs.openjdk.org/browse/JDK-8374210) due to C2-related regressions. The original change moved input validation checks for java.lang.StringCoding from the intrinsic to Java code (leaving the intrinsic check only with the `VerifyIntrinsicChecks` flag). Refer to the [original PR](https://github.com/openjdk/jdk/pull/25998) for details. >> >> This additional issue happens because, in some cases, for instance when the Java checking code is not inlined and we give an out-of-range constant as input, we fold the data path but not the control path and we crash in the backend. >> >> ## Causes >> >> The cause of this is that the out-of-range constant (e.g. -1) floats into the intrinsic and there (assuming the input is valid) we add a constraint to its type to positive integers (e.g. to compute the array address) which makes it top. >> >> ## Fix >> >> A possible fix is to introduce an opaque node (OpaqueGuardNode) similar to what we do in `must_be_not_null` for values that we know cannot be null: >> https://github.com/openjdk/jdk/blob/ce721665cd61d9a319c667d50d9917c359d6c104/src/hotspot/share/opto/graphKit.cpp#L1484 >> This will temporarily add the range check to ensure that C2 figures that out-of-range values cannot reach the intrinsic. Then, during macro expansion, we replace the opaque node with the corresponding constant (true/false) in product builds such that the actually unneeded guards are folded and do not end up in the emitted code. >> >> # Testing >> >> * Tier 1-3+ >> * 2 JTReg tests added >> * `TestRangeCheck.java` as regression test for the reported issue >> * `TestOpaqueGuardNodes.java` to check that opaque guard nodes are added when parsing and removed at macro expansion > > Damon Fenacci has updated the pull request incrementally with one additional commit since the last revision: > > JDK-8374582: revert wrong copyright change Thanks for working on this Damon. I added a few comments, otherwise it looks good! src/hotspot/share/opto/library_call.cpp line 894: > 892: > 893: inline Node* LibraryCallKit::generate_negative_guard(Node* index, RegionNode* region, > 894: Node** pos_index, bool is_opaque) { As we discussed offline, I think `with_opaque` is better here. src/hotspot/share/opto/opaquenode.hpp line 145: > 143: // with false in product builds such that the actually unneeded guards are folded and do not end up in the emitted code. > 144: // In debug builds, we keep the actual checks as additional verification code (i.e. removing OpaqueConstantBoolNodes and > 145: // use the BoolNode inputs instead). Nice comment! src/hotspot/share/opto/opaquenode.hpp line 148: > 146: class OpaqueConstantBoolNode : public Node { > 147: private: > 148: bool _constant; Should this be `const`? src/hotspot/share/opto/opaquenode.hpp line 150: > 148: bool _constant; > 149: public: > 150: OpaqueConstantBoolNode(Compile* C, Node* tst, bool constant) : Node(nullptr, tst), _constant(constant) { An alternative would be to have the `constant` be an actual input node instead of a field. In macro expansion, you could then do `_igvn.replace_node(n, n->in(2));` instead (maybe define an enum for the input indices). I don't have a strong opinion on this though and leave it up to you to decide ? ------------- Marked as reviewed by thartmann (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/29164#pullrequestreview-3738450475 PR Review Comment: https://git.openjdk.org/jdk/pull/29164#discussion_r2753636949 PR Review Comment: https://git.openjdk.org/jdk/pull/29164#discussion_r2753548067 PR Review Comment: https://git.openjdk.org/jdk/pull/29164#discussion_r2753551976 PR Review Comment: https://git.openjdk.org/jdk/pull/29164#discussion_r2753586409 From dfenacci at openjdk.org Mon Feb 2 12:01:51 2026 From: dfenacci at openjdk.org (Damon Fenacci) Date: Mon, 2 Feb 2026 12:01:51 GMT Subject: RFR: 8374582: [REDO] Move input validation checks to Java for java.lang.StringCoding intrinsics [v11] In-Reply-To: <3ci9RXEra2BlQPhYl-M0Wnu3hRpWaDvxPnMRzFnJA_k=.67795fb3-95d1-449b-a7a9-44b3776aa626@github.com> References: <3ci9RXEra2BlQPhYl-M0Wnu3hRpWaDvxPnMRzFnJA_k=.67795fb3-95d1-449b-a7a9-44b3776aa626@github.com> Message-ID: > ## Issue > > This is a redo of [JDK-8361842](https://bugs.openjdk.org/browse/JDK-8361842) which was backed out by [JDK-8374210](https://bugs.openjdk.org/browse/JDK-8374210) due to C2-related regressions. The original change moved input validation checks for java.lang.StringCoding from the intrinsic to Java code (leaving the intrinsic check only with the `VerifyIntrinsicChecks` flag). Refer to the [original PR](https://github.com/openjdk/jdk/pull/25998) for details. > > This additional issue happens because, in some cases, for instance when the Java checking code is not inlined and we give an out-of-range constant as input, we fold the data path but not the control path and we crash in the backend. > > ## Causes > > The cause of this is that the out-of-range constant (e.g. -1) floats into the intrinsic and there (assuming the input is valid) we add a constraint to its type to positive integers (e.g. to compute the array address) which makes it top. > > ## Fix > > A possible fix is to introduce an opaque node (OpaqueGuardNode) similar to what we do in `must_be_not_null` for values that we know cannot be null: > https://github.com/openjdk/jdk/blob/ce721665cd61d9a319c667d50d9917c359d6c104/src/hotspot/share/opto/graphKit.cpp#L1484 > This will temporarily add the range check to ensure that C2 figures that out-of-range values cannot reach the intrinsic. Then, during macro expansion, we replace the opaque node with the corresponding constant (true/false) in product builds such that the actually unneeded guards are folded and do not end up in the emitted code. > > # Testing > > * Tier 1-3+ > * 2 JTReg tests added > * `TestRangeCheck.java` as regression test for the reported issue > * `TestOpaqueGuardNodes.java` to check that opaque guard nodes are added when parsing and removed at macro expansion Damon Fenacci has updated the pull request incrementally with two additional commits since the last revision: - JDK-8374582: add const - JDK-8374582: with_opaque ------------- Changes: - all: https://git.openjdk.org/jdk/pull/29164/files - new: https://git.openjdk.org/jdk/pull/29164/files/5ac3e6e3..0d4eef88 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=29164&range=10 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29164&range=09-10 Stats: 7 lines in 3 files changed: 0 ins; 0 del; 7 mod Patch: https://git.openjdk.org/jdk/pull/29164.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29164/head:pull/29164 PR: https://git.openjdk.org/jdk/pull/29164 From dfenacci at openjdk.org Mon Feb 2 12:13:36 2026 From: dfenacci at openjdk.org (Damon Fenacci) Date: Mon, 2 Feb 2026 12:13:36 GMT Subject: RFR: 8374582: [REDO] Move input validation checks to Java for java.lang.StringCoding intrinsics [v10] In-Reply-To: References: <3ci9RXEra2BlQPhYl-M0Wnu3hRpWaDvxPnMRzFnJA_k=.67795fb3-95d1-449b-a7a9-44b3776aa626@github.com> Message-ID: On Mon, 2 Feb 2026 10:29:20 GMT, Tobias Hartmann wrote: >> Damon Fenacci has updated the pull request incrementally with one additional commit since the last revision: >> >> JDK-8374582: revert wrong copyright change > > src/hotspot/share/opto/library_call.cpp line 894: > >> 892: >> 893: inline Node* LibraryCallKit::generate_negative_guard(Node* index, RegionNode* region, >> 894: Node** pos_index, bool is_opaque) { > > As we discussed offline, I think `with_opaque` is better here. Renamed. Thanks @TobiHartmann. > src/hotspot/share/opto/opaquenode.hpp line 148: > >> 146: class OpaqueConstantBoolNode : public Node { >> 147: private: >> 148: bool _constant; > > Should this be `const`? Yep, fixed. > src/hotspot/share/opto/opaquenode.hpp line 150: > >> 148: bool _constant; >> 149: public: >> 150: OpaqueConstantBoolNode(Compile* C, Node* tst, bool constant) : Node(nullptr, tst), _constant(constant) { > > An alternative would be to have the `constant` be an actual input node instead of a field. In macro expansion, you could then do `_igvn.replace_node(n, n->in(2));` instead (maybe define an enum for the input indices). I don't have a strong opinion on this though and leave it up to you to decide ? Cool trick! ?... but now I can't decide between the two ? @chhagedorn do you fancy being the tiebreaker? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29164#discussion_r2754030906 PR Review Comment: https://git.openjdk.org/jdk/pull/29164#discussion_r2754030537 PR Review Comment: https://git.openjdk.org/jdk/pull/29164#discussion_r2754032138 From chagedorn at openjdk.org Mon Feb 2 13:28:57 2026 From: chagedorn at openjdk.org (Christian Hagedorn) Date: Mon, 2 Feb 2026 13:28:57 GMT Subject: RFR: 8374582: [REDO] Move input validation checks to Java for java.lang.StringCoding intrinsics [v10] In-Reply-To: References: <3ci9RXEra2BlQPhYl-M0Wnu3hRpWaDvxPnMRzFnJA_k=.67795fb3-95d1-449b-a7a9-44b3776aa626@github.com> Message-ID: On Mon, 2 Feb 2026 12:10:48 GMT, Damon Fenacci wrote: >> src/hotspot/share/opto/opaquenode.hpp line 150: >> >>> 148: bool _constant; >>> 149: public: >>> 150: OpaqueConstantBoolNode(Compile* C, Node* tst, bool constant) : Node(nullptr, tst), _constant(constant) { >> >> An alternative would be to have the `constant` be an actual input node instead of a field. In macro expansion, you could then do `_igvn.replace_node(n, n->in(2));` instead (maybe define an enum for the input indices). I don't have a strong opinion on this though and leave it up to you to decide ? > > Cool trick! ?... but now I can't decide between the two ? @chhagedorn do you fancy being the tiebreaker? The old `Opaque4` nodes used to have two data inputs where the second one was the replacement. I found it a little harder to view graphs in IGV with one more input. You also do not need to worry about trying to understand what the second input means. So, I would rather have a field if I may break the tie but both options are fine :-) When going with a field, you could add a NOT_PRODUCT(void dump_spec(outputStream* st) const); that prints `#true` or `#false` depending on `_constant` (that could also then be shown in IGV with the "Show custom node info"). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29164#discussion_r2754324868 From dfenacci at openjdk.org Mon Feb 2 14:03:00 2026 From: dfenacci at openjdk.org (Damon Fenacci) Date: Mon, 2 Feb 2026 14:03:00 GMT Subject: RFR: 8374582: [REDO] Move input validation checks to Java for java.lang.StringCoding intrinsics [v12] In-Reply-To: <3ci9RXEra2BlQPhYl-M0Wnu3hRpWaDvxPnMRzFnJA_k=.67795fb3-95d1-449b-a7a9-44b3776aa626@github.com> References: <3ci9RXEra2BlQPhYl-M0Wnu3hRpWaDvxPnMRzFnJA_k=.67795fb3-95d1-449b-a7a9-44b3776aa626@github.com> Message-ID: <2_bA8sRgRlbc279Aia0oD9gPBn8bcD5kLP3RnA4Xl4Q=.deaeaaf0-27a1-40f8-81f3-c8283c4d9529@github.com> > ## Issue > > This is a redo of [JDK-8361842](https://bugs.openjdk.org/browse/JDK-8361842) which was backed out by [JDK-8374210](https://bugs.openjdk.org/browse/JDK-8374210) due to C2-related regressions. The original change moved input validation checks for java.lang.StringCoding from the intrinsic to Java code (leaving the intrinsic check only with the `VerifyIntrinsicChecks` flag). Refer to the [original PR](https://github.com/openjdk/jdk/pull/25998) for details. > > This additional issue happens because, in some cases, for instance when the Java checking code is not inlined and we give an out-of-range constant as input, we fold the data path but not the control path and we crash in the backend. > > ## Causes > > The cause of this is that the out-of-range constant (e.g. -1) floats into the intrinsic and there (assuming the input is valid) we add a constraint to its type to positive integers (e.g. to compute the array address) which makes it top. > > ## Fix > > A possible fix is to introduce an opaque node (OpaqueGuardNode) similar to what we do in `must_be_not_null` for values that we know cannot be null: > https://github.com/openjdk/jdk/blob/ce721665cd61d9a319c667d50d9917c359d6c104/src/hotspot/share/opto/graphKit.cpp#L1484 > This will temporarily add the range check to ensure that C2 figures that out-of-range values cannot reach the intrinsic. Then, during macro expansion, we replace the opaque node with the corresponding constant (true/false) in product builds such that the actually unneeded guards are folded and do not end up in the emitted code. > > # Testing > > * Tier 1-3+ > * 2 JTReg tests added > * `TestRangeCheck.java` as regression test for the reported issue > * `TestOpaqueGuardNodes.java` to check that opaque guard nodes are added when parsing and removed at macro expansion Damon Fenacci has updated the pull request incrementally with two additional commits since the last revision: - JDK-8374582: remove empty line - JDK-8374582: add constant dump ------------- Changes: - all: https://git.openjdk.org/jdk/pull/29164/files - new: https://git.openjdk.org/jdk/pull/29164/files/0d4eef88..44b68dbc Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=29164&range=11 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29164&range=10-11 Stats: 7 lines in 2 files changed: 7 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/29164.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29164/head:pull/29164 PR: https://git.openjdk.org/jdk/pull/29164 From dfenacci at openjdk.org Mon Feb 2 14:05:43 2026 From: dfenacci at openjdk.org (Damon Fenacci) Date: Mon, 2 Feb 2026 14:05:43 GMT Subject: RFR: 8374582: [REDO] Move input validation checks to Java for java.lang.StringCoding intrinsics [v10] In-Reply-To: References: <3ci9RXEra2BlQPhYl-M0Wnu3hRpWaDvxPnMRzFnJA_k=.67795fb3-95d1-449b-a7a9-44b3776aa626@github.com> Message-ID: <9TRsuJgH4W8hsmU02_3jXvLwPotWWdihBDjXoA_DZ3A=.577eb61f-6333-4cca-ad89-bc17c73bb660@github.com> On Mon, 2 Feb 2026 13:26:12 GMT, Christian Hagedorn wrote: > So, I would rather have a field if I may break Let's go with the field then ? > ```NOT_PRODUCT(void dump_spec(outputStream* st) const);``` Good idea! Added. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29164#discussion_r2754497278 From thartmann at openjdk.org Mon Feb 2 16:02:56 2026 From: thartmann at openjdk.org (Tobias Hartmann) Date: Mon, 2 Feb 2026 16:02:56 GMT Subject: RFR: 8374582: [REDO] Move input validation checks to Java for java.lang.StringCoding intrinsics [v12] In-Reply-To: <2_bA8sRgRlbc279Aia0oD9gPBn8bcD5kLP3RnA4Xl4Q=.deaeaaf0-27a1-40f8-81f3-c8283c4d9529@github.com> References: <3ci9RXEra2BlQPhYl-M0Wnu3hRpWaDvxPnMRzFnJA_k=.67795fb3-95d1-449b-a7a9-44b3776aa626@github.com> <2_bA8sRgRlbc279Aia0oD9gPBn8bcD5kLP3RnA4Xl4Q=.deaeaaf0-27a1-40f8-81f3-c8283c4d9529@github.com> Message-ID: <_mVonDnsPn3yCi7haKqAlC_3iD8GNOojYbMt4xuUf_Y=.2c887c19-5dba-4501-bec4-faba0a2dca9b@github.com> On Mon, 2 Feb 2026 14:03:00 GMT, Damon Fenacci wrote: >> ## Issue >> >> This is a redo of [JDK-8361842](https://bugs.openjdk.org/browse/JDK-8361842) which was backed out by [JDK-8374210](https://bugs.openjdk.org/browse/JDK-8374210) due to C2-related regressions. The original change moved input validation checks for java.lang.StringCoding from the intrinsic to Java code (leaving the intrinsic check only with the `VerifyIntrinsicChecks` flag). Refer to the [original PR](https://github.com/openjdk/jdk/pull/25998) for details. >> >> This additional issue happens because, in some cases, for instance when the Java checking code is not inlined and we give an out-of-range constant as input, we fold the data path but not the control path and we crash in the backend. >> >> ## Causes >> >> The cause of this is that the out-of-range constant (e.g. -1) floats into the intrinsic and there (assuming the input is valid) we add a constraint to its type to positive integers (e.g. to compute the array address) which makes it top. >> >> ## Fix >> >> A possible fix is to introduce an opaque node (OpaqueGuardNode) similar to what we do in `must_be_not_null` for values that we know cannot be null: >> https://github.com/openjdk/jdk/blob/ce721665cd61d9a319c667d50d9917c359d6c104/src/hotspot/share/opto/graphKit.cpp#L1484 >> This will temporarily add the range check to ensure that C2 figures that out-of-range values cannot reach the intrinsic. Then, during macro expansion, we replace the opaque node with the corresponding constant (true/false) in product builds such that the actually unneeded guards are folded and do not end up in the emitted code. >> >> # Testing >> >> * Tier 1-3+ >> * 2 JTReg tests added >> * `TestRangeCheck.java` as regression test for the reported issue >> * `TestOpaqueGuardNodes.java` to check that opaque guard nodes are added when parsing and removed at macro expansion > > Damon Fenacci has updated the pull request incrementally with two additional commits since the last revision: > > - JDK-8374582: remove empty line > - JDK-8374582: add constant dump That looks good to me. ------------- Marked as reviewed by thartmann (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/29164#pullrequestreview-3740390312 From alanb at openjdk.org Tue Feb 3 12:04:40 2026 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 3 Feb 2026 12:04:40 GMT Subject: RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v23] In-Reply-To: References: Message-ID: On Sun, 1 Feb 2026 12:55:29 GMT, Tatsunori Uchino wrote: >> Adds `codePointCount()` overloads to `String`, `Character`, `(Abstract)StringBuilder`, and `StringBuffer` to make it possible to conveniently retrieve the length of a string as code points without extra boundary checks. >> >> >> if (superTremendouslyLongExpressionYieldingAString().codePointCount() > limit) { >> throw new Exception("exceeding length"); >> } >> >> >> Is a CSR required to this change? > > Tatsunori Uchino has updated the pull request incrementally with two additional commits since the last revision: > > - Add comment > - Fix logic error src/java.base/share/classes/java/lang/String.java line 1886: > 1884: * @since 27 > 1885: */ > 1886: public int codePointCount() { Are you planning to override the API docs here to say that it returns the number of Unicode code points in this String? That would get the API docs consistent with the existing 3-arg codePointCount and avoid referencing the String as a character sequence in the String docs. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26461#discussion_r2758723775 From naoto at openjdk.org Tue Feb 3 16:53:34 2026 From: naoto at openjdk.org (Naoto Sato) Date: Tue, 3 Feb 2026 16:53:34 GMT Subject: RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v23] In-Reply-To: References: Message-ID: <0nrxPt9EBTADN3jACynCXe6V3kf0duVrvdT-mcD-nqo=.a0764e66-8f41-4632-aa88-4bdd163e9e79@github.com> On Tue, 3 Feb 2026 11:59:21 GMT, Alan Bateman wrote: >> Tatsunori Uchino has updated the pull request incrementally with two additional commits since the last revision: >> >> - Add comment >> - Fix logic error > > src/java.base/share/classes/java/lang/String.java line 1886: > >> 1884: * @since 27 >> 1885: */ >> 1886: public int codePointCount() { > > Are you planning to override the API docs here to say that it returns the number of Unicode code points in this String? That would get the API docs consistent with the existing 3-arg codePointCount and avoid referencing the String as a character sequence in the String docs. That was my suggestion to remove the text, as the generated javadoc apparently shows the text is from CharSequence. It sure does replacing the CharSequence with String aligns with the other method, but it also introduces copying the almost identical text, which could introduce editorial left over if CharSequence text changes. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26461#discussion_r2760034348 From duke at openjdk.org Wed Feb 4 12:41:32 2026 From: duke at openjdk.org (Tatsunori Uchino) Date: Wed, 4 Feb 2026 12:41:32 GMT Subject: RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v23] In-Reply-To: References: Message-ID: On Sun, 1 Feb 2026 12:55:29 GMT, Tatsunori Uchino wrote: >> Adds `codePointCount()` overloads to `String`, `Character`, `(Abstract)StringBuilder`, and `StringBuffer` to make it possible to conveniently retrieve the length of a string as code points without extra boundary checks. >> >> >> if (superTremendouslyLongExpressionYieldingAString().codePointCount() > limit) { >> throw new Exception("exceeding length"); >> } >> >> >> Is a CSR required to this change? > > Tatsunori Uchino has updated the pull request incrementally with two additional commits since the last revision: > > - Add comment > - Fix logic error Can I commit test\jdk\java\nio\Buffer\build\tools\sp\Spp.class? It was generated by `genBasic.sh`. The other files were not changed. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26461#issuecomment-3847208289 From alanb at openjdk.org Wed Feb 4 14:26:21 2026 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 4 Feb 2026 14:26:21 GMT Subject: RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v23] In-Reply-To: References: Message-ID: On Wed, 4 Feb 2026 12:39:07 GMT, Tatsunori Uchino wrote: > Can I commit test\jdk\java\nio\Buffer\build\tools\sp\Spp.class? It was generated by `genBasic.sh`. The other files were not changed. Only updated .java files should be commit, not the class files (or the class files for the tool). ------------- PR Comment: https://git.openjdk.org/jdk/pull/26461#issuecomment-3847765110 From prr at openjdk.org Wed Feb 4 20:42:39 2026 From: prr at openjdk.org (Phil Race) Date: Wed, 4 Feb 2026 20:42:39 GMT Subject: RFR: 8377191: Remove AppContext from KeyboardFocusManager Message-ID: Remove AppContext from KeyboardFocusManager ------------- Commit messages: - 8377191 Changes: https://git.openjdk.org/jdk/pull/29578/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29578&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8377191 Stats: 192 lines in 7 files changed: 6 ins; 142 del; 44 mod Patch: https://git.openjdk.org/jdk/pull/29578.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29578/head:pull/29578 PR: https://git.openjdk.org/jdk/pull/29578 From prr at openjdk.org Wed Feb 4 20:42:40 2026 From: prr at openjdk.org (Phil Race) Date: Wed, 4 Feb 2026 20:42:40 GMT Subject: RFR: 8377191: Remove AppContext from KeyboardFocusManager In-Reply-To: References: Message-ID: On Wed, 4 Feb 2026 20:33:12 GMT, Phil Race wrote: > Remove AppContext from KeyboardFocusManager src/java.desktop/share/classes/sun/awt/SunToolkit.java line 429: > 427: } > 428: > 429: public static void postEvent(AWTEvent event) { The non-app context versions of various SunToolkit methods will eventually replace the overloads with AppContext. I'm adding similar overloads to other methods in other PRs that may be concurrent so please don't ask for a (c) year update - that'll just be a merge conflict. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29578#discussion_r2765892683 From chagedorn at openjdk.org Thu Feb 5 06:37:32 2026 From: chagedorn at openjdk.org (Christian Hagedorn) Date: Thu, 5 Feb 2026 06:37:32 GMT Subject: RFR: 8374582: [REDO] Move input validation checks to Java for java.lang.StringCoding intrinsics [v12] In-Reply-To: <2_bA8sRgRlbc279Aia0oD9gPBn8bcD5kLP3RnA4Xl4Q=.deaeaaf0-27a1-40f8-81f3-c8283c4d9529@github.com> References: <3ci9RXEra2BlQPhYl-M0Wnu3hRpWaDvxPnMRzFnJA_k=.67795fb3-95d1-449b-a7a9-44b3776aa626@github.com> <2_bA8sRgRlbc279Aia0oD9gPBn8bcD5kLP3RnA4Xl4Q=.deaeaaf0-27a1-40f8-81f3-c8283c4d9529@github.com> Message-ID: On Mon, 2 Feb 2026 14:03:00 GMT, Damon Fenacci wrote: >> ## Issue >> >> This is a redo of [JDK-8361842](https://bugs.openjdk.org/browse/JDK-8361842) which was backed out by [JDK-8374210](https://bugs.openjdk.org/browse/JDK-8374210) due to C2-related regressions. The original change moved input validation checks for java.lang.StringCoding from the intrinsic to Java code (leaving the intrinsic check only with the `VerifyIntrinsicChecks` flag). Refer to the [original PR](https://github.com/openjdk/jdk/pull/25998) for details. >> >> This additional issue happens because, in some cases, for instance when the Java checking code is not inlined and we give an out-of-range constant as input, we fold the data path but not the control path and we crash in the backend. >> >> ## Causes >> >> The cause of this is that the out-of-range constant (e.g. -1) floats into the intrinsic and there (assuming the input is valid) we add a constraint to its type to positive integers (e.g. to compute the array address) which makes it top. >> >> ## Fix >> >> A possible fix is to introduce an opaque node (OpaqueGuardNode) similar to what we do in `must_be_not_null` for values that we know cannot be null: >> https://github.com/openjdk/jdk/blob/ce721665cd61d9a319c667d50d9917c359d6c104/src/hotspot/share/opto/graphKit.cpp#L1484 >> This will temporarily add the range check to ensure that C2 figures that out-of-range values cannot reach the intrinsic. Then, during macro expansion, we replace the opaque node with the corresponding constant (true/false) in product builds such that the actually unneeded guards are folded and do not end up in the emitted code. >> >> # Testing >> >> * Tier 1-3+ >> * 2 JTReg tests added >> * `TestRangeCheck.java` as regression test for the reported issue >> * `TestOpaqueGuardNodes.java` to check that opaque guard nodes are added when parsing and removed at macro expansion > > Damon Fenacci has updated the pull request incrementally with two additional commits since the last revision: > > - JDK-8374582: remove empty line > - JDK-8374582: add constant dump Thanks for the updates Damon, looks good to me, too! ------------- Marked as reviewed by chagedorn (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/29164#pullrequestreview-3754821230 From naoto at openjdk.org Thu Feb 5 17:35:37 2026 From: naoto at openjdk.org (Naoto Sato) Date: Thu, 5 Feb 2026 17:35:37 GMT Subject: RFR: 8377013: TimeZone.getDefault() returns obsolete id on Windows (Asia/Calcutta) Message-ID: Fixing the Windows default time zones returned from `TimeZone.getDefault()` for some regions. On Windows, it uses their own regions for time zones that aren't 1-1 match to IANA's TZ database. Thus a mapping table is created as `conf/tzmappings` on Windows Java runtime. It is derived from CLDR's `windowsZones.xml` but it uses the obsolete IANA ids for their compatibility reasons. The fix is to replace the CLDR's old ids to the latest IANA ids for those regions. Since it is hard to provide an automated test, as it involves the modification of the Windows' default time zone, regression test is not provided. Instead the fix is manually confirmed using the JIRA issue's example. Since this is a change in behavior, I will file a corresponding CSR/RN. Here is the diff of the generated `conf/tzmappings` for reference: @@ -13,7 +13,7 @@ Arabian Standard Time:ZZ:Etc/GMT-4: Arabian Standard Time:001:Asia/Dubai: Arabic Standard Time:001:Asia/Baghdad: -Argentina Standard Time:001:America/Buenos_Aires: +Argentina Standard Time:001:America/Argentina/Buenos_Aires: Astrakhan Standard Time:001:Europe/Astrakhan: Atlantic Standard Time:BM:Atlantic/Bermuda: Atlantic Standard Time:GL:America/Thule: @@ -58,7 +58,7 @@ Central European Standard Time:MK:Europe/Skopje: Central European Standard Time:001:Europe/Warsaw: Central Pacific Standard Time:AQ:Antarctica/Casey: -Central Pacific Standard Time:FM:Pacific/Ponape: +Central Pacific Standard Time:FM:Pacific/Pohnpei: Central Pacific Standard Time:NC:Pacific/Noumea: Central Pacific Standard Time:VU:Pacific/Efate: Central Pacific Standard Time:ZZ:Etc/GMT-11: @@ -75,7 +75,7 @@ Dateline Standard Time:001:Etc/GMT+12: E. Africa Standard Time:AQ:Antarctica/Syowa: E. Africa Standard Time:DJ:Africa/Djibouti: -E. Africa Standard Time:ER:Africa/Asmera: +E. Africa Standard Time:ER:Africa/Asmara: E. Africa Standard Time:ET:Africa/Addis_Ababa: E. Africa Standard Time:KM:Indian/Comoro: E. Africa Standard Time:MG:Indian/Antananarivo: @@ -101,10 +101,10 @@ FLE Standard Time:FI:Europe/Helsinki: FLE Standard Time:LT:Europe/Vilnius: FLE Standard Time:LV:Europe/Riga: -FLE Standard Time:001:Europe/Kiev: +FLE Standard Time:001:Europe/Kyiv: Fiji Standard Time:001:Pacific/Fiji: GMT Standard Time:ES:Atlantic/Canary: -GMT Standard Time:FO:Atlantic/Faeroe: +GMT Standard Time:FO:Atlantic/Faroe: GMT Standard Time:GG:Europe/Guernsey: GMT Standard Time:IE:Europe/Dublin: GMT Standard Time:IM:Europe/Isle_of_Man: @@ -115,7 +115,7 @@ GTB Standard Time:GR:Europe/Athens: GTB Standard Time:001:Europe/Bucharest: Georgian Standard Time:001:Asia/Tbilisi: -Greenland Standard Time:001:America/Godthab: +Greenland Standard Time:001:America/Nuuk: Greenwich Standard Time:BF:Africa/Ouagadougou: Greenwich Standard Time:CI:Africa/Abidjan: Greenwich Standard Time:GH:Africa/Accra: @@ -136,7 +136,7 @@ Hawaiian Standard Time:PF:Pacific/Tahiti: Hawaiian Standard Time:ZZ:Etc/GMT+10: Hawaiian Standard Time:001:Pacific/Honolulu: -India Standard Time:001:Asia/Calcutta: +India Standard Time:001:Asia/Kolkata: Iran Standard Time:001:Asia/Tehran: Israel Standard Time:001:Asia/Jerusalem: Jordan Standard Time:001:Asia/Amman: @@ -161,10 +161,10 @@ Mountain Standard Time:001:America/Denver: Mountain Standard Time (Mexico):001:America/Mazatlan: Myanmar Standard Time:CC:Indian/Cocos: -Myanmar Standard Time:001:Asia/Rangoon: +Myanmar Standard Time:001:Asia/Yangon: N. Central Asia Standard Time:001:Asia/Novosibirsk: Namibia Standard Time:001:Africa/Windhoek: -Nepal Standard Time:001:Asia/Katmandu: +Nepal Standard Time:001:Asia/Kathmandu: New Zealand Standard Time:AQ:Antarctica/McMurdo: New Zealand Standard Time:001:Pacific/Auckland: Newfoundland Standard Time:001:America/St_Johns: @@ -196,7 +196,7 @@ SA Eastern Standard Time:ZZ:Etc/GMT+3: SA Eastern Standard Time:001:America/Cayenne: SA Pacific Standard Time:BR:America/Rio_Branco: -SA Pacific Standard Time:CA:America/Coral_Harbour: +SA Pacific Standard Time:CA:America/Atikokan: SA Pacific Standard Time:EC:America/Guayaquil: SA Pacific Standard Time:JM:America/Jamaica: SA Pacific Standard Time:KY:America/Cayman: @@ -236,7 +236,7 @@ SE Asia Standard Time:ID:Asia/Jakarta: SE Asia Standard Time:KH:Asia/Phnom_Penh: SE Asia Standard Time:LA:Asia/Vientiane: -SE Asia Standard Time:VN:Asia/Saigon: +SE Asia Standard Time:VN:Asia/Ho_Chi_Minh: SE Asia Standard Time:ZZ:Etc/GMT-7: SE Asia Standard Time:001:Asia/Bangkok: Saint Pierre Standard Time:001:America/Miquelon: @@ -279,7 +279,7 @@ Transbaikal Standard Time:001:Asia/Chita: Turkey Standard Time:001:Europe/Istanbul: Turks And Caicos Standard Time:001:America/Grand_Turk: -US Eastern Standard Time:001:America/Indianapolis: +US Eastern Standard Time:001:America/Indiana/Indianapolis: US Mountain Standard Time:CA:America/Creston: US Mountain Standard Time:MX:America/Hermosillo: US Mountain Standard Time:ZZ:Etc/GMT+7: @@ -292,7 +292,7 @@ UTC+12:UM:Pacific/Wake: UTC+12:WF:Pacific/Wallis: UTC+12:001:Etc/GMT-12: -UTC+13:KI:Pacific/Enderbury: +UTC+13:KI:Pacific/Kanton: UTC+13:TK:Pacific/Fakaofo: UTC+13:001:Etc/GMT-13: UTC-02:BR:America/Noronha: @@ -352,7 +352,7 @@ West Asia Standard Time:001:Asia/Tashkent: West Bank Standard Time:001:Asia/Hebron: West Pacific Standard Time:AQ:Antarctica/DumontDUrville: -West Pacific Standard Time:FM:Pacific/Truk: +West Pacific Standard Time:FM:Pacific/Chuuk: West Pacific Standard Time:GU:Pacific/Guam: West Pacific Standard Time:MP:Pacific/Saipan: West Pacific Standard Time:ZZ:Etc/GMT-10: ------------- Commit messages: - initial commit Changes: https://git.openjdk.org/jdk/pull/29591/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29591&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8377013 Stats: 28 lines in 3 files changed: 23 ins; 1 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/29591.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29591/head:pull/29591 PR: https://git.openjdk.org/jdk/pull/29591 From jlu at openjdk.org Thu Feb 5 22:53:04 2026 From: jlu at openjdk.org (Justin Lu) Date: Thu, 5 Feb 2026 22:53:04 GMT Subject: RFR: 8377013: TimeZone.getDefault() returns obsolete id on Windows (Asia/Calcutta) In-Reply-To: References: Message-ID: On Thu, 5 Feb 2026 17:27:22 GMT, Naoto Sato wrote: > Fixing the Windows default time zones returned from `TimeZone.getDefault()` for some regions. On Windows, it uses their own regions for time zones that aren't 1-1 match to IANA's TZ database. Thus a mapping table is created as `conf/tzmappings` on Windows Java runtime. It is derived from CLDR's `windowsZones.xml` but it uses the obsolete IANA ids for their compatibility reasons. The fix is to replace the CLDR's old ids to the latest IANA ids for those regions. > Since it is hard to provide an automated test, as it involves the modification of the Windows' default time zone, regression test is not provided. Instead the fix is manually confirmed using the JIRA issue's example. Since this is a change in behavior, I will file a corresponding CSR/RN. > > Here is the diff of the generated `conf/tzmappings` for reference: > > @@ -13,7 +13,7 @@ > Arabian Standard Time:ZZ:Etc/GMT-4: > Arabian Standard Time:001:Asia/Dubai: > Arabic Standard Time:001:Asia/Baghdad: > -Argentina Standard Time:001:America/Buenos_Aires: > +Argentina Standard Time:001:America/Argentina/Buenos_Aires: > Astrakhan Standard Time:001:Europe/Astrakhan: > Atlantic Standard Time:BM:Atlantic/Bermuda: > Atlantic Standard Time:GL:America/Thule: > @@ -58,7 +58,7 @@ > Central European Standard Time:MK:Europe/Skopje: > Central European Standard Time:001:Europe/Warsaw: > Central Pacific Standard Time:AQ:Antarctica/Casey: > -Central Pacific Standard Time:FM:Pacific/Ponape: > +Central Pacific Standard Time:FM:Pacific/Pohnpei: > Central Pacific Standard Time:NC:Pacific/Noumea: > Central Pacific Standard Time:VU:Pacific/Efate: > Central Pacific Standard Time:ZZ:Etc/GMT-11: > @@ -75,7 +75,7 @@ > Dateline Standard Time:001:Etc/GMT+12: > E. Africa Standard Time:AQ:Antarctica/Syowa: > E. Africa Standard Time:DJ:Africa/Djibouti: > -E. Africa Standard Time:ER:Africa/Asmera: > +E. Africa Standard Time:ER:Africa/Asmara: > E. Africa Standard Time:ET:Africa/Addis_Ababa: > E. Africa Standard Time:KM:Indian/Comoro: > E. Africa Standard Time:MG:Indian/Antananarivo: > @@ -101,10 +101,10 @@ > FLE Standard Time:FI:Europe/Helsinki: > FLE Standard Time:LT:Europe/Vilnius: > FLE Standard Time:LV:Europe/Riga: > -FLE Standard Time:001:Europe/Kiev: > +FLE Standard Time:001:Europe/Kyiv: > Fiji Standard Time:001:Pacific/Fiji: > GMT Standard Time:ES:Atlantic/Canary: > -GMT Standard Time:FO:Atlantic/Faeroe: > +GMT Standard Time:FO:Atlantic/Faroe: > GMT Standard Time:GG:Europe/Guernsey: > GMT Standard Time:IE:Europe/Dublin: > GMT Standard Time:IM:Europe/Isle_of_Man: > @@ -115,7 +115,7 @@ > GTB St... make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java line 296: > 294: > 295: // Parse data independent of locales > 296: parseBCP47(); Perhaps a comment either here or in `bcp47()` which indicates that parseBCP47 **must** precede `parseSupplemental()` such that the aliases can be derived from _timezone.xml_ first. make/jdk/src/classes/build/tools/cldrconverter/TimeZoneParseHandler.java line 45: > 43: class TimeZoneParseHandler extends AbstractLDMLHandler { > 44: private static final String PREF_PREFIX = "preferred:"; > 45: private final Map ianaAliasMap = HashMap.newHashMap(32); To give a sense of understanding, I recommend adding a comment indicating that the size of the `ianaAliasMap` can be estimated from the number of `iana` attributes present in _timezone.xml_. Including the CLDR version in this comment would help with locating and updating the size when CLDR data is upgraded in the JDK. make/jdk/src/classes/build/tools/cldrconverter/TimeZoneParseHandler.java line 72: > 70: if (iana != null) { > 71: for (var a : alias.split("\\s+")) { > 72: ianaAliasMap.put(a, iana); I think we should add a check to not add `a` to the `ianaAliasMap` if `a` is equal to `iana`, since the mapping would be identical. E.g. "Asia/Kolkata" -> "Asia/Kolkata". ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29591#discussion_r2771466800 PR Review Comment: https://git.openjdk.org/jdk/pull/29591#discussion_r2771442549 PR Review Comment: https://git.openjdk.org/jdk/pull/29591#discussion_r2771318244 From jlu at openjdk.org Thu Feb 5 22:53:05 2026 From: jlu at openjdk.org (Justin Lu) Date: Thu, 5 Feb 2026 22:53:05 GMT Subject: RFR: 8377013: TimeZone.getDefault() returns obsolete id on Windows (Asia/Calcutta) In-Reply-To: References: Message-ID: On Thu, 5 Feb 2026 22:32:16 GMT, Justin Lu wrote: >> Fixing the Windows default time zones returned from `TimeZone.getDefault()` for some regions. On Windows, it uses their own regions for time zones that aren't 1-1 match to IANA's TZ database. Thus a mapping table is created as `conf/tzmappings` on Windows Java runtime. It is derived from CLDR's `windowsZones.xml` but it uses the obsolete IANA ids for their compatibility reasons. The fix is to replace the CLDR's old ids to the latest IANA ids for those regions. >> Since it is hard to provide an automated test, as it involves the modification of the Windows' default time zone, regression test is not provided. Instead the fix is manually confirmed using the JIRA issue's example. Since this is a change in behavior, I will file a corresponding CSR/RN. >> >> Here is the diff of the generated `conf/tzmappings` for reference: >> >> @@ -13,7 +13,7 @@ >> Arabian Standard Time:ZZ:Etc/GMT-4: >> Arabian Standard Time:001:Asia/Dubai: >> Arabic Standard Time:001:Asia/Baghdad: >> -Argentina Standard Time:001:America/Buenos_Aires: >> +Argentina Standard Time:001:America/Argentina/Buenos_Aires: >> Astrakhan Standard Time:001:Europe/Astrakhan: >> Atlantic Standard Time:BM:Atlantic/Bermuda: >> Atlantic Standard Time:GL:America/Thule: >> @@ -58,7 +58,7 @@ >> Central European Standard Time:MK:Europe/Skopje: >> Central European Standard Time:001:Europe/Warsaw: >> Central Pacific Standard Time:AQ:Antarctica/Casey: >> -Central Pacific Standard Time:FM:Pacific/Ponape: >> +Central Pacific Standard Time:FM:Pacific/Pohnpei: >> Central Pacific Standard Time:NC:Pacific/Noumea: >> Central Pacific Standard Time:VU:Pacific/Efate: >> Central Pacific Standard Time:ZZ:Etc/GMT-11: >> @@ -75,7 +75,7 @@ >> Dateline Standard Time:001:Etc/GMT+12: >> E. Africa Standard Time:AQ:Antarctica/Syowa: >> E. Africa Standard Time:DJ:Africa/Djibouti: >> -E. Africa Standard Time:ER:Africa/Asmera: >> +E. Africa Standard Time:ER:Africa/Asmara: >> E. Africa Standard Time:ET:Africa/Addis_Ababa: >> E. Africa Standard Time:KM:Indian/Comoro: >> E. Africa Standard Time:MG:Indian/Antananarivo: >> @@ -101,10 +101,10 @@ >> FLE Standard Time:FI:Europe/Helsinki: >> FLE Standard Time:LT:Europe/Vilnius: >> FLE Standard Time:LV:Europe/Riga: >> -FLE Standard Time:001:Europe/Kiev: >> +FLE Standard Time:001:Europe/Kyiv: >> Fiji Standard Time:001:Pacific/Fiji: >> GMT Standard Time:ES:Atlantic/Canary: >> -GMT Standard Time:FO:Atlantic/Faeroe: >> +GMT Standard Time:FO:Atlantic/Faroe: >> GMT Standard Time:GG:Europe/Guernsey: >> GMT Standard Time... > > make/jdk/src/classes/build/tools/cldrconverter/TimeZoneParseHandler.java line 45: > >> 43: class TimeZoneParseHandler extends AbstractLDMLHandler { >> 44: private static final String PREF_PREFIX = "preferred:"; >> 45: private final Map ianaAliasMap = HashMap.newHashMap(32); > > To give a sense of understanding, I recommend adding a comment indicating that the size of the `ianaAliasMap` can be estimated from the number of `iana` attributes present in _timezone.xml_. Including the CLDR version in this comment would help with locating and updating the size when CLDR data is upgraded in the JDK. Separately, the size of the map seems to be 45 (and 26 when adding the identity check I noted below). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29591#discussion_r2771444477 From naoto at openjdk.org Fri Feb 6 00:32:13 2026 From: naoto at openjdk.org (Naoto Sato) Date: Fri, 6 Feb 2026 00:32:13 GMT Subject: RFR: 8377013: TimeZone.getDefault() returns obsolete id on Windows (Asia/Calcutta) [v2] In-Reply-To: References: Message-ID: > Fixing the Windows default time zones returned from `TimeZone.getDefault()` for some regions. On Windows, it uses their own regions for time zones that aren't 1-1 match to IANA's TZ database. Thus a mapping table is created as `conf/tzmappings` on Windows Java runtime. It is derived from CLDR's `windowsZones.xml` but it uses the obsolete IANA ids for their compatibility reasons. The fix is to replace the CLDR's old ids to the latest IANA ids for those regions. > Since it is hard to provide an automated test, as it involves the modification of the Windows' default time zone, regression test is not provided. Instead the fix is manually confirmed using the JIRA issue's example. Since this is a change in behavior, I will file a corresponding CSR/RN. > > Here is the diff of the generated `conf/tzmappings` for reference: > > @@ -13,7 +13,7 @@ > Arabian Standard Time:ZZ:Etc/GMT-4: > Arabian Standard Time:001:Asia/Dubai: > Arabic Standard Time:001:Asia/Baghdad: > -Argentina Standard Time:001:America/Buenos_Aires: > +Argentina Standard Time:001:America/Argentina/Buenos_Aires: > Astrakhan Standard Time:001:Europe/Astrakhan: > Atlantic Standard Time:BM:Atlantic/Bermuda: > Atlantic Standard Time:GL:America/Thule: > @@ -58,7 +58,7 @@ > Central European Standard Time:MK:Europe/Skopje: > Central European Standard Time:001:Europe/Warsaw: > Central Pacific Standard Time:AQ:Antarctica/Casey: > -Central Pacific Standard Time:FM:Pacific/Ponape: > +Central Pacific Standard Time:FM:Pacific/Pohnpei: > Central Pacific Standard Time:NC:Pacific/Noumea: > Central Pacific Standard Time:VU:Pacific/Efate: > Central Pacific Standard Time:ZZ:Etc/GMT-11: > @@ -75,7 +75,7 @@ > Dateline Standard Time:001:Etc/GMT+12: > E. Africa Standard Time:AQ:Antarctica/Syowa: > E. Africa Standard Time:DJ:Africa/Djibouti: > -E. Africa Standard Time:ER:Africa/Asmera: > +E. Africa Standard Time:ER:Africa/Asmara: > E. Africa Standard Time:ET:Africa/Addis_Ababa: > E. Africa Standard Time:KM:Indian/Comoro: > E. Africa Standard Time:MG:Indian/Antananarivo: > @@ -101,10 +101,10 @@ > FLE Standard Time:FI:Europe/Helsinki: > FLE Standard Time:LT:Europe/Vilnius: > FLE Standard Time:LV:Europe/Riga: > -FLE Standard Time:001:Europe/Kiev: > +FLE Standard Time:001:Europe/Kyiv: > Fiji Standard Time:001:Pacific/Fiji: > GMT Standard Time:ES:Atlantic/Canary: > -GMT Standard Time:FO:Atlantic/Faeroe: > +GMT Standard Time:FO:Atlantic/Faroe: > GMT Standard Time:GG:Europe/Guernsey: > GMT Standard Time:IE:Europe/Dublin: > GMT Standard Time:IM:Europe/Isle_of_Man: > @@ -115,7 +115,7 @@ > GTB St... Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: Reflects review comments ------------- Changes: - all: https://git.openjdk.org/jdk/pull/29591/files - new: https://git.openjdk.org/jdk/pull/29591/files/079e2f32..778b949f Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=29591&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29591&range=00-01 Stats: 8 lines in 2 files changed: 7 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/29591.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29591/head:pull/29591 PR: https://git.openjdk.org/jdk/pull/29591 From naoto at openjdk.org Fri Feb 6 00:32:14 2026 From: naoto at openjdk.org (Naoto Sato) Date: Fri, 6 Feb 2026 00:32:14 GMT Subject: RFR: 8377013: TimeZone.getDefault() returns obsolete id on Windows (Asia/Calcutta) In-Reply-To: References: Message-ID: On Thu, 5 Feb 2026 17:27:22 GMT, Naoto Sato wrote: > Fixing the Windows default time zones returned from `TimeZone.getDefault()` for some regions. On Windows, it uses their own regions for time zones that aren't 1-1 match to IANA's TZ database. Thus a mapping table is created as `conf/tzmappings` on Windows Java runtime. It is derived from CLDR's `windowsZones.xml` but it uses the obsolete IANA ids for their compatibility reasons. The fix is to replace the CLDR's old ids to the latest IANA ids for those regions. > Since it is hard to provide an automated test, as it involves the modification of the Windows' default time zone, regression test is not provided. Instead the fix is manually confirmed using the JIRA issue's example. Since this is a change in behavior, I will file a corresponding CSR/RN. > > Here is the diff of the generated `conf/tzmappings` for reference: > > @@ -13,7 +13,7 @@ > Arabian Standard Time:ZZ:Etc/GMT-4: > Arabian Standard Time:001:Asia/Dubai: > Arabic Standard Time:001:Asia/Baghdad: > -Argentina Standard Time:001:America/Buenos_Aires: > +Argentina Standard Time:001:America/Argentina/Buenos_Aires: > Astrakhan Standard Time:001:Europe/Astrakhan: > Atlantic Standard Time:BM:Atlantic/Bermuda: > Atlantic Standard Time:GL:America/Thule: > @@ -58,7 +58,7 @@ > Central European Standard Time:MK:Europe/Skopje: > Central European Standard Time:001:Europe/Warsaw: > Central Pacific Standard Time:AQ:Antarctica/Casey: > -Central Pacific Standard Time:FM:Pacific/Ponape: > +Central Pacific Standard Time:FM:Pacific/Pohnpei: > Central Pacific Standard Time:NC:Pacific/Noumea: > Central Pacific Standard Time:VU:Pacific/Efate: > Central Pacific Standard Time:ZZ:Etc/GMT-11: > @@ -75,7 +75,7 @@ > Dateline Standard Time:001:Etc/GMT+12: > E. Africa Standard Time:AQ:Antarctica/Syowa: > E. Africa Standard Time:DJ:Africa/Djibouti: > -E. Africa Standard Time:ER:Africa/Asmera: > +E. Africa Standard Time:ER:Africa/Asmara: > E. Africa Standard Time:ET:Africa/Addis_Ababa: > E. Africa Standard Time:KM:Indian/Comoro: > E. Africa Standard Time:MG:Indian/Antananarivo: > @@ -101,10 +101,10 @@ > FLE Standard Time:FI:Europe/Helsinki: > FLE Standard Time:LT:Europe/Vilnius: > FLE Standard Time:LV:Europe/Riga: > -FLE Standard Time:001:Europe/Kiev: > +FLE Standard Time:001:Europe/Kyiv: > Fiji Standard Time:001:Pacific/Fiji: > GMT Standard Time:ES:Atlantic/Canary: > -GMT Standard Time:FO:Atlantic/Faeroe: > +GMT Standard Time:FO:Atlantic/Faroe: > GMT Standard Time:GG:Europe/Guernsey: > GMT Standard Time:IE:Europe/Dublin: > GMT Standard Time:IM:Europe/Isle_of_Man: > @@ -115,7 +115,7 @@ > GTB St... Thank you, Justin. I addressed your suggestions ------------- PR Comment: https://git.openjdk.org/jdk/pull/29591#issuecomment-3857126921 From dfenacci at openjdk.org Fri Feb 6 07:44:44 2026 From: dfenacci at openjdk.org (Damon Fenacci) Date: Fri, 6 Feb 2026 07:44:44 GMT Subject: RFR: 8374582: [REDO] Move input validation checks to Java for java.lang.StringCoding intrinsics In-Reply-To: References: <3ci9RXEra2BlQPhYl-M0Wnu3hRpWaDvxPnMRzFnJA_k=.67795fb3-95d1-449b-a7a9-44b3776aa626@github.com> Message-ID: On Fri, 23 Jan 2026 13:47:53 GMT, Volkan Yazici wrote: >> ## Issue >> >> This is a redo of [JDK-8361842](https://bugs.openjdk.org/browse/JDK-8361842) which was backed out by [JDK-8374210](https://bugs.openjdk.org/browse/JDK-8374210) due to C2-related regressions. The original change moved input validation checks for java.lang.StringCoding from the intrinsic to Java code (leaving the intrinsic check only with the `VerifyIntrinsicChecks` flag). Refer to the [original PR](https://github.com/openjdk/jdk/pull/25998) for details. >> >> This additional issue happens because, in some cases, for instance when the Java checking code is not inlined and we give an out-of-range constant as input, we fold the data path but not the control path and we crash in the backend. >> >> ## Causes >> >> The cause of this is that the out-of-range constant (e.g. -1) floats into the intrinsic and there (assuming the input is valid) we add a constraint to its type to positive integers (e.g. to compute the array address) which makes it top. >> >> ## Fix >> >> A possible fix is to introduce an opaque node (OpaqueGuardNode) similar to what we do in `must_be_not_null` for values that we know cannot be null: >> https://github.com/openjdk/jdk/blob/ce721665cd61d9a319c667d50d9917c359d6c104/src/hotspot/share/opto/graphKit.cpp#L1484 >> This will temporarily add the range check to ensure that C2 figures that out-of-range values cannot reach the intrinsic. Then, during macro expansion, we replace the opaque node with the corresponding constant (true/false) in product builds such that the actually unneeded guards are folded and do not end up in the emitted code. >> >> # Testing >> >> * Tier 1-3+ >> * 2 JTReg tests added >> * `TestRangeCheck.java` as regression test for the reported issue >> * `TestOpaqueGuardNodes.java` to check that opaque guard nodes are added when parsing and removed at macro expansion > > I'd like to provide some help for reviewers: > > 1. [JDK-8361842] (integrated in 655dc516c22) implemented changes for `java.lang.StringCoding` > 2. [JDK-8374210] (integrated in 7e18de137c3) reported regressions against JDK-8361842, and used as the BACKOUT issue. > 3. [JDK-8374582] (this PR) is the REDO of JDK-8361842, plus the fix for regressions reported in JDK-8374210 > > That is, this PR starts with 3c466d372b7 (i.e, the revert of 7e18de137c3), and continues with the fix, which is **the interesting part, and that can be viewed by diff'ing 3c466d372b7...ff22857609d**. (ff22857609d is the last commit as of date.) > > [JDK-8361842]: https://bugs.openjdk.org/browse/JDK-8361842 > [JDK-8374210]: https://bugs.openjdk.org/browse/JDK-8374210 > [JDK-8374582]: https://bugs.openjdk.org/browse/JDK-8374582 Thanks a lot for your reviews @vy @chhagedorn @TobiHartmann! ------------- PR Comment: https://git.openjdk.org/jdk/pull/29164#issuecomment-3858562112 From dfenacci at openjdk.org Fri Feb 6 07:47:58 2026 From: dfenacci at openjdk.org (Damon Fenacci) Date: Fri, 6 Feb 2026 07:47:58 GMT Subject: Integrated: 8374582: [REDO] Move input validation checks to Java for java.lang.StringCoding intrinsics In-Reply-To: <3ci9RXEra2BlQPhYl-M0Wnu3hRpWaDvxPnMRzFnJA_k=.67795fb3-95d1-449b-a7a9-44b3776aa626@github.com> References: <3ci9RXEra2BlQPhYl-M0Wnu3hRpWaDvxPnMRzFnJA_k=.67795fb3-95d1-449b-a7a9-44b3776aa626@github.com> Message-ID: On Mon, 12 Jan 2026 10:29:39 GMT, Damon Fenacci wrote: > ## Issue > > This is a redo of [JDK-8361842](https://bugs.openjdk.org/browse/JDK-8361842) which was backed out by [JDK-8374210](https://bugs.openjdk.org/browse/JDK-8374210) due to C2-related regressions. The original change moved input validation checks for java.lang.StringCoding from the intrinsic to Java code (leaving the intrinsic check only with the `VerifyIntrinsicChecks` flag). Refer to the [original PR](https://github.com/openjdk/jdk/pull/25998) for details. > > This additional issue happens because, in some cases, for instance when the Java checking code is not inlined and we give an out-of-range constant as input, we fold the data path but not the control path and we crash in the backend. > > ## Causes > > The cause of this is that the out-of-range constant (e.g. -1) floats into the intrinsic and there (assuming the input is valid) we add a constraint to its type to positive integers (e.g. to compute the array address) which makes it top. > > ## Fix > > A possible fix is to introduce an opaque node (OpaqueGuardNode) similar to what we do in `must_be_not_null` for values that we know cannot be null: > https://github.com/openjdk/jdk/blob/ce721665cd61d9a319c667d50d9917c359d6c104/src/hotspot/share/opto/graphKit.cpp#L1484 > This will temporarily add the range check to ensure that C2 figures that out-of-range values cannot reach the intrinsic. Then, during macro expansion, we replace the opaque node with the corresponding constant (true/false) in product builds such that the actually unneeded guards are folded and do not end up in the emitted code. > > # Testing > > * Tier 1-3+ > * 2 JTReg tests added > * `TestRangeCheck.java` as regression test for the reported issue > * `TestOpaqueGuardNodes.java` to check that opaque guard nodes are added when parsing and removed at macro expansion This pull request has now been integrated. Changeset: bfd5bdaf Author: Damon Fenacci URL: https://git.openjdk.org/jdk/commit/bfd5bdaf7ffd96cf887fbbfe072414be38ee1b84 Stats: 462 lines in 36 files changed: 306 ins; 19 del; 137 mod 8374582: [REDO] Move input validation checks to Java for java.lang.StringCoding intrinsics Co-authored-by: Volkan Yazici Reviewed-by: chagedorn, thartmann, vyazici ------------- PR: https://git.openjdk.org/jdk/pull/29164 From cushon at openjdk.org Fri Feb 6 12:54:32 2026 From: cushon at openjdk.org (Liam Miller-Cushon) Date: Fri, 6 Feb 2026 12:54:32 GMT Subject: RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17] In-Reply-To: References: Message-ID: On Fri, 30 Jan 2026 15:56:20 GMT, Liam Miller-Cushon wrote: >> This implements an API to return the byte length of a String encoded in a given charset. See [JDK-8372353](https://bugs.openjdk.org/browse/JDK-8372353) for background. >> >> --- >> >> >> Benchmark (encoding) (stringLength) Mode Cnt Score Error Units >> StringLoopJmhBenchmark.getBytes ASCII 10 thrpt 5 406782650.595 ? 16960032.852 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 100 thrpt 5 172936926.189 ? 4532029.201 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 1000 thrpt 5 38830681.232 ? 2413274.766 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 100000 thrpt 5 458881.155 ? 12818.317 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 10 thrpt 5 37193762.990 ? 3962947.391 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 100 thrpt 5 55400876.236 ? 1267331.434 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 1000 thrpt 5 11104514.001 ? 41718.545 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 100000 thrpt 5 182535.414 ? 10296.120 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 10 thrpt 5 113474681.457 ? 8326589.199 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 100 thrpt 5 37854103.127 ? 4808526.773 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 1000 thrpt 5 4139833.009 ? 70636.784 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 100000 thrpt 5 57644.637 ? 1887.112 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 10 thrpt 5 946701647.247 ? 76938927.141 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 100 thrpt 5 396615374.479 ? 15167234.884 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 1000 thrpt 5 100464784.979 ? 794027.897 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 100000 thrpt 5 1215487.689 ? 1916.468 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 10 thrpt 5 221265102.323 ? 17013983.056 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 100 thrpt 5 137617873.887 ? 5842185.781 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 1000 thrpt 5 92540259.1... > > Liam Miller-Cushon has updated the pull request incrementally with one additional commit since the last revision: > > Rename getBytesLength to getByteLength Sorry for the last minute changes here. Folks who reviewed this, do you have any feedback on the changes in https://github.com/openjdk/jdk/pull/28454#issuecomment-3824421699 or the updates to the CSR? The change is renaming `getBytesLength` to `getByteLength`, and adding more discussion to the CSR about why the return type is `int` instead of `long`. ------------- PR Comment: https://git.openjdk.org/jdk/pull/28454#issuecomment-3860279135 From eirbjo at openjdk.org Fri Feb 6 13:51:03 2026 From: eirbjo at openjdk.org (Eirik =?UTF-8?B?QmrDuHJzbsO4cw==?=) Date: Fri, 6 Feb 2026 13:51:03 GMT Subject: RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17] In-Reply-To: References: Message-ID: On Fri, 30 Jan 2026 15:56:20 GMT, Liam Miller-Cushon wrote: >> This implements an API to return the byte length of a String encoded in a given charset. See [JDK-8372353](https://bugs.openjdk.org/browse/JDK-8372353) for background. >> >> --- >> >> >> Benchmark (encoding) (stringLength) Mode Cnt Score Error Units >> StringLoopJmhBenchmark.getBytes ASCII 10 thrpt 5 406782650.595 ? 16960032.852 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 100 thrpt 5 172936926.189 ? 4532029.201 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 1000 thrpt 5 38830681.232 ? 2413274.766 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 100000 thrpt 5 458881.155 ? 12818.317 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 10 thrpt 5 37193762.990 ? 3962947.391 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 100 thrpt 5 55400876.236 ? 1267331.434 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 1000 thrpt 5 11104514.001 ? 41718.545 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 100000 thrpt 5 182535.414 ? 10296.120 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 10 thrpt 5 113474681.457 ? 8326589.199 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 100 thrpt 5 37854103.127 ? 4808526.773 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 1000 thrpt 5 4139833.009 ? 70636.784 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 100000 thrpt 5 57644.637 ? 1887.112 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 10 thrpt 5 946701647.247 ? 76938927.141 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 100 thrpt 5 396615374.479 ? 15167234.884 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 1000 thrpt 5 100464784.979 ? 794027.897 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 100000 thrpt 5 1215487.689 ? 1916.468 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 10 thrpt 5 221265102.323 ? 17013983.056 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 100 thrpt 5 137617873.887 ? 5842185.781 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 1000 thrpt 5 92540259.1... > > Liam Miller-Cushon has updated the pull request incrementally with one additional commit since the last revision: > > Rename getBytesLength to getByteLength Excuse my last minute bikeshedding, but naming in `java.util.String` is important and everlasting, so here we go: I understand the reasoning behind `getBytesLength` / `getByteLength` aligning with the preexisting `getBytes` method. However, when seen as an independent API name, it seems quite weak. What is a "byte length" anyway? 8 bits? Any outsider/newcomer would need to dig into the API docs to figure out what this method does. Could we at least consider something with a stronger semantic expessiveness? May we also consider that this method could lean on `length()` instead of `getBytes()` ? What this returns is *the length in bytes of this String encoded with the given Charset*. Was `getEncodedLength` considered? I find it a bit revealing that the private implementation methods are named `encodedLength***`. So perhaps `encodedLength` could work? I expect this method to have few "regular" users. Maybe not confusing the 99% of String users that will never need this method is more important than improving discoverability for the 1%? If I'm right that this method will have few "regular" users, perhaps specialists could be better served finding it in `java.util.Charset`? ------------- PR Comment: https://git.openjdk.org/jdk/pull/28454#issuecomment-3860582916 From cushon at openjdk.org Fri Feb 6 14:10:54 2026 From: cushon at openjdk.org (Liam Miller-Cushon) Date: Fri, 6 Feb 2026 14:10:54 GMT Subject: RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17] In-Reply-To: References: Message-ID: On Fri, 30 Jan 2026 15:56:20 GMT, Liam Miller-Cushon wrote: >> This implements an API to return the byte length of a String encoded in a given charset. See [JDK-8372353](https://bugs.openjdk.org/browse/JDK-8372353) for background. >> >> --- >> >> >> Benchmark (encoding) (stringLength) Mode Cnt Score Error Units >> StringLoopJmhBenchmark.getBytes ASCII 10 thrpt 5 406782650.595 ? 16960032.852 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 100 thrpt 5 172936926.189 ? 4532029.201 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 1000 thrpt 5 38830681.232 ? 2413274.766 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 100000 thrpt 5 458881.155 ? 12818.317 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 10 thrpt 5 37193762.990 ? 3962947.391 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 100 thrpt 5 55400876.236 ? 1267331.434 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 1000 thrpt 5 11104514.001 ? 41718.545 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 100000 thrpt 5 182535.414 ? 10296.120 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 10 thrpt 5 113474681.457 ? 8326589.199 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 100 thrpt 5 37854103.127 ? 4808526.773 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 1000 thrpt 5 4139833.009 ? 70636.784 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 100000 thrpt 5 57644.637 ? 1887.112 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 10 thrpt 5 946701647.247 ? 76938927.141 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 100 thrpt 5 396615374.479 ? 15167234.884 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 1000 thrpt 5 100464784.979 ? 794027.897 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 100000 thrpt 5 1215487.689 ? 1916.468 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 10 thrpt 5 221265102.323 ? 17013983.056 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 100 thrpt 5 137617873.887 ? 5842185.781 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 1000 thrpt 5 92540259.1... > > Liam Miller-Cushon has updated the pull request incrementally with one additional commit since the last revision: > > Rename getBytesLength to getByteLength Thanks for the comments, re: `getEncodedLength` or `encodedLength`, those options where considered, although I didn't write them up as alternatives in the CSR. The main reason `getEncodedLength` wasn't used is that it doesn't make it clear that the unit of length is bytes. For UTF-8 a byte length is intuitive, for e.g. UTF-16 or UTF-32 the "encoded length" could also be the count of int16 (number of wchar_t) or int32. Including a `get` prefix or not was also considered, one benefit of `get` is that it aligns with `getBytes`, and also it may help convey that the method is doing computation (it's often going to be O(1), compared to e.g. `length()` which is O(1)). ------------- PR Comment: https://git.openjdk.org/jdk/pull/28454#issuecomment-3860683771 From jlu at openjdk.org Mon Feb 9 21:20:09 2026 From: jlu at openjdk.org (Justin Lu) Date: Mon, 9 Feb 2026 21:20:09 GMT Subject: RFR: 8377013: TimeZone.getDefault() returns obsolete id on Windows (Asia/Calcutta) [v2] In-Reply-To: References: Message-ID: On Fri, 6 Feb 2026 00:32:13 GMT, Naoto Sato wrote: >> Fixing the Windows default time zones returned from `TimeZone.getDefault()` for some regions. On Windows, it uses their own regions for time zones that aren't 1-1 match to IANA's TZ database. Thus a mapping table is created as `conf/tzmappings` on Windows Java runtime. It is derived from CLDR's `windowsZones.xml` but it uses the obsolete IANA ids for their compatibility reasons. The fix is to replace the CLDR's old ids to the latest IANA ids for those regions. >> Since it is hard to provide an automated test, as it involves the modification of the Windows' default time zone, regression test is not provided. Instead the fix is manually confirmed using the JIRA issue's example. Since this is a change in behavior, I will file a corresponding CSR/RN. >> >> Here is the diff of the generated `conf/tzmappings` for reference: >> >> @@ -13,7 +13,7 @@ >> Arabian Standard Time:ZZ:Etc/GMT-4: >> Arabian Standard Time:001:Asia/Dubai: >> Arabic Standard Time:001:Asia/Baghdad: >> -Argentina Standard Time:001:America/Buenos_Aires: >> +Argentina Standard Time:001:America/Argentina/Buenos_Aires: >> Astrakhan Standard Time:001:Europe/Astrakhan: >> Atlantic Standard Time:BM:Atlantic/Bermuda: >> Atlantic Standard Time:GL:America/Thule: >> @@ -58,7 +58,7 @@ >> Central European Standard Time:MK:Europe/Skopje: >> Central European Standard Time:001:Europe/Warsaw: >> Central Pacific Standard Time:AQ:Antarctica/Casey: >> -Central Pacific Standard Time:FM:Pacific/Ponape: >> +Central Pacific Standard Time:FM:Pacific/Pohnpei: >> Central Pacific Standard Time:NC:Pacific/Noumea: >> Central Pacific Standard Time:VU:Pacific/Efate: >> Central Pacific Standard Time:ZZ:Etc/GMT-11: >> @@ -75,7 +75,7 @@ >> Dateline Standard Time:001:Etc/GMT+12: >> E. Africa Standard Time:AQ:Antarctica/Syowa: >> E. Africa Standard Time:DJ:Africa/Djibouti: >> -E. Africa Standard Time:ER:Africa/Asmera: >> +E. Africa Standard Time:ER:Africa/Asmara: >> E. Africa Standard Time:ET:Africa/Addis_Ababa: >> E. Africa Standard Time:KM:Indian/Comoro: >> E. Africa Standard Time:MG:Indian/Antananarivo: >> @@ -101,10 +101,10 @@ >> FLE Standard Time:FI:Europe/Helsinki: >> FLE Standard Time:LT:Europe/Vilnius: >> FLE Standard Time:LV:Europe/Riga: >> -FLE Standard Time:001:Europe/Kiev: >> +FLE Standard Time:001:Europe/Kyiv: >> Fiji Standard Time:001:Pacific/Fiji: >> GMT Standard Time:ES:Atlantic/Canary: >> -GMT Standard Time:FO:Atlantic/Faeroe: >> +GMT Standard Time:FO:Atlantic/Faroe: >> GMT Standard Time:GG:Europe/Guernsey: >> GMT Standard Time... > > Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: > > Reflects review comments Marked as reviewed by jlu (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/29591#pullrequestreview-3774382646 From eirbjo at openjdk.org Mon Feb 9 21:30:52 2026 From: eirbjo at openjdk.org (Eirik =?UTF-8?B?QmrDuHJzbsO4cw==?=) Date: Mon, 9 Feb 2026 21:30:52 GMT Subject: RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17] In-Reply-To: References: Message-ID: <2BdASdHcWrwVR4vDUls8cwb_c3jNMRjLr1b551JsVvg=.3bb9ab66-458b-4a92-9178-b1563a3e9af2@github.com> On Fri, 6 Feb 2026 14:08:07 GMT, Liam Miller-Cushon wrote: > The main reason `getEncodedLength` wasn't used is that it doesn't make it clear that the unit of length is bytes. For UTF-8 a byte length is intuitive, for e.g. UTF-16 or UTF-32 the "encoded length" could also be the count of int16 (number of wchar_t) or int32. Emphasizing the unit of measurement is a laudable goal. I just feel that in this case it obscures what is being computed. What?s computed here is the *encoded* length, the unit of measurement seems a secondary concern. A String does not intrinsically have a ?byte length?, this concept seems only meaningful in relation to an encoding operation. Was `getEncodedByteLength` considered? `getEncodedLengthInBytes`? Was Charset considered as a home for this method? There the operational context of encoding would be obvious. > Including a `get` prefix or not was also considered, one benefit of `get` is that it aligns with `getBytes`, and also it may help convey that the method is doing computation (it's often going to be O(1), compared to e.g. `length()` which is O(1)). Again a laudable goal, but the actual computation seems obscure. String is prime real estate for millions of programmers. We should get this right. ------------- PR Comment: https://git.openjdk.org/jdk/pull/28454#issuecomment-3861158061 From cushon at openjdk.org Mon Feb 9 21:30:56 2026 From: cushon at openjdk.org (Liam Miller-Cushon) Date: Mon, 9 Feb 2026 21:30:56 GMT Subject: RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17] In-Reply-To: <2BdASdHcWrwVR4vDUls8cwb_c3jNMRjLr1b551JsVvg=.3bb9ab66-458b-4a92-9178-b1563a3e9af2@github.com> References: <2BdASdHcWrwVR4vDUls8cwb_c3jNMRjLr1b551JsVvg=.3bb9ab66-458b-4a92-9178-b1563a3e9af2@github.com> Message-ID: On Fri, 6 Feb 2026 15:50:24 GMT, Eirik Bj?rsn?s wrote: > Was `getEncodedByteLength` considered? `getEncodedLengthInBytes`? I think `getEncodedByteLength` and `getEncodedLengthInBytes` are both descriptive of what the method does. They seem verbose to me. In `getByteLength(Charset)`, the `Charset` provides some signal to the reader that the method is dealing with an encoded length. > Was Charset considered as a home for this method? There the operational context of encoding would be obvious. I don't think that was discussed. The primary motivation for adding this API is performance, I'd want to keep the fast path that optimizes using String internals, and avoid going through e.g. CharBuffer. I think it would be possible to add something to `JavaLangAccess` and have a specialized implementation of the method for the standard charsets (or their encoders) to preserve that. > String is prime real estate for millions of programmers. We should get this right. I agree! ------------- PR Comment: https://git.openjdk.org/jdk/pull/28454#issuecomment-3861273721 From rriggs at openjdk.org Mon Feb 9 21:31:12 2026 From: rriggs at openjdk.org (Roger Riggs) Date: Mon, 9 Feb 2026 21:31:12 GMT Subject: RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17] In-Reply-To: References: Message-ID: On Fri, 30 Jan 2026 15:56:20 GMT, Liam Miller-Cushon wrote: >> This implements an API to return the byte length of a String encoded in a given charset. See [JDK-8372353](https://bugs.openjdk.org/browse/JDK-8372353) for background. >> >> --- >> >> >> Benchmark (encoding) (stringLength) Mode Cnt Score Error Units >> StringLoopJmhBenchmark.getBytes ASCII 10 thrpt 5 406782650.595 ? 16960032.852 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 100 thrpt 5 172936926.189 ? 4532029.201 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 1000 thrpt 5 38830681.232 ? 2413274.766 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 100000 thrpt 5 458881.155 ? 12818.317 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 10 thrpt 5 37193762.990 ? 3962947.391 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 100 thrpt 5 55400876.236 ? 1267331.434 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 1000 thrpt 5 11104514.001 ? 41718.545 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 100000 thrpt 5 182535.414 ? 10296.120 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 10 thrpt 5 113474681.457 ? 8326589.199 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 100 thrpt 5 37854103.127 ? 4808526.773 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 1000 thrpt 5 4139833.009 ? 70636.784 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 100000 thrpt 5 57644.637 ? 1887.112 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 10 thrpt 5 946701647.247 ? 76938927.141 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 100 thrpt 5 396615374.479 ? 15167234.884 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 1000 thrpt 5 100464784.979 ? 794027.897 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 100000 thrpt 5 1215487.689 ? 1916.468 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 10 thrpt 5 221265102.323 ? 17013983.056 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 100 thrpt 5 137617873.887 ? 5842185.781 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 1000 thrpt 5 92540259.1... > > Liam Miller-Cushon has updated the pull request incrementally with one additional commit since the last revision: > > Rename getBytesLength to getByteLength I favored close alignment with `getBytes(CharSet).length`. As this is method is intended as a replacement for that. The encoded form is always bytes, so I don't think 'byte' needs to be in the name. I'd be fine with `getEncodedLength(Charset)`. The discoverability of the method if placed as `Charset.getEncodedLength(String)` would be very low and would require cross-package hacking to gain the performance advantage. ------------- PR Comment: https://git.openjdk.org/jdk/pull/28454#issuecomment-3861386284 From eirbjo at openjdk.org Mon Feb 9 21:31:20 2026 From: eirbjo at openjdk.org (Eirik =?UTF-8?B?QmrDuHJzbsO4cw==?=) Date: Mon, 9 Feb 2026 21:31:20 GMT Subject: RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17] In-Reply-To: References: Message-ID: On Fri, 6 Feb 2026 16:34:38 GMT, Roger Riggs wrote: > I'd be fine with `getEncodedLength(Charset)`. This name makes it clear that the method returns the length of this String, after encoding. While it is not explicity that the length is in bytes, as Roger says, encoding implies bytes anyway, so at the least "Encoded" strongly suggests the unit of measurement is bytes. The existence of a separate method for an encoded length makes it clear that this cannot have the same semantics as `String::length`. I don't think there is much room for confusion. While the similarity to the `getBytes().length` idiom is neat in 2026, I don't think it is important enough to determine the name of the metod. A method should describe what it does, not what it's soon to be outdated idiom used to look like back in the day. > The discoverability of the method if placed as `Charset.getEncodedLength(String)` would be very low and would require cross-package hacking to gain the performance advantage. The target audicence for this method is not discussed in the CSR, at least not explicitly. If the target audience is "most programmers", then String is a good home. If the target audience is specialist/framework/library developers working in very large companies with very large datasets, then perhaps the discoverabilty is not such a big issue and it's better to "hide away" this in Charset, which is where encoding operations generally live. If performance is important enough, it can warrant use of `JavaLangAccess`. ------------- PR Comment: https://git.openjdk.org/jdk/pull/28454#issuecomment-3861566063 From eirbjo at openjdk.org Mon Feb 9 21:31:37 2026 From: eirbjo at openjdk.org (Eirik =?UTF-8?B?QmrDuHJzbsO4cw==?=) Date: Mon, 9 Feb 2026 21:31:37 GMT Subject: RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17] In-Reply-To: References: Message-ID: <3B5NpEJg1-ylIKV9DYOrb5QN6T_Z6JC4ncRnxiUIjjM=.dfd3ef16-1d2f-4461-8fed-1aa167a487fd@github.com> On Fri, 6 Feb 2026 17:05:40 GMT, Alan Bateman wrote: > Maybe it should be looked at but in these discussions it would be CharsetEncoder, not Charset. Thanks Alan, not exactly my turf :-) It would be interesting to prototype if an implementation in `CharsetEncoder` could retain the desired performance characteristics. At the least, it would be good to see this alternative discussed in the CSR. ------------- PR Comment: https://git.openjdk.org/jdk/pull/28454#issuecomment-3861656546 From alanb at openjdk.org Mon Feb 9 21:31:28 2026 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 9 Feb 2026 21:31:28 GMT Subject: RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17] In-Reply-To: References: Message-ID: On Fri, 6 Feb 2026 17:01:41 GMT, Eirik Bj?rsn?s wrote: > then perhaps the discoverabilty is not such a big issue and it's better to "hide away" this in Charset, which is where encoding operations generally live. Maybe it should be looked at but in these discussions it would be CharsetEncoder, not Charset. ------------- PR Comment: https://git.openjdk.org/jdk/pull/28454#issuecomment-3861593365 From eirbjo at openjdk.org Mon Feb 9 21:31:47 2026 From: eirbjo at openjdk.org (Eirik =?UTF-8?B?QmrDuHJzbsO4cw==?=) Date: Mon, 9 Feb 2026 21:31:47 GMT Subject: RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17] In-Reply-To: References: Message-ID: On Fri, 30 Jan 2026 15:56:20 GMT, Liam Miller-Cushon wrote: >> This implements an API to return the byte length of a String encoded in a given charset. See [JDK-8372353](https://bugs.openjdk.org/browse/JDK-8372353) for background. >> >> --- >> >> >> Benchmark (encoding) (stringLength) Mode Cnt Score Error Units >> StringLoopJmhBenchmark.getBytes ASCII 10 thrpt 5 406782650.595 ? 16960032.852 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 100 thrpt 5 172936926.189 ? 4532029.201 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 1000 thrpt 5 38830681.232 ? 2413274.766 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 100000 thrpt 5 458881.155 ? 12818.317 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 10 thrpt 5 37193762.990 ? 3962947.391 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 100 thrpt 5 55400876.236 ? 1267331.434 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 1000 thrpt 5 11104514.001 ? 41718.545 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 100000 thrpt 5 182535.414 ? 10296.120 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 10 thrpt 5 113474681.457 ? 8326589.199 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 100 thrpt 5 37854103.127 ? 4808526.773 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 1000 thrpt 5 4139833.009 ? 70636.784 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 100000 thrpt 5 57644.637 ? 1887.112 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 10 thrpt 5 946701647.247 ? 76938927.141 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 100 thrpt 5 396615374.479 ? 15167234.884 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 1000 thrpt 5 100464784.979 ? 794027.897 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 100000 thrpt 5 1215487.689 ? 1916.468 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 10 thrpt 5 221265102.323 ? 17013983.056 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 100 thrpt 5 137617873.887 ? 5842185.781 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 1000 thrpt 5 92540259.1... > > Liam Miller-Cushon has updated the pull request incrementally with one additional commit since the last revision: > > Rename getBytesLength to getByteLength Should we also consider the inverse operation, that is to compute the length of a String had it been decoded from a sequence of bytes? `new String(byte[], Charset).length()` Someone will eventually ask for this. I see some potential use case for it in the `ZipFile` implementation where knowing the length ahead of decoding could provide efficient rejection of strings without decoding and without looking at String contents. Not saying we need to add it now, just that the name chosen here should leave room for a future addition of this inverse operation. Something like: str.getEncodedLength(Charset); // Encoded length of this string String.getDecodedLength(byte[], Charset); // Decoded length of byte sequence or, with the current scheme: str.getByteLength(Charset); // Encoded length of this string String.getStringLength(byte[], Charset); // Decoded length of byte sequence EDIT: Moving this out of `java.lang.String` unlocks: * Symmetry in that both can be instance methods * We would be free to support `ByteBuffer` and any `CharSequence`, not just strings: Charset cs = StandardCharsets.UTF_8; String h = "hello"; byte[] bytes = h.getBytes(cs); cs.encodedLength(CharBuffer.wrap(h)); cs.encodedLength(new StringBuilder(h)); cs.decodedLength(bytes); cs.decodedLength(ByteBuffer.wrap(bytes)); ------------- PR Comment: https://git.openjdk.org/jdk/pull/28454#issuecomment-3869643511 From cushon at openjdk.org Mon Feb 9 21:31:55 2026 From: cushon at openjdk.org (Liam Miller-Cushon) Date: Mon, 9 Feb 2026 21:31:55 GMT Subject: RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17] In-Reply-To: References: Message-ID: <-LFl1EtppLD8wkhQBOxPu8MrXXc6C6tO3gmCoeLK9JQ=.0f921030-33f3-4d9c-af12-45a4af633d53@github.com> On Fri, 6 Feb 2026 16:34:38 GMT, Roger Riggs wrote: > The encoded form is always bytes, so I don't think 'byte' needs to be in the name. I'd be fine with getEncodedLength(Charset). The javadoc would specify that it's a length in bytes, so perhaps that's sufficient without including 'bytes' in the method name. I do think that some callers might expect `getEncodedLength(UTF_16)` to return a length in code units and not bytes. There was some related discussion in [JDK-8372338](https://bugs.openjdk.org/browse/JDK-8372338) and also Maurizio's [Pulling the (foreign) string](https://cr.openjdk.org/~mcimadamore/panama/strings_ffm.html#reading-strings-with-known-length) doc. > The discoverability of the method if placed as Charset.getEncodedLength(String) would be very low and would require cross-package hacking to gain the performance advantage. For completeness, here's a demo of it in `CharsetEncoder` (https://github.com/openjdk/jdk/pull/29639). As expected it's possible to implement it that way and preserve equivalent performance, by adding a package visibility method to `String` and using `JavaLangAccess`. With that change, `string.getByteLength(UTF_8)` could be expressed as: try { int byteLength = StandardCharsets.UTF_8.newEncoder() .onUnmappableCharacter(CodingErrorAction.REPLACE) .onMalformedInput(CodingErrorAction.REPLACE) .getByteLength(stringData); } catch (CharacterCodingException e) { throw new IllegalStateException(e); } I can update the CSR to document this as an alternative. > Should we also consider the inverse operation, that is to compute the length of a String had it been decoded from a sequence of bytes? Someone will eventually ask for this. I see some potential use case for it in the ZipFile implementation where knowing the length ahead of decoding could provide efficient rejection of strings without decoding and without looking at String contents. What is the use-case for `decodedLength` in `ZipFile`? Does 'efficient rejection of strings without decoding' require knowing the decoded length, or just whether the data is a valid encoding? ------------- PR Comment: https://git.openjdk.org/jdk/pull/28454#issuecomment-3872766017 From eirbjo at openjdk.org Mon Feb 9 21:32:04 2026 From: eirbjo at openjdk.org (Eirik =?UTF-8?B?QmrDuHJzbsO4cw==?=) Date: Mon, 9 Feb 2026 21:32:04 GMT Subject: RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17] In-Reply-To: <-LFl1EtppLD8wkhQBOxPu8MrXXc6C6tO3gmCoeLK9JQ=.0f921030-33f3-4d9c-af12-45a4af633d53@github.com> References: <-LFl1EtppLD8wkhQBOxPu8MrXXc6C6tO3gmCoeLK9JQ=.0f921030-33f3-4d9c-af12-45a4af633d53@github.com> Message-ID: On Mon, 9 Feb 2026 16:26:42 GMT, Liam Miller-Cushon wrote: > What is the use-case for `decodedLength` in `ZipFile`? Does 'efficient rejection of strings without decoding' require knowing the decoded length, or just whether the data is a valid encoding? The ZIP file CEN header format only includes the length of the name in encoded form. Knowing the length of the decoded string could potentially let us quickly reject lookup matches against a lookup String only based on comparing string lengths (ZipFile supports returning "directory/" as a result for "directory", so we know a match would be 9 or 10 chars long). In practise, we compare hash codes before comparing strings. So this would only be useful for hash collisions. These are rare, so not worth optimizing. Perhaps there are other oppertinities though, it would certainly be possible to reject lookups based on min/max occurrence of entry lengths (or perhaps a bitset of occurring string lengths). But I'm sure there are other use cases where a `java.lang.String` is compared to its encoded form and knowing the length without String allocation could be useful. Input validation is another, possibly combined with rejection on malformed encoded data. ------------- PR Comment: https://git.openjdk.org/jdk/pull/28454#issuecomment-3872836764 From tr at openjdk.org Tue Feb 10 06:04:22 2026 From: tr at openjdk.org (Tejesh R) Date: Tue, 10 Feb 2026 06:04:22 GMT Subject: RFR: 8377191: Remove AppContext from KeyboardFocusManager In-Reply-To: References: Message-ID: <4UdckzHah1S-gfITkIEoABc-INNnKGZsyfK5-nt3d6w=.4dbe2865-4075-453e-bb48-a2a1010f4275@github.com> On Wed, 4 Feb 2026 20:33:12 GMT, Phil Race wrote: > Remove AppContext from KeyboardFocusManager src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java line 67: > 65: import sun.awt.AWTAccessor; > 66: import sun.awt.AWTAccessor.ComponentAccessor; > 67: import sun.awt.AppContext; I guess you have missed to remove the import. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29578#discussion_r2785948305 From eirbjo at openjdk.org Tue Feb 10 12:23:45 2026 From: eirbjo at openjdk.org (Eirik =?UTF-8?B?QmrDuHJzbsO4cw==?=) Date: Tue, 10 Feb 2026 12:23:45 GMT Subject: RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17] In-Reply-To: References: Message-ID: On Fri, 30 Jan 2026 15:56:20 GMT, Liam Miller-Cushon wrote: >> This implements an API to return the byte length of a String encoded in a given charset. See [JDK-8372353](https://bugs.openjdk.org/browse/JDK-8372353) for background. >> >> --- >> >> >> Benchmark (encoding) (stringLength) Mode Cnt Score Error Units >> StringLoopJmhBenchmark.getBytes ASCII 10 thrpt 5 406782650.595 ? 16960032.852 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 100 thrpt 5 172936926.189 ? 4532029.201 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 1000 thrpt 5 38830681.232 ? 2413274.766 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 100000 thrpt 5 458881.155 ? 12818.317 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 10 thrpt 5 37193762.990 ? 3962947.391 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 100 thrpt 5 55400876.236 ? 1267331.434 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 1000 thrpt 5 11104514.001 ? 41718.545 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 100000 thrpt 5 182535.414 ? 10296.120 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 10 thrpt 5 113474681.457 ? 8326589.199 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 100 thrpt 5 37854103.127 ? 4808526.773 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 1000 thrpt 5 4139833.009 ? 70636.784 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 100000 thrpt 5 57644.637 ? 1887.112 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 10 thrpt 5 946701647.247 ? 76938927.141 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 100 thrpt 5 396615374.479 ? 15167234.884 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 1000 thrpt 5 100464784.979 ? 794027.897 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 100000 thrpt 5 1215487.689 ? 1916.468 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 10 thrpt 5 221265102.323 ? 17013983.056 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 100 thrpt 5 137617873.887 ? 5842185.781 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 1000 thrpt 5 92540259.1... > > Liam Miller-Cushon has updated the pull request incrementally with one additional commit since the last revision: > > Rename getBytesLength to getByteLength > For completeness, here's a demo of it in `CharsetEncoder` (#29639). As expected it's possible to implement it that way and preserve equivalent performance, by adding a package visibility method to `String` and using `JavaLangAccess`. With that change, `string.getByteLength(UTF_8)` could be expressed as: > > ```java > try { > int byteLength = StandardCharsets.UTF_8.newEncoder() > .onUnmappableCharacter(CodingErrorAction.REPLACE) > .onMalformedInput(CodingErrorAction.REPLACE) > .getByteLength(stringData); > } catch (CharacterCodingException e) { > throw new IllegalStateException(e); > } > ``` > > I can update the CSR to document this as an alternative. This looks verbose at first sight. But I like how it allows control over coding error actions. This enables input validation and computing length in a single pass. Your demo seems to optimize only for `CodingErrorAction.REPLACE`, but that's probably more of an implementation detail than a limiting factor of API design, right? The demo focuses on the encoding side, but for completeness I guess the decoding side (with validation) could look like: > ```java > try { > int stringLength = StandardCharsets.UTF_8.newDecoder() > .onUnmappableCharacter(CodingErrorAction.REPORT) > .onMalformedInput(CodingErrorAction.REPORT) > .getDecodedLength(stringData); > } catch (CharacterCodingException e) { > throw new IllegalStateException(e); > } > ``` Did the stateful `CharsetEncoder` created meaningfully affect your performance benchmarking? ------------- PR Comment: https://git.openjdk.org/jdk/pull/28454#issuecomment-3877259235 From cushon at openjdk.org Tue Feb 10 13:20:31 2026 From: cushon at openjdk.org (Liam Miller-Cushon) Date: Tue, 10 Feb 2026 13:20:31 GMT Subject: RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17] In-Reply-To: References: Message-ID: On Fri, 30 Jan 2026 15:56:20 GMT, Liam Miller-Cushon wrote: >> This implements an API to return the byte length of a String encoded in a given charset. See [JDK-8372353](https://bugs.openjdk.org/browse/JDK-8372353) for background. >> >> --- >> >> >> Benchmark (encoding) (stringLength) Mode Cnt Score Error Units >> StringLoopJmhBenchmark.getBytes ASCII 10 thrpt 5 406782650.595 ? 16960032.852 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 100 thrpt 5 172936926.189 ? 4532029.201 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 1000 thrpt 5 38830681.232 ? 2413274.766 ops/s >> StringLoopJmhBenchmark.getBytes ASCII 100000 thrpt 5 458881.155 ? 12818.317 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 10 thrpt 5 37193762.990 ? 3962947.391 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 100 thrpt 5 55400876.236 ? 1267331.434 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 1000 thrpt 5 11104514.001 ? 41718.545 ops/s >> StringLoopJmhBenchmark.getBytes LATIN1 100000 thrpt 5 182535.414 ? 10296.120 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 10 thrpt 5 113474681.457 ? 8326589.199 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 100 thrpt 5 37854103.127 ? 4808526.773 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 1000 thrpt 5 4139833.009 ? 70636.784 ops/s >> StringLoopJmhBenchmark.getBytes UTF16 100000 thrpt 5 57644.637 ? 1887.112 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 10 thrpt 5 946701647.247 ? 76938927.141 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 100 thrpt 5 396615374.479 ? 15167234.884 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 1000 thrpt 5 100464784.979 ? 794027.897 ops/s >> StringLoopJmhBenchmark.getBytesLength ASCII 100000 thrpt 5 1215487.689 ? 1916.468 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 10 thrpt 5 221265102.323 ? 17013983.056 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 100 thrpt 5 137617873.887 ? 5842185.781 ops/s >> StringLoopJmhBenchmark.getBytesLength LATIN1 1000 thrpt 5 92540259.1... > > Liam Miller-Cushon has updated the pull request incrementally with one additional commit since the last revision: > > Rename getBytesLength to getByteLength I've updated the CSR to incorporate some of the additional alternatives that were raised. * `getEncodedLength`: both `getEncodedLength` and `getByteLength` seem like viable options. I'd appreciate input from core-libs reviewers on preferences. * discussion of moving this to `CharsetEncoder`. My opinion is that `String` seems like a better location for this API at this point, but that both are viable options if core-libs team prefers `CharsetEncoder`. I suggest leaving `getDecodedLength` as separate possible future work. I don't think anything in this change forecloses on the possibility of adding it later, if there are enough use-cases for it. ------------- PR Comment: https://git.openjdk.org/jdk/pull/28454#issuecomment-3877545589 From alanb at openjdk.org Tue Feb 10 13:59:14 2026 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 10 Feb 2026 13:59:14 GMT Subject: RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17] In-Reply-To: References: Message-ID: On Tue, 10 Feb 2026 12:20:36 GMT, Eirik Bj?rsn?s wrote: > Your demo seems to optimize only for `CodingErrorAction.REPLACE`, but that's probably more of an implementation detail than a limiting factor of API design, right? String.getBytes(Charset) uses REPLACE action, it doesn't ignore (which would change the length) or throw. ------------- PR Comment: https://git.openjdk.org/jdk/pull/28454#issuecomment-3877788819 From eirbjo at openjdk.org Tue Feb 10 15:28:57 2026 From: eirbjo at openjdk.org (Eirik =?UTF-8?B?QmrDuHJzbsO4cw==?=) Date: Tue, 10 Feb 2026 15:28:57 GMT Subject: RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17] In-Reply-To: References: Message-ID: On Tue, 10 Feb 2026 13:17:40 GMT, Liam Miller-Cushon wrote: > I've updated the CSR to incorporate some of the additional alternatives that were raised. Thanks Liam for taking time to review my comments, exploring options in the demo and documenting alternatives in the CSR. My opinions here are loosely held and to a large degree formed from the perspective of an armchair. I'm happy that alternatives have been raised and will take a step back now to let the PR proceed with input from experts with bigger shoes than me :-) ------------- PR Comment: https://git.openjdk.org/jdk/pull/28454#issuecomment-3878510280 From naoto at openjdk.org Wed Feb 11 09:46:08 2026 From: naoto at openjdk.org (Naoto Sato) Date: Wed, 11 Feb 2026 09:46:08 GMT Subject: RFR: 8377013: TimeZone.getDefault() returns obsolete id on Windows (Asia/Calcutta) [v2] In-Reply-To: References: Message-ID: On Fri, 6 Feb 2026 00:32:13 GMT, Naoto Sato wrote: >> Fixing the Windows default time zones returned from `TimeZone.getDefault()` for some regions. On Windows, it uses their own regions for time zones that aren't 1-1 match to IANA's TZ database. Thus a mapping table is created as `conf/tzmappings` on Windows Java runtime. It is derived from CLDR's `windowsZones.xml` but it uses the obsolete IANA ids for their compatibility reasons. The fix is to replace the CLDR's old ids to the latest IANA ids for those regions. >> Since it is hard to provide an automated test, as it involves the modification of the Windows' default time zone, regression test is not provided. Instead the fix is manually confirmed using the JIRA issue's example. Since this is a change in behavior, I will file a corresponding CSR/RN. >> >> Here is the diff of the generated `conf/tzmappings` for reference: >> >> @@ -13,7 +13,7 @@ >> Arabian Standard Time:ZZ:Etc/GMT-4: >> Arabian Standard Time:001:Asia/Dubai: >> Arabic Standard Time:001:Asia/Baghdad: >> -Argentina Standard Time:001:America/Buenos_Aires: >> +Argentina Standard Time:001:America/Argentina/Buenos_Aires: >> Astrakhan Standard Time:001:Europe/Astrakhan: >> Atlantic Standard Time:BM:Atlantic/Bermuda: >> Atlantic Standard Time:GL:America/Thule: >> @@ -58,7 +58,7 @@ >> Central European Standard Time:MK:Europe/Skopje: >> Central European Standard Time:001:Europe/Warsaw: >> Central Pacific Standard Time:AQ:Antarctica/Casey: >> -Central Pacific Standard Time:FM:Pacific/Ponape: >> +Central Pacific Standard Time:FM:Pacific/Pohnpei: >> Central Pacific Standard Time:NC:Pacific/Noumea: >> Central Pacific Standard Time:VU:Pacific/Efate: >> Central Pacific Standard Time:ZZ:Etc/GMT-11: >> @@ -75,7 +75,7 @@ >> Dateline Standard Time:001:Etc/GMT+12: >> E. Africa Standard Time:AQ:Antarctica/Syowa: >> E. Africa Standard Time:DJ:Africa/Djibouti: >> -E. Africa Standard Time:ER:Africa/Asmera: >> +E. Africa Standard Time:ER:Africa/Asmara: >> E. Africa Standard Time:ET:Africa/Addis_Ababa: >> E. Africa Standard Time:KM:Indian/Comoro: >> E. Africa Standard Time:MG:Indian/Antananarivo: >> @@ -101,10 +101,10 @@ >> FLE Standard Time:FI:Europe/Helsinki: >> FLE Standard Time:LT:Europe/Vilnius: >> FLE Standard Time:LV:Europe/Riga: >> -FLE Standard Time:001:Europe/Kiev: >> +FLE Standard Time:001:Europe/Kyiv: >> Fiji Standard Time:001:Pacific/Fiji: >> GMT Standard Time:ES:Atlantic/Canary: >> -GMT Standard Time:FO:Atlantic/Faeroe: >> +GMT Standard Time:FO:Atlantic/Faroe: >> GMT Standard Time:GG:Europe/Guernsey: >> GMT Standard Time... > > Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: > > Reflects review comments Thanks for the review! ------------- PR Comment: https://git.openjdk.org/jdk/pull/29591#issuecomment-3879307693 From naoto at openjdk.org Wed Feb 11 09:46:20 2026 From: naoto at openjdk.org (Naoto Sato) Date: Wed, 11 Feb 2026 09:46:20 GMT Subject: Integrated: 8377013: TimeZone.getDefault() returns obsolete id on Windows (Asia/Calcutta) In-Reply-To: References: Message-ID: On Thu, 5 Feb 2026 17:27:22 GMT, Naoto Sato wrote: > Fixing the Windows default time zones returned from `TimeZone.getDefault()` for some regions. On Windows, it uses their own regions for time zones that aren't 1-1 match to IANA's TZ database. Thus a mapping table is created as `conf/tzmappings` on Windows Java runtime. It is derived from CLDR's `windowsZones.xml` but it uses the obsolete IANA ids for their compatibility reasons. The fix is to replace the CLDR's old ids to the latest IANA ids for those regions. > Since it is hard to provide an automated test, as it involves the modification of the Windows' default time zone, regression test is not provided. Instead the fix is manually confirmed using the JIRA issue's example. Since this is a change in behavior, I will file a corresponding CSR/RN. > > Here is the diff of the generated `conf/tzmappings` for reference: > > @@ -13,7 +13,7 @@ > Arabian Standard Time:ZZ:Etc/GMT-4: > Arabian Standard Time:001:Asia/Dubai: > Arabic Standard Time:001:Asia/Baghdad: > -Argentina Standard Time:001:America/Buenos_Aires: > +Argentina Standard Time:001:America/Argentina/Buenos_Aires: > Astrakhan Standard Time:001:Europe/Astrakhan: > Atlantic Standard Time:BM:Atlantic/Bermuda: > Atlantic Standard Time:GL:America/Thule: > @@ -58,7 +58,7 @@ > Central European Standard Time:MK:Europe/Skopje: > Central European Standard Time:001:Europe/Warsaw: > Central Pacific Standard Time:AQ:Antarctica/Casey: > -Central Pacific Standard Time:FM:Pacific/Ponape: > +Central Pacific Standard Time:FM:Pacific/Pohnpei: > Central Pacific Standard Time:NC:Pacific/Noumea: > Central Pacific Standard Time:VU:Pacific/Efate: > Central Pacific Standard Time:ZZ:Etc/GMT-11: > @@ -75,7 +75,7 @@ > Dateline Standard Time:001:Etc/GMT+12: > E. Africa Standard Time:AQ:Antarctica/Syowa: > E. Africa Standard Time:DJ:Africa/Djibouti: > -E. Africa Standard Time:ER:Africa/Asmera: > +E. Africa Standard Time:ER:Africa/Asmara: > E. Africa Standard Time:ET:Africa/Addis_Ababa: > E. Africa Standard Time:KM:Indian/Comoro: > E. Africa Standard Time:MG:Indian/Antananarivo: > @@ -101,10 +101,10 @@ > FLE Standard Time:FI:Europe/Helsinki: > FLE Standard Time:LT:Europe/Vilnius: > FLE Standard Time:LV:Europe/Riga: > -FLE Standard Time:001:Europe/Kiev: > +FLE Standard Time:001:Europe/Kyiv: > Fiji Standard Time:001:Pacific/Fiji: > GMT Standard Time:ES:Atlantic/Canary: > -GMT Standard Time:FO:Atlantic/Faeroe: > +GMT Standard Time:FO:Atlantic/Faroe: > GMT Standard Time:GG:Europe/Guernsey: > GMT Standard Time:IE:Europe/Dublin: > GMT Standard Time:IM:Europe/Isle_of_Man: > @@ -115,7 +115,7 @@ > GTB St... This pull request has now been integrated. Changeset: 21d4c6c6 Author: Naoto Sato URL: https://git.openjdk.org/jdk/commit/21d4c6c68fc1199275b3317cd64ae24c8aeca003 Stats: 34 lines in 3 files changed: 29 ins; 0 del; 5 mod 8377013: TimeZone.getDefault() returns obsolete id on Windows (Asia/Calcutta) Reviewed-by: jlu ------------- PR: https://git.openjdk.org/jdk/pull/29591 From prr at openjdk.org Wed Feb 11 21:02:55 2026 From: prr at openjdk.org (Phil Race) Date: Wed, 11 Feb 2026 21:02:55 GMT Subject: RFR: 8377191: Remove AppContext from KeyboardFocusManager [v2] In-Reply-To: References: Message-ID: > Remove AppContext from KeyboardFocusManager Phil Race has updated the pull request incrementally with one additional commit since the last revision: 8377191 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/29578/files - new: https://git.openjdk.org/jdk/pull/29578/files/dd5134b5..4422ab50 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=29578&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29578&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 1 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/29578.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29578/head:pull/29578 PR: https://git.openjdk.org/jdk/pull/29578 From prr at openjdk.org Wed Feb 11 21:02:57 2026 From: prr at openjdk.org (Phil Race) Date: Wed, 11 Feb 2026 21:02:57 GMT Subject: RFR: 8377191: Remove AppContext from KeyboardFocusManager [v2] In-Reply-To: <4UdckzHah1S-gfITkIEoABc-INNnKGZsyfK5-nt3d6w=.4dbe2865-4075-453e-bb48-a2a1010f4275@github.com> References: <4UdckzHah1S-gfITkIEoABc-INNnKGZsyfK5-nt3d6w=.4dbe2865-4075-453e-bb48-a2a1010f4275@github.com> Message-ID: On Tue, 10 Feb 2026 05:55:29 GMT, Tejesh R wrote: >> Phil Race has updated the pull request incrementally with one additional commit since the last revision: >> >> 8377191 > > src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java line 67: > >> 65: import sun.awt.AWTAccessor; >> 66: import sun.awt.AWTAccessor.ComponentAccessor; >> 67: import sun.awt.AppContext; > > I guess you have missed to remove the import. I removed it. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29578#discussion_r2795500026 From prr at openjdk.org Wed Feb 11 21:02:58 2026 From: prr at openjdk.org (Phil Race) Date: Wed, 11 Feb 2026 21:02:58 GMT Subject: RFR: 8377191: Remove AppContext from KeyboardFocusManager [v2] In-Reply-To: <_4JmpXvJqSRQNrC9UYelWFIcUOSeRKqzvhsV0i_LP0I=.a0b92f6c-c2d5-4f92-a33e-32ae2ab76add@github.com> References: <_4JmpXvJqSRQNrC9UYelWFIcUOSeRKqzvhsV0i_LP0I=.a0b92f6c-c2d5-4f92-a33e-32ae2ab76add@github.com> Message-ID: On Mon, 9 Feb 2026 22:57:43 GMT, Sergey Bylokhov wrote: >> Phil Race has updated the pull request incrementally with one additional commit since the last revision: >> >> 8377191 > > src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java line 265: > >> 263: static boolean sendMessage(Component target, AWTEvent e) { >> 264: e.isPosted = true; >> 265: final SentEvent se = new DefaultKeyboardFocusManagerSentEvent(e); > > "final" for local variable is rarely used. Is it necessary here? I did not add that. It was already there. See line 275 in the "original" code. There may have been a reason but I don't see it. However it isn't a problem. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29578#discussion_r2786009001 From duke at openjdk.org Thu Feb 12 03:08:06 2026 From: duke at openjdk.org (duke) Date: Thu, 12 Feb 2026 03:08:06 GMT Subject: Withdrawn: 8309748: Improve host selection in `External Specifications` page In-Reply-To: References: Message-ID: On Wed, 17 Dec 2025 08:45:01 GMT, Hannes Walln?fer wrote: > Please review a change to improve selection by host name in the External Specifications page. After trying a list of checkboxes as used in the API summary pages and finding it not a suitable solution, I found that a select/dropdown menu works best for this page. > > - [New external specs page](https://cr.openjdk.org/~hannesw/8309748/api.00/external-specs.html) > - [Old external specs page](https://docs.oracle.com/en/java/javase/25/docs/api/external-specs.html) for comparsion > > I also updated `@spec` tags in `java.lang.Character` to point to `www.unicode.org` rather than `unicode.org` to avoid a `unicode.org` entry in the host list (other `@spec` tags use the `www.unicode.org` host name). The short `unicode.org` URL is still used elsewhere in the `java.lang.Character` class, I can update those links to the canonical host name as well if desired. This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/jdk/pull/28863 From tr at openjdk.org Fri Feb 13 05:42:22 2026 From: tr at openjdk.org (Tejesh R) Date: Fri, 13 Feb 2026 05:42:22 GMT Subject: RFR: 8377191: Remove AppContext from KeyboardFocusManager [v2] In-Reply-To: References: Message-ID: On Wed, 11 Feb 2026 21:02:55 GMT, Phil Race wrote: >> Remove AppContext from KeyboardFocusManager > > Phil Race has updated the pull request incrementally with one additional commit since the last revision: > > 8377191 LGTM. ------------- Marked as reviewed by tr (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/29578#pullrequestreview-3795160926 From serb at openjdk.org Fri Feb 13 17:48:21 2026 From: serb at openjdk.org (Sergey Bylokhov) Date: Fri, 13 Feb 2026 17:48:21 GMT Subject: RFR: 8377191: Remove AppContext from KeyboardFocusManager [v2] In-Reply-To: References: Message-ID: On Wed, 11 Feb 2026 21:02:55 GMT, Phil Race wrote: >> Remove AppContext from KeyboardFocusManager > > Phil Race has updated the pull request incrementally with one additional commit since the last revision: > > 8377191 Marked as reviewed by serb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/29578#pullrequestreview-3798629074 From prr at openjdk.org Fri Feb 13 19:46:23 2026 From: prr at openjdk.org (Phil Race) Date: Fri, 13 Feb 2026 19:46:23 GMT Subject: RFR: 8377191: Remove AppContext from KeyboardFocusManager [v3] In-Reply-To: References: Message-ID: > Remove AppContext from KeyboardFocusManager Phil Race has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits: - Merge - 8377191 - 8377191 ------------- Changes: https://git.openjdk.org/jdk/pull/29578/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29578&range=02 Stats: 189 lines in 6 files changed: 2 ins; 143 del; 44 mod Patch: https://git.openjdk.org/jdk/pull/29578.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29578/head:pull/29578 PR: https://git.openjdk.org/jdk/pull/29578 From dnguyen at openjdk.org Fri Feb 13 22:08:57 2026 From: dnguyen at openjdk.org (Damon Nguyen) Date: Fri, 13 Feb 2026 22:08:57 GMT Subject: RFR: 8377191: Remove AppContext from KeyboardFocusManager [v3] In-Reply-To: References: Message-ID: <5yJ6uwob_jDXEEaf3EAThgcsW2MJcVnkd6EmGd6kKJE=.03481d55-f27e-4382-9350-1049e3f62684@github.com> On Fri, 13 Feb 2026 19:46:23 GMT, Phil Race wrote: >> Remove AppContext from KeyboardFocusManager > > Phil Race has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits: > > - Merge > - 8377191 > - 8377191 Merge conflict looks to be resolved. ------------- Marked as reviewed by dnguyen (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/29578#pullrequestreview-3799821008 From prr at openjdk.org Fri Feb 13 22:43:24 2026 From: prr at openjdk.org (Phil Race) Date: Fri, 13 Feb 2026 22:43:24 GMT Subject: Integrated: 8377191: Remove AppContext from KeyboardFocusManager In-Reply-To: References: Message-ID: On Wed, 4 Feb 2026 20:33:12 GMT, Phil Race wrote: > Remove AppContext from KeyboardFocusManager This pull request has now been integrated. Changeset: 1920983e Author: Phil Race URL: https://git.openjdk.org/jdk/commit/1920983edb4001c71efaeefcf819feb977accbea Stats: 189 lines in 6 files changed: 2 ins; 143 del; 44 mod 8377191: Remove AppContext from KeyboardFocusManager Reviewed-by: dnguyen, tr, serb ------------- PR: https://git.openjdk.org/jdk/pull/29578