From duke at openjdk.org Sat Jun 1 00:15:05 2024 From: duke at openjdk.org (xiaotaonan) Date: Sat, 1 Jun 2024 00:15:05 GMT Subject: Withdrawn: 8331879: Clean up non-standard use of /// comments in `java.base` In-Reply-To: References: Message-ID: On Thu, 9 May 2024 02:09:50 GMT, xiaotaonan wrote: > Clean up non-standard use of /// comments in `java.base` This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/jdk/pull/19151 From liach at openjdk.org Sat Jun 1 01:45:08 2024 From: liach at openjdk.org (Chen Liang) Date: Sat, 1 Jun 2024 01:45:08 GMT Subject: RFR: 8333377: Migrate Generic Signature parsing to ClassFile API In-Reply-To: <8_XK2UpYcewLX40oL3TS0T7KGAgfBprN4aauvhVQBy4=.420255be-10a3-4a64-bac9-491b21983265@github.com> References: <8_XK2UpYcewLX40oL3TS0T7KGAgfBprN4aauvhVQBy4=.420255be-10a3-4a64-bac9-491b21983265@github.com> Message-ID: <5lZInTjc2WI4OVBkZG06EMR_T9kJMOhmhua5Jze6bdA=.be4a8991-6cf2-48d9-bc60-ff704c8ccdcc@github.com> On Fri, 17 May 2024 12:01:23 GMT, Chen Liang wrote: > Core reflection's generic signature parsing uses an ancient library with outdated visitor pattern on a tree model and contains unnecessary boilerplates. This is a duplication of ClassFile API's signature model. We should just move to ClassFile API, which is more throughoutly tested as well. > > To ensure compatibility, new tests are added to ensure consistent behavior when encountering malformed signatures or signatures with missing types. The reflective objects have been preserved and the only change is that lazy expansion now happens from CF objects, to reduce compatibility risks. Indeed, I put the JBS issue to target release 24. I believe given the potential behavioral changes, rushing into release 23 is a risky choice. (the 4 new tests can target 23 in a separate patch, but they require removal of a few redundant assertions in old generic code) ------------- PR Comment: https://git.openjdk.org/jdk/pull/19281#issuecomment-2143205523 From almatvee at openjdk.org Sat Jun 1 02:01:07 2024 From: almatvee at openjdk.org (Alexander Matveev) Date: Sat, 1 Jun 2024 02:01:07 GMT Subject: RFR: 8331977: Crash: SIGSEGV in dlerror() In-Reply-To: References: Message-ID: On Fri, 31 May 2024 14:05:07 GMT, Alexey Semenyuk wrote: > Fix MainClassTest class to use HelloApp.AppOutputVerifier class to run app launcher instead of raw Executor. This makes MainClassTest test run app launchers with retries. This change addresses the primary issue. > > Fix inconsistencies in HelloApp.AppOutputVerifier class. It used to provide API allowing to run launchers without retries. It inconsistently allowed the execution of launchers with suppressed output (stdout and stderr). It inconsistently executed launchers with/without PATH removed from the environment. > > These loopholes were eliminated: > > - stdout and stderr of app launchers is never suppressed; > - PATH env variable is always deleted for app launchers on Windows. It is not deleted on other platforms. This change sets the correct scope of [JDK-8254920](https://bugs.openjdk.org/browse/JDK-8254920) fix that introduced the removal of PATH env variable for app launchers; > - app launchers are always executed with retries unless the launcher is executed with `jpackage.test.noexit` system property set to `true` indicating the test app will not terminate on its own. > > Other changes are due to changes in HelloApp.AppOutputVerifier class. Looks good. ------------- Marked as reviewed by almatvee (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19502#pullrequestreview-2091922907 From jpai at openjdk.org Sat Jun 1 04:38:26 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Sat, 1 Jun 2024 04:38:26 GMT Subject: RFR: 8026127: Deflater/Inflater documentation incomplete/misleading Message-ID: <7Iu3kTwrw2DX_FgG7f3H6N5Q-FLKNU4-mS07HcPyMTY=.f1a9c247-c49d-4513-9bde-485bc1f8e357@github.com> Can I please get a review of this doc-only change which proposes to improve the code snippet that's in `java.util.zip.Deflater` and `java.util.zip.Inflater` to better explain the usage of those classes? This addresses https://bugs.openjdk.org/browse/JDK-8026127. The commit in the PR cleans up the snippet to correctly compress/decompress till the `Deflater` and `Inflater` are `finished()`. Additionally, the snippet also shows that the `Deflater` and `Inflater` are expected to be closed when their usage it done, to release the resources held by those instances. I've run `make docs-image` locally to verify that the generated snippet content as well as the link from `Inflater` work fine in the rendered javadoc HTML. ------------- Commit messages: - 8026127: Deflater/Inflater documentation incomplete/misleading Changes: https://git.openjdk.org/jdk/pull/19507/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19507&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8026127 Stats: 88 lines in 2 files changed: 31 ins; 31 del; 26 mod Patch: https://git.openjdk.org/jdk/pull/19507.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19507/head:pull/19507 PR: https://git.openjdk.org/jdk/pull/19507 From jpai at openjdk.org Sat Jun 1 05:18:17 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Sat, 1 Jun 2024 05:18:17 GMT Subject: RFR: 7022325: TEST_BUG: test/java/util/zip/ZipFile/ReadLongZipFileName.java leaks files if it fails [v2] In-Reply-To: <3IbUCEnZFVdQyBOtxtjoqRNfhlJYQVZ6DagF6T9mGgA=.adf1c246-1b8d-4609-bf58-5e381bcd5ae3@github.com> References: <3IbUCEnZFVdQyBOtxtjoqRNfhlJYQVZ6DagF6T9mGgA=.adf1c246-1b8d-4609-bf58-5e381bcd5ae3@github.com> Message-ID: > Can I please get a review of this test-only change which updates a couple of places in the test to use `try-with-resource`? > > As noted in https://bugs.openjdk.org/browse/JDK-7022325 this change should prevent leaking of resources in case there's any failure in the test. The test continues to pass with this change. Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: convert the test to junit ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19492/files - new: https://git.openjdk.org/jdk/pull/19492/files/3ce9ca81..b9d56006 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19492&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19492&range=00-01 Stats: 122 lines in 1 file changed: 28 ins; 60 del; 34 mod Patch: https://git.openjdk.org/jdk/pull/19492.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19492/head:pull/19492 PR: https://git.openjdk.org/jdk/pull/19492 From jpai at openjdk.org Sat Jun 1 05:23:03 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Sat, 1 Jun 2024 05:23:03 GMT Subject: RFR: 8333270: HandlersOnComplexResetUpdate and HandlersOnComplexUpdate tests fail with "Unexpected reference" if timeoutFactor is less than 1/3 In-Reply-To: References: Message-ID: On Fri, 31 May 2024 14:55:57 GMT, Daniel Fuchs wrote: > HandlersOnComplexResetUpdate and HandlersOnComplexUpdate tests verify that loggers are GC'ed (or not GC'ed) after a reset or an update. For that they poll a ReferenceQueue in a loop. The number of iteration is adjusted according to the jtreg timeout factor. However, the logic in the test did not expect that the timeout might be less than 1. > > This fix does two things: > > 1. fix the adjustCount logic - so that the number of iteration can only be increased > 2. use remove(timeout) instead of poll() in order to minimize the waiting time. test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexResetUpdate.java line 219: > 217: } > 218: WeakReference barRef = new WeakReference<>(Logger.getLogger("com.bar"), queue); > 219: if (!barRef.refersTo(barChild.getParent())) { Hello Daniel, since `refersTo()` is the preferred API in cases like this, should this same change be done in the other `HandlersOnComplexUpdate` test that's being updated in this PR? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19503#discussion_r1623151595 From jpai at openjdk.org Sat Jun 1 05:44:01 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Sat, 1 Jun 2024 05:44:01 GMT Subject: RFR: 7022325: TEST_BUG: test/java/util/zip/ZipFile/ReadLongZipFileName.java leaks files if it fails [v2] In-Reply-To: References: <3IbUCEnZFVdQyBOtxtjoqRNfhlJYQVZ6DagF6T9mGgA=.adf1c246-1b8d-4609-bf58-5e381bcd5ae3@github.com> Message-ID: On Sat, 1 Jun 2024 05:18:17 GMT, Jaikiran Pai wrote: >> Can I please get a review of this test-only change which updates a couple of places in the test to use `try-with-resource`? >> >> As noted in https://bugs.openjdk.org/browse/JDK-7022325 this change should prevent leaking of resources in case there's any failure in the test. The test continues to pass with this change. > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > convert the test to junit Hello Lance, I have now updated the PR to convert this test to junit test. While at it, I have also cleaned up the code to use `java.nio.file.Path` and use the jtreg scratch directory for the directories and the jar file this test creates. That way, we don't have to manually delete the directories when done. I have verified that the changes don't change the semantics of what was being tested in this test, which was a regression test for https://bugs.openjdk.org/browse/JDK-6374379. The test continues to pass with these change in our CI against all platforms. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19492#issuecomment-2143307371 From vklang at openjdk.org Sat Jun 1 11:54:25 2024 From: vklang at openjdk.org (Viktor Klang) Date: Sat, 1 Jun 2024 11:54:25 GMT Subject: RFR: 8327854: Test java/util/stream/test/org/openjdk/tests/java/util/stream/WhileOpStatefulTest.java failed with RuntimeException Message-ID: This PR improves the test failure output for the failing test case, and the underlying issue is likely going to be addressed by https://github.com/openjdk/jdk/pull/19131 /cc @DougLea ------------- Commit messages: - Improving the failure output of WhileOpStatefulTest Changes: https://git.openjdk.org/jdk/pull/19508/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19508&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8327854 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/19508.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19508/head:pull/19508 PR: https://git.openjdk.org/jdk/pull/19508 From asemenyuk at openjdk.org Sat Jun 1 12:34:05 2024 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Sat, 1 Jun 2024 12:34:05 GMT Subject: Integrated: 8331977: Crash: SIGSEGV in dlerror() In-Reply-To: References: Message-ID: On Fri, 31 May 2024 14:05:07 GMT, Alexey Semenyuk wrote: > Fix MainClassTest class to use HelloApp.AppOutputVerifier class to run app launcher instead of raw Executor. This makes MainClassTest test run app launchers with retries. This change addresses the primary issue. > > Fix inconsistencies in HelloApp.AppOutputVerifier class. It used to provide API allowing to run launchers without retries. It inconsistently allowed the execution of launchers with suppressed output (stdout and stderr). It inconsistently executed launchers with/without PATH removed from the environment. > > These loopholes were eliminated: > > - stdout and stderr of app launchers is never suppressed; > - PATH env variable is always deleted for app launchers on Windows. It is not deleted on other platforms. This change sets the correct scope of [JDK-8254920](https://bugs.openjdk.org/browse/JDK-8254920) fix that introduced the removal of PATH env variable for app launchers; > - app launchers are always executed with retries unless the launcher is executed with `jpackage.test.noexit` system property set to `true` indicating the test app will not terminate on its own. > > Other changes are due to changes in HelloApp.AppOutputVerifier class. This pull request has now been integrated. Changeset: 24530022 Author: Alexey Semenyuk URL: https://git.openjdk.org/jdk/commit/24530022d066763f7573f5c6d2030a30dc55afa6 Stats: 122 lines in 5 files changed: 48 ins; 41 del; 33 mod 8331977: Crash: SIGSEGV in dlerror() Reviewed-by: almatvee ------------- PR: https://git.openjdk.org/jdk/pull/19502 From lancea at openjdk.org Sat Jun 1 20:12:01 2024 From: lancea at openjdk.org (Lance Andersen) Date: Sat, 1 Jun 2024 20:12:01 GMT Subject: RFR: 7022325: TEST_BUG: test/java/util/zip/ZipFile/ReadLongZipFileName.java leaks files if it fails [v2] In-Reply-To: References: <3IbUCEnZFVdQyBOtxtjoqRNfhlJYQVZ6DagF6T9mGgA=.adf1c246-1b8d-4609-bf58-5e381bcd5ae3@github.com> Message-ID: On Sat, 1 Jun 2024 05:18:17 GMT, Jaikiran Pai wrote: >> Can I please get a review of this test-only change which updates a couple of places in the test to use `try-with-resource`? >> >> As noted in https://bugs.openjdk.org/browse/JDK-7022325 this change should prevent leaking of resources in case there's any failure in the test. The test continues to pass with this change. > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > convert the test to junit thank you Jai, changes look good ------------- Marked as reviewed by lancea (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19492#pullrequestreview-2092169070 From jpai at openjdk.org Sun Jun 2 01:11:07 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Sun, 2 Jun 2024 01:11:07 GMT Subject: Integrated: 7022325: TEST_BUG: test/java/util/zip/ZipFile/ReadLongZipFileName.java leaks files if it fails In-Reply-To: <3IbUCEnZFVdQyBOtxtjoqRNfhlJYQVZ6DagF6T9mGgA=.adf1c246-1b8d-4609-bf58-5e381bcd5ae3@github.com> References: <3IbUCEnZFVdQyBOtxtjoqRNfhlJYQVZ6DagF6T9mGgA=.adf1c246-1b8d-4609-bf58-5e381bcd5ae3@github.com> Message-ID: On Fri, 31 May 2024 00:57:18 GMT, Jaikiran Pai wrote: > Can I please get a review of this test-only change which updates a couple of places in the test to use `try-with-resource`? > > As noted in https://bugs.openjdk.org/browse/JDK-7022325 this change should prevent leaking of resources in case there's any failure in the test. The test continues to pass with this change. This pull request has now been integrated. Changeset: 4785461f Author: Jaikiran Pai URL: https://git.openjdk.org/jdk/commit/4785461f61d8f5c7444d2e6fd90f1e083dbc6fe4 Stats: 128 lines in 1 file changed: 34 ins; 68 del; 26 mod 7022325: TEST_BUG: test/java/util/zip/ZipFile/ReadLongZipFileName.java leaks files if it fails Reviewed-by: lancea ------------- PR: https://git.openjdk.org/jdk/pull/19492 From jpai at openjdk.org Sun Jun 2 01:11:06 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Sun, 2 Jun 2024 01:11:06 GMT Subject: RFR: 7022325: TEST_BUG: test/java/util/zip/ZipFile/ReadLongZipFileName.java leaks files if it fails [v2] In-Reply-To: References: <3IbUCEnZFVdQyBOtxtjoqRNfhlJYQVZ6DagF6T9mGgA=.adf1c246-1b8d-4609-bf58-5e381bcd5ae3@github.com> Message-ID: On Sat, 1 Jun 2024 05:18:17 GMT, Jaikiran Pai wrote: >> Can I please get a review of this test-only change which updates a couple of places in the test to use `try-with-resource`? >> >> As noted in https://bugs.openjdk.org/browse/JDK-7022325 this change should prevent leaking of resources in case there's any failure in the test. The test continues to pass with this change. > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > convert the test to junit Thank you Lance for the review. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19492#issuecomment-2143653405 From vklang at openjdk.org Sun Jun 2 14:36:09 2024 From: vklang at openjdk.org (Viktor Klang) Date: Sun, 2 Jun 2024 14:36:09 GMT Subject: RFR: 8322732: ForkJoinPool may underutilize cores in async mode [v17] In-Reply-To: References: Message-ID: On Fri, 31 May 2024 13:18:33 GMT, Doug Lea
wrote: >> This set of changes address causes of poor utilization with small numbers of cores due to overly aggressive contention avoidance. A number of further adjustments were needed to still avoid most contention effects in deployments with large numbers of cores > > Doug Lea has updated the pull request incrementally with one additional commit since the last revision: > > Reconcile changes src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 1345: > 1343: int b = base, p = top, cap; > 1344: if (p - b > 0 && a != null && (cap = a.length) > 0) { > 1345: for (int m = cap - 1, s, nb;;) { @DougLea I'm curious, what effect did you see if moving the `p - b > 0` out of the loop conditional? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1623453077 From alanb at openjdk.org Sun Jun 2 17:45:13 2024 From: alanb at openjdk.org (Alan Bateman) Date: Sun, 2 Jun 2024 17:45:13 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v29] In-Reply-To: References: Message-ID: <6Qs2lLk0mJP0XdyH9ysENqcUT7P0KxsWU95fvRzA21Q=.09e661a3-d340-4fde-8030-77db94a2d353@github.com> On Wed, 22 May 2024 13:23:25 GMT, Severin Gehwolf wrote: >> Please review this patch which adds a jlink mode to the JDK which doesn't need the packaged modules being present. A.k.a run-time image based jlink. Fundamentally this patch adds an option to use `jlink` even though your JDK install might not come with the packaged modules (directory `jmods`). This is particularly useful to further reduce the size of a jlinked runtime. After the removal of the concept of a JRE, a common distribution mechanism is still the full JDK with all modules and packaged modules. However, packaged modules can incur an additional size tax. For example in a container scenario it could be useful to have a base JDK container including all modules, but without also delivering the packaged modules. This comes at a size advantage of `~25%`. Such a base JDK container could then be used to `jlink` application specific runtimes, further reducing the size of the application runtime image (App + JDK runtime; as a single image *or* separate bundles, depending on the app being modularized). >> >> The basic design of this approach is to add a jlink plugin for tracking non-class and non-resource files of a JDK install. I.e. files which aren't present in the jimage (`lib/modules`). This enables producing a `JRTArchive` class which has all the info of what constitutes the final jlinked runtime. >> >> Basic usage example: >> >> $ diff -u <(./bin/java --list-modules --limit-modules java.se) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules java.se) >> $ diff -u <(./bin/java --list-modules --limit-modules jdk.jlink) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules jdk.jlink) >> $ ls ../linux-x86_64-server-release/images/jdk/jmods >> java.base.jmod java.net.http.jmod java.sql.rowset.jmod jdk.crypto.ec.jmod jdk.internal.opt.jmod jdk.jdi.jmod jdk.management.agent.jmod jdk.security.auth.jmod >> java.compiler.jmod java.prefs.jmod java.transaction.xa.jmod jdk.dynalink.jmod jdk.internal.vm.ci.jmod jdk.jdwp.agent.jmod jdk.management.jfr.jmod jdk.security.jgss.jmod >> java.datatransfer.jmod java.rmi.jmod java.xml.crypto.jmod jdk.editpad.jmod jdk.internal.vm.compiler.jmod jdk.jfr.jmod jdk.management.jmod jdk.unsupported.desktop.jmod >> java.desktop.jmod java.scripting.jmod java.xml.jmod jdk.hotspot.agent.jmod jdk.i... > > Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 110 commits: > > - Merge branch 'master' into jdk-8311302-jmodless-link > - Fix new line in jlink.properties > - Merge branch 'master' into jdk-8311302-jmodless-link > - Simplify JLINK_JDK_EXTRA_OPTS var handling > - Only add runtime track files for linkable runtimes > - Generate the runtime image link diff at jlink time > > But only do that once the plugin-pipeline has run. The generation is > enabled with the hidden option '--generate-linkable-runtime' and > the resource pools available at jlink time are being used to generate > the diff. > - Merge branch 'master' into jdk-8311302-jmodless-link > - Use shorter name for the build tool > - Review feedback from Erik J. > - Remove dependency on CDS which isn't needed anymore > - ... and 100 more: https://git.openjdk.org/jdk/compare/4f1a10f8...e1e3f02f I've been looking through the changes. One thing that I'm wondering about is whether --generate-runtime-link-image should disable the keeping of packaged modules (set JLINK_KEEP_PACKAGED_MODULES to false). It seems surprising to use this configure option and have the jlink command in the build also copy the packaged modules into the image. (Doing that would of course mean that several existing jlink tests would need some changes, either to `@requires` or to remove the checks for the `jmods` directory) ------------- PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2143963280 From duke at openjdk.org Mon Jun 3 04:22:19 2024 From: duke at openjdk.org (lingjun-cg) Date: Mon, 3 Jun 2024 04:22:19 GMT Subject: RFR: 8333396: Performance regression of new DecimalFormat and DecimalFormat.format Message-ID: ### Performance regression of DecimalFormat.format >From the output of perf, we can see the hottest regions contain atomic instructions. But when run with JDK 11, there is no such problem. The reason is the removed biased locking. The DecimalFormat uses StringBuffer everywhere, and StringBuffer itself contains many synchronized methods. So I added support for some new methods that accept StringBuilder which is lock-free. ### Performance regression of new DecimalFormat After comparing the flame graph between current jdk and jdk 11, the method java.text.DecimalFormatSymbols#findNonFormatChar takes a significant time. The performance becomes as good as jdk11 after replacing it with a simple loop implementation. ------------- Commit messages: - 8333396: Performance regression of new DecimalFormat and DecimalFormat.format Changes: https://git.openjdk.org/jdk/pull/19513/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19513&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333396 Stats: 318 lines in 11 files changed: 268 ins; 0 del; 50 mod Patch: https://git.openjdk.org/jdk/pull/19513.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19513/head:pull/19513 PR: https://git.openjdk.org/jdk/pull/19513 From jpai at openjdk.org Mon Jun 3 04:31:27 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Mon, 3 Jun 2024 04:31:27 GMT Subject: RFR: 8333398: Uncomment the commented test in test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java Message-ID: Can I please get a review of this test-only change which uncomments an additional test that was commented out in `test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java`? As noted in https://bugs.openjdk.org/browse/JDK-8333398, the original issue due to which this line was commented out in the test, has been fixed several releases back and thus this line can now be uncommented. I've verified that this test continues to pass with these changes. ------------- Commit messages: - 8333398: Uncomment the commented test in test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java Changes: https://git.openjdk.org/jdk/pull/19514/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19514&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333398 Stats: 5 lines in 1 file changed: 0 ins; 3 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/19514.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19514/head:pull/19514 PR: https://git.openjdk.org/jdk/pull/19514 From jpai at openjdk.org Mon Jun 3 05:11:16 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Mon, 3 Jun 2024 05:11:16 GMT Subject: RFR: 8206447: InflaterInputStream.skip receives long but it's limited to Integer.MAX_VALUE Message-ID: Can I please get a review of this change which updates the API specification of `java.util.zip.InflaterInputStream.skip()` method to match its current implementation? `InflaterInputStream.skip()`, just like `DeflaterInputStream.skip()`, takes a `long` value `n` representing the number of bytes to skip. When a value greater than `Integer.MAX_VALUE` is passed to this `InflaterInputStream.skip()` method, the current implementation in that method only skips at most `Integer.MAX_VALUE` bytes. `DeflaterInputStream.skip()` too has the same behaviour. However, in the case of `DeflaterInputStream.skip()`, this semantic is clearly noted in that method's API documentation. `InflaterInputStream.skip()` currently doesn't specify this behaviour. The commit in this PR updates the `InflaterInputStream.skip()` to specify the current implementation. I'll open a CSR for this change. ------------- Commit messages: - 8206447: InflaterInputStream.skip receives long but it's limited to Integer.MAX_VALUE Changes: https://git.openjdk.org/jdk/pull/19515/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19515&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8206447 Stats: 10 lines in 2 files changed: 7 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/19515.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19515/head:pull/19515 PR: https://git.openjdk.org/jdk/pull/19515 From iris at openjdk.org Mon Jun 3 05:36:03 2024 From: iris at openjdk.org (Iris Clark) Date: Mon, 3 Jun 2024 05:36:03 GMT Subject: RFR: 8333398: Uncomment the commented test in test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java In-Reply-To: References: Message-ID: On Mon, 3 Jun 2024 04:25:38 GMT, Jaikiran Pai wrote: > Can I please get a review of this test-only change which uncomments an additional test that was commented out in `test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java`? > > As noted in https://bugs.openjdk.org/browse/JDK-8333398, the original issue due to which this line was commented out in the test, has been fixed several releases back and thus this line can now be uncommented. > > I've verified that this test continues to pass with these changes. Marked as reviewed by iris (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/19514#pullrequestreview-2092824056 From jpai at openjdk.org Mon Jun 3 05:46:30 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Mon, 3 Jun 2024 05:46:30 GMT Subject: RFR: 8206447: InflaterInputStream.skip receives long but it's limited to Integer.MAX_VALUE [v2] In-Reply-To: References: Message-ID: > Can I please get a review of this change which updates the API specification of `java.util.zip.InflaterInputStream.skip()` method to match its current implementation? > > `InflaterInputStream.skip()`, just like `DeflaterInputStream.skip()`, takes a `long` value `n` representing the number of bytes to skip. When a value greater than `Integer.MAX_VALUE` is passed to this `InflaterInputStream.skip()` method, the current implementation in that method only skips at most `Integer.MAX_VALUE` bytes. `DeflaterInputStream.skip()` too has the same behaviour. However, in the case of `DeflaterInputStream.skip()`, this semantic is clearly noted in that method's API documentation. `InflaterInputStream.skip()` currently doesn't specify this behaviour. > > The commit in this PR updates the `InflaterInputStream.skip()` to specify the current implementation. > > I'll open a CSR for this change. Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: also note that the method may block, just like DeflaterInputStream specifies it ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19515/files - new: https://git.openjdk.org/jdk/pull/19515/files/2a116fe4..e13e65d2 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19515&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19515&range=00-01 Stats: 2 lines in 1 file changed: 2 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/19515.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19515/head:pull/19515 PR: https://git.openjdk.org/jdk/pull/19515 From jpai at openjdk.org Mon Jun 3 05:46:30 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Mon, 3 Jun 2024 05:46:30 GMT Subject: RFR: 8206447: InflaterInputStream.skip receives long but it's limited to Integer.MAX_VALUE In-Reply-To: References: Message-ID: On Mon, 3 Jun 2024 05:06:00 GMT, Jaikiran Pai wrote: > Can I please get a review of this change which updates the API specification of `java.util.zip.InflaterInputStream.skip()` method to match its current implementation? > > `InflaterInputStream.skip()`, just like `DeflaterInputStream.skip()`, takes a `long` value `n` representing the number of bytes to skip. When a value greater than `Integer.MAX_VALUE` is passed to this `InflaterInputStream.skip()` method, the current implementation in that method only skips at most `Integer.MAX_VALUE` bytes. `DeflaterInputStream.skip()` too has the same behaviour. However, in the case of `DeflaterInputStream.skip()`, this semantic is clearly noted in that method's API documentation. `InflaterInputStream.skip()` currently doesn't specify this behaviour. > > The commit in this PR updates the `InflaterInputStream.skip()` to specify the current implementation. > > I'll open a CSR for this change. The CSR is available for review at https://bugs.openjdk.org/browse/JDK-8333400 ------------- PR Comment: https://git.openjdk.org/jdk/pull/19515#issuecomment-2144323834 From duke at openjdk.org Mon Jun 3 06:13:35 2024 From: duke at openjdk.org (lingjun-cg) Date: Mon, 3 Jun 2024 06:13:35 GMT Subject: RFR: 8333396: Performance regression of new DecimalFormat and DecimalFormat.format [v2] In-Reply-To: References: Message-ID: <-uD4Wih5e1lvOwd2KFhBfcDKN1PrDr2aL_EVz1NzBC0=.48a676c7-cbac-422c-b3a5-763db15473ca@github.com> > ### Performance regression of DecimalFormat.format > From the output of perf, we can see the hottest regions contain atomic instructions. But when run with JDK 11, there is no such problem. The reason is the removed biased locking. > The DecimalFormat uses StringBuffer everywhere, and StringBuffer itself contains many synchronized methods. > So I added support for some new methods that accept StringBuilder which is lock-free. > > ### Performance regression of new DecimalFormat > After comparing the flame graph between current jdk and jdk 11, the method java.text.DecimalFormatSymbols#findNonFormatChar takes a significant time. The performance becomes as good as jdk11 after replacing it with a simple loop implementation. > > > > ### Test result > > @BenchmarkMode(Mode.AverageTime) > @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) > @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) > @State(Scope.Thread) > @OutputTimeUnit(TimeUnit.NANOSECONDS) > public class JmhDecimalFormat { > > private DecimalFormat format; > > @Setup(Level.Trial) > public void setup() { > format = new DecimalFormat("#0.00000"); > } > > @Benchmark > public void testNewAndFormat() throws InterruptedException { > new DecimalFormat("#0.00000").format(9524234.1236457); > } > > @Benchmark > public void testNewOnly() throws InterruptedException { > new DecimalFormat("#0.00000"); > } > > @Benchmark > public void testFormatOnly() throws InterruptedException { > format.format(9524234.1236457); > } > } > > #### Current JDK before optimize > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testFormatOnly avgt 50 642.099 ? 1.253 ns/op > JmhDecimalFormat.testNewAndFormat avgt 50 989.307 ? 3.676 ns/op > JmhDecimalFormat.testNewOnly avgt 50 303.381 ? 5.252 ns/op > > > > #### Current JDK after optimize > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testFormatOnly avgt 50 351.499 ? 0.761 ns/op > JmhDecimalFormat.testNewAndFormat avgt 50 615.145 ? 2.478 ns/op > JmhDecimalFormat.testNewOnly avgt 50 209.874 ? 9.951 ns/op > > > ### JDK 11 > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testFormatOnly avgt 50 364.214 ? 1.191 ns/op > JmhDecimalFormat.testNewAndFormat avgt 50 658.699 ? 2.311 ns/op > JmhDecimalFormat.testNewOnly avgt 50 248.300 ? 5.158 ns/op lingjun-cg has updated the pull request incrementally with one additional commit since the last revision: 8333396: Performance regression of new DecimalFormat and DecimalFormat.format ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19513/files - new: https://git.openjdk.org/jdk/pull/19513/files/a6755f8f..b48962b5 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19513&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19513&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/19513.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19513/head:pull/19513 PR: https://git.openjdk.org/jdk/pull/19513 From shade at openjdk.org Mon Jun 3 08:13:04 2024 From: shade at openjdk.org (Aleksey Shipilev) Date: Mon, 3 Jun 2024 08:13:04 GMT Subject: RFR: 8332586: Avoid cloning empty arrays in java.lang.reflect.{Method,Constructor} [v6] In-Reply-To: <9ci7LNaIJt3-hmeXTHJYCw4qc-LCW_WjFZ1wC70da3M=.8aa1d843-c71e-4b0b-b497-e18e52bfc48e@github.com> References: <9ci7LNaIJt3-hmeXTHJYCw4qc-LCW_WjFZ1wC70da3M=.8aa1d843-c71e-4b0b-b497-e18e52bfc48e@github.com> Message-ID: On Fri, 31 May 2024 18:39:33 GMT, jengebr wrote: >> Improve `java/lang/reflect/Method.java` by eliminating needless cloning of Class[0] instances. This cloning is intended to prevent callers from changing array contents, but many Methods have zero exceptions or zero parameters, and returning the original `Class[0]` is sufficient. >> >> Results from the included JMH benchmark: >> Before: >> >> Benchmark Mode Cnt Score Error Units >> ConstructorBenchmark.getExceptionTypes avgt 5 6.526 ? 0.183 ns/op >> ConstructorBenchmark.getExceptionTypesEmpty avgt 5 5.803 ? 0.073 ns/op >> ConstructorBenchmark.getParameterTypes avgt 5 6.521 ? 0.188 ns/op >> ConstructorBenchmark.getParameterTypesEmpty avgt 5 5.747 ? 0.087 ns/op >> MethodBenchmark.getExceptionTypes avgt 5 6.525 ? 0.163 ns/op >> MethodBenchmark.getExceptionTypesEmpty avgt 5 5.783 ? 0.130 ns/op >> MethodBenchmark.getParameterTypes avgt 5 6.518 ? 0.195 ns/op >> MethodBenchmark.getParameterTypesEmpty avgt 5 5.742 ? 0.028 ns/op >> >> >> After: >> >> Benchmark Mode Cnt Score Error Units >> ConstructorBenchmark.getExceptionTypes avgt 5 6.590 ? 0.124 ns/op >> ConstructorBenchmark.getExceptionTypesEmpty avgt 5 1.351 ? 0.061 ns/op >> ConstructorBenchmark.getParameterTypes avgt 5 6.651 ? 0.132 ns/op >> ConstructorBenchmark.getParameterTypesEmpty avgt 5 1.353 ? 0.150 ns/op >> MethodBenchmark.getExceptionTypes avgt 5 6.701 ? 0.151 ns/op >> MethodBenchmark.getExceptionTypesEmpty avgt 5 1.422 ? 0.025 ns/op >> MethodBenchmark.getParameterTypes avgt 5 6.629 ? 0.142 ns/op >> MethodBenchmark.getParameterTypesEmpty avgt 5 1.273 ? 0.169 ns/op > > jengebr has updated the pull request incrementally with one additional commit since the last revision: > > Fixing nits in benchmark I believe GHA failure (serviceability/jvmti/ObjectMonitorUsage/ObjectMonitorUsage, x86_32) is unrelated to this change, it is a known issue fixed in current master. We can proceed with integration. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19327#issuecomment-2144546824 From dholmes at openjdk.org Mon Jun 3 08:40:09 2024 From: dholmes at openjdk.org (David Holmes) Date: Mon, 3 Jun 2024 08:40:09 GMT Subject: RFR: 8331977: Crash: SIGSEGV in dlerror() In-Reply-To: References: Message-ID: On Fri, 31 May 2024 14:05:07 GMT, Alexey Semenyuk wrote: > Fix MainClassTest class to use HelloApp.AppOutputVerifier class to run app launcher instead of raw Executor. This makes MainClassTest test run app launchers with retries. This change addresses the primary issue. > > Fix inconsistencies in HelloApp.AppOutputVerifier class. It used to provide API allowing to run launchers without retries. It inconsistently allowed the execution of launchers with suppressed output (stdout and stderr). It inconsistently executed launchers with/without PATH removed from the environment. > > These loopholes were eliminated: > > - stdout and stderr of app launchers is never suppressed; > - PATH env variable is always deleted for app launchers on Windows. It is not deleted on other platforms. This change sets the correct scope of [JDK-8254920](https://bugs.openjdk.org/browse/JDK-8254920) fix that introduced the removal of PATH env variable for app launchers; > - app launchers are always executed with retries unless the launcher is executed with `jpackage.test.noexit` system property set to `true` indicating the test app will not terminate on its own. > > Other changes are due to changes in HelloApp.AppOutputVerifier class. I am yet to see anything that actually explains the cause of the `dlerror` crash here ??? ------------- PR Comment: https://git.openjdk.org/jdk/pull/19502#issuecomment-2144616488 From sgehwolf at openjdk.org Mon Jun 3 09:23:12 2024 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Mon, 3 Jun 2024 09:23:12 GMT Subject: RFR: 8261242: [Linux] OSContainer::is_containerized() returns true when run outside a container [v3] In-Reply-To: References: Message-ID: On Fri, 3 May 2024 16:05:30 GMT, Severin Gehwolf wrote: >> Please review this enhancement to the container detection code which allows it to figure out whether the JVM is actually running inside a container (`podman`, `docker`, `crio`), or with some other means that enforces memory/cpu limits by means of the cgroup filesystem. If neither of those conditions hold, the JVM runs in not containerized mode, addressing the issue described in the JBS tracker. For example, on my Linux system `is_containerized() == false" is being indicated with the following trace log line: >> >> >> [0.001s][debug][os,container] OSContainer::init: is_containerized() = false because no cpu or memory limit is present >> >> >> This state is being exposed by the Java `Metrics` API class using the new (still JDK internal) `isContainerized()` method. Example: >> >> >> java -XshowSettings:system --version >> Operating System Metrics: >> Provider: cgroupv1 >> System not containerized. >> openjdk 23-internal 2024-09-17 >> OpenJDK Runtime Environment (fastdebug build 23-internal-adhoc.sgehwolf.jdk-jdk) >> OpenJDK 64-Bit Server VM (fastdebug build 23-internal-adhoc.sgehwolf.jdk-jdk, mixed mode, sharing) >> >> >> The basic property this is being built on is the observation that the cgroup controllers typically get mounted read only into containers. Note that the current container tests assert that `OSContainer::is_containerized() == true` in various tests. Therefore, using the heuristic of "is any memory or cpu limit present" isn't sufficient. I had considered that in an earlier iteration, but many container tests failed. >> >> Overall, I think, with this patch we improve the current situation of claiming a containerized system being present when it's actually just a regular Linux system. >> >> Testing: >> >> - [x] GHA (risc-v failure seems infra related) >> - [x] Container tests on Linux x86_64 of cgroups v1 and cgroups v2 (including gtests) >> - [x] Some manual testing using cri-o >> >> Thoughts? > > Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 12 additional commits since the last revision: > > - Add doc for mountinfo scanning. > - Unify naming of variables > - Merge branch 'master' into jdk-8261242-is-containerized-fix > - Merge branch 'master' into jdk-8261242-is-containerized-fix > - jcheck fixes > - Fix tests > - Implement Metrics.isContainerized() > - Some clean-up > - Drop cgroups testing on plain Linux > - Implement fall-back logic for non-ro controller mounts > - ... and 2 more: https://git.openjdk.org/jdk/compare/88976cae...434430ca Keep open bot. Thanks. ------------- PR Comment: https://git.openjdk.org/jdk/pull/18201#issuecomment-2144706137 From duke at openjdk.org Mon Jun 3 09:51:09 2024 From: duke at openjdk.org (Oussama Louati) Date: Mon, 3 Jun 2024 09:51:09 GMT Subject: RFR: 8307818: Convert Indify tool to Classfile API [v10] In-Reply-To: <74l_lkysArBLJT8e9oXv8W0biPEPuXVwg6kBxfOjm8w=.385285ed-1d32-4a2a-9509-ace445fc94b7@github.com> References: <74l_lkysArBLJT8e9oXv8W0biPEPuXVwg6kBxfOjm8w=.385285ed-1d32-4a2a-9509-ace445fc94b7@github.com> Message-ID: On Wed, 22 May 2024 22:38:16 GMT, Oussama Louati wrote: >> test/jdk/java/lang/invoke/CallStaticInitOrder.java line 54: >> >>> 52: >>> 53: static int Init1Tick; >>> 54: public static class Init1 { >> >> Is there a reason to change all the classes and methods to public? > > the test throws a java.lang.IllegalAccessError Changed to original access modifier ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/18841#discussion_r1624137975 From ihse at openjdk.org Mon Jun 3 10:07:05 2024 From: ihse at openjdk.org (Magnus Ihse Bursie) Date: Mon, 3 Jun 2024 10:07:05 GMT Subject: Integrated: 8333301: Remove static builds using --enable-static-build In-Reply-To: References: Message-ID: On Thu, 30 May 2024 19:14:43 GMT, Magnus Ihse Bursie wrote: > The original way of building static libraries in the JDK was to use the configure argument --enable-static-build, which set the value of the make variable STATIC_BUILD. (Note that this is not the same as the source code definition STATIC_BUILD, which will be set by other means as well.) > > This method only ever worked on macOS, and has long since stopped working. It was originally introduced for the Mobile Project, but I've now learn that not even they use it anymore. > > It just adds clutter to the build system, and should be removed. This pull request has now been integrated. Changeset: f0bffbce Author: Magnus Ihse Bursie URL: https://git.openjdk.org/jdk/commit/f0bffbce35bb06e724857e8651dd429c4f9df284 Stats: 218 lines in 14 files changed: 4 ins; 206 del; 8 mod 8333301: Remove static builds using --enable-static-build Reviewed-by: sgehwolf, erikj ------------- PR: https://git.openjdk.org/jdk/pull/19487 From asotona at openjdk.org Mon Jun 3 10:11:34 2024 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 3 Jun 2024 10:11:34 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v13] In-Reply-To: References: Message-ID: > [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use classfile API for reflection proxy-generation. Actual implementation of `ProxyGenerator` is focused on performance, however it causes JDK bootstrap regressions. `ProxyGenerator.TEMPLATE` class model is statically created and each proxy class is transformed from the template. > > This patch is intended to examine plain proxy generation impact on performance and JDK bootstrap (vs proxy transformation from template). > > The generated proxy is migrated from static initialization to CONDY bootstrap. > > Please review. > > Thank you, > Adam Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: added ProxyGenBench JMH micro benchmark ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19410/files - new: https://git.openjdk.org/jdk/pull/19410/files/942342d5..834d65c5 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19410&range=12 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19410&range=11-12 Stats: 114 lines in 1 file changed: 114 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/19410.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19410/head:pull/19410 PR: https://git.openjdk.org/jdk/pull/19410 From asotona at openjdk.org Mon Jun 3 10:11:35 2024 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 3 Jun 2024 10:11:35 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v12] In-Reply-To: References: Message-ID: On Wed, 29 May 2024 07:17:38 GMT, Adam Sotona wrote: >> [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use classfile API for reflection proxy-generation. Actual implementation of `ProxyGenerator` is focused on performance, however it causes JDK bootstrap regressions. `ProxyGenerator.TEMPLATE` class model is statically created and each proxy class is transformed from the template. >> >> This patch is intended to examine plain proxy generation impact on performance and JDK bootstrap (vs proxy transformation from template). >> >> The generated proxy is migrated from static initialization to CONDY bootstrap. >> >> Please review. >> >> Thank you, >> Adam > > Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 13 additional commits since the last revision: > > - obsolete import > - Merge branch 'master' into JDK-8332457-proxy-startup > - missing bracket > - Update src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java > > Co-authored-by: liach <7806504+liach at users.noreply.github.com> > - removed obsolete entry > - MTD_ cleanup > - fixed javadoc > - CONDY implementation of ProxyGenerator > - simplification of the proxy class loading > - more improvements > - ... and 3 more: https://git.openjdk.org/jdk/compare/2ed35129...942342d5 Added `ProxyGenBenchmark` measuring generation time of 100 proxies. Results for master branch: Benchmark Mode Cnt Score Error Units Proxy.ProxyGenBench.generateProxies ss 10 12.266 ? 2.571 ms/op Results for this PR: Benchmark Mode Cnt Score Error Units Proxy.ProxyGenBench.generateProxies ss 10 9.851 ? 2.424 ms/op ------------- PR Comment: https://git.openjdk.org/jdk/pull/19410#issuecomment-2144806554 From sgehwolf at openjdk.org Mon Jun 3 10:12:16 2024 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Mon, 3 Jun 2024 10:12:16 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v29] In-Reply-To: <6Qs2lLk0mJP0XdyH9ysENqcUT7P0KxsWU95fvRzA21Q=.09e661a3-d340-4fde-8030-77db94a2d353@github.com> References: <6Qs2lLk0mJP0XdyH9ysENqcUT7P0KxsWU95fvRzA21Q=.09e661a3-d340-4fde-8030-77db94a2d353@github.com> Message-ID: On Sun, 2 Jun 2024 17:41:55 GMT, Alan Bateman wrote: > I've been looking through the changes. One thing that I'm wondering about is whether --generate-runtime-link-image should disable the keeping of packaged modules (set JLINK_KEEP_PACKAGED_MODULES to false). It seems surprising to use this configure option and have the jlink command in the build also copy the packaged modules into the image. @AlanBateman IMO those are orthogonal concepts. Note that the configure options are `--enable-packaged-modules` and `--enable-runtime-link-image`. The corresponding `jlink` options are `--keep-packaged-modules` and `--generate-linkable-runtime`. My mental model is that with this patch it allows a more flexible distribution of the JDK build. The testing story also seems easier in its current form. All non-linkable runtime tests run as-is - with a linkable runtime build - but also run linkable runtime tests (those have appropriate `@requires` tags). We've had some discussion around this already in this review thread. I'm arguing that both configure options make sense independently and in combination. The user can configure it to their liking. What I'd try to avoid is needing to produce two different builds whether or not the JDK is runtime linkable or not. That is because our prime use-case is to make `jmods` optional when `jlink` is being used post build and test. I've tried to explain it earlier [here](https://github.com/openjdk/jdk/pull/14787#issuecomment-1999307995) and [here](https://github.com/openjdk/jdk/pull/14787#issuecomment-2003848668). @mlchung seemed OK with it [here](https://github.com/openjdk/jdk/pull/14787#issuecomment-2004605507) and @erikj79 was ok with it as well [here](https://github.com/openjdk/jdk/pull/14787#issuecomment-2004761747). Is there a specific reason this needs to be done? With the current patch `--enable-runtime-link-image` influences how the `jimage` in `lib/modules` looks like (adds some metadata) nothing else. `--enable-packaged-modules` influences copying of the packaged modules. Right now, what you are suggesting could be achieved with these configure options: `--enable-runtime-link-image --disable-packaged-modules` Is that not sufficient? Thoughts? ------------- PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2144808992 From redestad at openjdk.org Mon Jun 3 10:33:03 2024 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 3 Jun 2024 10:33:03 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v13] In-Reply-To: References: Message-ID: On Mon, 3 Jun 2024 10:11:34 GMT, Adam Sotona wrote: >> [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use classfile API for reflection proxy-generation. Actual implementation of `ProxyGenerator` is focused on performance, however it causes JDK bootstrap regressions. `ProxyGenerator.TEMPLATE` class model is statically created and each proxy class is transformed from the template. >> >> This patch is intended to examine plain proxy generation impact on performance and JDK bootstrap (vs proxy transformation from template). >> >> The generated proxy is migrated from static initialization to CONDY bootstrap. >> >> Please review. >> >> Thank you, >> Adam > > Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: > > added ProxyGenBench JMH micro benchmark test/micro/org/openjdk/bench/java/lang/reflect/Proxy/ProxyGenBench.java line 66: > 64: ClassDesc tempDesc = ClassDesc.ofDescriptor(Interfaze.class.descriptorString()); > 65: loader = new ClsLoader(); > 66: clsMap = new HashMap<>(100); Suggestion: clsMap = HashMap.newHashMap(100); ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19410#discussion_r1624192732 From lancea at openjdk.org Mon Jun 3 11:03:03 2024 From: lancea at openjdk.org (Lance Andersen) Date: Mon, 3 Jun 2024 11:03:03 GMT Subject: RFR: 8333398: Uncomment the commented test in test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java In-Reply-To: References: Message-ID: On Mon, 3 Jun 2024 04:25:38 GMT, Jaikiran Pai wrote: > Can I please get a review of this test-only change which uncomments an additional test that was commented out in `test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java`? > > As noted in https://bugs.openjdk.org/browse/JDK-8333398, the original issue due to which this line was commented out in the test, has been fixed several releases back and thus this line can now be uncommented. > > I've verified that this test continues to pass with these changes. Change looks fine. We should look at at a later date to convert this to junit and when we do, look to rework isMultiReleaseJar() as it actually runs multiple tests within the test itself and if one fails, the rest will not be run ------------- Marked as reviewed by lancea (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19514#pullrequestreview-2093508099 From lancea at openjdk.org Mon Jun 3 11:07:01 2024 From: lancea at openjdk.org (Lance Andersen) Date: Mon, 3 Jun 2024 11:07:01 GMT Subject: RFR: 8206447: InflaterInputStream.skip receives long but it's limited to Integer.MAX_VALUE [v2] In-Reply-To: References: Message-ID: On Mon, 3 Jun 2024 05:46:30 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which updates the API specification of `java.util.zip.InflaterInputStream.skip()` method to match its current implementation? >> >> `InflaterInputStream.skip()`, just like `DeflaterInputStream.skip()`, takes a `long` value `n` representing the number of bytes to skip. When a value greater than `Integer.MAX_VALUE` is passed to this `InflaterInputStream.skip()` method, the current implementation in that method only skips at most `Integer.MAX_VALUE` bytes. `DeflaterInputStream.skip()` too has the same behaviour. However, in the case of `DeflaterInputStream.skip()`, this semantic is clearly noted in that method's API documentation. `InflaterInputStream.skip()` currently doesn't specify this behaviour. >> >> The commit in this PR updates the `InflaterInputStream.skip()` to specify the current implementation. >> >> I'll open a CSR for this change. > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > also note that the method may block, just like DeflaterInputStream specifies it Marked as reviewed by lancea (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/19515#pullrequestreview-2093515783 From asotona at openjdk.org Mon Jun 3 11:09:31 2024 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 3 Jun 2024 11:09:31 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v14] In-Reply-To: References: Message-ID: <5KL3je2BA4s5IEKwoV4WfzqOgCbbadPdiXI6zWZV6qg=.302bd6cd-5dc7-4cf9-9705-0f3b9c39c9b0@github.com> > [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use classfile API for reflection proxy-generation. Actual implementation of `ProxyGenerator` is focused on performance, however it causes JDK bootstrap regressions. `ProxyGenerator.TEMPLATE` class model is statically created and each proxy class is transformed from the template. > > This patch is intended to examine plain proxy generation impact on performance and JDK bootstrap (vs proxy transformation from template). > > The generated proxy is migrated from static initialization to CONDY bootstrap. > > Please review. > > Thank you, > Adam Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: ProxyGenBench simplification ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19410/files - new: https://git.openjdk.org/jdk/pull/19410/files/834d65c5..7b00967d Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19410&range=13 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19410&range=12-13 Stats: 44 lines in 1 file changed: 1 ins; 33 del; 10 mod Patch: https://git.openjdk.org/jdk/pull/19410.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19410/head:pull/19410 PR: https://git.openjdk.org/jdk/pull/19410 From asotona at openjdk.org Mon Jun 3 11:09:31 2024 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 3 Jun 2024 11:09:31 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v13] In-Reply-To: References: Message-ID: <-CsYt0CTtBan0JkQvdA3sC2ZDZSskBO_Sn2_GvF-Trg=.35c79ca5-2e99-4fbe-aacf-d353a26b35a9@github.com> On Mon, 3 Jun 2024 10:30:03 GMT, Claes Redestad wrote: >> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: >> >> added ProxyGenBench JMH micro benchmark > > test/micro/org/openjdk/bench/java/lang/reflect/Proxy/ProxyGenBench.java line 66: > >> 64: ClassDesc tempDesc = ClassDesc.ofDescriptor(Interfaze.class.descriptorString()); >> 65: loader = new ClsLoader(); >> 66: clsMap = new HashMap<>(100); > > Suggestion: > > clsMap = HashMap.newHashMap(100); I've simplified it a lot. It uses a new `ClassLoader` instance for each proxy generation, instead of preparation of 100 different interfaces. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19410#discussion_r1624235034 From dl at openjdk.org Mon Jun 3 11:19:08 2024 From: dl at openjdk.org (Doug Lea) Date: Mon, 3 Jun 2024 11:19:08 GMT Subject: RFR: 8322732: ForkJoinPool may underutilize cores in async mode [v17] In-Reply-To: References: Message-ID: On Sun, 2 Jun 2024 14:33:45 GMT, Viktor Klang wrote: >> Doug Lea has updated the pull request incrementally with one additional commit since the last revision: >> >> Reconcile changes > > src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 1345: > >> 1343: int b = base, p = top, cap; >> 1344: if (p - b > 0 && a != null && (cap = a.length) > 0) { >> 1345: for (int m = cap - 1, s, nb;;) { > > @DougLea I'm curious, what effect did you see if moving the `p - b > 0` out of the loop conditional? This was part of saving a read in the common case of empty local queue. Barely but reliably worth doing. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1624246576 From redestad at openjdk.org Mon Jun 3 11:40:02 2024 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 3 Jun 2024 11:40:02 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v14] In-Reply-To: <5KL3je2BA4s5IEKwoV4WfzqOgCbbadPdiXI6zWZV6qg=.302bd6cd-5dc7-4cf9-9705-0f3b9c39c9b0@github.com> References: <5KL3je2BA4s5IEKwoV4WfzqOgCbbadPdiXI6zWZV6qg=.302bd6cd-5dc7-4cf9-9705-0f3b9c39c9b0@github.com> Message-ID: On Mon, 3 Jun 2024 11:09:31 GMT, Adam Sotona wrote: >> [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use classfile API for reflection proxy-generation. Actual implementation of `ProxyGenerator` is focused on performance, however it causes JDK bootstrap regressions. `ProxyGenerator.TEMPLATE` class model is statically created and each proxy class is transformed from the template. >> >> This patch is intended to examine plain proxy generation impact on performance and JDK bootstrap (vs proxy transformation from template). >> >> The generated proxy is migrated from static initialization to CONDY bootstrap. >> >> Please review. >> >> Thank you, >> Adam > > Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: > > ProxyGenBench simplification test/micro/org/openjdk/bench/java/lang/reflect/Proxy/ProxyGenBench.java line 23: > 21: * questions. > 22: */ > 23: package org.openjdk.bench.java.lang.reflect.Proxy; Package name needs to be lowercase. Not sure why the folder name is uppercase Proxy, but the two pre-existing benchmarks both have lower case package declarations. Uppercase letters in package names may subtly break a few tools ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19410#discussion_r1624270828 From asotona at openjdk.org Mon Jun 3 12:00:30 2024 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 3 Jun 2024 12:00:30 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v15] In-Reply-To: References: Message-ID: > [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use classfile API for reflection proxy-generation. Actual implementation of `ProxyGenerator` is focused on performance, however it causes JDK bootstrap regressions. `ProxyGenerator.TEMPLATE` class model is statically created and each proxy class is transformed from the template. > > This patch is intended to examine plain proxy generation impact on performance and JDK bootstrap (vs proxy transformation from template). > > The generated proxy is migrated from static initialization to CONDY bootstrap. > > Please review. > > Thank you, > Adam Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: ProxyGenBench moved ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19410/files - new: https://git.openjdk.org/jdk/pull/19410/files/7b00967d..09baa376 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19410&range=14 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19410&range=13-14 Stats: 0 lines in 1 file changed: 0 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/19410.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19410/head:pull/19410 PR: https://git.openjdk.org/jdk/pull/19410 From asotona at openjdk.org Mon Jun 3 12:04:29 2024 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 3 Jun 2024 12:04:29 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v16] In-Reply-To: References: Message-ID: <-NxgxkvbajhdQ8NO_N5rL77A8DyXQmdO28Fi7C76JH8=.f9bf1ac6-192b-4610-92ae-f3a4b9d81f89@github.com> > [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use classfile API for reflection proxy-generation. Actual implementation of `ProxyGenerator` is focused on performance, however it causes JDK bootstrap regressions. `ProxyGenerator.TEMPLATE` class model is statically created and each proxy class is transformed from the template. > > This patch is intended to examine plain proxy generation impact on performance and JDK bootstrap (vs proxy transformation from template). > > The generated proxy is migrated from static initialization to CONDY bootstrap. > > Please review. > > Thank you, > Adam Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: fixed package ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19410/files - new: https://git.openjdk.org/jdk/pull/19410/files/09baa376..29e269f5 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19410&range=15 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19410&range=14-15 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/19410.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19410/head:pull/19410 PR: https://git.openjdk.org/jdk/pull/19410 From asotona at openjdk.org Mon Jun 3 12:04:29 2024 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 3 Jun 2024 12:04:29 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v14] In-Reply-To: References: <5KL3je2BA4s5IEKwoV4WfzqOgCbbadPdiXI6zWZV6qg=.302bd6cd-5dc7-4cf9-9705-0f3b9c39c9b0@github.com> Message-ID: On Mon, 3 Jun 2024 11:37:34 GMT, Claes Redestad wrote: >> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: >> >> ProxyGenBench simplification > > test/micro/org/openjdk/bench/java/lang/reflect/Proxy/ProxyGenBench.java line 23: > >> 21: * questions. >> 22: */ >> 23: package org.openjdk.bench.java.lang.reflect.Proxy; > > Package name needs to be lowercase. Not sure why the folder name is uppercase Proxy, but the two pre-existing benchmarks both have lower case package declarations. Uppercase letters in package names may subtly break a few tools Yes, I've moved it down to j/l/reflect. However the existing benchmarks probably need a separate treatment. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19410#discussion_r1624297815 From vklang at openjdk.org Mon Jun 3 12:26:06 2024 From: vklang at openjdk.org (Viktor Klang) Date: Mon, 3 Jun 2024 12:26:06 GMT Subject: RFR: 8322732: ForkJoinPool may underutilize cores in async mode [v17] In-Reply-To: References: Message-ID: On Mon, 3 Jun 2024 11:16:49 GMT, Doug Lea
wrote: >> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 1345: >> >>> 1343: int b = base, p = top, cap; >>> 1344: if (p - b > 0 && a != null && (cap = a.length) > 0) { >>> 1345: for (int m = cap - 1, s, nb;;) { >> >> @DougLea I'm curious, what effect did you see if moving the `p - b > 0` out of the loop conditional? > > This was part of saving a read in the common case of empty local queue. Barely but reliably worth doing. ? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1624352663 From alanb at openjdk.org Mon Jun 3 12:58:15 2024 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 3 Jun 2024 12:58:15 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v29] In-Reply-To: <6Qs2lLk0mJP0XdyH9ysENqcUT7P0KxsWU95fvRzA21Q=.09e661a3-d340-4fde-8030-77db94a2d353@github.com> References: <6Qs2lLk0mJP0XdyH9ysENqcUT7P0KxsWU95fvRzA21Q=.09e661a3-d340-4fde-8030-77db94a2d353@github.com> Message-ID: On Sun, 2 Jun 2024 17:41:55 GMT, Alan Bateman wrote: >> Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 110 commits: >> >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - Fix new line in jlink.properties >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - Simplify JLINK_JDK_EXTRA_OPTS var handling >> - Only add runtime track files for linkable runtimes >> - Generate the runtime image link diff at jlink time >> >> But only do that once the plugin-pipeline has run. The generation is >> enabled with the hidden option '--generate-linkable-runtime' and >> the resource pools available at jlink time are being used to generate >> the diff. >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - Use shorter name for the build tool >> - Review feedback from Erik J. >> - Remove dependency on CDS which isn't needed anymore >> - ... and 100 more: https://git.openjdk.org/jdk/compare/4f1a10f8...e1e3f02f > > I've been looking through the changes. One thing that I'm wondering about is whether --generate-runtime-link-image should disable the keeping of packaged modules (set JLINK_KEEP_PACKAGED_MODULES to false). It seems surprising to use this configure option and have the jlink command in the build also copy the packaged modules into the image. > > (Doing that would of course mean that several existing jlink tests would need some changes, either to `@requires` or to remove the checks for the `jmods` directory) > @AlanBateman IMO those are orthogonal concepts. The purpose of --enable-runtime-link-image is to produce a run-time image that is capable of running jlink without the packaged modules. The benefit is is a reducing size on the file system but you don't get that benefit if the packages modules are copied in the image. So I think we may have the wrong default. Yes, they are separate configure and jlink options but I'm wondering if it would be more sensible to opt-in(not opt-out) to keep the packaged modules when configured with --enable-runtime-link-image. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2145136017 From duke at openjdk.org Mon Jun 3 13:41:14 2024 From: duke at openjdk.org (jengebr) Date: Mon, 3 Jun 2024 13:41:14 GMT Subject: Integrated: 8332586: Avoid cloning empty arrays in java.lang.reflect.{Method,Constructor} In-Reply-To: References: Message-ID: On Tue, 21 May 2024 13:49:18 GMT, jengebr wrote: > Improve `java/lang/reflect/Method.java` by eliminating needless cloning of Class[0] instances. This cloning is intended to prevent callers from changing array contents, but many Methods have zero exceptions or zero parameters, and returning the original `Class[0]` is sufficient. > > Results from the included JMH benchmark: > Before: > > Benchmark Mode Cnt Score Error Units > ConstructorBenchmark.getExceptionTypes avgt 5 6.526 ? 0.183 ns/op > ConstructorBenchmark.getExceptionTypesEmpty avgt 5 5.803 ? 0.073 ns/op > ConstructorBenchmark.getParameterTypes avgt 5 6.521 ? 0.188 ns/op > ConstructorBenchmark.getParameterTypesEmpty avgt 5 5.747 ? 0.087 ns/op > MethodBenchmark.getExceptionTypes avgt 5 6.525 ? 0.163 ns/op > MethodBenchmark.getExceptionTypesEmpty avgt 5 5.783 ? 0.130 ns/op > MethodBenchmark.getParameterTypes avgt 5 6.518 ? 0.195 ns/op > MethodBenchmark.getParameterTypesEmpty avgt 5 5.742 ? 0.028 ns/op > > > After: > > Benchmark Mode Cnt Score Error Units > ConstructorBenchmark.getExceptionTypes avgt 5 6.590 ? 0.124 ns/op > ConstructorBenchmark.getExceptionTypesEmpty avgt 5 1.351 ? 0.061 ns/op > ConstructorBenchmark.getParameterTypes avgt 5 6.651 ? 0.132 ns/op > ConstructorBenchmark.getParameterTypesEmpty avgt 5 1.353 ? 0.150 ns/op > MethodBenchmark.getExceptionTypes avgt 5 6.701 ? 0.151 ns/op > MethodBenchmark.getExceptionTypesEmpty avgt 5 1.422 ? 0.025 ns/op > MethodBenchmark.getParameterTypes avgt 5 6.629 ? 0.142 ns/op > MethodBenchmark.getParameterTypesEmpty avgt 5 1.273 ? 0.169 ns/op This pull request has now been integrated. Changeset: 27af19d9 Author: John Engebretson Committer: Aleksey Shipilev URL: https://git.openjdk.org/jdk/commit/27af19d921a5cf15f5146471b58961815690b4f2 Stats: 177 lines in 4 files changed: 170 ins; 1 del; 6 mod 8332586: Avoid cloning empty arrays in java.lang.reflect.{Method,Constructor} Reviewed-by: shade, rriggs, liach ------------- PR: https://git.openjdk.org/jdk/pull/19327 From asotona at openjdk.org Mon Jun 3 13:50:19 2024 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 3 Jun 2024 13:50:19 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v17] In-Reply-To: References: Message-ID: > [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use classfile API for reflection proxy-generation. Actual implementation of `ProxyGenerator` is focused on performance, however it causes JDK bootstrap regressions. `ProxyGenerator.TEMPLATE` class model is statically created and each proxy class is transformed from the template. > > This patch is intended to examine plain proxy generation impact on performance and JDK bootstrap (vs proxy transformation from template). > > The generated proxy is migrated from static initialization to CONDY bootstrap. > > Please review. > > Thank you, > Adam Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: ClassFile context made static ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19410/files - new: https://git.openjdk.org/jdk/pull/19410/files/29e269f5..fb3cdcdd Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19410&range=16 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19410&range=15-16 Stats: 12 lines in 1 file changed: 3 ins; 8 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/19410.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19410/head:pull/19410 PR: https://git.openjdk.org/jdk/pull/19410 From asotona at openjdk.org Mon Jun 3 14:39:12 2024 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 3 Jun 2024 14:39:12 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v3] In-Reply-To: References: Message-ID: On Mon, 27 May 2024 12:20:20 GMT, Chen Liang wrote: >> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: >> >> performance improvements > > src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java line 76: > >> 74: >> 75: private static final MethodTypeDesc >> 76: MTD_boolean = MethodTypeDescImpl.ofValidated(CD_boolean, ConstantUtils.EMPTY_CLASSDESC), > > Maybe we can change the `MethodTypeDescImpl.ofValidated` to varargs so we don't need explicit array initializations. Yes, I like that idea. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19410#discussion_r1624576109 From asemenyuk at openjdk.org Mon Jun 3 14:41:07 2024 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Mon, 3 Jun 2024 14:41:07 GMT Subject: RFR: 8331977: Crash: SIGSEGV in dlerror() In-Reply-To: References: Message-ID: On Mon, 3 Jun 2024 08:37:50 GMT, David Holmes wrote: >> Fix MainClassTest class to use HelloApp.AppOutputVerifier class to run app launcher instead of raw Executor. This makes MainClassTest test run app launchers with retries. This change addresses the primary issue. >> >> Fix inconsistencies in HelloApp.AppOutputVerifier class. It used to provide API allowing to run launchers without retries. It inconsistently allowed the execution of launchers with suppressed output (stdout and stderr). It inconsistently executed launchers with/without PATH removed from the environment. >> >> These loopholes were eliminated: >> >> - stdout and stderr of app launchers is never suppressed; >> - PATH env variable is always deleted for app launchers on Windows. It is not deleted on other platforms. This change sets the correct scope of [JDK-8254920](https://bugs.openjdk.org/browse/JDK-8254920) fix that introduced the removal of PATH env variable for app launchers; >> - app launchers are always executed with retries unless the launcher is executed with `jpackage.test.noexit` system property set to `true` indicating the test app will not terminate on its own. >> >> Other changes are due to changes in HelloApp.AppOutputVerifier class. > > I am yet to see anything that actually explains the cause of the `dlerror` crash here ??? @dholmes-ora there is no fix for the cause of the `dlerror` crash in this PR. The PR fixes jpackage tests to rerun a launcher if it crashes. This workaround for jpackage tests was first introduced in [JDK-8269403](https://bugs.openjdk.org/browse/JDK-8269403) fix but MainClassTest was left unfixed back then. This PR complements [JDK-8269403](https://bugs.openjdk.org/browse/JDK-8269403). ------------- PR Comment: https://git.openjdk.org/jdk/pull/19502#issuecomment-2145373568 From asotona at openjdk.org Mon Jun 3 14:43:15 2024 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 3 Jun 2024 14:43:15 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v18] In-Reply-To: References: Message-ID: <2gq6-2yMBh8Q-C8QE3-Mbqwz4EtSvLynO-TW0QN_Rh0=.97f6694a-778a-44f4-aa8e-d9cab29a5cff@github.com> > [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use classfile API for reflection proxy-generation. Actual implementation of `ProxyGenerator` is focused on performance, however it causes JDK bootstrap regressions. `ProxyGenerator.TEMPLATE` class model is statically created and each proxy class is transformed from the template. > > This patch is intended to examine plain proxy generation impact on performance and JDK bootstrap (vs proxy transformation from template). > > The generated proxy is migrated from static initialization to CONDY bootstrap. > > Please review. > > Thank you, > Adam Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: MethodTypeDescImpl::ofValidated changed to varargs ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19410/files - new: https://git.openjdk.org/jdk/pull/19410/files/fb3cdcdd..6ca164bc Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19410&range=17 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19410&range=16-17 Stats: 14 lines in 2 files changed: 0 ins; 0 del; 14 mod Patch: https://git.openjdk.org/jdk/pull/19410.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19410/head:pull/19410 PR: https://git.openjdk.org/jdk/pull/19410 From volker.simonis at gmail.com Mon Jun 3 15:03:28 2024 From: volker.simonis at gmail.com (Volker Simonis) Date: Mon, 3 Jun 2024 17:03:28 +0200 Subject: Status of project "Brisbane"? Message-ID: Hi, What's the status of Project Brisbane? According to [1], the Project was approved two month ago on April 4th, but until now I can't find it listed on openjdk.org nor can I find a corresponding mailing list? Best regards, Volker [1] https://mail.openjdk.org/pipermail/announce/2024-April/000350.html From sgehwolf at openjdk.org Mon Jun 3 15:43:15 2024 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Mon, 3 Jun 2024 15:43:15 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v29] In-Reply-To: References: <6Qs2lLk0mJP0XdyH9ysENqcUT7P0KxsWU95fvRzA21Q=.09e661a3-d340-4fde-8030-77db94a2d353@github.com> Message-ID: On Mon, 3 Jun 2024 12:55:54 GMT, Alan Bateman wrote: > So I think we may have the wrong default. Yes, they are separate configure and jlink options but I'm wondering if it would be more sensible to opt-in(not opt-out) to keep the packaged modules when configured with --enable-runtime-link-image. OK. I'll rework it so that we'll have: | config opts | effect | equivalent to | | -----------------|----------|---------------------| | `--enable-runtime-link-image` | produces a linkable runtime **without** packaged modules even though the default of `--enable-packaged-modules` is otherwise `true`.| `--enable-runtime-link-image --disable-packaged-modules`| | `--enable-runtime-link-image --enable-packaged-modules`| produces a linkable runtime **with** packaged modules, overriding the default of packaged modules not being enabled when `--enable-runtime-link-image` is being used otherwise | N/A| | `--disable-runtime-link-image` | Default as of today. Adds packaged modules, with no run time link supporting jimage | `--disable-runtime-link-image --enable-packaged-modules`| | `--disable-runtime-link-image --disable-packaged-modules` | No linkable jimage runtime, no packaged modules in the resulting JDK | N/A | Does that proposal sound good? ------------- PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2145540168 From naoto at openjdk.org Mon Jun 3 15:55:08 2024 From: naoto at openjdk.org (Naoto Sato) Date: Mon, 3 Jun 2024 15:55:08 GMT Subject: RFR: 8333103: Re-examine the console provider loading [v2] In-Reply-To: References: Message-ID: On Thu, 30 May 2024 19:48:25 GMT, Naoto Sato wrote: >> There is an initialization code in `Console` class that searches for the Console implementations. Refactoring the init code not to use lambda/stream would reduce the (initial) number of loaded classes by about 100 for java.base implementations. This would become relevant when the java.io.IO (JEP 477) uses Console as the underlying framework. > > Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: > > Clarify the comment for multiple impls in the module case Thank you for your reviews! ------------- PR Comment: https://git.openjdk.org/jdk/pull/19467#issuecomment-2145561992 From naoto at openjdk.org Mon Jun 3 15:55:09 2024 From: naoto at openjdk.org (Naoto Sato) Date: Mon, 3 Jun 2024 15:55:09 GMT Subject: Integrated: 8333103: Re-examine the console provider loading In-Reply-To: References: Message-ID: On Wed, 29 May 2024 19:51:36 GMT, Naoto Sato wrote: > There is an initialization code in `Console` class that searches for the Console implementations. Refactoring the init code not to use lambda/stream would reduce the (initial) number of loaded classes by about 100 for java.base implementations. This would become relevant when the java.io.IO (JEP 477) uses Console as the underlying framework. This pull request has now been integrated. Changeset: 9686e804 Author: Naoto Sato URL: https://git.openjdk.org/jdk/commit/9686e804a2b058955ff88149c54a0a7896c0a2eb Stats: 23 lines in 1 file changed: 5 ins; 0 del; 18 mod 8333103: Re-examine the console provider loading Reviewed-by: redestad, jpai ------------- PR: https://git.openjdk.org/jdk/pull/19467 From jjg at openjdk.org Mon Jun 3 16:12:09 2024 From: jjg at openjdk.org (Jonathan Gibbons) Date: Mon, 3 Jun 2024 16:12:09 GMT Subject: RFR: 8330954: since-checker - Fix remaining `@since` tags in `java.base` [v4] In-Reply-To: References: Message-ID: On Mon, 13 May 2024 20:14:38 GMT, Nizar Benalla wrote: >> Please review this PR that aims to add all the remaining needed `@since` tags in `java.base`, and group them into a single fix. >> This is related to #18934 and my work around the `@since` checker feature. >> Explicit `@since` tags are needed for some overriding methods for the purpose of the checker. >> >> I will only give the example with the `CompletableFuture` class but here is the before where the methods only appeared in "Methods declared in interface N" >> >> Screenshot 2024-05-06 at 00 06 57 >> >> >> >> and after where the method has it's own javadoc, the main description is added and the `@since` tags are added as intended. >> >> I don't have an account on `https://cr.openjdk.org/` but I could host the generated docs somewhere if that is needed. >> >> Screenshot 2024-05-06 at 00 07 16 >> >> Screenshot 2024-05-06 at 00 08 06 >> >> Screenshot 2024-05-06 at 00 09 03 >> >> >> TIA > > Nizar Benalla has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision: > > - Merge remote-tracking branch 'upstream/master' into 8330954 > - (C) > - (C) > - Move security classes changes to pr18373 > - remove couple extra lines > - Pull request is now only about `@since` tags, might add an other commit > - add one more `{inheritDoc}` to `CompletableFuture.state` > - add `@throws` declarations to javadoc > - add ``{@inheritDoc}`` to new javadoc comments > - remove two extra spaces > - ... and 1 more: https://git.openjdk.org/jdk/compare/39767aaa...b3574b97 I disagree somewhat with the statements in the comments that the checker should follow the javadoc rules, whatever they are. The important thing is to decide what the rules for `@since` should be, in terms of changes to the set of signatures in the class. Generally, I think the rule should be that _every_ declaration should have `@since` _except_ that members need not have the tag if it would be the same as for the enclosing class or interface. As far as adding an overriding method is concerned, if it has the same VM descriptor as the overridden method, it is not a "new" method in the class; if it has a covariant return type, that is a significant change to the descriptor and so such methods should have `@since`. As a practical rule for deciding whether any declaration is new or not, imagine writing a test program that refers to the most specific form of the declaration. If that test program does not compile on JDK version N-1 and does compile on version N, then it warrants having `@since N`. Put another way, `@since N` should identify the first release in which the declaration can be used in the given form. Note, these rules are stated without reference to what `javadoc` does. `javadoc` should follow these rules as well; it is a bug if the tool generates incorrect documentation based on `@since` tags following these rules. Also, while the proposed new Since Checker should follow these rules when analysing declarations, it may go further when making suggestions to correct errors that it finds. For example, instead of simply saying _No `@since` tag found here_, it might analyze the history and say _No `@since` tag found here; the declaration was introduced in X_ for an appropriate X. ------------- PR Comment: https://git.openjdk.org/jdk/pull/18954#issuecomment-2145605004 From duke at openjdk.org Mon Jun 3 18:00:35 2024 From: duke at openjdk.org (Sean Gwizdak) Date: Mon, 3 Jun 2024 18:00:35 GMT Subject: RFR: 8332249: Micro-optimize Method.hashCode [v2] In-Reply-To: References: Message-ID: <_cZQqk-UhO06IobPUiqc0kCoRfquUsz2SkrSuo2RDdM=.3da1e381-920c-4be1-9409-d0f6382c82de@github.com> > Improve the speed of Method.hashCode by caching the hashcode on first use. I've seen an application where Method.hashCode is a hot path, and this is a fairly simple speedup. The memory overhead is low. > > This addresses issue [JDK-8332249](https://bugs.openjdk.org/browse/JDK-8332249). > > Before: > > Benchmark Mode Cnt Score Error Units > # Intel Skylake > MethodHashCode.benchmarkHashCode avgt 5 1.843 ? 0.149 ns/op > # Arm Neoverse N1 > MethodHashCode.benchmarkHashCode avgt 5 2.363 ? 0.091 ns/op > > > > After: > > > Benchmark Mode Cnt Score Error Units > # Intel Skylake > MethodHashCode.benchmarkHashCode avgt 5 1.121 ? 1.189 ns/op > # Arm Neoverse N1 > MethodHashCode.benchmarkHashCode avgt 5 1.001 ? 0.001 ns/op Sean Gwizdak has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision: - Remove trailing whitespace. - Move hashCode benchmark into the newly created MethodBenchmark file - Merge branch 'master' into method-hashcode-JDK-8332249 - Remove changes to JavaDoc per guidance. - Fix whitespace issues pointed by the bot - Micro-optimize Method.hashCode ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19433/files - new: https://git.openjdk.org/jdk/pull/19433/files/2e4c0c94..4364d99d Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19433&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19433&range=00-01 Stats: 30025 lines in 868 files changed: 18155 ins; 7339 del; 4531 mod Patch: https://git.openjdk.org/jdk/pull/19433.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19433/head:pull/19433 PR: https://git.openjdk.org/jdk/pull/19433 From duke at openjdk.org Mon Jun 3 18:00:35 2024 From: duke at openjdk.org (Sean Gwizdak) Date: Mon, 3 Jun 2024 18:00:35 GMT Subject: RFR: 8332249: Micro-optimize Method.hashCode In-Reply-To: References: Message-ID: <1nHePCi8zFt1wPVCivejS_9ITXsGL0EXc4flQv3jieY=.3e19574a-29ce-47eb-9011-f3d152eec408@github.com> On Tue, 28 May 2024 17:25:34 GMT, Sean Gwizdak wrote: > Improve the speed of Method.hashCode by caching the hashcode on first use. I've seen an application where Method.hashCode is a hot path, and this is a fairly simple speedup. The memory overhead is low. > > This addresses issue [JDK-8332249](https://bugs.openjdk.org/browse/JDK-8332249). > > Before: > > Benchmark Mode Cnt Score Error Units > # Intel Skylake > MethodHashCode.benchmarkHashCode avgt 5 1.843 ? 0.149 ns/op > # Arm Neoverse N1 > MethodHashCode.benchmarkHashCode avgt 5 2.363 ? 0.091 ns/op > > > > After: > > > Benchmark Mode Cnt Score Error Units > # Intel Skylake > MethodHashCode.benchmarkHashCode avgt 5 1.121 ? 1.189 ns/op > # Arm Neoverse N1 > MethodHashCode.benchmarkHashCode avgt 5 1.001 ? 0.001 ns/op Minor change after draft review -- moved Method hashCode benchmark into the newly created MethodBenchmark file. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19433#issuecomment-2145806129 From nbenalla at openjdk.org Mon Jun 3 18:05:43 2024 From: nbenalla at openjdk.org (Nizar Benalla) Date: Mon, 3 Jun 2024 18:05:43 GMT Subject: RFR: 8332072: Convert package.html files in `java.naming` to package-info.java Message-ID: Can I please get a review for this small change? The motivation is that javac does not recognize `package.html` files. The conversion was simple, I used a script to rename the files, append "*" on the left and remove some HTML tags like and . I did the conversion in place, renaming them in git but with the big amount of change git thinks it's a new file. I also added a new `package-info.java` file to `javax.naming.ldap.spi`. I hope that's fine. ------------- Commit messages: - remove whitespace - 8332072: Convert package.html files in `java.naming` to package-info.java Changes: https://git.openjdk.org/jdk/pull/19529/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19529&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8332072 Stats: 1438 lines in 11 files changed: 724 ins; 714 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/19529.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19529/head:pull/19529 PR: https://git.openjdk.org/jdk/pull/19529 From duke at openjdk.org Mon Jun 3 19:03:15 2024 From: duke at openjdk.org (jengebr) Date: Mon, 3 Jun 2024 19:03:15 GMT Subject: RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations Message-ID: Improve `java/util/concurrent/CopyOnWriteArrayList` by eliminating needless cloning of Object[0] instances. This cloning is intended to prevent callers from changing array contents, but many `CopyOnWriteArrayList`s are allocated to size zero, or are otherwise maintained empty, so cloning is unnecessary. Results from the included JMH benchmark: Before: Benchmark Mode Cnt Score Error Units CopyOnWriteArrayListBenchmark.clear avgt 5 74.487 ? 1.793 ns/op CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 27.918 ? 0.759 ns/op CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.656 ? 0.375 ns/op CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 15.415 ? 0.489 ns/op CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.608 ? 0.363 ns/op CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 15.374 ? 0.260 ns/op CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 15.688 ? 0.350 ns/op After: Benchmark Mode Cnt Score Error Units CopyOnWriteArrayListBenchmark.clear avgt 5 75.365 ? 2.092 ns/op CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 20.803 ? 0.539 ns/op CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.808 ? 0.582 ns/op CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 12.980 ? 0.418 ns/op CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.627 ? 0.173 ns/op CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 12.864 ? 0.408 ns/op CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 12.931 ? 0.255 ns/op ------------- Commit messages: - Fixing whitespace - Removing toArray from benchmark - Reverting change to clone() - Merge branch 'openjdk:master' into CopyOnWriteArrayList_optimization - Adding JMH benchmark - Merge branch 'openjdk:master' into CopyOnWriteArrayList_optimization - Merge branch 'openjdk:master' into CopyOnWriteArrayList_optimization - Revert "Updating copyright yeaer" - Merge branch 'openjdk:master' into CopyOnWriteArrayList_optimization - Updating copyright yeaer - ... and 2 more: https://git.openjdk.org/jdk/compare/9686e804...ea7a0042 Changes: https://git.openjdk.org/jdk/pull/19527/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19527&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8332842 Stats: 107 lines in 2 files changed: 104 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/19527.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19527/head:pull/19527 PR: https://git.openjdk.org/jdk/pull/19527 From shade at openjdk.org Mon Jun 3 19:03:16 2024 From: shade at openjdk.org (Aleksey Shipilev) Date: Mon, 3 Jun 2024 19:03:16 GMT Subject: RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations In-Reply-To: References: Message-ID: On Mon, 3 Jun 2024 16:47:20 GMT, jengebr wrote: > Improve `java/util/concurrent/CopyOnWriteArrayList` by eliminating needless cloning of Object[0] instances. This cloning is intended to prevent callers from changing array contents, but many `CopyOnWriteArrayList`s are allocated to size zero, or are otherwise maintained empty, so cloning is unnecessary. > > Results from the included JMH benchmark: > Before: > > Benchmark Mode Cnt Score Error Units > CopyOnWriteArrayListBenchmark.clear avgt 5 74.487 ? 1.793 ns/op > CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 27.918 ? 0.759 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.656 ? 0.375 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 15.415 ? 0.489 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.608 ? 0.363 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 15.374 ? 0.260 ns/op > CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 15.688 ? 0.350 ns/op > > > After: > > Benchmark Mode Cnt Score Error Units > CopyOnWriteArrayListBenchmark.clear avgt 5 75.365 ? 2.092 ns/op > CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 20.803 ? 0.539 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.808 ? 0.582 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 12.980 ? 0.418 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.627 ? 0.173 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 12.864 ? 0.408 ns/op > CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 12.931 ? 0.255 ns/op Some initial comments. @DougLea might want to give it a sanity check. Note there is a jcheck failure due to whitespace issues. Plus, I think the PR should still be named "8332842: Optimize empty CopyOnWriteArrayList allocations"? src/java.base/share/classes/java/util/concurrent/CopyOnWriteArrayList.java line 338: > 336: */ > 337: public Object[] toArray() { > 338: return getArray().length == 0 ? getArray() : getArray().clone(); Unfortunately, I think this is against the spec for this method, which explicitly says the method must allocate a new array. Yes, this change would be within the spirit of the spec ("You can modify the array", which you cannot if the object is empty), but is against the letter of it. ------------- PR Review: https://git.openjdk.org/jdk/pull/19527#pullrequestreview-2094435376 PR Comment: https://git.openjdk.org/jdk/pull/19527#issuecomment-2145853813 PR Review Comment: https://git.openjdk.org/jdk/pull/19527#discussion_r1624791561 From dl at openjdk.org Mon Jun 3 19:03:16 2024 From: dl at openjdk.org (Doug Lea) Date: Mon, 3 Jun 2024 19:03:16 GMT Subject: RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations In-Reply-To: References: Message-ID: <96SNKGdvRhf20ArPe4-IdcXkhzvKDnwQ7W1VlXX689I=.78e6fc24-980e-42e4-aa67-090968a5b215@github.com> On Mon, 3 Jun 2024 16:47:20 GMT, jengebr wrote: > Improve `java/util/concurrent/CopyOnWriteArrayList` by eliminating needless cloning of Object[0] instances. This cloning is intended to prevent callers from changing array contents, but many `CopyOnWriteArrayList`s are allocated to size zero, or are otherwise maintained empty, so cloning is unnecessary. > > Results from the included JMH benchmark: > Before: > > Benchmark Mode Cnt Score Error Units > CopyOnWriteArrayListBenchmark.clear avgt 5 74.487 ? 1.793 ns/op > CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 27.918 ? 0.759 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.656 ? 0.375 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 15.415 ? 0.489 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.608 ? 0.363 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 15.374 ? 0.260 ns/op > CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 15.688 ? 0.350 ns/op > > > After: > > Benchmark Mode Cnt Score Error Units > CopyOnWriteArrayListBenchmark.clear avgt 5 75.365 ? 2.092 ns/op > CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 20.803 ? 0.539 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.808 ? 0.582 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 12.980 ? 0.418 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.627 ? 0.173 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 12.864 ? 0.408 ns/op > CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 12.931 ? 0.255 ns/op The jmh benchmark checks only the empty case, you need to also show lack of impact on non-empty cases. Assuming you demonstrate this, it seems basically OK, (Deja vu previous cases including hash maps). It is only a small band-aid -- programs generating lots of them still have to allocate the COWAL object, so the savings are small compared to not generating them at all unless needed. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19527#issuecomment-2145896233 From duke at openjdk.org Mon Jun 3 19:03:16 2024 From: duke at openjdk.org (jengebr) Date: Mon, 3 Jun 2024 19:03:16 GMT Subject: RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations In-Reply-To: References: Message-ID: On Mon, 3 Jun 2024 17:07:28 GMT, Aleksey Shipilev wrote: >> Improve `java/util/concurrent/CopyOnWriteArrayList` by eliminating needless cloning of Object[0] instances. This cloning is intended to prevent callers from changing array contents, but many `CopyOnWriteArrayList`s are allocated to size zero, or are otherwise maintained empty, so cloning is unnecessary. >> >> Results from the included JMH benchmark: >> Before: >> >> Benchmark Mode Cnt Score Error Units >> CopyOnWriteArrayListBenchmark.clear avgt 5 74.487 ? 1.793 ns/op >> CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 27.918 ? 0.759 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.656 ? 0.375 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 15.415 ? 0.489 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.608 ? 0.363 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 15.374 ? 0.260 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 15.688 ? 0.350 ns/op >> >> >> After: >> >> Benchmark Mode Cnt Score Error Units >> CopyOnWriteArrayListBenchmark.clear avgt 5 75.365 ? 2.092 ns/op >> CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 20.803 ? 0.539 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.808 ? 0.582 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 12.980 ? 0.418 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.627 ? 0.173 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 12.864 ? 0.408 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 12.931 ? 0.255 ns/op > > src/java.base/share/classes/java/util/concurrent/CopyOnWriteArrayList.java line 338: > >> 336: */ >> 337: public Object[] toArray() { >> 338: return getArray().length == 0 ? getArray() : getArray().clone(); > > Unfortunately, I think this is against the spec for this method, which explicitly says the method must allocate a new array. Yes, this change would be within the spirit of the spec ("You can modify the array", which you cannot if the object is empty), but is against the letter of it. I think you're right, I'll remove the change to toArray(). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19527#discussion_r1624873832 From alanb at openjdk.org Mon Jun 3 19:12:43 2024 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 3 Jun 2024 19:12:43 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v29] In-Reply-To: References: <6Qs2lLk0mJP0XdyH9ysENqcUT7P0KxsWU95fvRzA21Q=.09e661a3-d340-4fde-8030-77db94a2d353@github.com> Message-ID: On Mon, 3 Jun 2024 15:40:10 GMT, Severin Gehwolf wrote: > Does that proposal sound good? That table is useful, I think it's right. No change to default behavior. If someone configures with --enable-runtime-image then they get a JDK run-time image that supports jlink (with some limitations) but is significantly small as it doesn't include the packaged modules. I've read through most of the changes now. Overall I think it's looking good, just a few terminology and minor points that I'll add as comments. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2145932080 From vlivanov at openjdk.org Mon Jun 3 19:36:58 2024 From: vlivanov at openjdk.org (Vladimir Ivanov) Date: Mon, 3 Jun 2024 19:36:58 GMT Subject: RFR: 8332547: Unloaded signature classes in DirectMethodHandles [v2] In-Reply-To: References: Message-ID: > JVM routinely installs loader constraints for unloaded signature classes when method resolution takes place. MethodHandle resolution took a different route and eagerly resolves signature classes instead (see `java.lang.invoke.MemberName$Factory::resolve` and `sun.invoke.util.VerifyAccess::isTypeVisible` for details). > > There's a micro-optimization which bypasses eager resolution for `java.*` classes. The downside is that `java.*` signature classes can show up as unloaded. It manifests as inlining failures during JIT-compilation and may cause severe performance issues. > > Proposed fix removes the aforementioned special case logic during `MethodHandle` resolution. > > In some cases it may slow down `MethodHandle` construction a bit (e.g., when repeatedly constructing `DirectMethodHandle`s with lots of arguments), but `MethodHandle` construction step is not performance critical. > > Testing: hs-tier1 - hs-tier4 Vladimir Ivanov has updated the pull request incrementally with one additional commit since the last revision: Renaming: isTypeVisible -> ensureTypeVisible ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19319/files - new: https://git.openjdk.org/jdk/pull/19319/files/805d42fc..058cdba3 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19319&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19319&range=00-01 Stats: 9 lines in 3 files changed: 0 ins; 0 del; 9 mod Patch: https://git.openjdk.org/jdk/pull/19319.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19319/head:pull/19319 PR: https://git.openjdk.org/jdk/pull/19319 From vlivanov at openjdk.org Mon Jun 3 19:36:58 2024 From: vlivanov at openjdk.org (Vladimir Ivanov) Date: Mon, 3 Jun 2024 19:36:58 GMT Subject: RFR: 8332547: Unloaded signature classes in DirectMethodHandles In-Reply-To: References: Message-ID: On Tue, 21 May 2024 20:14:41 GMT, Jorn Vernee wrote: >> Class loading triggered by `Class.forName()` call is at the core of `isTypeVisible`. (The rest is fast path checks.) It's what makes `isTypeVisible` query idempotent. >> >> I can definitely name it differently (e.g, `ensureTypeVisible`), but making a separate class loading pass across signature classes doesn't make much sense. > >> I can definitely name it differently (e.g, ensureTypeVisible), but making a separate class loading pass across signature classes doesn't make much sense. > > Ok, in that case I suggest also renaming `MemberName::checkForTypeAlias`, maybe to `ensureTypeVisible` as well. @JornVernee ok, renamed. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19319#issuecomment-2145967665 From asemenyuk at openjdk.org Mon Jun 3 20:36:38 2024 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Mon, 3 Jun 2024 20:36:38 GMT Subject: RFR: 8333452: Make logging in jdk.jpackage.internal.OverridableResource class configurable Message-ID: 8333452: Make logging in jdk.jpackage.internal.OverridableResource class configurable ------------- Commit messages: - 8333452: Make logging in jdk.jpackage.internal.OverridableResource class configurable Changes: https://git.openjdk.org/jdk/pull/19532/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19532&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333452 Stats: 67 lines in 2 files changed: 59 ins; 0 del; 8 mod Patch: https://git.openjdk.org/jdk/pull/19532.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19532/head:pull/19532 PR: https://git.openjdk.org/jdk/pull/19532 From asemenyuk at openjdk.org Mon Jun 3 20:51:32 2024 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Mon, 3 Jun 2024 20:51:32 GMT Subject: RFR: 8333452: Make logging in jdk.jpackage.internal.OverridableResource class configurable In-Reply-To: References: Message-ID: <6Ft3j082LGTr9PYq6SkggwO61-AQcISPyJMpskSoeXA=.76084516-65e4-497b-a3ef-4bddcb828f00@github.com> On Mon, 3 Jun 2024 20:29:47 GMT, Alexey Semenyuk wrote: > 8333452: Make logging in jdk.jpackage.internal.OverridableResource class configurable @sashamatveev, please review ------------- PR Comment: https://git.openjdk.org/jdk/pull/19532#issuecomment-2146097131 From jvernee at openjdk.org Mon Jun 3 20:51:32 2024 From: jvernee at openjdk.org (Jorn Vernee) Date: Mon, 3 Jun 2024 20:51:32 GMT Subject: RFR: 8332547: Unloaded signature classes in DirectMethodHandles [v2] In-Reply-To: References: Message-ID: On Mon, 3 Jun 2024 19:36:58 GMT, Vladimir Ivanov wrote: >> JVM routinely installs loader constraints for unloaded signature classes when method resolution takes place. MethodHandle resolution took a different route and eagerly resolves signature classes instead (see `java.lang.invoke.MemberName$Factory::resolve` and `sun.invoke.util.VerifyAccess::isTypeVisible` for details). >> >> There's a micro-optimization which bypasses eager resolution for `java.*` classes. The downside is that `java.*` signature classes can show up as unloaded. It manifests as inlining failures during JIT-compilation and may cause severe performance issues. >> >> Proposed fix removes the aforementioned special case logic during `MethodHandle` resolution. >> >> In some cases it may slow down `MethodHandle` construction a bit (e.g., when repeatedly constructing `DirectMethodHandle`s with lots of arguments), but `MethodHandle` construction step is not performance critical. >> >> Testing: hs-tier1 - hs-tier4 > > Vladimir Ivanov has updated the pull request incrementally with one additional commit since the last revision: > > Renaming: isTypeVisible -> ensureTypeVisible Thanks ------------- Marked as reviewed by jvernee (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19319#pullrequestreview-2094825208 From kak at google.com Mon Jun 3 21:24:56 2024 From: kak at google.com (Kurt Alfred Kluever) Date: Mon, 3 Jun 2024 17:24:56 -0400 Subject: Instant.now(Clock) and InstantSource Message-ID: Hi folks, It feels a bit strange that you can't pass an `InstantSource` to `Instant.now(...)`, but you _can_ pass a `Clock` (which of course has a "useless" `ZoneId` when creating an `Instant`). Therefore, I'd like to propose one of the following API changes: 1) adding `Instant.now(InstantSource)` 2) deprecating `Instant.now(Clock)` in favor of `clock.instant()` (I believe removing `Instant.now(Clock)` would be binary compatible, so that's not an option, right?) There's also a related discussion about adding an InstantSource-based static factory method to the "local" types (e.g., `LocalDate.now(InstantSource, ZoneId)`). However, I always avoid using the static factories on those types and have been quite happy with the fluent pattern instead (e.g., `instantSource.instant().atZone(...).toLocalDate()`). Thoughts? -- kak -------------- next part -------------- An HTML attachment was scrubbed... URL: From darcy at openjdk.org Mon Jun 3 21:32:33 2024 From: darcy at openjdk.org (Joe Darcy) Date: Mon, 3 Jun 2024 21:32:33 GMT Subject: RFR: 8332072: Convert package.html files in `java.naming` to package-info.java In-Reply-To: References: Message-ID: On Mon, 3 Jun 2024 17:26:52 GMT, Nizar Benalla wrote: > Can I please get a review for this small change? The motivation is that javac does not recognize `package.html` files. > > The conversion was simple, I used a script to rename the files, append "*" on the left and remove some HTML tags like `` and ``. I did the conversion in place, renaming them in git but with the big amount of change `git` thinks it's a new file. > > I also added a new `package-info.java` file to `javax.naming.ldap.spi`. I hope that's fine. I recommend having the new package-info.java files follow the now-current javadoc conventions including: * Using `{@code foo}` in preference to `foo` * Using the `@snippet` tag in preference to `
`
* etc.

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

PR Comment: https://git.openjdk.org/jdk/pull/19529#issuecomment-2146157205

From almatvee at openjdk.org  Mon Jun  3 21:55:44 2024
From: almatvee at openjdk.org (Alexander Matveev)
Date: Mon, 3 Jun 2024 21:55:44 GMT
Subject: RFR: 8333452: Make logging in
 jdk.jpackage.internal.OverridableResource class configurable
In-Reply-To: 
References: 
Message-ID: <10WPt_KgCEXUX8V3piQE1apNek2ewk1qffe6O-TcCF0=.f9002b64-6c54-42c6-83d8-b02e8f67ff6e@github.com>

On Mon, 3 Jun 2024 20:29:47 GMT, Alexey Semenyuk  wrote:

> 8333452: Make logging in jdk.jpackage.internal.OverridableResource class configurable

OverridableResource uses Log.verbose, which will log if -verbose is specified. What do you mean by "OverridableResource class unconditionally writes in the log."? Why "In some situations emitting log messages is not desired."? If we do not need to log them when "-verbose" is specified then lets just remove them.

`NoLogging` class is only used by test. Can we modify `OverridableResource` in such way it does not require additional code which is used by test only?

This added functionality is not used. It is completely unclear from PR and/or issue description why we need this and how it will be used in the future?

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

PR Comment: https://git.openjdk.org/jdk/pull/19532#issuecomment-2146189724

From jlu at openjdk.org  Mon Jun  3 22:03:48 2024
From: jlu at openjdk.org (Justin Lu)
Date: Mon, 3 Jun 2024 22:03:48 GMT
Subject: Integrated: 8332424: Update IANA Language Subtag Registry to Version
 2024-05-16
In-Reply-To: 
References: 
Message-ID: 

On Fri, 17 May 2024 18:04:02 GMT, Justin Lu  wrote:

> Please review this PR which is a trivial update to the IANA sub tag registry to version 2024-05-16. Locale tests pass as expected after update.
> 
> Associated announcement -> https://mm.icann.org/pipermail/ietf-languages-announcements/2024-May/000091.html

This pull request has now been integrated.

Changeset: 6dac8d64
Author:    Justin Lu 
URL:       https://git.openjdk.org/jdk/commit/6dac8d64527b4e9ade783b99f82fbecd81c426a6
Stats:     9 lines in 2 files changed: 6 ins; 0 del; 3 mod

8332424: Update IANA Language Subtag Registry to Version 2024-05-16

Reviewed-by: naoto, iris

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

PR: https://git.openjdk.org/jdk/pull/19286

From liach at openjdk.org  Mon Jun  3 22:33:49 2024
From: liach at openjdk.org (Chen Liang)
Date: Mon, 3 Jun 2024 22:33:49 GMT
Subject: RFR: 8332547: Unloaded signature classes in DirectMethodHandles
 [v2]
In-Reply-To: 
References: 
 
Message-ID: <1WnYxErQWK4DWeiSqd-P0wB5k5HrlTkZtjtVp8bXV8A=.d74c9626-1889-4ae9-b197-9991cb21ee06@github.com>

On Mon, 3 Jun 2024 19:36:58 GMT, Vladimir Ivanov  wrote:

>> JVM routinely installs loader constraints for unloaded signature classes when method resolution takes place. MethodHandle resolution took a different route and eagerly resolves signature classes instead (see `java.lang.invoke.MemberName$Factory::resolve` and `sun.invoke.util.VerifyAccess::isTypeVisible` for details). 
>> 
>> There's a micro-optimization which bypasses eager resolution for `java.*` classes. The downside is that `java.*` signature classes can show up as unloaded. It manifests as inlining failures during JIT-compilation and may cause severe performance issues.
>> 
>> Proposed fix removes the aforementioned special case logic during `MethodHandle` resolution. 
>> 
>> In some cases it may slow down `MethodHandle` construction a bit (e.g., when repeatedly constructing `DirectMethodHandle`s with lots of arguments), but `MethodHandle` construction step is not performance critical.  
>> 
>> Testing: hs-tier1 - hs-tier4
>
> Vladimir Ivanov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Renaming: isTypeVisible -> ensureTypeVisible

Marked as reviewed by liach (Author).

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

PR Review: https://git.openjdk.org/jdk/pull/19319#pullrequestreview-2094960904

From asemenyuk at openjdk.org  Mon Jun  3 22:34:01 2024
From: asemenyuk at openjdk.org (Alexey Semenyuk)
Date: Mon, 3 Jun 2024 22:34:01 GMT
Subject: Withdrawn: 8333452: Make logging in
 jdk.jpackage.internal.OverridableResource class configurable
In-Reply-To: 
References: 
Message-ID: 

On Mon, 3 Jun 2024 20:29:47 GMT, Alexey Semenyuk  wrote:

> 8333452: Make logging in jdk.jpackage.internal.OverridableResource class configurable

This pull request has been closed without being integrated.

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

PR: https://git.openjdk.org/jdk/pull/19532

From asemenyuk at openjdk.org  Mon Jun  3 22:33:59 2024
From: asemenyuk at openjdk.org (Alexey Semenyuk)
Date: Mon, 3 Jun 2024 22:33:59 GMT
Subject: RFR: 8333452: Make logging in
 jdk.jpackage.internal.OverridableResource class configurable
In-Reply-To: <10WPt_KgCEXUX8V3piQE1apNek2ewk1qffe6O-TcCF0=.f9002b64-6c54-42c6-83d8-b02e8f67ff6e@github.com>
References: 
 <10WPt_KgCEXUX8V3piQE1apNek2ewk1qffe6O-TcCF0=.f9002b64-6c54-42c6-83d8-b02e8f67ff6e@github.com>
Message-ID: 

On Mon, 3 Jun 2024 21:53:06 GMT, Alexander Matveev  wrote:

> This added functionality is not used. It is completely unclear from PR and/or issue description why we need this and how it will be used in the future?

It was supposed to be used in [WiX4 project](https://bugs.openjdk.org/browse/JDK-8319457). In this project the same resource was supposed to be saved multiple times, producing duplicated messages in the log. This was the case at the early stage of the project. I looked closer and it is not needed any more. I'll withdraw this PR.

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

PR Comment: https://git.openjdk.org/jdk/pull/19532#issuecomment-2146217269

From asemenyuk at openjdk.org  Mon Jun  3 22:35:00 2024
From: asemenyuk at openjdk.org (Alexey Semenyuk)
Date: Mon, 3 Jun 2024 22:35:00 GMT
Subject: RFR: 8319457: Update jpackage to support WiX Toolset 4 on Windows
In-Reply-To: 
References: 
Message-ID: 

On Mon, 20 May 2024 21:14:09 GMT, Alexey Semenyuk  wrote:

> Add support for WiX4 in jpackage.
> 
> jpackage supports both WiX3 and WiX4. It will pick WiX4 if both versions are installed.
> 
> Custom WiX3 sources will be automatically converted to WiX4 format if WiX4 is used. The converter provides:
> 
> - full support of the conversion of WiX L10N (.wxl) files, i.e. full support of "http://schemas.microsoft.com/wix/2006/localization" to "http://wixtoolset.org/schemas/v4/wxl" namespace conversion;
> - partial support of WiX source (.wxs) files, i.e. partial support of "http://schemas.microsoft.com/wix/2006/wi" to "http://wixtoolset.org/schemas/v4/wxs" namespace conversion;
> 
> The converter is a XSLT stylesheet. The default converter is `src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/wix3-to-wix4-conv.xsl`. It can be replaced with the custom converter by adding "wix-conv.xsl" file to the resource directory.

@sashamatveev please review

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

PR Comment: https://git.openjdk.org/jdk/pull/19318#issuecomment-2146229622

From asemenyuk at openjdk.org  Mon Jun  3 22:34:59 2024
From: asemenyuk at openjdk.org (Alexey Semenyuk)
Date: Mon, 3 Jun 2024 22:34:59 GMT
Subject: RFR: 8319457: Update jpackage to support WiX Toolset 4 on Windows
Message-ID: 

Add support for WiX4 in jpackage.

jpackage supports both WiX3 and WiX4. It will pick WiX4 if both versions are installed.

Custom WiX3 sources will be automatically converted to WiX4 format if WiX4 is used. The converter provides:

- full support of the conversion of WiX L10N (.wxl) files, i.e. full support of "http://schemas.microsoft.com/wix/2006/localization" to "http://wixtoolset.org/schemas/v4/wxl" namespace conversion;
- partial support of WiX source (.wxs) files, i.e. partial support of "http://schemas.microsoft.com/wix/2006/wi" to "http://wixtoolset.org/schemas/v4/wxs" namespace conversion;

The converter is a XSLT stylesheet. The default converter is `src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/wix3-to-wix4-conv.xsl`. It can be replaced with the custom converter by adding "wix-conv.xsl" file to the resource directory.

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

Commit messages:
 - Revert "Revert "Rollback unneeded change""
 - Support the use of custom wix source converter
 - Ensure WiX source converter works with the default JDK XSLT processor and Saxon HE (v12.4)
 - Revert "Rollback unneeded change"
 - Rollback unneeded change
 - Merge branch 'master' into JDK-8319457
 - Don't suppress jpackage output when it is detecting what packaging tools available and what bundlers are supported.
 - Fix issue with running jtreg tests when wix.exe is not available in the PATH. When wix.exe is not in the PATH, jpackage uses %USERPROFILE% env variable to get user home directory. But jtreg removes it from the environment when running tests, so without wix.exe in the PATH all jpackage tests will fail on Windows. This makes it impossible to test jpackage with wix3. This patch addresses this issue by reading user home additionally from "java.home" system property.
 - Merge branch 'master' into JDK-8319457
 - Got rid of Wix36 WiX toolset type
 - ... and 16 more: https://git.openjdk.org/jdk/compare/5abc0292...fbb9f418

Changes: https://git.openjdk.org/jdk/pull/19318/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19318&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8319457
  Stats: 1485 lines in 22 files changed: 1154 ins; 91 del; 240 mod
  Patch: https://git.openjdk.org/jdk/pull/19318.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19318/head:pull/19318

PR: https://git.openjdk.org/jdk/pull/19318

From jlu at openjdk.org  Mon Jun  3 22:39:08 2024
From: jlu at openjdk.org (Justin Lu)
Date: Mon, 3 Jun 2024 22:39:08 GMT
Subject: RFR: 8333456: CompactNumberFormat integer parsing fails when string
 has no suffix
Message-ID: 

Please review this PR which handles incorrect CompactNumberFormat integer only parsing when there is no suffix.

See the following snippet,


var fmt = NumberFormat.getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT)
fmt.setParseIntegerOnly(true)
fmt.parse("5K") // returns 5000
fmt.parse("50.00") // returns 50
fmt.parse("5") // unexpectedly throws StringIndexOutOfBoundsException 
fmt.parse("5 ") // returns 5


Within the `parse` method, there is code that advances `position` past the fractional portion to find the suffix when `parseIntegerOnly()` is true. However, if a valid string input is given with no suffix, `DecimalFormat.subparseNumber()` will fully iterate through the string and `position` will be equal to the length of the string, throwing StringIndexOutOfBoundsException when `charAt` is invoked (line 1740).

We should check to make sure position does not exceed the string length before deciding to check for a decimal symbol.

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

Commit messages:
 - init

Changes: https://git.openjdk.org/jdk/pull/19533/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19533&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8333456
  Stats: 69 lines in 2 files changed: 68 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/19533.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19533/head:pull/19533

PR: https://git.openjdk.org/jdk/pull/19533

From naoto at openjdk.org  Mon Jun  3 23:01:31 2024
From: naoto at openjdk.org (Naoto Sato)
Date: Mon, 3 Jun 2024 23:01:31 GMT
Subject: RFR: 8333396: Performance regression of new DecimalFormat and
 DecimalFormat.format [v2]
In-Reply-To: <-uD4Wih5e1lvOwd2KFhBfcDKN1PrDr2aL_EVz1NzBC0=.48a676c7-cbac-422c-b3a5-763db15473ca@github.com>
References: 
 <-uD4Wih5e1lvOwd2KFhBfcDKN1PrDr2aL_EVz1NzBC0=.48a676c7-cbac-422c-b3a5-763db15473ca@github.com>
Message-ID: <-lR14fPp8p-mX7THuFYQEDdZRHoP8OKwgOdgxEVEo0s=.d079484f-fa05-4786-bc71-f4b76fe7bea4@github.com>

On Mon, 3 Jun 2024 06:13:35 GMT, lingjun-cg  wrote:

>> ### Performance regression of DecimalFormat.format
>> From the output of perf, we can see the hottest regions contain atomic instructions.  But when run with JDK 11, there is no such problem. The reason is the removed biased locking.  
>> The DecimalFormat uses StringBuffer everywhere, and StringBuffer itself contains many synchronized methods.
>> So I added support for some new methods that accept StringBuilder which is lock-free.
>> 
>> ### Performance regression of new DecimalFormat
>> After comparing the flame graph between current jdk and jdk 11,  the method java.text.DecimalFormatSymbols#findNonFormatChar takes a significant time.  The performance becomes as good as jdk11 after replacing it with a simple loop implementation.
>> 
>> 
>> 
>> ### Test result
>> 
>> @BenchmarkMode(Mode.AverageTime)
>> @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS)
>> @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
>> @State(Scope.Thread)
>> @OutputTimeUnit(TimeUnit.NANOSECONDS)
>> public class JmhDecimalFormat {
>> 
>>     private DecimalFormat format;
>> 
>>     @Setup(Level.Trial)
>>     public void setup() {
>>         format = new DecimalFormat("#0.00000");
>>     }
>> 
>>     @Benchmark
>>     public void testNewAndFormat() throws InterruptedException {
>>         new DecimalFormat("#0.00000").format(9524234.1236457);
>>     }
>> 
>>     @Benchmark
>>     public void testNewOnly() throws InterruptedException {
>>         new DecimalFormat("#0.00000");
>>     }
>> 
>>     @Benchmark
>>     public void testFormatOnly() throws InterruptedException {
>>         format.format(9524234.1236457);
>>     }
>> }
>> 
>> #### Current JDK before optimize
>> 
>>  Benchmark                             Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly       avgt   50  642.099 ? 1.253  ns/op
>> JmhDecimalFormat.testNewAndFormat     avgt   50  989.307 ? 3.676  ns/op
>> JmhDecimalFormat.testNewOnly          avgt   50  303.381 ? 5.252  ns/op
>> 
>> 
>> 
>> #### Current JDK after optimize
>> 
>> Benchmark                          Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly    avgt   50  351.499 ? 0.761  ns/op
>> JmhDecimalFormat.testNewAndFormat  avgt   50  615.145 ? 2.478  ns/op
>> JmhDecimalFormat.testNewOnly       avgt   50  209.874 ? 9.951  ns/op
>> 
>> 
>> ### JDK 11 
>> 
>> Benchmark                          Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly    avgt   50  364.214 ? 1.191  ns/op
>> JmhDecimalFormat.testNewAndForma...
>
> lingjun-cg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8333396: Performance regression of new DecimalFormat and DecimalFormat.format

Hi,

Can you please provide more details? As to StringBuffer, I think it is being used since those classes in `java.text` package have been created. I am not sure why that contributes to what you described as the "performance regression".

Separately, please split this PR into two, as combining two different issues into a single JBS issue/PR is not right. The second issue is likely due to loading stream classes for the first time at JVM startup.

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

PR Comment: https://git.openjdk.org/jdk/pull/19513#issuecomment-2146264799

From nbenalla at openjdk.org  Tue Jun  4 00:41:07 2024
From: nbenalla at openjdk.org (Nizar Benalla)
Date: Tue, 4 Jun 2024 00:41:07 GMT
Subject: RFR: 8326951: since-checker - missing @ since tags [v9]
In-Reply-To: 
References: <_iA0CxGgaa8nA5AlNfT1IfG3Y6Wx7tcdiv3oJQNYCjQ=.5fb84060-0490-4b18-8995-cc534e1c22f5@github.com>
 
Message-ID: 

On Mon, 13 May 2024 20:39:14 GMT, Nizar Benalla  wrote:

>> I added `@since` tags for methods/constructors that do not match the `@since` of the enclosing class.
>> 
>> The `write` method already existed in `PrintStream` in earlier versions and instances of it could always call this method, since it extends `FilterOutputStream` [which has the method](https://github.com/openjdk/jdk6/blob/3e49aa876353eaa215cde71eb21acc9b7f9872a0/jdk/src/share/classes/java/io/FilterOutputStream.java#L96).
>> 
>> for `MappedByteBuffer slice()` and `MappedByteBuffer slice(int index, int length)`, the return type changed from `ByteBuffer ` to `MappedByteBuffer`. And the checker tool differentiates between them because of that.
>> 
>> This is similar to #18032 and #18373 
>> 
>> For context, I am writing tests to check for accurate use of `@since` tags in documentation comments in source code.
>> We're following these rules for now:
>> 
>> ### Rule 1: Introduction of New Elements
>> 
>> - If an element is new in JDK N, with no equivalent in JDK N-1, it must include `@since N`.
>>   - Exception: Member elements (fields, methods, nested classes) may omit `@since` if their version matches the value specified for the enclosing class or interface.
>> 
>> ### Rule 2: Existing Elements in Subsequent JDK Versions
>> 
>> - If an element exists in JDK N, with an equivalent in JDK N-1, it should not include `@since N`.
>> 
>> ### Rule 3: Handling Missing `@since` Tags in methods if there is no `@since`
>> 
>> - When inspecting methods, prioritize the `@since` annotation of the supertype's overridden method.
>> - If unavailable or if the enclosing class's `@since` is newer, use the enclosing element's `@since`.
>> 
>>   I.e. if A extends B, and we add a method to B in JDK N, and add an override of the method to A in JDK M (M > N), we will use N as the effective `@since` for the method.
>
> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
> 
>   empty commit and merge

Here is a snippet from the report of the checker with the relevant bits for this PR

STDERR:
method: void java.io.PrintStream.write(byte[]): `@since` version is 14 but the element exists before JDK 10
method: java.lang.invoke.MethodHandle java.lang.invoke.MethodHandles.tableSwitch(java.lang.invoke.MethodHandle,java.lang.invoke.MethodHandle[]): `@since` version is 9 instead of 17
method: void java.lang.reflect.MalformedParameterizedTypeException.(java.lang.String): `@since` version is 9 instead of 10
method: java.nio.MappedByteBuffer java.nio.MappedByteBuffer.slice(): `@since` version is 9 instead of 17
method: java.nio.MappedByteBuffer java.nio.MappedByteBuffer.slice(int,int): `@since` version is 9 instead of 17
method: java.nio.MappedByteBuffer java.nio.MappedByteBuffer.duplicate(): `@since` version is 9 instead of 17
method: java.nio.MappedByteBuffer java.nio.MappedByteBuffer.compact(): `@since` version is 9 instead of 17
method: void java.util.Properties.(int): `@since` version is 9 instead of 10
method: float java.util.concurrent.ThreadLocalRandom.nextFloat(float): `@since` version is 9 instead of 17
method: float java.util.concurrent.ThreadLocalRandom.nextFloat(float,float): `@since` version is 9 instead of 17
method: void java.util.zip.Deflater.setDictionary(java.nio.ByteBuffer): `@since` version is 9 instead of 11




Here is the full report

STDERR:
method: void java.io.PrintStream.write(byte[]): `@since` version is 14 but the element exists before JDK 10
method: byte[] java.io.FileInputStream.readNBytes(int): `@since` version is 9 instead of 11
method: java.lang.classfile.Signature.ClassTypeSig java.lang.classfile.ClassSignature.superclassSignature(): `@since` version is 22 instead of 23
method: java.lang.classfile.constantpool.PoolEntry java.lang.classfile.ClassReader.readEntryOrNull(int,java.lang.Class): `@since` version is 24 instead of 23
method: java.lang.classfile.constantpool.PoolEntry java.lang.classfile.constantpool.ConstantPool.entryByIndex(int,java.lang.Class): `@since` version is 24 instead of 23
method: java.lang.Class java.lang.constant.ClassDesc.resolveConstantDesc(java.lang.invoke.MethodHandles.Lookup): `@since` version is 12 instead of 21
method: java.lang.invoke.MethodType java.lang.constant.MethodTypeDesc.resolveConstantDesc(java.lang.invoke.MethodHandles.Lookup): `@since` version is 12 instead of 21
method: java.lang.invoke.MethodHandle java.lang.constant.MethodHandleDesc.resolveConstantDesc(java.lang.invoke.MethodHandles.Lookup): `@since` version is 12 instead of 21
method: long java.lang.foreign.MemorySegment.maxByteAlignment(): `@since` version is 22 instead of 23
method: java.lang.invoke.MethodHandle java.lang.invoke.MethodHandles.tableSwitch(java.lang.invoke.MethodHandle,java.lang.invoke.MethodHandle[]): `@since` version is 9 instead of 17
method: java.lang.Object java.lang.ref.Reference.clone(): `@since` version is 11 but the element exists before JDK 10
method: void java.lang.reflect.MalformedParameterizedTypeException.(java.lang.String): `@since` version is 9 instead of 10
method: java.nio.MappedByteBuffer java.nio.MappedByteBuffer.slice(): `@since` version is 9 instead of 17
method: java.nio.MappedByteBuffer java.nio.MappedByteBuffer.slice(int,int): `@since` version is 9 instead of 17
method: java.nio.MappedByteBuffer java.nio.MappedByteBuffer.duplicate(): `@since` version is 9 instead of 17
method: java.nio.MappedByteBuffer java.nio.MappedByteBuffer.compact(): `@since` version is 9 instead of 17
method: boolean java.text.ChoiceFormat.isStrict(): `@since` version is 9 instead of 23
method: void java.text.ChoiceFormat.setStrict(boolean): `@since` version is 9 instead of 23
method: void java.util.Properties.(int): `@since` version is 9 instead of 10
method: java.lang.Object java.util.concurrent.FutureTask.resultNow(): `@since` version is 9 instead of 19
method: java.lang.Throwable java.util.concurrent.FutureTask.exceptionNow(): `@since` version is 9 instead of 19
method: java.util.concurrent.Future.State java.util.concurrent.FutureTask.state(): `@since` version is 9 instead of 19
method: float java.util.concurrent.ThreadLocalRandom.nextFloat(float): `@since` version is 9 instead of 17
method: float java.util.concurrent.ThreadLocalRandom.nextFloat(float,float): `@since` version is 9 instead of 17
method: java.util.concurrent.Future.State java.util.concurrent.ForkJoinTask.state(): `@since` version is 9 instead of 19
method: java.lang.Object java.util.concurrent.ForkJoinTask.resultNow(): `@since` version is 9 instead of 19
method: java.lang.Throwable java.util.concurrent.ForkJoinTask.exceptionNow(): `@since` version is 9 instead of 19
method: java.util.concurrent.Delayed java.util.concurrent.DelayQueue.remove(): `@since` version is 9 instead of 21
method: java.lang.Object java.util.concurrent.CompletableFuture.resultNow(): `@since` version is 9 instead of 19
method: java.lang.Throwable java.util.concurrent.CompletableFuture.exceptionNow(): `@since` version is 9 instead of 19
method: java.util.concurrent.CompletableFuture java.util.concurrent.CompletableFuture.exceptionallyAsync(java.util.function.Function): `@since` version is 9 instead of 12
method: java.util.concurrent.CompletableFuture java.util.concurrent.CompletableFuture.exceptionallyAsync(java.util.function.Function,java.util.concurrent.Executor): `@since` version is 9 instead of 12
method: java.util.concurrent.CompletableFuture java.util.concurrent.CompletableFuture.exceptionallyCompose(java.util.function.Function): `@since` version is 9 instead of 12
method: java.util.concurrent.CompletableFuture java.util.concurrent.CompletableFuture.exceptionallyComposeAsync(java.util.function.Function): `@since` version is 9 instead of 12
method: java.util.concurrent.CompletableFuture java.util.concurrent.CompletableFuture.exceptionallyComposeAsync(java.util.function.Function,java.util.concurrent.Executor): `@since` version is 9 instead of 12
method: java.util.concurrent.Future.State java.util.concurrent.CompletableFuture.state(): `@since` version is 9 instead of 19
method: void java.util.zip.Deflater.setDictionary(java.nio.ByteBuffer): `@since` version is 9 instead of 11
java.lang.Exception: The `@since` checker found 37 problems
        at SinceChecker.checkModule(SinceChecker.java:262)
        at SinceChecker.main(SinceChecker.java:123)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:333)
        at java.base/java.lang.Thread.run(Thread.java:1575)

JavaTest Message: Test threw exception: java.lang.Exception
JavaTest Message: shutting down test


TEST RESULT: Failed. Execution failed: `main' threw exception: java.lang.Exception: The `@since` checker found 37 problems
--------------------------------------------------

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

PR Comment: https://git.openjdk.org/jdk/pull/18055#issuecomment-2146354662

From almatvee at openjdk.org  Tue Jun  4 01:23:11 2024
From: almatvee at openjdk.org (Alexander Matveev)
Date: Tue, 4 Jun 2024 01:23:11 GMT
Subject: RFR: 8319457: Update jpackage to support WiX Toolset 4 on Windows
In-Reply-To: 
References: 
Message-ID: <-o573bkx_xWBRkJS3IWGlevuqgWGL-4EyAxCexUvGUQ=.32f6db30-d90b-4be9-987b-7112349f11d4@github.com>

On Mon, 20 May 2024 21:14:09 GMT, Alexey Semenyuk  wrote:

> Add support for WiX4 in jpackage.
> 
> jpackage supports both WiX3 and WiX4. It will pick WiX4 if both versions are installed.
> 
> Custom WiX3 sources will be automatically converted to WiX4 format if WiX4 is used. The converter provides:
> 
> - full support of the conversion of WiX L10N (.wxl) files, i.e. full support of "http://schemas.microsoft.com/wix/2006/localization" to "http://wixtoolset.org/schemas/v4/wxl" namespace conversion;
> - partial support of WiX source (.wxs) files, i.e. partial support of "http://schemas.microsoft.com/wix/2006/wi" to "http://wixtoolset.org/schemas/v4/wxs" namespace conversion;
> 
> The converter is a XSLT stylesheet. The default converter is `src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/wix3-to-wix4-conv.xsl`. It can be replaced with the custom converter by adding "wix-conv.xsl" file to the resource directory.

Looks good overall. Only two minor comments.

1) Do we need to handle default case for unknown wix type? In same cases you have `default -> throw new IllegalArgumentException();` and in some you do not have.
2) Looks like resource files are saved in wrong format. Is it expected?

src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_de.wxl line 1:

> 1: 

MsiInstallerStrings_de(ja,zh_CA).wxl are probably saved in wrong format. Can you double check if it is intentional change?

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

PR Review: https://git.openjdk.org/jdk/pull/19318#pullrequestreview-2095104559
PR Review Comment: https://git.openjdk.org/jdk/pull/19318#discussion_r1625207485

From almatvee at openjdk.org  Tue Jun  4 01:27:11 2024
From: almatvee at openjdk.org (Alexander Matveev)
Date: Tue, 4 Jun 2024 01:27:11 GMT
Subject: RFR: 8319457: Update jpackage to support WiX Toolset 4 on Windows
In-Reply-To: 
References: 
Message-ID: 

On Mon, 20 May 2024 21:14:09 GMT, Alexey Semenyuk  wrote:

> Add support for WiX4 in jpackage.
> 
> jpackage supports both WiX3 and WiX4. It will pick WiX4 if both versions are installed.
> 
> Custom WiX3 sources will be automatically converted to WiX4 format if WiX4 is used. The converter provides:
> 
> - full support of the conversion of WiX L10N (.wxl) files, i.e. full support of "http://schemas.microsoft.com/wix/2006/localization" to "http://wixtoolset.org/schemas/v4/wxl" namespace conversion;
> - partial support of WiX source (.wxs) files, i.e. partial support of "http://schemas.microsoft.com/wix/2006/wi" to "http://wixtoolset.org/schemas/v4/wxs" namespace conversion;
> 
> The converter is a XSLT stylesheet. The default converter is `src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/wix3-to-wix4-conv.xsl`. It can be replaced with the custom converter by adding "wix-conv.xsl" file to the resource directory.

WiX Toolset 5 is also available. Is there plan to add support for WiX 5?

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

PR Comment: https://git.openjdk.org/jdk/pull/19318#issuecomment-2146391220

From asemenyuk at openjdk.org  Tue Jun  4 01:31:24 2024
From: asemenyuk at openjdk.org (Alexey Semenyuk)
Date: Tue, 4 Jun 2024 01:31:24 GMT
Subject: RFR: 8319457: Update jpackage to support WiX Toolset 4 on Windows
In-Reply-To: 
References: 
Message-ID: <_KH2nqfJlGhXRkSjfcbkoT0eh6BazisgILXajANJ4g0=.717d85e7-4979-404e-9683-3fb83f4cf9a5@github.com>

On Mon, 20 May 2024 21:14:09 GMT, Alexey Semenyuk  wrote:

> Add support for WiX4 in jpackage.
> 
> jpackage supports both WiX3 and WiX4. It will pick WiX4 if both versions are installed.
> 
> Custom WiX3 sources will be automatically converted to WiX4 format if WiX4 is used. The converter provides:
> 
> - full support of the conversion of WiX L10N (.wxl) files, i.e. full support of "http://schemas.microsoft.com/wix/2006/localization" to "http://wixtoolset.org/schemas/v4/wxl" namespace conversion;
> - partial support of WiX source (.wxs) files, i.e. partial support of "http://schemas.microsoft.com/wix/2006/wi" to "http://wixtoolset.org/schemas/v4/wxs" namespace conversion;
> 
> The converter is a XSLT stylesheet. The default converter is `src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/wix3-to-wix4-conv.xsl`. It can be replaced with the custom converter by adding "wix-conv.xsl" file to the resource directory.

Thank you for the review! I'll fix the L10N files.

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

PR Comment: https://git.openjdk.org/jdk/pull/19318#issuecomment-2146394454

From asemenyuk at openjdk.org  Tue Jun  4 01:31:24 2024
From: asemenyuk at openjdk.org (Alexey Semenyuk)
Date: Tue, 4 Jun 2024 01:31:24 GMT
Subject: RFR: 8319457: Update jpackage to support WiX Toolset 4 on Windows
In-Reply-To: 
References: 
 
Message-ID: 

On Tue, 4 Jun 2024 01:24:15 GMT, Alexander Matveev  wrote:

> Is there plan to add support for WiX 5?

This patch supports WiX5 as well. There is not much difference between WiX4 and WiX5 from jpackage perspective. I'll update the description

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

PR Comment: https://git.openjdk.org/jdk/pull/19318#issuecomment-2146395368

From duke at openjdk.org  Tue Jun  4 01:39:12 2024
From: duke at openjdk.org (lingjun-cg)
Date: Tue, 4 Jun 2024 01:39:12 GMT
Subject: RFR: 8333396: Performance regression of new DecimalFormat and
 DecimalFormat.format [v2]
In-Reply-To: <-uD4Wih5e1lvOwd2KFhBfcDKN1PrDr2aL_EVz1NzBC0=.48a676c7-cbac-422c-b3a5-763db15473ca@github.com>
References: 
 <-uD4Wih5e1lvOwd2KFhBfcDKN1PrDr2aL_EVz1NzBC0=.48a676c7-cbac-422c-b3a5-763db15473ca@github.com>
Message-ID: 

On Mon, 3 Jun 2024 06:13:35 GMT, lingjun-cg  wrote:

>> ### Performance regression of DecimalFormat.format
>> From the output of perf, we can see the hottest regions contain atomic instructions.  But when run with JDK 11, there is no such problem. The reason is the removed biased locking.  
>> The DecimalFormat uses StringBuffer everywhere, and StringBuffer itself contains many synchronized methods.
>> So I added support for some new methods that accept StringBuilder which is lock-free.
>> 
>> ### Performance regression of new DecimalFormat
>> After comparing the flame graph between current jdk and jdk 11,  the method java.text.DecimalFormatSymbols#findNonFormatChar takes a significant time.  The performance becomes as good as jdk11 after replacing it with a simple loop implementation.
>> 
>> 
>> 
>> ### Test result
>> 
>> @BenchmarkMode(Mode.AverageTime)
>> @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS)
>> @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
>> @State(Scope.Thread)
>> @OutputTimeUnit(TimeUnit.NANOSECONDS)
>> public class JmhDecimalFormat {
>> 
>>     private DecimalFormat format;
>> 
>>     @Setup(Level.Trial)
>>     public void setup() {
>>         format = new DecimalFormat("#0.00000");
>>     }
>> 
>>     @Benchmark
>>     public void testNewAndFormat() throws InterruptedException {
>>         new DecimalFormat("#0.00000").format(9524234.1236457);
>>     }
>> 
>>     @Benchmark
>>     public void testNewOnly() throws InterruptedException {
>>         new DecimalFormat("#0.00000");
>>     }
>> 
>>     @Benchmark
>>     public void testFormatOnly() throws InterruptedException {
>>         format.format(9524234.1236457);
>>     }
>> }
>> 
>> #### Current JDK before optimize
>> 
>>  Benchmark                             Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly       avgt   50  642.099 ? 1.253  ns/op
>> JmhDecimalFormat.testNewAndFormat     avgt   50  989.307 ? 3.676  ns/op
>> JmhDecimalFormat.testNewOnly          avgt   50  303.381 ? 5.252  ns/op
>> 
>> 
>> 
>> #### Current JDK after optimize
>> 
>> Benchmark                          Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly    avgt   50  351.499 ? 0.761  ns/op
>> JmhDecimalFormat.testNewAndFormat  avgt   50  615.145 ? 2.478  ns/op
>> JmhDecimalFormat.testNewOnly       avgt   50  209.874 ? 9.951  ns/op
>> 
>> 
>> ### JDK 11 
>> 
>> Benchmark                          Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly    avgt   50  364.214 ? 1.191  ns/op
>> JmhDecimalFormat.testNewAndForma...
>
> lingjun-cg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8333396: Performance regression of new DecimalFormat and DecimalFormat.format

Hi naotaoj,
    What I mean "performance regression" is compare to JDK 11. We have an server side application that use DecimalFormat.format API seriously. When migrate it from JDK 11 to JDK 21, we found a performance  degradation.
So I write the JMH test case "JmhDecimalFormat".  It show that there a performance regression since JDK 21.

These are the perfasm output for running JMH on both JDK 11 and JDK21. There are some  hot regions around the atomic instructions in JDK 21, but no such problem in JDK 11.
[jdk11.txt](https://github.com/user-attachments/files/15541278/jdk11.txt)
[jdk21.txt](https://github.com/user-attachments/files/15541279/jdk21.txt)

Maybe the [JEP 374: Deprecate and Disable Biased Locking](https://openjdk.org/jeps/374) is the reason?
So I run the benchmark on JDK 11 again but with option '-XX:-UseBiasedLocking',  there only a minor gap between jdk11 and jdk 21.

OK, return to my patch. java.text use StringBuffer internally,  but nearly all methods in StringBuffer are synchronized:

    @Override
    public synchronized StringBuffer append(Object obj) {
        ....
    }

    @Override
    @IntrinsicCandidate
    public synchronized StringBuffer append(String str) {
        ...
    }


>From the above analysis, the atomic instructions slow down DecimalFormat.format, and StringBuffer's synchronized methods generate there atomic instructions. So If remove these synchronized methods, it will get a better performance.
So I replace StringBuffer with StringBuilder in  java.text.NumberFormat.

    public final String format(double number) {
        // Use fast-path for double result if that works
        String result = fastFormat(number);
        if (result != null)
            return result;

        -return format(number, new StringBuffer(),
        +return format(number, new StringBuilder(),
                      DontCareFieldPosition.INSTANCE).toString();
    }

@@ -367,7 +367,7 @@ public final String format(double number) {
     * @see java.text.Format#format
     */
    public final String format(long number) {
       - return format(number, new StringBuffer(),
       + return format(number, new StringBuilder(),
                      DontCareFieldPosition.INSTANCE).toString();
    }


> Separately, please split this PR into two, as combining two different issues into a single JBS issue/PR is not right. The second issue is likely due to loading stream classes for the first time at JVM startup.
This is the flame graph compare to JDK 11 and JDK 21:
[flame-graph-jdk11-jdk21.zip](https://github.com/user-attachments/files/15541397/flame-graph-jdk11-jdk21.zip)

OK. I will create a separate  issue.

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

PR Comment: https://git.openjdk.org/jdk/pull/19513#issuecomment-2146401596

From vdyakov at openjdk.org  Tue Jun  4 01:40:31 2024
From: vdyakov at openjdk.org (Victor Dyakov)
Date: Tue, 4 Jun 2024 01:40:31 GMT
Subject: RFR: 8319457: Update jpackage to support WiX Toolset 4 on Windows
In-Reply-To: 
References: 
Message-ID: 

On Mon, 20 May 2024 21:14:09 GMT, Alexey Semenyuk  wrote:

> Add support for WiX4 (and WiX5) in jpackage.
> 
> jpackage supports WiX3, WiX4 and WiX5. It will pick WiX4/WiX5 if one of them is installed and there is WiX3 installed too. (Note: WiX4 and WiX5 are not supposed to be installed side-by-side, but if it happens, WiX5 will be preferred over WiX4).
> 
> Custom WiX3 sources will be automatically converted to WiX4 format if WiX4/WiX5 is used. The converter provides:
> 
> - full support of the conversion of WiX L10N (.wxl) files, i.e. full support of "http://schemas.microsoft.com/wix/2006/localization" to "http://wixtoolset.org/schemas/v4/wxl" namespace conversion;
> - partial support of WiX source (.wxs) files, i.e. partial support of "http://schemas.microsoft.com/wix/2006/wi" to "http://wixtoolset.org/schemas/v4/wxs" namespace conversion;
> 
> The converter is a XSLT stylesheet. The default converter is `src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/wix3-to-wix4-conv.xsl`. It can be replaced with the custom converter by adding "wix-conv.xsl" file to the resource directory.

as we previously agreed this is for JDK 24 (mainline is becoming JDK 24 after 10am PT on Thu June 6) just do not jeopardize  by any kind of risks on stabilization part with all tests run cycle, so good to integrate once it is reviewed and approved after June 6th

WiX v5 for WiX v4 users

WiX v5 is highly compatible with WiX v4. WiX v5 continues in the traditions of WiX v4 and is available as both a .NET tool and an MSBuild SDK. The WiX v5 language uses the same XML namespace as WiX v4 and -- with a couple of exceptions -- is backward compatible with the WiX v4 language. That means that you don't need to translate your WiX v4 projects to use WiX v5.
https://wixtoolset.org/docs/fivefour/

So this is a good point to make it working with WiX 5 (not just WiX 4)

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

PR Comment: https://git.openjdk.org/jdk/pull/19318#issuecomment-2146401059
PR Comment: https://git.openjdk.org/jdk/pull/19318#issuecomment-2146402910

From jpai at openjdk.org  Tue Jun  4 01:56:09 2024
From: jpai at openjdk.org (Jaikiran Pai)
Date: Tue, 4 Jun 2024 01:56:09 GMT
Subject: RFR: 8333398: Uncomment the commented test in
 test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java
In-Reply-To: 
References: 
Message-ID: 

On Mon, 3 Jun 2024 04:25:38 GMT, Jaikiran Pai  wrote:

> Can I please get a review of this test-only change which uncomments an additional test that was commented out in `test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java`?
> 
> As noted in https://bugs.openjdk.org/browse/JDK-8333398, the original issue due to which this line was commented out in the test, has been fixed several releases back and thus this line can now be uncommented.
> 
> I've verified that this test continues to pass with these changes.

Thank you Iris and Lance for the reviews.

> We should look at at a later date to convert this to junit and when we do, look to rework isMultiReleaseJar() as it actually runs multiple tests within the test itself and if one fails, the rest will not be run

I have added it to my TODO to update this test in future.

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

PR Comment: https://git.openjdk.org/jdk/pull/19514#issuecomment-2146416470

From jpai at openjdk.org  Tue Jun  4 01:56:10 2024
From: jpai at openjdk.org (Jaikiran Pai)
Date: Tue, 4 Jun 2024 01:56:10 GMT
Subject: Integrated: 8333398: Uncomment the commented test in
 test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java
In-Reply-To: 
References: 
Message-ID: 

On Mon, 3 Jun 2024 04:25:38 GMT, Jaikiran Pai  wrote:

> Can I please get a review of this test-only change which uncomments an additional test that was commented out in `test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java`?
> 
> As noted in https://bugs.openjdk.org/browse/JDK-8333398, the original issue due to which this line was commented out in the test, has been fixed several releases back and thus this line can now be uncommented.
> 
> I've verified that this test continues to pass with these changes.

This pull request has now been integrated.

Changeset: d230b303
Author:    Jaikiran Pai 
URL:       https://git.openjdk.org/jdk/commit/d230b30353f59135287436b09949b80e9fd73a93
Stats:     5 lines in 1 file changed: 0 ins; 3 del; 2 mod

8333398: Uncomment the commented test in test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java

Reviewed-by: iris, lancea

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

PR: https://git.openjdk.org/jdk/pull/19514

From duke at openjdk.org  Tue Jun  4 02:18:49 2024
From: duke at openjdk.org (lingjun-cg)
Date: Tue, 4 Jun 2024 02:18:49 GMT
Subject: RFR: 8333396: Performance regression of DecimalFormat.format [v3]
In-Reply-To: 
References: 
Message-ID: 

> ### Performance regression of DecimalFormat.format
> From the output of perf, we can see the hottest regions contain atomic instructions.  But when run with JDK 11, there is no such problem. The reason is the removed biased locking.  
> The DecimalFormat uses StringBuffer everywhere, and StringBuffer itself contains many synchronized methods.
> So I added support for some new methods that accept StringBuilder which is lock-free.
> 
> ### Test result
> 
> @BenchmarkMode(Mode.AverageTime)
> @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS)
> @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
> @State(Scope.Thread)
> @OutputTimeUnit(TimeUnit.NANOSECONDS)
> public class JmhDecimalFormat {
> 
>     private DecimalFormat format;
> 
>     @Setup(Level.Trial)
>     public void setup() {
>         format = new DecimalFormat("#0.00000");
>     }
> 
>     @Benchmark
>     public void testNewAndFormat() throws InterruptedException {
>         new DecimalFormat("#0.00000").format(9524234.1236457);
>     }
> 
>     @Benchmark
>     public void testNewOnly() throws InterruptedException {
>         new DecimalFormat("#0.00000");
>     }
> 
>     @Benchmark
>     public void testFormatOnly() throws InterruptedException {
>         format.format(9524234.1236457);
>     }
> }
> 
> #### Current JDK before optimize
> 
>  Benchmark                             Mode  Cnt    Score   Error  Units
> JmhDecimalFormat.testFormatOnly       avgt   50  642.099 ? 1.253  ns/op
> JmhDecimalFormat.testNewAndFormat     avgt   50  989.307 ? 3.676  ns/op
> JmhDecimalFormat.testNewOnly          avgt   50  303.381 ? 5.252  ns/op
> 
> 
> 
> #### Current JDK after optimize
> 
> Benchmark                          Mode  Cnt    Score   Error  Units
> JmhDecimalFormat.testFormatOnly    avgt   50  351.499 ? 0.761  ns/op
> JmhDecimalFormat.testNewAndFormat  avgt   50  615.145 ? 2.478  ns/op
> JmhDecimalFormat.testNewOnly       avgt   50  209.874 ? 9.951  ns/op
> 
> 
> ### JDK 11 
> 
> Benchmark                          Mode  Cnt    Score   Error  Units
> JmhDecimalFormat.testFormatOnly    avgt   50  364.214 ? 1.191  ns/op
> JmhDecimalFormat.testNewAndFormat  avgt   50  658.699 ? 2.311  ns/op
> JmhDecimalFormat.testNewOnly       avgt   50  248.300 ? 5.158  ns/op

lingjun-cg has updated the pull request incrementally with one additional commit since the last revision:

  8333396: Performance regression of DecimalFormat.format

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/19513/files
  - new: https://git.openjdk.org/jdk/pull/19513/files/b48962b5..0a581428

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=19513&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19513&range=01-02

  Stats: 6 lines in 1 file changed: 0 ins; 2 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/19513.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19513/head:pull/19513

PR: https://git.openjdk.org/jdk/pull/19513

From duke at openjdk.org  Tue Jun  4 02:39:24 2024
From: duke at openjdk.org (lingjun-cg)
Date: Tue, 4 Jun 2024 02:39:24 GMT
Subject: RFR: 8333462: Performance regression of new DecimalFormat() when
 compare to jdk11
Message-ID: 

Run the below benchmark test  ,it show the average time of new DecimalFormat()  increase 18% when compare to jdk 11.

the result with jdk 11:

Benchmark                          Mode  Cnt    Score   Error  Units
JmhDecimalFormat.testNewOnly       avgt   50  248.300 ? 5.158  ns/op


the result with current jdk:

Benchmark                          Mode  Cnt    Score   Error  Units
JmhDecimalFormat.testNewOnly       avgt   50  303.381 ? 5.252  ns/op



@BenchmarkMode(Mode.AverageTime)
@Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
@State(Scope.Thread)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public class JmhDecimalFormat {

    @Setup(Level.Trial)
    public void setup() {
    }

    @Benchmark
    public void testNewOnly() throws InterruptedException {
        new DecimalFormat("#0.00000");
    }
}


Compare the flame graph it shows the java.text.DecimalFormatSymbols#findNonFormatChar takes a significant time. 
After replacing  the lambda implementation with a simple loop , it shows nearly the same performance as jdk 11.


Benchmark                          Mode  Cnt    Score   Error  Units
JmhDecimalFormat.testNewOnly       avgt   50  209.874 ? 9.951  ns/op


[flame-graph-jdk11-jdk21.zip](https://github.com/user-attachments/files/15541764/flame-graph-jdk11-jdk21.zip)

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

Commit messages:
 - 8333462: Performance regression of new DecimalFormat() when compare to jdk11

Changes: https://git.openjdk.org/jdk/pull/19534/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19534&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8333462
  Stats: 6 lines in 1 file changed: 2 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/19534.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19534/head:pull/19534

PR: https://git.openjdk.org/jdk/pull/19534

From almatvee at openjdk.org  Tue Jun  4 02:41:04 2024
From: almatvee at openjdk.org (Alexander Matveev)
Date: Tue, 4 Jun 2024 02:41:04 GMT
Subject: RFR: 8319457: Update jpackage to support WiX Toolset 4 on Windows
In-Reply-To: 
References: 
 
 
Message-ID: 

On Tue, 4 Jun 2024 01:29:15 GMT, Alexey Semenyuk  wrote:

> > Is there plan to add support for WiX 5?
> 
> This patch supports WiX5 as well. There is not much difference between WiX4 and WiX5 from jpackage perspective. I'll update the description

I assume WiX5 will just work if installed instead of WiX4? Do you think it will make sense to introduce Wix5 ToolsetType in case if we need to do something different between 4 and 5?

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

PR Comment: https://git.openjdk.org/jdk/pull/19318#issuecomment-2146460825

From almatvee at openjdk.org  Tue Jun  4 02:45:08 2024
From: almatvee at openjdk.org (Alexander Matveev)
Date: Tue, 4 Jun 2024 02:45:08 GMT
Subject: RFR: 8319457: Update jpackage to support WiX Toolset 4 on Windows
In-Reply-To: 
References: 
Message-ID: 

On Mon, 20 May 2024 21:14:09 GMT, Alexey Semenyuk  wrote:

> Add support for WiX4 (and WiX5) in jpackage.
> 
> jpackage supports WiX3, WiX4 and WiX5. It will pick WiX4/WiX5 if one of them is installed and there is WiX3 installed too. (Note: WiX4 and WiX5 are not supposed to be installed side-by-side, but if it happens, WiX5 will be preferred over WiX4).
> 
> Custom WiX3 sources will be automatically converted to WiX4 format if WiX4/WiX5 is used. The converter provides:
> 
> - full support of the conversion of WiX L10N (.wxl) files, i.e. full support of "http://schemas.microsoft.com/wix/2006/localization" to "http://wixtoolset.org/schemas/v4/wxl" namespace conversion;
> - partial support of WiX source (.wxs) files, i.e. partial support of "http://schemas.microsoft.com/wix/2006/wi" to "http://wixtoolset.org/schemas/v4/wxs" namespace conversion;
> 
> The converter is a XSLT stylesheet. The default converter is `src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/wix3-to-wix4-conv.xsl`. It can be replaced with the custom converter by adding "wix-conv.xsl" file to the resource directory.

src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixTool.java line 51:

> 49:     Candle3("candle", DottedVersion.lazy("3.0")),
> 50:     Light3("light", DottedVersion.lazy("3.0")),
> 51:     Wix4("wix", DottedVersion.lazy("4.0.4"));

Is there any reason to use "4.0.4" here? Latest released version is "4.0.5". Can we just put "4.0" similar to "3.0".

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19318#discussion_r1625259023

From vlivanov at openjdk.org  Tue Jun  4 04:05:12 2024
From: vlivanov at openjdk.org (Vladimir Ivanov)
Date: Tue, 4 Jun 2024 04:05:12 GMT
Subject: RFR: 8332547: Unloaded signature classes in DirectMethodHandles
 [v2]
In-Reply-To: 
References: 
 
Message-ID: <2fd-qvBsJuxYtZmX22F7u5ycAN7uDMobngVKi3Wqrtc=.dc93d9da-948d-433d-9aeb-a205407a41b5@github.com>

On Mon, 3 Jun 2024 19:36:58 GMT, Vladimir Ivanov  wrote:

>> JVM routinely installs loader constraints for unloaded signature classes when method resolution takes place. MethodHandle resolution took a different route and eagerly resolves signature classes instead (see `java.lang.invoke.MemberName$Factory::resolve` and `sun.invoke.util.VerifyAccess::isTypeVisible` for details). 
>> 
>> There's a micro-optimization which bypasses eager resolution for `java.*` classes. The downside is that `java.*` signature classes can show up as unloaded. It manifests as inlining failures during JIT-compilation and may cause severe performance issues.
>> 
>> Proposed fix removes the aforementioned special case logic during `MethodHandle` resolution. 
>> 
>> In some cases it may slow down `MethodHandle` construction a bit (e.g., when repeatedly constructing `DirectMethodHandle`s with lots of arguments), but `MethodHandle` construction step is not performance critical.  
>> 
>> Testing: hs-tier1 - hs-tier4
>
> Vladimir Ivanov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Renaming: isTypeVisible -> ensureTypeVisible

Thanks for the reviews, Jorn and Chen.

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

PR Comment: https://git.openjdk.org/jdk/pull/19319#issuecomment-2146542294

From vlivanov at openjdk.org  Tue Jun  4 04:05:13 2024
From: vlivanov at openjdk.org (Vladimir Ivanov)
Date: Tue, 4 Jun 2024 04:05:13 GMT
Subject: Integrated: 8332547: Unloaded signature classes in DirectMethodHandles
In-Reply-To: 
References: 
Message-ID: <88jGtEXd70Hb-Qjg9oZKX_N3Ut3OOn8hAAhb1GsTFnU=.92540a2f-028d-4d4c-b2f1-e72f25d91942@github.com>

On Mon, 20 May 2024 21:29:20 GMT, Vladimir Ivanov  wrote:

> JVM routinely installs loader constraints for unloaded signature classes when method resolution takes place. MethodHandle resolution took a different route and eagerly resolves signature classes instead (see `java.lang.invoke.MemberName$Factory::resolve` and `sun.invoke.util.VerifyAccess::isTypeVisible` for details). 
> 
> There's a micro-optimization which bypasses eager resolution for `java.*` classes. The downside is that `java.*` signature classes can show up as unloaded. It manifests as inlining failures during JIT-compilation and may cause severe performance issues.
> 
> Proposed fix removes the aforementioned special case logic during `MethodHandle` resolution. 
> 
> In some cases it may slow down `MethodHandle` construction a bit (e.g., when repeatedly constructing `DirectMethodHandle`s with lots of arguments), but `MethodHandle` construction step is not performance critical.  
> 
> Testing: hs-tier1 - hs-tier4

This pull request has now been integrated.

Changeset: 29e10e45
Author:    Vladimir Ivanov 
URL:       https://git.openjdk.org/jdk/commit/29e10e4582c1a844a6db4c42ba01bd1d6d4dfd52
Stats:     83 lines in 4 files changed: 68 ins; 0 del; 15 mod

8332547: Unloaded signature classes in DirectMethodHandles

Reviewed-by: jvernee, liach

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

PR: https://git.openjdk.org/jdk/pull/19319

From dholmes at openjdk.org  Tue Jun  4 05:57:04 2024
From: dholmes at openjdk.org (David Holmes)
Date: Tue, 4 Jun 2024 05:57:04 GMT
Subject: RFR: 8331977: Crash: SIGSEGV in dlerror()
In-Reply-To: 
References: 
 
 
Message-ID: 

On Mon, 3 Jun 2024 14:38:03 GMT, Alexey Semenyuk  wrote:

>> I am yet to see anything that actually explains the cause of the `dlerror` crash here ???
>
> @dholmes-ora there is no fix for the cause of the `dlerror` crash in this PR. The PR fixes jpackage tests to rerun a launcher if it crashes. This workaround for jpackage tests was first introduced in [JDK-8269403](https://bugs.openjdk.org/browse/JDK-8269403) fix but MainClassTest was left unfixed back then. This PR complements [JDK-8269403](https://bugs.openjdk.org/browse/JDK-8269403).

@alexeysemenyukoracle But now there is no bug to investigate the dlerrror crash! If you wanted to make the test more robust a new JBS issue should have been filed for that.

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

PR Comment: https://git.openjdk.org/jdk/pull/19502#issuecomment-2146669916

From alanb at openjdk.org  Tue Jun  4 06:46:17 2024
From: alanb at openjdk.org (Alan Bateman)
Date: Tue, 4 Jun 2024 06:46:17 GMT
Subject: RFR: 8331977: Crash: SIGSEGV in dlerror()
In-Reply-To: 
References: 
 
 
Message-ID: 

On Mon, 3 Jun 2024 14:38:03 GMT, Alexey Semenyuk  wrote:

>> I am yet to see anything that actually explains the cause of the `dlerror` crash here ???
>
> @dholmes-ora there is no fix for the cause of the `dlerror` crash in this PR. The PR fixes jpackage tests to rerun a launcher if it crashes. This workaround for jpackage tests was first introduced in [JDK-8269403](https://bugs.openjdk.org/browse/JDK-8269403) fix but MainClassTest was left unfixed back then. This PR complements [JDK-8269403](https://bugs.openjdk.org/browse/JDK-8269403).

@alexeysemenyukoracle If I read JDK-8269403 correctly then there is an issue somewhere that hasn't been diagnosed. A workaround has been put in to "re-run" when there is a crash, thus hiding the issue. Are there follow-up issues created in JBS to continue the hunt for the original crash?

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

PR Comment: https://git.openjdk.org/jdk/pull/19502#issuecomment-2146731836

From scolebourne at joda.org  Tue Jun  4 07:17:07 2024
From: scolebourne at joda.org (Stephen Colebourne)
Date: Tue, 4 Jun 2024 08:17:07 +0100
Subject: Instant.now(Clock) and InstantSource
In-Reply-To: 
References: 
Message-ID: 

On Mon, 3 Jun 2024 at 22:25, Kurt Alfred Kluever  wrote:
> It feels a bit strange that you can't pass an `InstantSource` to `Instant.now(...)`, but you _can_ pass a `Clock` (which of course has a "useless" `ZoneId` when creating an `Instant`). Therefore, I'd like to propose one of the following API changes:
>
> 1) adding `Instant.now(InstantSource)`
> 2) deprecating `Instant.now(Clock)` in favor of `clock.instant()`

I have no problem with adding `Instant.now(InstantSource)`, but I
think deprecating the `Clock` method is unnecessary (given it will
never be removed AFAICT, and it is no doubt in widespread use).
Stephen

From duke at openjdk.org  Tue Jun  4 07:25:07 2024
From: duke at openjdk.org (kuaiwei)
Date: Tue, 4 Jun 2024 07:25:07 GMT
Subject: RFR: 8333396: Performance regression of DecimalFormat.format [v3]
In-Reply-To: 
References: 
 
Message-ID: 

On Tue, 4 Jun 2024 02:18:49 GMT, lingjun-cg  wrote:

>> ### Performance regression of DecimalFormat.format
>> From the output of perf, we can see the hottest regions contain atomic instructions.  But when run with JDK 11, there is no such problem. The reason is the removed biased locking.  
>> The DecimalFormat uses StringBuffer everywhere, and StringBuffer itself contains many synchronized methods.
>> So I added support for some new methods that accept StringBuilder which is lock-free.
>> 
>> ### Test result
>> 
>> @BenchmarkMode(Mode.AverageTime)
>> @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS)
>> @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
>> @State(Scope.Thread)
>> @OutputTimeUnit(TimeUnit.NANOSECONDS)
>> public class JmhDecimalFormat {
>> 
>>     private DecimalFormat format;
>> 
>>     @Setup(Level.Trial)
>>     public void setup() {
>>         format = new DecimalFormat("#0.00000");
>>     }
>> 
>>     @Benchmark
>>     public void testNewAndFormat() throws InterruptedException {
>>         new DecimalFormat("#0.00000").format(9524234.1236457);
>>     }
>> 
>>     @Benchmark
>>     public void testNewOnly() throws InterruptedException {
>>         new DecimalFormat("#0.00000");
>>     }
>> 
>>     @Benchmark
>>     public void testFormatOnly() throws InterruptedException {
>>         format.format(9524234.1236457);
>>     }
>> }
>> 
>> #### Current JDK before optimize
>> 
>>  Benchmark                             Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly       avgt   50  642.099 ? 1.253  ns/op
>> JmhDecimalFormat.testNewAndFormat     avgt   50  989.307 ? 3.676  ns/op
>> JmhDecimalFormat.testNewOnly          avgt   50  303.381 ? 5.252  ns/op
>> 
>> 
>> 
>> #### Current JDK after optimize
>> 
>> Benchmark                          Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly    avgt   50  351.499 ? 0.761  ns/op
>> JmhDecimalFormat.testNewAndFormat  avgt   50  615.145 ? 2.478  ns/op
>> JmhDecimalFormat.testNewOnly       avgt   50  209.874 ? 9.951  ns/op
>> 
>> 
>> ### JDK 11 
>> 
>> Benchmark                          Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly    avgt   50  364.214 ? 1.191  ns/op
>> JmhDecimalFormat.testNewAndFormat  avgt   50  658.699 ? 2.311  ns/op
>> JmhDecimalFormat.testNewOnly       avgt   50  248.300 ? 5.158  ns/op
>
> lingjun-cg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8333396: Performance regression of DecimalFormat.format

Hi, I think you can add the jmh test case.

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

PR Comment: https://git.openjdk.org/jdk/pull/19513#issuecomment-2146791250

From syan at openjdk.org  Tue Jun  4 07:51:36 2024
From: syan at openjdk.org (SendaoYan)
Date: Tue, 4 Jun 2024 07:51:36 GMT
Subject: RFR: 8333477: Delete extra empty spaces in Makefiles
Message-ID: 

Hi all,
  This PR several extra empty spaces and extra empty lines in several Makefiles. It's trivial fix, no risk.

Thanks.

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

Commit messages:
 - 8333477: Delete extra empty spaces in Makefiles

Changes: https://git.openjdk.org/jdk/pull/19537/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19537&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8333477
  Stats: 9 lines in 4 files changed: 0 ins; 1 del; 8 mod
  Patch: https://git.openjdk.org/jdk/pull/19537.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19537/head:pull/19537

PR: https://git.openjdk.org/jdk/pull/19537

From duke at openjdk.org  Tue Jun  4 07:53:02 2024
From: duke at openjdk.org (lingjun-cg)
Date: Tue, 4 Jun 2024 07:53:02 GMT
Subject: RFR: 8333396: Performance regression of DecimalFormat.format [v3]
In-Reply-To: 
References: 
 
 
Message-ID: 

On Tue, 4 Jun 2024 07:21:15 GMT, kuaiwei  wrote:

> Hi, I think you can add the jmh test case.

https://github.com/openjdk/jdk/pull/19513#issue-2330131051 already contains the test case.

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

PR Comment: https://git.openjdk.org/jdk/pull/19513#issuecomment-2146844849

From duke at openjdk.org  Tue Jun  4 07:58:16 2024
From: duke at openjdk.org (kuaiwei)
Date: Tue, 4 Jun 2024 07:58:16 GMT
Subject: RFR: 8333396: Performance regression of DecimalFormat.format [v3]
In-Reply-To: 
References: 
 
Message-ID: 

On Tue, 4 Jun 2024 02:18:49 GMT, lingjun-cg  wrote:

>> ### Performance regression of DecimalFormat.format
>> From the output of perf, we can see the hottest regions contain atomic instructions.  But when run with JDK 11, there is no such problem. The reason is the removed biased locking.  
>> The DecimalFormat uses StringBuffer everywhere, and StringBuffer itself contains many synchronized methods.
>> So I added support for some new methods that accept StringBuilder which is lock-free.
>> 
>> ### Benchmark testcase
>> 
>> @BenchmarkMode(Mode.AverageTime)
>> @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS)
>> @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
>> @State(Scope.Thread)
>> @OutputTimeUnit(TimeUnit.NANOSECONDS)
>> public class JmhDecimalFormat {
>> 
>>     private DecimalFormat format;
>> 
>>     @Setup(Level.Trial)
>>     public void setup() {
>>         format = new DecimalFormat("#0.00000");
>>     }
>> 
>>     @Benchmark
>>     public void testNewAndFormat() throws InterruptedException {
>>         new DecimalFormat("#0.00000").format(9524234.1236457);
>>     }
>> 
>>     @Benchmark
>>     public void testNewOnly() throws InterruptedException {
>>         new DecimalFormat("#0.00000");
>>     }
>> 
>>     @Benchmark
>>     public void testFormatOnly() throws InterruptedException {
>>         format.format(9524234.1236457);
>>     }
>> }
>> 
>> 
>> ### Test result
>> #### Current JDK before optimize
>> 
>>  Benchmark                             Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly       avgt   50  642.099 ? 1.253  ns/op
>> JmhDecimalFormat.testNewAndFormat     avgt   50  989.307 ? 3.676  ns/op
>> JmhDecimalFormat.testNewOnly          avgt   50  303.381 ? 5.252  ns/op
>> 
>> 
>> 
>> #### Current JDK after optimize
>> 
>> Benchmark                          Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly    avgt   50  351.499 ? 0.761  ns/op
>> JmhDecimalFormat.testNewAndFormat  avgt   50  615.145 ? 2.478  ns/op
>> JmhDecimalFormat.testNewOnly       avgt   50  209.874 ? 9.951  ns/op
>> 
>> 
>> ### JDK 11 
>> 
>> Benchmark                          Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly    avgt   50  364.214 ? 1.191  ns/op
>> JmhDecimalFormat.testNewAndFormat  avgt   50  658.699 ? 2.311  ns/op
>> JmhDecimalFormat.testNewOnly       avgt   50  248.300 ? 5.158  ns/op
>
> lingjun-cg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8333396: Performance regression of DecimalFormat.format

> > Hi, I think you can add the jmh test case.
> 
> [#19513 (comment)](https://github.com/openjdk/jdk/pull/19513#issue-2330131051) already contains the test case.

I mean it can be added as a test case in test/micro and be evaluated in future build.

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

PR Comment: https://git.openjdk.org/jdk/pull/19513#issuecomment-2146853395

From duke at openjdk.org  Tue Jun  4 09:01:04 2024
From: duke at openjdk.org (lingjun-cg)
Date: Tue, 4 Jun 2024 09:01:04 GMT
Subject: RFR: 8333396: Performance regression of DecimalFormat.format [v3]
In-Reply-To: 
References: 
 
 
Message-ID: 

On Tue, 4 Jun 2024 07:54:56 GMT, kuaiwei  wrote:

> > > Hi, I think you can add the jmh test case.
> > 
> > 
> > [#19513 (comment)](https://github.com/openjdk/jdk/pull/19513#issue-2330131051) already contains the test case.
> 
> I mean it can be added as a test case in test/micro and be evaluated in future build.

Thanks for your remainder. There exist a JMH  test case which named  'test/micro/org/openjdk/bench/java/text/DefFormatterBench.java'.

This JMH test case run in throughput mode.
If  run without the patch, the output is:

Benchmark                                  Mode  Cnt     Score    Error   Units
DefFormatterBench.testDefNumberFormatter  thrpt    5  1842.666 ? 83.694  ops/ms


If run with after apply the patch, the output is:

Benchmark                                  Mode  Cnt     Score     Error   Units
DefFormatterBench.testDefNumberFormatter  thrpt    5  3988.274 ? 513.434  ops/ms


The score is increased by  (3988.274-1842.666)/1842.666 = 116%.

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

PR Comment: https://git.openjdk.org/jdk/pull/19513#issuecomment-2146983441

From ihse at openjdk.org  Tue Jun  4 09:07:22 2024
From: ihse at openjdk.org (Magnus Ihse Bursie)
Date: Tue, 4 Jun 2024 09:07:22 GMT
Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged
 modules being present [v29]
In-Reply-To: 
References: 
 
 <6Qs2lLk0mJP0XdyH9ysENqcUT7P0KxsWU95fvRzA21Q=.09e661a3-d340-4fde-8030-77db94a2d353@github.com>
 
 
 
Message-ID: 

On Mon, 3 Jun 2024 19:10:22 GMT, Alan Bateman  wrote:

> Does that proposal sound good?

What you basically is saying is that the default value of `packaged-modules` should be `! runtime-link-image` (i.e. the inverse)?

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

PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2146996167

From duke at openjdk.org  Tue Jun  4 09:07:44 2024
From: duke at openjdk.org (lingjun-cg)
Date: Tue, 4 Jun 2024 09:07:44 GMT
Subject: RFR: 8333396: Performance regression of DecimalFormat.format [v4]
In-Reply-To: 
References: 
Message-ID: 

> ### Performance regression of DecimalFormat.format
> From the output of perf, we can see the hottest regions contain atomic instructions.  But when run with JDK 11, there is no such problem. The reason is the removed biased locking.  
> The DecimalFormat uses StringBuffer everywhere, and StringBuffer itself contains many synchronized methods.
> So I added support for some new methods that accept StringBuilder which is lock-free.
> 
> ### Benchmark testcase
> 
> @BenchmarkMode(Mode.AverageTime)
> @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS)
> @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
> @State(Scope.Thread)
> @OutputTimeUnit(TimeUnit.NANOSECONDS)
> public class JmhDecimalFormat {
> 
>     private DecimalFormat format;
> 
>     @Setup(Level.Trial)
>     public void setup() {
>         format = new DecimalFormat("#0.00000");
>     }
> 
>     @Benchmark
>     public void testNewAndFormat() throws InterruptedException {
>         new DecimalFormat("#0.00000").format(9524234.1236457);
>     }
> 
>     @Benchmark
>     public void testNewOnly() throws InterruptedException {
>         new DecimalFormat("#0.00000");
>     }
> 
>     @Benchmark
>     public void testFormatOnly() throws InterruptedException {
>         format.format(9524234.1236457);
>     }
> }
> 
> 
> ### Test result
> #### Current JDK before optimize
> 
>  Benchmark                             Mode  Cnt    Score   Error  Units
> JmhDecimalFormat.testFormatOnly       avgt   50  642.099 ? 1.253  ns/op
> JmhDecimalFormat.testNewAndFormat     avgt   50  989.307 ? 3.676  ns/op
> JmhDecimalFormat.testNewOnly          avgt   50  303.381 ? 5.252  ns/op
> 
> 
> 
> #### Current JDK after optimize
> 
> Benchmark                          Mode  Cnt    Score   Error  Units
> JmhDecimalFormat.testFormatOnly    avgt   50  351.499 ? 0.761  ns/op
> JmhDecimalFormat.testNewAndFormat  avgt   50  615.145 ? 2.478  ns/op
> JmhDecimalFormat.testNewOnly       avgt   50  209.874 ? 9.951  ns/op
> 
> 
> ### JDK 11 
> 
> Benchmark                          Mode  Cnt    Score   Error  Units
> JmhDecimalFormat.testFormatOnly    avgt   50  364.214 ? 1.191  ns/op
> JmhDecimalFormat.testNewAndFormat  avgt   50  658.699 ? 2.311  ns/op
> JmhDecimalFormat.testNewOnly       avgt   50  248.300 ? 5.158  ns/op

lingjun-cg has updated the pull request incrementally with one additional commit since the last revision:

  8333396: Performance regression of DecimalFormat.format

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/19513/files
  - new: https://git.openjdk.org/jdk/pull/19513/files/0a581428..6210c61e

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=19513&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19513&range=02-03

  Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/19513.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19513/head:pull/19513

PR: https://git.openjdk.org/jdk/pull/19513

From duke at openjdk.org  Tue Jun  4 09:09:05 2024
From: duke at openjdk.org (kuaiwei)
Date: Tue, 4 Jun 2024 09:09:05 GMT
Subject: RFR: 8333396: Performance regression of DecimalFormat.format [v3]
In-Reply-To: 
References: 
 
 
 
Message-ID: <2W8HmjrFpkx70jtdbOELneBDxX8m4QxG-Pvxa00f9cs=.428ef3eb-e3aa-48e7-9bc2-4f1112c692ea@github.com>

On Tue, 4 Jun 2024 08:58:38 GMT, lingjun-cg  wrote:

> > > > Hi, I think you can add the jmh test case.
> > > 
> > > 
> > > [#19513 (comment)](https://github.com/openjdk/jdk/pull/19513#issue-2330131051) already contains the test case.
> > 
> > 
> > I mean it can be added as a test case in test/micro and be evaluated in future build.
> 
> Thanks for your remainder. There exist a JMH test case which named 'test/micro/org/openjdk/bench/java/text/DefFormatterBench.java'.
> 
> This JMH test case run in throughput mode. If run without the patch, the output is:
> 
> ```
> Benchmark                                  Mode  Cnt     Score    Error   Units
> DefFormatterBench.testDefNumberFormatter  thrpt    5  1842.666 ? 83.694  ops/ms
> ```
> 
> If run with after apply the patch, the output is:
> 
> ```
> Benchmark                                  Mode  Cnt     Score     Error   Units
> DefFormatterBench.testDefNumberFormatter  thrpt    5  3988.274 ? 513.434  ops/ms
> ```
> 
> The score is increased by (3988.274-1842.666)/1842.666 = 116%.

Yes, it's what I expected.

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

PR Comment: https://git.openjdk.org/jdk/pull/19513#issuecomment-2146999574

From sgehwolf at openjdk.org  Tue Jun  4 09:11:28 2024
From: sgehwolf at openjdk.org (Severin Gehwolf)
Date: Tue, 4 Jun 2024 09:11:28 GMT
Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged
 modules being present [v29]
In-Reply-To: 
References: 
 
 <6Qs2lLk0mJP0XdyH9ysENqcUT7P0KxsWU95fvRzA21Q=.09e661a3-d340-4fde-8030-77db94a2d353@github.com>
 
 
 
 
Message-ID: 

On Tue, 4 Jun 2024 09:04:30 GMT, Magnus Ihse Bursie  wrote:

> > Does that proposal sound good?
> 
> What you basically is saying is that the default value of `packaged-modules` should be `! runtime-link-image` (i.e. the inverse)?

Yes. **default** of the `packaged-modules` value being the key.

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

PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2147004354

From sgehwolf at openjdk.org  Tue Jun  4 09:54:27 2024
From: sgehwolf at openjdk.org (Severin Gehwolf)
Date: Tue, 4 Jun 2024 09:54:27 GMT
Subject: RFR: 8333446: Add tests for hierarchical container support
Message-ID: 

Please review this PR which adds test support for systemd slices so that bugs like [JDK-8217338](https://bugs.openjdk.org/browse/JDK-8217338) can be verified. The added test, `SystemdMemoryAwarenessTest` currently passes on cgroups v1 and fails on cgroups v2 due to the way how [JDK-8217338](https://bugs.openjdk.org/browse/JDK-8217338) was implemented when JDK 13 was a thing. Therefore immediately problem-listed. It should get unlisted once [JDK-8322420](https://bugs.openjdk.org/browse/JDK-8322420) merges.

I'm adding those tests in order to not regress another time.

Testing:
- [x] Container tests on Linux x86_64 cgroups v2 and Linux x86_64 cgroups v1.
- [x] New systemd test on cg v1 (passes). Fails on cg v2 (due to  JDK-8322420)
- [x] GHA

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

Commit messages:
 - Fix comments
 - 8333446: Add tests for hierarchical container support

Changes: https://git.openjdk.org/jdk/pull/19530/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19530&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8333446
  Stats: 489 lines in 8 files changed: 482 ins; 0 del; 7 mod
  Patch: https://git.openjdk.org/jdk/pull/19530.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19530/head:pull/19530

PR: https://git.openjdk.org/jdk/pull/19530

From sgehwolf at openjdk.org  Tue Jun  4 09:54:27 2024
From: sgehwolf at openjdk.org (Severin Gehwolf)
Date: Tue, 4 Jun 2024 09:54:27 GMT
Subject: RFR: 8333446: Add tests for hierarchical container support
In-Reply-To: 
References: 
Message-ID: 

On Mon, 3 Jun 2024 17:28:09 GMT, Severin Gehwolf  wrote:

> Please review this PR which adds test support for systemd slices so that bugs like [JDK-8217338](https://bugs.openjdk.org/browse/JDK-8217338) can be verified. The added test, `SystemdMemoryAwarenessTest` currently passes on cgroups v1 and fails on cgroups v2 due to the way how [JDK-8217338](https://bugs.openjdk.org/browse/JDK-8217338) was implemented when JDK 13 was a thing. Therefore immediately problem-listed. It should get unlisted once [JDK-8322420](https://bugs.openjdk.org/browse/JDK-8322420) merges.
> 
> I'm adding those tests in order to not regress another time.
> 
> Testing:
> - [x] Container tests on Linux x86_64 cgroups v2 and Linux x86_64 cgroups v1.
> - [x] New systemd test on cg v1 (passes). Fails on cg v2 (due to  JDK-8322420)
> - [x] GHA

GHA failure of macos-x64 seems infra related and not related to this patch.

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

PR Comment: https://git.openjdk.org/jdk/pull/19530#issuecomment-2147097626

From sgehwolf at openjdk.org  Tue Jun  4 09:59:29 2024
From: sgehwolf at openjdk.org (Severin Gehwolf)
Date: Tue, 4 Jun 2024 09:59:29 GMT
Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged
 modules being present [v29]
In-Reply-To: 
References: 
 
 <6Qs2lLk0mJP0XdyH9ysENqcUT7P0KxsWU95fvRzA21Q=.09e661a3-d340-4fde-8030-77db94a2d353@github.com>
 
 
 
Message-ID: 

On Mon, 3 Jun 2024 19:10:22 GMT, Alan Bateman  wrote:

> I've read through most of the changes now. Overall I think it's looking good, just a few terminology and minor points that I'll add as comments.

@AlanBateman I don't see those comments. Should I?

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

PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2147116736

From jpai at openjdk.org  Tue Jun  4 11:38:09 2024
From: jpai at openjdk.org (Jaikiran Pai)
Date: Tue, 4 Jun 2024 11:38:09 GMT
Subject: RFR: 8326951: since-checker - missing @ since tags [v9]
In-Reply-To: 
References: <_iA0CxGgaa8nA5AlNfT1IfG3Y6Wx7tcdiv3oJQNYCjQ=.5fb84060-0490-4b18-8995-cc534e1c22f5@github.com>
 
Message-ID: 

On Mon, 13 May 2024 20:39:14 GMT, Nizar Benalla  wrote:

>> I added `@since` tags for methods/constructors that do not match the `@since` of the enclosing class.
>> 
>> The `write` method already existed in `PrintStream` in earlier versions and instances of it could always call this method, since it extends `FilterOutputStream` [which has the method](https://github.com/openjdk/jdk6/blob/3e49aa876353eaa215cde71eb21acc9b7f9872a0/jdk/src/share/classes/java/io/FilterOutputStream.java#L96).
>> 
>> for `MappedByteBuffer slice()` and `MappedByteBuffer slice(int index, int length)`, the return type changed from `ByteBuffer ` to `MappedByteBuffer`. And the checker tool differentiates between them because of that.
>> 
>> This is similar to #18032 and #18373 
>> 
>> For context, I am writing tests to check for accurate use of `@since` tags in documentation comments in source code.
>> We're following these rules for now:
>> 
>> ### Rule 1: Introduction of New Elements
>> 
>> - If an element is new in JDK N, with no equivalent in JDK N-1, it must include `@since N`.
>>   - Exception: Member elements (fields, methods, nested classes) may omit `@since` if their version matches the value specified for the enclosing class or interface.
>> 
>> ### Rule 2: Existing Elements in Subsequent JDK Versions
>> 
>> - If an element exists in JDK N, with an equivalent in JDK N-1, it should not include `@since N`.
>> 
>> ### Rule 3: Handling Missing `@since` Tags in methods if there is no `@since`
>> 
>> - When inspecting methods, prioritize the `@since` annotation of the supertype's overridden method.
>> - If unavailable or if the enclosing class's `@since` is newer, use the enclosing element's `@since`.
>> 
>>   I.e. if A extends B, and we add a method to B in JDK N, and add an override of the method to A in JDK M (M > N), we will use N as the effective `@since` for the method.
>
> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
> 
>   empty commit and merge

src/java.base/share/classes/java/io/PrintStream.java line 683:

> 681:      * @see #write(byte[],int,int)
> 682:      *
> 683:      * @since 14

The `@since 14` was added here as part of https://bugs.openjdk.org/browse/JDK-8187898. The CSR explains what the changes were https://bugs.openjdk.org/browse/JDK-8230625. As noted in that CSR's specification (and attached images), the change for this method in that issue ended up being just API clarification (through a `@apiNote`) and no other change to this specific method. It continued to have the same signature including the throws clause that was previously available on this class through the super `FilterOutputStream#write(byte[])` method.

So removing this `@since 14` looks correct to me.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18055#discussion_r1625840895

From jpai at openjdk.org  Tue Jun  4 11:41:07 2024
From: jpai at openjdk.org (Jaikiran Pai)
Date: Tue, 4 Jun 2024 11:41:07 GMT
Subject: RFR: 8326951: since-checker - missing @ since tags [v9]
In-Reply-To: 
References: <_iA0CxGgaa8nA5AlNfT1IfG3Y6Wx7tcdiv3oJQNYCjQ=.5fb84060-0490-4b18-8995-cc534e1c22f5@github.com>
 
Message-ID: <9cNhL1WSyM-7ciSlWChw51xUvYUQYf8-mKxII-yT9Z4=.262297ee-ee41-4112-bcec-d6c706559d68@github.com>

On Mon, 13 May 2024 20:39:14 GMT, Nizar Benalla  wrote:

>> I added `@since` tags for methods/constructors that do not match the `@since` of the enclosing class.
>> 
>> The `write` method already existed in `PrintStream` in earlier versions and instances of it could always call this method, since it extends `FilterOutputStream` [which has the method](https://github.com/openjdk/jdk6/blob/3e49aa876353eaa215cde71eb21acc9b7f9872a0/jdk/src/share/classes/java/io/FilterOutputStream.java#L96).
>> 
>> for `MappedByteBuffer slice()` and `MappedByteBuffer slice(int index, int length)`, the return type changed from `ByteBuffer ` to `MappedByteBuffer`. And the checker tool differentiates between them because of that.
>> 
>> This is similar to #18032 and #18373 
>> 
>> For context, I am writing tests to check for accurate use of `@since` tags in documentation comments in source code.
>> We're following these rules for now:
>> 
>> ### Rule 1: Introduction of New Elements
>> 
>> - If an element is new in JDK N, with no equivalent in JDK N-1, it must include `@since N`.
>>   - Exception: Member elements (fields, methods, nested classes) may omit `@since` if their version matches the value specified for the enclosing class or interface.
>> 
>> ### Rule 2: Existing Elements in Subsequent JDK Versions
>> 
>> - If an element exists in JDK N, with an equivalent in JDK N-1, it should not include `@since N`.
>> 
>> ### Rule 3: Handling Missing `@since` Tags in methods if there is no `@since`
>> 
>> - When inspecting methods, prioritize the `@since` annotation of the supertype's overridden method.
>> - If unavailable or if the enclosing class's `@since` is newer, use the enclosing element's `@since`.
>> 
>>   I.e. if A extends B, and we add a method to B in JDK N, and add an override of the method to A in JDK M (M > N), we will use N as the effective `@since` for the method.
>
> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
> 
>   empty commit and merge

src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 7925:

> 7923:      * @since 17
> 7924:      */
> 7925:     public static MethodHandle tableSwitch(MethodHandle fallback, MethodHandle... targets) {

This method was introduced in Java 17 through https://bugs.openjdk.org/browse/JDK-8263087. So this addition of `@since 17` looks fine to me.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18055#discussion_r1625845162

From jpai at openjdk.org  Tue Jun  4 11:44:05 2024
From: jpai at openjdk.org (Jaikiran Pai)
Date: Tue, 4 Jun 2024 11:44:05 GMT
Subject: RFR: 8326951: since-checker - missing @ since tags [v9]
In-Reply-To: 
References: <_iA0CxGgaa8nA5AlNfT1IfG3Y6Wx7tcdiv3oJQNYCjQ=.5fb84060-0490-4b18-8995-cc534e1c22f5@github.com>
 
Message-ID: 

On Mon, 13 May 2024 20:39:14 GMT, Nizar Benalla  wrote:

>> I added `@since` tags for methods/constructors that do not match the `@since` of the enclosing class.
>> 
>> The `write` method already existed in `PrintStream` in earlier versions and instances of it could always call this method, since it extends `FilterOutputStream` [which has the method](https://github.com/openjdk/jdk6/blob/3e49aa876353eaa215cde71eb21acc9b7f9872a0/jdk/src/share/classes/java/io/FilterOutputStream.java#L96).
>> 
>> for `MappedByteBuffer slice()` and `MappedByteBuffer slice(int index, int length)`, the return type changed from `ByteBuffer ` to `MappedByteBuffer`. And the checker tool differentiates between them because of that.
>> 
>> This is similar to #18032 and #18373 
>> 
>> For context, I am writing tests to check for accurate use of `@since` tags in documentation comments in source code.
>> We're following these rules for now:
>> 
>> ### Rule 1: Introduction of New Elements
>> 
>> - If an element is new in JDK N, with no equivalent in JDK N-1, it must include `@since N`.
>>   - Exception: Member elements (fields, methods, nested classes) may omit `@since` if their version matches the value specified for the enclosing class or interface.
>> 
>> ### Rule 2: Existing Elements in Subsequent JDK Versions
>> 
>> - If an element exists in JDK N, with an equivalent in JDK N-1, it should not include `@since N`.
>> 
>> ### Rule 3: Handling Missing `@since` Tags in methods if there is no `@since`
>> 
>> - When inspecting methods, prioritize the `@since` annotation of the supertype's overridden method.
>> - If unavailable or if the enclosing class's `@since` is newer, use the enclosing element's `@since`.
>> 
>>   I.e. if A extends B, and we add a method to B in JDK N, and add an override of the method to A in JDK M (M > N), we will use N as the effective `@since` for the method.
>
> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
> 
>   empty commit and merge

src/java.base/share/classes/java/lang/reflect/MalformedParameterizedTypeException.java line 56:

> 54:      * @since 10
> 55:      */
> 56:     public MalformedParameterizedTypeException(String message) {

Both this and the explicit no-arg constructor were introduced in this class through https://bugs.openjdk.org/browse/JDK-8183175 in Java 10. Since an (implicit) no-arg constructor was always available even before that change, it makes sense to add a `@since 10` to only this explicit constructor. This change looks good.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18055#discussion_r1625848542

From jpai at openjdk.org  Tue Jun  4 11:53:09 2024
From: jpai at openjdk.org (Jaikiran Pai)
Date: Tue, 4 Jun 2024 11:53:09 GMT
Subject: RFR: 8326951: since-checker - missing @ since tags [v9]
In-Reply-To: 
References: <_iA0CxGgaa8nA5AlNfT1IfG3Y6Wx7tcdiv3oJQNYCjQ=.5fb84060-0490-4b18-8995-cc534e1c22f5@github.com>
 
Message-ID: <4iicrOFX4yXDID9AdiLV73BBhTU8GuFT5z3mq1g9Zn4=.7d507deb-35b4-40bc-8d47-dc8165b22730@github.com>

On Mon, 13 May 2024 20:39:14 GMT, Nizar Benalla  wrote:

>> I added `@since` tags for methods/constructors that do not match the `@since` of the enclosing class.
>> 
>> The `write` method already existed in `PrintStream` in earlier versions and instances of it could always call this method, since it extends `FilterOutputStream` [which has the method](https://github.com/openjdk/jdk6/blob/3e49aa876353eaa215cde71eb21acc9b7f9872a0/jdk/src/share/classes/java/io/FilterOutputStream.java#L96).
>> 
>> for `MappedByteBuffer slice()` and `MappedByteBuffer slice(int index, int length)`, the return type changed from `ByteBuffer ` to `MappedByteBuffer`. And the checker tool differentiates between them because of that.
>> 
>> This is similar to #18032 and #18373 
>> 
>> For context, I am writing tests to check for accurate use of `@since` tags in documentation comments in source code.
>> We're following these rules for now:
>> 
>> ### Rule 1: Introduction of New Elements
>> 
>> - If an element is new in JDK N, with no equivalent in JDK N-1, it must include `@since N`.
>>   - Exception: Member elements (fields, methods, nested classes) may omit `@since` if their version matches the value specified for the enclosing class or interface.
>> 
>> ### Rule 2: Existing Elements in Subsequent JDK Versions
>> 
>> - If an element exists in JDK N, with an equivalent in JDK N-1, it should not include `@since N`.
>> 
>> ### Rule 3: Handling Missing `@since` Tags in methods if there is no `@since`
>> 
>> - When inspecting methods, prioritize the `@since` annotation of the supertype's overridden method.
>> - If unavailable or if the enclosing class's `@since` is newer, use the enclosing element's `@since`.
>> 
>>   I.e. if A extends B, and we add a method to B in JDK N, and add an override of the method to A in JDK M (M > N), we will use N as the effective `@since` for the method.
>
> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
> 
>   empty commit and merge

src/java.base/share/classes/java/nio/MappedByteBuffer.java line 404:

> 402:      */
> 403:     @Override
> 404:     public abstract MappedByteBuffer slice();

This and the other 3 methods on which this `@since 17` is being added here were introduced in Java 17, through https://bugs.openjdk.org/browse/JDK-4833719. Before that change, these methods would have been available on this `MappedByteBuffer` through the super `ByteBuffer` class and those methods have been specified to return a `ByteBuffer`. After that change in JDK-4833719, these methods now return a `MappedByteBuffer` which is an observable change. So adding `@since 17` to these methods looks correct to me.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18055#discussion_r1625858949

From jpai at openjdk.org  Tue Jun  4 11:56:32 2024
From: jpai at openjdk.org (Jaikiran Pai)
Date: Tue, 4 Jun 2024 11:56:32 GMT
Subject: RFR: 8326951: since-checker - missing @ since tags [v9]
In-Reply-To: 
References: <_iA0CxGgaa8nA5AlNfT1IfG3Y6Wx7tcdiv3oJQNYCjQ=.5fb84060-0490-4b18-8995-cc534e1c22f5@github.com>
 
Message-ID: 

On Mon, 13 May 2024 20:39:14 GMT, Nizar Benalla  wrote:

>> I added `@since` tags for methods/constructors that do not match the `@since` of the enclosing class.
>> 
>> The `write` method already existed in `PrintStream` in earlier versions and instances of it could always call this method, since it extends `FilterOutputStream` [which has the method](https://github.com/openjdk/jdk6/blob/3e49aa876353eaa215cde71eb21acc9b7f9872a0/jdk/src/share/classes/java/io/FilterOutputStream.java#L96).
>> 
>> for `MappedByteBuffer slice()` and `MappedByteBuffer slice(int index, int length)`, the return type changed from `ByteBuffer ` to `MappedByteBuffer`. And the checker tool differentiates between them because of that.
>> 
>> This is similar to #18032 and #18373 
>> 
>> For context, I am writing tests to check for accurate use of `@since` tags in documentation comments in source code.
>> We're following these rules for now:
>> 
>> ### Rule 1: Introduction of New Elements
>> 
>> - If an element is new in JDK N, with no equivalent in JDK N-1, it must include `@since N`.
>>   - Exception: Member elements (fields, methods, nested classes) may omit `@since` if their version matches the value specified for the enclosing class or interface.
>> 
>> ### Rule 2: Existing Elements in Subsequent JDK Versions
>> 
>> - If an element exists in JDK N, with an equivalent in JDK N-1, it should not include `@since N`.
>> 
>> ### Rule 3: Handling Missing `@since` Tags in methods if there is no `@since`
>> 
>> - When inspecting methods, prioritize the `@since` annotation of the supertype's overridden method.
>> - If unavailable or if the enclosing class's `@since` is newer, use the enclosing element's `@since`.
>> 
>>   I.e. if A extends B, and we add a method to B in JDK N, and add an override of the method to A in JDK M (M > N), we will use N as the effective `@since` for the method.
>
> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
> 
>   empty commit and merge

src/java.base/share/classes/java/util/Properties.java line 190:

> 188:      * @since 10
> 189:      */
> 190:     public Properties(int initialCapacity) {

This constructor was introduced in Java 10 through https://bugs.openjdk.org/browse/JDK-8189319, so adding `@since 10` here looks correct to me.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18055#discussion_r1625864049

From jpai at openjdk.org  Tue Jun  4 12:02:10 2024
From: jpai at openjdk.org (Jaikiran Pai)
Date: Tue, 4 Jun 2024 12:02:10 GMT
Subject: RFR: 8326951: since-checker - missing @ since tags [v9]
In-Reply-To: 
References: <_iA0CxGgaa8nA5AlNfT1IfG3Y6Wx7tcdiv3oJQNYCjQ=.5fb84060-0490-4b18-8995-cc534e1c22f5@github.com>
 
Message-ID: 

On Mon, 13 May 2024 20:39:14 GMT, Nizar Benalla  wrote:

>> I added `@since` tags for methods/constructors that do not match the `@since` of the enclosing class.
>> 
>> The `write` method already existed in `PrintStream` in earlier versions and instances of it could always call this method, since it extends `FilterOutputStream` [which has the method](https://github.com/openjdk/jdk6/blob/3e49aa876353eaa215cde71eb21acc9b7f9872a0/jdk/src/share/classes/java/io/FilterOutputStream.java#L96).
>> 
>> for `MappedByteBuffer slice()` and `MappedByteBuffer slice(int index, int length)`, the return type changed from `ByteBuffer ` to `MappedByteBuffer`. And the checker tool differentiates between them because of that.
>> 
>> This is similar to #18032 and #18373 
>> 
>> For context, I am writing tests to check for accurate use of `@since` tags in documentation comments in source code.
>> We're following these rules for now:
>> 
>> ### Rule 1: Introduction of New Elements
>> 
>> - If an element is new in JDK N, with no equivalent in JDK N-1, it must include `@since N`.
>>   - Exception: Member elements (fields, methods, nested classes) may omit `@since` if their version matches the value specified for the enclosing class or interface.
>> 
>> ### Rule 2: Existing Elements in Subsequent JDK Versions
>> 
>> - If an element exists in JDK N, with an equivalent in JDK N-1, it should not include `@since N`.
>> 
>> ### Rule 3: Handling Missing `@since` Tags in methods if there is no `@since`
>> 
>> - When inspecting methods, prioritize the `@since` annotation of the supertype's overridden method.
>> - If unavailable or if the enclosing class's `@since` is newer, use the enclosing element's `@since`.
>> 
>>   I.e. if A extends B, and we add a method to B in JDK N, and add an override of the method to A in JDK M (M > N), we will use N as the effective `@since` for the method.
>
> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
> 
>   empty commit and merge

src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java line 513:

> 511:      */
> 512:     @Override
> 513:     public float nextFloat(float bound) {

These 2 `nextFloat(...)` methods which take parameters were introduced in Java 17 https://bugs.openjdk.org/browse/JDK-8248862, whereas the no-arg `nextFloat()` method existed prior to that. So adding `@since 17` to these 2 methods looks correct to me.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18055#discussion_r1625871382

From jpai at openjdk.org  Tue Jun  4 12:09:13 2024
From: jpai at openjdk.org (Jaikiran Pai)
Date: Tue, 4 Jun 2024 12:09:13 GMT
Subject: RFR: 8326951: since-checker - missing @ since tags [v9]
In-Reply-To: 
References: <_iA0CxGgaa8nA5AlNfT1IfG3Y6Wx7tcdiv3oJQNYCjQ=.5fb84060-0490-4b18-8995-cc534e1c22f5@github.com>
 
Message-ID: <3BU-FyIAlIKRp6fuWFZ1RLtiNk4Jqn1PzvpXBnUH8GI=.2b2a55d1-6db9-4e15-9411-c0b2c36d8552@github.com>

On Mon, 13 May 2024 20:39:14 GMT, Nizar Benalla  wrote:

>> I added `@since` tags for methods/constructors that do not match the `@since` of the enclosing class.
>> 
>> The `write` method already existed in `PrintStream` in earlier versions and instances of it could always call this method, since it extends `FilterOutputStream` [which has the method](https://github.com/openjdk/jdk6/blob/3e49aa876353eaa215cde71eb21acc9b7f9872a0/jdk/src/share/classes/java/io/FilterOutputStream.java#L96).
>> 
>> for `MappedByteBuffer slice()` and `MappedByteBuffer slice(int index, int length)`, the return type changed from `ByteBuffer ` to `MappedByteBuffer`. And the checker tool differentiates between them because of that.
>> 
>> This is similar to #18032 and #18373 
>> 
>> For context, I am writing tests to check for accurate use of `@since` tags in documentation comments in source code.
>> We're following these rules for now:
>> 
>> ### Rule 1: Introduction of New Elements
>> 
>> - If an element is new in JDK N, with no equivalent in JDK N-1, it must include `@since N`.
>>   - Exception: Member elements (fields, methods, nested classes) may omit `@since` if their version matches the value specified for the enclosing class or interface.
>> 
>> ### Rule 2: Existing Elements in Subsequent JDK Versions
>> 
>> - If an element exists in JDK N, with an equivalent in JDK N-1, it should not include `@since N`.
>> 
>> ### Rule 3: Handling Missing `@since` Tags in methods if there is no `@since`
>> 
>> - When inspecting methods, prioritize the `@since` annotation of the supertype's overridden method.
>> - If unavailable or if the enclosing class's `@since` is newer, use the enclosing element's `@since`.
>> 
>>   I.e. if A extends B, and we add a method to B in JDK N, and add an override of the method to A in JDK M (M > N), we will use N as the effective `@since` for the method.
>
> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
> 
>   empty commit and merge

These changes look good to me. Thank you Nizar for the work on the `@since` checker and these PRs in individual areas.

src/java.base/share/classes/java/util/zip/Deflater.java line 342:

> 340:      * @since 11
> 341:      */
> 342:     public void setDictionary(ByteBuffer dictionary) {

This method was introduced in Java 11 through https://bugs.openjdk.org/browse/JDK-6341887. It appears to be an oversight that a `@since 11` wasn't added to this method in that change, because other new methods introduced in that change did come with a `@since 11`. So this addition of `@since 11` now looks fine to me.

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

Marked as reviewed by jpai (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/18055#pullrequestreview-2096192264
PR Review Comment: https://git.openjdk.org/jdk/pull/18055#discussion_r1625879138

From liach at openjdk.org  Tue Jun  4 12:17:03 2024
From: liach at openjdk.org (Chen Liang)
Date: Tue, 4 Jun 2024 12:17:03 GMT
Subject: RFR: 8333396: Performance regression of DecimalFormat.format [v4]
In-Reply-To: 
References: 
 
Message-ID: <9b1t-nvBzroL2HmUPp287t-GaRiYO1AtrriSX87ktnE=.2ff3c363-a1d9-4841-8e02-c0d667153a7a@github.com>

On Tue, 4 Jun 2024 09:07:44 GMT, lingjun-cg  wrote:

>> ### Performance regression of DecimalFormat.format
>> From the output of perf, we can see the hottest regions contain atomic instructions.  But when run with JDK 11, there is no such problem. The reason is the removed biased locking.  
>> The DecimalFormat uses StringBuffer everywhere, and StringBuffer itself contains many synchronized methods.
>> So I added support for some new methods that accept StringBuilder which is lock-free.
>> 
>> ### Benchmark testcase
>> 
>> @BenchmarkMode(Mode.AverageTime)
>> @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS)
>> @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
>> @State(Scope.Thread)
>> @OutputTimeUnit(TimeUnit.NANOSECONDS)
>> public class JmhDecimalFormat {
>> 
>>     private DecimalFormat format;
>> 
>>     @Setup(Level.Trial)
>>     public void setup() {
>>         format = new DecimalFormat("#0.00000");
>>     }
>> 
>>     @Benchmark
>>     public void testNewAndFormat() throws InterruptedException {
>>         new DecimalFormat("#0.00000").format(9524234.1236457);
>>     }
>> 
>>     @Benchmark
>>     public void testNewOnly() throws InterruptedException {
>>         new DecimalFormat("#0.00000");
>>     }
>> 
>>     @Benchmark
>>     public void testFormatOnly() throws InterruptedException {
>>         format.format(9524234.1236457);
>>     }
>> }
>> 
>> 
>> ### Test result
>> #### Current JDK before optimize
>> 
>>  Benchmark                             Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly       avgt   50  642.099 ? 1.253  ns/op
>> JmhDecimalFormat.testNewAndFormat     avgt   50  989.307 ? 3.676  ns/op
>> JmhDecimalFormat.testNewOnly          avgt   50  303.381 ? 5.252  ns/op
>> 
>> 
>> 
>> #### Current JDK after optimize
>> 
>> Benchmark                          Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly    avgt   50  351.499 ? 0.761  ns/op
>> JmhDecimalFormat.testNewAndFormat  avgt   50  615.145 ? 2.478  ns/op
>> JmhDecimalFormat.testNewOnly       avgt   50  209.874 ? 9.951  ns/op
>> 
>> 
>> ### JDK 11 
>> 
>> Benchmark                          Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly    avgt   50  364.214 ? 1.191  ns/op
>> JmhDecimalFormat.testNewAndFormat  avgt   50  658.699 ? 2.311  ns/op
>> JmhDecimalFormat.testNewOnly       avgt   50  248.300 ? 5.158  ns/op
>
> lingjun-cg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8333396: Performance regression of DecimalFormat.format

src/java.base/share/classes/java/text/NumberFormat.java line 405:

> 403:                          StringBuilder toAppendTo,
> 404:                          FieldPosition pos) {
> 405:         throw new UnsupportedOperationException("Subclasses should override this " +

NumberFormat supports user-created classes, as it is abstract and has a protected constructor. This will cause exceptions in formatting users' custom NumberFormat subclasses.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19513#discussion_r1625890872

From liach at openjdk.org  Tue Jun  4 12:21:05 2024
From: liach at openjdk.org (Chen Liang)
Date: Tue, 4 Jun 2024 12:21:05 GMT
Subject: RFR: 8333396: Performance regression of DecimalFormat.format [v4]
In-Reply-To: 
References: 
 
Message-ID: 

On Tue, 4 Jun 2024 09:07:44 GMT, lingjun-cg  wrote:

>> ### Performance regression of DecimalFormat.format
>> From the output of perf, we can see the hottest regions contain atomic instructions.  But when run with JDK 11, there is no such problem. The reason is the removed biased locking.  
>> The DecimalFormat uses StringBuffer everywhere, and StringBuffer itself contains many synchronized methods.
>> So I added support for some new methods that accept StringBuilder which is lock-free.
>> 
>> ### Benchmark testcase
>> 
>> @BenchmarkMode(Mode.AverageTime)
>> @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS)
>> @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
>> @State(Scope.Thread)
>> @OutputTimeUnit(TimeUnit.NANOSECONDS)
>> public class JmhDecimalFormat {
>> 
>>     private DecimalFormat format;
>> 
>>     @Setup(Level.Trial)
>>     public void setup() {
>>         format = new DecimalFormat("#0.00000");
>>     }
>> 
>>     @Benchmark
>>     public void testNewAndFormat() throws InterruptedException {
>>         new DecimalFormat("#0.00000").format(9524234.1236457);
>>     }
>> 
>>     @Benchmark
>>     public void testNewOnly() throws InterruptedException {
>>         new DecimalFormat("#0.00000");
>>     }
>> 
>>     @Benchmark
>>     public void testFormatOnly() throws InterruptedException {
>>         format.format(9524234.1236457);
>>     }
>> }
>> 
>> 
>> ### Test result
>> #### Current JDK before optimize
>> 
>>  Benchmark                             Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly       avgt   50  642.099 ? 1.253  ns/op
>> JmhDecimalFormat.testNewAndFormat     avgt   50  989.307 ? 3.676  ns/op
>> JmhDecimalFormat.testNewOnly          avgt   50  303.381 ? 5.252  ns/op
>> 
>> 
>> 
>> #### Current JDK after optimize
>> 
>> Benchmark                          Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly    avgt   50  351.499 ? 0.761  ns/op
>> JmhDecimalFormat.testNewAndFormat  avgt   50  615.145 ? 2.478  ns/op
>> JmhDecimalFormat.testNewOnly       avgt   50  209.874 ? 9.951  ns/op
>> 
>> 
>> ### JDK 11 
>> 
>> Benchmark                          Mode  Cnt    Score   Error  Units
>> JmhDecimalFormat.testFormatOnly    avgt   50  364.214 ? 1.191  ns/op
>> JmhDecimalFormat.testNewAndFormat  avgt   50  658.699 ? 2.311  ns/op
>> JmhDecimalFormat.testNewOnly       avgt   50  248.300 ? 5.158  ns/op
>
> lingjun-cg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8333396: Performance regression of DecimalFormat.format

src/java.base/share/classes/java/text/NumberFormat.java line 350:

> 348:             return result;
> 349: 
> 350:         return format(number, new StringBuffer(),

Instead of just calling the package-private method that cannot be implemented by user subclasses, we can probably add a package-private method like `boolean isInternalSubclass` to decide if we should call the Buffer or Builder version.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19513#discussion_r1625900669

From liach at openjdk.org  Tue Jun  4 12:23:15 2024
From: liach at openjdk.org (Chen Liang)
Date: Tue, 4 Jun 2024 12:23:15 GMT
Subject: RFR: 8333462: Performance regression of new DecimalFormat() when
 compare to jdk11
In-Reply-To: 
References: 
Message-ID: 

On Tue, 4 Jun 2024 02:32:28 GMT, lingjun-cg  wrote:

> Run the below benchmark test  ,it show the average time of new DecimalFormat()  increase 18% when compare to jdk 11.
> 
> the result with jdk 11:
> 
> Benchmark                          Mode  Cnt    Score   Error  Units
> JmhDecimalFormat.testNewOnly       avgt   50  248.300 ? 5.158  ns/op
> 
> 
> the result with current jdk:
> 
> Benchmark                          Mode  Cnt    Score   Error  Units
> JmhDecimalFormat.testNewOnly       avgt   50  303.381 ? 5.252  ns/op
> 
> 
> 
> @BenchmarkMode(Mode.AverageTime)
> @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS)
> @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
> @State(Scope.Thread)
> @OutputTimeUnit(TimeUnit.NANOSECONDS)
> public class JmhDecimalFormat {
> 
>     @Setup(Level.Trial)
>     public void setup() {
>     }
> 
>     @Benchmark
>     public void testNewOnly() throws InterruptedException {
>         new DecimalFormat("#0.00000");
>     }
> }
> 
> 
> Compare the flame graph it shows the java.text.DecimalFormatSymbols#findNonFormatChar takes a significant time. 
> After replacing  the lambda implementation with a simple loop , it shows nearly the same performance as jdk 11.
> 
> 
> Benchmark                          Mode  Cnt    Score   Error  Units
> JmhDecimalFormat.testNewOnly       avgt   50  209.874 ? 9.951  ns/op
> 
> 
> [flame-graph-jdk11-jdk21.zip](https://github.com/user-attachments/files/15541764/flame-graph-jdk11-jdk21.zip)

Marked as reviewed by liach (Author).

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

PR Review: https://git.openjdk.org/jdk/pull/19534#pullrequestreview-2096229334

From asemenyuk at openjdk.org  Tue Jun  4 12:36:34 2024
From: asemenyuk at openjdk.org (Alexey Semenyuk)
Date: Tue, 4 Jun 2024 12:36:34 GMT
Subject: RFR: 8319457: Update jpackage to support WiX Toolset 4 on Windows
In-Reply-To: 
References: 
 
Message-ID: 

On Tue, 4 Jun 2024 02:41:29 GMT, Alexander Matveev  wrote:

>> Add support for WiX4 (and WiX5) in jpackage.
>> 
>> jpackage supports WiX3, WiX4 and WiX5. It will pick WiX4/WiX5 if one of them is installed and there is WiX3 installed too. (Note: WiX4 and WiX5 are not supposed to be installed side-by-side, but if it happens, WiX5 will be preferred over WiX4).
>> 
>> Custom WiX3 sources will be automatically converted to WiX4 format if WiX4/WiX5 is used. The converter provides:
>> 
>> - full support of the conversion of WiX L10N (.wxl) files, i.e. full support of "http://schemas.microsoft.com/wix/2006/localization" to "http://wixtoolset.org/schemas/v4/wxl" namespace conversion;
>> - partial support of WiX source (.wxs) files, i.e. partial support of "http://schemas.microsoft.com/wix/2006/wi" to "http://wixtoolset.org/schemas/v4/wxs" namespace conversion;
>> 
>> The converter is a XSLT stylesheet. The default converter is `src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/wix3-to-wix4-conv.xsl`. It can be replaced with the custom converter by adding "wix-conv.xsl" file to the resource directory.
>
> src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixTool.java line 51:
> 
>> 49:     Candle3("candle", DottedVersion.lazy("3.0")),
>> 50:     Light3("light", DottedVersion.lazy("3.0")),
>> 51:     Wix4("wix", DottedVersion.lazy("4.0.4"));
> 
> Is there any reason to use "4.0.4" here? Latest released version is "4.0.5". Can we just put "4.0" similar to "3.0".

WiX4 prior v4.0.4 has a security vulnerability - https://www.tenable.com/plugins/nessus/190557
So v4.0.4 is the minimal WiX4 version jpackage will support.

As for WiX3, I don't think we should alter the minimal supported version due to backward compatibility.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19318#discussion_r1625923156

From asemenyuk at openjdk.org  Tue Jun  4 12:41:03 2024
From: asemenyuk at openjdk.org (Alexey Semenyuk)
Date: Tue, 4 Jun 2024 12:41:03 GMT
Subject: RFR: 8319457: Update jpackage to support WiX Toolset 4 on Windows
In-Reply-To: 
References: 
 
 
 
Message-ID: 

On Tue, 4 Jun 2024 02:38:51 GMT, Alexander Matveev  wrote:

> I assume WiX5 will just work if installed instead of WiX4?

Correct.

> Do you think it will make sense to introduce Wix5 ToolsetType in case if we need to do something different between 4 and 5?

They claim WiX5 is backward compatible with WiX4, i.e. WiX4 code should work with WiX5 toolkit. So I don't see a reason to introduce Wix5 ToolsetType now.

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

PR Comment: https://git.openjdk.org/jdk/pull/19318#issuecomment-2147430144

From asemenyuk at openjdk.org  Tue Jun  4 12:45:11 2024
From: asemenyuk at openjdk.org (Alexey Semenyuk)
Date: Tue, 4 Jun 2024 12:45:11 GMT
Subject: RFR: 8331977: Crash: SIGSEGV in dlerror()
In-Reply-To: 
References: 
Message-ID: 

On Fri, 31 May 2024 14:05:07 GMT, Alexey Semenyuk  wrote:

> Fix MainClassTest class to use HelloApp.AppOutputVerifier class to run app launcher instead of raw Executor. This makes MainClassTest test run app launchers with retries. This change addresses the primary issue.
> 
> Fix inconsistencies in HelloApp.AppOutputVerifier class. It used to provide API allowing to run launchers without retries. It inconsistently allowed the execution of launchers with suppressed output (stdout and stderr). It inconsistently executed launchers with/without PATH removed from the environment.
> 
> These loopholes were eliminated:
> 
>  - stdout and stderr of app launchers is never suppressed;
>  - PATH env variable is always deleted for app launchers on Windows. It is not deleted on other platforms. This change sets the correct scope of [JDK-8254920](https://bugs.openjdk.org/browse/JDK-8254920) fix that introduced the removal of PATH env variable for app launchers;
>  - app launchers are always executed with retries unless the launcher is executed with `jpackage.test.noexit` system property set to `true` indicating the test app will not terminate on its own.
> 
> Other changes are due to changes in HelloApp.AppOutputVerifier class.

There is [JDK-8263466](https://bugs.openjdk.org/browse/JDK-8263466) with the same symptoms to be investigated. It is linked to this bug.

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

PR Comment: https://git.openjdk.org/jdk/pull/19502#issuecomment-2147440644

From alanb at openjdk.org  Tue Jun  4 12:51:20 2024
From: alanb at openjdk.org (Alan Bateman)
Date: Tue, 4 Jun 2024 12:51:20 GMT
Subject: RFR: 8329581: Java launcher no longer prints a stack trace [v10]
In-Reply-To: <-UOwxqkVlfuaUcyTRnAWx76pUzUHyHV-oBUC4HBP8HA=.df291aa8-2c4e-4771-a68a-a31b91ae8d8b@github.com>
References: 
 
 <-UOwxqkVlfuaUcyTRnAWx76pUzUHyHV-oBUC4HBP8HA=.df291aa8-2c4e-4771-a68a-a31b91ae8d8b@github.com>
Message-ID: 

On Fri, 31 May 2024 14:34:16 GMT, Sonia Zaldana Calles  wrote:

> Hi all,
> 
> I think there's some consensus that we need some follow up cleanup issues for the JNI spec, renaming constants, fixing return codes, etc.
> 
> Seeing how that grows the scope of the issue quite a bit, I'd like to push this patch and track the other issues brought up separately.
> 
> If there are no objections about the current state, I'd like to integrate some time next week. Let me know your thoughts.
> 
> cc: @jaikiran, @AlanBateman

Okay. The follow-on issue can remove CHECK_EXCEPTION_NULL_FAIL introduced by this PR or replace it with something simple that just checks if the ID is null.

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

PR Comment: https://git.openjdk.org/jdk/pull/18786#issuecomment-2147452633

From duke at openjdk.org  Tue Jun  4 12:53:06 2024
From: duke at openjdk.org (jengebr)
Date: Tue, 4 Jun 2024 12:53:06 GMT
Subject: RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations
In-Reply-To: <96SNKGdvRhf20ArPe4-IdcXkhzvKDnwQ7W1VlXX689I=.78e6fc24-980e-42e4-aa67-090968a5b215@github.com>
References: 
 <96SNKGdvRhf20ArPe4-IdcXkhzvKDnwQ7W1VlXX689I=.78e6fc24-980e-42e4-aa67-090968a5b215@github.com>
Message-ID: 

On Mon, 3 Jun 2024 18:48:48 GMT, Doug Lea 
wrote: > The jmh benchmark checks only the empty case, you need to also show lack of impact on non-empty cases. After removing `toArray`, I think this is covered. Can you please confirm? > Assuming you demonstrate this, it seems basically OK, (Deja vu previous cases including hash maps). It is only a small band-aid -- programs generating lots of them still have to allocate the COWAL object, so the savings are small compared to not generating them at all unless needed. The motivation for this change is an app that retains 23K instances of CopyOnWriteArrayList, 22K of which have zero items. The 22K instances each have their own copy of an Object[0]. This change eliminates 343KB of retained memory and 22K objects. I had initially modified `toArray()` for the sake of completeness but don't directly benefit from it, so I'm willing to drop that to remain within spec. FWIW the issue arises inside `org.jboss.resteasy` so the benefit is broad, albeit shallow. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19527#issuecomment-2147454256 From asemenyuk at openjdk.org Tue Jun 4 12:53:12 2024 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Tue, 4 Jun 2024 12:53:12 GMT Subject: RFR: 8331977: Crash: SIGSEGV in dlerror() In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 06:43:12 GMT, Alan Bateman wrote: > If I read JDK-8269403 correctly then there is an issue somewhere that hasn't been diagnosed. Correct. > A workaround has been put in to "re-run" when there is a crash, thus hiding the issue. Correct. > Are there follow-up issues created in JBS to continue the hunt for the original crash? The issue was first reported in [JDK-8263466](https://bugs.openjdk.org/browse/JDK-8263466). It was "fixed" by rerunning the launcher. The fix didn't cover all the scenarios of launcher executions in jpackage tests. One of these uncovered scenarios caused the issue of this PR. We already have [JDK-8263466](https://bugs.openjdk.org/browse/JDK-8263466) to find the original crash. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19502#issuecomment-2147454916 From syan at openjdk.org Tue Jun 4 12:58:11 2024 From: syan at openjdk.org (SendaoYan) Date: Tue, 4 Jun 2024 12:58:11 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 07:47:46 GMT, SendaoYan wrote: > Hi all, > This PR several extra empty spaces and extra empty lines in several Makefiles. It's trivial fix, no risk. > > Thanks. > /label build Thanks. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19537#issuecomment-2147467980 From alanb at openjdk.org Tue Jun 4 12:58:15 2024 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 4 Jun 2024 12:58:15 GMT Subject: RFR: 8331977: Crash: SIGSEGV in dlerror() In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 12:49:18 GMT, Alexey Semenyuk wrote: > We already have [JDK-8263466](https://bugs.openjdk.org/browse/JDK-8263466) to find the original crash. Thanks, just making sure the issue that there is an issue tracking it as it's a bit unsettling that a re-run may be hiding something serious ------------- PR Comment: https://git.openjdk.org/jdk/pull/19502#issuecomment-2147467566 From erikj at openjdk.org Tue Jun 4 13:01:12 2024 From: erikj at openjdk.org (Erik Joelsson) Date: Tue, 4 Jun 2024 13:01:12 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles In-Reply-To: References: Message-ID: <-zitWvnM2OMNoksPkobR-GY7ydETAQyBLwcrdcoiLWE=.c1e182c2-7b34-43e9-a96f-e3bf1b367f8f@github.com> On Tue, 4 Jun 2024 07:47:46 GMT, SendaoYan wrote: > Hi all, > This PR several extra empty spaces and extra empty lines in several Makefiles. It's trivial fix, no risk. > > Thanks. Marked as reviewed by erikj (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/19537#pullrequestreview-2096319123 From jpai at openjdk.org Tue Jun 4 13:02:16 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Tue, 4 Jun 2024 13:02:16 GMT Subject: RFR: 8329581: Java launcher no longer prints a stack trace [v10] In-Reply-To: <-UOwxqkVlfuaUcyTRnAWx76pUzUHyHV-oBUC4HBP8HA=.df291aa8-2c4e-4771-a68a-a31b91ae8d8b@github.com> References: <-UOwxqkVlfuaUcyTRnAWx76pUzUHyHV-oBUC4HBP8HA=.df291aa8-2c4e-4771-a68a-a31b91ae8d8b@github.com> Message-ID: On Fri, 31 May 2024 14:34:16 GMT, Sonia Zaldana Calles wrote: >> Sonia Zaldana Calles has updated the pull request incrementally with one additional commit since the last revision: >> >> Decreasing diff size addressing unnecessary changes > > Hi all, > > I think there's some consensus that we need some follow up cleanup issues for the JNI spec, renaming constants, fixing return codes, etc. > > Seeing how that grows the scope of the issue quite a bit, I'd like to push this patch and track the other issues brought up separately. > > If there are no objections about the current state, I'd like to integrate some time next week. Let me know your thoughts. > > cc: @jaikiran, @AlanBateman Hello Sonia @SoniaZaldana, so based on Alan's latest inputs, the next thing to do on this PR is to refresh the PR to merge it with the latest master branch changes and then run tier1, tier2 and tier3 tests to make sure they continue to pass and have this integrated soon. I'll file follow up issue(s) and also trigger CI testing of this PR. ------------- PR Comment: https://git.openjdk.org/jdk/pull/18786#issuecomment-2147476871 From vklang at openjdk.org Tue Jun 4 13:06:08 2024 From: vklang at openjdk.org (Viktor Klang) Date: Tue, 4 Jun 2024 13:06:08 GMT Subject: RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations In-Reply-To: References: Message-ID: On Mon, 3 Jun 2024 16:47:20 GMT, jengebr wrote: > Improve `java/util/concurrent/CopyOnWriteArrayList` by eliminating needless cloning of Object[0] instances. This cloning is intended to prevent callers from changing array contents, but many `CopyOnWriteArrayList`s are allocated to size zero, or are otherwise maintained empty, so cloning is unnecessary. > > Results from the included JMH benchmark: > Before: > > Benchmark Mode Cnt Score Error Units > CopyOnWriteArrayListBenchmark.clear avgt 5 74.487 ? 1.793 ns/op > CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 27.918 ? 0.759 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.656 ? 0.375 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 15.415 ? 0.489 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.608 ? 0.363 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 15.374 ? 0.260 ns/op > CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 15.688 ? 0.350 ns/op > > > After: > > Benchmark Mode Cnt Score Error Units > CopyOnWriteArrayListBenchmark.clear avgt 5 75.365 ? 2.092 ns/op > CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 20.803 ? 0.539 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.808 ? 0.582 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 12.980 ? 0.418 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.627 ? 0.173 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 12.864 ? 0.408 ns/op > CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 12.931 ? 0.255 ns/op src/java.base/share/classes/java/util/concurrent/CopyOnWriteArrayList.java line 103: > 101: private static final long serialVersionUID = 8673264195747942595L; > 102: > 103: private static final Object[] EMPTY_ELEMENTDATA = {}; Looks like readObject() ought to also be changed to use the EMPTY_ELEMENTDATA if the length of the read array is 0? And perhaps `clone()`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19527#discussion_r1625968254 From asemenyuk at openjdk.org Tue Jun 4 13:52:03 2024 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Tue, 4 Jun 2024 13:52:03 GMT Subject: RFR: 8319457: Update jpackage to support WiX Toolset 4 on Windows [v2] In-Reply-To: References: Message-ID: > Add support for WiX4 (and WiX5) in jpackage. > > jpackage supports WiX3, WiX4 and WiX5. It will pick WiX4/WiX5 if one of them is installed and there is WiX3 installed too. (Note: WiX4 and WiX5 are not supposed to be installed side-by-side, but if it happens, WiX5 will be preferred over WiX4). > > Custom WiX3 sources will be automatically converted to WiX4 format if WiX4/WiX5 is used. The converter provides: > > - full support of the conversion of WiX L10N (.wxl) files, i.e. full support of "http://schemas.microsoft.com/wix/2006/localization" to "http://wixtoolset.org/schemas/v4/wxl" namespace conversion; > - partial support of WiX source (.wxs) files, i.e. partial support of "http://schemas.microsoft.com/wix/2006/wi" to "http://wixtoolset.org/schemas/v4/wxs" namespace conversion; > > The converter is a XSLT stylesheet. The default converter is `src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/wix3-to-wix4-conv.xsl`. It can be replaced with the custom converter by adding "wix-conv.xsl" file to the resource directory. Alexey Semenyuk has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 28 commits: - EOLs restored - Merge branch 'master' into JDK-8319457 - Revert "Revert "Rollback unneeded change"" This reverts commit 5fded0b107643b20a5c517a58f611b89406aec8e. - Support the use of custom wix source converter - Ensure WiX source converter works with the default JDK XSLT processor and Saxon HE (v12.4) - Revert "Rollback unneeded change" This reverts commit 00d7cc6c102f3b2c8db84d47cc6a04aad53f74fc. - Rollback unneeded change - Merge branch 'master' into JDK-8319457 - Don't suppress jpackage output when it is detecting what packaging tools available and what bundlers are supported. - Fix issue with running jtreg tests when wix.exe is not available in the PATH. When wix.exe is not in the PATH, jpackage uses %USERPROFILE% env variable to get user home directory. But jtreg removes it from the environment when running tests, so without wix.exe in the PATH all jpackage tests will fail on Windows. This makes it impossible to test jpackage with wix3. This patch addresses this issue by reading user home additionally from "java.home" system property. - ... and 18 more: https://git.openjdk.org/jdk/compare/9686e804...99aac323 ------------- Changes: https://git.openjdk.org/jdk/pull/19318/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19318&range=01 Stats: 1471 lines in 22 files changed: 1155 ins; 92 del; 224 mod Patch: https://git.openjdk.org/jdk/pull/19318.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19318/head:pull/19318 PR: https://git.openjdk.org/jdk/pull/19318 From asemenyuk at openjdk.org Tue Jun 4 14:01:41 2024 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Tue, 4 Jun 2024 14:01:41 GMT Subject: RFR: 8319457: Update jpackage to support WiX Toolset 4 on Windows [v3] In-Reply-To: References: Message-ID: <46rNKmM6sX8QF8XEuEtbKFaQe4jylFVn8IaQtX9sX-c=.93d21c3d-02eb-4b2d-a6fe-f3441ba3d47b@github.com> > Add support for WiX4 (and WiX5) in jpackage. > > jpackage supports WiX3, WiX4 and WiX5. It will pick WiX4/WiX5 if one of them is installed and there is WiX3 installed too. (Note: WiX4 and WiX5 are not supposed to be installed side-by-side, but if it happens, WiX5 will be preferred over WiX4). > > Custom WiX3 sources will be automatically converted to WiX4 format if WiX4/WiX5 is used. The converter provides: > > - full support of the conversion of WiX L10N (.wxl) files, i.e. full support of "http://schemas.microsoft.com/wix/2006/localization" to "http://wixtoolset.org/schemas/v4/wxl" namespace conversion; > - partial support of WiX source (.wxs) files, i.e. partial support of "http://schemas.microsoft.com/wix/2006/wi" to "http://wixtoolset.org/schemas/v4/wxs" namespace conversion; > > The converter is a XSLT stylesheet. The default converter is `src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/wix3-to-wix4-conv.xsl`. It can be replaced with the custom converter by adding "wix-conv.xsl" file to the resource directory. Alexey Semenyuk has updated the pull request incrementally with one additional commit since the last revision: EOLs restored ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19318/files - new: https://git.openjdk.org/jdk/pull/19318/files/99aac323..782d121b Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19318&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19318&range=01-02 Stats: 36 lines in 2 files changed: 0 ins; 0 del; 36 mod Patch: https://git.openjdk.org/jdk/pull/19318.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19318/head:pull/19318 PR: https://git.openjdk.org/jdk/pull/19318 From asemenyuk at openjdk.org Tue Jun 4 14:01:41 2024 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Tue, 4 Jun 2024 14:01:41 GMT Subject: RFR: 8319457: Update jpackage to support WiX Toolset 4 on Windows [v3] In-Reply-To: <-o573bkx_xWBRkJS3IWGlevuqgWGL-4EyAxCexUvGUQ=.32f6db30-d90b-4be9-987b-7112349f11d4@github.com> References: <-o573bkx_xWBRkJS3IWGlevuqgWGL-4EyAxCexUvGUQ=.32f6db30-d90b-4be9-987b-7112349f11d4@github.com> Message-ID: <7gOdTXsL65PTSgWKTwmDDFUn4qvCu1DY0LIfbIyTh-k=.cd1d834e-40ed-40a4-8ca2-570554542359@github.com> On Tue, 4 Jun 2024 01:07:15 GMT, Alexander Matveev wrote: >> Alexey Semenyuk has updated the pull request incrementally with one additional commit since the last revision: >> >> EOLs restored > > src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_de.wxl line 1: > >> 1: > > MsiInstallerStrings_de(ja,zh_CA).wxl are probably saved in wrong format. Can you double check if it is intentional change? Fixed ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19318#discussion_r1626070251 From dfuchs at openjdk.org Tue Jun 4 15:17:33 2024 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Tue, 4 Jun 2024 15:17:33 GMT Subject: RFR: 8333270: HandlersOnComplexResetUpdate and HandlersOnComplexUpdate tests fail with "Unexpected reference" if timeoutFactor is less than 1/3 [v2] In-Reply-To: References: Message-ID: > HandlersOnComplexResetUpdate and HandlersOnComplexUpdate tests verify that loggers are GC'ed (or not GC'ed) after a reset or an update. For that they poll a ReferenceQueue in a loop. The number of iteration is adjusted according to the jtreg timeout factor. However, the logic in the test did not expect that the timeout might be less than 1. > > This fix does two things: > > 1. fix the adjustCount logic - so that the number of iteration can only be increased > 2. use remove(timeout) instead of poll() in order to minimize the waiting time. Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: Review feedback: use Reference::refersTo consistently ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19503/files - new: https://git.openjdk.org/jdk/pull/19503/files/be5a4d82..75576a8d Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19503&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19503&range=00-01 Stats: 5 lines in 2 files changed: 0 ins; 0 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/19503.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19503/head:pull/19503 PR: https://git.openjdk.org/jdk/pull/19503 From dfuchs at openjdk.org Tue Jun 4 15:17:33 2024 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Tue, 4 Jun 2024 15:17:33 GMT Subject: RFR: 8333270: HandlersOnComplexResetUpdate and HandlersOnComplexUpdate tests fail with "Unexpected reference" if timeoutFactor is less than 1/3 [v2] In-Reply-To: References: Message-ID: On Sat, 1 Jun 2024 05:20:24 GMT, Jaikiran Pai wrote: >> Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: >> >> Review feedback: use Reference::refersTo consistently > > test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexResetUpdate.java line 219: > >> 217: } >> 218: WeakReference barRef = new WeakReference<>(Logger.getLogger("com.bar"), queue); >> 219: if (!barRef.refersTo(barChild.getParent())) { > > Hello Daniel, since `refersTo()` is the preferred API in cases like this, should this same change be done in the other `HandlersOnComplexUpdate` test that's being updated in this PR? Good point. Updated. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19503#discussion_r1626196539 From asotona at openjdk.org Tue Jun 4 15:17:48 2024 From: asotona at openjdk.org (Adam Sotona) Date: Tue, 4 Jun 2024 15:17:48 GMT Subject: RFR: 8333086: Using Console.println is unnecessarily slow due to JLine initalization In-Reply-To: References: Message-ID: On Thu, 30 May 2024 13:50:33 GMT, Jan Lahoda wrote: > Consider these two programs: > > > public class SystemPrint { > public static void main(String... args) { > System.err.println("Hello!"); > } > } > > and: > > public class IOPrint { > public static void main(String... args) { > java.io.IO.println("Hello!"); > } > } > > > They do the same conceptual thing - write a text to the output. But, `IO.println` delegates to `Console.println`, which then delegates to a `Console` backend, and the default backend is currently based on JLine. > > The issues is that JLine takes a quite a long time to initialize, and in a program like this, JLine is not really needed - it is used to provide better editing experience when reading input, but there's no reading in these programs. > > For example, on my computer: > > $ time java -classpath /tmp SystemPrint > Hello! > > real 0m0,035s > user 0m0,019s > sys 0m0,019s > > $ time java -classpath /tmp --enable-preview IOPrint > Hello! > > real 0m0,165s > user 0m0,324s > sys 0m0,042s > > > The proposal herein is to delegate to the simpler `Console` backend from `java.base` as long as the user only uses methods that print to output, and switch to the JLine delegate when other methods (typically input) is used. Note that while technically `writer()` is a method doing output, it will force JLine initialization to avoid possible problems if the client caches the writer and uses it after switching the delegates. > > With this patch, I can get timing like this: > > $ time java --enable-preview -classpath /tmp/ IOPrint > Hello! > > real 0m0,051s > user 0m0,038s > sys 0m0,020s > > > which seems much more acceptable. > > There is also #19467, which may reduce the time further. > > A future work might focus on making JLine initialize faster, but avoiding JLine initialization in case where we don't need it seems like a good step to me in any case. It looks like a legit performance trick. ------------- Marked as reviewed by asotona (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19479#pullrequestreview-2096720909 From asemenyuk at openjdk.org Tue Jun 4 16:07:18 2024 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Tue, 4 Jun 2024 16:07:18 GMT Subject: RFR: 8319457: Update jpackage to support WiX Toolset 4 on Windows [v4] In-Reply-To: References: Message-ID: > Add support for WiX4 (and WiX5) in jpackage. > > jpackage supports WiX3, WiX4 and WiX5. It will pick WiX4/WiX5 if one of them is installed and there is WiX3 installed too. (Note: WiX4 and WiX5 are not supposed to be installed side-by-side, but if it happens, WiX5 will be preferred over WiX4). > > Custom WiX3 sources will be automatically converted to WiX4 format if WiX4/WiX5 is used. The converter provides: > > - full support of the conversion of WiX L10N (.wxl) files, i.e. full support of "http://schemas.microsoft.com/wix/2006/localization" to "http://wixtoolset.org/schemas/v4/wxl" namespace conversion; > - partial support of WiX source (.wxs) files, i.e. partial support of "http://schemas.microsoft.com/wix/2006/wi" to "http://wixtoolset.org/schemas/v4/wxs" namespace conversion; > > The converter is a XSLT stylesheet. The default converter is `src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/wix3-to-wix4-conv.xsl`. It can be replaced with the custom converter by adding "wix-conv.xsl" file to the resource directory. Alexey Semenyuk has updated the pull request incrementally with two additional commits since the last revision: - WixSourceConverter#applyTo should do what OverridableResource#saveToFile() does: create parent directory and replace output file if it exists. - Fix issue with overwriting custom l10n file in the resource directory. All WiX source files from the resource directory should be copied to jpackage work directory before running wxi tools. jpackage should not change files in the resource directory. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19318/files - new: https://git.openjdk.org/jdk/pull/19318/files/782d121b..af8fb680 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19318&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19318&range=02-03 Stats: 11 lines in 3 files changed: 7 ins; 0 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/19318.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19318/head:pull/19318 PR: https://git.openjdk.org/jdk/pull/19318 From chagedorn at openjdk.org Tue Jun 4 16:11:03 2024 From: chagedorn at openjdk.org (Christian Hagedorn) Date: Tue, 4 Jun 2024 16:11:03 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 07:47:46 GMT, SendaoYan wrote: > Hi all, > This PR several extra empty spaces and extra empty lines in several Makefiles. It's trivial fix, no risk. > > Thanks. Looks good! Somehow the integrate command did not work. ------------- Marked as reviewed by chagedorn (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19537#pullrequestreview-2096615859 From syan at openjdk.org Tue Jun 4 16:11:05 2024 From: syan at openjdk.org (SendaoYan) Date: Tue, 4 Jun 2024 16:11:05 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 07:47:46 GMT, SendaoYan wrote: > Hi all, > This PR several extra empty spaces and extra empty lines in several Makefiles. It's trivial fix, no risk. > > Thanks. Thanks for the review. Thanks all for the review. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19537#issuecomment-2147523325 PR Comment: https://git.openjdk.org/jdk/pull/19537#issuecomment-2147711173 From szaldana at openjdk.org Tue Jun 4 16:17:36 2024 From: szaldana at openjdk.org (Sonia Zaldana Calles) Date: Tue, 4 Jun 2024 16:17:36 GMT Subject: RFR: 8329581: Java launcher no longer prints a stack trace [v11] In-Reply-To: References: Message-ID: > Hi folks, > > This PR aims to fix [JDK-8329581](https://bugs.openjdk.org/browse/JDK-8329581). > > I think the regression got introduced in [JDK-8315458](https://bugs.openjdk.org/browse/JDK-8315458). > > In the issue linked above, [LauncherHelper#getMainType](https://github.com/openjdk/jdk/pull/16461/files#diff-108a3a3e3c2d108c8c7f19ea498f641413b7c9239ecd2975a6c27d904c2ba226) got removed to simplify launcher code. > > Previously, we used ```getMainType``` to do the appropriate main method invocation in ```JavaMain```. However, we currently attempt to do all types of main method invocations at the same time [here](https://github.com/openjdk/jdk/blob/master/src/java.base/share/native/libjli/java.c#L623). > > Note how all of these invocations clear the exception reported with [CHECK_EXCEPTION_FAIL](https://github.com/openjdk/jdk/blob/140f56718bbbfc31bb0c39255c68568fad285a1f/src/java.base/share/native/libjli/java.c#L390). > > Therefore, if a legitimate exception comes up during one of these invocations, it does not get reported. > > I propose reintroducing ```LauncherHelper#getMainType``` but I'm looking forward to your suggestions. > > Cheers, > Sonia Sonia Zaldana Calles has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 14 additional commits since the last revision: - Merge branch 'openjdk:master' into JDK-8329581 - Decreasing diff size addressing unnecessary changes - Fixing indentation Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com> - Fixing broken uncaught exception mechanism - Make deleting file OS agnostic - Adding test case - Removing long lines - Using new macro to avoid reporting JNI error - Changes based on feedback - Fixing space formatting - ... and 4 more: https://git.openjdk.org/jdk/compare/d654de0c...12fe416c ------------- Changes: - all: https://git.openjdk.org/jdk/pull/18786/files - new: https://git.openjdk.org/jdk/pull/18786/files/1a0c76f2..12fe416c Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=18786&range=10 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=18786&range=09-10 Stats: 582850 lines in 7246 files changed: 146903 ins; 86361 del; 349586 mod Patch: https://git.openjdk.org/jdk/pull/18786.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/18786/head:pull/18786 PR: https://git.openjdk.org/jdk/pull/18786 From stuefe at openjdk.org Tue Jun 4 16:17:37 2024 From: stuefe at openjdk.org (Thomas Stuefe) Date: Tue, 4 Jun 2024 16:17:37 GMT Subject: RFR: 8329581: Java launcher no longer prints a stack trace [v11] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 13:34:30 GMT, Sonia Zaldana Calles wrote: >> Hi folks, >> >> This PR aims to fix [JDK-8329581](https://bugs.openjdk.org/browse/JDK-8329581). >> >> I think the regression got introduced in [JDK-8315458](https://bugs.openjdk.org/browse/JDK-8315458). >> >> In the issue linked above, [LauncherHelper#getMainType](https://github.com/openjdk/jdk/pull/16461/files#diff-108a3a3e3c2d108c8c7f19ea498f641413b7c9239ecd2975a6c27d904c2ba226) got removed to simplify launcher code. >> >> Previously, we used ```getMainType``` to do the appropriate main method invocation in ```JavaMain```. However, we currently attempt to do all types of main method invocations at the same time [here](https://github.com/openjdk/jdk/blob/master/src/java.base/share/native/libjli/java.c#L623). >> >> Note how all of these invocations clear the exception reported with [CHECK_EXCEPTION_FAIL](https://github.com/openjdk/jdk/blob/140f56718bbbfc31bb0c39255c68568fad285a1f/src/java.base/share/native/libjli/java.c#L390). >> >> Therefore, if a legitimate exception comes up during one of these invocations, it does not get reported. >> >> I propose reintroducing ```LauncherHelper#getMainType``` but I'm looking forward to your suggestions. >> >> Cheers, >> Sonia > > Sonia Zaldana Calles has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 14 additional commits since the last revision: > > - Merge branch 'openjdk:master' into JDK-8329581 > - Decreasing diff size addressing unnecessary changes > - Fixing indentation > > Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com> > - Fixing broken uncaught exception mechanism > - Make deleting file OS agnostic > - Adding test case > - Removing long lines > - Using new macro to avoid reporting JNI error > - Changes based on feedback > - Fixing space formatting > - ... and 4 more: https://git.openjdk.org/jdk/compare/d654de0c...12fe416c Latest version is still good. ------------- Marked as reviewed by stuefe (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/18786#pullrequestreview-2096358502 From alanb at openjdk.org Tue Jun 4 16:17:45 2024 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 4 Jun 2024 16:17:45 GMT Subject: RFR: 8329581: Java launcher no longer prints a stack trace [v10] In-Reply-To: References: <-UOwxqkVlfuaUcyTRnAWx76pUzUHyHV-oBUC4HBP8HA=.df291aa8-2c4e-4771-a68a-a31b91ae8d8b@github.com> Message-ID: On Tue, 4 Jun 2024 13:17:11 GMT, Thomas Stuefe wrote: > Curious, why tier 1 to 3 specifically? Is there anything specific in tier 3 you want to have tested? I think just prudent to run more tests when touching the launcher as it has options that aren't tested much in tier1. Shouldn't be an issue here but thinking of the splash screen tests (jdk_desktop test group), and tests for Java agents. Also jlink and jpackage can be useful when testing changes to the launcher. ------------- PR Comment: https://git.openjdk.org/jdk/pull/18786#issuecomment-2147552797 From alanb at openjdk.org Tue Jun 4 16:17:41 2024 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 4 Jun 2024 16:17:41 GMT Subject: RFR: 8329581: Java launcher no longer prints a stack trace [v10] In-Reply-To: References: <-UOwxqkVlfuaUcyTRnAWx76pUzUHyHV-oBUC4HBP8HA=.df291aa8-2c4e-4771-a68a-a31b91ae8d8b@github.com> Message-ID: On Tue, 4 Jun 2024 12:59:54 GMT, Jaikiran Pai wrote: > I'll file follow up issue(s) and also trigger CI testing of this PR. Thanks, the regressions fixed here are important to fix. It's unfortunate there the original changes weren't changes weren't caught by tests. There is a good test coverage added here but I think we'll need to see if there are other testing gaps. ------------- PR Comment: https://git.openjdk.org/jdk/pull/18786#issuecomment-2147492466 From stuefe at openjdk.org Tue Jun 4 16:17:45 2024 From: stuefe at openjdk.org (Thomas Stuefe) Date: Tue, 4 Jun 2024 16:17:45 GMT Subject: RFR: 8329581: Java launcher no longer prints a stack trace [v10] In-Reply-To: <-UOwxqkVlfuaUcyTRnAWx76pUzUHyHV-oBUC4HBP8HA=.df291aa8-2c4e-4771-a68a-a31b91ae8d8b@github.com> References: <-UOwxqkVlfuaUcyTRnAWx76pUzUHyHV-oBUC4HBP8HA=.df291aa8-2c4e-4771-a68a-a31b91ae8d8b@github.com> Message-ID: On Fri, 31 May 2024 14:34:16 GMT, Sonia Zaldana Calles wrote: >> Sonia Zaldana Calles has updated the pull request incrementally with one additional commit since the last revision: >> >> Decreasing diff size addressing unnecessary changes > > Hi all, > > I think there's some consensus that we need some follow up cleanup issues for the JNI spec, renaming constants, fixing return codes, etc. > > Seeing how that grows the scope of the issue quite a bit, I'd like to push this patch and track the other issues brought up separately. > > If there are no objections about the current state, I'd like to integrate some time next week. Let me know your thoughts. > > cc: @jaikiran, @AlanBateman > Hello Sonia @SoniaZaldana, so based on Alan's latest inputs, the next thing to do on this PR is to refresh the PR to merge it with the latest master branch changes and then run tier1, tier2 and tier3 tests to make sure they continue to pass and have this integrated soon. Curious, why tier 1 to 3 specifically? Is there anything specific in tier 3 you want to have tested? ------------- PR Comment: https://git.openjdk.org/jdk/pull/18786#issuecomment-2147514185 From nbenalla at openjdk.org Tue Jun 4 16:17:54 2024 From: nbenalla at openjdk.org (Nizar Benalla) Date: Tue, 4 Jun 2024 16:17:54 GMT Subject: RFR: 8326951: since-checker - missing @ since tags [v9] In-Reply-To: References: <_iA0CxGgaa8nA5AlNfT1IfG3Y6Wx7tcdiv3oJQNYCjQ=.5fb84060-0490-4b18-8995-cc534e1c22f5@github.com> Message-ID: <9rwcxCtDSvNErRJA2krVv4LtregWT6UJflZ51MEpbBk=.e3b907f8-6734-4e14-8aef-5ec61d94cad7@github.com> On Mon, 13 May 2024 20:39:14 GMT, Nizar Benalla wrote: >> I added `@since` tags for methods/constructors that do not match the `@since` of the enclosing class. >> >> The `write` method already existed in `PrintStream` in earlier versions and instances of it could always call this method, since it extends `FilterOutputStream` [which has the method](https://github.com/openjdk/jdk6/blob/3e49aa876353eaa215cde71eb21acc9b7f9872a0/jdk/src/share/classes/java/io/FilterOutputStream.java#L96). >> >> for `MappedByteBuffer slice()` and `MappedByteBuffer slice(int index, int length)`, the return type changed from `ByteBuffer ` to `MappedByteBuffer`. And the checker tool differentiates between them because of that. >> >> This is similar to #18032 and #18373 >> >> For context, I am writing tests to check for accurate use of `@since` tags in documentation comments in source code. >> We're following these rules for now: >> >> ### Rule 1: Introduction of New Elements >> >> - If an element is new in JDK N, with no equivalent in JDK N-1, it must include `@since N`. >> - Exception: Member elements (fields, methods, nested classes) may omit `@since` if their version matches the value specified for the enclosing class or interface. >> >> ### Rule 2: Existing Elements in Subsequent JDK Versions >> >> - If an element exists in JDK N, with an equivalent in JDK N-1, it should not include `@since N`. >> >> ### Rule 3: Handling Missing `@since` Tags in methods if there is no `@since` >> >> - When inspecting methods, prioritize the `@since` annotation of the supertype's overridden method. >> - If unavailable or if the enclosing class's `@since` is newer, use the enclosing element's `@since`. >> >> I.e. if A extends B, and we add a method to B in JDK N, and add an override of the method to A in JDK M (M > N), we will use N as the effective `@since` for the method. > > Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision: > > empty commit and merge Thanks for the thorough review! ------------- PR Comment: https://git.openjdk.org/jdk/pull/18055#issuecomment-2147542776 From naoto.sato at oracle.com Tue Jun 4 16:23:15 2024 From: naoto.sato at oracle.com (Naoto Sato) Date: Tue, 4 Jun 2024 09:23:15 -0700 Subject: Instant.now(Clock) and InstantSource In-Reply-To: References: Message-ID: <55a29f76-c34b-4244-97c5-2a627af6c586@oracle.com> +1 for not deprecating the method that takes Clock. It would give existing users unnecessary warnings. Naoto On 6/4/24 12:17 AM, Stephen Colebourne wrote: > On Mon, 3 Jun 2024 at 22:25, Kurt Alfred Kluever wrote: >> It feels a bit strange that you can't pass an `InstantSource` to `Instant.now(...)`, but you _can_ pass a `Clock` (which of course has a "useless" `ZoneId` when creating an `Instant`). Therefore, I'd like to propose one of the following API changes: >> >> 1) adding `Instant.now(InstantSource)` >> 2) deprecating `Instant.now(Clock)` in favor of `clock.instant()` > > I have no problem with adding `Instant.now(InstantSource)`, but I > think deprecating the `Clock` method is unnecessary (given it will > never be removed AFAICT, and it is no doubt in widespread use). > Stephen From sgehwolf at openjdk.org Tue Jun 4 16:23:19 2024 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Tue, 4 Jun 2024 16:23:19 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v30] In-Reply-To: References: Message-ID: > Please review this patch which adds a jlink mode to the JDK which doesn't need the packaged modules being present. A.k.a run-time image based jlink. Fundamentally this patch adds an option to use `jlink` even though your JDK install might not come with the packaged modules (directory `jmods`). This is particularly useful to further reduce the size of a jlinked runtime. After the removal of the concept of a JRE, a common distribution mechanism is still the full JDK with all modules and packaged modules. However, packaged modules can incur an additional size tax. For example in a container scenario it could be useful to have a base JDK container including all modules, but without also delivering the packaged modules. This comes at a size advantage of `~25%`. Such a base JDK container could then be used to `jlink` application specific runtimes, further reducing the size of the application runtime image (App + JDK runtime; as a single image *or* separate bundles, depending on the app b eing modularized). > > The basic design of this approach is to add a jlink plugin for tracking non-class and non-resource files of a JDK install. I.e. files which aren't present in the jimage (`lib/modules`). This enables producing a `JRTArchive` class which has all the info of what constitutes the final jlinked runtime. > > Basic usage example: > > $ diff -u <(./bin/java --list-modules --limit-modules java.se) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules java.se) > $ diff -u <(./bin/java --list-modules --limit-modules jdk.jlink) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules jdk.jlink) > $ ls ../linux-x86_64-server-release/images/jdk/jmods > java.base.jmod java.net.http.jmod java.sql.rowset.jmod jdk.crypto.ec.jmod jdk.internal.opt.jmod jdk.jdi.jmod jdk.management.agent.jmod jdk.security.auth.jmod > java.compiler.jmod java.prefs.jmod java.transaction.xa.jmod jdk.dynalink.jmod jdk.internal.vm.ci.jmod jdk.jdwp.agent.jmod jdk.management.jfr.jmod jdk.security.jgss.jmod > java.datatransfer.jmod java.rmi.jmod java.xml.crypto.jmod jdk.editpad.jmod jdk.internal.vm.compiler.jmod jdk.jfr.jmod jdk.management.jmod jdk.unsupported.desktop.jmod > java.desktop.jmod java.scripting.jmod java.xml.jmod jdk.hotspot.agent.jmod jdk.internal.vm.compiler.manage... Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 113 commits: - Mark some tests with requiring packaged modules - Correctly set packaged modules default - Merge branch 'master' into jdk-8311302-jmodless-link - Merge branch 'master' into jdk-8311302-jmodless-link - Fix new line in jlink.properties - Merge branch 'master' into jdk-8311302-jmodless-link - Simplify JLINK_JDK_EXTRA_OPTS var handling - Only add runtime track files for linkable runtimes - Generate the runtime image link diff at jlink time But only do that once the plugin-pipeline has run. The generation is enabled with the hidden option '--generate-linkable-runtime' and the resource pools available at jlink time are being used to generate the diff. - Merge branch 'master' into jdk-8311302-jmodless-link - ... and 103 more: https://git.openjdk.org/jdk/compare/64bbae75...0eb1e48d ------------- Changes: https://git.openjdk.org/jdk/pull/14787/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14787&range=29 Stats: 3473 lines in 41 files changed: 3312 ins; 117 del; 44 mod Patch: https://git.openjdk.org/jdk/pull/14787.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14787/head:pull/14787 PR: https://git.openjdk.org/jdk/pull/14787 From sgehwolf at openjdk.org Tue Jun 4 16:23:23 2024 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Tue, 4 Jun 2024 16:23:23 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v29] In-Reply-To: References: <6Qs2lLk0mJP0XdyH9ysENqcUT7P0KxsWU95fvRzA21Q=.09e661a3-d340-4fde-8030-77db94a2d353@github.com> Message-ID: On Mon, 3 Jun 2024 19:10:22 GMT, Alan Bateman wrote: > > Does that proposal sound good? > > That table is useful, I think it's right. No change to default behavior. If someone configures with --enable-runtime-image then they get a JDK run-time image that supports jlink (with some limitations) but is significantly small as it doesn't include the packaged modules. https://github.com/openjdk/jdk/pull/14787/commits/5fef297ba999963d60452f098193d2cba33a941b implements this. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2147609799 From sgehwolf at openjdk.org Tue Jun 4 16:23:24 2024 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Tue, 4 Jun 2024 16:23:24 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v29] In-Reply-To: <6Qs2lLk0mJP0XdyH9ysENqcUT7P0KxsWU95fvRzA21Q=.09e661a3-d340-4fde-8030-77db94a2d353@github.com> References: <6Qs2lLk0mJP0XdyH9ysENqcUT7P0KxsWU95fvRzA21Q=.09e661a3-d340-4fde-8030-77db94a2d353@github.com> Message-ID: On Sun, 2 Jun 2024 17:41:55 GMT, Alan Bateman wrote: > (Doing that would of course mean that several existing jlink tests would need some changes, either to `@requires` or to remove the checks for the `jmods` directory) I've added a couple of `@requires jlink.packagedModules` (new with this patch) so that jlink tests don't start to fail with it. As a follow-up I've filed https://bugs.openjdk.org/browse/JDK-8333541. This change is becoming large enough as it is and would like to get this in before RDP1 on Thursday. The initial work was submitted almost a year ago. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2147709606 From asemenyuk at openjdk.org Tue Jun 4 16:33:17 2024 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Tue, 4 Jun 2024 16:33:17 GMT Subject: RFR: 8319457: Update jpackage to support WiX Toolset 4 on Windows [v4] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 16:07:18 GMT, Alexey Semenyuk wrote: >> Add support for WiX4 (and WiX5) in jpackage. >> >> jpackage supports WiX3, WiX4 and WiX5. It will pick WiX4/WiX5 if one of them is installed and there is WiX3 installed too. (Note: WiX4 and WiX5 are not supposed to be installed side-by-side, but if it happens, WiX5 will be preferred over WiX4). >> >> Custom WiX3 sources will be automatically converted to WiX4 format if WiX4/WiX5 is used. The converter provides: >> >> - full support of the conversion of WiX L10N (.wxl) files, i.e. full support of "http://schemas.microsoft.com/wix/2006/localization" to "http://wixtoolset.org/schemas/v4/wxl" namespace conversion; >> - partial support of WiX source (.wxs) files, i.e. partial support of "http://schemas.microsoft.com/wix/2006/wi" to "http://wixtoolset.org/schemas/v4/wxs" namespace conversion; >> >> The converter is a XSLT stylesheet. The default converter is `src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/wix3-to-wix4-conv.xsl`. It can be replaced with the custom converter by adding "wix-conv.xsl" file to the resource directory. > > Alexey Semenyuk has updated the pull request incrementally with two additional commits since the last revision: > > - WixSourceConverter#applyTo should do what OverridableResource#saveToFile() does: create parent directory and replace output file if it exists. > - Fix issue with overwriting custom l10n file in the resource directory. All WiX source files from the resource directory should be copied to jpackage work directory before running wxi tools. jpackage should not change files in the resource directory. Fixed WinL10nTest test failure. It didn't fail on my dev machine but failed in another environment. I thought it was sporadic but it turned out to be a bug in this PR. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19318#issuecomment-2147915867 From naoto at openjdk.org Tue Jun 4 16:33:00 2024 From: naoto at openjdk.org (Naoto Sato) Date: Tue, 4 Jun 2024 16:33:00 GMT Subject: RFR: 8333086: Using Console.println is unnecessarily slow due to JLine initalization In-Reply-To: References: Message-ID: On Thu, 30 May 2024 13:50:33 GMT, Jan Lahoda wrote: > Consider these two programs: > > > public class SystemPrint { > public static void main(String... args) { > System.err.println("Hello!"); > } > } > > and: > > public class IOPrint { > public static void main(String... args) { > java.io.IO.println("Hello!"); > } > } > > > They do the same conceptual thing - write a text to the output. But, `IO.println` delegates to `Console.println`, which then delegates to a `Console` backend, and the default backend is currently based on JLine. > > The issues is that JLine takes a quite a long time to initialize, and in a program like this, JLine is not really needed - it is used to provide better editing experience when reading input, but there's no reading in these programs. > > For example, on my computer: > > $ time java -classpath /tmp SystemPrint > Hello! > > real 0m0,035s > user 0m0,019s > sys 0m0,019s > > $ time java -classpath /tmp --enable-preview IOPrint > Hello! > > real 0m0,165s > user 0m0,324s > sys 0m0,042s > > > The proposal herein is to delegate to the simpler `Console` backend from `java.base` as long as the user only uses methods that print to output, and switch to the JLine delegate when other methods (typically input) is used. Note that while technically `writer()` is a method doing output, it will force JLine initialization to avoid possible problems if the client caches the writer and uses it after switching the delegates. > > With this patch, I can get timing like this: > > $ time java --enable-preview -classpath /tmp/ IOPrint > Hello! > > real 0m0,051s > user 0m0,038s > sys 0m0,020s > > > which seems much more acceptable. > > There is also #19467, which may reduce the time further. > > A future work might focus on making JLine initialize faster, but avoiding JLine initialization in case where we don't need it seems like a good step to me in any case. Looks good with a minor nit. test/jdk/jdk/internal/jline/LazyJdkConsoleProvider.java line 74: > 72: ProcessBuilder builder = > 73: ProcessTools.createTestJavaProcessBuilder("--enable-preview", > 74: "-verbose:class", Better to explicitly specify `-Djdk.console=jdk.internal.le` ------------- PR Review: https://git.openjdk.org/jdk/pull/19479#pullrequestreview-2096855434 PR Review Comment: https://git.openjdk.org/jdk/pull/19479#discussion_r1626281874 From jpai at openjdk.org Tue Jun 4 16:47:57 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Tue, 4 Jun 2024 16:47:57 GMT Subject: RFR: 8333270: HandlersOnComplexResetUpdate and HandlersOnComplexUpdate tests fail with "Unexpected reference" if timeoutFactor is less than 1/3 [v2] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 15:17:33 GMT, Daniel Fuchs wrote: >> HandlersOnComplexResetUpdate and HandlersOnComplexUpdate tests verify that loggers are GC'ed (or not GC'ed) after a reset or an update. For that they poll a ReferenceQueue in a loop. The number of iteration is adjusted according to the jtreg timeout factor. However, the logic in the test did not expect that the timeout might be less than 1. >> >> This fix does two things: >> >> 1. fix the adjustCount logic - so that the number of iteration can only be increased >> 2. use remove(timeout) instead of poll() in order to minimize the waiting time. > > Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: > > Review feedback: use Reference::refersTo consistently The changes look good to me. ------------- Marked as reviewed by jpai (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19503#pullrequestreview-2096922118 From nbenalla at openjdk.org Tue Jun 4 16:54:07 2024 From: nbenalla at openjdk.org (Nizar Benalla) Date: Tue, 4 Jun 2024 16:54:07 GMT Subject: Integrated: 8326951: since-checker - missing @ since tags In-Reply-To: <_iA0CxGgaa8nA5AlNfT1IfG3Y6Wx7tcdiv3oJQNYCjQ=.5fb84060-0490-4b18-8995-cc534e1c22f5@github.com> References: <_iA0CxGgaa8nA5AlNfT1IfG3Y6Wx7tcdiv3oJQNYCjQ=.5fb84060-0490-4b18-8995-cc534e1c22f5@github.com> Message-ID: <6_AxWxwLvM8is87Q-BRTBSqIpBIbxsin3XUcCMHW-Ng=.fe4ee43d-c805-4fc3-acf5-0a8a40b73e35@github.com> On Thu, 29 Feb 2024 09:45:35 GMT, Nizar Benalla wrote: > I added `@since` tags for methods/constructors that do not match the `@since` of the enclosing class. > > The `write` method already existed in `PrintStream` in earlier versions and instances of it could always call this method, since it extends `FilterOutputStream` [which has the method](https://github.com/openjdk/jdk6/blob/3e49aa876353eaa215cde71eb21acc9b7f9872a0/jdk/src/share/classes/java/io/FilterOutputStream.java#L96). > > for `MappedByteBuffer slice()` and `MappedByteBuffer slice(int index, int length)`, the return type changed from `ByteBuffer ` to `MappedByteBuffer`. And the checker tool differentiates between them because of that. > > This is similar to #18032 and #18373 > > For context, I am writing tests to check for accurate use of `@since` tags in documentation comments in source code. > We're following these rules for now: > > ### Rule 1: Introduction of New Elements > > - If an element is new in JDK N, with no equivalent in JDK N-1, it must include `@since N`. > - Exception: Member elements (fields, methods, nested classes) may omit `@since` if their version matches the value specified for the enclosing class or interface. > > ### Rule 2: Existing Elements in Subsequent JDK Versions > > - If an element exists in JDK N, with an equivalent in JDK N-1, it should not include `@since N`. > > ### Rule 3: Handling Missing `@since` Tags in methods if there is no `@since` > > - When inspecting methods, prioritize the `@since` annotation of the supertype's overridden method. > - If unavailable or if the enclosing class's `@since` is newer, use the enclosing element's `@since`. > > I.e. if A extends B, and we add a method to B in JDK N, and add an override of the method to A in JDK M (M > N), we will use N as the effective `@since` for the method. This pull request has now been integrated. Changeset: e0bab786 Author: Nizar Benalla Committer: Jaikiran Pai URL: https://git.openjdk.org/jdk/commit/e0bab786402d70e9a74d1816c029c772ea01f697 Stats: 24 lines in 7 files changed: 19 ins; 2 del; 3 mod 8326951: since-checker - missing @ since tags Reviewed-by: jpai ------------- PR: https://git.openjdk.org/jdk/pull/18055 From duke at openjdk.org Tue Jun 4 17:01:01 2024 From: duke at openjdk.org (David M. Lloyd) Date: Tue, 4 Jun 2024 17:01:01 GMT Subject: Integrated: 8333312: Incorrect since tags on new ClassReader and ConstantPool methods In-Reply-To: References: Message-ID: On Fri, 31 May 2024 13:04:03 GMT, David M. Lloyd wrote: > The new method additions ClassReader.readEntryOrNull(int, Class) and ConstantPool.entryByIndex(int, Class) have incorrect since tags; they should be `@since 23`. This pull request has now been integrated. Changeset: b101dcb6 Author: David M. Lloyd Committer: Adam Sotona URL: https://git.openjdk.org/jdk/commit/b101dcb609eae00b406f387cd90e58487d5868df Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod 8333312: Incorrect since tags on new ClassReader and ConstantPool methods Reviewed-by: liach, asotona ------------- PR: https://git.openjdk.org/jdk/pull/19501 From naoto at openjdk.org Tue Jun 4 17:24:56 2024 From: naoto at openjdk.org (Naoto Sato) Date: Tue, 4 Jun 2024 17:24:56 GMT Subject: RFR: 8333456: CompactNumberFormat integer parsing fails when string has no suffix In-Reply-To: References: Message-ID: On Mon, 3 Jun 2024 22:32:54 GMT, Justin Lu wrote: > Please review this PR which handles incorrect CompactNumberFormat integer only parsing when there is no suffix. > > See the following snippet, > > > var fmt = NumberFormat.getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT) > fmt.setParseIntegerOnly(true) > fmt.parse("5K") // returns 5000 > fmt.parse("50.00") // returns 50 > fmt.parse("5") // unexpectedly throws StringIndexOutOfBoundsException > fmt.parse("5 ") // returns 5 > > > Within the `parse` method, there is code that advances `position` past the fractional portion to find the suffix when `parseIntegerOnly()` is true. However, if a valid string input is given with no suffix, `DecimalFormat.subparseNumber()` will fully iterate through the string and `position` will be equal to the length of the string, throwing StringIndexOutOfBoundsException when `charAt` is invoked (line 1740). > > We should check to make sure position does not exceed the string length before deciding to check for a decimal symbol. The fix looks good. For the test, can we add the test case into an existing test, instead of creating a new test case file? ------------- PR Review: https://git.openjdk.org/jdk/pull/19533#pullrequestreview-2096998510 From cushon at openjdk.org Tue Jun 4 17:42:23 2024 From: cushon at openjdk.org (Liam Miller-Cushon) Date: Tue, 4 Jun 2024 17:42:23 GMT Subject: RFR: 8328821: Map.of().entrySet() mutators should throw UnsupportedOperationException [v3] In-Reply-To: References: Message-ID: > This change overrides mutator methods in the implementation returned by `Map.of().entrySet()` to throw `UnsupportedOperationException`. Liam Miller-Cushon has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision: - Merge remote-tracking branch 'origin/master' into JDK-8328821-make-clear-consistent - Check m.entrySet().hashCode() in MOAT - Merge remote-tracking branch 'origin/master' into JDK-8328821-make-clear-consistent - Use AbstractImmutableSet - Throw UOE for all Map.of().entrySet() mutator methods - 8328821: Make the ImmutableCollections clear() call consistent Without overriding clear(), a call to it in an empty map would just return, as iterator.hasNext() would be false. However if calling Map.of().clear() throws an exception. To make the behavior of Map.of().entrySet().clear() consistent, we need to have an implementation of clear() for the entry set that throws as well. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/18522/files - new: https://git.openjdk.org/jdk/pull/18522/files/17851d80..598af2e5 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=18522&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=18522&range=01-02 Stats: 20292 lines in 534 files changed: 12666 ins; 5447 del; 2179 mod Patch: https://git.openjdk.org/jdk/pull/18522.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/18522/head:pull/18522 PR: https://git.openjdk.org/jdk/pull/18522 From cushon at openjdk.org Tue Jun 4 17:43:08 2024 From: cushon at openjdk.org (Liam Miller-Cushon) Date: Tue, 4 Jun 2024 17:43:08 GMT Subject: RFR: 8332744: [REDO] 'internal proprietary API' diagnostics if --system is configured to an earlier JDK version Message-ID: This change fixes a bug preventing javac from emitting 'compiler.warn.sun.proprietary' diagnostics if `--system` is set to a non-default value. The diagnostics are currently emitted for values of `--release`, and for the default value of `--system`. The is a redo of [JDK-8331081](https://bugs.openjdk.org/browse/JDK-8331081), which was backed out in [JDK-8332740](https://bugs.openjdk.org/browse/JDK-8332740) due to a build failure in the microbenchmarks. ------------- Commit messages: - Merge remote-tracking branch 'origin/master' into JDK-8332744 - Use jdk.internal.misc.Unsafe instead of sun.misc.Unsafe in microbenchmarks to avoid a sunapi warning - [REDO] 'internal proprietary API' diagnostics if --system is configured to an earlier JDK version Changes: https://git.openjdk.org/jdk/pull/19397/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19397&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8332744 Stats: 159 lines in 20 files changed: 132 ins; 0 del; 27 mod Patch: https://git.openjdk.org/jdk/pull/19397.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19397/head:pull/19397 PR: https://git.openjdk.org/jdk/pull/19397 From cushon at openjdk.org Tue Jun 4 17:43:24 2024 From: cushon at openjdk.org (Liam Miller-Cushon) Date: Tue, 4 Jun 2024 17:43:24 GMT Subject: RFR: 8328995: Launcher can't open jar files where the offset of the manifest is >4GB [v7] In-Reply-To: References: Message-ID: <_TvJQ-I5L2LkS4PrOqEX4MU_GBDxP0nJy_kkwMk9lr0=.ca7a9572-fdad-4c43-8355-8c273646bfc5@github.com> > This change fixes a zip64 bug in the launcher that is prevent it from reading the manifest of jars where the 'relative offset of local header' field in the central directory entry is >4GB. As described in APPNOTE.TXT 4.5.3, the offset is too large to be stored in the central directory it is stored in a 'Zip64 Extended Information Extra Field'. Liam Miller-Cushon has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains eight additional commits since the last revision: - Merge remote-tracking branch 'origin/master' into JDK-8328995 - Move test to test/jdk/tools/launcher - Add some more comments - Maximum Zip64 extra field length is 32 - Make cendsk an unsigned short - Fix disk number size - Improvements * don't rely on variable length arrays * only run the test of 64 bit machines, since it requires >4GB of heap - 8328995: launcher can't open jar files where the offset of the manifest is >4GB ------------- Changes: - all: https://git.openjdk.org/jdk/pull/18479/files - new: https://git.openjdk.org/jdk/pull/18479/files/140e13b9..da36c059 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=18479&range=06 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=18479&range=05-06 Stats: 232749 lines in 4679 files changed: 131506 ins; 74722 del; 26521 mod Patch: https://git.openjdk.org/jdk/pull/18479.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/18479/head:pull/18479 PR: https://git.openjdk.org/jdk/pull/18479 From naoto at openjdk.org Tue Jun 4 17:46:17 2024 From: naoto at openjdk.org (Naoto Sato) Date: Tue, 4 Jun 2024 17:46:17 GMT Subject: RFR: 8332161: Test restoring echo in the Console implementation (java.base) [v7] In-Reply-To: References: Message-ID: > This test intends to verify the behavior of JdkConsole for the java.base module, wrt restoring the echo. The test assumes the internal methods that sets/gets the echo status of the platform. Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: Check restored echo with stty -a ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19315/files - new: https://git.openjdk.org/jdk/pull/19315/files/2477adf4..c1ea5d59 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19315&range=06 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19315&range=05-06 Stats: 68 lines in 2 files changed: 8 ins; 38 del; 22 mod Patch: https://git.openjdk.org/jdk/pull/19315.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19315/head:pull/19315 PR: https://git.openjdk.org/jdk/pull/19315 From naoto at openjdk.org Tue Jun 4 18:49:01 2024 From: naoto at openjdk.org (Naoto Sato) Date: Tue, 4 Jun 2024 18:49:01 GMT Subject: RFR: 8333396: Performance regression of DecimalFormat.format [v4] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 09:07:44 GMT, lingjun-cg wrote: >> ### Performance regression of DecimalFormat.format >> From the output of perf, we can see the hottest regions contain atomic instructions. But when run with JDK 11, there is no such problem. The reason is the removed biased locking. >> The DecimalFormat uses StringBuffer everywhere, and StringBuffer itself contains many synchronized methods. >> So I added support for some new methods that accept StringBuilder which is lock-free. >> >> ### Benchmark testcase >> >> @BenchmarkMode(Mode.AverageTime) >> @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) >> @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) >> @State(Scope.Thread) >> @OutputTimeUnit(TimeUnit.NANOSECONDS) >> public class JmhDecimalFormat { >> >> private DecimalFormat format; >> >> @Setup(Level.Trial) >> public void setup() { >> format = new DecimalFormat("#0.00000"); >> } >> >> @Benchmark >> public void testNewAndFormat() throws InterruptedException { >> new DecimalFormat("#0.00000").format(9524234.1236457); >> } >> >> @Benchmark >> public void testNewOnly() throws InterruptedException { >> new DecimalFormat("#0.00000"); >> } >> >> @Benchmark >> public void testFormatOnly() throws InterruptedException { >> format.format(9524234.1236457); >> } >> } >> >> >> ### Test result >> #### Current JDK before optimize >> >> Benchmark Mode Cnt Score Error Units >> JmhDecimalFormat.testFormatOnly avgt 50 642.099 ? 1.253 ns/op >> JmhDecimalFormat.testNewAndFormat avgt 50 989.307 ? 3.676 ns/op >> JmhDecimalFormat.testNewOnly avgt 50 303.381 ? 5.252 ns/op >> >> >> >> #### Current JDK after optimize >> >> Benchmark Mode Cnt Score Error Units >> JmhDecimalFormat.testFormatOnly avgt 50 351.499 ? 0.761 ns/op >> JmhDecimalFormat.testNewAndFormat avgt 50 615.145 ? 2.478 ns/op >> JmhDecimalFormat.testNewOnly avgt 50 209.874 ? 9.951 ns/op >> >> >> ### JDK 11 >> >> Benchmark Mode Cnt Score Error Units >> JmhDecimalFormat.testFormatOnly avgt 50 364.214 ? 1.191 ns/op >> JmhDecimalFormat.testNewAndFormat avgt 50 658.699 ? 2.311 ns/op >> JmhDecimalFormat.testNewOnly avgt 50 248.300 ? 5.158 ns/op > > lingjun-cg has updated the pull request incrementally with one additional commit since the last revision: > > 8333396: Performance regression of DecimalFormat.format Thanks for splitting up the PR/JBS. For this one, I am still not sure why this StringBuffer/Builder locking became an issue, as the code is basically the same in JDK11 (meaning StringBuffer has always been used). Would it be possible if the regression was caused by some other changes? ------------- PR Comment: https://git.openjdk.org/jdk/pull/19513#issuecomment-2148184952 From naoto at openjdk.org Tue Jun 4 18:50:57 2024 From: naoto at openjdk.org (Naoto Sato) Date: Tue, 4 Jun 2024 18:50:57 GMT Subject: RFR: 8333462: Performance regression of new DecimalFormat() when compare to jdk11 In-Reply-To: References: Message-ID: <_1kh4M6jLwCDhffLKwcdEvAVrP33zlFn-OguIgu3Eys=.9419d026-2a67-4589-8d83-c767f6bd269b@github.com> On Tue, 4 Jun 2024 02:32:28 GMT, lingjun-cg wrote: > Run the below benchmark test ,it show the average time of new DecimalFormat() increase 18% when compare to jdk 11. > > the result with jdk 11: > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testNewOnly avgt 50 248.300 ? 5.158 ns/op > > > the result with current jdk: > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testNewOnly avgt 50 303.381 ? 5.252 ns/op > > > > @BenchmarkMode(Mode.AverageTime) > @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) > @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) > @State(Scope.Thread) > @OutputTimeUnit(TimeUnit.NANOSECONDS) > public class JmhDecimalFormat { > > @Setup(Level.Trial) > public void setup() { > } > > @Benchmark > public void testNewOnly() throws InterruptedException { > new DecimalFormat("#0.00000"); > } > } > > > Compare the flame graph it shows the java.text.DecimalFormatSymbols#findNonFormatChar takes a significant time. > After replacing the lambda implementation with a simple loop , it shows nearly the same performance as jdk 11. > > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testNewOnly avgt 50 209.874 ? 9.951 ns/op > > > [flame-graph-jdk11-jdk21.zip](https://github.com/user-attachments/files/15541764/flame-graph-jdk11-jdk21.zip) LGTM src/java.base/share/classes/java/text/DecimalFormatSymbols.java line 866: > 864: private char findNonFormatChar(String src, char defChar) { > 865: for (int i = 0; i < src.length(); i++) { > 866: if (Character.getType(src.charAt(i)) != Character.FORMAT) { return of `src.charAt(i)` can be reused ------------- Marked as reviewed by naoto (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19534#pullrequestreview-2097161949 PR Review Comment: https://git.openjdk.org/jdk/pull/19534#discussion_r1626467416 From dl at openjdk.org Tue Jun 4 19:43:57 2024 From: dl at openjdk.org (Doug Lea) Date: Tue, 4 Jun 2024 19:43:57 GMT Subject: RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 13:03:45 GMT, Viktor Klang wrote: >> Improve `java/util/concurrent/CopyOnWriteArrayList` by eliminating needless cloning of Object[0] instances. This cloning is intended to prevent callers from changing array contents, but many `CopyOnWriteArrayList`s are allocated to size zero, or are otherwise maintained empty, so cloning is unnecessary. >> >> Results from the included JMH benchmark: >> Before: >> >> Benchmark Mode Cnt Score Error Units >> CopyOnWriteArrayListBenchmark.clear avgt 5 74.487 ? 1.793 ns/op >> CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 27.918 ? 0.759 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.656 ? 0.375 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 15.415 ? 0.489 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.608 ? 0.363 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 15.374 ? 0.260 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 15.688 ? 0.350 ns/op >> >> >> After: >> >> Benchmark Mode Cnt Score Error Units >> CopyOnWriteArrayListBenchmark.clear avgt 5 75.365 ? 2.092 ns/op >> CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 20.803 ? 0.539 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.808 ? 0.582 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 12.980 ? 0.418 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.627 ? 0.173 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 12.864 ? 0.408 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 12.931 ? 0.255 ns/op > > src/java.base/share/classes/java/util/concurrent/CopyOnWriteArrayList.java line 103: > >> 101: private static final long serialVersionUID = 8673264195747942595L; >> 102: >> 103: private static final Object[] EMPTY_ELEMENTDATA = {}; > > Looks like readObject() ought to also be changed to use the EMPTY_ELEMENTDATA if the length of the read array is 0? And perhaps `clone()`. Agreed. You might as well be consistent with this so that no one will need to re-address if some application does zillions of clones of empty lists. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19527#discussion_r1626520838 From naoto at openjdk.org Tue Jun 4 19:47:57 2024 From: naoto at openjdk.org (Naoto Sato) Date: Tue, 4 Jun 2024 19:47:57 GMT Subject: RFR: 8333396: Performance regression of DecimalFormat.format [v4] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 09:07:44 GMT, lingjun-cg wrote: >> ### Performance regression of DecimalFormat.format >> From the output of perf, we can see the hottest regions contain atomic instructions. But when run with JDK 11, there is no such problem. The reason is the removed biased locking. >> The DecimalFormat uses StringBuffer everywhere, and StringBuffer itself contains many synchronized methods. >> So I added support for some new methods that accept StringBuilder which is lock-free. >> >> ### Benchmark testcase >> >> @BenchmarkMode(Mode.AverageTime) >> @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) >> @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) >> @State(Scope.Thread) >> @OutputTimeUnit(TimeUnit.NANOSECONDS) >> public class JmhDecimalFormat { >> >> private DecimalFormat format; >> >> @Setup(Level.Trial) >> public void setup() { >> format = new DecimalFormat("#0.00000"); >> } >> >> @Benchmark >> public void testNewAndFormat() throws InterruptedException { >> new DecimalFormat("#0.00000").format(9524234.1236457); >> } >> >> @Benchmark >> public void testNewOnly() throws InterruptedException { >> new DecimalFormat("#0.00000"); >> } >> >> @Benchmark >> public void testFormatOnly() throws InterruptedException { >> format.format(9524234.1236457); >> } >> } >> >> >> ### Test result >> #### Current JDK before optimize >> >> Benchmark Mode Cnt Score Error Units >> JmhDecimalFormat.testFormatOnly avgt 50 642.099 ? 1.253 ns/op >> JmhDecimalFormat.testNewAndFormat avgt 50 989.307 ? 3.676 ns/op >> JmhDecimalFormat.testNewOnly avgt 50 303.381 ? 5.252 ns/op >> >> >> >> #### Current JDK after optimize >> >> Benchmark Mode Cnt Score Error Units >> JmhDecimalFormat.testFormatOnly avgt 50 351.499 ? 0.761 ns/op >> JmhDecimalFormat.testNewAndFormat avgt 50 615.145 ? 2.478 ns/op >> JmhDecimalFormat.testNewOnly avgt 50 209.874 ? 9.951 ns/op >> >> >> ### JDK 11 >> >> Benchmark Mode Cnt Score Error Units >> JmhDecimalFormat.testFormatOnly avgt 50 364.214 ? 1.191 ns/op >> JmhDecimalFormat.testNewAndFormat avgt 50 658.699 ? 2.311 ns/op >> JmhDecimalFormat.testNewOnly avgt 50 248.300 ? 5.158 ns/op > > lingjun-cg has updated the pull request incrementally with one additional commit since the last revision: > > 8333396: Performance regression of DecimalFormat.format Also it would be helpful to compare the performance without biased locking in JDK11. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19513#issuecomment-2148296971 From duke at openjdk.org Tue Jun 4 19:56:10 2024 From: duke at openjdk.org (jengebr) Date: Tue, 4 Jun 2024 19:56:10 GMT Subject: RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations [v2] In-Reply-To: References: Message-ID: > Improve `java/util/concurrent/CopyOnWriteArrayList` by eliminating needless cloning of Object[0] instances. This cloning is intended to prevent callers from changing array contents, but many `CopyOnWriteArrayList`s are allocated to size zero, or are otherwise maintained empty, so cloning is unnecessary. > > Results from the included JMH benchmark: > Before: > > Benchmark Mode Cnt Score Error Units > CopyOnWriteArrayListBenchmark.clear avgt 5 74.487 ? 1.793 ns/op > CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 27.918 ? 0.759 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.656 ? 0.375 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 15.415 ? 0.489 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.608 ? 0.363 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 15.374 ? 0.260 ns/op > CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 15.688 ? 0.350 ns/op > > > After: > > Benchmark Mode Cnt Score Error Units > CopyOnWriteArrayListBenchmark.clear avgt 5 75.365 ? 2.092 ns/op > CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 20.803 ? 0.539 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.808 ? 0.582 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 12.980 ? 0.418 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.627 ? 0.173 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 12.864 ? 0.408 ns/op > CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 12.931 ? 0.255 ns/op jengebr has updated the pull request incrementally with one additional commit since the last revision: Adding coverage to readObject() ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19527/files - new: https://git.openjdk.org/jdk/pull/19527/files/ea7a0042..9ab83c9d Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19527&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19527&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/19527.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19527/head:pull/19527 PR: https://git.openjdk.org/jdk/pull/19527 From duke at openjdk.org Tue Jun 4 20:00:57 2024 From: duke at openjdk.org (jengebr) Date: Tue, 4 Jun 2024 20:00:57 GMT Subject: RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations [v2] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 19:41:15 GMT, Doug Lea
wrote: >> src/java.base/share/classes/java/util/concurrent/CopyOnWriteArrayList.java line 103: >> >>> 101: private static final long serialVersionUID = 8673264195747942595L; >>> 102: >>> 103: private static final Object[] EMPTY_ELEMENTDATA = {}; >> >> Looks like readObject() ought to also be changed to use the EMPTY_ELEMENTDATA if the length of the read array is 0? And perhaps `clone()`. > > Agreed. You might as well be consistent with this so that no one will need to re-address if some application does zillions of clones of empty lists. I've updated `readObject` to match - thanks! `clone()` isn't a big win since the array is allocated elsewhere and the application doesn't use that code path, so I'll leave that alone for now. Sorry, I crossed wires with @DougLea 's comment, will add `clone`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19527#discussion_r1626537384 PR Review Comment: https://git.openjdk.org/jdk/pull/19527#discussion_r1626538689 From jlu at openjdk.org Tue Jun 4 20:15:56 2024 From: jlu at openjdk.org (Justin Lu) Date: Tue, 4 Jun 2024 20:15:56 GMT Subject: RFR: 8333462: Performance regression of new DecimalFormat() when compare to jdk11 In-Reply-To: References: Message-ID: <8_vJeH_-UgrmoTmXZZ1wMAoi4RtuLNWk4a-Aqsd6xHc=.bf8b1a8e-aaef-42e0-948a-2432696c6fa5@github.com> On Tue, 4 Jun 2024 02:32:28 GMT, lingjun-cg wrote: > Run the below benchmark test ,it show the average time of new DecimalFormat() increase 18% when compare to jdk 11. > > the result with jdk 11: > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testNewOnly avgt 50 248.300 ? 5.158 ns/op > > > the result with current jdk: > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testNewOnly avgt 50 303.381 ? 5.252 ns/op > > > > @BenchmarkMode(Mode.AverageTime) > @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) > @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) > @State(Scope.Thread) > @OutputTimeUnit(TimeUnit.NANOSECONDS) > public class JmhDecimalFormat { > > @Setup(Level.Trial) > public void setup() { > } > > @Benchmark > public void testNewOnly() throws InterruptedException { > new DecimalFormat("#0.00000"); > } > } > > > Compare the flame graph it shows the java.text.DecimalFormatSymbols#findNonFormatChar takes a significant time. > After replacing the lambda implementation with a simple loop , it shows nearly the same performance as jdk 11. > > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testNewOnly avgt 50 209.874 ? 9.951 ns/op > > > [flame-graph-jdk11-jdk21.zip](https://github.com/user-attachments/files/15541764/flame-graph-jdk11-jdk21.zip) LGTM. Also needs copyright year update ------------- Marked as reviewed by jlu (Committer). PR Review: https://git.openjdk.org/jdk/pull/19534#pullrequestreview-2097304072 From jlu at openjdk.org Tue Jun 4 20:43:09 2024 From: jlu at openjdk.org (Justin Lu) Date: Tue, 4 Jun 2024 20:43:09 GMT Subject: RFR: 8333456: CompactNumberFormat integer parsing fails when string has no suffix [v2] In-Reply-To: References: Message-ID: > Please review this PR which handles incorrect CompactNumberFormat integer only parsing when there is no suffix. > > See the following snippet, > > > var fmt = NumberFormat.getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT) > fmt.setParseIntegerOnly(true) > fmt.parse("5K") // returns 5000 > fmt.parse("50.00") // returns 50 > fmt.parse("5") // unexpectedly throws StringIndexOutOfBoundsException > fmt.parse("5 ") // returns 5 > > > Within the `parse` method, there is code that advances `position` past the fractional portion to find the suffix when `parseIntegerOnly()` is true. However, if a valid string input is given with no suffix, `DecimalFormat.subparseNumber()` will fully iterate through the string and `position` will be equal to the length of the string, throwing StringIndexOutOfBoundsException when `charAt` is invoked (line 1740). > > We should check to make sure position does not exceed the string length before deciding to check for a decimal symbol. Justin Lu has updated the pull request incrementally with one additional commit since the last revision: move test to existing test file ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19533/files - new: https://git.openjdk.org/jdk/pull/19533/files/b6bb7e56..accb1850 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19533&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19533&range=00-01 Stats: 93 lines in 2 files changed: 24 ins; 68 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/19533.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19533/head:pull/19533 PR: https://git.openjdk.org/jdk/pull/19533 From nbenalla at openjdk.org Tue Jun 4 20:44:30 2024 From: nbenalla at openjdk.org (Nizar Benalla) Date: Tue, 4 Jun 2024 20:44:30 GMT Subject: RFR: 8331051: Add an `@since` checker test for `java.base` module [v9] In-Reply-To: References: Message-ID: > This checker checks the values of the `@since` tag found in the documentation comment for an element against the release in which the element first appeared. > > Real since value of an API element is computed as the oldest release in which the given API element was introduced. That is: > - for modules, classes and interfaces, the release in which the element with the given qualified name was introduced > - for constructors, the release in which the constructor with the given VM descriptor was introduced > - for methods and fields, the release in which the given method or field with the given VM descriptor became a member of its enclosing class or interface, whether direct or inherited > > Effective since value of an API element is computed as follows: > - if the given element has a `@since` tag in its javadoc, it is used > - in all other cases, return the effective since value of the enclosing element > > The since checker verifies that for every API element, the real since value and the effective since value are the same, and reports an error if they are not. > > Preview method are handled as per JEP 12, if `@PreviewFeature` is used consistently going forward then the checker doesn't need to be updated with every release. The checker has explicit knowledge of preview elements that came before `JDK 14` because they weren't marked in a machine understandable way and preview elements that came before `JDK 17` that didn't have `@PreviewFeature`. > > Important note : We only check code written since `JDK 9` as the releases used to determine the expected value of `@since` tags are taken from the historical data built into `javac` which only goes back that far > > The intial comment at the beginning of `SinceChecker.java` holds more information into the program. > > I already have filed issues and fixed some wrong tags like in #18640, #18032, #18030, #18055, #18373, #18954, #18972. Nizar Benalla has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 17 additional commits since the last revision: - Improve checker report messages - Merge branch 'master' into source-based-since-checker - - removed unused parameter `i` - make rest of methods private - ".toString" instead of "toString" Signed-off-by: Nizar Benalla - Add a few more legacy methods, needed a few more after changes to the checker - checking for null values directly rather than catching NPE - Merge remote-tracking branch 'upstream/master' into source-based-since-checker - Now only skipping the common methods that every record class will have, and will never need a new `@since` - - Not checking elements enclosed within a record, I doubt a record class will change after being created - Added a null check as `toString` can return an exception - - Added some legacy modules that existed long before preview features (they were incubating) - Not checking elements enclosed withing a record - Only check if the file is readable using `Files.isReadable` - Dropped the use of `Files.exists` and `Files.isDirectory` - Use `--add-modules` option now to resolve certain modules - mention packages in initial comment - ... and 7 more: https://git.openjdk.org/jdk/compare/544d8c3f...5be962b7 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/18934/files - new: https://git.openjdk.org/jdk/pull/18934/files/85b2d1a5..5be962b7 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=18934&range=08 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=18934&range=07-08 Stats: 77006 lines in 1512 files changed: 56440 ins; 13399 del; 7167 mod Patch: https://git.openjdk.org/jdk/pull/18934.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/18934/head:pull/18934 PR: https://git.openjdk.org/jdk/pull/18934 From nbenalla at openjdk.org Tue Jun 4 20:46:59 2024 From: nbenalla at openjdk.org (Nizar Benalla) Date: Tue, 4 Jun 2024 20:46:59 GMT Subject: RFR: 8331051: Add an `@since` checker test for `java.base` module [v8] In-Reply-To: References: Message-ID: On Mon, 27 May 2024 12:04:20 GMT, Nizar Benalla wrote: >> This checker checks the values of the `@since` tag found in the documentation comment for an element against the release in which the element first appeared. >> >> Real since value of an API element is computed as the oldest release in which the given API element was introduced. That is: >> - for modules, classes and interfaces, the release in which the element with the given qualified name was introduced >> - for constructors, the release in which the constructor with the given VM descriptor was introduced >> - for methods and fields, the release in which the given method or field with the given VM descriptor became a member of its enclosing class or interface, whether direct or inherited >> >> Effective since value of an API element is computed as follows: >> - if the given element has a `@since` tag in its javadoc, it is used >> - in all other cases, return the effective since value of the enclosing element >> >> The since checker verifies that for every API element, the real since value and the effective since value are the same, and reports an error if they are not. >> >> Preview method are handled as per JEP 12, if `@PreviewFeature` is used consistently going forward then the checker doesn't need to be updated with every release. The checker has explicit knowledge of preview elements that came before `JDK 14` because they weren't marked in a machine understandable way and preview elements that came before `JDK 17` that didn't have `@PreviewFeature`. >> >> Important note : We only check code written since `JDK 9` as the releases used to determine the expected value of `@since` tags are taken from the historical data built into `javac` which only goes back that far >> >> The intial comment at the beginning of `SinceChecker.java` holds more information into the program. >> >> I already have filed issues and fixed some wrong tags like in #18640, #18032, #18030, #18055, #18373, #18954, #18972. > > Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision: > > - removed unused parameter `i` > - make rest of methods private > - ".toString" instead of "toString" > > Signed-off-by: Nizar Benalla The checker's report has been improved, the result after running it on `java.base` is the following SinceChecker java.base STDERR: src/java.base/java/io/PrintStream.java:685 method: void java.io.PrintStream.write(byte[]): `@since` version is 14 but the element exists before JDK 10 src/java.base/java/io/FileInputStream.java:374 method: byte[] java.io.FileInputStream.readNBytes(int): `@since` version: 9; found: 11 src/java.base/java/lang/classfile/ClassSignature.java:45 method: java.lang.classfile.Signature.ClassTypeSig java.lang.classfile.ClassSignature.superclassSignature(): `@since` version: 22; found: 23 src/java.base/java/lang/classfile/ClassReader.java:131 method: java.lang.classfile.constantpool.PoolEntry java.lang.classfile.ClassReader.readEntryOrNull(int,java.lang.Class): `@since` version: 24; found: 23 src/java.base/java/lang/classfile/constantpool/ConstantPool.java:74 method: java.lang.classfile.constantpool.PoolEntry java.lang.classfile.constantpool.ConstantPool.entryByIndex(int,java.lang.Class): `@since` version: 24; found: 23 src/java.base/java/lang/constant/ClassDesc.java:378 method: java.lang.Class java.lang.constant.ClassDesc.resolveConstantDesc(java.lang.invoke.MethodHandles.Lookup): `@since` version: 12; found: 21 src/java.base/java/lang/constant/MethodTypeDesc.java:226 method: java.lang.invoke.MethodType java.lang.constant.MethodTypeDesc.resolveConstantDesc(java.lang.invoke.MethodHandles.Lookup): `@since` version: 12; found: 21 src/java.base/java/lang/constant/MethodHandleDesc.java:210 method: java.lang.invoke.MethodHandle java.lang.constant.MethodHandleDesc.resolveConstantDesc(java.lang.invoke.MethodHandles.Lookup): `@since` version: 12; found: 21 src/java.base/java/lang/foreign/MemorySegment.java:622 method: long java.lang.foreign.MemorySegment.maxByteAlignment(): `@since` version: 22; found: 23 src/java.base/java/lang/invoke/MethodHandles.java:7923 method: java.lang.invoke.MethodHandle java.lang.invoke.MethodHandles.tableSwitch(java.lang.invoke.MethodHandle,java.lang.invoke.MethodHandle[]): `@since` version: 9; found: 17 src/java.base/java/lang/ref/Reference.java:527 method: java.lang.Object java.lang.ref.Reference.clone(): `@since` version is 11 but the element exists before JDK 10 src/java.base/java/lang/reflect/MalformedParameterizedTypeException.java:54 method: void java.lang.reflect.MalformedParameterizedTypeException.(java.lang.String): `@since` version: 9; found: 10 src/java.base/java/nio/MappedByteBuffer.java:401 method: java.nio.MappedByteBuffer java.nio.MappedByteBuffer.slice(): `@since` version: 9; found: 17 src/java.base/java/nio/MappedByteBuffer.java:414 method: java.nio.MappedByteBuffer java.nio.MappedByteBuffer.slice(int,int): `@since` version: 9; found: 17 src/java.base/java/nio/MappedByteBuffer.java:420 method: java.nio.MappedByteBuffer java.nio.MappedByteBuffer.duplicate(): `@since` version: 9; found: 17 src/java.base/java/nio/MappedByteBuffer.java:427 method: java.nio.MappedByteBuffer java.nio.MappedByteBuffer.compact(): `@since` version: 9; found: 17 src/java.base/java/text/ChoiceFormat.java:589 method: boolean java.text.ChoiceFormat.isStrict(): `@since` version: 9; found: 23 src/java.base/java/text/ChoiceFormat.java:595 method: void java.text.ChoiceFormat.setStrict(boolean): `@since` version: 9; found: 23 src/java.base/java/util/Properties.java:189 method: void java.util.Properties.(int): `@since` version: 9; found: 10 src/java.base/java/util/concurrent/FutureTask.java:208 method: java.lang.Object java.util.concurrent.FutureTask.resultNow(): `@since` version: 9; found: 19 src/java.base/java/util/concurrent/FutureTask.java:224 method: java.lang.Throwable java.util.concurrent.FutureTask.exceptionNow(): `@since` version: 9; found: 19 src/java.base/java/util/concurrent/FutureTask.java:239 method: java.util.concurrent.Future.State java.util.concurrent.FutureTask.state(): `@since` version: 9; found: 19 src/java.base/java/util/concurrent/ThreadLocalRandom.java:504 method: float java.util.concurrent.ThreadLocalRandom.nextFloat(float): `@since` version: 9; found: 17 src/java.base/java/util/concurrent/ThreadLocalRandom.java:514 method: float java.util.concurrent.ThreadLocalRandom.nextFloat(float,float): `@since` version: 9; found: 17 src/java.base/java/util/concurrent/ForkJoinTask.java:890 method: java.util.concurrent.Future.State java.util.concurrent.ForkJoinTask.state(): `@since` version: 9; found: 19 src/java.base/java/util/concurrent/ForkJoinTask.java:899 method: java.lang.Object java.util.concurrent.ForkJoinTask.resultNow(): `@since` version: 9; found: 19 src/java.base/java/util/concurrent/ForkJoinTask.java:913 method: java.lang.Throwable java.util.concurrent.ForkJoinTask.exceptionNow(): `@since` version: 9; found: 19 src/java.base/java/util/concurrent/DelayQueue.java:331 method: java.util.concurrent.Delayed java.util.concurrent.DelayQueue.remove(): `@since` version: 9; found: 21 src/java.base/java/util/concurrent/CompletableFuture.java:2137 method: java.lang.Object java.util.concurrent.CompletableFuture.resultNow(): `@since` version: 9; found: 19 src/java.base/java/util/concurrent/CompletableFuture.java:2152 method: java.lang.Throwable java.util.concurrent.CompletableFuture.exceptionNow(): `@since` version: 9; found: 19 src/java.base/java/util/concurrent/CompletableFuture.java:2399 method: java.util.concurrent.CompletableFuture java.util.concurrent.CompletableFuture.exceptionallyAsync(java.util.function.Function): `@since` version: 9; found: 12 src/java.base/java/util/concurrent/CompletableFuture.java:2404 method: java.util.concurrent.CompletableFuture java.util.concurrent.CompletableFuture.exceptionallyAsync(java.util.function.Function,java.util.concurrent.Executor): `@since` version: 9; found: 12 src/java.base/java/util/concurrent/CompletableFuture.java:2409 method: java.util.concurrent.CompletableFuture java.util.concurrent.CompletableFuture.exceptionallyCompose(java.util.function.Function): `@since` version: 9; found: 12 src/java.base/java/util/concurrent/CompletableFuture.java:2414 method: java.util.concurrent.CompletableFuture java.util.concurrent.CompletableFuture.exceptionallyComposeAsync(java.util.function.Function): `@since` version: 9; found: 12 src/java.base/java/util/concurrent/CompletableFuture.java:2419 method: java.util.concurrent.CompletableFuture java.util.concurrent.CompletableFuture.exceptionallyComposeAsync(java.util.function.Function,java.util.concurrent.Executor): `@since` version: 9; found: 12 src/java.base/java/util/concurrent/CompletableFuture.java:2544 method: java.util.concurrent.Future.State java.util.concurrent.CompletableFuture.state(): `@since` version: 9; found: 19 src/java.base/java/util/zip/Deflater.java:340 method: void java.util.zip.Deflater.setDictionary(java.nio.ByteBuffer): `@since` version: 9; found: 11 java.lang.Exception: The `@since` checker found 37 problems at SinceChecker.checkModule(SinceChecker.java:262) at SinceChecker.main(SinceChecker.java:123) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:333) at java.base/java.lang.Thread.run(Thread.java:1575) JavaTest Message: Test threw exception: java.lang.Exception JavaTest Message: shutting down test TEST RESULT: Failed. Execution failed: `main' threw exception: java.lang.Exception: The `@since` checker found 37 problems -------------------------------------------------- Test results: failed: 1 ------------- PR Comment: https://git.openjdk.org/jdk/pull/18934#issuecomment-2148385307 From nbenalla at openjdk.org Tue Jun 4 20:53:03 2024 From: nbenalla at openjdk.org (Nizar Benalla) Date: Tue, 4 Jun 2024 20:53:03 GMT Subject: RFR: 8331051: Add an `@since` checker test for `java.base` module [v9] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 20:44:30 GMT, Nizar Benalla wrote: >> This checker checks the values of the `@since` tag found in the documentation comment for an element against the release in which the element first appeared. >> >> Real since value of an API element is computed as the oldest release in which the given API element was introduced. That is: >> - for modules, classes and interfaces, the release in which the element with the given qualified name was introduced >> - for constructors, the release in which the constructor with the given VM descriptor was introduced >> - for methods and fields, the release in which the given method or field with the given VM descriptor became a member of its enclosing class or interface, whether direct or inherited >> >> Effective since value of an API element is computed as follows: >> - if the given element has a `@since` tag in its javadoc, it is used >> - in all other cases, return the effective since value of the enclosing element >> >> The since checker verifies that for every API element, the real since value and the effective since value are the same, and reports an error if they are not. >> >> Preview method are handled as per JEP 12, if `@PreviewFeature` is used consistently going forward then the checker doesn't need to be updated with every release. The checker has explicit knowledge of preview elements that came before `JDK 14` because they weren't marked in a machine understandable way and preview elements that came before `JDK 17` that didn't have `@PreviewFeature`. >> >> Important note : We only check code written since `JDK 9` as the releases used to determine the expected value of `@since` tags are taken from the historical data built into `javac` which only goes back that far >> >> The intial comment at the beginning of `SinceChecker.java` holds more information into the program. >> >> I already have filed issues and fixed some wrong tags like in #18640, #18032, #18030, #18055, #18373, #18954, #18972. > > Nizar Benalla has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 17 additional commits since the last revision: > > - Improve checker report messages > - Merge branch 'master' into source-based-since-checker > - - removed unused parameter `i` > - make rest of methods private > - ".toString" instead of "toString" > > Signed-off-by: Nizar Benalla > - Add a few more legacy methods, needed a few more after changes to the checker > - checking for null values directly rather than catching NPE > - Merge remote-tracking branch 'upstream/master' into source-based-since-checker > - Now only skipping the common methods that every record class will have, and will never need a new `@since` > - - Not checking elements enclosed within a record, I doubt a record class will change after being created > - Added a null check as `toString` can return an exception > - - Added some legacy modules that existed long before preview features (they were incubating) > - Not checking elements enclosed withing a record > - Only check if the file is readable using `Files.isReadable` > - Dropped the use of `Files.exists` and `Files.isDirectory` > - Use `--add-modules` option now to resolve certain modules > - mention packages in initial comment > - ... and 7 more: https://git.openjdk.org/jdk/compare/026b5fc2...5be962b7 While this might seem like a lot, if a developer runs it before pushing, they should only encounter a few reports at most. ------------- PR Comment: https://git.openjdk.org/jdk/pull/18934#issuecomment-2148393893 From joehw at openjdk.org Tue Jun 4 21:22:03 2024 From: joehw at openjdk.org (Joe Wang) Date: Tue, 4 Jun 2024 21:22:03 GMT Subject: RFR: 8332750: Broken link in CatalogFeatures.html Message-ID: Fix a broken link. ------------- Commit messages: - 8332750: Broken link in CatalogFeatures.html Changes: https://git.openjdk.org/jdk/pull/19551/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19551&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8332750 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/19551.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19551/head:pull/19551 PR: https://git.openjdk.org/jdk/pull/19551 From lancea at openjdk.org Tue Jun 4 21:39:57 2024 From: lancea at openjdk.org (Lance Andersen) Date: Tue, 4 Jun 2024 21:39:57 GMT Subject: RFR: 8332750: Broken link in CatalogFeatures.html In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 21:17:43 GMT, Joe Wang wrote: > Fix a broken link. Marked as reviewed by lancea (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/19551#pullrequestreview-2097429096 From iris at openjdk.org Tue Jun 4 21:42:56 2024 From: iris at openjdk.org (Iris Clark) Date: Tue, 4 Jun 2024 21:42:56 GMT Subject: RFR: 8332750: Broken link in CatalogFeatures.html In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 21:17:43 GMT, Joe Wang wrote: > Fix a broken link. Marked as reviewed by iris (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/19551#pullrequestreview-2097432388 From naoto at openjdk.org Tue Jun 4 22:37:20 2024 From: naoto at openjdk.org (Naoto Sato) Date: Tue, 4 Jun 2024 22:37:20 GMT Subject: RFR: 8332161: Test restoring echo in the Console implementation (java.base) [v8] In-Reply-To: References: Message-ID: > This test intends to verify the behavior of JdkConsole for the java.base module, wrt restoring the echo. The test assumes the internal methods that sets/gets the echo status of the platform. Naoto Sato has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 26 commits: - Corrected comments - Merge branch 'master' into JDK-8332161-restoreEcho-Test - Check restored echo with stty -a - incorporated the same fix from 8332922 - Merge branch 'master' into JDK-8332161-restoreEcho-Test - Merge branch 'master' into JDK-8332161-restoreEcho-Test - Merge branch 'JDK-8332084-restoreEcho-readLock' into JDK-8332161-restoreEcho-Test - Added comment for restoreEchoLock - fixing typo - Merge branch 'JDK-8332084-restoreEcho-readLock' into JDK-8332161-restoreEcho-Test - ... and 16 more: https://git.openjdk.org/jdk/compare/9686e804...1c0ab8eb ------------- Changes: https://git.openjdk.org/jdk/pull/19315/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19315&range=07 Stats: 158 lines in 2 files changed: 158 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/19315.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19315/head:pull/19315 PR: https://git.openjdk.org/jdk/pull/19315 From naoto at openjdk.org Tue Jun 4 22:44:55 2024 From: naoto at openjdk.org (Naoto Sato) Date: Tue, 4 Jun 2024 22:44:55 GMT Subject: RFR: 8332750: Broken link in CatalogFeatures.html In-Reply-To: References: Message-ID: <1nquc3zcVM03Vh3zOHQ-jBH_E7lLb_BRIpXWuqm_9Uw=.ed4a4b88-d5ad-45ce-9fe6-12ff1040087e@github.com> On Tue, 4 Jun 2024 21:17:43 GMT, Joe Wang wrote: > Fix a broken link. Marked as reviewed by naoto (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/19551#pullrequestreview-2097510057 From bchristi at openjdk.org Tue Jun 4 23:23:56 2024 From: bchristi at openjdk.org (Brent Christian) Date: Tue, 4 Jun 2024 23:23:56 GMT Subject: RFR: 8333462: Performance regression of new DecimalFormat() when compare to jdk11 In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 02:32:28 GMT, lingjun-cg wrote: > Run the below benchmark test ,it show the average time of new DecimalFormat() increase 18% when compare to jdk 11. > > the result with jdk 11: > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testNewOnly avgt 50 248.300 ? 5.158 ns/op > > > the result with current jdk: > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testNewOnly avgt 50 303.381 ? 5.252 ns/op > > > > @BenchmarkMode(Mode.AverageTime) > @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) > @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) > @State(Scope.Thread) > @OutputTimeUnit(TimeUnit.NANOSECONDS) > public class JmhDecimalFormat { > > @Setup(Level.Trial) > public void setup() { > } > > @Benchmark > public void testNewOnly() throws InterruptedException { > new DecimalFormat("#0.00000"); > } > } > > > Compare the flame graph it shows the java.text.DecimalFormatSymbols#findNonFormatChar takes a significant time. > After replacing the lambda implementation with a simple loop , it shows nearly the same performance as jdk 11. > > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testNewOnly avgt 50 209.874 ? 9.951 ns/op > > > [flame-graph-jdk11-jdk21.zip](https://github.com/user-attachments/files/15541764/flame-graph-jdk11-jdk21.zip) Would it be better if the benchmark returned the created `DecimalFormat` ? Just thinking about dead code elimination: https://github.com/openjdk/jmh/blob/master/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_08_DeadCode.java ------------- PR Comment: https://git.openjdk.org/jdk/pull/19534#issuecomment-2148568212 From bchristi at openjdk.org Tue Jun 4 23:29:58 2024 From: bchristi at openjdk.org (Brent Christian) Date: Tue, 4 Jun 2024 23:29:58 GMT Subject: RFR: 8333396: Performance regression of DecimalFormat.format [v4] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 09:07:44 GMT, lingjun-cg wrote: >> ### Performance regression of DecimalFormat.format >> From the output of perf, we can see the hottest regions contain atomic instructions. But when run with JDK 11, there is no such problem. The reason is the removed biased locking. >> The DecimalFormat uses StringBuffer everywhere, and StringBuffer itself contains many synchronized methods. >> So I added support for some new methods that accept StringBuilder which is lock-free. >> >> ### Benchmark testcase >> >> @BenchmarkMode(Mode.AverageTime) >> @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) >> @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) >> @State(Scope.Thread) >> @OutputTimeUnit(TimeUnit.NANOSECONDS) >> public class JmhDecimalFormat { >> >> private DecimalFormat format; >> >> @Setup(Level.Trial) >> public void setup() { >> format = new DecimalFormat("#0.00000"); >> } >> >> @Benchmark >> public void testNewAndFormat() throws InterruptedException { >> new DecimalFormat("#0.00000").format(9524234.1236457); >> } >> >> @Benchmark >> public void testNewOnly() throws InterruptedException { >> new DecimalFormat("#0.00000"); >> } >> >> @Benchmark >> public void testFormatOnly() throws InterruptedException { >> format.format(9524234.1236457); >> } >> } >> >> >> ### Test result >> #### Current JDK before optimize >> >> Benchmark Mode Cnt Score Error Units >> JmhDecimalFormat.testFormatOnly avgt 50 642.099 ? 1.253 ns/op >> JmhDecimalFormat.testNewAndFormat avgt 50 989.307 ? 3.676 ns/op >> JmhDecimalFormat.testNewOnly avgt 50 303.381 ? 5.252 ns/op >> >> >> >> #### Current JDK after optimize >> >> Benchmark Mode Cnt Score Error Units >> JmhDecimalFormat.testFormatOnly avgt 50 351.499 ? 0.761 ns/op >> JmhDecimalFormat.testNewAndFormat avgt 50 615.145 ? 2.478 ns/op >> JmhDecimalFormat.testNewOnly avgt 50 209.874 ? 9.951 ns/op >> >> >> ### JDK 11 >> >> Benchmark Mode Cnt Score Error Units >> JmhDecimalFormat.testFormatOnly avgt 50 364.214 ? 1.191 ns/op >> JmhDecimalFormat.testNewAndFormat avgt 50 658.699 ? 2.311 ns/op >> JmhDecimalFormat.testNewOnly avgt 50 248.300 ? 5.158 ns/op > > lingjun-cg has updated the pull request incrementally with one additional commit since the last revision: > > 8333396: Performance regression of DecimalFormat.format (Same comment as on the [other PR](https://github.com/openjdk/jdk/pull/19534#issuecomment-2148568212).) Would it be better if the benchmarks returned the created DecimalFormats ? Just thinking about dead code elimination: https://github.com/openjdk/jmh/blob/master/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_08_DeadCode.java ------------- PR Comment: https://git.openjdk.org/jdk/pull/19513#issuecomment-2148572775 From liach at openjdk.org Wed Jun 5 00:55:03 2024 From: liach at openjdk.org (Chen Liang) Date: Wed, 5 Jun 2024 00:55:03 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 07:47:46 GMT, SendaoYan wrote: > Hi all, > This PR several extra empty spaces and extra empty lines in several Makefiles. It's trivial fix, no risk. > > Thanks. @altrisi As trivial and low-effort as this seems, this is actually fixing some technical debt for legacy Makefiles last changed before 8e7a855ee8f085cee080395058f79c8a75bfef40 when trailing whitespace checks applied to Makefiles. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19537#issuecomment-2148641237 From nbenalla at openjdk.org Wed Jun 5 01:29:00 2024 From: nbenalla at openjdk.org (Nizar Benalla) Date: Wed, 5 Jun 2024 01:29:00 GMT Subject: RFR: 8332072: Convert package.html files in `java.naming` to package-info.java In-Reply-To: References: Message-ID: On Mon, 3 Jun 2024 17:26:52 GMT, Nizar Benalla wrote: > Can I please get a review for this small change? The motivation is that javac does not recognize `package.html` files. > > The conversion was simple, I used a script to rename the files, append "*" on the left and remove some HTML tags like `` and ``. I did the conversion in place, renaming them in git but with the big amount of change `git` thinks it's a new file. > > I also added a new `package-info.java` file to `javax.naming.ldap.spi`. I hope that's fine. Sure, I will do it for this one. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19529#issuecomment-2148690821 From duke at openjdk.org Wed Jun 5 01:54:12 2024 From: duke at openjdk.org (lingjun-cg) Date: Wed, 5 Jun 2024 01:54:12 GMT Subject: RFR: 8333462: Performance regression of new DecimalFormat() when compare to jdk11 [v2] In-Reply-To: References: Message-ID: > Run the below benchmark test ,it show the average time of new DecimalFormat() increase 18% when compare to jdk 11. > > the result with jdk 11: > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testNewOnly avgt 50 248.300 ? 5.158 ns/op > > > the result with current jdk: > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testNewOnly avgt 50 303.381 ? 5.252 ns/op > > > > @BenchmarkMode(Mode.AverageTime) > @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) > @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) > @State(Scope.Thread) > @OutputTimeUnit(TimeUnit.NANOSECONDS) > public class JmhDecimalFormat { > > @Setup(Level.Trial) > public void setup() { > } > > @Benchmark > public void testNewOnly() throws InterruptedException { > new DecimalFormat("#0.00000"); > } > } > > > Compare the flame graph it shows the java.text.DecimalFormatSymbols#findNonFormatChar takes a significant time. > After replacing the lambda implementation with a simple loop , it shows nearly the same performance as jdk 11. > > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testNewOnly avgt 50 209.874 ? 9.951 ns/op > > > [flame-graph-jdk11-jdk21.zip](https://github.com/user-attachments/files/15541764/flame-graph-jdk11-jdk21.zip) lingjun-cg has updated the pull request incrementally with one additional commit since the last revision: 8333462: Performance regression of new DecimalFormat() when compare to jdk11 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19534/files - new: https://git.openjdk.org/jdk/pull/19534/files/a230ce00..d5b9ccfb Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19534&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19534&range=00-01 Stats: 4 lines in 1 file changed: 1 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/19534.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19534/head:pull/19534 PR: https://git.openjdk.org/jdk/pull/19534 From duke at openjdk.org Wed Jun 5 01:54:12 2024 From: duke at openjdk.org (lingjun-cg) Date: Wed, 5 Jun 2024 01:54:12 GMT Subject: Integrated: 8333462: Performance regression of new DecimalFormat() when compare to jdk11 In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 02:32:28 GMT, lingjun-cg wrote: > Run the below benchmark test ,it show the average time of new DecimalFormat() increase 18% when compare to jdk 11. > > the result with jdk 11: > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testNewOnly avgt 50 248.300 ? 5.158 ns/op > > > the result with current jdk: > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testNewOnly avgt 50 303.381 ? 5.252 ns/op > > > > @BenchmarkMode(Mode.AverageTime) > @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) > @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) > @State(Scope.Thread) > @OutputTimeUnit(TimeUnit.NANOSECONDS) > public class JmhDecimalFormat { > > @Setup(Level.Trial) > public void setup() { > } > > @Benchmark > public void testNewOnly() throws InterruptedException { > new DecimalFormat("#0.00000"); > } > } > > > Compare the flame graph it shows the java.text.DecimalFormatSymbols#findNonFormatChar takes a significant time. > After replacing the lambda implementation with a simple loop , it shows nearly the same performance as jdk 11. > > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testNewOnly avgt 50 209.874 ? 9.951 ns/op > > > [flame-graph-jdk11-jdk21.zip](https://github.com/user-attachments/files/15541764/flame-graph-jdk11-jdk21.zip) This pull request has now been integrated. Changeset: d8261279 Author: lingjun.cg Committer: Denghui Dong URL: https://git.openjdk.org/jdk/commit/d826127970bd2ae8bf4cacc3c55634dc5af307c4 Stats: 8 lines in 1 file changed: 3 ins; 0 del; 5 mod 8333462: Performance regression of new DecimalFormat() when compare to jdk11 Reviewed-by: liach, naoto, jlu ------------- PR: https://git.openjdk.org/jdk/pull/19534 From duke at openjdk.org Wed Jun 5 02:01:56 2024 From: duke at openjdk.org (lingjun-cg) Date: Wed, 5 Jun 2024 02:01:56 GMT Subject: RFR: 8333396: Performance regression of DecimalFormat.format [v4] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 19:44:57 GMT, Naoto Sato wrote: > Also it would be helpful to compare the performance without biased locking in JDK11. If run in JDK11 without biased locking, the performance is as same as run in current JDK. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19513#issuecomment-2148719265 From jpai at openjdk.org Wed Jun 5 02:03:00 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 5 Jun 2024 02:03:00 GMT Subject: RFR: 8329581: Java launcher no longer prints a stack trace [v10] In-Reply-To: <-UOwxqkVlfuaUcyTRnAWx76pUzUHyHV-oBUC4HBP8HA=.df291aa8-2c4e-4771-a68a-a31b91ae8d8b@github.com> References: <-UOwxqkVlfuaUcyTRnAWx76pUzUHyHV-oBUC4HBP8HA=.df291aa8-2c4e-4771-a68a-a31b91ae8d8b@github.com> Message-ID: On Fri, 31 May 2024 14:34:16 GMT, Sonia Zaldana Calles wrote: >> Sonia Zaldana Calles has updated the pull request incrementally with one additional commit since the last revision: >> >> Decreasing diff size addressing unnecessary changes > > Hi all, > > I think there's some consensus that we need some follow up cleanup issues for the JNI spec, renaming constants, fixing return codes, etc. > > Seeing how that grows the scope of the issue quite a bit, I'd like to push this patch and track the other issues brought up separately. > > If there are no objections about the current state, I'd like to integrate some time next week. Let me know your thoughts. > > cc: @jaikiran, @AlanBateman @SoniaZaldana CI testing of this PR along with latest master commits passed without any failures. So you can now integrate this. ------------- PR Comment: https://git.openjdk.org/jdk/pull/18786#issuecomment-2148719775 From joehw at openjdk.org Wed Jun 5 02:56:00 2024 From: joehw at openjdk.org (Joe Wang) Date: Wed, 5 Jun 2024 02:56:00 GMT Subject: RFR: 8332750: Broken link in CatalogFeatures.html In-Reply-To: References: Message-ID: <5aAgylOHQlZImmPrg1OGWFTF1FDbJnewyR5Jhv5N_co=.5485424f-f315-4c75-89d9-82401bb1209d@github.com> On Tue, 4 Jun 2024 21:17:43 GMT, Joe Wang wrote: > Fix a broken link. Thanks all! ------------- PR Comment: https://git.openjdk.org/jdk/pull/19551#issuecomment-2148759156 From joehw at openjdk.org Wed Jun 5 02:56:00 2024 From: joehw at openjdk.org (Joe Wang) Date: Wed, 5 Jun 2024 02:56:00 GMT Subject: Integrated: 8332750: Broken link in CatalogFeatures.html In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 21:17:43 GMT, Joe Wang wrote: > Fix a broken link. This pull request has now been integrated. Changeset: 9db7c950 Author: Joe Wang URL: https://git.openjdk.org/jdk/commit/9db7c950190853513f4c2afa0efa9a4ff72b60d7 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod 8332750: Broken link in CatalogFeatures.html Reviewed-by: lancea, iris, naoto ------------- PR: https://git.openjdk.org/jdk/pull/19551 From duke at openjdk.org Wed Jun 5 03:59:24 2024 From: duke at openjdk.org (lingjun-cg) Date: Wed, 5 Jun 2024 03:59:24 GMT Subject: RFR: 8333396: Performance regression of DecimalFormat.format [v5] In-Reply-To: References: Message-ID: > ### Performance regression of DecimalFormat.format > From the output of perf, we can see the hottest regions contain atomic instructions. But when run with JDK 11, there is no such problem. The reason is the removed biased locking. > The DecimalFormat uses StringBuffer everywhere, and StringBuffer itself contains many synchronized methods. > So I added support for some new methods that accept StringBuilder which is lock-free. > > ### Benchmark testcase > > @BenchmarkMode(Mode.AverageTime) > @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) > @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) > @State(Scope.Thread) > @OutputTimeUnit(TimeUnit.NANOSECONDS) > public class JmhDecimalFormat { > > private DecimalFormat format; > > @Setup(Level.Trial) > public void setup() { > format = new DecimalFormat("#0.00000"); > } > > @Benchmark > public void testNewAndFormat() throws InterruptedException { > new DecimalFormat("#0.00000").format(9524234.1236457); > } > > @Benchmark > public void testNewOnly() throws InterruptedException { > new DecimalFormat("#0.00000"); > } > > @Benchmark > public void testFormatOnly() throws InterruptedException { > format.format(9524234.1236457); > } > } > > > ### Test result > #### Current JDK before optimize > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testFormatOnly avgt 50 642.099 ? 1.253 ns/op > JmhDecimalFormat.testNewAndFormat avgt 50 989.307 ? 3.676 ns/op > JmhDecimalFormat.testNewOnly avgt 50 303.381 ? 5.252 ns/op > > > > #### Current JDK after optimize > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testFormatOnly avgt 50 351.499 ? 0.761 ns/op > JmhDecimalFormat.testNewAndFormat avgt 50 615.145 ? 2.478 ns/op > JmhDecimalFormat.testNewOnly avgt 50 209.874 ? 9.951 ns/op > > > ### JDK 11 > > Benchmark Mode Cnt Score Error Units > JmhDecimalFormat.testFormatOnly avgt 50 364.214 ? 1.191 ns/op > JmhDecimalFormat.testNewAndFormat avgt 50 658.699 ? 2.311 ns/op > JmhDecimalFormat.testNewOnly avgt 50 248.300 ? 5.158 ns/op lingjun-cg has updated the pull request incrementally with one additional commit since the last revision: 8333396: Performance regression of DecimalFormat.format ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19513/files - new: https://git.openjdk.org/jdk/pull/19513/files/6210c61e..1ab65e18 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19513&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19513&range=03-04 Stats: 45 lines in 8 files changed: 37 ins; 0 del; 8 mod Patch: https://git.openjdk.org/jdk/pull/19513.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19513/head:pull/19513 PR: https://git.openjdk.org/jdk/pull/19513 From almatvee at openjdk.org Wed Jun 5 04:36:02 2024 From: almatvee at openjdk.org (Alexander Matveev) Date: Wed, 5 Jun 2024 04:36:02 GMT Subject: RFR: 8319457: Update jpackage to support WiX Toolset 4 on Windows [v4] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 16:07:18 GMT, Alexey Semenyuk wrote: >> Add support for WiX4 (and WiX5) in jpackage. >> >> jpackage supports WiX3, WiX4 and WiX5. It will pick WiX4/WiX5 if one of them is installed and there is WiX3 installed too. (Note: WiX4 and WiX5 are not supposed to be installed side-by-side, but if it happens, WiX5 will be preferred over WiX4). >> >> Custom WiX3 sources will be automatically converted to WiX4 format if WiX4/WiX5 is used. The converter provides: >> >> - full support of the conversion of WiX L10N (.wxl) files, i.e. full support of "http://schemas.microsoft.com/wix/2006/localization" to "http://wixtoolset.org/schemas/v4/wxl" namespace conversion; >> - partial support of WiX source (.wxs) files, i.e. partial support of "http://schemas.microsoft.com/wix/2006/wi" to "http://wixtoolset.org/schemas/v4/wxs" namespace conversion; >> >> The converter is a XSLT stylesheet. The default converter is `src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/wix3-to-wix4-conv.xsl`. It can be replaced with the custom converter by adding "wix-conv.xsl" file to the resource directory. > > Alexey Semenyuk has updated the pull request incrementally with two additional commits since the last revision: > > - WixSourceConverter#applyTo should do what OverridableResource#saveToFile() does: create parent directory and replace output file if it exists. > - Fix issue with overwriting custom l10n file in the resource directory. All WiX source files from the resource directory should be copied to jpackage work directory before running wxi tools. jpackage should not change files in the resource directory. src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixAppImageFragmentBuilder.java line 157: > 155: > 156: @Override > 157: List getLoggableWixFeatures() { Maybe I am missing something, but is it used? I only see call to base class `WixFragmentBuilder::getLoggableWixFeatures`. src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources.properties line 44: > 42: resource.installdirnotemptydlg-wix-file=Not empty install directory dialog WiX project file > 43: resource.launcher-as-service-wix-file=Service installer WiX project file > 44: resource.wix-src-conv=XSLT stylesheet converting WiX sources from WiX v3 to WiX v4 format WiX v4 -> WiX v4/v5 src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources.properties line 46: > 44: resource.wix-src-conv=XSLT stylesheet converting WiX sources from WiX v3 to WiX v4 format > 45: > 46: error.no-wix-tools=Can not find WiX tools. Was looking for WiX v3 light.exe and candle.exe or WiX v4 wix.exe and none was found WiX v4 -> WiX v4/v5 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19318#discussion_r1626887692 PR Review Comment: https://git.openjdk.org/jdk/pull/19318#discussion_r1626907533 PR Review Comment: https://git.openjdk.org/jdk/pull/19318#discussion_r1626909859 From duke at openjdk.org Wed Jun 5 04:44:02 2024 From: duke at openjdk.org (David Alayachew) Date: Wed, 5 Jun 2024 04:44:02 GMT Subject: RFR: 8330005: RandomGeneratorFactory.getDefault() throws exception when the runtime image only has java.base module [v7] In-Reply-To: References: Message-ID: <1A1-Oho1unVU40_M9kIkuTY43sNrNRWy8ZtIpcJ4CP0=.e3afed26-7d36-44e4-9327-bb834ec2314e@github.com> On Wed, 8 May 2024 08:30:39 GMT, Raffaello Giulietti wrote: >> Move all random generators mandated in package `java.util.random` and currently implemented in module `jdk.random` to module `java.base`, and remove module `jdk.random`. > > Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision: > > Removed empty line. Hey, I'm just curious -- why was the solution to remove an entire module? I understand the point of moving the relevant code over to `java.base`, but I don't understand why removing the random module made sense. ------------- PR Comment: https://git.openjdk.org/jdk/pull/18932#issuecomment-2148842095 From alanb at openjdk.org Wed Jun 5 05:03:04 2024 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 5 Jun 2024 05:03:04 GMT Subject: RFR: 8330005: RandomGeneratorFactory.getDefault() throws exception when the runtime image only has java.base module [v7] In-Reply-To: <1A1-Oho1unVU40_M9kIkuTY43sNrNRWy8ZtIpcJ4CP0=.e3afed26-7d36-44e4-9327-bb834ec2314e@github.com> References: <1A1-Oho1unVU40_M9kIkuTY43sNrNRWy8ZtIpcJ4CP0=.e3afed26-7d36-44e4-9327-bb834ec2314e@github.com> Message-ID: On Wed, 5 Jun 2024 04:41:48 GMT, David Alayachew wrote: > Hey, I'm just curious -- why was the solution to remove an entire module? I understand the point of moving the relevant code over to `java.base`, but I don't understand why removing the random module made sense. With the implementations moved, the jdk.random module didn't contain any classes. A placeholder module could have been left in place for this using jlink that might have a script that adds this module but it didn't seem worth it to do this for a release or two. It was a different answer for jdk.cryto.ec before it was removed. That module existed since JDK 9 so more likely be used in jlink scripts. ------------- PR Comment: https://git.openjdk.org/jdk/pull/18932#issuecomment-2148858435 From duke at openjdk.org Wed Jun 5 05:28:06 2024 From: duke at openjdk.org (David Alayachew) Date: Wed, 5 Jun 2024 05:28:06 GMT Subject: RFR: 8330005: RandomGeneratorFactory.getDefault() throws exception when the runtime image only has java.base module [v7] In-Reply-To: References: Message-ID: On Wed, 8 May 2024 08:30:39 GMT, Raffaello Giulietti wrote: >> Move all random generators mandated in package `java.util.random` and currently implemented in module `jdk.random` to module `java.base`, and remove module `jdk.random`. > > Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision: > > Removed empty line. oh lol, makes sense then. It's wild though -- I always thought that deleting an entire module would count as a backwards incompatible thing. On Wed, Jun 5, 2024 at 1:00?AM Alan Bateman ***@***.***> wrote: > Hey, I'm just curious -- why was the solution to remove an entire module? > I understand the point of moving the relevant code over to java.base, but > I don't understand why removing the random module made sense. > > With the implementations moved, the jdk.random module didn't contain any > classes. A placeholder module could have been left in place for this using > jlink that might have a script that adds this module but it didn't seem > worth it to do this for a release or two. It was a different answer for > jdk.cryto.ec before it was removed. That module existed since JDK 9 so > more likely be used in jlink scripts. > > ? > Reply to this email directly, view it on GitHub > , or > unsubscribe > > . > You are receiving this because you commented.Message ID: > ***@***.***> > ------------- PR Comment: https://git.openjdk.org/jdk/pull/18932#issuecomment-2148883348 From thartmann at openjdk.org Wed Jun 5 05:42:57 2024 From: thartmann at openjdk.org (Tobias Hartmann) Date: Wed, 5 Jun 2024 05:42:57 GMT Subject: RFR: 8333334: C2: Make result of `Node::dominates` more precise to enhance scalar replacement In-Reply-To: References: Message-ID: On Fri, 31 May 2024 09:01:38 GMT, MaxXing wrote: > This patch changes the algorithm of `Node::dominates` to make the result more precise, and allows the iterators of `ConcurrentHashMap` to be scalar replaced. > > The previous algorithm will return a conservative result when encountering a dead control flow, and only try the first two input paths of a multi-input Region node, which may prevent the scalar replacement in some cases. > > For example, with G1 GC enabled, C2 generates GC barriers for `ConcurrentHashMap` iteration operations at some early phases, and then eliminates them in a later IGVN, but `LoadNode` is also idealized in the same IGVN. This causes `LoadNode::Ideal` to see some dead barrier control flows, and refuse to split some instance field loads through Phi due to the conservative result of `Node::dominates`, and thus the scalar replacement can not be applied to iterators in the later macro elimination phase. > > This patch allows `Node::dominates` to try other paths of the last multi-input Region node when the first path is dead, and makes `ConcurrentHashMap` iteration ~30% faster: > > > Benchmark (nkeys) Mode Cnt Score Error Units > Maps.testConcurrentHashMapIterators 10000 avgt 15 414099.085 ? 33230.945 ns/op # baseline > Maps.testConcurrentHashMapIterators 10000 avgt 15 315490.281 ? 3037.056 ns/op # patch > > > Testing: tier1-4. Impressive results! I haven't looked at the change yet but here are a few questions / requests: - Could you add a screenshot of the IR of the case you are describing? - Wouldn't it help to add the LoadNode back to the IGVN worklist and wait for the dead path to be removed? - Could you add an [IR framework](https://github.com/openjdk/jdk/blob/master/test/hotspot/jtreg/compiler/lib/ir_framework/README.md) test that verifies that the optimization works as expected? Thanks, Tobias ------------- PR Review: https://git.openjdk.org/jdk/pull/19496#pullrequestreview-2098076379 From jlahoda at openjdk.org Wed Jun 5 05:59:16 2024 From: jlahoda at openjdk.org (Jan Lahoda) Date: Wed, 5 Jun 2024 05:59:16 GMT Subject: RFR: 8333086: Using Console.println is unnecessarily slow due to JLine initalization [v2] In-Reply-To: References: Message-ID: > Consider these two programs: > > > public class SystemPrint { > public static void main(String... args) { > System.err.println("Hello!"); > } > } > > and: > > public class IOPrint { > public static void main(String... args) { > java.io.IO.println("Hello!"); > } > } > > > They do the same conceptual thing - write a text to the output. But, `IO.println` delegates to `Console.println`, which then delegates to a `Console` backend, and the default backend is currently based on JLine. > > The issues is that JLine takes a quite a long time to initialize, and in a program like this, JLine is not really needed - it is used to provide better editing experience when reading input, but there's no reading in these programs. > > For example, on my computer: > > $ time java -classpath /tmp SystemPrint > Hello! > > real 0m0,035s > user 0m0,019s > sys 0m0,019s > > $ time java -classpath /tmp --enable-preview IOPrint > Hello! > > real 0m0,165s > user 0m0,324s > sys 0m0,042s > > > The proposal herein is to delegate to the simpler `Console` backend from `java.base` as long as the user only uses methods that print to output, and switch to the JLine delegate when other methods (typically input) is used. Note that while technically `writer()` is a method doing output, it will force JLine initialization to avoid possible problems if the client caches the writer and uses it after switching the delegates. > > With this patch, I can get timing like this: > > $ time java --enable-preview -classpath /tmp/ IOPrint > Hello! > > real 0m0,051s > user 0m0,038s > sys 0m0,020s > > > which seems much more acceptable. > > There is also #19467, which may reduce the time further. > > A future work might focus on making JLine initialize faster, but avoiding JLine initialization in case where we don't need it seems like a good step to me in any case. Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision: Reflecting review feedback - explicitly selecting the jdk.internal.le provider in the test. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19479/files - new: https://git.openjdk.org/jdk/pull/19479/files/9886732e..7a0c448f Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19479&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19479&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/19479.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19479/head:pull/19479 PR: https://git.openjdk.org/jdk/pull/19479 From thartmann at openjdk.org Wed Jun 5 11:21:09 2024 From: thartmann at openjdk.org (Tobias Hartmann) Date: Wed, 5 Jun 2024 11:21:09 GMT Subject: RFR: 8329538: Accelerate P256 on x86_64 using Montgomery intrinsic [v12] In-Reply-To: <2HF_LGpK7B6i1UcgJ8g9JgzGF27gVAHZkGnVQk-Fo4w=.98339735-cd89-4059-a449-6a4911e9af41@github.com> References: <2HF_LGpK7B6i1UcgJ8g9JgzGF27gVAHZkGnVQk-Fo4w=.98339735-cd89-4059-a449-6a4911e9af41@github.com> Message-ID: On Wed, 22 May 2024 14:19:36 GMT, Volodymyr Paprotski wrote: >> Volodymyr Paprotski has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 17 additional commits since the last revision: >> >> - Merge remote-tracking branch 'origin/master' into ecc-montgomery >> - shenandoah verifier >> - comments from Sandhya >> - whitespace >> - add message back >> - whitespace >> - Use AffinePoint to exit Montgomery domain >> >> Style notes: >> Affine.equals() >> - Mismatched fields only appear to be used from testing, perhaps should be moved there instead >> Affine.getX(boolean)|getY(boolean) >> - "Passing flag is bad design" - cleanest/performant alternative to several instanceof checks >> - needed to convert Affine to Projective (need to stay in montgomery domain) >> ECOperations.PointMultiplier >> - changes could probably be restored to original (since ProjectivePoint handling no longer required) >> - consider these changes an improvement? (fewer nested classes) >> - was an inner-class but not using inner-class features (i.e. ecOps variable should be converted) >> - whitespace >> - Comments from Tony and Jatin >> - Comments from Jatin and Tony >> - ... and 7 more: https://git.openjdk.org/jdk/compare/1adfff34...b1a33004 > > Thanks Tobi! Unfortunately, this caused a performance regression, see [JDK-8333583](https://bugs.openjdk.org/browse/JDK-8333583). @vpaprotsk, please have a look. ------------- PR Comment: https://git.openjdk.org/jdk/pull/18583#issuecomment-2149576062 From jpai at openjdk.org Wed Jun 5 11:45:10 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 5 Jun 2024 11:45:10 GMT Subject: RFR: 8206447: InflaterInputStream.skip receives long but it's limited to Integer.MAX_VALUE [v3] In-Reply-To: References: Message-ID: > Can I please get a review of this change which updates the API specification of `java.util.zip.InflaterInputStream.skip()` method to match its current implementation? > > `InflaterInputStream.skip()`, just like `DeflaterInputStream.skip()`, takes a `long` value `n` representing the number of bytes to skip. When a value greater than `Integer.MAX_VALUE` is passed to this `InflaterInputStream.skip()` method, the current implementation in that method only skips at most `Integer.MAX_VALUE` bytes. `DeflaterInputStream.skip()` too has the same behaviour. However, in the case of `DeflaterInputStream.skip()`, this semantic is clearly noted in that method's API documentation. `InflaterInputStream.skip()` currently doesn't specify this behaviour. > > The commit in this PR updates the `InflaterInputStream.skip()` to specify the current implementation. > > I'll open a CSR for this change. Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: review feedback updates from the CSR ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19515/files - new: https://git.openjdk.org/jdk/pull/19515/files/e13e65d2..a43e96de Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19515&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19515&range=01-02 Stats: 12 lines in 2 files changed: 2 ins; 2 del; 8 mod Patch: https://git.openjdk.org/jdk/pull/19515.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19515/head:pull/19515 PR: https://git.openjdk.org/jdk/pull/19515 From alanb at openjdk.org Wed Jun 5 11:48:01 2024 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 5 Jun 2024 11:48:01 GMT Subject: RFR: 8322732: ForkJoinPool may underutilize cores in async mode [v17] In-Reply-To: References: Message-ID: On Fri, 31 May 2024 13:18:33 GMT, Doug Lea
wrote: >> This set of changes address causes of poor utilization with small numbers of cores due to overly aggressive contention avoidance. A number of further adjustments were needed to still avoid most contention effects in deployments with large numbers of cores > > Doug Lea has updated the pull request incrementally with one additional commit since the last revision: > > Reconcile changes Viktor (mostly) and I have been testing and reviewing these changes at each iteration. I think we are happy with where things are at, significantly very positive in some of the streams/gatherer tests. The Starvation test is the canary to catch a scenario that has been observed along the way, but not with the current version. So I think this is good to integrate. ------------- Marked as reviewed by alanb (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19131#pullrequestreview-2098894992 From asotona at openjdk.org Wed Jun 5 12:00:25 2024 From: asotona at openjdk.org (Adam Sotona) Date: Wed, 5 Jun 2024 12:00:25 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v19] In-Reply-To: References: Message-ID: > [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use classfile API for reflection proxy-generation. Actual implementation of `ProxyGenerator` is focused on performance, however it causes JDK bootstrap regressions. `ProxyGenerator.TEMPLATE` class model is statically created and each proxy class is transformed from the template. > > This patch is intended to examine plain proxy generation impact on performance and JDK bootstrap (vs proxy transformation from template). > > The generated proxy is migrated from static initialization to CONDY bootstrap. > > Please review. > > Thank you, > Adam Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: An assortment of potential improvements Co-authored-by: Claes Redestad ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19410/files - new: https://git.openjdk.org/jdk/pull/19410/files/6ca164bc..54376fe8 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19410&range=18 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19410&range=17-18 Stats: 25 lines in 5 files changed: 15 ins; 0 del; 10 mod Patch: https://git.openjdk.org/jdk/pull/19410.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19410/head:pull/19410 PR: https://git.openjdk.org/jdk/pull/19410 From jpai at openjdk.org Wed Jun 5 12:14:07 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 5 Jun 2024 12:14:07 GMT Subject: RFR: 8206447: InflaterInputStream.skip receives long but it's limited to Integer.MAX_VALUE [v4] In-Reply-To: References: Message-ID: <9UlaEbxrgbKs_KSP9pbE84Ws41jEDmEPZVEm3VjZbCc=.4abfbe92-731c-4014-97fc-c5e3a1e9878b@github.com> > Can I please get a review of this change which updates the API specification of `java.util.zip.InflaterInputStream.skip()` method to match its current implementation? > > `InflaterInputStream.skip()`, just like `DeflaterInputStream.skip()`, takes a `long` value `n` representing the number of bytes to skip. When a value greater than `Integer.MAX_VALUE` is passed to this `InflaterInputStream.skip()` method, the current implementation in that method only skips at most `Integer.MAX_VALUE` bytes. `DeflaterInputStream.skip()` too has the same behaviour. However, in the case of `DeflaterInputStream.skip()`, this semantic is clearly noted in that method's API documentation. `InflaterInputStream.skip()` currently doesn't specify this behaviour. > > The commit in this PR updates the `InflaterInputStream.skip()` to specify the current implementation. > > I'll open a CSR for this change. Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: clarify blocking semantic ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19515/files - new: https://git.openjdk.org/jdk/pull/19515/files/a43e96de..b7b870d5 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19515&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19515&range=02-03 Stats: 4 lines in 2 files changed: 0 ins; 0 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/19515.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19515/head:pull/19515 PR: https://git.openjdk.org/jdk/pull/19515 From asotona at openjdk.org Wed Jun 5 12:14:58 2024 From: asotona at openjdk.org (Adam Sotona) Date: Wed, 5 Jun 2024 12:14:58 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v19] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 12:00:25 GMT, Adam Sotona wrote: >> [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use classfile API for reflection proxy-generation. Actual implementation of `ProxyGenerator` is focused on performance, however it causes JDK bootstrap regressions. `ProxyGenerator.TEMPLATE` class model is statically created and each proxy class is transformed from the template. >> >> This patch is intended to examine plain proxy generation impact on performance and JDK bootstrap (vs proxy transformation from template). >> >> The generated proxy is migrated from static initialization to CONDY bootstrap. >> >> Please review. >> >> Thank you, >> Adam > > Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: > > An assortment of potential improvements > > Co-authored-by: Claes Redestad Name Cnt Base Error Test Error Unit Change Perfstartup-JMH 20 40.000 ? 0.000 40.000 ? 0.000 ms/op 1.00x (p = 0.000 ) :.cycles 236365197.300 ? 3630668.331 224263724.700 ? 4160144.635 cycles 0.95x (p = 0.000*) :.instructions 602001346.250 ? 3134647.039 574894340.900 ? 2297441.310 instructions 0.95x (p = 0.000*) :.taskclock 60.000 ? 0.000 58.500 ? 3.181 ms 0.98x (p = 0.083 ) * = significant ------------- PR Comment: https://git.openjdk.org/jdk/pull/19410#issuecomment-2149681885 From alanb at openjdk.org Wed Jun 5 12:21:57 2024 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 5 Jun 2024 12:21:57 GMT Subject: RFR: 8206447: InflaterInputStream.skip receives long but it's limited to Integer.MAX_VALUE [v4] In-Reply-To: <9UlaEbxrgbKs_KSP9pbE84Ws41jEDmEPZVEm3VjZbCc=.4abfbe92-731c-4014-97fc-c5e3a1e9878b@github.com> References: <9UlaEbxrgbKs_KSP9pbE84Ws41jEDmEPZVEm3VjZbCc=.4abfbe92-731c-4014-97fc-c5e3a1e9878b@github.com> Message-ID: On Wed, 5 Jun 2024 12:14:07 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which updates the API specification of `java.util.zip.InflaterInputStream.skip()` method to match its current implementation? >> >> `InflaterInputStream.skip()`, just like `DeflaterInputStream.skip()`, takes a `long` value `n` representing the number of bytes to skip. When a value greater than `Integer.MAX_VALUE` is passed to this `InflaterInputStream.skip()` method, the current implementation in that method only skips at most `Integer.MAX_VALUE` bytes. `DeflaterInputStream.skip()` too has the same behaviour. However, in the case of `DeflaterInputStream.skip()`, this semantic is clearly noted in that method's API documentation. `InflaterInputStream.skip()` currently doesn't specify this behaviour. >> >> The commit in this PR updates the `InflaterInputStream.skip()` to specify the current implementation. >> >> I'll open a CSR for this change. > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > clarify blocking semantic This went through a few iterations in the CSR issue, looking good now. ------------- Marked as reviewed by alanb (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19515#pullrequestreview-2098975614 From asotona at openjdk.org Wed Jun 5 12:21:59 2024 From: asotona at openjdk.org (Adam Sotona) Date: Wed, 5 Jun 2024 12:21:59 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v19] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 12:00:25 GMT, Adam Sotona wrote: >> [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use classfile API for reflection proxy-generation. Actual implementation of `ProxyGenerator` is focused on performance, however it causes JDK bootstrap regressions. `ProxyGenerator.TEMPLATE` class model is statically created and each proxy class is transformed from the template. >> >> This patch is intended to examine plain proxy generation impact on performance and JDK bootstrap (vs proxy transformation from template). >> >> The generated proxy is migrated from static initialization to CONDY bootstrap. >> >> Please review. >> >> Thank you, >> Adam > > Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: > > An assortment of potential improvements > > Co-authored-by: Claes Redestad Benchmark Mode Cnt Score Error Units ProxyGenBench.generate100Proxies(master) ss 10 15.295 ? 5.435 ms/op ProxyGenBench.generate100Proxies(#19410) ss 10 11.761 ? 3.323 ms/op Finished running test 'micro:.+ProxyGenBench.+' ------------- PR Comment: https://git.openjdk.org/jdk/pull/19410#issuecomment-2149694078 From redestad at openjdk.org Wed Jun 5 12:27:58 2024 From: redestad at openjdk.org (Claes Redestad) Date: Wed, 5 Jun 2024 12:27:58 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v19] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 12:00:25 GMT, Adam Sotona wrote: >> [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use classfile API for reflection proxy-generation. Actual implementation of `ProxyGenerator` is focused on performance, however it causes JDK bootstrap regressions. `ProxyGenerator.TEMPLATE` class model is statically created and each proxy class is transformed from the template. >> >> This patch is intended to examine plain proxy generation impact on performance and JDK bootstrap (vs proxy transformation from template). >> >> The generated proxy is migrated from static initialization to CONDY bootstrap. >> >> Please review. >> >> Thank you, >> Adam > > Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: > > An assortment of potential improvements > > Co-authored-by: Claes Redestad Looks good. Generation of proxy classes gets a nice boost this way. The condy bsm calls that may happen later takes a small hit which we can improve in a follow-up. ------------- Marked as reviewed by redestad (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19410#pullrequestreview-2098990024 From vklang at openjdk.org Wed Jun 5 12:33:05 2024 From: vklang at openjdk.org (Viktor Klang) Date: Wed, 5 Jun 2024 12:33:05 GMT Subject: RFR: 8322732: ForkJoinPool may underutilize cores in async mode [v17] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 11:45:10 GMT, Alan Bateman wrote: >> Doug Lea has updated the pull request incrementally with one additional commit since the last revision: >> >> Reconcile changes > > Viktor (mostly) and I have been testing and reviewing these changes at each iteration. I think we are happy with where things are at, significantly very positive in some of the streams/gatherer tests. The Starvation test is the canary to catch a scenario that has been observed along the way, but not with the current version. So I think this is good to integrate. Seconding @AlanBateman, I've reviewed and provided feedback on this PR multiple times, and have had numerous runs of parallel streams / gatherers and I think this is good to go. If I was a reviewer my vote would matter, but I'm adding this comment here as an "enthusiastic supporter". :) ------------- PR Comment: https://git.openjdk.org/jdk/pull/19131#issuecomment-2149714806 From jlahoda at openjdk.org Wed Jun 5 12:36:33 2024 From: jlahoda at openjdk.org (Jan Lahoda) Date: Wed, 5 Jun 2024 12:36:33 GMT Subject: RFR: 8333086: Using Console.println is unnecessarily slow due to JLine initalization [v3] In-Reply-To: References: Message-ID: > Consider these two programs: > > > public class SystemPrint { > public static void main(String... args) { > System.err.println("Hello!"); > } > } > > and: > > public class IOPrint { > public static void main(String... args) { > java.io.IO.println("Hello!"); > } > } > > > They do the same conceptual thing - write a text to the output. But, `IO.println` delegates to `Console.println`, which then delegates to a `Console` backend, and the default backend is currently based on JLine. > > The issues is that JLine takes a quite a long time to initialize, and in a program like this, JLine is not really needed - it is used to provide better editing experience when reading input, but there's no reading in these programs. > > For example, on my computer: > > $ time java -classpath /tmp SystemPrint > Hello! > > real 0m0,035s > user 0m0,019s > sys 0m0,019s > > $ time java -classpath /tmp --enable-preview IOPrint > Hello! > > real 0m0,165s > user 0m0,324s > sys 0m0,042s > > > The proposal herein is to delegate to the simpler `Console` backend from `java.base` as long as the user only uses methods that print to output, and switch to the JLine delegate when other methods (typically input) is used. Note that while technically `writer()` is a method doing output, it will force JLine initialization to avoid possible problems if the client caches the writer and uses it after switching the delegates. > > With this patch, I can get timing like this: > > $ time java --enable-preview -classpath /tmp/ IOPrint > Hello! > > real 0m0,051s > user 0m0,038s > sys 0m0,020s > > > which seems much more acceptable. > > There is also #19467, which may reduce the time further. > > A future work might focus on making JLine initialize faster, but avoiding JLine initialization in case where we don't need it seems like a good step to me in any case. Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision: Correctly reflecting review feedback ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19479/files - new: https://git.openjdk.org/jdk/pull/19479/files/7a0c448f..f3259793 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19479&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19479&range=01-02 Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/19479.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19479/head:pull/19479 PR: https://git.openjdk.org/jdk/pull/19479 From liach at openjdk.org Wed Jun 5 12:43:01 2024 From: liach at openjdk.org (Chen Liang) Date: Wed, 5 Jun 2024 12:43:01 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v19] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 12:00:25 GMT, Adam Sotona wrote: >> [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use classfile API for reflection proxy-generation. Actual implementation of `ProxyGenerator` is focused on performance, however it causes JDK bootstrap regressions. `ProxyGenerator.TEMPLATE` class model is statically created and each proxy class is transformed from the template. >> >> This patch is intended to examine plain proxy generation impact on performance and JDK bootstrap (vs proxy transformation from template). >> >> The generated proxy is migrated from static initialization to CONDY bootstrap. >> >> Please review. >> >> Thank you, >> Adam > > Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: > > An assortment of potential improvements > > Co-authored-by: Claes Redestad src/java.base/share/classes/java/lang/constant/ConstantDescs.java line 356: > 354: ClassDesc[] fullParamTypes = new ClassDesc[paramTypes.length + prefixLen]; > 355: System.arraycopy(INDY_BOOTSTRAP_ARGS, 0, fullParamTypes, 0, prefixLen); > 356: System.arraycopy(paramTypes, 0, fullParamTypes, prefixLen, paramTypes.length); I'm thinking about creating a basic MethodTypeDesc like `INDY_BOOTSTRAP_TYPE = MethodTypeDesc.ofValidated(CD_Object, INDY_BOOTSTRAP_ARGS)`, and we derive bsm with INDY_BOOTSTRAP_TYPE .insertParameterTypes(INDY_BOOTSTRAP_TYPE.parameterCount(), paramTypes) .changeReturnType(returnType) which creates two MTD wrappers but they share the same parameter array test/micro/org/openjdk/bench/java/lang/reflect/ProxyGenBench.java line 2: > 1: /* > 2: * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. Suggestion: * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19410#discussion_r1627683294 PR Review Comment: https://git.openjdk.org/jdk/pull/19410#discussion_r1627685503 From asotona at openjdk.org Wed Jun 5 12:50:25 2024 From: asotona at openjdk.org (Adam Sotona) Date: Wed, 5 Jun 2024 12:50:25 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v20] In-Reply-To: References: Message-ID: > [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use classfile API for reflection proxy-generation. Actual implementation of `ProxyGenerator` is focused on performance, however it causes JDK bootstrap regressions. `ProxyGenerator.TEMPLATE` class model is statically created and each proxy class is transformed from the template. > > This patch is intended to examine plain proxy generation impact on performance and JDK bootstrap (vs proxy transformation from template). > > The generated proxy is migrated from static initialization to CONDY bootstrap. > > Please review. > > Thank you, > Adam Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: Update test/micro/org/openjdk/bench/java/lang/reflect/ProxyGenBench.java Co-authored-by: Chen Liang ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19410/files - new: https://git.openjdk.org/jdk/pull/19410/files/54376fe8..a0822718 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19410&range=19 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19410&range=18-19 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/19410.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19410/head:pull/19410 PR: https://git.openjdk.org/jdk/pull/19410 From dl at openjdk.org Wed Jun 5 13:05:10 2024 From: dl at openjdk.org (Doug Lea) Date: Wed, 5 Jun 2024 13:05:10 GMT Subject: Integrated: 8322732: ForkJoinPool may underutilize cores in async mode In-Reply-To: References: Message-ID: On Tue, 7 May 2024 22:50:18 GMT, Doug Lea
wrote: > This set of changes address causes of poor utilization with small numbers of cores due to overly aggressive contention avoidance. A number of further adjustments were needed to still avoid most contention effects in deployments with large numbers of cores This pull request has now been integrated. Changeset: 789f704d Author: Doug Lea
URL: https://git.openjdk.org/jdk/commit/789f704d9ab5aaf87193f508859c4c9a528d7779 Stats: 735 lines in 2 files changed: 250 ins; 184 del; 301 mod 8322732: ForkJoinPool may underutilize cores in async mode 8327854: Test java/util/stream/test/org/openjdk/tests/java/util/stream/WhileOpStatefulTest.java failed with RuntimeException Reviewed-by: alanb ------------- PR: https://git.openjdk.org/jdk/pull/19131 From szaldana at openjdk.org Wed Jun 5 13:09:10 2024 From: szaldana at openjdk.org (Sonia Zaldana Calles) Date: Wed, 5 Jun 2024 13:09:10 GMT Subject: RFR: 8329581: Java launcher no longer prints a stack trace [v10] In-Reply-To: <-UOwxqkVlfuaUcyTRnAWx76pUzUHyHV-oBUC4HBP8HA=.df291aa8-2c4e-4771-a68a-a31b91ae8d8b@github.com> References: <-UOwxqkVlfuaUcyTRnAWx76pUzUHyHV-oBUC4HBP8HA=.df291aa8-2c4e-4771-a68a-a31b91ae8d8b@github.com> Message-ID: On Fri, 31 May 2024 14:34:16 GMT, Sonia Zaldana Calles wrote: >> Sonia Zaldana Calles has updated the pull request incrementally with one additional commit since the last revision: >> >> Decreasing diff size addressing unnecessary changes > > Hi all, > > I think there's some consensus that we need some follow up cleanup issues for the JNI spec, renaming constants, fixing return codes, etc. > > Seeing how that grows the scope of the issue quite a bit, I'd like to push this patch and track the other issues brought up separately. > > If there are no objections about the current state, I'd like to integrate some time next week. Let me know your thoughts. > > cc: @jaikiran, @AlanBateman > @SoniaZaldana CI testing of this PR along with latest master commits passed without any failures. So you can now integrate this. Thanks @jaikiran! ------------- PR Comment: https://git.openjdk.org/jdk/pull/18786#issuecomment-2149833060 From liach at openjdk.org Wed Jun 5 13:09:10 2024 From: liach at openjdk.org (Chen Liang) Date: Wed, 5 Jun 2024 13:09:10 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v20] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 12:50:25 GMT, Adam Sotona wrote: >> [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use classfile API for reflection proxy-generation. Actual implementation of `ProxyGenerator` is focused on performance, however it causes JDK bootstrap regressions. `ProxyGenerator.TEMPLATE` class model is statically created and each proxy class is transformed from the template. >> >> This patch is intended to examine plain proxy generation impact on performance and JDK bootstrap (vs proxy transformation from template). >> >> The generated proxy is migrated from static initialization to CONDY bootstrap. >> >> Please review. >> >> Thank you, >> Adam > > Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: > > Update test/micro/org/openjdk/bench/java/lang/reflect/ProxyGenBench.java > > Co-authored-by: Chen Liang Marked as reviewed by liach (Author). ------------- PR Review: https://git.openjdk.org/jdk/pull/19410#pullrequestreview-2099091898 From szaldana at openjdk.org Wed Jun 5 13:15:10 2024 From: szaldana at openjdk.org (Sonia Zaldana Calles) Date: Wed, 5 Jun 2024 13:15:10 GMT Subject: Integrated: 8329581: Java launcher no longer prints a stack trace In-Reply-To: References: Message-ID: On Mon, 15 Apr 2024 18:25:02 GMT, Sonia Zaldana Calles wrote: > Hi folks, > > This PR aims to fix [JDK-8329581](https://bugs.openjdk.org/browse/JDK-8329581). > > I think the regression got introduced in [JDK-8315458](https://bugs.openjdk.org/browse/JDK-8315458). > > In the issue linked above, [LauncherHelper#getMainType](https://github.com/openjdk/jdk/pull/16461/files#diff-108a3a3e3c2d108c8c7f19ea498f641413b7c9239ecd2975a6c27d904c2ba226) got removed to simplify launcher code. > > Previously, we used ```getMainType``` to do the appropriate main method invocation in ```JavaMain```. However, we currently attempt to do all types of main method invocations at the same time [here](https://github.com/openjdk/jdk/blob/master/src/java.base/share/native/libjli/java.c#L623). > > Note how all of these invocations clear the exception reported with [CHECK_EXCEPTION_FAIL](https://github.com/openjdk/jdk/blob/140f56718bbbfc31bb0c39255c68568fad285a1f/src/java.base/share/native/libjli/java.c#L390). > > Therefore, if a legitimate exception comes up during one of these invocations, it does not get reported. > > I propose reintroducing ```LauncherHelper#getMainType``` but I'm looking forward to your suggestions. > > Cheers, > Sonia This pull request has now been integrated. Changeset: cbb6747e Author: Sonia Zaldana Calles Committer: Jaikiran Pai URL: https://git.openjdk.org/jdk/commit/cbb6747e6b9ce7e2b9e0ffb0a1f9499f7e0e13b0 Stats: 351 lines in 4 files changed: 309 ins; 10 del; 32 mod 8329581: Java launcher no longer prints a stack trace 8329420: Java 22 (and 23) launcher calls default constructor although main() is static 8330864: No error message when ExceptionInInitializerError thrown in static initializer Reviewed-by: stuefe ------------- PR: https://git.openjdk.org/jdk/pull/18786 From alanb at openjdk.org Wed Jun 5 13:24:13 2024 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 5 Jun 2024 13:24:13 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v29] In-Reply-To: References: <6Qs2lLk0mJP0XdyH9ysENqcUT7P0KxsWU95fvRzA21Q=.09e661a3-d340-4fde-8030-77db94a2d353@github.com> Message-ID: On Tue, 4 Jun 2024 14:39:23 GMT, Severin Gehwolf wrote: > I've added a couple of `@requires jlink.packagedModules` (new with this patch) so that jlink tests don't start to fail with it. Good, the `@requires jlink.packagedModules` make sense. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2149888841 From alanb at openjdk.org Wed Jun 5 13:24:15 2024 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 5 Jun 2024 13:24:15 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v30] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 16:23:19 GMT, Severin Gehwolf wrote: >> Please review this patch which adds a jlink mode to the JDK which doesn't need the packaged modules being present. A.k.a run-time image based jlink. Fundamentally this patch adds an option to use `jlink` even though your JDK install might not come with the packaged modules (directory `jmods`). This is particularly useful to further reduce the size of a jlinked runtime. After the removal of the concept of a JRE, a common distribution mechanism is still the full JDK with all modules and packaged modules. However, packaged modules can incur an additional size tax. For example in a container scenario it could be useful to have a base JDK container including all modules, but without also delivering the packaged modules. This comes at a size advantage of `~25%`. Such a base JDK container could then be used to `jlink` application specific runtimes, further reducing the size of the application runtime image (App + JDK runtime; as a single image *or* separate bundles, depending on the app being modularized). >> >> The basic design of this approach is to add a jlink plugin for tracking non-class and non-resource files of a JDK install. I.e. files which aren't present in the jimage (`lib/modules`). This enables producing a `JRTArchive` class which has all the info of what constitutes the final jlinked runtime. >> >> Basic usage example: >> >> $ diff -u <(./bin/java --list-modules --limit-modules java.se) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules java.se) >> $ diff -u <(./bin/java --list-modules --limit-modules jdk.jlink) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules jdk.jlink) >> $ ls ../linux-x86_64-server-release/images/jdk/jmods >> java.base.jmod java.net.http.jmod java.sql.rowset.jmod jdk.crypto.ec.jmod jdk.internal.opt.jmod jdk.jdi.jmod jdk.management.agent.jmod jdk.security.auth.jmod >> java.compiler.jmod java.prefs.jmod java.transaction.xa.jmod jdk.dynalink.jmod jdk.internal.vm.ci.jmod jdk.jdwp.agent.jmod jdk.management.jfr.jmod jdk.security.jgss.jmod >> java.datatransfer.jmod java.rmi.jmod java.xml.crypto.jmod jdk.editpad.jmod jdk.internal.vm.compiler.jmod jdk.jfr.jmod jdk.management.jmod jdk.unsupported.desktop.jmod >> java.desktop.jmod java.scripting.jmod java.xml.jmod jdk.hotspot.agent.jmod jdk.i... > > Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 113 commits: > > - Mark some tests with requiring packaged modules > - Correctly set packaged modules default > - Merge branch 'master' into jdk-8311302-jmodless-link > - Merge branch 'master' into jdk-8311302-jmodless-link > - Fix new line in jlink.properties > - Merge branch 'master' into jdk-8311302-jmodless-link > - Simplify JLINK_JDK_EXTRA_OPTS var handling > - Only add runtime track files for linkable runtimes > - Generate the runtime image link diff at jlink time > > But only do that once the plugin-pipeline has run. The generation is > enabled with the hidden option '--generate-linkable-runtime' and > the resource pools available at jlink time are being used to generate > the diff. > - Merge branch 'master' into jdk-8311302-jmodless-link > - ... and 103 more: https://git.openjdk.org/jdk/compare/64bbae75...0eb1e48d > [5fef297](https://github.com/openjdk/jdk/commit/5fef297ba999963d60452f098193d2cba33a941b) implements this. I think it was surprising that --enable-runtime-link-image still included the packaged modules so thanks for taking the feedback on this point. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2149894976 From vklang at openjdk.org Wed Jun 5 13:27:01 2024 From: vklang at openjdk.org (Viktor Klang) Date: Wed, 5 Jun 2024 13:27:01 GMT Subject: RFR: 8312436: CompletableFuture never completes when 'Throwable.toString()' method throws Exception In-Reply-To: References: Message-ID: On Sun, 28 Apr 2024 09:54:34 GMT, Viktor Klang wrote: > Primarily offering this PR for discussion, as Throwables throwing exceptions on toString(), getLocalizedMessage(), or getMessage() seems like a rather unreasonable thing to do. > > Nevertheless, there is some things we can do, as witnessed in this PR. @AlanBateman Do you have a minute to review this one? ------------- PR Comment: https://git.openjdk.org/jdk/pull/18988#issuecomment-2149910528 From alanb at openjdk.org Wed Jun 5 13:27:14 2024 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 5 Jun 2024 13:27:14 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v30] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 16:23:19 GMT, Severin Gehwolf wrote: >> Please review this patch which adds a jlink mode to the JDK which doesn't need the packaged modules being present. A.k.a run-time image based jlink. Fundamentally this patch adds an option to use `jlink` even though your JDK install might not come with the packaged modules (directory `jmods`). This is particularly useful to further reduce the size of a jlinked runtime. After the removal of the concept of a JRE, a common distribution mechanism is still the full JDK with all modules and packaged modules. However, packaged modules can incur an additional size tax. For example in a container scenario it could be useful to have a base JDK container including all modules, but without also delivering the packaged modules. This comes at a size advantage of `~25%`. Such a base JDK container could then be used to `jlink` application specific runtimes, further reducing the size of the application runtime image (App + JDK runtime; as a single image *or* separate bundles, depending on the app being modularized). >> >> The basic design of this approach is to add a jlink plugin for tracking non-class and non-resource files of a JDK install. I.e. files which aren't present in the jimage (`lib/modules`). This enables producing a `JRTArchive` class which has all the info of what constitutes the final jlinked runtime. >> >> Basic usage example: >> >> $ diff -u <(./bin/java --list-modules --limit-modules java.se) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules java.se) >> $ diff -u <(./bin/java --list-modules --limit-modules jdk.jlink) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules jdk.jlink) >> $ ls ../linux-x86_64-server-release/images/jdk/jmods >> java.base.jmod java.net.http.jmod java.sql.rowset.jmod jdk.crypto.ec.jmod jdk.internal.opt.jmod jdk.jdi.jmod jdk.management.agent.jmod jdk.security.auth.jmod >> java.compiler.jmod java.prefs.jmod java.transaction.xa.jmod jdk.dynalink.jmod jdk.internal.vm.ci.jmod jdk.jdwp.agent.jmod jdk.management.jfr.jmod jdk.security.jgss.jmod >> java.datatransfer.jmod java.rmi.jmod java.xml.crypto.jmod jdk.editpad.jmod jdk.internal.vm.compiler.jmod jdk.jfr.jmod jdk.management.jmod jdk.unsupported.desktop.jmod >> java.desktop.jmod java.scripting.jmod java.xml.jmod jdk.hotspot.agent.jmod jdk.i... > > Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 113 commits: > > - Mark some tests with requiring packaged modules > - Correctly set packaged modules default > - Merge branch 'master' into jdk-8311302-jmodless-link > - Merge branch 'master' into jdk-8311302-jmodless-link > - Fix new line in jlink.properties > - Merge branch 'master' into jdk-8311302-jmodless-link > - Simplify JLINK_JDK_EXTRA_OPTS var handling > - Only add runtime track files for linkable runtimes > - Generate the runtime image link diff at jlink time > > But only do that once the plugin-pipeline has run. The generation is > enabled with the hidden option '--generate-linkable-runtime' and > the resource pools available at jlink time are being used to generate > the diff. > - Merge branch 'master' into jdk-8311302-jmodless-link > - ... and 103 more: https://git.openjdk.org/jdk/compare/64bbae75...0eb1e48d test/jdk/tools/lib/tests/JImageHelper.java line 38: > 36: * JDK Modular image iterator > 37: */ > 38: public class JImageHelper { This is only usable in tests that use `@modules` to open jdk.internal.jimage.*. It might be better co-locate this with the jlink tests for now. It may be that we do have test infra structure for jimage in the future but starting out with the supporting test lib in the jlink test tree should be okay. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14787#discussion_r1627780757 From alanb at openjdk.org Wed Jun 5 13:33:12 2024 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 5 Jun 2024 13:33:12 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v30] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 16:23:19 GMT, Severin Gehwolf wrote: >> Please review this patch which adds a jlink mode to the JDK which doesn't need the packaged modules being present. A.k.a run-time image based jlink. Fundamentally this patch adds an option to use `jlink` even though your JDK install might not come with the packaged modules (directory `jmods`). This is particularly useful to further reduce the size of a jlinked runtime. After the removal of the concept of a JRE, a common distribution mechanism is still the full JDK with all modules and packaged modules. However, packaged modules can incur an additional size tax. For example in a container scenario it could be useful to have a base JDK container including all modules, but without also delivering the packaged modules. This comes at a size advantage of `~25%`. Such a base JDK container could then be used to `jlink` application specific runtimes, further reducing the size of the application runtime image (App + JDK runtime; as a single image *or* separate bundles, depending on the app being modularized). >> >> The basic design of this approach is to add a jlink plugin for tracking non-class and non-resource files of a JDK install. I.e. files which aren't present in the jimage (`lib/modules`). This enables producing a `JRTArchive` class which has all the info of what constitutes the final jlinked runtime. >> >> Basic usage example: >> >> $ diff -u <(./bin/java --list-modules --limit-modules java.se) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules java.se) >> $ diff -u <(./bin/java --list-modules --limit-modules jdk.jlink) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules jdk.jlink) >> $ ls ../linux-x86_64-server-release/images/jdk/jmods >> java.base.jmod java.net.http.jmod java.sql.rowset.jmod jdk.crypto.ec.jmod jdk.internal.opt.jmod jdk.jdi.jmod jdk.management.agent.jmod jdk.security.auth.jmod >> java.compiler.jmod java.prefs.jmod java.transaction.xa.jmod jdk.dynalink.jmod jdk.internal.vm.ci.jmod jdk.jdwp.agent.jmod jdk.management.jfr.jmod jdk.security.jgss.jmod >> java.datatransfer.jmod java.rmi.jmod java.xml.crypto.jmod jdk.editpad.jmod jdk.internal.vm.compiler.jmod jdk.jfr.jmod jdk.management.jmod jdk.unsupported.desktop.jmod >> java.desktop.jmod java.scripting.jmod java.xml.jmod jdk.hotspot.agent.jmod jdk.i... > > Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 113 commits: > > - Mark some tests with requiring packaged modules > - Correctly set packaged modules default > - Merge branch 'master' into jdk-8311302-jmodless-link > - Merge branch 'master' into jdk-8311302-jmodless-link > - Fix new line in jlink.properties > - Merge branch 'master' into jdk-8311302-jmodless-link > - Simplify JLINK_JDK_EXTRA_OPTS var handling > - Only add runtime track files for linkable runtimes > - Generate the runtime image link diff at jlink time > > But only do that once the plugin-pipeline has run. The generation is > enabled with the hidden option '--generate-linkable-runtime' and > the resource pools available at jlink time are being used to generate > the diff. > - Merge branch 'master' into jdk-8311302-jmodless-link > - ... and 103 more: https://git.openjdk.org/jdk/compare/64bbae75...0eb1e48d make/Images.gmk line 101: > 99: ifeq ($(JLINK_PRODUCE_RUNTIME_LINK_JDK), true) > 100: JLINK_JDK_EXTRA_OPTS += --generate-linkable-runtime > 101: endif In passing, I suppose this could be JLINK_PRODUCE_LINKABLE_RUNTIME to be consistent with the configure option. No big deal of course, just noticed a few places where the words are transposed. make/autoconf/jdk-options.m4 line 594: > 592: DEFAULT_PACKAGED_MODULES=false > 593: else > 594: DEFAULT_PACKAGED_MODULES=true Good! ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14787#discussion_r1627791600 PR Review Comment: https://git.openjdk.org/jdk/pull/14787#discussion_r1627791805 From alanb at openjdk.org Wed Jun 5 13:37:15 2024 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 5 Jun 2024 13:37:15 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v30] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 16:23:19 GMT, Severin Gehwolf wrote: >> Please review this patch which adds a jlink mode to the JDK which doesn't need the packaged modules being present. A.k.a run-time image based jlink. Fundamentally this patch adds an option to use `jlink` even though your JDK install might not come with the packaged modules (directory `jmods`). This is particularly useful to further reduce the size of a jlinked runtime. After the removal of the concept of a JRE, a common distribution mechanism is still the full JDK with all modules and packaged modules. However, packaged modules can incur an additional size tax. For example in a container scenario it could be useful to have a base JDK container including all modules, but without also delivering the packaged modules. This comes at a size advantage of `~25%`. Such a base JDK container could then be used to `jlink` application specific runtimes, further reducing the size of the application runtime image (App + JDK runtime; as a single image *or* separate bundles, depending on the app being modularized). >> >> The basic design of this approach is to add a jlink plugin for tracking non-class and non-resource files of a JDK install. I.e. files which aren't present in the jimage (`lib/modules`). This enables producing a `JRTArchive` class which has all the info of what constitutes the final jlinked runtime. >> >> Basic usage example: >> >> $ diff -u <(./bin/java --list-modules --limit-modules java.se) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules java.se) >> $ diff -u <(./bin/java --list-modules --limit-modules jdk.jlink) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules jdk.jlink) >> $ ls ../linux-x86_64-server-release/images/jdk/jmods >> java.base.jmod java.net.http.jmod java.sql.rowset.jmod jdk.crypto.ec.jmod jdk.internal.opt.jmod jdk.jdi.jmod jdk.management.agent.jmod jdk.security.auth.jmod >> java.compiler.jmod java.prefs.jmod java.transaction.xa.jmod jdk.dynalink.jmod jdk.internal.vm.ci.jmod jdk.jdwp.agent.jmod jdk.management.jfr.jmod jdk.security.jgss.jmod >> java.datatransfer.jmod java.rmi.jmod java.xml.crypto.jmod jdk.editpad.jmod jdk.internal.vm.compiler.jmod jdk.jfr.jmod jdk.management.jmod jdk.unsupported.desktop.jmod >> java.desktop.jmod java.scripting.jmod java.xml.jmod jdk.hotspot.agent.jmod jdk.i... > > Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 113 commits: > > - Mark some tests with requiring packaged modules > - Correctly set packaged modules default > - Merge branch 'master' into jdk-8311302-jmodless-link > - Merge branch 'master' into jdk-8311302-jmodless-link > - Fix new line in jlink.properties > - Merge branch 'master' into jdk-8311302-jmodless-link > - Simplify JLINK_JDK_EXTRA_OPTS var handling > - Only add runtime track files for linkable runtimes > - Generate the runtime image link diff at jlink time > > But only do that once the plugin-pipeline has run. The generation is > enabled with the hidden option '--generate-linkable-runtime' and > the resource pools available at jlink time are being used to generate > the diff. > - Merge branch 'master' into jdk-8311302-jmodless-link > - ... and 103 more: https://git.openjdk.org/jdk/compare/64bbae75...0eb1e48d src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JRTArchive.java line 131: > 129: public boolean equals(Object obj) { > 130: if (obj instanceof JRTArchive) { > 131: JRTArchive other = (JRTArchive)obj; Cleanup for later, you can use pattern matching here and avoid the cast. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14787#discussion_r1627798949 From pminborg at openjdk.org Wed Jun 5 13:39:57 2024 From: pminborg at openjdk.org (Per Minborg) Date: Wed, 5 Jun 2024 13:39:57 GMT Subject: RFR: 8332249: Micro-optimize Method.hashCode [v2] In-Reply-To: References: <68bP4OaEhjeBisrD5wDLvmOBykXE4J_UlxO9BcFSZl8=.455e75dd-1983-4989-92cf-9101c3ff1696@github.com> Message-ID: On Wed, 29 May 2024 15:20:15 GMT, Chen Liang wrote: >> This was something that I tried and I observed a performance regression on the ARM platform that I was testing. From my understanding, `@Stable` tells the compiler to trust the contents of this field which is only given when the field holder is a known constant. This is generally true for cases like `Enums` but not usually for `Method`. >> >> >> Benchmark Mode Cnt Score Error Units >> # Intel Skylake >> MethodHashCode.benchmarkHashCode avgt 5 1.113 ? 1.146 ns/op >> # Arm Neoverse N1 >> MethodHashCode.benchmarkHashCode avgt 5 3.204 ? 0.001 ns/op > > Interesting, don't know about hotspot internals so I can't diagnose the exact cause of this regression. In order to be eligible for constant folding, the benchmark must declare the `Method hashCodeMethod;` as `static final`. It is hard for me to understand why a `@Stable` annotation should have a detrimental performance impact on an instance field. Can we see a benchmark on Arm Neoverse N1 with the field declared `@Stable` compared to not declared `@Stable`? Also, if the field is `static final`, how would it look like? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19433#discussion_r1627803876 From pminborg at openjdk.org Wed Jun 5 13:43:59 2024 From: pminborg at openjdk.org (Per Minborg) Date: Wed, 5 Jun 2024 13:43:59 GMT Subject: RFR: 8332249: Micro-optimize Method.hashCode [v2] In-Reply-To: References: <68bP4OaEhjeBisrD5wDLvmOBykXE4J_UlxO9BcFSZl8=.455e75dd-1983-4989-92cf-9101c3ff1696@github.com> Message-ID: <-iZhTXSd9kx0Eg5DOq1bAfhCKapEWykLJfft8Te4rb0=.d87c8953-599e-4b47-bfb8-a93aa1ecf38f@github.com> On Wed, 5 Jun 2024 13:37:15 GMT, Per Minborg wrote: >> Interesting, don't know about hotspot internals so I can't diagnose the exact cause of this regression. > > In order to be eligible for constant folding, the benchmark must declare the `Method hashCodeMethod;` as `static final`. > > It is hard for me to understand why a `@Stable` annotation should have a detrimental performance impact on an instance field. > > Can we see a benchmark on Arm Neoverse N1 with the field declared `@Stable` compared to not declared `@Stable`? Also, if the field is `static final`, how would it look like? As a note, If we would have access to the contemplated `StableValue` and `hash` was declared even as an _instance variable_ `StableValue` in a regular class, then it would be trusted and would be eligible for constant folding due to the VM will have special rules for fields of StableValue type. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19433#discussion_r1627810415 From pminborg at openjdk.org Wed Jun 5 13:48:01 2024 From: pminborg at openjdk.org (Per Minborg) Date: Wed, 5 Jun 2024 13:48:01 GMT Subject: RFR: 8332249: Micro-optimize Method.hashCode [v2] In-Reply-To: <-iZhTXSd9kx0Eg5DOq1bAfhCKapEWykLJfft8Te4rb0=.d87c8953-599e-4b47-bfb8-a93aa1ecf38f@github.com> References: <68bP4OaEhjeBisrD5wDLvmOBykXE4J_UlxO9BcFSZl8=.455e75dd-1983-4989-92cf-9101c3ff1696@github.com> <-iZhTXSd9kx0Eg5DOq1bAfhCKapEWykLJfft8Te4rb0=.d87c8953-599e-4b47-bfb8-a93aa1ecf38f@github.com> Message-ID: On Wed, 5 Jun 2024 13:41:10 GMT, Per Minborg wrote: >> In order to be eligible for constant folding, the benchmark must declare the `Method hashCodeMethod;` as `static final`. >> >> It is hard for me to understand why a `@Stable` annotation should have a detrimental performance impact on an instance field. >> >> ~~Can we see a benchmark on Arm Neoverse N1 with the field declared `@Stable` compared to not declared `@Stable`? ~~ Also, if the field is `static final`, how would it look like? > > As a note, If we would have access to the contemplated `StableValue` and `hash` was declared even as an _instance variable_ `StableValue` in a regular class, then it would be trusted and would be eligible for constant folding due to the VM will have special rules for fields of StableValue type. Ahh. There was a benchmark in the initial message. Sorry. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19433#discussion_r1627818122 From alanb at openjdk.org Wed Jun 5 13:50:13 2024 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 5 Jun 2024 13:50:13 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v30] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 16:23:19 GMT, Severin Gehwolf wrote: >> Please review this patch which adds a jlink mode to the JDK which doesn't need the packaged modules being present. A.k.a run-time image based jlink. Fundamentally this patch adds an option to use `jlink` even though your JDK install might not come with the packaged modules (directory `jmods`). This is particularly useful to further reduce the size of a jlinked runtime. After the removal of the concept of a JRE, a common distribution mechanism is still the full JDK with all modules and packaged modules. However, packaged modules can incur an additional size tax. For example in a container scenario it could be useful to have a base JDK container including all modules, but without also delivering the packaged modules. This comes at a size advantage of `~25%`. Such a base JDK container could then be used to `jlink` application specific runtimes, further reducing the size of the application runtime image (App + JDK runtime; as a single image *or* separate bundles, depending on the app being modularized). >> >> The basic design of this approach is to add a jlink plugin for tracking non-class and non-resource files of a JDK install. I.e. files which aren't present in the jimage (`lib/modules`). This enables producing a `JRTArchive` class which has all the info of what constitutes the final jlinked runtime. >> >> Basic usage example: >> >> $ diff -u <(./bin/java --list-modules --limit-modules java.se) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules java.se) >> $ diff -u <(./bin/java --list-modules --limit-modules jdk.jlink) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules jdk.jlink) >> $ ls ../linux-x86_64-server-release/images/jdk/jmods >> java.base.jmod java.net.http.jmod java.sql.rowset.jmod jdk.crypto.ec.jmod jdk.internal.opt.jmod jdk.jdi.jmod jdk.management.agent.jmod jdk.security.auth.jmod >> java.compiler.jmod java.prefs.jmod java.transaction.xa.jmod jdk.dynalink.jmod jdk.internal.vm.ci.jmod jdk.jdwp.agent.jmod jdk.management.jfr.jmod jdk.security.jgss.jmod >> java.datatransfer.jmod java.rmi.jmod java.xml.crypto.jmod jdk.editpad.jmod jdk.internal.vm.compiler.jmod jdk.jfr.jmod jdk.management.jmod jdk.unsupported.desktop.jmod >> java.desktop.jmod java.scripting.jmod java.xml.jmod jdk.hotspot.agent.jmod jdk.i... > > Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 113 commits: > > - Mark some tests with requiring packaged modules > - Correctly set packaged modules default > - Merge branch 'master' into jdk-8311302-jmodless-link > - Merge branch 'master' into jdk-8311302-jmodless-link > - Fix new line in jlink.properties > - Merge branch 'master' into jdk-8311302-jmodless-link > - Simplify JLINK_JDK_EXTRA_OPTS var handling > - Only add runtime track files for linkable runtimes > - Generate the runtime image link diff at jlink time > > But only do that once the plugin-pipeline has run. The generation is > enabled with the hidden option '--generate-linkable-runtime' and > the resource pools available at jlink time are being used to generate > the diff. > - Merge branch 'master' into jdk-8311302-jmodless-link > - ... and 103 more: https://git.openjdk.org/jdk/compare/64bbae75...0eb1e48d src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties line 119: > 117: > 118: err.runtime.link.not.linkable.runtime=The current run-time image does not support run-time linking. > 119: err.runtime.link.jdk.jlink.prohibited=Including jdk.jlink module for run-time image based links is not allowed. The phrase "run-time image based links" in this error message (and in the value of err.runtime.link.packaged.mods) is a bit unusual. As developers will see this message then maybe it could say that this jlink in the current run-time image doesn't contain packaged modules and cannot be used to create another run-time image that include the jdk.jlink module. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14787#discussion_r1627820124 From alanb at openjdk.org Wed Jun 5 13:57:15 2024 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 5 Jun 2024 13:57:15 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v30] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 16:23:19 GMT, Severin Gehwolf wrote: >> Please review this patch which adds a jlink mode to the JDK which doesn't need the packaged modules being present. A.k.a run-time image based jlink. Fundamentally this patch adds an option to use `jlink` even though your JDK install might not come with the packaged modules (directory `jmods`). This is particularly useful to further reduce the size of a jlinked runtime. After the removal of the concept of a JRE, a common distribution mechanism is still the full JDK with all modules and packaged modules. However, packaged modules can incur an additional size tax. For example in a container scenario it could be useful to have a base JDK container including all modules, but without also delivering the packaged modules. This comes at a size advantage of `~25%`. Such a base JDK container could then be used to `jlink` application specific runtimes, further reducing the size of the application runtime image (App + JDK runtime; as a single image *or* separate bundles, depending on the app being modularized). >> >> The basic design of this approach is to add a jlink plugin for tracking non-class and non-resource files of a JDK install. I.e. files which aren't present in the jimage (`lib/modules`). This enables producing a `JRTArchive` class which has all the info of what constitutes the final jlinked runtime. >> >> Basic usage example: >> >> $ diff -u <(./bin/java --list-modules --limit-modules java.se) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules java.se) >> $ diff -u <(./bin/java --list-modules --limit-modules jdk.jlink) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules jdk.jlink) >> $ ls ../linux-x86_64-server-release/images/jdk/jmods >> java.base.jmod java.net.http.jmod java.sql.rowset.jmod jdk.crypto.ec.jmod jdk.internal.opt.jmod jdk.jdi.jmod jdk.management.agent.jmod jdk.security.auth.jmod >> java.compiler.jmod java.prefs.jmod java.transaction.xa.jmod jdk.dynalink.jmod jdk.internal.vm.ci.jmod jdk.jdwp.agent.jmod jdk.management.jfr.jmod jdk.security.jgss.jmod >> java.datatransfer.jmod java.rmi.jmod java.xml.crypto.jmod jdk.editpad.jmod jdk.internal.vm.compiler.jmod jdk.jfr.jmod jdk.management.jmod jdk.unsupported.desktop.jmod >> java.desktop.jmod java.scripting.jmod java.xml.jmod jdk.hotspot.agent.jmod jdk.i... > > Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 113 commits: > > - Mark some tests with requiring packaged modules > - Correctly set packaged modules default > - Merge branch 'master' into jdk-8311302-jmodless-link > - Merge branch 'master' into jdk-8311302-jmodless-link > - Fix new line in jlink.properties > - Merge branch 'master' into jdk-8311302-jmodless-link > - Simplify JLINK_JDK_EXTRA_OPTS var handling > - Only add runtime track files for linkable runtimes > - Generate the runtime image link diff at jlink time > > But only do that once the plugin-pipeline has run. The generation is > enabled with the hidden option '--generate-linkable-runtime' and > the resource pools available at jlink time are being used to generate > the diff. > - Merge branch 'master' into jdk-8311302-jmodless-link > - ... and 103 more: https://git.openjdk.org/jdk/compare/64bbae75...0eb1e48d src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/ResourceDiff.java line 39: > 37: > 38: /** > 39: * Class representing a difference between a jimage resource. For all intents A difference between a jimage resource and ??? Someone might wonder about that. src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/ResourceDiff.java line 215: > 213: } > 214: } catch (IOException e) { > 215: e.printStackTrace(); Is this IOException swallowed by jlink when not running with the debugging option? I'm wondering about the printStackTrace here. src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/ResourcePoolReader.java line 33: > 31: import jdk.tools.jlink.plugin.ResourcePool; > 32: > 33: @SuppressWarnings("try") Is this needed? src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/ResourcePoolReader.java line 49: > 47: @Override > 48: public List getEntries() { > 49: return pool.entries().map(a -> a.path()).collect(Collectors.toList()); I think you can use toList() here. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14787#discussion_r1627830148 PR Review Comment: https://git.openjdk.org/jdk/pull/14787#discussion_r1627833211 PR Review Comment: https://git.openjdk.org/jdk/pull/14787#discussion_r1627828480 PR Review Comment: https://git.openjdk.org/jdk/pull/14787#discussion_r1627828158 From alanb at openjdk.org Wed Jun 5 14:38:59 2024 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 5 Jun 2024 14:38:59 GMT Subject: RFR: 8312436: CompletableFuture never completes when 'Throwable.toString()' method throws Exception In-Reply-To: References: Message-ID: On Sun, 28 Apr 2024 09:54:34 GMT, Viktor Klang wrote: > Primarily offering this PR for discussion, as Throwables throwing exceptions on toString(), getLocalizedMessage(), or getMessage() seems like a rather unreasonable thing to do. > > Nevertheless, there is some things we can do, as witnessed in this PR. Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/18988#pullrequestreview-2099417935 From vklang at openjdk.org Wed Jun 5 14:43:03 2024 From: vklang at openjdk.org (Viktor Klang) Date: Wed, 5 Jun 2024 14:43:03 GMT Subject: Integrated: 8312436: CompletableFuture never completes when 'Throwable.toString()' method throws Exception In-Reply-To: References: Message-ID: On Sun, 28 Apr 2024 09:54:34 GMT, Viktor Klang wrote: > Primarily offering this PR for discussion, as Throwables throwing exceptions on toString(), getLocalizedMessage(), or getMessage() seems like a rather unreasonable thing to do. > > Nevertheless, there is some things we can do, as witnessed in this PR. This pull request has now been integrated. Changeset: 326dbb1b Author: Viktor Klang URL: https://git.openjdk.org/jdk/commit/326dbb1b139dd1ec1b8605339b91697cdf49da9a Stats: 63 lines in 2 files changed: 52 ins; 2 del; 9 mod 8312436: CompletableFuture never completes when 'Throwable.toString()' method throws Exception Reviewed-by: alanb ------------- PR: https://git.openjdk.org/jdk/pull/18988 From asemenyuk at openjdk.org Wed Jun 5 14:56:02 2024 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Wed, 5 Jun 2024 14:56:02 GMT Subject: RFR: 8319457: Update jpackage to support WiX v4 and v5 on Windows [v4] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 04:20:17 GMT, Alexander Matveev wrote: >> Alexey Semenyuk has updated the pull request incrementally with two additional commits since the last revision: >> >> - WixSourceConverter#applyTo should do what OverridableResource#saveToFile() does: create parent directory and replace output file if it exists. >> - Fix issue with overwriting custom l10n file in the resource directory. All WiX source files from the resource directory should be copied to jpackage work directory before running wxi tools. jpackage should not change files in the resource directory. > > src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources.properties line 44: > >> 42: resource.installdirnotemptydlg-wix-file=Not empty install directory dialog WiX project file >> 43: resource.launcher-as-service-wix-file=Service installer WiX project file >> 44: resource.wix-src-conv=XSLT stylesheet converting WiX sources from WiX v3 to WiX v4 format > > WiX v4 -> WiX v4/v5 The converter does exactly as described, it converts WiX v3 sources into WiX v4 **format** that can be used with WiX v4 and WiX v5. So I believe the description should remain unchanged. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19318#discussion_r1627942141 From duke at openjdk.org Wed Jun 5 14:59:00 2024 From: duke at openjdk.org (jengebr) Date: Wed, 5 Jun 2024 14:59:00 GMT Subject: RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations [v2] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 19:58:41 GMT, jengebr wrote: >> Agreed. You might as well be consistent with this so that no one will need to re-address if some application does zillions of clones of empty lists. > > Sorry, I crossed wires with @DougLea 's comment, will add `clone`. `clone()` performs a shallow copy, so there is currently no `Object[]` allocated and therefore nothing to optimize. I don't think there's any work to do here. @DougLea @viktorklang-ora can you confirm? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19527#discussion_r1627947686 From darcy at openjdk.org Wed Jun 5 15:35:18 2024 From: darcy at openjdk.org (Joe Darcy) Date: Wed, 5 Jun 2024 15:35:18 GMT Subject: RFR: 8330182: Start of release updates for JDK 24 [v12] In-Reply-To: References: Message-ID: > Get JDK 24 underway. Joe Darcy has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 23 commits: - Update copyright. - Updated problem list after bug fix. - Merge branch 'master' into JDK-8330188 - Merge branch 'master' into JDK-8330188 - Temporarily problem list java.lang.instrument tests until jar generation is fixed. - Merge branch 'master' into JDK-8330188 - Update symbol files for JDK 23 build 25. - Correct release year. - Merge branch 'master' into JDK-8330188 - Add symbol files current with JDK 23 build 24. - ... and 13 more: https://git.openjdk.org/jdk/compare/4369856c...f4a5026b ------------- Changes: https://git.openjdk.org/jdk/pull/18787/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18787&range=11 Stats: 2083 lines in 50 files changed: 2019 ins; 7 del; 57 mod Patch: https://git.openjdk.org/jdk/pull/18787.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/18787/head:pull/18787 PR: https://git.openjdk.org/jdk/pull/18787 From asotona at openjdk.org Wed Jun 5 15:36:08 2024 From: asotona at openjdk.org (Adam Sotona) Date: Wed, 5 Jun 2024 15:36:08 GMT Subject: Integrated: 8332457: Examine startup overheads from JDK-8294961 In-Reply-To: References: Message-ID: <3KhVxR6fDkAmIz1GOzh5sU_HaxfgOHz4r3thIUutGVc=.98ba1c26-853f-4ce2-9c4a-58562d4a6652@github.com> On Mon, 27 May 2024 09:01:36 GMT, Adam Sotona wrote: > [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use classfile API for reflection proxy-generation. Actual implementation of `ProxyGenerator` is focused on performance, however it causes JDK bootstrap regressions. `ProxyGenerator.TEMPLATE` class model is statically created and each proxy class is transformed from the template. > > This patch is intended to examine plain proxy generation impact on performance and JDK bootstrap (vs proxy transformation from template). > > The generated proxy is migrated from static initialization to CONDY bootstrap. > > Please review. > > Thank you, > Adam This pull request has now been integrated. Changeset: d85b0ca5 Author: Adam Sotona URL: https://git.openjdk.org/jdk/commit/d85b0ca5cdc1820a886c46bf555b2051fed7f167 Stats: 500 lines in 9 files changed: 174 ins; 197 del; 129 mod 8332457: Examine startup overheads from JDK-8294961 8229959: Convert proxy class to use constant dynamic Reviewed-by: liach, redestad ------------- PR: https://git.openjdk.org/jdk/pull/19410 From lancea at openjdk.org Wed Jun 5 15:40:02 2024 From: lancea at openjdk.org (Lance Andersen) Date: Wed, 5 Jun 2024 15:40:02 GMT Subject: RFR: 8206447: InflaterInputStream.skip receives long but it's limited to Integer.MAX_VALUE [v4] In-Reply-To: <9UlaEbxrgbKs_KSP9pbE84Ws41jEDmEPZVEm3VjZbCc=.4abfbe92-731c-4014-97fc-c5e3a1e9878b@github.com> References: <9UlaEbxrgbKs_KSP9pbE84Ws41jEDmEPZVEm3VjZbCc=.4abfbe92-731c-4014-97fc-c5e3a1e9878b@github.com> Message-ID: <_0bu3ts3mntxSur9c7vRLEfiYfS7K-A9OSR1u1qtV9g=.660eeaa1-71a8-4ea2-8b43-322abb98d619@github.com> On Wed, 5 Jun 2024 12:14:07 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which updates the API specification of `java.util.zip.InflaterInputStream.skip()` method to match its current implementation? >> >> `InflaterInputStream.skip()`, just like `DeflaterInputStream.skip()`, takes a `long` value `n` representing the number of bytes to skip. When a value greater than `Integer.MAX_VALUE` is passed to this `InflaterInputStream.skip()` method, the current implementation in that method only skips at most `Integer.MAX_VALUE` bytes. `DeflaterInputStream.skip()` too has the same behaviour. However, in the case of `DeflaterInputStream.skip()`, this semantic is clearly noted in that method's API documentation. `InflaterInputStream.skip()` currently doesn't specify this behaviour. >> >> The commit in this PR updates the `InflaterInputStream.skip()` to specify the current implementation. >> >> I'll open a CSR for this change. > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > clarify blocking semantic latest update looks good. Thank you and Alan for the additional wordsmithing ------------- Marked as reviewed by lancea (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19515#pullrequestreview-2099574770 From asemenyuk at openjdk.org Wed Jun 5 15:41:59 2024 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Wed, 5 Jun 2024 15:41:59 GMT Subject: RFR: 8319457: Update jpackage to support WiX v4 and v5 on Windows [v4] In-Reply-To: <-o573bkx_xWBRkJS3IWGlevuqgWGL-4EyAxCexUvGUQ=.32f6db30-d90b-4be9-987b-7112349f11d4@github.com> References: <-o573bkx_xWBRkJS3IWGlevuqgWGL-4EyAxCexUvGUQ=.32f6db30-d90b-4be9-987b-7112349f11d4@github.com> Message-ID: On Tue, 4 Jun 2024 01:20:15 GMT, Alexander Matveev wrote: > Do we need to handle default case for unknown wix type? In same cases you have default -> throw new IllegalArgumentException(); and in some you do not have. Good catch. I'll update the code to make `switch(wixVersion) ...` expressions consistent as follows: switch (wixVersion) { case Wix3 -> {} case WiX4 -> {} default -> throw new IllegalArgumentException(); } ------------- PR Comment: https://git.openjdk.org/jdk/pull/19318#issuecomment-2150382290 From iris at openjdk.org Wed Jun 5 15:45:05 2024 From: iris at openjdk.org (Iris Clark) Date: Wed, 5 Jun 2024 15:45:05 GMT Subject: RFR: 8330182: Start of release updates for JDK 24 [v12] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 15:35:18 GMT, Joe Darcy wrote: >> Get JDK 24 underway. > > Joe Darcy has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 23 commits: > > - Update copyright. > - Updated problem list after bug fix. > - Merge branch 'master' into JDK-8330188 > - Merge branch 'master' into JDK-8330188 > - Temporarily problem list java.lang.instrument tests until jar generation is fixed. > - Merge branch 'master' into JDK-8330188 > - Update symbol files for JDK 23 build 25. > - Correct release year. > - Merge branch 'master' into JDK-8330188 > - Add symbol files current with JDK 23 build 24. > - ... and 13 more: https://git.openjdk.org/jdk/compare/4369856c...f4a5026b Marked as reviewed by iris (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/18787#pullrequestreview-2099585754 From asemenyuk at openjdk.org Wed Jun 5 15:49:03 2024 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Wed, 5 Jun 2024 15:49:03 GMT Subject: RFR: 8319457: Update jpackage to support WiX v4 and v5 on Windows [v4] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 03:54:46 GMT, Alexander Matveev wrote: >> Alexey Semenyuk has updated the pull request incrementally with two additional commits since the last revision: >> >> - WixSourceConverter#applyTo should do what OverridableResource#saveToFile() does: create parent directory and replace output file if it exists. >> - Fix issue with overwriting custom l10n file in the resource directory. All WiX source files from the resource directory should be copied to jpackage work directory before running wxi tools. jpackage should not change files in the resource directory. > > src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixAppImageFragmentBuilder.java line 157: > >> 155: >> 156: @Override >> 157: List getLoggableWixFeatures() { > > Maybe I am missing something, but is it used? I only see call to base class `WixFragmentBuilder::getLoggableWixFeatures`. `WixFragmentBuilder::getLoggableWixFeatures` is equivalent to: new Function>() { public List apply(WixFragmentBuilder obj) { return obj.getLoggableWixFeatures(); } } An overridden WixAppImageFragmentBuilder#getLoggableWixFeatures() method will be called when WixAppImageFragmentBuilder instance is given. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19318#discussion_r1628020809 From jpai at openjdk.org Wed Jun 5 16:00:04 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 5 Jun 2024 16:00:04 GMT Subject: RFR: 8206447: InflaterInputStream.skip receives long but it's limited to Integer.MAX_VALUE [v4] In-Reply-To: <9UlaEbxrgbKs_KSP9pbE84Ws41jEDmEPZVEm3VjZbCc=.4abfbe92-731c-4014-97fc-c5e3a1e9878b@github.com> References: <9UlaEbxrgbKs_KSP9pbE84Ws41jEDmEPZVEm3VjZbCc=.4abfbe92-731c-4014-97fc-c5e3a1e9878b@github.com> Message-ID: On Wed, 5 Jun 2024 12:14:07 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which updates the API specification of `java.util.zip.InflaterInputStream.skip()` method to match its current implementation? >> >> `InflaterInputStream.skip()`, just like `DeflaterInputStream.skip()`, takes a `long` value `n` representing the number of bytes to skip. When a value greater than `Integer.MAX_VALUE` is passed to this `InflaterInputStream.skip()` method, the current implementation in that method only skips at most `Integer.MAX_VALUE` bytes. `DeflaterInputStream.skip()` too has the same behaviour. However, in the case of `DeflaterInputStream.skip()`, this semantic is clearly noted in that method's API documentation. `InflaterInputStream.skip()` currently doesn't specify this behaviour. >> >> The commit in this PR updates the `InflaterInputStream.skip()` to specify the current implementation. >> >> I'll open a CSR for this change. > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > clarify blocking semantic Thank you all for the reviews and the inputs to the specification text. The CSR has been approved, so I'll integrate this now. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19515#issuecomment-2150413847 From jpai at openjdk.org Wed Jun 5 16:00:05 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 5 Jun 2024 16:00:05 GMT Subject: Integrated: 8206447: InflaterInputStream.skip receives long but it's limited to Integer.MAX_VALUE In-Reply-To: References: Message-ID: On Mon, 3 Jun 2024 05:06:00 GMT, Jaikiran Pai wrote: > Can I please get a review of this change which updates the API specification of `java.util.zip.InflaterInputStream.skip()` method to match its current implementation? > > `InflaterInputStream.skip()`, just like `DeflaterInputStream.skip()`, takes a `long` value `n` representing the number of bytes to skip. When a value greater than `Integer.MAX_VALUE` is passed to this `InflaterInputStream.skip()` method, the current implementation in that method only skips at most `Integer.MAX_VALUE` bytes. `DeflaterInputStream.skip()` too has the same behaviour. However, in the case of `DeflaterInputStream.skip()`, this semantic is clearly noted in that method's API documentation. `InflaterInputStream.skip()` currently doesn't specify this behaviour. > > The commit in this PR updates the `InflaterInputStream.skip()` to specify the current implementation. > > I'll open a CSR for this change. This pull request has now been integrated. Changeset: d7d1afb0 Author: Jaikiran Pai URL: https://git.openjdk.org/jdk/commit/d7d1afb0a84e771870e9f43e08c4a63c8fdccdd9 Stats: 21 lines in 2 files changed: 11 ins; 2 del; 8 mod 8206447: InflaterInputStream.skip receives long but it's limited to Integer.MAX_VALUE Reviewed-by: lancea, alanb ------------- PR: https://git.openjdk.org/jdk/pull/19515 From sgehwolf at openjdk.org Wed Jun 5 16:54:10 2024 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Wed, 5 Jun 2024 16:54:10 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v30] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 13:52:43 GMT, Alan Bateman wrote: >> Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 113 commits: >> >> - Mark some tests with requiring packaged modules >> - Correctly set packaged modules default >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - Fix new line in jlink.properties >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - Simplify JLINK_JDK_EXTRA_OPTS var handling >> - Only add runtime track files for linkable runtimes >> - Generate the runtime image link diff at jlink time >> >> But only do that once the plugin-pipeline has run. The generation is >> enabled with the hidden option '--generate-linkable-runtime' and >> the resource pools available at jlink time are being used to generate >> the diff. >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - ... and 103 more: https://git.openjdk.org/jdk/compare/64bbae75...0eb1e48d > > src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/ResourceDiff.java line 39: > >> 37: >> 38: /** >> 39: * Class representing a difference between a jimage resource. For all intents > > A difference between a jimage resource and ??? Someone might wonder about that. I've updated the comment a bit to make it clearer. > src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/ResourcePoolReader.java line 33: > >> 31: import jdk.tools.jlink.plugin.ResourcePool; >> 32: >> 33: @SuppressWarnings("try") > > Is this needed? Yes. Otherwise this warning is produced: src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/ResourcePoolReader.java:32: warning: [try] auto-closeable resource ResourcePoolReader has a member method close() that could throw InterruptedException public class ResourcePoolReader implements ImageResource { ^ error: warnings found and -Werror specified ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14787#discussion_r1628112307 PR Review Comment: https://git.openjdk.org/jdk/pull/14787#discussion_r1628111856 From sgehwolf at openjdk.org Wed Jun 5 16:57:12 2024 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Wed, 5 Jun 2024 16:57:12 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v30] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 13:54:07 GMT, Alan Bateman wrote: >> Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 113 commits: >> >> - Mark some tests with requiring packaged modules >> - Correctly set packaged modules default >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - Fix new line in jlink.properties >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - Simplify JLINK_JDK_EXTRA_OPTS var handling >> - Only add runtime track files for linkable runtimes >> - Generate the runtime image link diff at jlink time >> >> But only do that once the plugin-pipeline has run. The generation is >> enabled with the hidden option '--generate-linkable-runtime' and >> the resource pools available at jlink time are being used to generate >> the diff. >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - ... and 103 more: https://git.openjdk.org/jdk/compare/64bbae75...0eb1e48d > > src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/ResourceDiff.java line 215: > >> 213: } >> 214: } catch (IOException e) { >> 215: e.printStackTrace(); > > Is this IOException swallowed by jlink when not running with the debugging option? I'm wondering about the printStackTrace here. I think this is a left-over of some devevelopment work. Removed now. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14787#discussion_r1628115979 From naoto at openjdk.org Wed Jun 5 17:09:57 2024 From: naoto at openjdk.org (Naoto Sato) Date: Wed, 5 Jun 2024 17:09:57 GMT Subject: RFR: 8333456: CompactNumberFormat integer parsing fails when string has no suffix [v2] In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 20:43:09 GMT, Justin Lu wrote: >> Please review this PR which handles incorrect CompactNumberFormat integer only parsing when there is no suffix. >> >> See the following snippet, >> >> >> var fmt = NumberFormat.getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT) >> fmt.setParseIntegerOnly(true) >> fmt.parse("5K") // returns 5000 >> fmt.parse("50.00") // returns 50 >> fmt.parse("5") // unexpectedly throws StringIndexOutOfBoundsException >> fmt.parse("5 ") // returns 5 >> >> >> Within the `parse` method, there is code that advances `position` past the fractional portion to find the suffix when `parseIntegerOnly()` is true. However, if a valid string input is given with no suffix, `DecimalFormat.subparseNumber()` will fully iterate through the string and `position` will be equal to the length of the string, throwing StringIndexOutOfBoundsException when `charAt` is invoked (line 1740). >> >> We should check to make sure position does not exceed the string length before deciding to check for a decimal symbol. > > Justin Lu has updated the pull request incrementally with one additional commit since the last revision: > > move test to existing test file LGTM. Thanks for the changes. ------------- Marked as reviewed by naoto (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19533#pullrequestreview-2099786378 From naoto at openjdk.org Wed Jun 5 17:16:56 2024 From: naoto at openjdk.org (Naoto Sato) Date: Wed, 5 Jun 2024 17:16:56 GMT Subject: RFR: 8333086: Using Console.println is unnecessarily slow due to JLine initalization [v3] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 12:36:33 GMT, Jan Lahoda wrote: >> Consider these two programs: >> >> >> public class SystemPrint { >> public static void main(String... args) { >> System.err.println("Hello!"); >> } >> } >> >> and: >> >> public class IOPrint { >> public static void main(String... args) { >> java.io.IO.println("Hello!"); >> } >> } >> >> >> They do the same conceptual thing - write a text to the output. But, `IO.println` delegates to `Console.println`, which then delegates to a `Console` backend, and the default backend is currently based on JLine. >> >> The issues is that JLine takes a quite a long time to initialize, and in a program like this, JLine is not really needed - it is used to provide better editing experience when reading input, but there's no reading in these programs. >> >> For example, on my computer: >> >> $ time java -classpath /tmp SystemPrint >> Hello! >> >> real 0m0,035s >> user 0m0,019s >> sys 0m0,019s >> >> $ time java -classpath /tmp --enable-preview IOPrint >> Hello! >> >> real 0m0,165s >> user 0m0,324s >> sys 0m0,042s >> >> >> The proposal herein is to delegate to the simpler `Console` backend from `java.base` as long as the user only uses methods that print to output, and switch to the JLine delegate when other methods (typically input) is used. Note that while technically `writer()` is a method doing output, it will force JLine initialization to avoid possible problems if the client caches the writer and uses it after switching the delegates. >> >> With this patch, I can get timing like this: >> >> $ time java --enable-preview -classpath /tmp/ IOPrint >> Hello! >> >> real 0m0,051s >> user 0m0,038s >> sys 0m0,020s >> >> >> which seems much more acceptable. >> >> There is also #19467, which may reduce the time further. >> >> A future work might focus on making JLine initialize faster, but avoiding JLine initialization in case where we don't need it seems like a good step to me in any case. > > Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision: > > Correctly reflecting review feedback LGTM. Thanks for the changes. ------------- Marked as reviewed by naoto (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19479#pullrequestreview-2099801902 From sgehwolf at openjdk.org Wed Jun 5 17:21:12 2024 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Wed, 5 Jun 2024 17:21:12 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v30] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 13:46:59 GMT, Alan Bateman wrote: >> Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 113 commits: >> >> - Mark some tests with requiring packaged modules >> - Correctly set packaged modules default >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - Fix new line in jlink.properties >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - Simplify JLINK_JDK_EXTRA_OPTS var handling >> - Only add runtime track files for linkable runtimes >> - Generate the runtime image link diff at jlink time >> >> But only do that once the plugin-pipeline has run. The generation is >> enabled with the hidden option '--generate-linkable-runtime' and >> the resource pools available at jlink time are being used to generate >> the diff. >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - ... and 103 more: https://git.openjdk.org/jdk/compare/64bbae75...0eb1e48d > > src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties line 119: > >> 117: >> 118: err.runtime.link.not.linkable.runtime=The current run-time image does not support run-time linking. >> 119: err.runtime.link.jdk.jlink.prohibited=Including jdk.jlink module for run-time image based links is not allowed. > > The phrase "run-time image based links" in this error message (and in the value of err.runtime.link.packaged.mods) is a bit unusual. As developers will see this message then maybe it could say that this jlink in the current run-time image doesn't contain packaged modules and cannot be used to create another run-time image that include the jdk.jlink module. I've used alternative phrasing. Hopefully better now. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14787#discussion_r1628146154 From jlahoda at openjdk.org Wed Jun 5 17:23:02 2024 From: jlahoda at openjdk.org (Jan Lahoda) Date: Wed, 5 Jun 2024 17:23:02 GMT Subject: Integrated: 8333086: Using Console.println is unnecessarily slow due to JLine initalization In-Reply-To: References: Message-ID: On Thu, 30 May 2024 13:50:33 GMT, Jan Lahoda wrote: > Consider these two programs: > > > public class SystemPrint { > public static void main(String... args) { > System.err.println("Hello!"); > } > } > > and: > > public class IOPrint { > public static void main(String... args) { > java.io.IO.println("Hello!"); > } > } > > > They do the same conceptual thing - write a text to the output. But, `IO.println` delegates to `Console.println`, which then delegates to a `Console` backend, and the default backend is currently based on JLine. > > The issues is that JLine takes a quite a long time to initialize, and in a program like this, JLine is not really needed - it is used to provide better editing experience when reading input, but there's no reading in these programs. > > For example, on my computer: > > $ time java -classpath /tmp SystemPrint > Hello! > > real 0m0,035s > user 0m0,019s > sys 0m0,019s > > $ time java -classpath /tmp --enable-preview IOPrint > Hello! > > real 0m0,165s > user 0m0,324s > sys 0m0,042s > > > The proposal herein is to delegate to the simpler `Console` backend from `java.base` as long as the user only uses methods that print to output, and switch to the JLine delegate when other methods (typically input) is used. Note that while technically `writer()` is a method doing output, it will force JLine initialization to avoid possible problems if the client caches the writer and uses it after switching the delegates. > > With this patch, I can get timing like this: > > $ time java --enable-preview -classpath /tmp/ IOPrint > Hello! > > real 0m0,051s > user 0m0,038s > sys 0m0,020s > > > which seems much more acceptable. > > There is also #19467, which may reduce the time further. > > A future work might focus on making JLine initialize faster, but avoiding JLine initialization in case where we don't need it seems like a good step to me in any case. This pull request has now been integrated. Changeset: f7dbb98f Author: Jan Lahoda URL: https://git.openjdk.org/jdk/commit/f7dbb98fe69eb98f8544577d81550b4fd817864b Stats: 226 lines in 2 files changed: 213 ins; 1 del; 12 mod 8333086: Using Console.println is unnecessarily slow due to JLine initalization Reviewed-by: asotona, naoto ------------- PR: https://git.openjdk.org/jdk/pull/19479 From sgehwolf at openjdk.org Wed Jun 5 17:31:45 2024 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Wed, 5 Jun 2024 17:31:45 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v30] In-Reply-To: References: Message-ID: <7fLmkNjG530Uyw1huywfUiSRPtpiWuJRWmEdlJqiOTs=.0add5d71-c32e-47fa-9d71-1e00772bb50a@github.com> On Wed, 5 Jun 2024 13:21:20 GMT, Alan Bateman wrote: >> Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 113 commits: >> >> - Mark some tests with requiring packaged modules >> - Correctly set packaged modules default >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - Fix new line in jlink.properties >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - Simplify JLINK_JDK_EXTRA_OPTS var handling >> - Only add runtime track files for linkable runtimes >> - Generate the runtime image link diff at jlink time >> >> But only do that once the plugin-pipeline has run. The generation is >> enabled with the hidden option '--generate-linkable-runtime' and >> the resource pools available at jlink time are being used to generate >> the diff. >> - Merge branch 'master' into jdk-8311302-jmodless-link >> - ... and 103 more: https://git.openjdk.org/jdk/compare/64bbae75...0eb1e48d > >> [5fef297](https://github.com/openjdk/jdk/commit/5fef297ba999963d60452f098193d2cba33a941b) implements this. > > I think it was surprising that --enable-runtime-link-image still included the packaged modules so thanks for taking the feedback on this point. Thanks for the review, @AlanBateman! Updates pushed. > test/jdk/tools/lib/tests/JImageHelper.java line 38: > >> 36: * JDK Modular image iterator >> 37: */ >> 38: public class JImageHelper { > > This is only usable in tests that use `@modules` to open jdk.internal.jimage.*. It might be better co-locate this with the jlink tests for now. It may be that we do have test infra structure for jimage in the future but starting out with the supporting test lib in the jlink test tree should be okay. Sure. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2150589379 PR Review Comment: https://git.openjdk.org/jdk/pull/14787#discussion_r1628156069 From sgehwolf at openjdk.org Wed Jun 5 17:31:44 2024 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Wed, 5 Jun 2024 17:31:44 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v31] In-Reply-To: References: Message-ID: > Please review this patch which adds a jlink mode to the JDK which doesn't need the packaged modules being present. A.k.a run-time image based jlink. Fundamentally this patch adds an option to use `jlink` even though your JDK install might not come with the packaged modules (directory `jmods`). This is particularly useful to further reduce the size of a jlinked runtime. After the removal of the concept of a JRE, a common distribution mechanism is still the full JDK with all modules and packaged modules. However, packaged modules can incur an additional size tax. For example in a container scenario it could be useful to have a base JDK container including all modules, but without also delivering the packaged modules. This comes at a size advantage of `~25%`. Such a base JDK container could then be used to `jlink` application specific runtimes, further reducing the size of the application runtime image (App + JDK runtime; as a single image *or* separate bundles, depending on the app b eing modularized). > > The basic design of this approach is to add a jlink plugin for tracking non-class and non-resource files of a JDK install. I.e. files which aren't present in the jimage (`lib/modules`). This enables producing a `JRTArchive` class which has all the info of what constitutes the final jlinked runtime. > > Basic usage example: > > $ diff -u <(./bin/java --list-modules --limit-modules java.se) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules java.se) > $ diff -u <(./bin/java --list-modules --limit-modules jdk.jlink) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules jdk.jlink) > $ ls ../linux-x86_64-server-release/images/jdk/jmods > java.base.jmod java.net.http.jmod java.sql.rowset.jmod jdk.crypto.ec.jmod jdk.internal.opt.jmod jdk.jdi.jmod jdk.management.agent.jmod jdk.security.auth.jmod > java.compiler.jmod java.prefs.jmod java.transaction.xa.jmod jdk.dynalink.jmod jdk.internal.vm.ci.jmod jdk.jdwp.agent.jmod jdk.management.jfr.jmod jdk.security.jgss.jmod > java.datatransfer.jmod java.rmi.jmod java.xml.crypto.jmod jdk.editpad.jmod jdk.internal.vm.compiler.jmod jdk.jfr.jmod jdk.management.jmod jdk.unsupported.desktop.jmod > java.desktop.jmod java.scripting.jmod java.xml.jmod jdk.hotspot.agent.jmod jdk.internal.vm.compiler.manage... Severin Gehwolf has updated the pull request incrementally with six additional commits since the last revision: - Move JImageHelper - Update wording on multi-hop. - Remove printStackTrace() - Fix comment. Stream.toList() - Use pattern matching for instanceof in JRTArchive::equals - Rename JLINK_PRODUCE_RUNTIME_LINK_JDK to JLINK_PRODUCE_LINKABLE_RUNTIME ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14787/files - new: https://git.openjdk.org/jdk/pull/14787/files/0eb1e48d..b72648ba Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14787&range=30 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14787&range=29-30 Stats: 28 lines in 10 files changed: 4 ins; 7 del; 17 mod Patch: https://git.openjdk.org/jdk/pull/14787.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14787/head:pull/14787 PR: https://git.openjdk.org/jdk/pull/14787 From sgehwolf at openjdk.org Wed Jun 5 17:31:45 2024 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Wed, 5 Jun 2024 17:31:45 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v29] In-Reply-To: References: <6Qs2lLk0mJP0XdyH9ysENqcUT7P0KxsWU95fvRzA21Q=.09e661a3-d340-4fde-8030-77db94a2d353@github.com> Message-ID: On Tue, 4 Jun 2024 09:04:30 GMT, Magnus Ihse Bursie wrote: >>> Does that proposal sound good? >> >> That table is useful, I think it's right. No change to default behavior. If someone configures with --enable-runtime-image then they get a JDK run-time image that supports jlink (with some limitations) but is significantly small as it doesn't include the packaged modules. >> >> I've read through most of the changes now. Overall I think it's looking good, just a few terminology and minor points that I'll add as comments. > >> Does that proposal sound good? > > What you basically is saying is that the default value of `packaged-modules` should be `! runtime-link-image` (i.e. the inverse)? @magicus @erikj79 Do you mind re-reviewing the build changes? ------------- PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2150590534 From asotona at openjdk.org Wed Jun 5 17:32:14 2024 From: asotona at openjdk.org (Adam Sotona) Date: Wed, 5 Jun 2024 17:32:14 GMT Subject: RFR: 8294960: Convert java.base/java.lang.invoke package to use the Classfile API to generate lambdas and method handles [v14] In-Reply-To: References: Message-ID: > java.base java.lang.invoke package heavily uses ASM to generate lambdas and method handles. > > This patch converts ASM calls to Classfile API. > > This PR is continuation of https://github.com/openjdk/jdk/pull/12945 > > Any comments and suggestions are welcome. > > Please review. > > Thank you, > Adam Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 24 commits: - Merge branch 'master' into JDK-8294960-invoke # Conflicts: # src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java - Merge branch 'master' into JDK-8294960-invoke # Conflicts: # src/java.base/share/classes/java/lang/classfile/Attributes.java - fixed CodeBuilder use in j.l.invoke - Merge branch 'master' into JDK-8294960-invoke - Merge pull request #4 from cl4es/boxunbox_holder Only create box/unbox MethodRefEntries on request - Only create box/unbox MethodRefEntries on request - Merge pull request #3 from cl4es/minor_init_improvements Reduce init overhead of InvokeBytecodeGenerator and StackMapGenerator - Remove stray MRE_LF_interpretWithArguments - Reduce init overhead of InvokeBytecodeGenerator and StackMapGenerator - Deferred initialization of attributes map by moving into a holder class Co-authored-by: Claes Redestad - ... and 14 more: https://git.openjdk.org/jdk/compare/f73922b2...9360b0eb ------------- Changes: https://git.openjdk.org/jdk/pull/17108/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17108&range=13 Stats: 2113 lines in 10 files changed: 422 ins; 861 del; 830 mod Patch: https://git.openjdk.org/jdk/pull/17108.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17108/head:pull/17108 PR: https://git.openjdk.org/jdk/pull/17108 From naoto at openjdk.org Wed Jun 5 17:48:25 2024 From: naoto at openjdk.org (Naoto Sato) Date: Wed, 5 Jun 2024 17:48:25 GMT Subject: RFR: 8332161: Test restoring echo in the Console implementation (java.base) [v9] In-Reply-To: References: Message-ID: > This test intends to verify the behavior of JdkConsole for the java.base module, wrt restoring the echo. The test assumes the internal methods that sets/gets the echo status of the platform. Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: Removed unnecessary add-opens ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19315/files - new: https://git.openjdk.org/jdk/pull/19315/files/1c0ab8eb..c583c633 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19315&range=08 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19315&range=07-08 Stats: 1 line in 1 file changed: 0 ins; 1 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/19315.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19315/head:pull/19315 PR: https://git.openjdk.org/jdk/pull/19315 From almatvee at openjdk.org Wed Jun 5 19:13:02 2024 From: almatvee at openjdk.org (Alexander Matveev) Date: Wed, 5 Jun 2024 19:13:02 GMT Subject: RFR: 8319457: Update jpackage to support WiX v4 and v5 on Windows [v4] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 14:53:09 GMT, Alexey Semenyuk wrote: >> src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources.properties line 44: >> >>> 42: resource.installdirnotemptydlg-wix-file=Not empty install directory dialog WiX project file >>> 43: resource.launcher-as-service-wix-file=Service installer WiX project file >>> 44: resource.wix-src-conv=XSLT stylesheet converting WiX sources from WiX v3 to WiX v4 format >> >> WiX v4 -> WiX v4/v5 > > The converter does exactly as described, it converts WiX v3 sources into WiX v4 **format** that can be used with WiX v4 and WiX v5. So I believe the description should remain unchanged. Makes sense, but for `error.no-wix-tools` I think we should add v5, in case if users sees this message when only v5 is installed. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19318#discussion_r1628308316 From jvernee at openjdk.org Wed Jun 5 19:29:03 2024 From: jvernee at openjdk.org (Jorn Vernee) Date: Wed, 5 Jun 2024 19:29:03 GMT Subject: RFR: 8325984: 4 jcstress tests are failing in Tier6 4 times each Message-ID: These 4 tests were failing due to an incompatibility with jcstress. They were problemlisted in past (https://bugs.openjdk.org/browse/JDK-8326062). Now that jcstress has been updated (https://github.com/openjdk/jdk/pull/19332) with the relevant fix (https://github.com/openjdk/jcstress/pull/147), we can re-enable these tests. Testing: I've verified that all 4 tests now pass on Linux-x64 ------------- Commit messages: - reenable jcstress tests Changes: https://git.openjdk.org/jdk/pull/19565/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19565&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8325984 Stats: 5 lines in 1 file changed: 0 ins; 5 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/19565.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19565/head:pull/19565 PR: https://git.openjdk.org/jdk/pull/19565 From almatvee at openjdk.org Wed Jun 5 19:34:58 2024 From: almatvee at openjdk.org (Alexander Matveev) Date: Wed, 5 Jun 2024 19:34:58 GMT Subject: RFR: 8319457: Update jpackage to support WiX v4 and v5 on Windows In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 12:37:03 GMT, Alexey Semenyuk wrote: > > I assume WiX5 will just work if installed instead of WiX4? > > Correct. > > > Do you think it will make sense to introduce Wix5 ToolsetType in case if we need to do something different between 4 and 5? > > They claim WiX5 is backward compatible with WiX4, i.e. WiX4 code should work with WiX5 toolkit. So I don't see a reason to introduce Wix5 ToolsetType now. jpackage allows override of main WiX source file (main.wxs), do you know what will happen if user will add main.wxs with format features available only in WiX 5 and will have WiX 5 toolkit installed? Do you know if there any benefits to use any features available in WiX5 if WiX5 toolkit is installed, instead of using only WiX4 features with WiX5 toolkit? ------------- PR Comment: https://git.openjdk.org/jdk/pull/19318#issuecomment-2150809380 From lmesnik at openjdk.org Wed Jun 5 21:11:18 2024 From: lmesnik at openjdk.org (Leonid Mesnik) Date: Wed, 5 Jun 2024 21:11:18 GMT Subject: RFR: 8303133: Update ProcessTools.startProcess(...) to exit early if process exit before linePredicate is printed. In-Reply-To: References: Message-ID: On Fri, 24 Feb 2023 22:15:18 GMT, Leonid Mesnik wrote: > The solution proposed by Stefan K > > The startProcess() might wait forever for the expected line if the process exits (failed to start). It makes sense to just fail earlier in such cases. > > The fix also move > 'output = new OutputAnalyzer(this.process);' > in method xrun() to be able to try to print them in waitFor is failed/interrupted. Thanks ------------- PR Comment: https://git.openjdk.org/jdk/pull/12751#issuecomment-1444608371 From erikj at openjdk.org Wed Jun 5 21:25:23 2024 From: erikj at openjdk.org (Erik Joelsson) Date: Wed, 5 Jun 2024 21:25:23 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v31] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 17:31:44 GMT, Severin Gehwolf wrote: >> Please review this patch which adds a jlink mode to the JDK which doesn't need the packaged modules being present. A.k.a run-time image based jlink. Fundamentally this patch adds an option to use `jlink` even though your JDK install might not come with the packaged modules (directory `jmods`). This is particularly useful to further reduce the size of a jlinked runtime. After the removal of the concept of a JRE, a common distribution mechanism is still the full JDK with all modules and packaged modules. However, packaged modules can incur an additional size tax. For example in a container scenario it could be useful to have a base JDK container including all modules, but without also delivering the packaged modules. This comes at a size advantage of `~25%`. Such a base JDK container could then be used to `jlink` application specific runtimes, further reducing the size of the application runtime image (App + JDK runtime; as a single image *or* separate bundles, depending on the app being modularized). >> >> The basic design of this approach is to add a jlink plugin for tracking non-class and non-resource files of a JDK install. I.e. files which aren't present in the jimage (`lib/modules`). This enables producing a `JRTArchive` class which has all the info of what constitutes the final jlinked runtime. >> >> Basic usage example: >> >> $ diff -u <(./bin/java --list-modules --limit-modules java.se) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules java.se) >> $ diff -u <(./bin/java --list-modules --limit-modules jdk.jlink) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules jdk.jlink) >> $ ls ../linux-x86_64-server-release/images/jdk/jmods >> java.base.jmod java.net.http.jmod java.sql.rowset.jmod jdk.crypto.ec.jmod jdk.internal.opt.jmod jdk.jdi.jmod jdk.management.agent.jmod jdk.security.auth.jmod >> java.compiler.jmod java.prefs.jmod java.transaction.xa.jmod jdk.dynalink.jmod jdk.internal.vm.ci.jmod jdk.jdwp.agent.jmod jdk.management.jfr.jmod jdk.security.jgss.jmod >> java.datatransfer.jmod java.rmi.jmod java.xml.crypto.jmod jdk.editpad.jmod jdk.internal.vm.compiler.jmod jdk.jfr.jmod jdk.management.jmod jdk.unsupported.desktop.jmod >> java.desktop.jmod java.scripting.jmod java.xml.jmod jdk.hotspot.agent.jmod jdk.i... > > Severin Gehwolf has updated the pull request incrementally with six additional commits since the last revision: > > - Move JImageHelper > - Update wording on multi-hop. > - Remove printStackTrace() > - Fix comment. Stream.toList() > - Use pattern matching for instanceof in JRTArchive::equals > - Rename JLINK_PRODUCE_RUNTIME_LINK_JDK to JLINK_PRODUCE_LINKABLE_RUNTIME Build changes look good. Note that having a dynamic value for a DEFAULT makes it render the help text a bit weirdly. You may want to consider spelling out how the default changes in the help text. We have some of these issues with other configure options already though so no big deal I think. ------------- Marked as reviewed by erikj (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14787#pullrequestreview-2100313329 From joehw at openjdk.org Thu Jun 6 00:04:44 2024 From: joehw at openjdk.org (Joe Wang) Date: Thu, 6 Jun 2024 00:04:44 GMT Subject: RFR: 8332161: Test restoring echo in the Console implementation (java.base) [v9] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 17:48:25 GMT, Naoto Sato wrote: >> This test intends to verify the behavior of JdkConsole for the java.base module, wrt restoring the echo. The test assumes the internal methods that sets/gets the echo status of the platform. > > Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: > > Removed unnecessary add-opens Marked as reviewed by joehw (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/19315#pullrequestreview-2100486648 From jpai at openjdk.org Thu Jun 6 06:14:44 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Thu, 6 Jun 2024 06:14:44 GMT Subject: RFR: 8326227: Rounding error that may distort computeNextGaussian results [v3] In-Reply-To: <68EGloykZoxV6IUFMEdsIas6LqJG0W4wjzfU-PmyTyY=.5a48c97b-7858-4321-804d-8e23fb9f0383@github.com> References: <68EGloykZoxV6IUFMEdsIas6LqJG0W4wjzfU-PmyTyY=.5a48c97b-7858-4321-804d-8e23fb9f0383@github.com> Message-ID: On Thu, 9 May 2024 03:55:15 GMT, Chris Hennick wrote: >> Chris Hennick has updated the pull request incrementally with one additional commit since the last revision: >> >> Bug fix: add-exports was for wrong package > > Keep open. > > @JimLaskey it looks like you're the author of most of the surrounding code; can you please confirm that there's a rounding error in the existing implementation and that this PR will fix it? Or if the `git blame` logs are giving you more credit than you're willing to take, then could you please assign it to one ot the real authors or, if that's not possible, to someone else who's in a relevant role and can capable of reviewing and eventually merging this PR? Hello Chris @Pr0methean, please keep this open. Some of us are checking if we can find someone experienced with this code to provide reviews. ------------- PR Comment: https://git.openjdk.org/jdk/pull/17703#issuecomment-2151485139 From duke at openjdk.org Thu Jun 6 06:45:45 2024 From: duke at openjdk.org (ExE Boss) Date: Thu, 6 Jun 2024 06:45:45 GMT Subject: RFR: 8332249: Micro-optimize Method.hashCode [v2] In-Reply-To: <_cZQqk-UhO06IobPUiqc0kCoRfquUsz2SkrSuo2RDdM=.3da1e381-920c-4be1-9409-d0f6382c82de@github.com> References: <_cZQqk-UhO06IobPUiqc0kCoRfquUsz2SkrSuo2RDdM=.3da1e381-920c-4be1-9409-d0f6382c82de@github.com> Message-ID: On Mon, 3 Jun 2024 18:00:35 GMT, Sean Gwizdak wrote: >> Improve the speed of Method.hashCode by caching the hashcode on first use. I've seen an application where Method.hashCode is a hot path, and this is a fairly simple speedup. The memory overhead is low. >> >> This addresses issue [JDK-8332249](https://bugs.openjdk.org/browse/JDK-8332249). >> >> Before: >> >> Benchmark Mode Cnt Score Error Units >> # Intel Skylake >> MethodHashCode.benchmarkHashCode avgt 5 1.843 ? 0.149 ns/op >> # Arm Neoverse N1 >> MethodHashCode.benchmarkHashCode avgt 5 2.363 ? 0.091 ns/op >> >> >> >> After: >> >> >> Benchmark Mode Cnt Score Error Units >> # Intel Skylake >> MethodHashCode.benchmarkHashCode avgt 5 1.121 ? 1.189 ns/op >> # Arm Neoverse N1 >> MethodHashCode.benchmarkHashCode avgt 5 1.001 ? 0.001 ns/op > > Sean Gwizdak has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision: > > - Remove trailing whitespace. > - Move hashCode benchmark into the newly created MethodBenchmark file > - Merge branch 'master' into method-hashcode-JDK-8332249 > - Remove changes to JavaDoc per guidance. > - Fix whitespace issues pointed by the bot > - Micro-optimize Method.hashCode src/java.base/share/classes/java/lang/reflect/Method.java line 392: > 390: .hashCode(); > 391: } > 392: return hc; The?`hash`?field should probably somehow be?shared?with the?`Method.root`?instance, so?that it?doesn?t need to?be?recomputed when?different?code gets?a?`Method`?reference. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19433#discussion_r1628860179 From duke at openjdk.org Thu Jun 6 06:56:57 2024 From: duke at openjdk.org (ExE Boss) Date: Thu, 6 Jun 2024 06:56:57 GMT Subject: RFR: 8294960: Convert java.base/java.lang.invoke package to use the Classfile API to generate lambdas and method handles [v14] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 17:32:14 GMT, Adam Sotona wrote: >> java.base java.lang.invoke package heavily uses ASM to generate lambdas and method handles. >> >> This patch converts ASM calls to Classfile API. >> >> This PR is continuation of https://github.com/openjdk/jdk/pull/12945 >> >> Any comments and suggestions are welcome. >> >> Please review. >> >> Thank you, >> Adam > > Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 24 commits: > > - Merge branch 'master' into JDK-8294960-invoke > > # Conflicts: > # src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java > - Merge branch 'master' into JDK-8294960-invoke > > # Conflicts: > # src/java.base/share/classes/java/lang/classfile/Attributes.java > - fixed CodeBuilder use in j.l.invoke > - Merge branch 'master' into JDK-8294960-invoke > - Merge pull request #4 from cl4es/boxunbox_holder > > Only create box/unbox MethodRefEntries on request > - Only create box/unbox MethodRefEntries on request > - Merge pull request #3 from cl4es/minor_init_improvements > > Reduce init overhead of InvokeBytecodeGenerator and StackMapGenerator > - Remove stray MRE_LF_interpretWithArguments > - Reduce init overhead of InvokeBytecodeGenerator and StackMapGenerator > - Deferred initialization of attributes map by moving into a holder class > > Co-authored-by: Claes Redestad > - ... and 14 more: https://git.openjdk.org/jdk/compare/f73922b2...9360b0eb These?can all?use `ReferenceClassDescImpl?::ofValidated(?)`: src/java.base/share/classes/jdk/internal/classfile/impl/StackMapGenerator.java line 1259: > 1257: LONG_ARRAY_TYPE = referenceType(ClassDesc.ofDescriptor("[J")), > 1258: DOUBLE_ARRAY_TYPE = referenceType(ClassDesc.ofDescriptor("[D")), > 1259: FLOAT_ARRAY_TYPE = referenceType(ClassDesc.ofDescriptor("[F")), Suggestion: INT_ARRAY_TYPE = referenceType(ReferenceClassDescImpl.ofValidated("[I")), BOOLEAN_ARRAY_TYPE = referenceType(ReferenceClassDescImpl.ofValidated("[Z")), BYTE_ARRAY_TYPE = referenceType(ReferenceClassDescImpl.ofValidated("[B")), CHAR_ARRAY_TYPE = referenceType(ReferenceClassDescImpl.ofValidated("[C")), SHORT_ARRAY_TYPE = referenceType(ReferenceClassDescImpl.ofValidated("[S")), LONG_ARRAY_TYPE = referenceType(ReferenceClassDescImpl.ofValidated("[J")), DOUBLE_ARRAY_TYPE = referenceType(ReferenceClassDescImpl.ofValidated("[D")), FLOAT_ARRAY_TYPE = referenceType(ReferenceClassDescImpl.ofValidated("[F")), src/java.base/share/classes/jdk/internal/classfile/impl/StackMapGenerator.java line 1325: > 1323: > 1324: private static final ClassDesc CD_Cloneable = ClassDesc.ofDescriptor("Ljava/lang/Cloneable;"); > 1325: private static final ClassDesc CD_Serializable = ClassDesc.ofDescriptor("Ljava/io/Serializable;"); Suggestion: private static final ClassDesc CD_Cloneable = ReferenceClassDescImpl.ofValidated("Ljava/lang/Cloneable;"); private static final ClassDesc CD_Serializable = ReferenceClassDescImpl.ofValidated("Ljava/io/Serializable;"); ------------- PR Review: https://git.openjdk.org/jdk/pull/17108#pullrequestreview-2100944857 PR Review Comment: https://git.openjdk.org/jdk/pull/17108#discussion_r1628870728 PR Review Comment: https://git.openjdk.org/jdk/pull/17108#discussion_r1628871015 From duke at openjdk.org Thu Jun 6 07:32:38 2024 From: duke at openjdk.org (MaxXing) Date: Thu, 6 Jun 2024 07:32:38 GMT Subject: RFR: 8333334: C2: Make result of `Node::dominates` more precise to enhance scalar replacement [v2] In-Reply-To: References: Message-ID: > This patch changes the algorithm of `Node::dominates` to make the result more precise, and allows the iterators of `ConcurrentHashMap` to be scalar replaced. > > The previous algorithm will return a conservative result when encountering a dead control flow, and only try the first two input paths of a multi-input Region node, which may prevent the scalar replacement in some cases. > > For example, with G1 GC enabled, C2 generates GC barriers for `ConcurrentHashMap` iteration operations at some early phases, and then eliminates them in a later IGVN, but `LoadNode` is also idealized in the same IGVN. This causes `LoadNode::Ideal` to see some dead barrier control flows, and refuse to split some instance field loads through Phi due to the conservative result of `Node::dominates`, and thus the scalar replacement can not be applied to iterators in the later macro elimination phase. > > This patch allows `Node::dominates` to try other paths of the last multi-input Region node when the first path is dead, and makes `ConcurrentHashMap` iteration ~30% faster: > > > Benchmark (nkeys) Mode Cnt Score Error Units > Maps.testConcurrentHashMapIterators 10000 avgt 15 414099.085 ? 33230.945 ns/op # baseline > Maps.testConcurrentHashMapIterators 10000 avgt 15 315490.281 ? 3037.056 ns/op # patch > > > Testing: tier1-4. MaxXing has updated the pull request incrementally with one additional commit since the last revision: Revert last commit, and push the `LoadNode` back to the worklist to wait for the dead code to be removed. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19496/files - new: https://git.openjdk.org/jdk/pull/19496/files/e3330ece..b5db38dc Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19496&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19496&range=00-01 Stats: 107 lines in 4 files changed: 39 ins; 34 del; 34 mod Patch: https://git.openjdk.org/jdk/pull/19496.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19496/head:pull/19496 PR: https://git.openjdk.org/jdk/pull/19496 From duke at openjdk.org Thu Jun 6 07:32:39 2024 From: duke at openjdk.org (MaxXing) Date: Thu, 6 Jun 2024 07:32:39 GMT Subject: RFR: 8333334: C2: Make result of `Node::dominates` more precise to enhance scalar replacement [v2] In-Reply-To: References: Message-ID: <4ch5Wd2SW4LvRD8lDW1UWuAnG0I50kwaXQB_1xW3eFQ=.1351c57b-cef7-4e2c-bf91-368dedf0a8b4@github.com> On Wed, 5 Jun 2024 05:40:12 GMT, Tobias Hartmann wrote: >> MaxXing has updated the pull request incrementally with one additional commit since the last revision: >> >> Revert last commit, and push the `LoadNode` back to the worklist to wait for the dead code to be removed. > > Impressive results! I haven't looked at the change yet but here are a few questions / requests: > - Could you add a screenshot of the IR of the case you are describing? > - Wouldn't it help to add the LoadNode back to the IGVN worklist and wait for the dead path to be removed? > - Could you add an [IR framework](https://github.com/openjdk/jdk/blob/master/test/hotspot/jtreg/compiler/lib/ir_framework/README.md) test that verifies that the optimization works as expected? > > Thanks, > Tobias @TobiHartmann Hi Tobias, thanks for your reply! > Could you add a screenshot of the IR of the case you are describing? Sure. Here's a simple example of iterating over the keys of `ConcurrentHashMap`: public long sumMapKeys() { long sum = 0; Enumeration it = map.keys(); while (it.hasMoreElements()) { sum += (Long) it.nextElement(); } return sum; } And here's what `-XX:+PrintEscapeAnalysis -XX:+PrintEliminateAllocations` says: JavaObject(6) NoEscape(NoEscape) [ 183F 189F 205F 196F 191F 179F 186F 202F 208F 233F 637F 1069F [ 104 109 ]] 92 Allocate === 76 6 69 8 1 (90 89 24 1 1 1 22 1 1 43 77 87 ) [[ 93 94 95 102 103 104 ]] rawptr:NotNull ( int:>=0, java/lang/Object:NotNull *, bool, top, bool ) ConcurrentHashMap::keys @ bci:16 (line 2152) MyBenchmark::sumMapKeys @ bci:6 (line 105) !jvms: ConcurrentHashMap::keys @ bci:16 (line 2152) MyBenchmark::sumMapKeys @ bci:6 (line 105) LocalVar(60) [ 92P [ 109 183b 189b 205b ]] 104 Proj === 92 [[ 105 109 183 189 205 ]] #5 !jvms: ConcurrentHashMap::keys @ bci:16 (line 2152) MyBenchmark::sumMapKeys @ bci:6 (line 105) LocalVar(103) [ 104 92P [ 196b 191b 179b 186b 202b 208b 233b 637b 1069b ]] 109 CheckCastPP === 106 104 [[ 1801 1771 1754 1584 1503 1503 1490 1490 1466 1466 1451 1451 208 1393 1381 1381 179 179 186 186 208 196 191 191 196 202 202 228 297 233 233 1363 1363 1393 1321 1321 1311 637 637 648 648 998 988 1311 1301 477 477 487 487 497 497 569 1301 672 685 767 672 978 920 539 539 1069 1069 557 557 1128 569 631 1061 685 631 ]] #java/util/concurrent/ConcurrentHashMap$KeyIterator (java/util/Iterator,java/util/Enumeration):NotNull:exact * Oop:java/util/concurrent/ConcurrentHashMap$KeyIterator (java/util/Iterator,java/util/Enumeration):NotNull:exact * !jvms: ConcurrentHashMap::keys @ bci:16 (line 2152) MyBenchmark::sumMapKeys @ bci:6 (line 105) NotScalar (Field load) 109 CheckCastPP === 106 104 [[ 1801 1771 1754 1584 1503 1503 1490 1490 1128 569 1451 1451 208 1393 1381 1381 672 685 1069 1069 208 196 191 191 196 978 685 631 297 767 672 569 1301 1393 1321 1321 1311 557 557 631 1061 998 988 1311 1301 477 477 487 487 497 497 ]] #java/util/concurrent/ConcurrentHashMap$KeyIterator (java/util/Iterator,java/util/Enumeration):NotNull:exact *,iid=92 Oop:java/util/concurrent/ConcurrentHashMap$KeyIterator (java/util/Iterator,java/util/Enumeration):NotNull:exact *,iid=92 !jvms: ConcurrentHashMap::keys @ bci:16 (line 2152) MyBenchmark::sumMapKeys @ bci:6 (line 105) >>>> 2186 LoadI === _ 1973 191 [[ 2185 ]] @java/util/concurrent/ConcurrentHashMap$Traverser+12 *, name=index, idx=9; #int !orig=[2178],[2171],[1373] !jvms: ConcurrentHashMap$Traverser::advance @ bci:51 (line 3369) ConcurrentHashMap$KeyIterator::next @ bci:28 (line 3468) ConcurrentHashMap$KeyIterator::nextElement @ bci:1 (line 3472) MyBenchmark::sumMapKeys @ bci:21 (line 107) It shows that scalar replacement is aborted due to field load 2186: ir-diff As we can see its memory is a Phi, and it should be split by `LoadNode::split_through_phi` if its address `109 CheckCastPP` dominates the control flow of the Phi node `1330 Region`. The control node of `CheckCastPP` is `106 Proj`: cast And it does dominate 1330, although not that obvious: cfg But `Node::dominates` think it doesn't because of the dead control flow. > Wouldn't it help to add the LoadNode back to the IGVN worklist and wait for the dead path to be removed? I tried to revert the change of main algorithm of `Node::dominates`, and just add some code to add the LoadNode back to the worklist if we met dead path. It works, still makes the iteration ~30% faster: Benchmark (nkeys) Mode Cnt Score Error Units Maps.testConcurrentHashMapIterators 10000 avgt 15 312720.415 ? 3255.500 ns/op Thanks for pointing this out. I updated this PR, and the latest commit is passing test tier1-4. > Could you add an [IR framework](https://github.com/openjdk/jdk/blob/master/test/hotspot/jtreg/compiler/lib/ir_framework/README.md) test that verifies that the optimization works as expected? I'm still trying to reproduce this case without using `ConcurrentHashMap`, but haven't found a way yet. Can I add an IR test that depends on `ConcurrentHashMap`? (It might need to be updated if the implementation of `ConcurrentHashMap` changes, I guess.) ------------- PR Comment: https://git.openjdk.org/jdk/pull/19496#issuecomment-2151588662 From jpai at openjdk.org Thu Jun 6 07:43:30 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Thu, 6 Jun 2024 07:43:30 GMT Subject: RFR: 8026127: Deflater/Inflater documentation incomplete/misleading [v2] In-Reply-To: <7Iu3kTwrw2DX_FgG7f3H6N5Q-FLKNU4-mS07HcPyMTY=.f1a9c247-c49d-4513-9bde-485bc1f8e357@github.com> References: <7Iu3kTwrw2DX_FgG7f3H6N5Q-FLKNU4-mS07HcPyMTY=.f1a9c247-c49d-4513-9bde-485bc1f8e357@github.com> Message-ID: > Can I please get a review of this doc-only change which proposes to improve the code snippet that's in `java.util.zip.Deflater` and `java.util.zip.Inflater` to better explain the usage of those classes? This addresses https://bugs.openjdk.org/browse/JDK-8026127. > > The commit in the PR cleans up the snippet to correctly compress/decompress till the `Deflater` and `Inflater` are `finished()`. Additionally, the snippet also shows that the `Deflater` and `Inflater` are expected to be closed when their usage it done, to release the resources held by those instances. > > I've run `make docs-image` locally to verify that the generated snippet content as well as the link from `Inflater` work fine in the rendered javadoc HTML. Jaikiran Pai has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision: - merge latest from master branch - 8026127: Deflater/Inflater documentation incomplete/misleading ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19507/files - new: https://git.openjdk.org/jdk/pull/19507/files/d8d86bcb..098212a6 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19507&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19507&range=00-01 Stats: 19514 lines in 482 files changed: 12009 ins; 5593 del; 1912 mod Patch: https://git.openjdk.org/jdk/pull/19507.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19507/head:pull/19507 PR: https://git.openjdk.org/jdk/pull/19507 From asotona at openjdk.org Thu Jun 6 08:25:15 2024 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 6 Jun 2024 08:25:15 GMT Subject: RFR: 8294960: Convert java.base/java.lang.invoke package to use the Classfile API to generate lambdas and method handles [v15] In-Reply-To: References: Message-ID: > java.base java.lang.invoke package heavily uses ASM to generate lambdas and method handles. > > This patch converts ASM calls to Classfile API. > > This PR is continuation of https://github.com/openjdk/jdk/pull/12945 > > Any comments and suggestions are welcome. > > Please review. > > Thank you, > Adam Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: Apply suggestions from code review There are new possibilities with decoupled constants implementation, thank you for the reminder. Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com> ------------- Changes: - all: https://git.openjdk.org/jdk/pull/17108/files - new: https://git.openjdk.org/jdk/pull/17108/files/9360b0eb..019633bd Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=17108&range=14 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17108&range=13-14 Stats: 10 lines in 1 file changed: 0 ins; 0 del; 10 mod Patch: https://git.openjdk.org/jdk/pull/17108.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17108/head:pull/17108 PR: https://git.openjdk.org/jdk/pull/17108 From asotona at openjdk.org Thu Jun 6 08:34:21 2024 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 6 Jun 2024 08:34:21 GMT Subject: RFR: 8294960: Convert java.base/java.lang.invoke package to use the Classfile API to generate lambdas and method handles [v16] In-Reply-To: References: Message-ID: > java.base java.lang.invoke package heavily uses ASM to generate lambdas and method handles. > > This patch converts ASM calls to Classfile API. > > This PR is continuation of https://github.com/openjdk/jdk/pull/12945 > > Any comments and suggestions are welcome. > > Please review. > > Thank you, > Adam Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: fixed imports ------------- Changes: - all: https://git.openjdk.org/jdk/pull/17108/files - new: https://git.openjdk.org/jdk/pull/17108/files/019633bd..902b02ee Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=17108&range=15 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17108&range=14-15 Stats: 18 lines in 1 file changed: 6 ins; 7 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/17108.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17108/head:pull/17108 PR: https://git.openjdk.org/jdk/pull/17108 From duke at openjdk.org Thu Jun 6 08:48:46 2024 From: duke at openjdk.org (ExE Boss) Date: Thu, 6 Jun 2024 08:48:46 GMT Subject: RFR: 8333265: De-duplicate method references in java.util.stream.FindOps In-Reply-To: <1oIB6hqDegMWORETDlXfVgb_xM405KYmoM1DCACMolk=.e2a1e506-77a0-403a-aeec-8d2edf2d73e2@github.com> References: <1oIB6hqDegMWORETDlXfVgb_xM405KYmoM1DCACMolk=.e2a1e506-77a0-403a-aeec-8d2edf2d73e2@github.com> Message-ID: On Thu, 30 May 2024 12:50:36 GMT, Claes Redestad wrote: > Extracting duplicate method references to static field reduce proxy class spinning and loading. In this case 2 less classes loaded when using `findAny()` on each type of stream. The?intermediate `Predicate`s and?`Supplier`s don?t?need to?be?fields, and?it?s?probably better for?them to?be?locals: src/java.base/share/classes/java/util/stream/FindOps.java line 204: > 202: > 203: static final FindOp OP_FIND_ANY = new FindOp<>(false, > 204: StreamShape.REFERENCE, Optional.empty(), IS_PRESENT, NEW); Suggestion: static final TerminalOp OP_FIND_FIRST, OP_FIND_ANY; static { Predicate> isPresent = Optional::isPresent; Supplier>> newSink = FindSink.OfRef::new; OP_FIND_FIRST = new FindOp<>(true, StreamShape.REFERENCE, Optional.empty(), isPresent, newSink); OP_FIND_ANY = new FindOp<>(false, StreamShape.REFERENCE, Optional.empty(), isPresent, newSink); } src/java.base/share/classes/java/util/stream/FindOps.java line 227: > 225: StreamShape.INT_VALUE, OptionalInt.empty(), IS_PRESENT, NEW); > 226: static final TerminalOp OP_FIND_ANY = new FindOp<>(false, > 227: StreamShape.INT_VALUE, OptionalInt.empty(), IS_PRESENT, NEW); Suggestion: static final TerminalOp OP_FIND_FIRST, OP_FIND_ANY; static { Predicate isPresent = OptionalInt::isPresent; Supplier newSink = FindSink.OfInt::new; OP_FIND_FIRST = new FindOp<>(true, StreamShape.INT_VALUE, OptionalInt.empty(), isPresent, newSink); OP_FIND_ANY = new FindOp<>(false, StreamShape.INT_VALUE, OptionalInt.empty(), isPresent, newSink); } src/java.base/share/classes/java/util/stream/FindOps.java line 250: > 248: StreamShape.LONG_VALUE, OptionalLong.empty(), IS_PRESENT, NEW); > 249: static final TerminalOp OP_FIND_ANY = new FindOp<>(false, > 250: StreamShape.LONG_VALUE, OptionalLong.empty(), IS_PRESENT, NEW); Suggestion: static final TerminalOp OP_FIND_FIRST, OP_FIND_ANY; static { Predicate isPresent = OptionalLong::isPresent; Supplier newSink = FindSink.OfLong::new; OP_FIND_FIRST = new FindOp<>(true, StreamShape.LONG_VALUE, OptionalLong.empty(), isPresent, newSink); OP_FIND_ANY = new FindOp<>(false, StreamShape.LONG_VALUE, OptionalLong.empty(), isPresent, newSink); } src/java.base/share/classes/java/util/stream/FindOps.java line 273: > 271: StreamShape.DOUBLE_VALUE, OptionalDouble.empty(), IS_PRESENT, NEW); > 272: static final TerminalOp OP_FIND_ANY = new FindOp<>(false, > 273: StreamShape.DOUBLE_VALUE, OptionalDouble.empty(), IS_PRESENT, NEW); Suggestion: static final TerminalOp OP_FIND_FIRST, OP_FIND_ANY; static { Predicate isPresent = OptionalDouble::isPresent; Supplier newSink = FindSink.OfDouble::new; OP_FIND_FIRST = new FindOp<>(true, StreamShape.DOUBLE_VALUE, OptionalDouble.empty(), isPresent, newSink); OP_FIND_ANY = new FindOp<>(false, StreamShape.DOUBLE_VALUE, OptionalDouble.empty(), isPresent, newSink); } ------------- PR Review: https://git.openjdk.org/jdk/pull/19477#pullrequestreview-2101252355 PR Review Comment: https://git.openjdk.org/jdk/pull/19477#discussion_r1629032905 PR Review Comment: https://git.openjdk.org/jdk/pull/19477#discussion_r1629035242 PR Review Comment: https://git.openjdk.org/jdk/pull/19477#discussion_r1629040800 PR Review Comment: https://git.openjdk.org/jdk/pull/19477#discussion_r1629043309 From ihse at openjdk.org Thu Jun 6 09:37:05 2024 From: ihse at openjdk.org (Magnus Ihse Bursie) Date: Thu, 6 Jun 2024 09:37:05 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v31] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 17:31:44 GMT, Severin Gehwolf wrote: >> Please review this patch which adds a jlink mode to the JDK which doesn't need the packaged modules being present. A.k.a run-time image based jlink. Fundamentally this patch adds an option to use `jlink` even though your JDK install might not come with the packaged modules (directory `jmods`). This is particularly useful to further reduce the size of a jlinked runtime. After the removal of the concept of a JRE, a common distribution mechanism is still the full JDK with all modules and packaged modules. However, packaged modules can incur an additional size tax. For example in a container scenario it could be useful to have a base JDK container including all modules, but without also delivering the packaged modules. This comes at a size advantage of `~25%`. Such a base JDK container could then be used to `jlink` application specific runtimes, further reducing the size of the application runtime image (App + JDK runtime; as a single image *or* separate bundles, depending on the app being modularized). >> >> The basic design of this approach is to add a jlink plugin for tracking non-class and non-resource files of a JDK install. I.e. files which aren't present in the jimage (`lib/modules`). This enables producing a `JRTArchive` class which has all the info of what constitutes the final jlinked runtime. >> >> Basic usage example: >> >> $ diff -u <(./bin/java --list-modules --limit-modules java.se) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules java.se) >> $ diff -u <(./bin/java --list-modules --limit-modules jdk.jlink) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules jdk.jlink) >> $ ls ../linux-x86_64-server-release/images/jdk/jmods >> java.base.jmod java.net.http.jmod java.sql.rowset.jmod jdk.crypto.ec.jmod jdk.internal.opt.jmod jdk.jdi.jmod jdk.management.agent.jmod jdk.security.auth.jmod >> java.compiler.jmod java.prefs.jmod java.transaction.xa.jmod jdk.dynalink.jmod jdk.internal.vm.ci.jmod jdk.jdwp.agent.jmod jdk.management.jfr.jmod jdk.security.jgss.jmod >> java.datatransfer.jmod java.rmi.jmod java.xml.crypto.jmod jdk.editpad.jmod jdk.internal.vm.compiler.jmod jdk.jfr.jmod jdk.management.jmod jdk.unsupported.desktop.jmod >> java.desktop.jmod java.scripting.jmod java.xml.jmod jdk.hotspot.agent.jmod jdk.i... > > Severin Gehwolf has updated the pull request incrementally with six additional commits since the last revision: > > - Move JImageHelper > - Update wording on multi-hop. > - Remove printStackTrace() > - Fix comment. Stream.toList() > - Use pattern matching for instanceof in JRTArchive::equals > - Rename JLINK_PRODUCE_RUNTIME_LINK_JDK to JLINK_PRODUCE_LINKABLE_RUNTIME As Erik says. You need to add something like: `DEFAULT_DESC: [the inverse of --enable-runtime-link-image]`. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2151836837 From asotona at openjdk.org Thu Jun 6 09:38:27 2024 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 6 Jun 2024 09:38:27 GMT Subject: RFR: 8294960: Convert java.base/java.lang.invoke package to use the Classfile API to generate lambdas and method handles [v17] In-Reply-To: References: Message-ID: > java.base java.lang.invoke package heavily uses ASM to generate lambdas and method handles. > > This patch converts ASM calls to Classfile API. > > This PR is continuation of https://github.com/openjdk/jdk/pull/12945 > > Any comments and suggestions are welcome. > > Please review. > > Thank you, > Adam Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: use of jdk.internal.constant to improve performance ------------- Changes: - all: https://git.openjdk.org/jdk/pull/17108/files - new: https://git.openjdk.org/jdk/pull/17108/files/902b02ee..e814749a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=17108&range=16 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17108&range=15-16 Stats: 113 lines in 6 files changed: 35 ins; 7 del; 71 mod Patch: https://git.openjdk.org/jdk/pull/17108.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17108/head:pull/17108 PR: https://git.openjdk.org/jdk/pull/17108 From sgehwolf at openjdk.org Thu Jun 6 09:47:30 2024 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Thu, 6 Jun 2024 09:47:30 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v32] In-Reply-To: References: Message-ID: > Please review this patch which adds a jlink mode to the JDK which doesn't need the packaged modules being present. A.k.a run-time image based jlink. Fundamentally this patch adds an option to use `jlink` even though your JDK install might not come with the packaged modules (directory `jmods`). This is particularly useful to further reduce the size of a jlinked runtime. After the removal of the concept of a JRE, a common distribution mechanism is still the full JDK with all modules and packaged modules. However, packaged modules can incur an additional size tax. For example in a container scenario it could be useful to have a base JDK container including all modules, but without also delivering the packaged modules. This comes at a size advantage of `~25%`. Such a base JDK container could then be used to `jlink` application specific runtimes, further reducing the size of the application runtime image (App + JDK runtime; as a single image *or* separate bundles, depending on the app b eing modularized). > > The basic design of this approach is to add a jlink plugin for tracking non-class and non-resource files of a JDK install. I.e. files which aren't present in the jimage (`lib/modules`). This enables producing a `JRTArchive` class which has all the info of what constitutes the final jlinked runtime. > > Basic usage example: > > $ diff -u <(./bin/java --list-modules --limit-modules java.se) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules java.se) > $ diff -u <(./bin/java --list-modules --limit-modules jdk.jlink) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules jdk.jlink) > $ ls ../linux-x86_64-server-release/images/jdk/jmods > java.base.jmod java.net.http.jmod java.sql.rowset.jmod jdk.crypto.ec.jmod jdk.internal.opt.jmod jdk.jdi.jmod jdk.management.agent.jmod jdk.security.auth.jmod > java.compiler.jmod java.prefs.jmod java.transaction.xa.jmod jdk.dynalink.jmod jdk.internal.vm.ci.jmod jdk.jdwp.agent.jmod jdk.management.jfr.jmod jdk.security.jgss.jmod > java.datatransfer.jmod java.rmi.jmod java.xml.crypto.jmod jdk.editpad.jmod jdk.internal.vm.compiler.jmod jdk.jfr.jmod jdk.management.jmod jdk.unsupported.desktop.jmod > java.desktop.jmod java.scripting.jmod java.xml.jmod jdk.hotspot.agent.jmod jdk.internal.vm.compiler.manage... Severin Gehwolf has updated the pull request incrementally with one additional commit since the last revision: Fix default description of keep-packaged-modules ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14787/files - new: https://git.openjdk.org/jdk/pull/14787/files/b72648ba..7a8f839e Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14787&range=31 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14787&range=30-31 Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/14787.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14787/head:pull/14787 PR: https://git.openjdk.org/jdk/pull/14787 From sgehwolf at openjdk.org Thu Jun 6 09:47:30 2024 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Thu, 6 Jun 2024 09:47:30 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v31] In-Reply-To: References: Message-ID: <7VabDem5bcwntO2OnnFjvHHp-PRoiqznwlS0biro1uw=.5728750d-7213-4edc-a6a4-0934a7976ffa@github.com> On Thu, 6 Jun 2024 09:33:43 GMT, Magnus Ihse Bursie wrote: > As Erik says. You need to add something like: `DEFAULT_DESC: [the inverse of --enable-runtime-link-image]`. https://github.com/openjdk/jdk/pull/14787/commits/7a8f839e55c5109deeb5022d2338b37387c95c85 does that. Sorry it clashed with your comment. It sets it to `enabled by default unless --enable-runtime-link-image is set`. Hopefully that is OK as well. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2151859093 From ihse at openjdk.org Thu Jun 6 09:52:57 2024 From: ihse at openjdk.org (Magnus Ihse Bursie) Date: Thu, 6 Jun 2024 09:52:57 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v32] In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 09:47:30 GMT, Severin Gehwolf wrote: >> Please review this patch which adds a jlink mode to the JDK which doesn't need the packaged modules being present. A.k.a run-time image based jlink. Fundamentally this patch adds an option to use `jlink` even though your JDK install might not come with the packaged modules (directory `jmods`). This is particularly useful to further reduce the size of a jlinked runtime. After the removal of the concept of a JRE, a common distribution mechanism is still the full JDK with all modules and packaged modules. However, packaged modules can incur an additional size tax. For example in a container scenario it could be useful to have a base JDK container including all modules, but without also delivering the packaged modules. This comes at a size advantage of `~25%`. Such a base JDK container could then be used to `jlink` application specific runtimes, further reducing the size of the application runtime image (App + JDK runtime; as a single image *or* separate bundles, depending on the app being modularized). >> >> The basic design of this approach is to add a jlink plugin for tracking non-class and non-resource files of a JDK install. I.e. files which aren't present in the jimage (`lib/modules`). This enables producing a `JRTArchive` class which has all the info of what constitutes the final jlinked runtime. >> >> Basic usage example: >> >> $ diff -u <(./bin/java --list-modules --limit-modules java.se) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules java.se) >> $ diff -u <(./bin/java --list-modules --limit-modules jdk.jlink) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules jdk.jlink) >> $ ls ../linux-x86_64-server-release/images/jdk/jmods >> java.base.jmod java.net.http.jmod java.sql.rowset.jmod jdk.crypto.ec.jmod jdk.internal.opt.jmod jdk.jdi.jmod jdk.management.agent.jmod jdk.security.auth.jmod >> java.compiler.jmod java.prefs.jmod java.transaction.xa.jmod jdk.dynalink.jmod jdk.internal.vm.ci.jmod jdk.jdwp.agent.jmod jdk.management.jfr.jmod jdk.security.jgss.jmod >> java.datatransfer.jmod java.rmi.jmod java.xml.crypto.jmod jdk.editpad.jmod jdk.internal.vm.compiler.jmod jdk.jfr.jmod jdk.management.jmod jdk.unsupported.desktop.jmod >> java.desktop.jmod java.scripting.jmod java.xml.jmod jdk.hotspot.agent.jmod jdk.i... > > Severin Gehwolf has updated the pull request incrementally with one additional commit since the last revision: > > Fix default description of keep-packaged-modules Marked as reviewed by ihse (Reviewer). The wording was much better than what I suggested. Thanks. ------------- PR Review: https://git.openjdk.org/jdk/pull/14787#pullrequestreview-2101492920 PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2151870228 From asotona at openjdk.org Thu Jun 6 10:16:14 2024 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 6 Jun 2024 10:16:14 GMT Subject: RFR: 8294960: Convert java.base/java.lang.invoke package to use the Classfile API to generate lambdas and method handles [v18] In-Reply-To: References: Message-ID: > java.base java.lang.invoke package heavily uses ASM to generate lambdas and method handles. > > This patch converts ASM calls to Classfile API. > > This PR is continuation of https://github.com/openjdk/jdk/pull/12945 > > Any comments and suggestions are welcome. > > Please review. > > Thank you, > Adam Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: - reverted static initialization of ConstantPoolBuilder and CP entries - fixed naming conventions ------------- Changes: - all: https://git.openjdk.org/jdk/pull/17108/files - new: https://git.openjdk.org/jdk/pull/17108/files/e814749a..f870a8df Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=17108&range=17 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17108&range=16-17 Stats: 43 lines in 2 files changed: 7 ins; 13 del; 23 mod Patch: https://git.openjdk.org/jdk/pull/17108.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17108/head:pull/17108 PR: https://git.openjdk.org/jdk/pull/17108 From alanb at openjdk.org Thu Jun 6 10:45:00 2024 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 6 Jun 2024 10:45:00 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v32] In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 09:47:30 GMT, Severin Gehwolf wrote: >> Please review this patch which adds a jlink mode to the JDK which doesn't need the packaged modules being present. A.k.a run-time image based jlink. Fundamentally this patch adds an option to use `jlink` even though your JDK install might not come with the packaged modules (directory `jmods`). This is particularly useful to further reduce the size of a jlinked runtime. After the removal of the concept of a JRE, a common distribution mechanism is still the full JDK with all modules and packaged modules. However, packaged modules can incur an additional size tax. For example in a container scenario it could be useful to have a base JDK container including all modules, but without also delivering the packaged modules. This comes at a size advantage of `~25%`. Such a base JDK container could then be used to `jlink` application specific runtimes, further reducing the size of the application runtime image (App + JDK runtime; as a single image *or* separate bundles, depending on the app being modularized). >> >> The basic design of this approach is to add a jlink plugin for tracking non-class and non-resource files of a JDK install. I.e. files which aren't present in the jimage (`lib/modules`). This enables producing a `JRTArchive` class which has all the info of what constitutes the final jlinked runtime. >> >> Basic usage example: >> >> $ diff -u <(./bin/java --list-modules --limit-modules java.se) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules java.se) >> $ diff -u <(./bin/java --list-modules --limit-modules jdk.jlink) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules jdk.jlink) >> $ ls ../linux-x86_64-server-release/images/jdk/jmods >> java.base.jmod java.net.http.jmod java.sql.rowset.jmod jdk.crypto.ec.jmod jdk.internal.opt.jmod jdk.jdi.jmod jdk.management.agent.jmod jdk.security.auth.jmod >> java.compiler.jmod java.prefs.jmod java.transaction.xa.jmod jdk.dynalink.jmod jdk.internal.vm.ci.jmod jdk.jdwp.agent.jmod jdk.management.jfr.jmod jdk.security.jgss.jmod >> java.datatransfer.jmod java.rmi.jmod java.xml.crypto.jmod jdk.editpad.jmod jdk.internal.vm.compiler.jmod jdk.jfr.jmod jdk.management.jmod jdk.unsupported.desktop.jmod >> java.desktop.jmod java.scripting.jmod java.xml.jmod jdk.hotspot.agent.jmod jdk.i... > > Severin Gehwolf has updated the pull request incrementally with one additional commit since the last revision: > > Fix default description of keep-packaged-modules I've read through all src changes. I think Sundar is looking at the code changes too. The overall design seems solid. I know it took a long time to get there but this is nature of a feature like this. At this point I regret that there isn't a JEP. A JEP would have captured the motivation, outlined the design, the reasoning for the restrictions, and document the design choices/directions that have been prototyped. If there isn't a JEP then I suppose it can come later if the feature is progressed and there is discussion about making it the default rather than opt-in at build configure time. As cleanup, I think we will need to bring some consistency to the terminology and phrasing in documentation, code and comments. Right now there is "run-time linking", "linkable run-time", "run-time linkable JDK image", "linkable jimage". Also as cleanup, I think the code needs more comments. There is no JEP right now with an authoritive description of the feature so anyone maintaining this code will have to figure out a lot of details. It feels like there should be somehting that documents the effect of --enable-runtime-link-image, how the diffs are generated and saved, and how they are used by jlink. There is also a lot of new code in ImageFileCreator and JlinkTask that is asking for some method descriptions so that anyone touching this code can quickly understand what these methods are doing. I don't want to get into code style issues now but I think it would be helpful for future maintainers to avoid more of the overfly long lines if possible (some of them are 150, 160, 170+ and really hard to look at code side-by-side). ------------- PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2151964298 From shade at openjdk.org Thu Jun 6 10:51:44 2024 From: shade at openjdk.org (Aleksey Shipilev) Date: Thu, 6 Jun 2024 10:51:44 GMT Subject: RFR: 8325984: 4 jcstress tests are failing in Tier6 4 times each In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 19:21:56 GMT, Jorn Vernee wrote: > These 4 tests were failing due to an incompatibility with jcstress. They were problemlisted in past (https://bugs.openjdk.org/browse/JDK-8326062). > > Now that jcstress has been updated (https://github.com/openjdk/jdk/pull/19332) with the relevant fix (https://github.com/openjdk/jcstress/pull/147), we can re-enable these tests. > > Testing: I've verified that all 4 tests now pass on Linux-x64 I think only Oracle CIs run these tests through jtreg wrappers? Anyway, this looks good to me. ------------- Marked as reviewed by shade (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19565#pullrequestreview-2101607822 From liach at openjdk.org Thu Jun 6 11:46:46 2024 From: liach at openjdk.org (Chen Liang) Date: Thu, 6 Jun 2024 11:46:46 GMT Subject: RFR: 8332249: Micro-optimize Method.hashCode [v2] In-Reply-To: References: <_cZQqk-UhO06IobPUiqc0kCoRfquUsz2SkrSuo2RDdM=.3da1e381-920c-4be1-9409-d0f6382c82de@github.com> Message-ID: <9f9ETnR3ID7Ct5v2-jesnU-U-AlbHQF0fQjz5VFamvM=.6bc70cb4-2717-4895-ae4f-52f516603df7@github.com> On Thu, 6 Jun 2024 06:41:48 GMT, ExE Boss wrote: >> Sean Gwizdak has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision: >> >> - Remove trailing whitespace. >> - Move hashCode benchmark into the newly created MethodBenchmark file >> - Merge branch 'master' into method-hashcode-JDK-8332249 >> - Remove changes to JavaDoc per guidance. >> - Fix whitespace issues pointed by the bot >> - Micro-optimize Method.hashCode > > src/java.base/share/classes/java/lang/reflect/Method.java line 392: > >> 390: .hashCode(); >> 391: } >> 392: return hc; > > The?`hash`?field should probably somehow be?shared?with the?`Method.root`?instance, so?that it?doesn?t need to?be?recomputed when?different?code gets?a?`Method`?reference. Currently the hashCode computation is quite cheap. I think we can consider this delegation if it gets more complex, say if the hash code now considers parameters. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19433#discussion_r1629365372 From sgehwolf at openjdk.org Thu Jun 6 12:11:58 2024 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Thu, 6 Jun 2024 12:11:58 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v32] In-Reply-To: References: Message-ID: <9hNjD7eheWnoeCUhjUFOLaWodK6xWr8ZEpVUpER2hcQ=.c021a63b-2a70-4433-ae36-644962d293ac@github.com> On Thu, 6 Jun 2024 10:42:20 GMT, Alan Bateman wrote: >> Severin Gehwolf has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix default description of keep-packaged-modules > > I've read through all src changes. I think Sundar is looking at the code changes too. > > The overall design seems solid. I know it took a long time to get there but this is nature of a feature like this. At this point I regret that there isn't a JEP. A JEP would have captured the motivation, outlined the design, the reasoning for the restrictions, and document the design choices/directions that have been prototyped. If there isn't a JEP then I suppose it can come later if the feature is progressed and there is discussion about making it the default rather than opt-in at build configure time. > > As cleanup, I think we will need to bring some consistency to the terminology and phrasing in documentation, code and comments. Right now there is "run-time linking", "linkable run-time", "run-time linkable JDK image", "linkable jimage". > > Also as cleanup, I think the code needs more comments. There is no JEP right now with an authoritive description of the feature so anyone maintaining this code will have to figure out a lot of details. It feels like there should be somehting that documents the effect of --enable-runtime-link-image, how the diffs are generated and saved, and how they are used by jlink. There is also a lot of new code in ImageFileCreator and JlinkTask that is asking for some method descriptions so that anyone touching this code can quickly understand what these methods are doing. I don't want to get into code style issues now but I think it would be helpful for future maintainers to avoid more of the overfly long lines if possible (some of them are 150, 160, 170+ and really hard to look at code side-by-side). @AlanBateman Sure, I appreciate the feedback. Do I understand it correctly that this won't get into JDK 23 then? If so, perhaps the better way would be to draft a JEP for JDK 24 and get that proposed early. What I'd like to avoid is for this change to don't see much movement for a long time between now and RDP 1 of JDK 24 and have a similar crunch when JDK 24 is close to forking. You mention clean-up a lot. Is that suggesting it *can* go into JDK 23 and clean-up in ramp-down? I'm confused... Some clarity on how to best approach getting this integrated that would be acceptable for all involved would be appreciated. Thanks! ------------- PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2152248595 From asemenyuk at openjdk.org Thu Jun 6 12:43:46 2024 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Thu, 6 Jun 2024 12:43:46 GMT Subject: RFR: 8319457: Update jpackage to support WiX v4 and v5 on Windows In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 19:31:57 GMT, Alexander Matveev wrote: > jpackage allows override of main WiX source file (main.wxs), do you know what will happen if user will add main.wxs with format features available only in WiX 5 and will have WiX 5 toolkit installed? jpackage will detect the custom main.wxs is WiX4 format and pass it as is to `wix.exe`. I.e. custom WiX5 main.wxs will work with WiX5 toolkit. However, it will fail if they try using custom main.wxs with WiX5-specific features with WiX4 toolkit. But this is out of the scope of jpackage. > Do you know if there any benefits to use any features available in WiX5 if WiX5 toolkit is installed, instead of using only WiX4 features with WiX5 toolkit? As far as I can tell from https://wixtoolset.org/docs/fivefour/, WiX5 reduces the redundancy of source files compared to WiX4. I can see how people handwriting sophisticated WiX source files can benefit from these improvements, not jpackage. The default main.wxs and two dialogs jpackage supplies are very basic and other sources are generated. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19318#issuecomment-2152309900 From duke at openjdk.org Thu Jun 6 12:46:36 2024 From: duke at openjdk.org (jengebr) Date: Thu, 6 Jun 2024 12:46:36 GMT Subject: RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations [v3] In-Reply-To: References: Message-ID: > Improve `java/util/concurrent/CopyOnWriteArrayList` by eliminating needless cloning of Object[0] instances. This cloning is intended to prevent callers from changing array contents, but many `CopyOnWriteArrayList`s are allocated to size zero, or are otherwise maintained empty, so cloning is unnecessary. > > Results from the included JMH benchmark: > Before: > > Benchmark Mode Cnt Score Error Units > CopyOnWriteArrayListBenchmark.clear avgt 5 74.487 ? 1.793 ns/op > CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 27.918 ? 0.759 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.656 ? 0.375 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 15.415 ? 0.489 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.608 ? 0.363 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 15.374 ? 0.260 ns/op > CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 15.688 ? 0.350 ns/op > > > After: > > Benchmark Mode Cnt Score Error Units > CopyOnWriteArrayListBenchmark.clear avgt 5 75.365 ? 2.092 ns/op > CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 20.803 ? 0.539 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.808 ? 0.582 ns/op > CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 12.980 ? 0.418 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.627 ? 0.173 ns/op > CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 12.864 ? 0.408 ns/op > CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 12.931 ? 0.255 ns/op jengebr has updated the pull request incrementally with one additional commit since the last revision: Adding benchmarks for readObject ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19527/files - new: https://git.openjdk.org/jdk/pull/19527/files/9ab83c9d..b1920f7a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19527&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19527&range=01-02 Stats: 43 lines in 1 file changed: 41 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/19527.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19527/head:pull/19527 PR: https://git.openjdk.org/jdk/pull/19527 From asemenyuk at openjdk.org Thu Jun 6 12:52:00 2024 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Thu, 6 Jun 2024 12:52:00 GMT Subject: RFR: 8319457: Update jpackage to support WiX v4 and v5 on Windows [v5] In-Reply-To: References: Message-ID: <2w8qlUQQsvAFKylKWh2daqvBmuN_mOtUgn6Bqv0tpjc=.e3f5fc3c-ab83-49c9-a5f1-7e0b0b463e56@github.com> > Add support for WiX4 and WiX5 in jpackage. > > jpackage supports WiX3, WiX4 and WiX5. It will pick WiX4/WiX5 if one of them is installed and there is WiX3 installed too. (Note: WiX4 and WiX5 are not supposed to be installed side-by-side, but if it happens, WiX5 will be preferred over WiX4). > > Custom WiX3 sources will be automatically converted to WiX4 format if WiX4/WiX5 is used. The converter provides: > > - full support of the conversion of WiX L10N (.wxl) files, i.e. full support of "http://schemas.microsoft.com/wix/2006/localization" to "http://wixtoolset.org/schemas/v4/wxl" namespace conversion; > - partial support of WiX source (.wxs) files, i.e. partial support of "http://schemas.microsoft.com/wix/2006/wi" to "http://wixtoolset.org/schemas/v4/wxs" namespace conversion; > > The converter is a XSLT stylesheet. The default converter is `src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/wix3-to-wix4-conv.xsl`. It can be replaced with the custom converter by adding "wix-conv.xsl" file to the resource directory. Alexey Semenyuk has updated the pull request incrementally with one additional commit since the last revision: Unify "switch(wixVersion) ..." expressions. Always throw IllegalArgumentException if "wixVersion" is not WixToolkit#Wix3 or WixToolkit#Wix4. When/If we add another value to WixToolkit enum this will help not to miss adjusting all WiX version-specific code. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19318/files - new: https://git.openjdk.org/jdk/pull/19318/files/af8fb680..899470e4 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19318&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19318&range=03-04 Stats: 64 lines in 6 files changed: 46 ins; 12 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/19318.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19318/head:pull/19318 PR: https://git.openjdk.org/jdk/pull/19318 From prappo at openjdk.org Thu Jun 6 12:52:48 2024 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 6 Jun 2024 12:52:48 GMT Subject: RFR: 8332161: Test restoring echo in the Console implementation (java.base) [v9] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 17:48:25 GMT, Naoto Sato wrote: >> This test intends to verify the behavior of JdkConsole for the java.base module, wrt restoring the echo. The test assumes the internal methods that sets/gets the echo status of the platform. > > Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: > > Removed unnecessary add-opens This feels like a better, end-to-end test. Thank you for your perseverance. Below are some comments. test/jdk/java/io/Console/RestoreEchoTest.java line 66: > 64: OutputAnalyzer output = ProcessTools.executeProcess( > 65: "expect", > 66: "-n", What does `-n` do? test/jdk/java/io/Console/RestoreEchoTest.java line 70: > 68: initialEcho, > 69: jdkDir + "/bin/java", > 70: "--add-opens=java.base/jdk.internal.io=ALL-UNNAMED", We don't seem to need `--add-opens`. test/jdk/java/io/Console/RestoreEchoTest.java line 72: > 70: "--add-opens=java.base/jdk.internal.io=ALL-UNNAMED", > 71: "-Djdk.console=java.base", > 72: "-classpath", testClasses, Consider this. If we remove `-classpath` (and `var testClasses`), not only will nothing break, but we'll be also able to use JUnit assertions and assumptions in `main` instead of manual check-then-throw. This will work because the expect-process will inherit the environment, which captures `CLASSPATH` ( see https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/ProcessBuilder.html#start() ). Again, the above is just something to consider. For all I know, you might've considered it already and rejected. test/jdk/java/io/Console/RestoreEchoTest.java line 78: > 76: if (eval != 0) { > 77: throw new RuntimeException("Test failed. Exit value from 'expect' command: " + eval); > 78: } It could've been `assertEquals(0, output.getExitValue())`. test/jdk/java/io/Console/RestoreEchoTest.java line 93: > 91: // testing readLine() > 92: String input = con.readLine("prompt: "); > 93: con.printf("input is %s\n", input); I know that this test is only run on Linux and macOS, and yet `%n` would be better than `\n`. It's one of those cases where it's simpler to use a general solution than to use a less general one and explain why it still does the job. test/jdk/java/io/Console/RestoreEchoTest.java line 97: > 95: // testing readPassword() > 96: input = String.valueOf(con.readPassword("password prompt: ")); > 97: con.printf("password is %s\n", input); Ditto on `%n`. test/jdk/java/io/Console/restoreEcho.exp line 57: > 55: test "$rpprompt" "$rpinput" "-echo" "$rpexpected" > 56: # See if the initialEcho is restored with `stty -a` > 57: expect " $initialEcho " If you leave out those whitespace characters inside the quotes and `$initialEcho` expands to `-echo`, it will be treated as an option to `expect`, right? If so, consider this instead: expect -- $initialEcho But more importantly: could a test match `echo` in `-echo` and therefore falsely pass? ------------- PR Review: https://git.openjdk.org/jdk/pull/19315#pullrequestreview-2101329552 PR Review Comment: https://git.openjdk.org/jdk/pull/19315#discussion_r1629085477 PR Review Comment: https://git.openjdk.org/jdk/pull/19315#discussion_r1629331808 PR Review Comment: https://git.openjdk.org/jdk/pull/19315#discussion_r1629348345 PR Review Comment: https://git.openjdk.org/jdk/pull/19315#discussion_r1629359368 PR Review Comment: https://git.openjdk.org/jdk/pull/19315#discussion_r1629361442 PR Review Comment: https://git.openjdk.org/jdk/pull/19315#discussion_r1629361824 PR Review Comment: https://git.openjdk.org/jdk/pull/19315#discussion_r1629445000 From asemenyuk at openjdk.org Thu Jun 6 12:58:59 2024 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Thu, 6 Jun 2024 12:58:59 GMT Subject: RFR: 8319457: Update jpackage to support WiX v4 and v5 on Windows [v6] In-Reply-To: References: Message-ID: > Add support for WiX4 and WiX5 in jpackage. > > jpackage supports WiX3, WiX4 and WiX5. It will pick WiX4/WiX5 if one of them is installed and there is WiX3 installed too. (Note: WiX4 and WiX5 are not supposed to be installed side-by-side, but if it happens, WiX5 will be preferred over WiX4). > > Custom WiX3 sources will be automatically converted to WiX4 format if WiX4/WiX5 is used. The converter provides: > > - full support of the conversion of WiX L10N (.wxl) files, i.e. full support of "http://schemas.microsoft.com/wix/2006/localization" to "http://wixtoolset.org/schemas/v4/wxl" namespace conversion; > - partial support of WiX source (.wxs) files, i.e. partial support of "http://schemas.microsoft.com/wix/2006/wi" to "http://wixtoolset.org/schemas/v4/wxs" namespace conversion; > > The converter is a XSLT stylesheet. The default converter is `src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/wix3-to-wix4-conv.xsl`. It can be replaced with the custom converter by adding "wix-conv.xsl" file to the resource directory. Alexey Semenyuk has updated the pull request incrementally with one additional commit since the last revision: Add WiX v5 to "error.no-wix-tools" ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19318/files - new: https://git.openjdk.org/jdk/pull/19318/files/899470e4..d4469735 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19318&range=05 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19318&range=04-05 Stats: 4 lines in 4 files changed: 0 ins; 0 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/19318.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19318/head:pull/19318 PR: https://git.openjdk.org/jdk/pull/19318 From jpai at openjdk.org Thu Jun 6 13:13:21 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Thu, 6 Jun 2024 13:13:21 GMT Subject: RFR: 8333714: Cleanup the usages of CHECK_EXCEPTION_NULL_FAIL macro in java launcher Message-ID: Can I please get a review for this change which proposes to remove the `CHECK_EXCEPTION_NULL_FAIL` macro from the `java` launcher code? This addresses https://bugs.openjdk.org/browse/JDK-8333714. As noted in that JBS issue, in a recent PR discussion, it was suggested https://github.com/openjdk/jdk/pull/18786#issuecomment-2147452633 that this macro should be removed and the failure of a JNI specified operation (the ones for which this macro is being used) should be determined based on a `NULL` value returned from that function. The commit in this PR removes this macros and updates the call sites to do a `NULL` check. Given the nature of this change, no new tests have been added. tier1, tier2 and tier3 testing passed successfully with these changes. ------------- Commit messages: - simplify function comments - 8333714: Cleanup the usages of CHECK_EXCEPTION_NULL_FAIL macro in java launcher Changes: https://git.openjdk.org/jdk/pull/19576/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19576&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333714 Stats: 76 lines in 1 file changed: 45 ins; 9 del; 22 mod Patch: https://git.openjdk.org/jdk/pull/19576.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19576/head:pull/19576 PR: https://git.openjdk.org/jdk/pull/19576 From prasad.velagapudi at servicenow.com Thu Jun 6 13:14:51 2024 From: prasad.velagapudi at servicenow.com (Prasad Velagapudi) Date: Thu, 6 Jun 2024 13:14:51 +0000 Subject: Lambda Classes reachability from GC roots in JDK11 and JDK17 Message-ID: Hello Lambda Experts, I am looking for clarifications on the following questions. 1. I observed in my tests that lambda classes generated for inline lambda expressions (ex: LambdaUtil::print), are STRONGLY linked to defining class loader and never gets collected on GC. This behaviour is same in both JDK11 and JDK17. Can you please confirm is this accurate? 2. Also, I observed that the lambda classes generated for inline lambda expressions (ex: LambdaUtil::print) not adding additional overhead to Metaspace. Can you please confirm is this accurate? Regards, Prasad -------------- next part -------------- An HTML attachment was scrubbed... URL: From jpai at openjdk.org Thu Jun 6 13:28:55 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Thu, 6 Jun 2024 13:28:55 GMT Subject: RFR: 8333714: Cleanup the usages of CHECK_EXCEPTION_NULL_FAIL macro in java launcher [v2] In-Reply-To: References: Message-ID: <2ljA_wbHn-RLVyWR3VrIKme5JmvzdWnrCVEEtQVeok4=.d9486ad8-ca69-40ac-b25a-25a83ef1cb70@github.com> > Can I please get a review for this change which proposes to remove the `CHECK_EXCEPTION_NULL_FAIL` macro from the `java` launcher code? > > This addresses https://bugs.openjdk.org/browse/JDK-8333714. As noted in that JBS issue, in a recent PR discussion, it was suggested https://github.com/openjdk/jdk/pull/18786#issuecomment-2147452633 that this macro should be removed and the failure of a JNI specified operation (the ones for which this macro is being used) should be determined based on a `NULL` value returned from that function. The commit in this PR removes this macros and updates the call sites to do a `NULL` check. > > Given the nature of this change, no new tests have been added. tier1, tier2 and tier3 testing passed successfully with these changes. Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: improve comments ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19576/files - new: https://git.openjdk.org/jdk/pull/19576/files/1c2a3dfb..1b3d630a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19576&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19576&range=00-01 Stats: 20 lines in 1 file changed: 0 ins; 8 del; 12 mod Patch: https://git.openjdk.org/jdk/pull/19576.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19576/head:pull/19576 PR: https://git.openjdk.org/jdk/pull/19576 From alanb at openjdk.org Thu Jun 6 13:50:59 2024 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 6 Jun 2024 13:50:59 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v32] In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 10:42:20 GMT, Alan Bateman wrote: >> Severin Gehwolf has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix default description of keep-packaged-modules > > I've read through all src changes. I think Sundar is looking at the code changes too. > > The overall design seems solid. I know it took a long time to get there but this is nature of a feature like this. At this point I regret that there isn't a JEP. A JEP would have captured the motivation, outlined the design, the reasoning for the restrictions, and document the design choices/directions that have been prototyped. If there isn't a JEP then I suppose it can come later if the feature is progressed and there is discussion about making it the default rather than opt-in at build configure time. > > As cleanup, I think we will need to bring some consistency to the terminology and phrasing in documentation, code and comments. Right now there is "run-time linking", "linkable run-time", "run-time linkable JDK image", "linkable jimage". > > Also as cleanup, I think the code needs more comments. There is no JEP right now with an authoritive description of the feature so anyone maintaining this code will have to figure out a lot of details. It feels like there should be somehting that documents the effect of --enable-runtime-link-image, how the diffs are generated and saved, and how they are used by jlink. There is also a lot of new code in ImageFileCreator and JlinkTask that is asking for some method descriptions so that anyone touching this code can quickly understand what these methods are doing. I don't want to get into code style issues now but I think it would be helpful for future maintainers to avoid more of the overfly long lines if possible (some of them are 150, 160, 170+ and really hard to look at code side-by-side). > @AlanBateman Sure, I appreciate the feedback. Do I understand it correctly that this won't get into JDK 23 then? If so, perhaps the better way would be to draft a JEP for JDK 24 and get that proposed early. What I'd like to avoid is for this change to don't see much movement for a long time between now and RDP 1 of JDK 24 and have a similar crunch when JDK 24 is close to forking. You mention clean-up a lot. Is that suggesting it _can_ go into JDK 23 and clean-up in ramp-down? I'm confused... > > Some clarity on how to best approach getting this integrated that would be acceptable for all involved would be appreciated. Thanks! The fork for JDK 23 is today so if I was running with this feature then I wouldn't integrate it today. If you are willing to put the time into writing a JEP then I think it's the right thing to do. We should probably have brought this up long before now. I'm happy to help review iterations. There is a lot to write down and this will be very valuable for future phases of this work. I assume future phases. We agreed some restrictions to reduce complexity for this first phase. Future phases may remove these and maybe there is confidence in the future to make it default. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2152576950 From jpai at openjdk.org Thu Jun 6 14:02:03 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Thu, 6 Jun 2024 14:02:03 GMT Subject: RFR: 8026127: Deflater/Inflater documentation incomplete/misleading [v3] In-Reply-To: <7Iu3kTwrw2DX_FgG7f3H6N5Q-FLKNU4-mS07HcPyMTY=.f1a9c247-c49d-4513-9bde-485bc1f8e357@github.com> References: <7Iu3kTwrw2DX_FgG7f3H6N5Q-FLKNU4-mS07HcPyMTY=.f1a9c247-c49d-4513-9bde-485bc1f8e357@github.com> Message-ID: <5EcD6qP5xpBf57GZ0HXbmX2qEftWfIK9Ymj9Gz9qScM=.bae6d8ef-de5a-4a13-b5d9-9368d41b77a8@github.com> > Can I please get a review of this doc-only change which proposes to improve the code snippet that's in `java.util.zip.Deflater` and `java.util.zip.Inflater` to better explain the usage of those classes? This addresses https://bugs.openjdk.org/browse/JDK-8026127. > > The commit in the PR cleans up the snippet to correctly compress/decompress till the `Deflater` and `Inflater` are `finished()`. Additionally, the snippet also shows that the `Deflater` and `Inflater` are expected to be closed when their usage it done, to release the resources held by those instances. > > I've run `make docs-image` locally to verify that the generated snippet content as well as the link from `Inflater` work fine in the rendered javadoc HTML. Jaikiran Pai has updated the pull request incrementally with two additional commits since the last revision: - minor change to the comment - move the snippet to an external snippet ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19507/files - new: https://git.openjdk.org/jdk/pull/19507/files/098212a6..7a72a760 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19507&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19507&range=01-02 Stats: 158 lines in 3 files changed: 97 ins; 58 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/19507.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19507/head:pull/19507 PR: https://git.openjdk.org/jdk/pull/19507 From shade at openjdk.org Thu Jun 6 14:32:47 2024 From: shade at openjdk.org (Aleksey Shipilev) Date: Thu, 6 Jun 2024 14:32:47 GMT Subject: RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations [v3] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 14:56:26 GMT, jengebr wrote: > clone() performs a shallow copy, so there is currently no Object[] allocated and therefore nothing to optimize. Yes, I believe so. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19527#discussion_r1629666551 From shade at openjdk.org Thu Jun 6 14:38:47 2024 From: shade at openjdk.org (Aleksey Shipilev) Date: Thu, 6 Jun 2024 14:38:47 GMT Subject: RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations [v3] In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 12:46:36 GMT, jengebr wrote: >> Improve `java/util/concurrent/CopyOnWriteArrayList` by eliminating needless cloning of Object[0] instances. This cloning is intended to prevent callers from changing array contents, but many `CopyOnWriteArrayList`s are allocated to size zero, or are otherwise maintained empty, so cloning is unnecessary. >> >> Results from the included JMH benchmark: >> Before: >> >> Benchmark Mode Cnt Score Error Units >> CopyOnWriteArrayListBenchmark.clear avgt 5 74.487 ? 1.793 ns/op >> CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 27.918 ? 0.759 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.656 ? 0.375 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 15.415 ? 0.489 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.608 ? 0.363 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 15.374 ? 0.260 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 15.688 ? 0.350 ns/op >> CopyOnWriteArrayListBenchmark.readInstance avgt 10 2625.125 ? 71.802 ns/op >> CopyOnWriteArrayListBenchmark.readInstanceEmpty avgt 10 2607.447 ? 46.400 ns/op >> >> >> After: >> >> Benchmark Mode Cnt Score Error Units >> CopyOnWriteArrayListBenchmark.clear avgt 5 75.365 ? 2.092 ns/op >> CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 20.803 ? 0.539 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.808 ? 0.582 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 12.980 ? 0.418 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.627 ? 0.173 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 12.864 ? 0.408 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 12.931 ? 0.255 ns/op >> CopyOnWriteArrayListBenchmark.readInstance avgt 10 2615.500 ? 30.771 ns/op >> CopyOnWriteArrayListBenchmark.readInstanceEmpty avgt 10 2583.892 ? 62.086 ns/op > > jengebr has updated the pull request incrementally with one additional commit since the last revision: > > Adding benchmarks for readObject I think this is good. I'll let Doug and Viktor to confirm their comments were addressed. ------------- Marked as reviewed by shade (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19527#pullrequestreview-2102178280 From prasad.velagapudi at servicenow.com Thu Jun 6 14:40:04 2024 From: prasad.velagapudi at servicenow.com (Prasad Velagapudi) Date: Thu, 6 Jun 2024 14:40:04 +0000 Subject: Lambda Classes reachability from GC roots in JDK11 and JDK17 In-Reply-To: References: Message-ID: Hello Lambda Experts, I am looking for clarifications on the following questions. 1. I observed in my tests that lambda classes generated for inline lambda expressions (ex: LambdaUtil::print), are STRONGLY linked to defining class loader and never gets collected on GC. This behaviour is same in both JDK11 and JDK17. Can you please confirm is this accurate? 2. Also, I observed that the lambda classes generated for inline lambda expressions (ex: LambdaUtil::print) not adding additional overhead to Metaspace in JDK17 compared to that of JDK11 . Can you please confirm is this accurate? Regards, Prasad -------------- next part -------------- An HTML attachment was scrubbed... URL: From dl at openjdk.org Thu Jun 6 14:48:55 2024 From: dl at openjdk.org (Doug Lea) Date: Thu, 6 Jun 2024 14:48:55 GMT Subject: RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations [v3] In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 12:46:36 GMT, jengebr wrote: >> Improve `java/util/concurrent/CopyOnWriteArrayList` by eliminating needless cloning of Object[0] instances. This cloning is intended to prevent callers from changing array contents, but many `CopyOnWriteArrayList`s are allocated to size zero, or are otherwise maintained empty, so cloning is unnecessary. >> >> Results from the included JMH benchmark: >> Before: >> >> Benchmark Mode Cnt Score Error Units >> CopyOnWriteArrayListBenchmark.clear avgt 5 74.487 ? 1.793 ns/op >> CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 27.918 ? 0.759 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.656 ? 0.375 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 15.415 ? 0.489 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.608 ? 0.363 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 15.374 ? 0.260 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 15.688 ? 0.350 ns/op >> CopyOnWriteArrayListBenchmark.readInstance avgt 10 2625.125 ? 71.802 ns/op >> CopyOnWriteArrayListBenchmark.readInstanceEmpty avgt 10 2607.447 ? 46.400 ns/op >> >> >> After: >> >> Benchmark Mode Cnt Score Error Units >> CopyOnWriteArrayListBenchmark.clear avgt 5 75.365 ? 2.092 ns/op >> CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 20.803 ? 0.539 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.808 ? 0.582 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 12.980 ? 0.418 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.627 ? 0.173 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 12.864 ? 0.408 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 12.931 ? 0.255 ns/op >> CopyOnWriteArrayListBenchmark.readInstance avgt 10 2615.500 ? 30.771 ns/op >> CopyOnWriteArrayListBenchmark.readInstanceEmpty avgt 10 2583.892 ? 62.086 ns/op > > jengebr has updated the pull request incrementally with one additional commit since the last revision: > > Adding benchmarks for readObject Yes, I think this is now OK (and maybe barely worth doing). ------------- PR Comment: https://git.openjdk.org/jdk/pull/19527#issuecomment-2152726032 From jvernee at openjdk.org Thu Jun 6 15:21:45 2024 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 6 Jun 2024 15:21:45 GMT Subject: RFR: 8325984: 4 jcstress tests are failing in Tier6 4 times each In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 10:48:51 GMT, Aleksey Shipilev wrote: > I think only Oracle CIs run these tests through jtreg wrappers? We do run them in our CI. Not sure who else runs them that way. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19565#issuecomment-2152799029 From dfuchs at openjdk.org Thu Jun 6 15:22:51 2024 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Thu, 6 Jun 2024 15:22:51 GMT Subject: Integrated: 8333270: HandlersOnComplexResetUpdate and HandlersOnComplexUpdate tests fail with "Unexpected reference" if timeoutFactor is less than 1/3 In-Reply-To: References: Message-ID: On Fri, 31 May 2024 14:55:57 GMT, Daniel Fuchs wrote: > HandlersOnComplexResetUpdate and HandlersOnComplexUpdate tests verify that loggers are GC'ed (or not GC'ed) after a reset or an update. For that they poll a ReferenceQueue in a loop. The number of iteration is adjusted according to the jtreg timeout factor. However, the logic in the test did not expect that the timeout might be less than 1. > > This fix does two things: > > 1. fix the adjustCount logic - so that the number of iteration can only be increased > 2. use remove(timeout) instead of poll() in order to minimize the waiting time. This pull request has now been integrated. Changeset: d02cb742 Author: Daniel Fuchs URL: https://git.openjdk.org/jdk/commit/d02cb742f79e88c6438ca58a6357fe432fb286cb Stats: 16 lines in 2 files changed: 0 ins; 2 del; 14 mod 8333270: HandlersOnComplexResetUpdate and HandlersOnComplexUpdate tests fail with "Unexpected reference" if timeoutFactor is less than 1/3 Reviewed-by: jpai ------------- PR: https://git.openjdk.org/jdk/pull/19503 From sgehwolf at openjdk.org Thu Jun 6 15:38:06 2024 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Thu, 6 Jun 2024 15:38:06 GMT Subject: RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v32] In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 09:47:30 GMT, Severin Gehwolf wrote: >> Please review this patch which adds a jlink mode to the JDK which doesn't need the packaged modules being present. A.k.a run-time image based jlink. Fundamentally this patch adds an option to use `jlink` even though your JDK install might not come with the packaged modules (directory `jmods`). This is particularly useful to further reduce the size of a jlinked runtime. After the removal of the concept of a JRE, a common distribution mechanism is still the full JDK with all modules and packaged modules. However, packaged modules can incur an additional size tax. For example in a container scenario it could be useful to have a base JDK container including all modules, but without also delivering the packaged modules. This comes at a size advantage of `~25%`. Such a base JDK container could then be used to `jlink` application specific runtimes, further reducing the size of the application runtime image (App + JDK runtime; as a single image *or* separate bundles, depending on the app being modularized). >> >> The basic design of this approach is to add a jlink plugin for tracking non-class and non-resource files of a JDK install. I.e. files which aren't present in the jimage (`lib/modules`). This enables producing a `JRTArchive` class which has all the info of what constitutes the final jlinked runtime. >> >> Basic usage example: >> >> $ diff -u <(./bin/java --list-modules --limit-modules java.se) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules java.se) >> $ diff -u <(./bin/java --list-modules --limit-modules jdk.jlink) <(../linux-x86_64-server-release/images/jdk/bin/java --list-modules --limit-modules jdk.jlink) >> $ ls ../linux-x86_64-server-release/images/jdk/jmods >> java.base.jmod java.net.http.jmod java.sql.rowset.jmod jdk.crypto.ec.jmod jdk.internal.opt.jmod jdk.jdi.jmod jdk.management.agent.jmod jdk.security.auth.jmod >> java.compiler.jmod java.prefs.jmod java.transaction.xa.jmod jdk.dynalink.jmod jdk.internal.vm.ci.jmod jdk.jdwp.agent.jmod jdk.management.jfr.jmod jdk.security.jgss.jmod >> java.datatransfer.jmod java.rmi.jmod java.xml.crypto.jmod jdk.editpad.jmod jdk.internal.vm.compiler.jmod jdk.jfr.jmod jdk.management.jmod jdk.unsupported.desktop.jmod >> java.desktop.jmod java.scripting.jmod java.xml.jmod jdk.hotspot.agent.jmod jdk.i... > > Severin Gehwolf has updated the pull request incrementally with one additional commit since the last revision: > > Fix default description of keep-packaged-modules OK. I'm aware about the timelines for JDK 23. Thanks for bringing clarity to this. My aim will be to bring this into JDK 24 with a JEP then. Hopefully we can bring this to a successful conclusion that way. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-2152833052 From duke at openjdk.org Thu Jun 6 15:56:07 2024 From: duke at openjdk.org (Robert Toyonaga) Date: Thu, 6 Jun 2024 15:56:07 GMT Subject: RFR: 8332400: isspace argument should be a valid unsigned char Message-ID: ### Summary This change ensures we don't get undefined behavior when calling[`isspace`](https://pubs.opengroup.org/onlinepubs/007904975/functions/isspace.html). `isspace` accepts an `int` argument that "the application shall ensure is a character representable as an unsigned char or equal to the value of the macro EOF.". Previously, there was no checking of the values passed to `isspace`. I've replaced direct calls with a new wrapper `os::is_space` that performs a range check and prevents the possibility of undefined behavior from happening. For instances outside of Hotspot, I've added casts to `unsigned char`. **Testing** - Added a new test in `test/hotspot/gtest/runtime/test_os.cpp` to check `os::is_space` is working correctly. - tier1 ------------- Commit messages: - Prevent undefined behaviour when calling isspace. Changes: https://git.openjdk.org/jdk/pull/19567/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19567&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8332400 Stats: 31 lines in 8 files changed: 20 ins; 0 del; 11 mod Patch: https://git.openjdk.org/jdk/pull/19567.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19567/head:pull/19567 PR: https://git.openjdk.org/jdk/pull/19567 From darcy at openjdk.org Thu Jun 6 16:04:56 2024 From: darcy at openjdk.org (Joe Darcy) Date: Thu, 6 Jun 2024 16:04:56 GMT Subject: Integrated: 8330182: Start of release updates for JDK 24 In-Reply-To: References: Message-ID: On Mon, 15 Apr 2024 19:01:08 GMT, Joe Darcy wrote: > Get JDK 24 underway. This pull request has now been integrated. Changeset: 75dc2f85 Author: Joe Darcy Committer: Jesper Wilhelmsson URL: https://git.openjdk.org/jdk/commit/75dc2f8518d0adea30f7065d6732b807c0220756 Stats: 2083 lines in 50 files changed: 2019 ins; 7 del; 57 mod 8330182: Start of release updates for JDK 24 8330183: Add SourceVersion.RELEASE_24 8330184: Add source 24 and target 24 to javac Reviewed-by: iris, vromero, asotona, dholmes ------------- PR: https://git.openjdk.org/jdk/pull/18787 From acobbs at openjdk.org Thu Jun 6 17:03:57 2024 From: acobbs at openjdk.org (Archie Cobbs) Date: Thu, 6 Jun 2024 17:03:57 GMT Subject: RFR: 8322256: Define and document GZIPInputStream concatenated stream semantics [v5] In-Reply-To: References: Message-ID: > `GZIPInputStream` supports reading data from multiple concatenated GZIP data streams since [JDK-4691425](https://bugs.openjdk.org/browse/JDK-4691425). In order to do this, after a GZIP trailer frame is read, it attempts to read a GZIP header frame and, if successful, proceeds onward to decompress the new stream. If the attempt to decode a GZIP header frame fails, or happens to trigger an `IOException`, it just ignores the trailing garbage and/or the `IOException` and returns EOF. > > There are several issues with this: > > 1. The behaviors of (a) supporting concatenated streams and (b) ignoring trailing garbage are not documented, much less precisely specified. > 2. Ignoring trailing garbage is dubious because it could easily hide errors or other data corruption that an application would rather be notified about. Moreover, the API claims that a `ZipException` will be thrown when corrupt data is read, but obviously that doesn't happen in the trailing garbage scenario (so N concatenated streams where the last one has a corrupted header frame is indistinguishable from N-1 valid streams). > 3. There's no way to create a `GZIPInputStream` that does _not_ support stream concatenation. > > On the other hand, `GZIPInputStream` is an old class with lots of existing usage, so it's important to preserve the existing behavior, warts and all (note: my the definition of "existing behavior" here includes the bug fix in [JDK-7036144](https://bugs.openjdk.org/browse/JDK-7036144)). > > So this patch adds a new constructor that takes two new parameters `allowConcatenation` and `allowTrailingGarbage`. The legacy behavior is enabled by setting both to true; otherwise, they do what they sound like. In particular, when `allowTrailingGarbage` is false, then the underlying input must contain exactly one (if `allowConcatenation` is false) or exactly N (if `allowConcatenation` is true) concatenated GZIP data streams, otherwise an exception is guaranteed. Archie Cobbs has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 12 commits: - Bump @since from 23 to 24. - Merge branch 'master' into JDK-8322256 - Relabel "trailing garbage" as "extra bytes" to sound less accusatory. - Simplify code by eliminating an impossible case. - Field name change and Javadoc wording tweaks. - Merge branch 'master' into JDK-8322256 - Javadoc wording tweaks. - Merge branch 'master' into JDK-8322256 - Clarify exceptions: sometimes ZipException, sometimes EOFException. - Merge branch 'master' into JDK-8322256 - ... and 2 more: https://git.openjdk.org/jdk/compare/75dc2f85...f845a75b ------------- Changes: https://git.openjdk.org/jdk/pull/18385/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18385&range=04 Stats: 318 lines in 2 files changed: 292 ins; 13 del; 13 mod Patch: https://git.openjdk.org/jdk/pull/18385.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/18385/head:pull/18385 PR: https://git.openjdk.org/jdk/pull/18385 From naoto at openjdk.org Thu Jun 6 17:08:03 2024 From: naoto at openjdk.org (Naoto Sato) Date: Thu, 6 Jun 2024 17:08:03 GMT Subject: RFR: 8332161: Test restoring echo in the Console implementation (java.base) [v10] In-Reply-To: References: Message-ID: <4FMfXMA9-RY8ewee8ONkJX5dJk_Q9VDx_1d8r1QPoQ4=.27afd79b-5125-4725-a5ba-2c28a08a1225@github.com> > This test intends to verify the behavior of JdkConsole for the java.base module, wrt restoring the echo. The test assumes the internal methods that sets/gets the echo status of the platform. 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/19315/files - new: https://git.openjdk.org/jdk/pull/19315/files/c583c633..0e72fe46 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19315&range=09 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19315&range=08-09 Stats: 11 lines in 2 files changed: 1 ins; 6 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/19315.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19315/head:pull/19315 PR: https://git.openjdk.org/jdk/pull/19315 From naoto at openjdk.org Thu Jun 6 17:11:47 2024 From: naoto at openjdk.org (Naoto Sato) Date: Thu, 6 Jun 2024 17:11:47 GMT Subject: RFR: 8332161: Test restoring echo in the Console implementation (java.base) [v9] In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 09:05:23 GMT, Pavel Rappo wrote: >> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: >> >> Removed unnecessary add-opens > > test/jdk/java/io/Console/RestoreEchoTest.java line 66: > >> 64: OutputAnalyzer output = ProcessTools.executeProcess( >> 65: "expect", >> 66: "-n", > > What does `-n` do? It is for not reading the user's expect settings (`~/.expect.rc` if any) > test/jdk/java/io/Console/RestoreEchoTest.java line 72: > >> 70: "--add-opens=java.base/jdk.internal.io=ALL-UNNAMED", >> 71: "-Djdk.console=java.base", >> 72: "-classpath", testClasses, > > Consider this. If we remove `-classpath` (and `var testClasses`), not only will nothing break, but we'll be also able to use JUnit assertions and assumptions in `main` instead of manual check-then-throw. This will work because the expect-process will inherit the environment, which captures `CLASSPATH` ( see https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/ProcessBuilder.html#start() ). > > Again, the above is just something to consider. For all I know, you might've considered it already and rejected. I haven't considered that. Removed. > test/jdk/java/io/Console/restoreEcho.exp line 57: > >> 55: test "$rpprompt" "$rpinput" "-echo" "$rpexpected" >> 56: # See if the initialEcho is restored with `stty -a` >> 57: expect " $initialEcho " > > If you leave out those whitespace characters inside the quotes and `$initialEcho` expands to `-echo`, it will be treated as an option to `expect`, right? If so, consider this instead: > > expect -- $initialEcho > > But more importantly: could a test match `echo` in `-echo` and therefore falsely pass? The spaces before/after `$initialEcho` are exactly to distinguish "echo" from "-echo", otherwise the test falsely succeeds as you pointed out. Although the test works as expected as it is, adding `--` would be safer. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19315#discussion_r1629915235 PR Review Comment: https://git.openjdk.org/jdk/pull/19315#discussion_r1629915623 PR Review Comment: https://git.openjdk.org/jdk/pull/19315#discussion_r1629915890 From david.lloyd at redhat.com Thu Jun 6 17:37:25 2024 From: david.lloyd at redhat.com (David Lloyd) Date: Thu, 6 Jun 2024 12:37:25 -0500 Subject: [External] : Re: New candidate JEP: 471: Deprecate the Memory-Access Methods in sun.misc.Unsafe for Removal In-Reply-To: References: <20240503151140.68BE06C9AEE@eggemoggin.niobe.net> <990521CB-66E1-45E6-8019-79E2C0BF7FEE@oracle.com> <835bfb2c-3318-4869-b8ff-6b1d3c1b70ad@oracle.com> Message-ID: Just bumping this one more time. I intend to start by opening a JIRA to add the two proposed methods to `ReflectionFactory`, and go from there. I guess that we might need a JEP for the proposed serialization restrictions, which is going to be considerably more involved, so I'm putting that off as a second step for now, pending further discussion. On Wed, May 15, 2024 at 9:00?PM - wrote: > Indeed, ReflectionFactory. newConstructorForSerialization can be used to > access otherwise-private constructors. Before JDK-8315810, it could even > allocate one class and call the constructor of another class. > > I strongly support your proposal to restrict ReflectionFactory. > > Regards, Chen > > On Wed, May 15, 2024 at 6:23?PM David Lloyd > wrote: > >> >> >> On Tue, May 14, 2024 at 10:01?AM David Lloyd >> wrote: >> >>> (Moving to core-libs-dev) >>> >>> On Tue, May 14, 2024 at 9:40?AM Alan Bateman >>> wrote: >>> >>>> On 14/05/2024 14:42, David Lloyd wrote: >>>> >>>> ReflectionFactory allows access to serialization facilities without any >>>> access checking (other than the defunct SecurityManager checks). Perhaps >>>> this class could gain some more methods, like this: >>>> >>>> * `newGetterForSerialization(Field field)` - includes ability to access >>>> `objectStreamFields` and `serialVersionUID`, or these could be separate >>>> methods >>>> * `newSetterForSerialziation(Field field)` >>>> >>>> Does this seem workable? >>>> >>>> The intention with ReflectionFactory is that serialization libraries go >>>> through the readObject/writeObject and other magic methods, to avoid field >>>> access. >>>> >>>> Probably best to being this to core-libs-dev for further discussion. >>>> >>> >>> This doesn't match my recollection. The `readObject` and `writeObject` >>> methods are optional private methods which serializable classes *may* >>> provide when they want a bespoke serialization strategy (and the other >>> methods that are accessed via this special class are similar in this >>> regard). They are not in any way magical in that they do not provide the >>> means to perform this part of the serialization process, and thus they are >>> not a substitute for field access in serialization. According to >>> JDK-8164908, these methods were added because at the time, Unsafe was still >>> state of the art for custom serialization and IIOP to access fields (with >>> libraries using Field actively moving to Unsafe instead). However Unsafe >>> did not and does not provide access to methods, so in order to avoid the >>> aforementioned `add-opens` explosion, these methods were added as a >>> compromise. Now that Unsafe is being deprecated, it is my opinion that this >>> does need to be revisited because at the time, Unsafe was the recommended >>> approach. >>> >>> [1] https://bugs.openjdk.org/browse/JDK-8164908 >>> >> It seems to me that it might be a good idea (as part of 8305968 >> (Integrity by default)) to put the `ReflectionFactory` API behind a >> restricted method call somehow, even considered separately from the changes >> suggested above. Maybe in conjunction with a non-standard switch that works >> similarly to `--enable-native-access`, e.g. >> `--enable-serialization=org.serial.framework`? That would also somewhat >> mitigate the security risk of adding the aforementioned methods or >> something like them to this class. >> >> Should I open a bug for either (or both) of these suggestions? Or perhaps >> there is a better way to proceed? >> >> -- >> - DML ? he/him >> > -- - DML ? he/him -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgibbons at openjdk.org Thu Jun 6 17:44:05 2024 From: sgibbons at openjdk.org (Scott Gibbons) Date: Thu, 6 Jun 2024 17:44:05 GMT Subject: RFR: 8320448: Accelerate IndexOf using AVX2 [v52] In-Reply-To: References: Message-ID: On Thu, 30 May 2024 16:16:45 GMT, Scott Gibbons wrote: >> Re-write the IndexOf code without the use of the pcmpestri instruction, only using AVX2 instructions. This change accelerates String.IndexOf on average 1.3x for AVX2. The benchmark numbers: >> >> >> Benchmark Score Latest >> StringIndexOf.advancedWithMediumSub 343.573 317.934 0.925375393x >> StringIndexOf.advancedWithShortSub1 1039.081 1053.96 1.014319384x >> StringIndexOf.advancedWithShortSub2 55.828 110.541 1.980027943x >> StringIndexOf.constantPattern 9.361 11.906 1.271872663x >> StringIndexOf.searchCharLongSuccess 4.216 4.218 1.000474383x >> StringIndexOf.searchCharMediumSuccess 3.133 3.216 1.02649218x >> StringIndexOf.searchCharShortSuccess 3.76 3.761 1.000265957x >> StringIndexOf.success 9.186 9.713 1.057369911x >> StringIndexOf.successBig 14.341 46.343 3.231504079x >> StringIndexOfChar.latin1_AVX2_String 6220.918 12154.52 1.953814533x >> StringIndexOfChar.latin1_AVX2_char 5503.556 5540.044 1.006629895x >> StringIndexOfChar.latin1_SSE4_String 6978.854 6818.689 0.977049957x >> StringIndexOfChar.latin1_SSE4_char 5657.499 5474.624 0.967675646x >> StringIndexOfChar.latin1_Short_String 7132.541 6863.359 0.962260014x >> StringIndexOfChar.latin1_Short_char 16013.389 16162.437 1.009307711x >> StringIndexOfChar.latin1_mixed_String 7386.123 14771.622 1.999915517x >> StringIndexOfChar.latin1_mixed_char 9901.671 9782.245 0.987938803 > > Scott Gibbons has updated the pull request incrementally with one additional commit since the last revision: > > Fix copyright & a couple of comment typos Hi, everyone. I see that JDK 23 has now been forked, and new commits go into the JDK 24 branch. I would like to get this in as soon as possible to have as much time with fuzzers, etc. for everyone to be confident in the code. I have 3 positive reviews on this PR and would like to integrate. Please reply as soon as you reasonably can with objections or approval and I will integrate. Thanks. ------------- PR Comment: https://git.openjdk.org/jdk/pull/16753#issuecomment-2153072708 From liach at openjdk.org Thu Jun 6 17:51:44 2024 From: liach at openjdk.org (Chen Liang) Date: Thu, 6 Jun 2024 17:51:44 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 07:47:46 GMT, SendaoYan wrote: > Hi all, > This PR several extra empty spaces and extra empty lines in several Makefiles. It's trivial fix, no risk. > > Thanks. Changes requested by liach (Author). test/jdk/java/rmi/reliability/benchmark/bench/rmi/Makefile line 1: > 1: # This file change is dubious: 1. It does not have any trailing whitespace that can fail the skara checks. 2. If the duplicate blank lines in the end of this Makefile is indeed problematic (as fixed here), please fix the only other occasion in the JDK, which is the Makefile in the parent directory. (Checked with `\n$^\n$\Z` pattern in all Makefiles) Recommended actions: Either 1. Revert changes in this file; 2. Also update `test/jdk/java/rmi/reliability/benchmark/bench/Makefile` to remove the trailing blank line. ------------- PR Review: https://git.openjdk.org/jdk/pull/19537#pullrequestreview-2102735910 PR Review Comment: https://git.openjdk.org/jdk/pull/19537#discussion_r1629981196 From naoto at openjdk.org Thu Jun 6 17:54:45 2024 From: naoto at openjdk.org (Naoto Sato) Date: Thu, 6 Jun 2024 17:54:45 GMT Subject: RFR: 8332161: Test restoring echo in the Console implementation (java.base) [v9] In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 17:08:45 GMT, Naoto Sato wrote: >> test/jdk/java/io/Console/RestoreEchoTest.java line 72: >> >>> 70: "--add-opens=java.base/jdk.internal.io=ALL-UNNAMED", >>> 71: "-Djdk.console=java.base", >>> 72: "-classpath", testClasses, >> >> Consider this. If we remove `-classpath` (and `var testClasses`), not only will nothing break, but we'll be also able to use JUnit assertions and assumptions in `main` instead of manual check-then-throw. This will work because the expect-process will inherit the environment, which captures `CLASSPATH` ( see https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/ProcessBuilder.html#start() ). >> >> Again, the above is just something to consider. For all I know, you might've considered it already and rejected. > > I haven't considered that. Removed. Turned out that removing the classpath ends up not finding the test class: Error: Could not find or load main class RestoreEchoTest Caused by: java.lang.ClassNotFoundException: RestoreEchoTest ]; ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19315#discussion_r1629984403 From lancea at openjdk.org Thu Jun 6 18:02:43 2024 From: lancea at openjdk.org (Lance Andersen) Date: Thu, 6 Jun 2024 18:02:43 GMT Subject: RFR: 8026127: Deflater/Inflater documentation incomplete/misleading [v3] In-Reply-To: <5EcD6qP5xpBf57GZ0HXbmX2qEftWfIK9Ymj9Gz9qScM=.bae6d8ef-de5a-4a13-b5d9-9368d41b77a8@github.com> References: <7Iu3kTwrw2DX_FgG7f3H6N5Q-FLKNU4-mS07HcPyMTY=.f1a9c247-c49d-4513-9bde-485bc1f8e357@github.com> <5EcD6qP5xpBf57GZ0HXbmX2qEftWfIK9Ymj9Gz9qScM=.bae6d8ef-de5a-4a13-b5d9-9368d41b77a8@github.com> Message-ID: On Thu, 6 Jun 2024 14:02:03 GMT, Jaikiran Pai wrote: >> Can I please get a review of this doc-only change which proposes to improve the code snippet that's in `java.util.zip.Deflater` and `java.util.zip.Inflater` to better explain the usage of those classes? This addresses https://bugs.openjdk.org/browse/JDK-8026127. >> >> The commit in the PR cleans up the snippet to correctly compress/decompress till the `Deflater` and `Inflater` are `finished()`. Additionally, the snippet also shows that the `Deflater` and `Inflater` are expected to be closed when their usage it done, to release the resources held by those instances. >> >> I've run `make docs-image` locally to verify that the generated snippet content as well as the link from `Inflater` work fine in the rendered javadoc HTML. > > Jaikiran Pai has updated the pull request incrementally with two additional commits since the last revision: > > - minor change to the comment > - move the snippet to an external snippet thank you for converting the examples to take advantage of an external snippet Looks good Jai and thank you ------------- Marked as reviewed by lancea (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19507#pullrequestreview-2102777897 From rgiulietti at openjdk.org Thu Jun 6 18:21:04 2024 From: rgiulietti at openjdk.org (Raffaello Giulietti) Date: Thu, 6 Jun 2024 18:21:04 GMT Subject: RFR: 8333599: Improve description of \b matcher in j.u.r.Pattern Message-ID: A documentation-only change to match the original intent and the implemented behavior. ------------- Commit messages: - 8333599: Improve description of \b matcher in j.u.r.Pattern Changes: https://git.openjdk.org/jdk/pull/19583/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19583&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333599 Stats: 4 lines in 1 file changed: 1 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/19583.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19583/head:pull/19583 PR: https://git.openjdk.org/jdk/pull/19583 From kvn at openjdk.org Thu Jun 6 18:28:07 2024 From: kvn at openjdk.org (Vladimir Kozlov) Date: Thu, 6 Jun 2024 18:28:07 GMT Subject: RFR: 8320448: Accelerate IndexOf using AVX2 [v52] In-Reply-To: References: Message-ID: On Thu, 30 May 2024 16:16:45 GMT, Scott Gibbons wrote: >> Re-write the IndexOf code without the use of the pcmpestri instruction, only using AVX2 instructions. This change accelerates String.IndexOf on average 1.3x for AVX2. The benchmark numbers: >> >> >> Benchmark Score Latest >> StringIndexOf.advancedWithMediumSub 343.573 317.934 0.925375393x >> StringIndexOf.advancedWithShortSub1 1039.081 1053.96 1.014319384x >> StringIndexOf.advancedWithShortSub2 55.828 110.541 1.980027943x >> StringIndexOf.constantPattern 9.361 11.906 1.271872663x >> StringIndexOf.searchCharLongSuccess 4.216 4.218 1.000474383x >> StringIndexOf.searchCharMediumSuccess 3.133 3.216 1.02649218x >> StringIndexOf.searchCharShortSuccess 3.76 3.761 1.000265957x >> StringIndexOf.success 9.186 9.713 1.057369911x >> StringIndexOf.successBig 14.341 46.343 3.231504079x >> StringIndexOfChar.latin1_AVX2_String 6220.918 12154.52 1.953814533x >> StringIndexOfChar.latin1_AVX2_char 5503.556 5540.044 1.006629895x >> StringIndexOfChar.latin1_SSE4_String 6978.854 6818.689 0.977049957x >> StringIndexOfChar.latin1_SSE4_char 5657.499 5474.624 0.967675646x >> StringIndexOfChar.latin1_Short_String 7132.541 6863.359 0.962260014x >> StringIndexOfChar.latin1_Short_char 16013.389 16162.437 1.009307711x >> StringIndexOfChar.latin1_mixed_String 7386.123 14771.622 1.999915517x >> StringIndexOfChar.latin1_mixed_char 9901.671 9782.245 0.987938803 > > Scott Gibbons has updated the pull request incrementally with one additional commit since the last revision: > > Fix copyright & a couple of comment typos Let me do quick testing with latest mainline (JDK 24 now). ------------- PR Comment: https://git.openjdk.org/jdk/pull/16753#issuecomment-2153142794 From naoto at openjdk.org Thu Jun 6 18:34:59 2024 From: naoto at openjdk.org (Naoto Sato) Date: Thu, 6 Jun 2024 18:34:59 GMT Subject: RFR: 8332161: Test restoring echo in the Console implementation (java.base) [v11] In-Reply-To: References: Message-ID: > This test intends to verify the behavior of JdkConsole for the java.base module, wrt restoring the echo. The test assumes the internal methods that sets/gets the echo status of the platform. Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: Restored classpath ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19315/files - new: https://git.openjdk.org/jdk/pull/19315/files/0e72fe46..c6476270 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19315&range=10 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19315&range=09-10 Stats: 2 lines in 1 file changed: 2 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/19315.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19315/head:pull/19315 PR: https://git.openjdk.org/jdk/pull/19315 From liach at openjdk.org Thu Jun 6 18:40:04 2024 From: liach at openjdk.org (Chen Liang) Date: Thu, 6 Jun 2024 18:40:04 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base Message-ID: In java.base, especially in bytecode generators, we have many different methods converting known valid Class and MethodType into ClassDesc and MethodTypeDesc. These conversions should be consolidated into the same utility method for the ease of future maintenance. ------------- Commit messages: - Missed license header - Consolidate class/mt to desc operations Changes: https://git.openjdk.org/jdk/pull/19585/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19585&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333749 Stats: 160 lines in 8 files changed: 71 ins; 31 del; 58 mod Patch: https://git.openjdk.org/jdk/pull/19585.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19585/head:pull/19585 PR: https://git.openjdk.org/jdk/pull/19585 From liach at openjdk.org Thu Jun 6 18:48:58 2024 From: liach at openjdk.org (Chen Liang) Date: Thu, 6 Jun 2024 18:48:58 GMT Subject: RFR: 8333377: Migrate Generic Signature parsing to ClassFile API [v2] In-Reply-To: <8_XK2UpYcewLX40oL3TS0T7KGAgfBprN4aauvhVQBy4=.420255be-10a3-4a64-bac9-491b21983265@github.com> References: <8_XK2UpYcewLX40oL3TS0T7KGAgfBprN4aauvhVQBy4=.420255be-10a3-4a64-bac9-491b21983265@github.com> Message-ID: > Core reflection's generic signature parsing uses an ancient library with outdated visitor pattern on a tree model and contains unnecessary boilerplates. This is a duplication of ClassFile API's signature model. We should just move to ClassFile API, which is more throughoutly tested as well. > > To ensure compatibility, new tests are added to ensure consistent behavior when encountering malformed signatures or signatures with missing types. The reflective objects have been preserved and the only change is that lazy expansion now happens from CF objects, to reduce compatibility risks. Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 16 commits: - Merge branch 'master' of https://github.com/openjdk/jdk into feature/new-generic-info - Remove redundant try-catch in getEnclosingMethod/Constructor - Merge branch 'test/signature-error' into feature/new-generic-info - Fix everything - Fixxes - Stage - Stage new tests - Merge branch 'master' of https://github.com/openjdk/jdk into feature/new-generic-info - Merge branch 'master' of https://github.com/openjdk/jdk into feature/new-generic-info - Merge branch 'master' of https://github.com/openjdk/jdk into feature/new-generic-info - ... and 6 more: https://git.openjdk.org/jdk/compare/2a37764e...19ee8797 ------------- Changes: https://git.openjdk.org/jdk/pull/19281/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19281&range=01 Stats: 4605 lines in 66 files changed: 1027 ins; 3483 del; 95 mod Patch: https://git.openjdk.org/jdk/pull/19281.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19281/head:pull/19281 PR: https://git.openjdk.org/jdk/pull/19281 From duke at openjdk.org Thu Jun 6 18:53:48 2024 From: duke at openjdk.org (Chris Hennick) Date: Thu, 6 Jun 2024 18:53:48 GMT Subject: RFR: 8326227: Rounding error that may distort computeNextGaussian results [v3] In-Reply-To: References: Message-ID: On Wed, 21 Feb 2024 02:18:08 GMT, Chris Hennick wrote: >> This provides a slightly more accurate bounding limit for `computeNextExponentialSoftCapped` when calling it from `computeNextGaussian`. This could cause the `while (computeNextExponentialSoftCapped(rng, limit) < limit)` check in `computeNextGaussian` on line 1402 to always be true, making the `nextGaussian` runtime unbounded in the worst case; but more likely, it would give a result that was truncated too close to zero. >> >> This change is being tested prior to submission to OpenJDK by https://github.com/openjdk/jdk/pull/17703/commits/b8be051cbf40a6a05fafc6a2c76942e9e0b11fdf. > > Chris Hennick has updated the pull request incrementally with one additional commit since the last revision: > > Bug fix: add-exports was for wrong package keep open ------------- PR Comment: https://git.openjdk.org/jdk/pull/17703#issuecomment-2153184927 From redestad at openjdk.org Thu Jun 6 19:11:44 2024 From: redestad at openjdk.org (Claes Redestad) Date: Thu, 6 Jun 2024 19:11:44 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 18:35:01 GMT, Chen Liang wrote: > In java.base, especially in bytecode generators, we have many different methods converting known valid Class and MethodType into ClassDesc and MethodTypeDesc. These conversions should be consolidated into the same utility method for the ease of future maintenance. Looks good to me. Probably should get someone to OK changes in foreign/abi (@JornVernee perhaps?). There are some pre-existing places where we call `ReferenceClassDescImpl.ofValidated` directly that could probably be switched over to `ConstantUtils.classDesc` for slightly nicer code. Or - if it matters - add a `referenceClassDesc` which avoids the `type.isPrimitive` test. src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line 256: > 254: // the field name holding the method handle for this method > 255: String fieldName = "m" + count++; > 256: var mt = methodDesc(m.getReturnType(), JLRA.getExecutableSharedParameterTypes(m)); Suggestion: var md = methodDesc(m.getReturnType(), JLRA.getExecutableSharedParameterTypes(m)); src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java line 469: > 467: // o instanceof Wrapped(float) > 468: cb.aload(SELECTOR_OBJ); > 469: cb.instanceOf(classDesc(Wrapper.forBasicType(classLabel) I have a patch somewhere to cache the wrapper class desc in `sun.invoke.util.Wrapper`, both as a micro-optimization and to help disambigutate the unfortunately named (my bad) `Wrapper::classDescriptor` method. Maybe we can roll that into this..? src/java.base/share/classes/jdk/internal/foreign/abi/BindingSpecializer.java line 471: > 469: case Allocate allocate -> emitAllocBuffer(allocate); > 470: case BoxAddress boxAddress -> emitBoxAddress(boxAddress); > 471: case SegmentBase _ -> emitSegmentBase(); Seem a bit too far detached from the changes at hand for a drive-by code cleanup? ------------- Marked as reviewed by redestad (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19585#pullrequestreview-2102953208 PR Review Comment: https://git.openjdk.org/jdk/pull/19585#discussion_r1630049028 PR Review Comment: https://git.openjdk.org/jdk/pull/19585#discussion_r1630061889 PR Review Comment: https://git.openjdk.org/jdk/pull/19585#discussion_r1630074187 From liach at openjdk.org Thu Jun 6 19:14:44 2024 From: liach at openjdk.org (Chen Liang) Date: Thu, 6 Jun 2024 19:14:44 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 18:56:51 GMT, Claes Redestad wrote: >> In java.base, especially in bytecode generators, we have many different methods converting known valid Class and MethodType into ClassDesc and MethodTypeDesc. These conversions should be consolidated into the same utility method for the ease of future maintenance. > > src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java line 469: > >> 467: // o instanceof Wrapped(float) >> 468: cb.aload(SELECTOR_OBJ); >> 469: cb.instanceOf(classDesc(Wrapper.forBasicType(classLabel) > > I have a patch somewhere to cache the wrapper class desc in `sun.invoke.util.Wrapper`, both as a micro-optimization and to help disambigutate the unfortunately named (my bad) `Wrapper::classDescriptor` method. Maybe we can roll that into this..? Feel free, or you can get your patch merged first and then I base off yours if yours is ready. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19585#discussion_r1630091038 From liach at openjdk.org Thu Jun 6 19:24:14 2024 From: liach at openjdk.org (Chen Liang) Date: Thu, 6 Jun 2024 19:24:14 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base [v2] In-Reply-To: References: Message-ID: > In java.base, especially in bytecode generators, we have many different methods converting known valid Class and MethodType into ClassDesc and MethodTypeDesc. These conversions should be consolidated into the same utility method for the ease of future maintenance. Chen Liang has updated the pull request incrementally with one additional commit since the last revision: mt -> md (desc) ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19585/files - new: https://git.openjdk.org/jdk/pull/19585/files/cb4f6d13..3e28306f Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19585&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19585&range=00-01 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/19585.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19585/head:pull/19585 PR: https://git.openjdk.org/jdk/pull/19585 From liach at openjdk.org Thu Jun 6 19:24:14 2024 From: liach at openjdk.org (Chen Liang) Date: Thu, 6 Jun 2024 19:24:14 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base [v2] In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 19:01:02 GMT, Claes Redestad wrote: >> Chen Liang has updated the pull request incrementally with one additional commit since the last revision: >> >> mt -> md (desc) > > src/java.base/share/classes/jdk/internal/foreign/abi/BindingSpecializer.java line 471: > >> 469: case Allocate allocate -> emitAllocBuffer(allocate); >> 470: case BoxAddress boxAddress -> emitBoxAddress(boxAddress); >> 471: case SegmentBase _ -> emitSegmentBase(); > > Seem a bit too far detached from the changes at hand for a drive-by code cleanup? My uncontrollable urges to fix these minor IDE warnings... Please allow these fixes, as I have similar changes in ProxyGenerator as well. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19585#discussion_r1630100819 From jvernee at openjdk.org Thu Jun 6 19:42:44 2024 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 6 Jun 2024 19:42:44 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base [v2] In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 19:24:14 GMT, Chen Liang wrote: >> In java.base, especially in bytecode generators, we have many different methods converting known valid Class and MethodType into ClassDesc and MethodTypeDesc. These conversions should be consolidated into the same utility method for the ease of future maintenance. > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > mt -> md (desc) src/java.base/share/classes/jdk/internal/constant/ConstantUtils.java line 76: > 74: * type and parameter types can be described nominally. > 75: */ > 76: public static MethodTypeDesc methodDesc(MethodType type) { Please name these methods `methodTypeDesc`, since we also have the `Method` type. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19585#discussion_r1630114413 From liach at openjdk.org Thu Jun 6 19:46:47 2024 From: liach at openjdk.org (Chen Liang) Date: Thu, 6 Jun 2024 19:46:47 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base [v2] In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 19:09:36 GMT, Claes Redestad wrote: > There are some pre-existing places where we call `ReferenceClassDescImpl.ofValidated` directly that could probably be switched over to `ConstantUtils.classDesc` for slightly nicer code. Or - if it matters - add a `referenceClassDesc` which avoids the `type.isPrimitive` test. I think the main advantage of `ofValidated` is that it avoids descriptor string computation from class objects and should be kept in performance-sensitive code. `referenceClassDesc` would be feasible for less performance-demanding code's initialization and known safe conversions (a few APIs in CF API expects non-primitive CDs already). But should its implementation be `ofValidated` or `ofValidatedBinaryName` (same question for ClassDesc)? We used `ofValidatedBinaryName` here instead of a `toClassDesc` (which calls `ofValidated` via `descriptorString`) ------------- PR Comment: https://git.openjdk.org/jdk/pull/19585#issuecomment-2153281690 From smarks at openjdk.org Thu Jun 6 19:53:32 2024 From: smarks at openjdk.org (Stuart Marks) Date: Thu, 6 Jun 2024 19:53:32 GMT Subject: RFR: 8333599: Improve description of \b matcher in j.u.r.Pattern In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 18:16:14 GMT, Raffaello Giulietti wrote: > A documentation-only change to match the original intent and the implemented behavior. Looks good. The old version with the lookahead and lookbehind was hard to understand and it was inaccurate as well. The descriptive text is easier to understand and more accurate. ------------- Marked as reviewed by smarks (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19583#pullrequestreview-2103079803 From prappo at openjdk.org Thu Jun 6 20:36:12 2024 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 6 Jun 2024 20:36:12 GMT Subject: RFR: 8332161: Test restoring echo in the Console implementation (java.base) [v9] In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 17:51:50 GMT, Naoto Sato wrote: > Turned out that removing the classpath ends up not finding the test class: > > ``` > Error: Could not find or load main class RestoreEchoTest > Caused by: java.lang.ClassNotFoundException: RestoreEchoTest > ]; > ``` Hm... this is surprising. On my machine, `testSrc` expands to the `JTwork/classes/0/java/io/Console/RestoreEchoTest.d` directory, which is included in `CLASSPATH` and which contains `RestoreEchoTest.class`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19315#discussion_r1630200122 From jlu at openjdk.org Thu Jun 6 20:37:16 2024 From: jlu at openjdk.org (Justin Lu) Date: Thu, 6 Jun 2024 20:37:16 GMT Subject: Integrated: 8333456: CompactNumberFormat integer parsing fails when string has no suffix In-Reply-To: References: Message-ID: On Mon, 3 Jun 2024 22:32:54 GMT, Justin Lu wrote: > Please review this PR which handles incorrect CompactNumberFormat integer only parsing when there is no suffix. > > See the following snippet, > > > var fmt = NumberFormat.getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT) > fmt.setParseIntegerOnly(true) > fmt.parse("5K") // returns 5000 > fmt.parse("50.00") // returns 50 > fmt.parse("5") // unexpectedly throws StringIndexOutOfBoundsException > fmt.parse("5 ") // returns 5 > > > Within the `parse` method, there is code that advances `position` past the fractional portion to find the suffix when `parseIntegerOnly()` is true. However, if a valid string input is given with no suffix, `DecimalFormat.subparseNumber()` will fully iterate through the string and `position` will be equal to the length of the string, throwing StringIndexOutOfBoundsException when `charAt` is invoked (line 1740). > > We should check to make sure position does not exceed the string length before deciding to check for a decimal symbol. This pull request has now been integrated. Changeset: 6238bc8d Author: Justin Lu URL: https://git.openjdk.org/jdk/commit/6238bc8da2abe7a1f0cdd98c0af01e9ba1869ec3 Stats: 26 lines in 2 files changed: 24 ins; 0 del; 2 mod 8333456: CompactNumberFormat integer parsing fails when string has no suffix Reviewed-by: naoto ------------- PR: https://git.openjdk.org/jdk/pull/19533 From kvn at openjdk.org Thu Jun 6 20:40:28 2024 From: kvn at openjdk.org (Vladimir Kozlov) Date: Thu, 6 Jun 2024 20:40:28 GMT Subject: RFR: 8320448: Accelerate IndexOf using AVX2 [v52] In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 17:41:20 GMT, Scott Gibbons wrote: >> Scott Gibbons has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix copyright & a couple of comment typos > > Hi, everyone. I see that JDK 23 has now been forked, and new commits go into the JDK 24 branch. I would like to get this in as soon as possible to have as much time with fuzzers, etc. for everyone to be confident in the code. > > I have 3 positive reviews on this PR and would like to integrate. Please reply as soon as you reasonably can with objections or approval and I will integrate. Thanks. @asgibbons, my testing almost finished. No new failures. I think this can be pushed now. Thank you for waiting! ------------- PR Comment: https://git.openjdk.org/jdk/pull/16753#issuecomment-2153366787 From prappo at openjdk.org Thu Jun 6 20:57:14 2024 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 6 Jun 2024 20:57:14 GMT Subject: RFR: 8332161: Test restoring echo in the Console implementation (java.base) [v9] In-Reply-To: References: Message-ID: <9Tt4sIajoljcLVF53TpgvjcXn6lVaRw_LVtf63bdDhk=.8ca22c8d-1cd7-4910-a027-d2599905c1fb@github.com> On Thu, 6 Jun 2024 17:08:50 GMT, Naoto Sato wrote: >> test/jdk/java/io/Console/restoreEcho.exp line 57: >> >>> 55: test "$rpprompt" "$rpinput" "-echo" "$rpexpected" >>> 56: # See if the initialEcho is restored with `stty -a` >>> 57: expect " $initialEcho " >> >> If you leave out those whitespace characters inside the quotes and `$initialEcho` expands to `-echo`, it will be treated as an option to `expect`, right? If so, consider this instead: >> >> expect -- $initialEcho >> >> But more importantly: could a test match `echo` in `-echo` and therefore falsely pass? > > The spaces before/after `$initialEcho` are exactly to distinguish "echo" from "-echo", otherwise the test falsely succeeds as you pointed out. Although the test works as expected as it is, adding `--` would be safer. It's clever. However, we now depend on `(-)echo` being in the middle of the line, no? If `stty -a` format (IEEE Std 1003.2) allows `(-)echo` to appear in an arbitrary position of a line, our check won't work. If `(-)echo` appears in a leading position, it might be preceded by a TAB (similarly to `-echoprt` below). If `(-)echo` appears in a trailing position, it is followed by newline (similarly to `echoctl` below). lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl$ ^I-echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo$ ^I-extproc$ But I guess, it's good enough and certainly much better than the initially proposed unit test. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19315#discussion_r1630230512 From dholmes at openjdk.org Thu Jun 6 21:24:12 2024 From: dholmes at openjdk.org (David Holmes) Date: Thu, 6 Jun 2024 21:24:12 GMT Subject: RFR: 8332400: isspace argument should be a valid unsigned char In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 20:08:10 GMT, Robert Toyonaga wrote: > ### Summary > This change ensures we don't get undefined behavior when calling[`isspace`](https://pubs.opengroup.org/onlinepubs/007904975/functions/isspace.html). `isspace` accepts an `int` argument that "the application shall ensure is a character representable as an unsigned char or equal to the value of the macro EOF.". > > Previously, there was no checking of the values passed to `isspace`. I've replaced direct calls with a new wrapper `os::is_space` that performs a range check and prevents the possibility of undefined behavior from happening. For instances outside of Hotspot, I've added casts to `unsigned char`. > > **Testing** > - Added a new test in `test/hotspot/gtest/runtime/test_os.cpp` to check `os::is_space` is working correctly. > - tier1 Sorry I think this is well-intentioned but unnecessary in nearly all cases. If you pass a char there is no potential problem. Only passing an actual int could be a problem. src/hotspot/os/linux/cgroupSubsystem_linux.cpp line 664: > 662: char after_key = line[key_len]; > 663: if (strncmp(line, key, key_len) == 0 > 664: && os::is_space(after_key) != 0 I think this is excessive. The value is a char so cannot be a problem. The only calls to isspace that need checking are those that actually pass an int, and even then there could be adequate safeguards in place. src/hotspot/os/linux/os_linux.cpp line 1356: > 1354: if (s) { > 1355: // Skip blank chars > 1356: do { s++; } while (s && os::is_space(*s)); Again not needed. ------------- PR Review: https://git.openjdk.org/jdk/pull/19567#pullrequestreview-2103234054 PR Review Comment: https://git.openjdk.org/jdk/pull/19567#discussion_r1630265925 PR Review Comment: https://git.openjdk.org/jdk/pull/19567#discussion_r1630266490 From liach at openjdk.org Thu Jun 6 21:44:59 2024 From: liach at openjdk.org (Chen Liang) Date: Thu, 6 Jun 2024 21:44:59 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base [v3] In-Reply-To: References: Message-ID: <1IFJQFo8lSETZiScFUYARY8anru4CF5rHm_nZGId4eA=.f398ca15-0427-477f-ad0f-31a5d6e66b61@github.com> > In java.base, especially in bytecode generators, we have many different methods converting known valid Class and MethodType into ClassDesc and MethodTypeDesc. These conversions should be consolidated into the same utility method for the ease of future maintenance. Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision: - Merge branch 'master' of https://github.com/openjdk/jdk into cleanup/consolidate-todesc - Add referenceClassDesc, move ReferenceClassDescImpl.ofValidatedBinaryName to ConstantUtils.binaryNameToDesc - mt -> md (desc) - Missed license header - Consolidate class/mt to desc operations ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19585/files - new: https://git.openjdk.org/jdk/pull/19585/files/3e28306f..89bc5d8d Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19585&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19585&range=01-02 Stats: 2350 lines in 73 files changed: 2189 ins; 26 del; 135 mod Patch: https://git.openjdk.org/jdk/pull/19585.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19585/head:pull/19585 PR: https://git.openjdk.org/jdk/pull/19585 From sgibbons at openjdk.org Thu Jun 6 21:47:26 2024 From: sgibbons at openjdk.org (Scott Gibbons) Date: Thu, 6 Jun 2024 21:47:26 GMT Subject: RFR: 8320448: Accelerate IndexOf using AVX2 [v49] In-Reply-To: <9Gep5o1EEF96gprsHB1vDiw8KSQON-c6uh_9gBJyq9c=.43962158-2f23-4929-9e72-d4827a4fa5e8@github.com> References: <9PIuILHZnLHrZf1sz0Dsq6iup6qgyXw50mD0nGVS04c=.63bd0afd-d818-46fa-a082-a3d2066829cd@github.com> <4ZM8wZFYPZjIbjb_O6n6DNAlpYOa2EHfmhSZHVUAXNA=.b923e319-f143-4a4c-9916-face36f337db@github.com> <9Gep5o1EEF96gprsHB1vDiw8KSQON-c6uh_9gBJyq9c=.43962158-2f23-4929-9e72-d4827a4fa5e8@github.com> Message-ID: <8kmAaqEcZiqqRB0MSsNG2jbHkgQ-9p3DH_AHBZsBwr0=.be5d30cd-03b4-4446-8105-1d694cd3d7e4@github.com> On Thu, 30 May 2024 16:20:02 GMT, Emanuel Peter wrote: >> @vnkozlov OK. I'll defer to you all. I've contacted the author of the fuzzer to see what I can do to set up a local instance. Would this be sufficient to increase confidence for future submissions? We can run it perpetually on fixes (provided I can set it up). Had I done that, we could have had 6 months of fuzzing on top of our tests. Would that have alleviated this concern? > > @asgibbons I generally just stop pushing ANY RFE's a week or two before the fork. Even if you did run the fuzzer with it - there are often last-minute changes. And your code here is rather large, so even if you are confident, there must be at least one bug hiding. > > Running the fuzzer is nice as pre-integration, but it mostly only catches things post-integration. @eme64 Are you OK with me integrating? ------------- PR Comment: https://git.openjdk.org/jdk/pull/16753#issuecomment-2153456076 From naoto at openjdk.org Thu Jun 6 21:49:35 2024 From: naoto at openjdk.org (Naoto Sato) Date: Thu, 6 Jun 2024 21:49:35 GMT Subject: RFR: 8332161: Test restoring echo in the Console implementation (java.base) [v12] In-Reply-To: References: Message-ID: <5ac8-ZK1FeJdtdZsG8WQRFkdOFHD1Q_aT1rKYZ19lQ4=.3205fa59-10a5-4a14-b49c-98410b82cb6d@github.com> > This test intends to verify the behavior of JdkConsole for the java.base module, wrt restoring the echo. The test assumes the internal methods that sets/gets the echo status of the platform. Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: Loosening the timeout value ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19315/files - new: https://git.openjdk.org/jdk/pull/19315/files/c6476270..df5f8f91 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19315&range=11 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19315&range=10-11 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/19315.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19315/head:pull/19315 PR: https://git.openjdk.org/jdk/pull/19315 From liach at openjdk.org Thu Jun 6 21:56:15 2024 From: liach at openjdk.org (Chen Liang) Date: Thu, 6 Jun 2024 21:56:15 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base [v2] In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 19:30:21 GMT, Jorn Vernee wrote: >> Chen Liang has updated the pull request incrementally with one additional commit since the last revision: >> >> mt -> md (desc) > > src/java.base/share/classes/jdk/internal/constant/ConstantUtils.java line 76: > >> 74: * type and parameter types can be described nominally. >> 75: */ >> 76: public static MethodTypeDesc methodDesc(MethodType type) { > > Please name these methods `methodTypeDesc`, since we also have the `Method` type. Thanks for the suggestion. Done. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19585#discussion_r1630306158 From smarks at openjdk.org Fri Jun 7 00:26:11 2024 From: smarks at openjdk.org (Stuart Marks) Date: Fri, 7 Jun 2024 00:26:11 GMT Subject: RFR: 8333599: Improve description of \b matcher in j.u.r.Pattern In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 18:16:14 GMT, Raffaello Giulietti wrote: > A documentation-only change to match the original intent and the implemented behavior. Oh, this needs a CSR too, since it's a change to a normative assertion. Should be pretty simple though. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19583#issuecomment-2153628785 From jpai at openjdk.org Fri Jun 7 00:38:23 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Fri, 7 Jun 2024 00:38:23 GMT Subject: RFR: 8026127: Deflater/Inflater documentation incomplete/misleading [v3] In-Reply-To: <5EcD6qP5xpBf57GZ0HXbmX2qEftWfIK9Ymj9Gz9qScM=.bae6d8ef-de5a-4a13-b5d9-9368d41b77a8@github.com> References: <7Iu3kTwrw2DX_FgG7f3H6N5Q-FLKNU4-mS07HcPyMTY=.f1a9c247-c49d-4513-9bde-485bc1f8e357@github.com> <5EcD6qP5xpBf57GZ0HXbmX2qEftWfIK9Ymj9Gz9qScM=.bae6d8ef-de5a-4a13-b5d9-9368d41b77a8@github.com> Message-ID: <7xoQEr5Ooli93ufrumtVK5GcZIPTryVuCNT0u7L07MQ=.511c7f67-2322-45b2-8e17-405c8e92bbac@github.com> On Thu, 6 Jun 2024 14:02:03 GMT, Jaikiran Pai wrote: >> Can I please get a review of this doc-only change which proposes to improve the code snippet that's in `java.util.zip.Deflater` and `java.util.zip.Inflater` to better explain the usage of those classes? This addresses https://bugs.openjdk.org/browse/JDK-8026127. >> >> The commit in the PR cleans up the snippet to correctly compress/decompress till the `Deflater` and `Inflater` are `finished()`. Additionally, the snippet also shows that the `Deflater` and `Inflater` are expected to be closed when their usage it done, to release the resources held by those instances. >> >> I've run `make docs-image` locally to verify that the generated snippet content as well as the link from `Inflater` work fine in the rendered javadoc HTML. > > Jaikiran Pai has updated the pull request incrementally with two additional commits since the last revision: > > - minor change to the comment > - move the snippet to an external snippet Thank you Lance for the review. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19507#issuecomment-2153639493 From jpai at openjdk.org Fri Jun 7 00:38:24 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Fri, 7 Jun 2024 00:38:24 GMT Subject: Integrated: 8026127: Deflater/Inflater documentation incomplete/misleading In-Reply-To: <7Iu3kTwrw2DX_FgG7f3H6N5Q-FLKNU4-mS07HcPyMTY=.f1a9c247-c49d-4513-9bde-485bc1f8e357@github.com> References: <7Iu3kTwrw2DX_FgG7f3H6N5Q-FLKNU4-mS07HcPyMTY=.f1a9c247-c49d-4513-9bde-485bc1f8e357@github.com> Message-ID: On Sat, 1 Jun 2024 04:33:57 GMT, Jaikiran Pai wrote: > Can I please get a review of this doc-only change which proposes to improve the code snippet that's in `java.util.zip.Deflater` and `java.util.zip.Inflater` to better explain the usage of those classes? This addresses https://bugs.openjdk.org/browse/JDK-8026127. > > The commit in the PR cleans up the snippet to correctly compress/decompress till the `Deflater` and `Inflater` are `finished()`. Additionally, the snippet also shows that the `Deflater` and `Inflater` are expected to be closed when their usage it done, to release the resources held by those instances. > > I've run `make docs-image` locally to verify that the generated snippet content as well as the link from `Inflater` work fine in the rendered javadoc HTML. This pull request has now been integrated. Changeset: d8af5894 Author: Jaikiran Pai URL: https://git.openjdk.org/jdk/commit/d8af58941b5dedb9774c0971895c4924e57ac28b Stats: 155 lines in 3 files changed: 96 ins; 57 del; 2 mod 8026127: Deflater/Inflater documentation incomplete/misleading Reviewed-by: lancea ------------- PR: https://git.openjdk.org/jdk/pull/19507 From denis.gauthier at oracle.com Fri Jun 7 02:10:55 2024 From: denis.gauthier at oracle.com (Denis Gauthier) Date: Fri, 7 Jun 2024 02:10:55 +0000 Subject: [External] : Status of project "Brisbane"? In-Reply-To: References: Message-ID: Thanks for asking, Volker. At this stage we're still bootstrapping the project and going through internal processes to publish its OpenJDK repositories with code. We?re also juggling other projects. I can let you know once the mailing list and repository are available. In the meantime, feel free to ping me again if you don't hear anything in the next couple of months. Best regards, Denis From: Volker Simonis Date: Tuesday, 4 June 2024 at 1:03?AM To: core-libs-dev at openjdk.org , security-dev , Denis Gauthier Subject: [External] : Status of project "Brisbane"? Hi, What's the status of Project Brisbane? According to [1], the Project was approved two month ago on April 4th, but until now I can't find it listed on openjdk.org nor can I find a corresponding mailing list? Best regards, Volker [1] https://mail.openjdk.org/pipermail/announce/2024-April/000350.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From darcy at openjdk.org Fri Jun 7 04:53:36 2024 From: darcy at openjdk.org (Joe Darcy) Date: Fri, 7 Jun 2024 04:53:36 GMT Subject: RFR: 8333768: Minor doc updates to java.lang.{Float, Double} Message-ID: Misc small doc updates and addition of `@Overrides` annotations. ------------- Commit messages: - JDK-8333768: Minor doc updates to java.lang.{Float, Double} Changes: https://git.openjdk.org/jdk/pull/19590/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19590&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333768 Stats: 55 lines in 2 files changed: 40 ins; 2 del; 13 mod Patch: https://git.openjdk.org/jdk/pull/19590.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19590/head:pull/19590 PR: https://git.openjdk.org/jdk/pull/19590 From alanb at openjdk.org Fri Jun 7 04:58:11 2024 From: alanb at openjdk.org (Alan Bateman) Date: Fri, 7 Jun 2024 04:58:11 GMT Subject: RFR: 8333599: Improve description of \b matcher in j.u.r.Pattern In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 18:16:14 GMT, Raffaello Giulietti wrote: > A documentation-only change to match the original intent and the implemented behavior. Yes, this one needs a CSR. ------------- Marked as reviewed by alanb (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19583#pullrequestreview-2103635744 From epeter at openjdk.org Fri Jun 7 05:08:26 2024 From: epeter at openjdk.org (Emanuel Peter) Date: Fri, 7 Jun 2024 05:08:26 GMT Subject: RFR: 8320448: Accelerate IndexOf using AVX2 [v49] In-Reply-To: <8kmAaqEcZiqqRB0MSsNG2jbHkgQ-9p3DH_AHBZsBwr0=.be5d30cd-03b4-4446-8105-1d694cd3d7e4@github.com> References: <9PIuILHZnLHrZf1sz0Dsq6iup6qgyXw50mD0nGVS04c=.63bd0afd-d818-46fa-a082-a3d2066829cd@github.com> <4ZM8wZFYPZjIbjb_O6n6DNAlpYOa2EHfmhSZHVUAXNA=.b923e319-f143-4a4c-9916-face36f337db@github.com> <9Gep5o1EEF96gprsHB1vDiw8KSQON-c6uh_9gBJyq9c=.43962158-2f23-4929-9e72-d4827a4fa5e8@github.com> <8kmAaqEcZiqqRB0MSsNG2jbHkgQ-9p3DH_AHBZsBwr0=.be5d30cd-03b4-4446-8105-1d694cd3d7e4@github.com> Message-ID: <0XVuJ7gECpxt76s5lju6aMOqcZK9MJ07dtlumvonwZw=.3f199acf-047c-4aee-bcc6-e3fa9f4f4bf5@github.com> On Thu, 6 Jun 2024 21:44:44 GMT, Scott Gibbons wrote: >> @asgibbons I generally just stop pushing ANY RFE's a week or two before the fork. Even if you did run the fuzzer with it - there are often last-minute changes. And your code here is rather large, so even if you are confident, there must be at least one bug hiding. >> >> Running the fuzzer is nice as pre-integration, but it mostly only catches things post-integration. > > @eme64 Are you OK with me integrating? @asgibbons yes, ship it! ? Thanks for waiting! ------------- PR Comment: https://git.openjdk.org/jdk/pull/16753#issuecomment-2154015592 From stuefe at openjdk.org Fri Jun 7 06:10:12 2024 From: stuefe at openjdk.org (Thomas Stuefe) Date: Fri, 7 Jun 2024 06:10:12 GMT Subject: RFR: 8332400: isspace argument should be a valid unsigned char In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 21:21:23 GMT, David Holmes wrote: >> ### Summary >> This change ensures we don't get undefined behavior when calling[`isspace`](https://pubs.opengroup.org/onlinepubs/007904975/functions/isspace.html). `isspace` accepts an `int` argument that "the application shall ensure is a character representable as an unsigned char or equal to the value of the macro EOF.". >> >> Previously, there was no checking of the values passed to `isspace`. I've replaced direct calls with a new wrapper `os::is_space` that performs a range check and prevents the possibility of undefined behavior from happening. For instances outside of Hotspot, I've added casts to `unsigned char`. >> >> **Testing** >> - Added a new test in `test/hotspot/gtest/runtime/test_os.cpp` to check `os::is_space` is working correctly. >> - tier1 > > Sorry I think this is well-intentioned but unnecessary in nearly all cases. If you pass a char there is no potential problem. Only passing an actual int could be a problem. @dholmes-ora > Sorry I think this is well-intentioned but unnecessary in nearly all cases. If you pass a char there is no potential problem. Only passing an actual int could be a problem. Note that the issue was motivated by an Oracle engineer complaining about me using isspace on a char. That caused me to look up its behavior. Recently, we seem intent on eliminating UB, so why not. That said, I agree that we probably don't need the wrapper. And casting to int feels awkward. I propose - input from trusted sources, e.g. proc fs, don't need casting - input from other sources should be casted to unsigned char (see recommendation here: https://en.cppreference.com/w/cpp/string/byte/isspace "To use these functions safely with plain chars (or signed chars), the argument should first be converted to unsigned char") ------------- PR Comment: https://git.openjdk.org/jdk/pull/19567#issuecomment-2154146793 From syan at openjdk.org Fri Jun 7 07:29:39 2024 From: syan at openjdk.org (SendaoYan) Date: Fri, 7 Jun 2024 07:29:39 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles [v2] In-Reply-To: References: Message-ID: > Hi all, > This PR several extra empty spaces and extra empty lines in several Makefiles. It's trivial fix, no risk. > > Thanks. SendaoYan has updated the pull request incrementally with one additional commit since the last revision: delete extra empty trailing blank line in test/jdk/java/rmi/reliability/benchmark/bench/Makefile ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19537/files - new: https://git.openjdk.org/jdk/pull/19537/files/0d2be363..e80b98da Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19537&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19537&range=00-01 Stats: 2 lines in 1 file changed: 0 ins; 1 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/19537.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19537/head:pull/19537 PR: https://git.openjdk.org/jdk/pull/19537 From syan at openjdk.org Fri Jun 7 07:29:39 2024 From: syan at openjdk.org (SendaoYan) Date: Fri, 7 Jun 2024 07:29:39 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles [v2] In-Reply-To: References: Message-ID: <9rsVuFT4B5tg9CFepE9m-CsdBHMsfEPu4pWsWxZhkCk=.f3db4eff-1335-4c4f-a7d6-5970c4a544f7@github.com> On Thu, 6 Jun 2024 17:49:08 GMT, Chen Liang wrote: >> SendaoYan has updated the pull request incrementally with one additional commit since the last revision: >> >> delete extra empty trailing blank line in test/jdk/java/rmi/reliability/benchmark/bench/Makefile > > test/jdk/java/rmi/reliability/benchmark/bench/rmi/Makefile line 1: > >> 1: # > > This file change is dubious: > 1. It does not have any trailing whitespace that can fail the skara checks. > 2. If the duplicate blank lines in the end of this Makefile is indeed problematic (as fixed here), please fix the only other occasion in the JDK, which is the Makefile in the parent directory. (Checked with `\n$^\n$\Z` pattern in all Makefiles) > > Recommended actions: Either > 1. Revert changes in this file; > 2. Also update `test/jdk/java/rmi/reliability/benchmark/bench/Makefile` to remove the trailing blank line. Thanks for the suggestion, the trailing blank line of `test/jdk/java/rmi/reliability/benchmark/bench/Makefile` has been removed. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19537#discussion_r1630767547 From redestad at openjdk.org Fri Jun 7 08:12:15 2024 From: redestad at openjdk.org (Claes Redestad) Date: Fri, 7 Jun 2024 08:12:15 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base [v3] In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 19:12:35 GMT, Chen Liang wrote: >> src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java line 469: >> >>> 467: // o instanceof Wrapped(float) >>> 468: cb.aload(SELECTOR_OBJ); >>> 469: cb.instanceOf(classDesc(Wrapper.forBasicType(classLabel) >> >> I have a patch somewhere to cache the wrapper class desc in `sun.invoke.util.Wrapper`, both as a micro-optimization and to help disambigutate the unfortunately named (my bad) `Wrapper::classDescriptor` method. Maybe we can roll that into this..? > > Feel free, or you can get your patch merged first and then I base off yours if yours is ready. Created a PR you could fold into this, if you'd like: https://github.com/liachmodded/jdk/pull/1 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19585#discussion_r1630816783 From redestad at openjdk.org Fri Jun 7 08:27:36 2024 From: redestad at openjdk.org (Claes Redestad) Date: Fri, 7 Jun 2024 08:27:36 GMT Subject: RFR: 8333774: Avoid eagerly loading various EmptySpliterator classes Message-ID: <4Fe9imJ4KWHoEnbAkOW53q8gGtHTUJfeu6Kr1YFUONM=.91de28a6-af33-4bfc-a3da-8a55d97bc515@github.com> Trivially move a few private static finals to their respective source type to avoid eagerly loading a few small classes. ------------- Commit messages: - 8333774: Avoid eagerly loading various EmptySpliterator classes Changes: https://git.openjdk.org/jdk/pull/19591/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19591&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333774 Stats: 31 lines in 1 file changed: 12 ins; 11 del; 8 mod Patch: https://git.openjdk.org/jdk/pull/19591.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19591/head:pull/19591 PR: https://git.openjdk.org/jdk/pull/19591 From redestad at openjdk.org Fri Jun 7 08:52:18 2024 From: redestad at openjdk.org (Claes Redestad) Date: Fri, 7 Jun 2024 08:52:18 GMT Subject: RFR: 8332457: Examine startup overheads from JDK-8294961 [v19] In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 12:39:13 GMT, Chen Liang wrote: >> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: >> >> An assortment of potential improvements >> >> Co-authored-by: Claes Redestad > > src/java.base/share/classes/java/lang/constant/ConstantDescs.java line 356: > >> 354: ClassDesc[] fullParamTypes = new ClassDesc[paramTypes.length + prefixLen]; >> 355: System.arraycopy(INDY_BOOTSTRAP_ARGS, 0, fullParamTypes, 0, prefixLen); >> 356: System.arraycopy(paramTypes, 0, fullParamTypes, prefixLen, paramTypes.length); > > I'm thinking about creating a basic MethodTypeDesc like `INDY_BOOTSTRAP_TYPE = MethodTypeDesc.ofValidated(CD_Object, INDY_BOOTSTRAP_ARGS)`, and we derive bsm with > > INDY_BOOTSTRAP_TYPE > .insertParameterTypes(INDY_BOOTSTRAP_TYPE.parameterCount(), paramTypes) > .changeReturnType(returnType) > > which creates two MTD wrappers but they share the same parameter array That'd arguably be a bit cleaner. Might allocate an extra MTD (unless/until EA kicks in), but that might not matter really. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19410#discussion_r1630868455 From duke at openjdk.org Fri Jun 7 09:29:15 2024 From: duke at openjdk.org (ExE Boss) Date: Fri, 7 Jun 2024 09:29:15 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base [v3] In-Reply-To: <1IFJQFo8lSETZiScFUYARY8anru4CF5rHm_nZGId4eA=.f398ca15-0427-477f-ad0f-31a5d6e66b61@github.com> References: <1IFJQFo8lSETZiScFUYARY8anru4CF5rHm_nZGId4eA=.f398ca15-0427-477f-ad0f-31a5d6e66b61@github.com> Message-ID: On Thu, 6 Jun 2024 21:44:59 GMT, Chen Liang wrote: >> In java.base, especially in bytecode generators, we have many different methods converting known valid Class and MethodType into ClassDesc and MethodTypeDesc. These conversions should be consolidated into the same utility method for the ease of future maintenance. > > Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision: > > - Merge branch 'master' of https://github.com/openjdk/jdk into cleanup/consolidate-todesc > - Add referenceClassDesc, move ReferenceClassDescImpl.ofValidatedBinaryName to ConstantUtils.binaryNameToDesc > - mt -> md (desc) > - Missed license header > - Consolidate class/mt to desc operations This?could probably also?update `Class?::describeConstable()` to use `ReferenceClassDesc?::ofValidated?(String)` for?non?hidden reference?types: https://github.com/openjdk/jdk/blob/40b2fbd8207404961d3d23375b288cceafc3f902/src/java.base/share/classes/java/lang/Class.java#L4709-L4713 ------------- PR Comment: https://git.openjdk.org/jdk/pull/19585#issuecomment-2154453685 From djelinski at openjdk.org Fri Jun 7 09:48:21 2024 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Fri, 7 Jun 2024 09:48:21 GMT Subject: RFR: 8333742: ProcessImpl and ProcessHandleImpl may mishandle processes that exit with code 259 Message-ID: <1CvkxMiIsaatbXRqxy6MIPKRisHyifLU5VCr7OA-Lso=.6a1a2f1a-bfbb-4e59-ab2e-1a367b8f6492@github.com> `GetExitCodeProcess` method is not reliable for checking if a process exited already; it returns 259 (STILL_ACTIVE) if the process hasn't exited yet, but the same value is returned when the process exited with code 259. In order to check if the process exited, we need to check if its handle is in a signaled state using one of the wait methods. This PR fixes the onExit, exitValue, isAlive, and waitFor(timeout) methods to correctly handle the problematic exit code. I haven't fixed the ProcessImpl.toString method. I'm not sure the problem is important enough to justify an extra JNI call in the (probably typical) still-alive case. Tier1-3 testing clean. I modified the existing OnExitTest to cover this case. ------------- Commit messages: - More precise comment - exit waitForProcessExit on interrupt - Exclude test for exit code 259 on non-Windows systems - Fix waitFor - Fix onExit, exitValue and isProcessAlive Changes: https://git.openjdk.org/jdk/pull/19586/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19586&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333742 Stats: 58 lines in 4 files changed: 27 ins; 16 del; 15 mod Patch: https://git.openjdk.org/jdk/pull/19586.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19586/head:pull/19586 PR: https://git.openjdk.org/jdk/pull/19586 From liach at openjdk.org Fri Jun 7 10:58:13 2024 From: liach at openjdk.org (Chen Liang) Date: Fri, 7 Jun 2024 10:58:13 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles [v2] In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 07:29:39 GMT, SendaoYan wrote: >> Hi all, >> This PR several extra empty spaces and extra empty lines in several Makefiles. It's trivial fix, no risk. >> >> Thanks. > > SendaoYan has updated the pull request incrementally with one additional commit since the last revision: > > delete extra empty trailing blank line in test/jdk/java/rmi/reliability/benchmark/bench/Makefile Thank you for the fix. ------------- Marked as reviewed by liach (Author). PR Review: https://git.openjdk.org/jdk/pull/19537#pullrequestreview-2104241367 From liach at openjdk.org Fri Jun 7 11:08:12 2024 From: liach at openjdk.org (Chen Liang) Date: Fri, 7 Jun 2024 11:08:12 GMT Subject: RFR: 8333774: Avoid eagerly loading various EmptySpliterator classes In-Reply-To: <4Fe9imJ4KWHoEnbAkOW53q8gGtHTUJfeu6Kr1YFUONM=.91de28a6-af33-4bfc-a3da-8a55d97bc515@github.com> References: <4Fe9imJ4KWHoEnbAkOW53q8gGtHTUJfeu6Kr1YFUONM=.91de28a6-af33-4bfc-a3da-8a55d97bc515@github.com> Message-ID: <0_iPVvtwiBJaxQDiwpeFhkT1oykyzzdTfHst0ZKxBHU=.ac88927b-b9e8-4064-8ca6-5a6cfe99651a@github.com> On Fri, 7 Jun 2024 08:21:58 GMT, Claes Redestad wrote: > Trivially move a few private static finals to their respective source type to avoid eagerly loading a few small classes. Remember to update the copyright year. ------------- Marked as reviewed by liach (Author). PR Review: https://git.openjdk.org/jdk/pull/19591#pullrequestreview-2104267610 From redestad at openjdk.org Fri Jun 7 11:34:16 2024 From: redestad at openjdk.org (Claes Redestad) Date: Fri, 7 Jun 2024 11:34:16 GMT Subject: RFR: 8332249: Micro-optimize Method.hashCode [v2] In-Reply-To: References: <68bP4OaEhjeBisrD5wDLvmOBykXE4J_UlxO9BcFSZl8=.455e75dd-1983-4989-92cf-9101c3ff1696@github.com> <-iZhTXSd9kx0Eg5DOq1bAfhCKapEWykLJfft8Te4rb0=.d87c8953-599e-4b47-bfb8-a93aa1ecf38f@github.com> Message-ID: On Wed, 5 Jun 2024 13:45:46 GMT, Per Minborg wrote: >> As a note, If we would have access to the contemplated `StableValue` and `hash` was declared even as an _instance variable_ `StableValue` in a regular class, then it would be trusted and would be eligible for constant folding due to the VM will have special rules for fields of StableValue type. > > Ahh. There was a benchmark in the initial message. Sorry. We think this is caused by the membars being conservatively emitted at method exit, and more precis membar control should help ARM. Filed: https://bugs.openjdk.org/browse/JDK-8333791 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19433#discussion_r1631071572 From prappo at openjdk.org Fri Jun 7 12:15:18 2024 From: prappo at openjdk.org (Pavel Rappo) Date: Fri, 7 Jun 2024 12:15:18 GMT Subject: RFR: 8332161: Test restoring echo in the Console implementation (java.base) [v12] In-Reply-To: <5ac8-ZK1FeJdtdZsG8WQRFkdOFHD1Q_aT1rKYZ19lQ4=.3205fa59-10a5-4a14-b49c-98410b82cb6d@github.com> References: <5ac8-ZK1FeJdtdZsG8WQRFkdOFHD1Q_aT1rKYZ19lQ4=.3205fa59-10a5-4a14-b49c-98410b82cb6d@github.com> Message-ID: On Thu, 6 Jun 2024 21:49:35 GMT, Naoto Sato wrote: >> This test intends to verify the behavior of JdkConsole for the java.base module, wrt restoring the echo. The test assumes the internal methods that sets/gets the echo status of the platform. > > Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: > > Loosening the timeout value Thanks for having done it, Naoto. ------------- Marked as reviewed by prappo (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19315#pullrequestreview-2104391962 From redestad at openjdk.org Fri Jun 7 12:17:23 2024 From: redestad at openjdk.org (Claes Redestad) Date: Fri, 7 Jun 2024 12:17:23 GMT Subject: RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator Message-ID: This PR refactors type matching in BootstrapMethodInvoker and adds a few types, seeking to improve bootstrap overheads of some ConstantBootstraps and in particular the ProxyGenerator condys generated for e.g. annotation proxies since [JDK-8332457](https://bugs.openjdk.org/browse/JDK-8332457) I've adjusted the micro-benchmark added by JDK-8332457 to not only generate a proxy but also call into one of the proxied methodt (`Object::hashCode`). Running org.openjdk.bench.java.lang.reflect.ProxyGenBench as a one-off startup benchmark sees significant improvement (-9% instructions, -6% cycles): Name Cnt Base Error Test Error Unit Change Perfstartup-JMH 20 154,000 ? 8,165 148,000 ? 23,164 ms/op 1,04x (p = 0,352 ) :.cycles 925335973,200 ? 47147600,262 842221278,800 ? 46836254,964 cycles 0,91x (p = 0,000*) :.instructions 2101588857,600 ? 81105850,361 1966307798,400 ? 22011043,908 instructions 0,94x (p = 0,000*) :.taskclock 291,500 ? 16,494 262,000 ? 15,328 ms 0,90x (p = 0,000*) * = significant Number of classes loaded drops from 1096 to 1092 Running the micro regularly shows no significant difference: Name Cnt Base Error Test Error Unit Change ProxyGenBench.generateAndProxy100 10 26,827 ? 8,954 26,855 ? 7,531 ms/op 1,00x (p = 0,991 ) * = significant ------------- Commit messages: - Rename microbenchmark - Ensure proxying for hashCode etc is 'implemented' - Ensure proxying for hashCode etc is 'implemented' - Change ProxyGenBench to provoke proxy condy - Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator Changes: https://git.openjdk.org/jdk/pull/19598/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19598&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333793 Stats: 89 lines in 2 files changed: 35 ins; 24 del; 30 mod Patch: https://git.openjdk.org/jdk/pull/19598.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19598/head:pull/19598 PR: https://git.openjdk.org/jdk/pull/19598 From liach at openjdk.org Fri Jun 7 12:24:23 2024 From: liach at openjdk.org (Chen Liang) Date: Fri, 7 Jun 2024 12:24:23 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base [v4] In-Reply-To: References: Message-ID: > In java.base, especially in bytecode generators, we have many different methods converting known valid Class and MethodType into ClassDesc and MethodTypeDesc. These conversions should be consolidated into the same utility method for the ease of future maintenance. Chen Liang has updated the pull request incrementally with one additional commit since the last revision: Wrapper.basic/wrapperClassDescriptor (#1) ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19585/files - new: https://git.openjdk.org/jdk/pull/19585/files/89bc5d8d..69af091a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19585&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19585&range=02-03 Stats: 49 lines in 4 files changed: 17 ins; 2 del; 30 mod Patch: https://git.openjdk.org/jdk/pull/19585.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19585/head:pull/19585 PR: https://git.openjdk.org/jdk/pull/19585 From syan at openjdk.org Fri Jun 7 12:31:13 2024 From: syan at openjdk.org (SendaoYan) Date: Fri, 7 Jun 2024 12:31:13 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles [v2] In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 07:29:39 GMT, SendaoYan wrote: >> Hi all, >> This PR several extra empty spaces and extra empty lines in several Makefiles. It's trivial fix, no risk. >> >> Thanks. > > SendaoYan has updated the pull request incrementally with one additional commit since the last revision: > > delete extra empty trailing blank line in test/jdk/java/rmi/reliability/benchmark/bench/Makefile Thanks all for the review. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19537#issuecomment-2154735598 From liach at openjdk.org Fri Jun 7 12:35:37 2024 From: liach at openjdk.org (Chen Liang) Date: Fri, 7 Jun 2024 12:35:37 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base [v5] In-Reply-To: References: Message-ID: > In java.base, especially in bytecode generators, we have many different methods converting known valid Class and MethodType into ClassDesc and MethodTypeDesc. These conversions should be consolidated into the same utility method for the ease of future maintenance. Chen Liang has updated the pull request incrementally with one additional commit since the last revision: One other place can use wrapperClassDescriptor ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19585/files - new: https://git.openjdk.org/jdk/pull/19585/files/69af091a..e9ddc398 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19585&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19585&range=03-04 Stats: 4 lines in 1 file changed: 1 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/19585.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19585/head:pull/19585 PR: https://git.openjdk.org/jdk/pull/19585 From redestad at openjdk.org Fri Jun 7 12:38:24 2024 From: redestad at openjdk.org (Claes Redestad) Date: Fri, 7 Jun 2024 12:38:24 GMT Subject: RFR: 8333774: Avoid eagerly loading various EmptySpliterator classes [v2] In-Reply-To: <4Fe9imJ4KWHoEnbAkOW53q8gGtHTUJfeu6Kr1YFUONM=.91de28a6-af33-4bfc-a3da-8a55d97bc515@github.com> References: <4Fe9imJ4KWHoEnbAkOW53q8gGtHTUJfeu6Kr1YFUONM=.91de28a6-af33-4bfc-a3da-8a55d97bc515@github.com> Message-ID: > Trivially move a few private static finals to their respective source type to avoid eagerly loading a few small classes. Claes Redestad has updated the pull request incrementally with two additional commits since the last revision: - revert typo - Copyright ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19591/files - new: https://git.openjdk.org/jdk/pull/19591/files/5eb2ddd8..9d19bbe1 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19591&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19591&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/19591.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19591/head:pull/19591 PR: https://git.openjdk.org/jdk/pull/19591 From jwaters at openjdk.org Fri Jun 7 12:40:13 2024 From: jwaters at openjdk.org (Julian Waters) Date: Fri, 7 Jun 2024 12:40:13 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles [v2] In-Reply-To: References: Message-ID: <4cHhBehMcwLWREUH2qT-iK-uUHwJ0x5bMhyUnwL2gq8=.b9b607ff-f8e3-4e40-8ed7-4096d7e5ce50@github.com> On Fri, 7 Jun 2024 07:29:39 GMT, SendaoYan wrote: >> Hi all, >> This PR several extra empty spaces and extra empty lines in several Makefiles. It's trivial fix, no risk. >> >> Thanks. > > SendaoYan has updated the pull request incrementally with one additional commit since the last revision: > > delete extra empty trailing blank line in test/jdk/java/rmi/reliability/benchmark/bench/Makefile Marked as reviewed by jwaters (Committer). test/jdk/java/rmi/reliability/benchmark/bench/Makefile line 50: > 48: clean: > 49: rm -f *.class .classes > 50: Hmm, shouldn't this newline at EOF be kept? Asking @ all the people who've reviewed this so far, no need to change it just yet ------------- PR Review: https://git.openjdk.org/jdk/pull/19537#pullrequestreview-2104439647 PR Review Comment: https://git.openjdk.org/jdk/pull/19537#discussion_r1631140418 From jwaters at openjdk.org Fri Jun 7 12:40:14 2024 From: jwaters at openjdk.org (Julian Waters) Date: Fri, 7 Jun 2024 12:40:14 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles [v2] In-Reply-To: <9rsVuFT4B5tg9CFepE9m-CsdBHMsfEPu4pWsWxZhkCk=.f3db4eff-1335-4c4f-a7d6-5970c4a544f7@github.com> References: <9rsVuFT4B5tg9CFepE9m-CsdBHMsfEPu4pWsWxZhkCk=.f3db4eff-1335-4c4f-a7d6-5970c4a544f7@github.com> Message-ID: On Fri, 7 Jun 2024 07:26:39 GMT, SendaoYan wrote: >> test/jdk/java/rmi/reliability/benchmark/bench/rmi/Makefile line 1: >> >>> 1: # >> >> This file change is dubious: >> 1. It does not have any trailing whitespace that can fail the skara checks. >> 2. If the duplicate blank lines in the end of this Makefile is indeed problematic (as fixed here), please fix the only other occasion in the JDK, which is the Makefile in the parent directory. (Checked with `\n$^\n$\Z` pattern in all Makefiles) >> >> Recommended actions: Either >> 1. Revert changes in this file; >> 2. Also update `test/jdk/java/rmi/reliability/benchmark/bench/Makefile` to remove the trailing blank line. > > Thanks for the suggestion, the trailing blank line of `test/jdk/java/rmi/reliability/benchmark/bench/Makefile` has been removed. Hmm, I'm inclined to keep the newlines at the EOF for both, what do the rest of you think? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19537#discussion_r1631140457 From erikj at openjdk.org Fri Jun 7 12:51:16 2024 From: erikj at openjdk.org (Erik Joelsson) Date: Fri, 7 Jun 2024 12:51:16 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles [v2] In-Reply-To: References: Message-ID: <_nZVUUX4_1rgtwNp8seD0YoqxnZLtORfjVz9m0VFNrQ=.315a1692-b84c-4eed-95db-3843f438431a@github.com> On Fri, 7 Jun 2024 07:29:39 GMT, SendaoYan wrote: >> Hi all, >> This PR several extra empty spaces and extra empty lines in several Makefiles. It's trivial fix, no risk. >> >> Thanks. > > SendaoYan has updated the pull request incrementally with one additional commit since the last revision: > > delete extra empty trailing blank line in test/jdk/java/rmi/reliability/benchmark/bench/Makefile Marked as reviewed by erikj (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/19537#pullrequestreview-2104463763 From erikj at openjdk.org Fri Jun 7 12:51:17 2024 From: erikj at openjdk.org (Erik Joelsson) Date: Fri, 7 Jun 2024 12:51:17 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles [v2] In-Reply-To: <4cHhBehMcwLWREUH2qT-iK-uUHwJ0x5bMhyUnwL2gq8=.b9b607ff-f8e3-4e40-8ed7-4096d7e5ce50@github.com> References: <4cHhBehMcwLWREUH2qT-iK-uUHwJ0x5bMhyUnwL2gq8=.b9b607ff-f8e3-4e40-8ed7-4096d7e5ce50@github.com> Message-ID: <5YlIH2IloSdbb0dSta1qr9sb2e5Uyred24oKrMTvZFE=.b99a6c68-32f1-43d7-89f7-5205129f8e1f@github.com> On Fri, 7 Jun 2024 12:37:48 GMT, Julian Waters wrote: >> SendaoYan has updated the pull request incrementally with one additional commit since the last revision: >> >> delete extra empty trailing blank line in test/jdk/java/rmi/reliability/benchmark/bench/Makefile > > test/jdk/java/rmi/reliability/benchmark/bench/Makefile line 50: > >> 48: clean: >> 49: rm -f *.class .classes >> 50: > > Hmm, shouldn't this newline at EOF be kept? Asking @ all the people who've reviewed this so far, no need to change it just yet No, it's an extra newline. A file should end with a newline but one is enough. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19537#discussion_r1631152127 From liach at openjdk.org Fri Jun 7 12:56:19 2024 From: liach at openjdk.org (Chen Liang) Date: Fri, 7 Jun 2024 12:56:19 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles [v2] In-Reply-To: <5YlIH2IloSdbb0dSta1qr9sb2e5Uyred24oKrMTvZFE=.b99a6c68-32f1-43d7-89f7-5205129f8e1f@github.com> References: <4cHhBehMcwLWREUH2qT-iK-uUHwJ0x5bMhyUnwL2gq8=.b9b607ff-f8e3-4e40-8ed7-4096d7e5ce50@github.com> <5YlIH2IloSdbb0dSta1qr9sb2e5Uyred24oKrMTvZFE=.b99a6c68-32f1-43d7-89f7-5205129f8e1f@github.com> Message-ID: On Fri, 7 Jun 2024 12:47:39 GMT, Erik Joelsson wrote: >> test/jdk/java/rmi/reliability/benchmark/bench/Makefile line 50: >> >>> 48: clean: >>> 49: rm -f *.class .classes >>> 50: >> >> Hmm, shouldn't this newline at EOF be kept? Asking @ all the people who've reviewed this so far, no need to change it just yet > > No, it's an extra newline. A file should end with a newline but one is enough. As confusing as they are, unfortunately GitHub UI does not render extra trailing newlines. This is the only one I could find with grepWin. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19537#discussion_r1631159094 From liach at openjdk.org Fri Jun 7 12:58:16 2024 From: liach at openjdk.org (Chen Liang) Date: Fri, 7 Jun 2024 12:58:16 GMT Subject: RFR: 8333774: Avoid eagerly loading various EmptySpliterator classes [v2] In-Reply-To: References: <4Fe9imJ4KWHoEnbAkOW53q8gGtHTUJfeu6Kr1YFUONM=.91de28a6-af33-4bfc-a3da-8a55d97bc515@github.com> Message-ID: On Fri, 7 Jun 2024 12:38:24 GMT, Claes Redestad wrote: >> Trivially move a few private static finals to their respective source type to avoid eagerly loading a few small classes. > > Claes Redestad has updated the pull request incrementally with two additional commits since the last revision: > > - revert typo > - Copyright Marked as reviewed by liach (Author). src/java.base/share/classes/java/util/Spliterators.java line 89: > 87: } > 88: > 89: Suggestion: Bikeshedding to the extreme (yes, I looked for why the deletion had one less line) ------------- PR Review: https://git.openjdk.org/jdk/pull/19591#pullrequestreview-2104476389 PR Review Comment: https://git.openjdk.org/jdk/pull/19591#discussion_r1631160491 From sgehwolf at openjdk.org Fri Jun 7 12:59:26 2024 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Fri, 7 Jun 2024 12:59:26 GMT Subject: RFR: 8261242: [Linux] OSContainer::is_containerized() returns true when run outside a container [v4] In-Reply-To: References: Message-ID: > Please review this enhancement to the container detection code which allows it to figure out whether the JVM is actually running inside a container (`podman`, `docker`, `crio`), or with some other means that enforces memory/cpu limits by means of the cgroup filesystem. If neither of those conditions hold, the JVM runs in not containerized mode, addressing the issue described in the JBS tracker. For example, on my Linux system `is_containerized() == false" is being indicated with the following trace log line: > > > [0.001s][debug][os,container] OSContainer::init: is_containerized() = false because no cpu or memory limit is present > > > This state is being exposed by the Java `Metrics` API class using the new (still JDK internal) `isContainerized()` method. Example: > > > java -XshowSettings:system --version > Operating System Metrics: > Provider: cgroupv1 > System not containerized. > openjdk 23-internal 2024-09-17 > OpenJDK Runtime Environment (fastdebug build 23-internal-adhoc.sgehwolf.jdk-jdk) > OpenJDK 64-Bit Server VM (fastdebug build 23-internal-adhoc.sgehwolf.jdk-jdk, mixed mode, sharing) > > > The basic property this is being built on is the observation that the cgroup controllers typically get mounted read only into containers. Note that the current container tests assert that `OSContainer::is_containerized() == true` in various tests. Therefore, using the heuristic of "is any memory or cpu limit present" isn't sufficient. I had considered that in an earlier iteration, but many container tests failed. > > Overall, I think, with this patch we improve the current situation of claiming a containerized system being present when it's actually just a regular Linux system. > > Testing: > > - [x] GHA (risc-v failure seems infra related) > - [x] Container tests on Linux x86_64 of cgroups v1 and cgroups v2 (including gtests) > - [x] Some manual testing using cri-o > > Thoughts? Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 13 commits: - Merge branch 'master' into jdk-8261242-is-containerized-fix - Add doc for mountinfo scanning. - Unify naming of variables - Merge branch 'master' into jdk-8261242-is-containerized-fix - Merge branch 'master' into jdk-8261242-is-containerized-fix - jcheck fixes - Fix tests - Implement Metrics.isContainerized() - Some clean-up - Drop cgroups testing on plain Linux - ... and 3 more: https://git.openjdk.org/jdk/compare/40b2fbd8...02884c70 ------------- Changes: https://git.openjdk.org/jdk/pull/18201/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18201&range=03 Stats: 406 lines in 19 files changed: 301 ins; 78 del; 27 mod Patch: https://git.openjdk.org/jdk/pull/18201.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/18201/head:pull/18201 PR: https://git.openjdk.org/jdk/pull/18201 From syan at openjdk.org Fri Jun 7 13:04:18 2024 From: syan at openjdk.org (SendaoYan) Date: Fri, 7 Jun 2024 13:04:18 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles [v2] In-Reply-To: References: <4cHhBehMcwLWREUH2qT-iK-uUHwJ0x5bMhyUnwL2gq8=.b9b607ff-f8e3-4e40-8ed7-4096d7e5ce50@github.com> <5YlIH2IloSdbb0dSta1qr9sb2e5Uyred24oKrMTvZFE=.b99a6c68-32f1-43d7-89f7-5205129f8e1f@github.com> Message-ID: On Fri, 7 Jun 2024 12:53:46 GMT, Chen Liang wrote: >> No, it's an extra newline. A file should end with a newline but one is enough. > > As confusing as they are, unfortunately GitHub UI does not render extra trailing newlines. This is the only one I could find with grepWin. I find the extra trailing newlines through below shell command: for i in `find . -iname "Makefile*" | sed "/./build/d"` ; do tail -n 2 $i | grep -c "^$" | grep -q "^1$" ; if [[ 0 -eq $? ]] ; then echo $i ; fi ; done There are only two files has been found: ./test/jdk/java/rmi/reliability/benchmark/bench/rmi/Makefile ./test/jdk/java/rmi/reliability/benchmark/bench/Makefile ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19537#discussion_r1631168243 From rgiulietti at openjdk.org Fri Jun 7 13:06:14 2024 From: rgiulietti at openjdk.org (Raffaello Giulietti) Date: Fri, 7 Jun 2024 13:06:14 GMT Subject: RFR: 8333768: Minor doc updates to java.lang.{Float, Double} In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 04:47:12 GMT, Joe Darcy wrote: > Misc small doc updates and addition of `@Overrides` annotations. src/java.base/share/classes/java/lang/Double.java line 595: > 593: * This method corresponds to the convertToDecimalCharacter > 594: * operation defined in IEEE 754. > 595: * Does it? IEEE 754 `convertToDecimalCharacter` takes a 2nd argument, the `conversionSpecification` which "specifies the precision and formatting of the _decimalCharacterSequence_ result". There's no such flexibility here. Moreover, there seems to be no way to have a `conversionSpecification` that ensures the "shortest decimal" semantics of this method. Finally, IEEE 754 requires to signal inexact exceptions. Suggestion: * This method vaguely corresponds to the convertToDecimalCharacter The same holds for the other additional `@apiNote`s. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19590#discussion_r1631153540 From redestad at openjdk.org Fri Jun 7 13:08:24 2024 From: redestad at openjdk.org (Claes Redestad) Date: Fri, 7 Jun 2024 13:08:24 GMT Subject: RFR: 8333774: Avoid eagerly loading various EmptySpliterator classes [v3] In-Reply-To: <4Fe9imJ4KWHoEnbAkOW53q8gGtHTUJfeu6Kr1YFUONM=.91de28a6-af33-4bfc-a3da-8a55d97bc515@github.com> References: <4Fe9imJ4KWHoEnbAkOW53q8gGtHTUJfeu6Kr1YFUONM=.91de28a6-af33-4bfc-a3da-8a55d97bc515@github.com> Message-ID: <8nDWWM7n_ROj39uC3vEV6aa-c8aaKHfJtos6gQnI9gI=.71ae9a2f-0c95-46d4-aa73-ed80e2c39401@github.com> > Trivially move a few private static finals to their respective source type to avoid eagerly loading a few small classes. Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: Update src/java.base/share/classes/java/util/Spliterators.java Co-authored-by: Chen Liang ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19591/files - new: https://git.openjdk.org/jdk/pull/19591/files/9d19bbe1..10611afd Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19591&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19591&range=01-02 Stats: 1 line in 1 file changed: 0 ins; 1 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/19591.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19591/head:pull/19591 PR: https://git.openjdk.org/jdk/pull/19591 From jvernee at openjdk.org Fri Jun 7 13:23:13 2024 From: jvernee at openjdk.org (Jorn Vernee) Date: Fri, 7 Jun 2024 13:23:13 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base [v5] In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 12:35:37 GMT, Chen Liang wrote: >> In java.base, especially in bytecode generators, we have many different methods converting known valid Class and MethodType into ClassDesc and MethodTypeDesc. These conversions should be consolidated into the same utility method for the ease of future maintenance. > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > One other place can use wrapperClassDescriptor Marked as reviewed by jvernee (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/19585#pullrequestreview-2104537265 From jvernee at openjdk.org Fri Jun 7 13:35:15 2024 From: jvernee at openjdk.org (Jorn Vernee) Date: Fri, 7 Jun 2024 13:35:15 GMT Subject: RFR: 8325984: 4 jcstress tests are failing in Tier6 4 times each In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 10:48:51 GMT, Aleksey Shipilev wrote: >> These 4 tests were failing due to an incompatibility with jcstress. They were problemlisted in past (https://bugs.openjdk.org/browse/JDK-8326062). >> >> Now that jcstress has been updated (https://github.com/openjdk/jdk/pull/19332) with the relevant fix (https://github.com/openjdk/jcstress/pull/147), we can re-enable these tests. >> >> Testing: I've verified that all 4 tests now pass on Linux-x64 > > I think only Oracle CIs run these tests through jtreg wrappers? Anyway, this looks good to me. @shipilev Do you think this is trivial enough for one reviewer? ------------- PR Comment: https://git.openjdk.org/jdk/pull/19565#issuecomment-2154849759 From jwaters at openjdk.org Fri Jun 7 13:39:19 2024 From: jwaters at openjdk.org (Julian Waters) Date: Fri, 7 Jun 2024 13:39:19 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles [v2] In-Reply-To: References: <4cHhBehMcwLWREUH2qT-iK-uUHwJ0x5bMhyUnwL2gq8=.b9b607ff-f8e3-4e40-8ed7-4096d7e5ce50@github.com> <5YlIH2IloSdbb0dSta1qr9sb2e5Uyred24oKrMTvZFE=.b99a6c68-32f1-43d7-89f7-5205129f8e1f@github.com> Message-ID: On Fri, 7 Jun 2024 13:01:15 GMT, SendaoYan wrote: >> As confusing as they are, unfortunately GitHub UI does not render extra trailing newlines. This is the only one I could find with grepWin. > > I find the extra trailing newlines through below shell command: > > for i in `find . -iname "Makefile*" | sed "/./build/d"` ; do tail -n 2 $i | grep -c "^$" | grep -q "^1$" ; if [[ 0 -eq $? ]] ; then echo $i ; fi ; done > > > There are only two files has been found: > > ./test/jdk/java/rmi/reliability/benchmark/bench/rmi/Makefile > ./test/jdk/java/rmi/reliability/benchmark/bench/Makefile Ah, I had not realized that there was more than 1 newline. GitHub's UI confused me here, so we're good to go ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19537#discussion_r1631213656 From syan at openjdk.org Fri Jun 7 13:39:20 2024 From: syan at openjdk.org (SendaoYan) Date: Fri, 7 Jun 2024 13:39:20 GMT Subject: Integrated: 8333477: Delete extra empty spaces in Makefiles In-Reply-To: References: Message-ID: On Tue, 4 Jun 2024 07:47:46 GMT, SendaoYan wrote: > Hi all, > This PR several extra empty spaces and extra empty lines in several Makefiles. It's trivial fix, no risk. > > Thanks. This pull request has now been integrated. Changeset: d130d2f4 Author: SendaoYan Committer: Julian Waters URL: https://git.openjdk.org/jdk/commit/d130d2f4f46d37a2b924343de19d012c129b0a55 Stats: 11 lines in 5 files changed: 0 ins; 2 del; 9 mod 8333477: Delete extra empty spaces in Makefiles Reviewed-by: erikj, chagedorn, liach, jwaters ------------- PR: https://git.openjdk.org/jdk/pull/19537 From jvernee at openjdk.org Fri Jun 7 13:46:18 2024 From: jvernee at openjdk.org (Jorn Vernee) Date: Fri, 7 Jun 2024 13:46:18 GMT Subject: RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 12:12:44 GMT, Claes Redestad wrote: > This PR refactors type matching in BootstrapMethodInvoker and adds a few types, seeking to improve bootstrap overheads of some ConstantBootstraps and in particular the ProxyGenerator condys generated for e.g. annotation proxies since [JDK-8332457](https://bugs.openjdk.org/browse/JDK-8332457) > > I've adjusted the micro-benchmark added by JDK-8332457 to not only generate a proxy but also call into one of the proxied methodt (`Object::hashCode`). > > Running org.openjdk.bench.java.lang.reflect.ProxyGenBench as a one-off startup benchmark sees significant improvement (-9% instructions, -6% cycles): > > Name Cnt Base Error Test Error Unit Change > Perfstartup-JMH 20 154,000 ? 8,165 148,000 ? 23,164 ms/op 1,04x (p = 0,352 ) > :.cycles 925335973,200 ? 47147600,262 842221278,800 ? 46836254,964 cycles 0,91x (p = 0,000*) > :.instructions 2101588857,600 ? 81105850,361 1966307798,400 ? 22011043,908 instructions 0,94x (p = 0,000*) > :.taskclock 291,500 ? 16,494 262,000 ? 15,328 ms 0,90x (p = 0,000*) > * = significant > > Number of classes loaded drops from 1096 to 1092 > > Running the micro regularly shows no significant difference: > > Name Cnt Base Error Test Error Unit Change > ProxyGenBench.generateAndProxy100 10 26,827 ? 8,954 26,855 ? 7,531 ms/op 1,00x (p = 0,991 ) > * = significant src/java.base/share/classes/java/lang/invoke/BootstrapMethodInvoker.java line 145: > 143: .invokeExact(caller, name, (MethodType)type, (MethodType)argv[0], > 144: (MethodHandle)argv[1], (MethodType)argv[2]); > 145: } else if (argv.length >= 1 && bsmType == SCF_MT) { It seems that these `argv.length` comparisons were here for cases where the wrong number of arguments are passed to a bootstrap method? I don't see why check `argv.length > 1` is still required here... Some of the other cases are also happy to just access `argv`, (which we also do here on the next line). If you don't think this extract check is needed, please remove this source of confusion. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19598#discussion_r1631232730 From jvernee at openjdk.org Fri Jun 7 13:49:12 2024 From: jvernee at openjdk.org (Jorn Vernee) Date: Fri, 7 Jun 2024 13:49:12 GMT Subject: RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 12:12:44 GMT, Claes Redestad wrote: > This PR refactors type matching in BootstrapMethodInvoker and adds a few types, seeking to improve bootstrap overheads of some ConstantBootstraps and in particular the ProxyGenerator condys generated for e.g. annotation proxies since [JDK-8332457](https://bugs.openjdk.org/browse/JDK-8332457) > > I've adjusted the micro-benchmark added by JDK-8332457 to not only generate a proxy but also call into one of the proxied methodt (`Object::hashCode`). > > Running org.openjdk.bench.java.lang.reflect.ProxyGenBench as a one-off startup benchmark sees significant improvement (-9% instructions, -6% cycles): > > Name Cnt Base Error Test Error Unit Change > Perfstartup-JMH 20 154,000 ? 8,165 148,000 ? 23,164 ms/op 1,04x (p = 0,352 ) > :.cycles 925335973,200 ? 47147600,262 842221278,800 ? 46836254,964 cycles 0,91x (p = 0,000*) > :.instructions 2101588857,600 ? 81105850,361 1966307798,400 ? 22011043,908 instructions 0,94x (p = 0,000*) > :.taskclock 291,500 ? 16,494 262,000 ? 15,328 ms 0,90x (p = 0,000*) > * = significant > > Number of classes loaded drops from 1096 to 1092 > > Running the micro regularly shows no significant difference: > > Name Cnt Base Error Test Error Unit Change > ProxyGenBench.generateAndProxy100 10 26,827 ? 8,954 26,855 ? 7,531 ms/op 1,00x (p = 0,991 ) > * = significant As an aside: I suppose we pre-generate all the linkers that get spun up for these `invokeExact`calls already. But, we might still get a little bit of mileage out of switching to `invokeBasic`, which bypasses the linkers altogether. With the caveat that we have to be very careful that the call site type is correct. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19598#issuecomment-2154881850 From pminborg at openjdk.org Fri Jun 7 13:51:13 2024 From: pminborg at openjdk.org (Per Minborg) Date: Fri, 7 Jun 2024 13:51:13 GMT Subject: RFR: 8333774: Avoid eagerly loading various EmptySpliterator classes [v3] In-Reply-To: <8nDWWM7n_ROj39uC3vEV6aa-c8aaKHfJtos6gQnI9gI=.71ae9a2f-0c95-46d4-aa73-ed80e2c39401@github.com> References: <4Fe9imJ4KWHoEnbAkOW53q8gGtHTUJfeu6Kr1YFUONM=.91de28a6-af33-4bfc-a3da-8a55d97bc515@github.com> <8nDWWM7n_ROj39uC3vEV6aa-c8aaKHfJtos6gQnI9gI=.71ae9a2f-0c95-46d4-aa73-ed80e2c39401@github.com> Message-ID: On Fri, 7 Jun 2024 13:08:24 GMT, Claes Redestad wrote: >> Trivially move a few private static finals to their respective source type to avoid eagerly loading a few small classes. > > Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: > > Update src/java.base/share/classes/java/util/Spliterators.java > > Co-authored-by: Chen Liang Looks good to me. Nice observation, the laziness was for free as existing classes could be reused. ------------- Marked as reviewed by pminborg (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19591#pullrequestreview-2104630412 From liach at openjdk.org Fri Jun 7 13:53:12 2024 From: liach at openjdk.org (Chen Liang) Date: Fri, 7 Jun 2024 13:53:12 GMT Subject: RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 12:12:44 GMT, Claes Redestad wrote: > This PR refactors type matching in BootstrapMethodInvoker and adds a few types, seeking to improve bootstrap overheads of some ConstantBootstraps and in particular the ProxyGenerator condys generated for e.g. annotation proxies since [JDK-8332457](https://bugs.openjdk.org/browse/JDK-8332457) > > I've adjusted the micro-benchmark added by JDK-8332457 to not only generate a proxy but also call into one of the proxied methodt (`Object::hashCode`). > > Running org.openjdk.bench.java.lang.reflect.ProxyGenBench as a one-off startup benchmark sees significant improvement (-9% instructions, -6% cycles): > > Name Cnt Base Error Test Error Unit Change > Perfstartup-JMH 20 154,000 ? 8,165 148,000 ? 23,164 ms/op 1,04x (p = 0,352 ) > :.cycles 925335973,200 ? 47147600,262 842221278,800 ? 46836254,964 cycles 0,91x (p = 0,000*) > :.instructions 2101588857,600 ? 81105850,361 1966307798,400 ? 22011043,908 instructions 0,94x (p = 0,000*) > :.taskclock 291,500 ? 16,494 262,000 ? 15,328 ms 0,90x (p = 0,000*) > * = significant > > Number of classes loaded drops from 1096 to 1092 > > Running the micro regularly shows no significant difference: > > Name Cnt Base Error Test Error Unit Change > ProxyGenBench.generateAndProxy100 10 26,827 ? 8,954 26,855 ? 7,531 ms/op 1,00x (p = 0,991 ) > * = significant I recommend considering the `MethodHandle, Object[]` signature used by `ConstantBootstrap.invoke`: There had been previous proposals to use any method as a bootstrap method, and that API in particular can bridge that gap. src/java.base/share/classes/java/lang/invoke/BootstrapMethodInvoker.java line 289: > 287: * bootstrap method. > 288: */ > 289: private static final MethodType CONDY_GET_STATIC_FINAL_MT = MethodType.methodType(Object.class, This type should just be called `CONDY_NO_ARG` as it's the most common form of condy that doesn't take any arg (`nullConstant` `primitiveClass` etc.) src/java.base/share/classes/java/lang/invoke/BootstrapMethodInvoker.java line 296: > 294: * bootstrap method. > 295: */ > 296: private static final MethodType CONDY_GET_STATIC_FINAL_CLASS_MT = MethodType.methodType(Object.class, I recommend calling this `CONDY_EXTRA_CLASS`, as this is the type of `arrayVarHandle`. ------------- PR Review: https://git.openjdk.org/jdk/pull/19598#pullrequestreview-2104617832 PR Review Comment: https://git.openjdk.org/jdk/pull/19598#discussion_r1631241317 PR Review Comment: https://git.openjdk.org/jdk/pull/19598#discussion_r1631250689 From liach at openjdk.org Fri Jun 7 13:56:24 2024 From: liach at openjdk.org (Chen Liang) Date: Fri, 7 Jun 2024 13:56:24 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base [v6] In-Reply-To: References: Message-ID: > In java.base, especially in bytecode generators, we have many different methods converting known valid Class and MethodType into ClassDesc and MethodTypeDesc. These conversions should be consolidated into the same utility method for the ease of future maintenance. Chen Liang has updated the pull request incrementally with one additional commit since the last revision: ExE-Boss review, go through validated path in Class ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19585/files - new: https://git.openjdk.org/jdk/pull/19585/files/e9ddc398..d3938b4b Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19585&range=05 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19585&range=04-05 Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/19585.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19585/head:pull/19585 PR: https://git.openjdk.org/jdk/pull/19585 From redestad at openjdk.org Fri Jun 7 14:14:13 2024 From: redestad at openjdk.org (Claes Redestad) Date: Fri, 7 Jun 2024 14:14:13 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base [v6] In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 13:56:24 GMT, Chen Liang wrote: >> In java.base, especially in bytecode generators, we have many different methods converting known valid Class and MethodType into ClassDesc and MethodTypeDesc. These conversions should be consolidated into the same utility method for the ease of future maintenance. > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > ExE-Boss review, go through validated path in Class Good incremental improvements. ------------- Marked as reviewed by redestad (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19585#pullrequestreview-2104694382 From syan at openjdk.org Fri Jun 7 14:17:19 2024 From: syan at openjdk.org (SendaoYan) Date: Fri, 7 Jun 2024 14:17:19 GMT Subject: RFR: 8333477: Delete extra empty spaces in Makefiles [v2] In-Reply-To: References: Message-ID: <5PwXrAonDGIth_VkfWPZMDl-XFCPTLAIRunMUPsp_4g=.45fa1560-bcfb-4ac0-9bd7-03734547b09d@github.com> On Fri, 7 Jun 2024 07:29:39 GMT, SendaoYan wrote: >> Hi all, >> This PR several extra empty spaces and extra empty lines in several Makefiles. It's trivial fix, no risk. >> >> Thanks. > > SendaoYan has updated the pull request incrementally with one additional commit since the last revision: > > delete extra empty trailing blank line in test/jdk/java/rmi/reliability/benchmark/bench/Makefile Thanks all for the review and sponsor. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19537#issuecomment-2154937099 From shade at openjdk.org Fri Jun 7 14:31:14 2024 From: shade at openjdk.org (Aleksey Shipilev) Date: Fri, 7 Jun 2024 14:31:14 GMT Subject: RFR: 8325984: 4 jcstress tests are failing in Tier6 4 times each In-Reply-To: References: Message-ID: <_uQZcxrXOnPXBMLzSk9K2itTY0HTrWILaXe_Knl1EVU=.4775cf80-a348-406c-a2ba-39350315cad8@github.com> On Wed, 5 Jun 2024 19:21:56 GMT, Jorn Vernee wrote: > These 4 tests were failing due to an incompatibility with jcstress. They were problemlisted in past (https://bugs.openjdk.org/browse/JDK-8326062). > > Now that jcstress has been updated (https://github.com/openjdk/jdk/pull/19332) with the relevant fix (https://github.com/openjdk/jcstress/pull/147), we can re-enable these tests. > > Testing: I've verified that all 4 tests now pass on Linux-x64 I think this is fine and trivial. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19565#issuecomment-2154964073 From redestad at openjdk.org Fri Jun 7 14:53:16 2024 From: redestad at openjdk.org (Claes Redestad) Date: Fri, 7 Jun 2024 14:53:16 GMT Subject: Integrated: 8333774: Avoid eagerly loading various EmptySpliterator classes In-Reply-To: <4Fe9imJ4KWHoEnbAkOW53q8gGtHTUJfeu6Kr1YFUONM=.91de28a6-af33-4bfc-a3da-8a55d97bc515@github.com> References: <4Fe9imJ4KWHoEnbAkOW53q8gGtHTUJfeu6Kr1YFUONM=.91de28a6-af33-4bfc-a3da-8a55d97bc515@github.com> Message-ID: <149Q3yDBfPvL3DCQIcqxzds3yV1pDLbkBhcYvjethKw=.915ca76a-970f-4629-8943-3f826f40a368@github.com> On Fri, 7 Jun 2024 08:21:58 GMT, Claes Redestad wrote: > Trivially move a few private static finals to their respective source type to avoid eagerly loading a few small classes. This pull request has now been integrated. Changeset: d744059b Author: Claes Redestad URL: https://git.openjdk.org/jdk/commit/d744059b5b3e944bee53536de6f404666e45e8e5 Stats: 33 lines in 1 file changed: 12 ins; 12 del; 9 mod 8333774: Avoid eagerly loading various EmptySpliterator classes Reviewed-by: liach, pminborg ------------- PR: https://git.openjdk.org/jdk/pull/19591 From redestad at openjdk.org Fri Jun 7 14:53:15 2024 From: redestad at openjdk.org (Claes Redestad) Date: Fri, 7 Jun 2024 14:53:15 GMT Subject: RFR: 8333774: Avoid eagerly loading various EmptySpliterator classes [v3] In-Reply-To: <8nDWWM7n_ROj39uC3vEV6aa-c8aaKHfJtos6gQnI9gI=.71ae9a2f-0c95-46d4-aa73-ed80e2c39401@github.com> References: <4Fe9imJ4KWHoEnbAkOW53q8gGtHTUJfeu6Kr1YFUONM=.91de28a6-af33-4bfc-a3da-8a55d97bc515@github.com> <8nDWWM7n_ROj39uC3vEV6aa-c8aaKHfJtos6gQnI9gI=.71ae9a2f-0c95-46d4-aa73-ed80e2c39401@github.com> Message-ID: <8rV5KPlG-P5CMzwAHEykuTeXABr26N05wrDhUEp00q0=.8c51767c-2463-4bfc-a516-a23950031b92@github.com> On Fri, 7 Jun 2024 13:08:24 GMT, Claes Redestad wrote: >> Trivially move a few private static finals to their respective source type to avoid eagerly loading a few small classes. > > Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: > > Update src/java.base/share/classes/java/util/Spliterators.java > > Co-authored-by: Chen Liang Thanks! Yes, the best holder for a singleton is typically the class itself ? ------------- PR Comment: https://git.openjdk.org/jdk/pull/19591#issuecomment-2155003099 From rriggs at openjdk.org Fri Jun 7 15:01:15 2024 From: rriggs at openjdk.org (Roger Riggs) Date: Fri, 7 Jun 2024 15:01:15 GMT Subject: RFR: 8333742: ProcessImpl and ProcessHandleImpl may mishandle processes that exit with code 259 In-Reply-To: <1CvkxMiIsaatbXRqxy6MIPKRisHyifLU5VCr7OA-Lso=.6a1a2f1a-bfbb-4e59-ab2e-1a367b8f6492@github.com> References: <1CvkxMiIsaatbXRqxy6MIPKRisHyifLU5VCr7OA-Lso=.6a1a2f1a-bfbb-4e59-ab2e-1a367b8f6492@github.com> Message-ID: On Thu, 6 Jun 2024 18:40:51 GMT, Daniel Jeli?ski wrote: > `GetExitCodeProcess` method is not reliable for checking if a process exited already; it returns 259 (STILL_ACTIVE) if the process hasn't exited yet, but the same value is returned when the process exited with code 259. In order to check if the process exited, we need to check if its handle is in a signaled state using one of the wait methods. > > This PR fixes the onExit, exitValue, isAlive, and waitFor(timeout) methods to correctly handle the problematic exit code. > > I haven't fixed the ProcessImpl.toString method. I'm not sure the problem is important enough to justify an extra JNI call in the (probably typical) still-alive case. > > Tier1-3 testing clean. I modified the existing OnExitTest to cover this case. src/java.base/windows/native/libjava/ProcessHandleImpl_win.c line 128: > 126: JNU_ThrowByNameWithLastError(env, > 127: "java/lang/RuntimeException", "WaitForMultipleObjects"); > 128: } else if (!GetExitCodeProcess(handle, &exitValue)) { This can return STILL_ACTIVE if there is a spurious thread interrupt. The interrupt is presumably present to keep the thread from being stuck in a blocking windows os call. The calling code in ProcessHandleImpl is agnostic to platform and would report the process had exited. Can the risk of incorrectly reporting the process exit be mitigated? If the Thread is legitimately been interrupted, Thread.interrupted() would be true and the reaper could exit. If false, it could retry the waitForProcessExit(). src/java.base/windows/native/libjava/ProcessImpl_md.c line 471: > 469: { > 470: return WaitForSingleObject((HANDLE) handle, 0) /* don't wait */ > 471: == WAIT_TIMEOUT; Would this be better as `isProcessAlive(handle)`? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19586#discussion_r1631346916 PR Review Comment: https://git.openjdk.org/jdk/pull/19586#discussion_r1631322282 From jvernee at openjdk.org Fri Jun 7 15:44:16 2024 From: jvernee at openjdk.org (Jorn Vernee) Date: Fri, 7 Jun 2024 15:44:16 GMT Subject: Integrated: 8325984: 4 jcstress tests are failing in Tier6 4 times each In-Reply-To: References: Message-ID: On Wed, 5 Jun 2024 19:21:56 GMT, Jorn Vernee wrote: > These 4 tests were failing due to an incompatibility with jcstress. They were problemlisted in past (https://bugs.openjdk.org/browse/JDK-8326062). > > Now that jcstress has been updated (https://github.com/openjdk/jdk/pull/19332) with the relevant fix (https://github.com/openjdk/jcstress/pull/147), we can re-enable these tests. > > Testing: I've verified that all 4 tests now pass on Linux-x64 This pull request has now been integrated. Changeset: ee82346b Author: Jorn Vernee URL: https://git.openjdk.org/jdk/commit/ee82346bd5ecf3024d6dc7b7529598099483a42c Stats: 5 lines in 1 file changed: 0 ins; 5 del; 0 mod 8325984: 4 jcstress tests are failing in Tier6 4 times each Reviewed-by: shade ------------- PR: https://git.openjdk.org/jdk/pull/19565 From djelinski at openjdk.org Fri Jun 7 16:09:15 2024 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Fri, 7 Jun 2024 16:09:15 GMT Subject: RFR: 8333742: ProcessImpl and ProcessHandleImpl may mishandle processes that exit with code 259 In-Reply-To: References: <1CvkxMiIsaatbXRqxy6MIPKRisHyifLU5VCr7OA-Lso=.6a1a2f1a-bfbb-4e59-ab2e-1a367b8f6492@github.com> Message-ID: On Fri, 7 Jun 2024 14:58:30 GMT, Roger Riggs wrote: >> `GetExitCodeProcess` method is not reliable for checking if a process exited already; it returns 259 (STILL_ACTIVE) if the process hasn't exited yet, but the same value is returned when the process exited with code 259. In order to check if the process exited, we need to check if its handle is in a signaled state using one of the wait methods. >> >> This PR fixes the onExit, exitValue, isAlive, and waitFor(timeout) methods to correctly handle the problematic exit code. >> >> I haven't fixed the ProcessImpl.toString method. I'm not sure the problem is important enough to justify an extra JNI call in the (probably typical) still-alive case. >> >> Tier1-3 testing clean. I modified the existing OnExitTest to cover this case. > > src/java.base/windows/native/libjava/ProcessHandleImpl_win.c line 128: > >> 126: JNU_ThrowByNameWithLastError(env, >> 127: "java/lang/RuntimeException", "WaitForMultipleObjects"); >> 128: } else if (!GetExitCodeProcess(handle, &exitValue)) { > > This can return STILL_ACTIVE if there is a spurious thread interrupt. > The interrupt is presumably present to keep the thread from being stuck in a blocking windows os call. > > The calling code in ProcessHandleImpl is agnostic to platform and would report the process had exited. > > Can the risk of incorrectly reporting the process exit be mitigated? > > If the Thread is legitimately been interrupted, Thread.interrupted() would be true and the reaper could exit. > If false, it could retry the waitForProcessExit(). I only left it here because the wait for interrupt event was already present. Is being stuck in a blocking os call a bad thing? If not, I can drop the interrupt event, and wait on the process handle only. > src/java.base/windows/native/libjava/ProcessImpl_md.c line 471: > >> 469: { >> 470: return WaitForSingleObject((HANDLE) handle, 0) /* don't wait */ >> 471: == WAIT_TIMEOUT; > > Would this be better as `isProcessAlive(handle)`? I don't follow. Could you explain? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19586#discussion_r1631423597 PR Review Comment: https://git.openjdk.org/jdk/pull/19586#discussion_r1631424662 From naoto at openjdk.org Fri Jun 7 16:24:23 2024 From: naoto at openjdk.org (Naoto Sato) Date: Fri, 7 Jun 2024 16:24:23 GMT Subject: RFR: 8332161: Test restoring echo in the Console implementation (java.base) [v12] In-Reply-To: <5ac8-ZK1FeJdtdZsG8WQRFkdOFHD1Q_aT1rKYZ19lQ4=.3205fa59-10a5-4a14-b49c-98410b82cb6d@github.com> References: <5ac8-ZK1FeJdtdZsG8WQRFkdOFHD1Q_aT1rKYZ19lQ4=.3205fa59-10a5-4a14-b49c-98410b82cb6d@github.com> Message-ID: On Thu, 6 Jun 2024 21:49:35 GMT, Naoto Sato wrote: >> This test intends to verify the behavior of JdkConsole for the java.base module, wrt restoring the echo. The test assumes the internal methods that sets/gets the echo status of the platform. > > Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: > > Loosening the timeout value Thanks for the reviews! ------------- PR Comment: https://git.openjdk.org/jdk/pull/19315#issuecomment-2155153612 From naoto at openjdk.org Fri Jun 7 16:24:25 2024 From: naoto at openjdk.org (Naoto Sato) Date: Fri, 7 Jun 2024 16:24:25 GMT Subject: Integrated: 8332161: Test restoring echo in the Console implementation (java.base) In-Reply-To: References: Message-ID: On Mon, 20 May 2024 18:08:31 GMT, Naoto Sato wrote: > This test intends to verify the behavior of JdkConsole for the java.base module, wrt restoring the echo. The test assumes the internal methods that sets/gets the echo status of the platform. This pull request has now been integrated. Changeset: 25ad8623 Author: Naoto Sato URL: https://git.openjdk.org/jdk/commit/25ad86234a7cd6e606b273f3e63351aa07c567a3 Stats: 154 lines in 2 files changed: 154 ins; 0 del; 0 mod 8332161: Test restoring echo in the Console implementation (java.base) Reviewed-by: joehw, prappo ------------- PR: https://git.openjdk.org/jdk/pull/19315 From sgibbons at openjdk.org Fri Jun 7 17:05:33 2024 From: sgibbons at openjdk.org (Scott Gibbons) Date: Fri, 7 Jun 2024 17:05:33 GMT Subject: Integrated: 8320448: Accelerate IndexOf using AVX2 In-Reply-To: References: Message-ID: On Tue, 21 Nov 2023 00:06:19 GMT, Scott Gibbons wrote: > Re-write the IndexOf code without the use of the pcmpestri instruction, only using AVX2 instructions. This change accelerates String.IndexOf on average 1.3x for AVX2. The benchmark numbers: > > > Benchmark Score Latest > StringIndexOf.advancedWithMediumSub 343.573 317.934 0.925375393x > StringIndexOf.advancedWithShortSub1 1039.081 1053.96 1.014319384x > StringIndexOf.advancedWithShortSub2 55.828 110.541 1.980027943x > StringIndexOf.constantPattern 9.361 11.906 1.271872663x > StringIndexOf.searchCharLongSuccess 4.216 4.218 1.000474383x > StringIndexOf.searchCharMediumSuccess 3.133 3.216 1.02649218x > StringIndexOf.searchCharShortSuccess 3.76 3.761 1.000265957x > StringIndexOf.success 9.186 9.713 1.057369911x > StringIndexOf.successBig 14.341 46.343 3.231504079x > StringIndexOfChar.latin1_AVX2_String 6220.918 12154.52 1.953814533x > StringIndexOfChar.latin1_AVX2_char 5503.556 5540.044 1.006629895x > StringIndexOfChar.latin1_SSE4_String 6978.854 6818.689 0.977049957x > StringIndexOfChar.latin1_SSE4_char 5657.499 5474.624 0.967675646x > StringIndexOfChar.latin1_Short_String 7132.541 6863.359 0.962260014x > StringIndexOfChar.latin1_Short_char 16013.389 16162.437 1.009307711x > StringIndexOfChar.latin1_mixed_String 7386.123 14771.622 1.999915517x > StringIndexOfChar.latin1_mixed_char 9901.671 9782.245 0.987938803 This pull request has now been integrated. Changeset: 8e72d7cf Author: Scott Gibbons Committer: Jatin Bhateja URL: https://git.openjdk.org/jdk/commit/8e72d7cf8e7dfc7eb9e66bc562f125f947e37f49 Stats: 3906 lines in 16 files changed: 3876 ins; 0 del; 30 mod 8320448: Accelerate IndexOf using AVX2 Reviewed-by: epeter, kvn, sviswanathan ------------- PR: https://git.openjdk.org/jdk/pull/16753 From ron.pressler at oracle.com Fri Jun 7 18:19:06 2024 From: ron.pressler at oracle.com (Ron Pressler) Date: Fri, 7 Jun 2024 18:19:06 +0000 Subject: [External] : Re: New candidate JEP: 471: Deprecate the Memory-Access Methods in sun.misc.Unsafe for Removal In-Reply-To: References: <20240503151140.68BE06C9AEE@eggemoggin.niobe.net> <990521CB-66E1-45E6-8019-79E2C0BF7FEE@oracle.com> <835bfb2c-3318-4869-b8ff-6b1d3c1b70ad@oracle.com> Message-ID: > On 6 Jun 2024, at 18:37, David Lloyd wrote: > > Just bumping this one more time. I intend to start by opening a JIRA to add the two proposed methods to `ReflectionFactory`, and go from there. I guess that we might need a JEP for the proposed serialization restrictions, which is going to be considerably more involved, so I'm putting that off as a second step for now, pending further discussion. Hi. Seven years before the upcoming delivery of JEP 471 we [announced that the world of accessing JDK internals would be coming to an end](https://openjdk.org/jeps/260). Four years later, the JDK [started enforcing that](https://openjdk.org/jeps/403), but to give extra time to laggards who have not yet adapted to either refraining from accessing internals or instructing their users on the proper configuration of the JDK to allow doing so, we left some unsupported mechanisms in place to temporarily allow hacking around the restrictions until they can properly adapt. Now, three years later, we're starting the process of removing the temporary hacks, although we don't yet know how long the process should last. My first question is, how many more years do you think we should wait for libraries to finish the process by which they either refrain from accessing internals or instruct their users on the proper configuration that allows them to do so? Knowing how long we should wait for the libraries that have not yet finished their adaptation in the past seven years, and how far along they are in the process, could help inform how long we should wait until the actual removal of Unsafe. My second question has to do with the consideration that any serialization procedure should no longer bypass constructors (at least not without `--add-opens`, that is). I'd be interested to know about the difficulties serialization libraries have encountered in their process of migrating away from accessing internals and toward custom serializers for JDK classes, such as what public constructors are missing. This would help us identify what constructors we should add to support serialization that doesn't violate integrity. ? Ron From duke at openjdk.org Fri Jun 7 18:30:14 2024 From: duke at openjdk.org (ExE Boss) Date: Fri, 7 Jun 2024 18:30:14 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base [v6] In-Reply-To: References: Message-ID: <5HOOm-feUCYEaq-1D08UZSMraZ7VPH-qNKnZHXu3D_E=.e3cdcf7c-08a4-45d1-b3c3-05f72f0e6f0d@github.com> On Fri, 7 Jun 2024 13:56:24 GMT, Chen Liang wrote: >> In java.base, especially in bytecode generators, we have many different methods converting known valid Class and MethodType into ClassDesc and MethodTypeDesc. These conversions should be consolidated into the same utility method for the ease of future maintenance. > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > ExE-Boss review, go through validated path in Class `ClassDesc?::of?(String)`, `ClassDesc?::of?(String, String)`, and?`ClassDesc?::ofInternalName?(String)` can?probably call?`ReferenceClassDescImpl?::ofValidated?(String)`?directly as?those?methods already?perform?validation before?forwarding to?`ClassDesc?::ofDescriptor?(String)`. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19585#issuecomment-2155321459 From duke at openjdk.org Fri Jun 7 18:42:12 2024 From: duke at openjdk.org (ExE Boss) Date: Fri, 7 Jun 2024 18:42:12 GMT Subject: RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 13:45:42 GMT, Chen Liang wrote: >> This PR refactors type matching in BootstrapMethodInvoker and adds a few types, seeking to improve bootstrap overheads of some ConstantBootstraps and in particular the ProxyGenerator condys generated for e.g. annotation proxies since [JDK-8332457](https://bugs.openjdk.org/browse/JDK-8332457) >> >> I've adjusted the micro-benchmark added by JDK-8332457 to not only generate a proxy but also call into one of the proxied methodt (`Object::hashCode`). >> >> Running org.openjdk.bench.java.lang.reflect.ProxyGenBench as a one-off startup benchmark sees significant improvement (-9% instructions, -6% cycles): >> >> Name Cnt Base Error Test Error Unit Change >> Perfstartup-JMH 20 154,000 ? 8,165 148,000 ? 23,164 ms/op 1,04x (p = 0,352 ) >> :.cycles 925335973,200 ? 47147600,262 842221278,800 ? 46836254,964 cycles 0,91x (p = 0,000*) >> :.instructions 2101588857,600 ? 81105850,361 1966307798,400 ? 22011043,908 instructions 0,94x (p = 0,000*) >> :.taskclock 291,500 ? 16,494 262,000 ? 15,328 ms 0,90x (p = 0,000*) >> * = significant >> >> Number of classes loaded drops from 1096 to 1092 >> >> Running the micro regularly shows no significant difference: >> >> Name Cnt Base Error Test Error Unit Change >> ProxyGenBench.generateAndProxy100 10 26,827 ? 8,954 26,855 ? 7,531 ms/op 1,00x (p = 0,991 ) >> * = significant > > src/java.base/share/classes/java/lang/invoke/BootstrapMethodInvoker.java line 289: > >> 287: * bootstrap method. >> 288: */ >> 289: private static final MethodType CONDY_GET_STATIC_FINAL_MT = MethodType.methodType(Object.class, > > This type should just be called `CONDY_NO_ARG` as it's the most common form of condy that doesn't take any arg (`nullConstant` `primitiveClass` etc.) Note?that [`ConstantBootstraps?::primitiveClass?(Lookup, String, Class)`] has?a?static return?type of?`Class?`, so?the?following is?also?needed: /** * Exact type used of the {@link ConstantBootstraps#primitiveClass(Lookup, String, Class)} * bootstrap method. */ private static final MethodType CONDY_CLASS_NO_ARG_MT = CONDY_GET_STATIC_FINAL_MT.changeReturnType(Class.class); [`ConstantBootstraps?::primitiveClass?(Lookup, String, Class)`]: https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/invoke/ConstantBootstraps.html#primitiveClass(java.lang.invoke.MethodHandles.Lookup,java.lang.String,java.lang.Class) ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19598#discussion_r1631570980 From duke at openjdk.org Fri Jun 7 18:43:25 2024 From: duke at openjdk.org (duke) Date: Fri, 7 Jun 2024 18:43:25 GMT Subject: Withdrawn: 8324573: HashMap::putAll add notes for conservative resizing In-Reply-To: References: Message-ID: On Wed, 24 Jan 2024 00:26:09 GMT, Joshua Cao wrote: > Add notes for `HashMap::putAll()` conservative resizing. > > Note: everything below this line is from the original change. After discussion, we decided to keep the conservative resizing, but we should add an `@implNote` for the decision. > > --- > > This change mirrors what we did for ConcurrentHashMap in https://github.com/openjdk/jdk/pull/17116. When we add all entries from one map to anther, we should resize that map to the size of the sum of both maps. > > I used the command below to run the benchmarks. I set a high heap to reduce garbage collection noise. > > java -Xms25G -jar benchmarks.jar -p size=100000 -p addSize=100000 -gc true org.openjdk.bench.java.util.HashMapBench > > > Before change > > > Benchmark (addSize) (mapType) (size) Mode Cnt Score Error Units > HashMapBench.putAll 100000 HASH_MAP 100000 avgt 4 22.927 ? 3.170 ms/op > HashMapBench.putAll 100000 LINKED_HASH_MAP 100000 avgt 4 25.198 ? 2.189 ms/op > > > After change > > > Benchmark (addSize) (mapType) (size) Mode Cnt Score Error Units > HashMapBench.putAll 100000 HASH_MAP 100000 avgt 4 16.780 ? 0.526 ms/op > HashMapBench.putAll 100000 LINKED_HASH_MAP 100000 avgt 4 19.721 ? 0.349 ms/op > > > We see about average time improvements of 26% in HashMap and 20% in LinkedHashMap. > > --- > > In the worse case, we may have two maps with identical keys. In this case, we would aggressively resize when we do not need to. I'm also adding an additional `putAllSameKeys` benchmark. > > Before change: > > > Benchmark (addSize) (mapType) (size) Mode Cnt Score Error Units > HashMapBench.putAllSameKeys 100000 HASH_MAP 100000 avgt 6.956 ms/op > HashMapBench.putAllSameKeys:gc.alloc.rate 100000 HASH_MAP 100000 avgt 1091.383 MB/sec > HashMapBench.putAllSameKeys:gc.alloc.rate.norm 100000 HASH_MAP 100000 avgt 7968871.917 B/op > HashMapBench.putAllSameKeys:gc.count 100000 HASH_MAP 100000 avgt ? 0 counts > HashMapBench.putAllSameKeys 100000 LINKED_HASH_MAP 100000 avgt 8.417 ms/op > HashMapBench.putAllSameKeys:gc.alloc.rate 100000 LINKED_HASH_MAP 100000 avgt 992.543 MB/sec > HashMapBench.putAllSameKeys:gc.alloc.rate.norm 100000 LINKED_HASH_MAP 100000 avgt 87... This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/jdk/pull/17544 From redestad at openjdk.org Fri Jun 7 18:50:11 2024 From: redestad at openjdk.org (Claes Redestad) Date: Fri, 7 Jun 2024 18:50:11 GMT Subject: RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 18:38:52 GMT, ExE Boss wrote: >> src/java.base/share/classes/java/lang/invoke/BootstrapMethodInvoker.java line 289: >> >>> 287: * bootstrap method. >>> 288: */ >>> 289: private static final MethodType CONDY_GET_STATIC_FINAL_MT = MethodType.methodType(Object.class, >> >> This type should just be called `CONDY_NO_ARG` as it's the most common form of condy that doesn't take any arg (`nullConstant` `primitiveClass` etc.) > > Note?that [`ConstantBootstraps?::primitiveClass?(Lookup, String, Class)`] has?a?static return?type of?`Class?`, so?the?following is?also?needed: > > /** > * Exact type used of the {@link ConstantBootstraps#primitiveClass(Lookup, String, Class)} > * bootstrap method. > */ > private static final MethodType CONDY_CLASS_NO_ARG_MT > = CONDY_GET_STATIC_FINAL_MT.changeReturnType(Class.class); > > > [`ConstantBootstraps?::primitiveClass?(Lookup, String, Class)`]: https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/invoke/ConstantBootstraps.html#primitiveClass(java.lang.invoke.MethodHandles.Lookup,java.lang.String,java.lang.Class) It's not the intent of this PR to exhaustively enumerate all methods in `ConstantBootstraps`, primarily those shown to be bootstrap sensitive in some app. I've so far never seen a use of `primitiveClass` (and I admit being ignorant as to why this even exists as a BSM) so I don't have any reason to believe special-casing it will carry its own weight. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19598#discussion_r1631578674 From redestad at openjdk.org Fri Jun 7 18:58:36 2024 From: redestad at openjdk.org (Claes Redestad) Date: Fri, 7 Jun 2024 18:58:36 GMT Subject: RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator [v2] In-Reply-To: References: Message-ID: > This PR refactors type matching in BootstrapMethodInvoker and adds a few types, seeking to improve bootstrap overheads of some ConstantBootstraps and in particular the ProxyGenerator condys generated for e.g. annotation proxies since [JDK-8332457](https://bugs.openjdk.org/browse/JDK-8332457) > > I've adjusted the micro-benchmark added by JDK-8332457 to not only generate a proxy but also call into one of the proxied methodt (`Object::hashCode`). > > Running org.openjdk.bench.java.lang.reflect.ProxyGenBench as a one-off startup benchmark sees significant improvement (-9% instructions, -6% cycles): > > Name Cnt Base Error Test Error Unit Change > Perfstartup-JMH 20 154,000 ? 8,165 148,000 ? 23,164 ms/op 1,04x (p = 0,352 ) > :.cycles 925335973,200 ? 47147600,262 842221278,800 ? 46836254,964 cycles 0,91x (p = 0,000*) > :.instructions 2101588857,600 ? 81105850,361 1966307798,400 ? 22011043,908 instructions 0,94x (p = 0,000*) > :.taskclock 291,500 ? 16,494 262,000 ? 15,328 ms 0,90x (p = 0,000*) > * = significant > > Number of classes loaded drops from 1096 to 1092 > > Running the micro regularly shows no significant difference: > > Name Cnt Base Error Test Error Unit Change > ProxyGenBench.generateAndProxy100 10 26,827 ? 8,954 26,855 ? 7,531 ms/op 1,00x (p = 0,991 ) > * = significant Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: Adress review comments, add ConstantBootstraps#invoke to list of recognized type signatures ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19598/files - new: https://git.openjdk.org/jdk/pull/19598/files/21f945b5..532966a4 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19598&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19598&range=00-01 Stats: 29 lines in 1 file changed: 17 ins; 0 del; 12 mod Patch: https://git.openjdk.org/jdk/pull/19598.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19598/head:pull/19598 PR: https://git.openjdk.org/jdk/pull/19598 From redestad at openjdk.org Fri Jun 7 18:58:36 2024 From: redestad at openjdk.org (Claes Redestad) Date: Fri, 7 Jun 2024 18:58:36 GMT Subject: RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 13:46:22 GMT, Jorn Vernee wrote: > As an aside: I suppose we pre-generate all the linkers that get spun up for these `invokeExact`calls already. But, we might still get a little bit of mileage out of switching to `invokeBasic`, which bypasses the linkers altogether. With the caveat that we have to be very careful that the call site type is correct. I'm not sure I see what linkers you're alluding to here in profiles (and I don't think we have code pre-generating all of them), and I don't see how to use `invokeBasic` here instead. Care to elaborate? ------------- PR Comment: https://git.openjdk.org/jdk/pull/19598#issuecomment-2155357245 From liach at openjdk.org Fri Jun 7 19:21:15 2024 From: liach at openjdk.org (Chen Liang) Date: Fri, 7 Jun 2024 19:21:15 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base [v6] In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 13:56:24 GMT, Chen Liang wrote: >> In java.base, especially in bytecode generators, we have many different methods converting known valid Class and MethodType into ClassDesc and MethodTypeDesc. These conversions should be consolidated into the same utility method for the ease of future maintenance. > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > ExE-Boss review, go through validated path in Class No: they are missing checks against initial, trailing, or consecutive . or / separators. We can do that in a future patch, with proper test additions. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19585#issuecomment-2155386076 From liach at openjdk.org Fri Jun 7 19:25:13 2024 From: liach at openjdk.org (Chen Liang) Date: Fri, 7 Jun 2024 19:25:13 GMT Subject: RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator [v2] In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 18:47:53 GMT, Claes Redestad wrote: >> Note?that [`ConstantBootstraps?::primitiveClass?(Lookup, String, Class)`] has?a?static return?type of?`Class?`, so?the?following is?also?needed: >> >> /** >> * Exact type used of the {@link ConstantBootstraps#primitiveClass(Lookup, String, Class)} >> * bootstrap method. >> */ >> private static final MethodType CONDY_CLASS_NO_ARG_MT >> = CONDY_GET_STATIC_FINAL_MT.changeReturnType(Class.class); >> >> >> [`ConstantBootstraps?::primitiveClass?(Lookup, String, Class)`]: https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/invoke/ConstantBootstraps.html#primitiveClass(java.lang.invoke.MethodHandles.Lookup,java.lang.String,java.lang.Class) > > It's not the intent of this PR to exhaustively enumerate all methods in `ConstantBootstraps`, primarily those shown to be bootstrap sensitive in some app. I've so far never seen a use of `primitiveClass` (and I admit being ignorant as to why this even exists as a BSM) so I don't have any reason to believe special-casing it will carry its own weight. For its existence, I think it was the same as null, that they weren't representable by cp entries for bootstrap method args. They are now backed by PrimitiveClassDescImpl, a type of condy, and ClassFile API currently writes loadConstant(primitiveCd) as a condy. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19598#discussion_r1631606873 From rriggs at openjdk.org Fri Jun 7 20:39:15 2024 From: rriggs at openjdk.org (Roger Riggs) Date: Fri, 7 Jun 2024 20:39:15 GMT Subject: RFR: 8333742: ProcessImpl and ProcessHandleImpl may mishandle processes that exit with code 259 In-Reply-To: References: <1CvkxMiIsaatbXRqxy6MIPKRisHyifLU5VCr7OA-Lso=.6a1a2f1a-bfbb-4e59-ab2e-1a367b8f6492@github.com> Message-ID: On Fri, 7 Jun 2024 16:05:06 GMT, Daniel Jeli?ski wrote: >> src/java.base/windows/native/libjava/ProcessHandleImpl_win.c line 128: >> >>> 126: JNU_ThrowByNameWithLastError(env, >>> 127: "java/lang/RuntimeException", "WaitForMultipleObjects"); >>> 128: } else if (!GetExitCodeProcess(handle, &exitValue)) { >> >> This can return STILL_ACTIVE if there is a spurious thread interrupt. >> The interrupt is presumably present to keep the thread from being stuck in a blocking windows os call. >> >> The calling code in ProcessHandleImpl is agnostic to platform and would report the process had exited. >> >> Can the risk of incorrectly reporting the process exit be mitigated? >> >> If the Thread is legitimately been interrupted, Thread.interrupted() would be true and the reaper could exit. >> If false, it could retry the waitForProcessExit(). > > I only left it here because the wait for interrupt event was already present. Is being stuck in a blocking os call a bad thing? If not, I can drop the interrupt event, and wait on the process handle only. I think waiting on JVM_GetThreadInterruptEvent() is necessary during VM shutdown to allow the blocked thread to exit cleanly. >> src/java.base/windows/native/libjava/ProcessImpl_md.c line 471: >> >>> 469: { >>> 470: return WaitForSingleObject((HANDLE) handle, 0) /* don't wait */ >>> 471: == WAIT_TIMEOUT; >> >> Would this be better as `isProcessAlive(handle)`? > > I don't follow. Could you explain? The `WaitForSingleObject(handle, 0)` seems like an indirect way to determine if the process is alive. Whereas `isProcessAlive(handle)` seems to directly answer the question. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19586#discussion_r1631664185 PR Review Comment: https://git.openjdk.org/jdk/pull/19586#discussion_r1631662973 From djelinski at openjdk.org Fri Jun 7 20:55:12 2024 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Fri, 7 Jun 2024 20:55:12 GMT Subject: RFR: 8333742: ProcessImpl and ProcessHandleImpl may mishandle processes that exit with code 259 In-Reply-To: References: <1CvkxMiIsaatbXRqxy6MIPKRisHyifLU5VCr7OA-Lso=.6a1a2f1a-bfbb-4e59-ab2e-1a367b8f6492@github.com> Message-ID: On Fri, 7 Jun 2024 20:35:00 GMT, Roger Riggs wrote: >> I don't follow. Could you explain? > > The `WaitForSingleObject(handle, 0)` seems like an indirect way to determine if the process is alive. > Whereas `isProcessAlive(handle)` seems to directly answer the question. sorry, I still don't get it. Are you telling me that I should use isProcessAlive to implement isProcessAlive? Because it doesn't look like a WinAPI function name, ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19586#discussion_r1631676183 From djelinski at openjdk.org Fri Jun 7 20:59:11 2024 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Fri, 7 Jun 2024 20:59:11 GMT Subject: RFR: 8333742: ProcessImpl and ProcessHandleImpl may mishandle processes that exit with code 259 In-Reply-To: References: <1CvkxMiIsaatbXRqxy6MIPKRisHyifLU5VCr7OA-Lso=.6a1a2f1a-bfbb-4e59-ab2e-1a367b8f6492@github.com> Message-ID: <6FHMmdtAGyWE8HqW4etXrG0VSKrTektVEUXgJ2TXqs4=.bbaf0570-12eb-440a-848d-41674e8d29c6@github.com> On Fri, 7 Jun 2024 20:36:45 GMT, Roger Riggs wrote: >> I only left it here because the wait for interrupt event was already present. Is being stuck in a blocking os call a bad thing? If not, I can drop the interrupt event, and wait on the process handle only. > > I think waiting on JVM_GetThreadInterruptEvent() is necessary during VM shutdown to allow the blocked thread to exit cleanly. Interesting. Could you point me to a related bug / documentation / evidence? I tested the WaitForSingleObject version (commit 6524747a5ebc51c760b14e90309c5f18b58b20e2) on Windows 11, and I didn't observe any problems with shutting down the VM ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19586#discussion_r1631678678 From rriggs at openjdk.org Fri Jun 7 21:03:11 2024 From: rriggs at openjdk.org (Roger Riggs) Date: Fri, 7 Jun 2024 21:03:11 GMT Subject: RFR: 8333742: ProcessImpl and ProcessHandleImpl may mishandle processes that exit with code 259 In-Reply-To: References: <1CvkxMiIsaatbXRqxy6MIPKRisHyifLU5VCr7OA-Lso=.6a1a2f1a-bfbb-4e59-ab2e-1a367b8f6492@github.com> Message-ID: On Fri, 7 Jun 2024 20:52:38 GMT, Daniel Jeli?ski wrote: >> The `WaitForSingleObject(handle, 0)` seems like an indirect way to determine if the process is alive. >> Whereas `isProcessAlive(handle)` seems to directly answer the question. > > sorry, I still don't get it. Are you telling me that I should use isProcessAlive to implement isProcessAlive? Because it doesn't look like a WinAPI function name, I take it back. It was just wishful thinking that Windows had the obvious API. And I've intermingled Java methods for native methods. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19586#discussion_r1631681720 From darcy at openjdk.org Fri Jun 7 21:10:22 2024 From: darcy at openjdk.org (Joe Darcy) Date: Fri, 7 Jun 2024 21:10:22 GMT Subject: RFR: 8333828: Use value javadoc tag in java.lang.{Float, Double} Message-ID: Use the value tag to make the javadoc for various format-related constants more informative to readers. Currently the information is available by following the "Constant Field Values" link. I'll reflow the paragraphs before a push. ------------- Commit messages: - JDK-8333828: Use value javadoc tag in java.lang.{Float, Double} Changes: https://git.openjdk.org/jdk/pull/19607/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19607&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333828 Stats: 10 lines in 2 files changed: 0 ins; 0 del; 10 mod Patch: https://git.openjdk.org/jdk/pull/19607.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19607/head:pull/19607 PR: https://git.openjdk.org/jdk/pull/19607 From rriggs at openjdk.org Fri Jun 7 21:16:13 2024 From: rriggs at openjdk.org (Roger Riggs) Date: Fri, 7 Jun 2024 21:16:13 GMT Subject: RFR: 8333742: ProcessImpl and ProcessHandleImpl may mishandle processes that exit with code 259 In-Reply-To: <6FHMmdtAGyWE8HqW4etXrG0VSKrTektVEUXgJ2TXqs4=.bbaf0570-12eb-440a-848d-41674e8d29c6@github.com> References: <1CvkxMiIsaatbXRqxy6MIPKRisHyifLU5VCr7OA-Lso=.6a1a2f1a-bfbb-4e59-ab2e-1a367b8f6492@github.com> <6FHMmdtAGyWE8HqW4etXrG0VSKrTektVEUXgJ2TXqs4=.bbaf0570-12eb-440a-848d-41674e8d29c6@github.com> Message-ID: On Fri, 7 Jun 2024 20:56:03 GMT, Daniel Jeli?ski wrote: >> I think waiting on JVM_GetThreadInterruptEvent() is necessary during VM shutdown to allow the blocked thread to exit cleanly. > > Interesting. Could you point me to a related bug / documentation / evidence? I tested the WaitForSingleObject version (commit 6524747a5ebc51c760b14e90309c5f18b58b20e2) on Windows 11, and I didn't observe any problems with shutting down the VM I don't have a test or counter example and don't have a detailed understanding of the blocking needs of Hotspot. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19586#discussion_r1631701117 From jjg at openjdk.org Fri Jun 7 22:03:12 2024 From: jjg at openjdk.org (Jonathan Gibbons) Date: Fri, 7 Jun 2024 22:03:12 GMT Subject: RFR: 8333828: Use value javadoc tag in java.lang.{Float, Double} In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 21:05:33 GMT, Joe Darcy wrote: > Use the value tag to make the javadoc for various format-related constants more informative to readers. Currently the information is available by following the "Constant Field Values" link. > > I'll reflow the paragraphs before a push. You can omit the field name from a `{@value ...}` tag if the tag is in the doc comment for that field. Thus, in most if not all the cases here, you can simplify all tags to just `{@value}`. ------------- PR Review: https://git.openjdk.org/jdk/pull/19607#pullrequestreview-2105442388 From liach at openjdk.org Fri Jun 7 22:03:12 2024 From: liach at openjdk.org (Chen Liang) Date: Fri, 7 Jun 2024 22:03:12 GMT Subject: RFR: 8333828: Use value javadoc tag in java.lang.{Float, Double} In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 21:05:33 GMT, Joe Darcy wrote: > Use the value tag to make the javadoc for various format-related constants more informative to readers. Currently the information is available by following the "Constant Field Values" link. > > I'll reflow the paragraphs before a push. Since you are using the value tag on the field themselves to display their own value, I believe a `{@value}` suffices. See the example in java.lang.constant.ConstantDescs: https://github.com/openjdk/jdk/blob/cf677c901e70d98404ec9cc3d75a93926e02fcd2/src/java.base/share/classes/java/lang/constant/ConstantDescs.java#L307 https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/constant/ConstantDescs.html#INIT_NAME ------------- PR Comment: https://git.openjdk.org/jdk/pull/19607#issuecomment-2155627548 From liach at openjdk.org Fri Jun 7 22:06:17 2024 From: liach at openjdk.org (Chen Liang) Date: Fri, 7 Jun 2024 22:06:17 GMT Subject: RFR: 8333749: Consolidate ConstantDesc conversion in java.base [v6] In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 13:56:24 GMT, Chen Liang wrote: >> In java.base, especially in bytecode generators, we have many different methods converting known valid Class and MethodType into ClassDesc and MethodTypeDesc. These conversions should be consolidated into the same utility method for the ease of future maintenance. > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > ExE-Boss review, go through validated path in Class Thanks for the reviews! ------------- PR Comment: https://git.openjdk.org/jdk/pull/19585#issuecomment-2155630141 From darcy at openjdk.org Fri Jun 7 22:16:36 2024 From: darcy at openjdk.org (Joe Darcy) Date: Fri, 7 Jun 2024 22:16:36 GMT Subject: RFR: 8333828: Use value javadoc tag in java.lang.{Float, Double} [v2] In-Reply-To: References: Message-ID: <8EttkjTur6Og1vappqkT2az4EOh5G4FU2nA_b1anHYw=.80dd6f49-5182-4146-8e04-6f31e212b3aa@github.com> > Use the value tag to make the javadoc for various format-related constants more informative to readers. Currently the information is available by following the "Constant Field Values" link. > > I'll reflow the paragraphs before a push. Joe Darcy has updated the pull request incrementally with one additional commit since the last revision: Implement review feedback. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19607/files - new: https://git.openjdk.org/jdk/pull/19607/files/ab3b9e38..ea23aaf0 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19607&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19607&range=00-01 Stats: 10 lines in 2 files changed: 0 ins; 0 del; 10 mod Patch: https://git.openjdk.org/jdk/pull/19607.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19607/head:pull/19607 PR: https://git.openjdk.org/jdk/pull/19607 From liach at openjdk.org Fri Jun 7 22:24:26 2024 From: liach at openjdk.org (Chen Liang) Date: Fri, 7 Jun 2024 22:24:26 GMT Subject: RFR: 8333828: Use value javadoc tag in java.lang.{Float, Double} [v2] In-Reply-To: <8EttkjTur6Og1vappqkT2az4EOh5G4FU2nA_b1anHYw=.80dd6f49-5182-4146-8e04-6f31e212b3aa@github.com> References: <8EttkjTur6Og1vappqkT2az4EOh5G4FU2nA_b1anHYw=.80dd6f49-5182-4146-8e04-6f31e212b3aa@github.com> Message-ID: <9x1mwCraK3PlFykkeK1M_ZijoktK_8c9pEhq7aHYM90=.6f5968d4-e013-4759-b91f-061b6fb3a475@github.com> On Fri, 7 Jun 2024 22:16:36 GMT, Joe Darcy wrote: >> Use the value tag to make the javadoc for various format-related constants more informative to readers. Currently the information is available by following the "Constant Field Values" link. >> >> I'll reflow the paragraphs before a push. > > Joe Darcy has updated the pull request incrementally with one additional commit since the last revision: > > Implement review feedback. Thanks for this simplification! ------------- Marked as reviewed by liach (Author). PR Review: https://git.openjdk.org/jdk/pull/19607#pullrequestreview-2105458016 From duke at openjdk.org Sat Jun 8 02:52:41 2024 From: duke at openjdk.org (Shaojin Wen) Date: Sat, 8 Jun 2024 02:52:41 GMT Subject: RFR: 8327791: UUID toString removes the use of ByteArrayLittleEndian Message-ID: After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. ------------- Commit messages: - optimization for UUID toString Changes: https://git.openjdk.org/jdk/pull/19610/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19610&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8327791 Stats: 49 lines in 2 files changed: 4 ins; 26 del; 19 mod Patch: https://git.openjdk.org/jdk/pull/19610.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19610/head:pull/19610 PR: https://git.openjdk.org/jdk/pull/19610 From duke at openjdk.org Sat Jun 8 02:52:41 2024 From: duke at openjdk.org (Shaojin Wen) Date: Sat, 8 Jun 2024 02:52:41 GMT Subject: RFR: 8327791: UUID toString removes the use of ByteArrayLittleEndian In-Reply-To: References: Message-ID: On Sat, 8 Jun 2024 00:19:55 GMT, Shaojin Wen wrote: > After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. The performance numbers under MacBookPro M1 Max are as follows: -Benchmark (size) Mode Cnt Score Error Units (#master 8ffc35d117846a7a2aa08afed662273d2f887770 ) -UUIDBench.toString 20000 thrpt 15 103.904 ? 0.772 ops/us +Benchmark (size) Mode Cnt Score Error Units (# current 30373b81fddbf7e82340e466cf6425a5252399d2 ) +UUIDBench.toString 20000 thrpt 15 109.529 ? 1.156 ops/us + 5.41% ------------- PR Comment: https://git.openjdk.org/jdk/pull/19610#issuecomment-2155757438 From liach at openjdk.org Sat Jun 8 06:03:17 2024 From: liach at openjdk.org (Chen Liang) Date: Sat, 8 Jun 2024 06:03:17 GMT Subject: RFR: 8327791: UUID toString removes the use of ByteArrayLittleEndian In-Reply-To: References: Message-ID: On Sat, 8 Jun 2024 00:19:55 GMT, Shaojin Wen wrote: > After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. I think you mean bug ID 8333833, right? src/java.base/share/classes/jdk/internal/util/HexDigits.java line 123: > 121: */ > 122: public static void putHex(byte[] buffer, int off, int i) { > 123: int v = (DIGITS[i & 0xff] << 16) | DIGITS[(i >> 8) & 0xff]; Looking at the comments in #16245, it's said that the int must be computed beforehand so it will be a write of a 4-byte instead of 2 write of 2-bytes. Is that understanding correct? If my understanding is correct, I recommend to leave a comment explaining why we compact the value into an int, like // Prepare an int value so C2 generates a 4-byte write instead of two 2-byte writes ------------- PR Review: https://git.openjdk.org/jdk/pull/19610#pullrequestreview-2105776831 PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1631885732 From duke at openjdk.org Sat Jun 8 06:40:39 2024 From: duke at openjdk.org (Shaojin Wen) Date: Sat, 8 Jun 2024 06:40:39 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v2] In-Reply-To: References: Message-ID: > After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: add comments ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19610/files - new: https://git.openjdk.org/jdk/pull/19610/files/30373b81..ace7a9f6 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19610&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19610&range=00-01 Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/19610.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19610/head:pull/19610 PR: https://git.openjdk.org/jdk/pull/19610 From duke at openjdk.org Sat Jun 8 12:28:11 2024 From: duke at openjdk.org (Sunmisc Unsafe) Date: Sat, 8 Jun 2024 12:28:11 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v2] In-Reply-To: References: Message-ID: <2ZsyLWBqAF4daDjtkpfOaVNk6UsRuexVlZM5bKPxezc=.b4b3ec9b-6402-40ad-b19c-7cb3a461dac0@github.com> On Sat, 8 Jun 2024 06:40:39 GMT, Shaojin Wen wrote: >> After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. > > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: > > add comments As far as I know, ByteArrayLittleEndian uses the VarHandle mechanism, which more efficiently writes different primitives into the array, unlike the basic ------------- PR Comment: https://git.openjdk.org/jdk/pull/19610#issuecomment-2156018093 From redestad at openjdk.org Sat Jun 8 13:06:13 2024 From: redestad at openjdk.org (Claes Redestad) Date: Sat, 8 Jun 2024 13:06:13 GMT Subject: RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator [v2] In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 19:22:43 GMT, Chen Liang wrote: >> It's not the intent of this PR to exhaustively enumerate all methods in `ConstantBootstraps`, primarily those shown to be bootstrap sensitive in some app. I've so far never seen a use of `primitiveClass` (and I admit being ignorant as to why this even exists as a BSM) so I don't have any reason to believe special-casing it will carry its own weight. > > For its existence, I think it was the same as null, that they weren't representable by cp entries for bootstrap method args. They are now backed by PrimitiveClassDescImpl, a type of condy, and ClassFile API currently writes loadConstant(primitiveCd) as a condy. I am sure there's a perfectly good explanation why we've done it like that rather than translating things like javac would (AFAICT a load from `Integer/Short/Byte/...TYPE`). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19598#discussion_r1632041009 From liach at openjdk.org Sat Jun 8 13:08:16 2024 From: liach at openjdk.org (Chen Liang) Date: Sat, 8 Jun 2024 13:08:16 GMT Subject: Integrated: 8333749: Consolidate ConstantDesc conversion in java.base In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 18:35:01 GMT, Chen Liang wrote: > In java.base, especially in bytecode generators, we have many different methods converting known valid Class and MethodType into ClassDesc and MethodTypeDesc. These conversions should be consolidated into the same utility method for the ease of future maintenance. This pull request has now been integrated. Changeset: 8d2f9e57 Author: Chen Liang Committer: Claes Redestad URL: https://git.openjdk.org/jdk/commit/8d2f9e57c3797c01c84df007f4d2bfdcd645d0c0 Stats: 255 lines in 13 files changed: 113 ins; 47 del; 95 mod 8333749: Consolidate ConstantDesc conversion in java.base Co-authored-by: Claes Redestad Reviewed-by: redestad, jvernee ------------- PR: https://git.openjdk.org/jdk/pull/19585 From liach at openjdk.org Sat Jun 8 13:18:13 2024 From: liach at openjdk.org (Chen Liang) Date: Sat, 8 Jun 2024 13:18:13 GMT Subject: RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator [v2] In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 18:58:36 GMT, Claes Redestad wrote: >> This PR refactors type matching in BootstrapMethodInvoker and adds a few types, seeking to improve bootstrap overheads of some ConstantBootstraps and in particular the ProxyGenerator condys generated for e.g. annotation proxies since [JDK-8332457](https://bugs.openjdk.org/browse/JDK-8332457) >> >> I've adjusted the micro-benchmark added by JDK-8332457 to not only generate a proxy but also call into one of the proxied methodt (`Object::hashCode`). >> >> Running org.openjdk.bench.java.lang.reflect.ProxyGenBench as a one-off startup benchmark sees significant improvement (-9% instructions, -6% cycles): >> >> Name Cnt Base Error Test Error Unit Change >> Perfstartup-JMH 20 154,000 ? 8,165 148,000 ? 23,164 ms/op 1,04x (p = 0,352 ) >> :.cycles 925335973,200 ? 47147600,262 842221278,800 ? 46836254,964 cycles 0,91x (p = 0,000*) >> :.instructions 2101588857,600 ? 81105850,361 1966307798,400 ? 22011043,908 instructions 0,94x (p = 0,000*) >> :.taskclock 291,500 ? 16,494 262,000 ? 15,328 ms 0,90x (p = 0,000*) >> * = significant >> >> Number of classes loaded drops from 1096 to 1092 >> >> Running the micro regularly shows no significant difference: >> >> Name Cnt Base Error Test Error Unit Change >> ProxyGenBench.generateAndProxy100 10 26,827 ? 8,954 26,855 ? 7,531 ms/op 1,00x (p = 0,991 ) >> * = significant > > Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: > > Adress review comments, add ConstantBootstraps#invoke to list of recognized type signatures I think Jorn is recommending to use invokeBasic with erased types as how LambdaForm does it. We can try that approach, but we need new tests to verify that bootstrap method type mismatches throw the same exceptions, so that should be another RFE. ------------- Marked as reviewed by liach (Author). PR Review: https://git.openjdk.org/jdk/pull/19598#pullrequestreview-2105846859 From liach at openjdk.org Sat Jun 8 13:26:11 2024 From: liach at openjdk.org (Chen Liang) Date: Sat, 8 Jun 2024 13:26:11 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v2] In-Reply-To: <2ZsyLWBqAF4daDjtkpfOaVNk6UsRuexVlZM5bKPxezc=.b4b3ec9b-6402-40ad-b19c-7cb3a461dac0@github.com> References: <2ZsyLWBqAF4daDjtkpfOaVNk6UsRuexVlZM5bKPxezc=.b4b3ec9b-6402-40ad-b19c-7cb3a461dac0@github.com> Message-ID: On Sat, 8 Jun 2024 12:25:54 GMT, Sunmisc Unsafe wrote: >> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: >> >> add comments > > As far as I know, ByteArrayLittleEndian uses the VarHandle mechanism, which more efficiently writes different primitives into the array, unlike the basic @sunmisc BALE uses byte array view VH which still uses Unsafe: https://github.com/openjdk/jdk/blob/8d2f9e57c3797c01c84df007f4d2bfdcd645d0c0/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template#L141 Please take a look at #16245; you will see that C2 now JIT compiles these compatible "different primitives" like Unsafe would do, yet there's a bit of requirement on code shape. Thus I recommended the comment for wenshao, so future changes won't accidentally destroy the code shape and the optimization. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19610#issuecomment-2156036174 From duke at openjdk.org Sat Jun 8 13:42:15 2024 From: duke at openjdk.org (Shaojin Wen) Date: Sat, 8 Jun 2024 13:42:15 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v2] In-Reply-To: References: Message-ID: On Sat, 8 Jun 2024 06:40:39 GMT, Shaojin Wen wrote: >> After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. > > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: > > add comments The C2 optimization brought by PR #16245 makes many of the previous performance improvement techniques based on VarHandle/ByteArray/Unsafe no longer meaningful, and many optimizations based on this need to be changed back. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19610#issuecomment-2156040853 From liach at openjdk.org Sat Jun 8 13:52:13 2024 From: liach at openjdk.org (Chen Liang) Date: Sat, 8 Jun 2024 13:52:13 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v2] In-Reply-To: References: Message-ID: <1B01zmFFNBVQKAUnXm63jdTUjD9PcuDLE6aUKijDmxU=.2cfb18fa-5933-4ba8-80c4-40ef0b3ddbaa@github.com> On Sat, 8 Jun 2024 06:40:39 GMT, Shaojin Wen wrote: >> After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. > > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: > > add comments And in addition, VarHandle is not initialized unless it's necessary; thus, programs that use UUIDs but not VarHandle no longer need to initialize VarHandle. See #15386 where JDK startup has a performance degradation because it had to initialize VarHandle after using BALE. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19610#issuecomment-2156044329 From liach at openjdk.org Sat Jun 8 14:27:12 2024 From: liach at openjdk.org (Chen Liang) Date: Sat, 8 Jun 2024 14:27:12 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v2] In-Reply-To: References: Message-ID: On Sat, 8 Jun 2024 06:40:39 GMT, Shaojin Wen wrote: >> After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. > > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: > > add comments Marked as reviewed by liach (Author). ------------- PR Review: https://git.openjdk.org/jdk/pull/19610#pullrequestreview-2105860441 From duke at openjdk.org Sat Jun 8 14:51:11 2024 From: duke at openjdk.org (Glavo) Date: Sat, 8 Jun 2024 14:51:11 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v2] In-Reply-To: References: Message-ID: On Sat, 8 Jun 2024 06:40:39 GMT, Shaojin Wen wrote: >> After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. > > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: > > add comments I think we don't need to change them back everywhere, but only need to rewrite `ByteArrayLittleEndian` and `ByteArray` so that they no longer use `VarHandle`. Maybe I should rewrite https://github.com/openjdk/jdk/pull/14636 without using `Unsafe`, so more people might agree with it. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19610#issuecomment-2156063742 From duke at openjdk.org Sat Jun 8 15:54:15 2024 From: duke at openjdk.org (Brett Okken) Date: Sat, 8 Jun 2024 15:54:15 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v2] In-Reply-To: References: Message-ID: On Sat, 8 Jun 2024 06:40:39 GMT, Shaojin Wen wrote: >> After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. > > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: > > add comments src/java.base/share/classes/jdk/internal/util/HexDigits.java line 117: > 115: > 116: /** > 117: * Insert the int into the buffer as 4 hexadecimal digits 4 hex digits is 2 bytes, right? should this take a short instead? At a minimum, seems documentation should be clear as to which 2 bytes are used. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1632064197 From duke at openjdk.org Sat Jun 8 16:23:16 2024 From: duke at openjdk.org (Brett Okken) Date: Sat, 8 Jun 2024 16:23:16 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v2] In-Reply-To: References: Message-ID: On Sat, 8 Jun 2024 06:40:39 GMT, Shaojin Wen wrote: >> After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. > > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: > > add comments src/java.base/share/classes/jdk/internal/util/HexDigits.java line 122: > 120: * @param value to convert > 121: */ > 122: public static void putHex(byte[] buffer, int off, int i) { Should there be 2 methods - for 2 and 4 bytes respectively? Does c2 optimize 8 byte writes as well? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1632068305 From duke at openjdk.org Sat Jun 8 17:26:20 2024 From: duke at openjdk.org (Vladimir Yaroslavskiy) Date: Sat, 8 Jun 2024 17:26:20 GMT Subject: RFR: 8266431: Dual-Pivot Quicksort improvements (Radix sort) [v11] In-Reply-To: References: <918oCEfFu2JweXfV-afD1l_AGDDuc7dJwAxip-Ze6ZI=.8d5e9692-23db-47e4-9586-99e53b9cfbb6@github.com> Message-ID: On Sun, 22 Oct 2023 17:26:52 GMT, Laurent Bourg?s wrote: >> * improved mixed insertion sort (makes whole sorting faster) >> * introduced Radix which sort shows several times boost of performance and has linear complexity instead of n*ln(n) >> * improved merging sort for almost sorted data >> * optimized parallel sorting >> * improved step for pivot candidates and pivot partitioning >> * extended existing tests >> * added benchmarking JMH tests >> * suggested better buffer allocation: if no memory, it is switched to in-place sorting with no OutOfMemoryError, threshold is 1/16th heap >> >> I am going on previous PR by Vladimir Yaroslavskyi: https://github.com/openjdk/jdk/pull/3938 > > Laurent Bourg?s has updated the pull request incrementally with one additional commit since the last revision: > > add @SuppressWarnings (serial) Version for other data types is being prepared ------------- PR Comment: https://git.openjdk.org/jdk/pull/13568#issuecomment-2156111460 From liach at openjdk.org Sat Jun 8 18:04:13 2024 From: liach at openjdk.org (Chen Liang) Date: Sat, 8 Jun 2024 18:04:13 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v2] In-Reply-To: References: Message-ID: On Sat, 8 Jun 2024 15:51:13 GMT, Brett Okken wrote: >> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: >> >> add comments > > src/java.base/share/classes/jdk/internal/util/HexDigits.java line 117: > >> 115: >> 116: /** >> 117: * Insert the int into the buffer as 4 hexadecimal digits > > 4 hex digits is 2 bytes, right? > should this take a short instead? > At a minimum, seems documentation should be clear as to which 2 bytes are used. Yes, 4 hex digits requires 2 bytes of input integer; we always take the least significant bytes. I think taking an int is better than taking a short, as subint types are int in bytecode, and short's signedness may be bug-prone. > src/java.base/share/classes/jdk/internal/util/HexDigits.java line 122: > >> 120: * @param value to convert >> 121: */ >> 122: public static void putHex(byte[] buffer, int off, int i) { > > Should there be 2 methods - for 2 and 4 bytes respectively? > Does c2 optimize 8 byte writes as well? The 4-byte unsigned int input for 8-byte write sounds plausible, I personally am fine either with or without it. > Does c2 optimize 8 byte writes as well? >From the first few lines of #16245: > Merging multiple consecutive small stores (e.g. 8 byte stores) into larger stores (e.g. one long store) can lead to speedup. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1632081700 PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1632082369 From duke at openjdk.org Sat Jun 8 20:40:13 2024 From: duke at openjdk.org (Bernd) Date: Sat, 8 Jun 2024 20:40:13 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v2] In-Reply-To: References: Message-ID: On Sat, 8 Jun 2024 06:40:39 GMT, Shaojin Wen wrote: >> After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. > > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: > > add comments Changes requested by ecki at github.com (no known OpenJDK username). src/java.base/share/classes/jdk/internal/util/HexDigits.java line 120: > 118: * @param buffer byte buffer to copy into > 119: * @param off insert point > 120: * @param value to convert The parameter is called i. Maybe also add "Only least significant 16 bits are used." Even when it's only a internal api. ------------- PR Review: https://git.openjdk.org/jdk/pull/19610#pullrequestreview-2105936973 PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1632105594 From duke at openjdk.org Sat Jun 8 23:30:38 2024 From: duke at openjdk.org (Shaojin Wen) Date: Sat, 8 Jun 2024 23:30:38 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v3] In-Reply-To: References: Message-ID: > After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: change method name, putHex -> putHex4, and fix comments ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19610/files - new: https://git.openjdk.org/jdk/pull/19610/files/ace7a9f6..d6b4ed25 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19610&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19610&range=01-02 Stats: 12 lines in 2 files changed: 1 ins; 0 del; 11 mod Patch: https://git.openjdk.org/jdk/pull/19610.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19610/head:pull/19610 PR: https://git.openjdk.org/jdk/pull/19610 From duke at openjdk.org Sat Jun 8 23:52:12 2024 From: duke at openjdk.org (Shaojin Wen) Date: Sat, 8 Jun 2024 23:52:12 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v2] In-Reply-To: References: Message-ID: On Sat, 8 Jun 2024 18:00:43 GMT, Chen Liang wrote: >> src/java.base/share/classes/jdk/internal/util/HexDigits.java line 122: >> >>> 120: * @param value to convert >>> 121: */ >>> 122: public static void putHex(byte[] buffer, int off, int i) { >> >> Should there be 2 methods - for 2 and 4 bytes respectively? >> Does c2 optimize 8 byte writes as well? > > The 4-byte unsigned int input for 8-byte write sounds plausible, I personally am fine either with or without it. > >> Does c2 optimize 8 byte writes as well? > > From the first few lines of #16245: > >> Merging multiple consecutive small stores (e.g. 8 byte stores) into larger stores (e.g. one long store) can lead to speedup. 8-byte writing requires converting int to long. The performance is similar to the current version, but an additional method putHex8 needs to be added. The current version has less code. The following is the code for writing 8 bytes: class UUID { @Override public String toString() { byte[] buf = new byte[36]; HexDigits.putHex8(buf, 0, (int) (mostSigBits >> 32)); HexDigits.putHex10(buf, 8, (int) mostSigBits); HexDigits.putHex10(buf, 18, (int) (leastSigBits >> 32)); HexDigits.putHex8(buf, 28, (int) leastSigBits); try { return jla.newStringNoRepl(buf, StandardCharsets.ISO_8859_1); } catch (CharacterCodingException cce) { throw new AssertionError(cce); } } } class HexDigits { public static void putHex8(byte[] bytes, int off, int i) { long v = (((long) DIGITS[(i >> 16) & 0xff]) << 48) | (((long) DIGITS[(i >> 24) & 0xff]) << 32) | ( DIGITS[ i & 0xff] << 16) | ( DIGITS[(i >> 8 ) & 0xff]); bytes[off] = (byte) v; bytes[off + 1] = (byte) (v >> 8); bytes[off + 2] = (byte) (v >> 16); bytes[off + 3] = (byte) (v >> 24); bytes[off + 4] = (byte) (v >> 32); bytes[off + 5] = (byte) (v >> 40); bytes[off + 6] = (byte) (v >> 48); bytes[off + 7] = (byte) (v >> 56); } public static void putHex10(byte[] bytes, int off, int i) { int v0 = (DIGITS[(i >> 16) & 0xff] << 16) | DIGITS[(i >> 24) & 0xff]; int v1 = (DIGITS[i & 0xff] << 16) | DIGITS[(i >> 8 ) & 0xff]; bytes[off] = '-'; bytes[off + 1] = (byte) v0; bytes[off + 2] = (byte) (v0 >> 8); bytes[off + 3] = (byte) (v0 >> 16); bytes[off + 4] = (byte) (v0 >> 24); bytes[off + 5] = '-'; bytes[off + 6] = (byte) v1; bytes[off + 7] = (byte) (v1 >> 8); bytes[off + 8] = (byte) (v1 >> 16); bytes[off + 9] = (byte) (v1 >> 24); } } ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1632133853 From duke at openjdk.org Sun Jun 9 01:19:13 2024 From: duke at openjdk.org (Shaojin Wen) Date: Sun, 9 Jun 2024 01:19:13 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v3] In-Reply-To: References: Message-ID: On Sat, 8 Jun 2024 23:30:38 GMT, Shaojin Wen wrote: >> After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. > > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: > > change method name, putHex -> putHex4, and fix comments > I think we don't need to change them back everywhere, but only need to rewrite `ByteArrayLittleEndian` and `ByteArray` so that they no longer use `VarHandle`. > > Maybe I should rewrite #14636 without using `Unsafe`, so more people might agree with it. You are right, ByteArray and ByteArrayLittleEndian have good performance after removing Unsafe. This is similar to the previous version of java.io.Bits class ByteArrayLittleEndian { public static void setInt(byte[] array, int offset, int value) { array[offset ] = (byte) value; array[offset + 1] = (byte) (value >> 8); array[offset + 2] = (byte) (value >> 16); array[offset + 3] = (byte) (value >> 24); } } class HexDigits { public static void putHex4(byte[] array, int offset, int value) { // Prepare an int value so C2 generates a 4-byte write instead of two 2-byte writes ByteArrayLittleEndian.setInt( array, offset, (DIGITS[value & 0xff] << 16) | DIGITS[(value >> 8) & 0xff]); } } ------------- PR Comment: https://git.openjdk.org/jdk/pull/19610#issuecomment-2156255748 From duke at openjdk.org Sun Jun 9 04:30:23 2024 From: duke at openjdk.org (Glavo) Date: Sun, 9 Jun 2024 04:30:23 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v3] In-Reply-To: References: Message-ID: <1tSdi5opwr0s0mk55mnpmWXeUmtuBU8WVMKeDIn1pPo=.4cfb4d4a-168e-4865-a673-86389965e014@github.com> On Sun, 9 Jun 2024 01:16:49 GMT, Shaojin Wen wrote: > You are right, ByteArray and ByteArrayLittleEndian have good performance after removing Unsafe. This is similar to the previous version of java.io.Bits Do you have evidence that `VarHandle` affects startup time? If there is good evidence to support this, I would go ahead and rewrite https://github.com/openjdk/jdk/pull/14636. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19610#issuecomment-2156311883 From duke at openjdk.org Sun Jun 9 05:47:17 2024 From: duke at openjdk.org (Shaojin Wen) Date: Sun, 9 Jun 2024 05:47:17 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v3] In-Reply-To: References: Message-ID: On Sat, 8 Jun 2024 23:30:38 GMT, Shaojin Wen wrote: >> After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. > > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: > > change method name, putHex -> putHex4, and fix comments > > You are right, ByteArray and ByteArrayLittleEndian have good performance after removing Unsafe. This is similar to the previous version of java.io.Bits > > Do you have evidence that `VarHandle` affects startup time? If there is good evidence to support this, I would go ahead and rewrite #14636. @cl4es has fixed startup regression issues, such as this https://github.com/openjdk/jdk/pull/15836 ------------- PR Comment: https://git.openjdk.org/jdk/pull/19610#issuecomment-2156332130 From liach at openjdk.org Sun Jun 9 07:03:18 2024 From: liach at openjdk.org (Chen Liang) Date: Sun, 9 Jun 2024 07:03:18 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v3] In-Reply-To: References: Message-ID: On Sat, 8 Jun 2024 23:30:38 GMT, Shaojin Wen wrote: >> After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. > > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: > > change method name, putHex -> putHex4, and fix comments src/java.base/share/classes/java/util/UUID.java line 1: > 1: /* We can update copyright year to 2024 src/java.base/share/classes/jdk/internal/util/HexDigits.java line 1: > 1: /* We can update copyright header to `Copyright (c) 2023, 2024, Oracle ...` src/java.base/share/classes/jdk/internal/util/HexDigits.java line 118: > 116: /** > 117: * Insert the unsigned 2-byte integer into the buffer as 4 hexadecimal digit ASCII bytes, > 118: * {@code i} only least significant 16 bits are used. Suggestion: * only least significant 16 bits of {@code i} are used. src/java.base/share/classes/jdk/internal/util/HexDigits.java line 123: > 121: * @param i to convert > 122: */ > 123: public static void putHex4(byte[] buffer, int off, int i) { I recommend the name `put4`. `Hex` is redundant within the context of `HexDigits`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1632187884 PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1632187984 PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1632187743 PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1632187666 From duke at openjdk.org Sun Jun 9 07:15:43 2024 From: duke at openjdk.org (Shaojin Wen) Date: Sun, 9 Jun 2024 07:15:43 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v4] In-Reply-To: References: Message-ID: > After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: Update src/java.base/share/classes/jdk/internal/util/HexDigits.java Co-authored-by: Chen Liang ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19610/files - new: https://git.openjdk.org/jdk/pull/19610/files/d6b4ed25..7628536f Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19610&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19610&range=02-03 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/19610.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19610/head:pull/19610 PR: https://git.openjdk.org/jdk/pull/19610 From duke at openjdk.org Sun Jun 9 07:22:39 2024 From: duke at openjdk.org (Shaojin Wen) Date: Sun, 9 Jun 2024 07:22:39 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v5] In-Reply-To: References: Message-ID: <-LkwuSJsiVDstrSYOytzcy2LNwWPl8rpO8AUb73BjLc=.89ec9667-03fe-4785-838f-2e29f790d44c@github.com> > After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. Shaojin Wen has updated the pull request incrementally with two additional commits since the last revision: - rename putHex4 to put4 - update copy right year ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19610/files - new: https://git.openjdk.org/jdk/pull/19610/files/7628536f..5696288f Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19610&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19610&range=03-04 Stats: 11 lines in 2 files changed: 0 ins; 0 del; 11 mod Patch: https://git.openjdk.org/jdk/pull/19610.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19610/head:pull/19610 PR: https://git.openjdk.org/jdk/pull/19610 From redestad at openjdk.org Sun Jun 9 20:00:13 2024 From: redestad at openjdk.org (Claes Redestad) Date: Sun, 9 Jun 2024 20:00:13 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v5] In-Reply-To: <-LkwuSJsiVDstrSYOytzcy2LNwWPl8rpO8AUb73BjLc=.89ec9667-03fe-4785-838f-2e29f790d44c@github.com> References: <-LkwuSJsiVDstrSYOytzcy2LNwWPl8rpO8AUb73BjLc=.89ec9667-03fe-4785-838f-2e29f790d44c@github.com> Message-ID: On Sun, 9 Jun 2024 07:22:39 GMT, Shaojin Wen wrote: >> After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. > > Shaojin Wen has updated the pull request incrementally with two additional commits since the last revision: > > - rename putHex4 to put4 > - update copy right year Glad to see #16245 in action, enabling simpler code with equal or better performance. src/java.base/share/classes/jdk/internal/util/HexDigits.java line 123: > 121: * @param i to convert > 122: */ > 123: public static void put4(byte[] buffer, int off, int i) { Perhaps `index` and `value` are better names than `off` and `i`, respectively. ------------- Marked as reviewed by redestad (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19610#pullrequestreview-2106355754 PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1632380045 From duke at openjdk.org Sun Jun 9 22:45:26 2024 From: duke at openjdk.org (Shaojin Wen) Date: Sun, 9 Jun 2024 22:45:26 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v6] In-Reply-To: References: Message-ID: > After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: better parameter names ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19610/files - new: https://git.openjdk.org/jdk/pull/19610/files/5696288f..035a07ab Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19610&range=05 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19610&range=04-05 Stats: 8 lines in 1 file changed: 0 ins; 0 del; 8 mod Patch: https://git.openjdk.org/jdk/pull/19610.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19610/head:pull/19610 PR: https://git.openjdk.org/jdk/pull/19610 From liach at openjdk.org Sun Jun 9 22:51:16 2024 From: liach at openjdk.org (Chen Liang) Date: Sun, 9 Jun 2024 22:51:16 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v6] In-Reply-To: References: Message-ID: On Sun, 9 Jun 2024 22:45:26 GMT, Shaojin Wen wrote: >> After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. > > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: > > better parameter names Marked as reviewed by liach (Author). ------------- PR Review: https://git.openjdk.org/jdk/pull/19610#pullrequestreview-2106382827 From liach at openjdk.org Mon Jun 10 01:37:43 2024 From: liach at openjdk.org (Chen Liang) Date: Mon, 10 Jun 2024 01:37:43 GMT Subject: RFR: 8333854: IllegalAccessError with proxies after JDK-8332457 Message-ID: Please review this patch that fixes a critical issue that breaks some Proxy usages. CONSTANT_Class and CONSTANT_MethodType must fail resolution for inaccessible package-private types per JVMS 5.4.3.1 and 5.4.3.5, yet such types can appear in method descriptors in the same class. The proposed way to bypass is to store the MethodType as its descriptor string in the bootstrap method arguments, and use MethodType.fromMethodDescriptorString to restore the arguments, which does not have this restriction and does not eagerly load the parameter classes. This case isn't covered by existing tests, so a new test has been added. ------------- Commit messages: - Minor cleanup - 8333854: IllegalAccessError with proxies after JDK-8332457 Changes: https://git.openjdk.org/jdk/pull/19615/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19615&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333854 Stats: 79 lines in 2 files changed: 70 ins; 2 del; 7 mod Patch: https://git.openjdk.org/jdk/pull/19615.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19615/head:pull/19615 PR: https://git.openjdk.org/jdk/pull/19615 From duke at openjdk.org Mon Jun 10 02:16:18 2024 From: duke at openjdk.org (Glavo) Date: Mon, 10 Jun 2024 02:16:18 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v6] In-Reply-To: References: Message-ID: On Sun, 9 Jun 2024 22:45:26 GMT, Shaojin Wen wrote: >> After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. > > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: > > better parameter names I opened https://github.com/openjdk/jdk/pull/19616, let's continue the unfinished discussion in https://github.com/openjdk/jdk/pull/14636 there. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19610#issuecomment-2157056267 From duke at openjdk.org Mon Jun 10 02:17:25 2024 From: duke at openjdk.org (Glavo) Date: Mon, 10 Jun 2024 02:17:25 GMT Subject: RFR: 8310843: Reimplement ByteArray and ByteArrayLittleEndian with Unsafe Message-ID: Things have changed since https://github.com/openjdk/jdk/pull/14636 was closed, so let me reopen it. https://github.com/openjdk/jdk/pull/15386 confirmed that `VarHandle` in BALE caused a startup regression. In order to not have any more revert patches, it makes sense to optimize BALE. The optimization of https://github.com/openjdk/jdk/pull/16245 allows the traditional expression to have good performance, but BA and BALE save us from having to copy these lengthy expressions everywhere. So it makes sense to keep them. Now here's the question, should I rewrite this PR without `Unsafe`? I'll do some research (e.g. does `Unsafe` have better performance during warmup?), but I'd also like to take some advice. ------------- Commit messages: - 8310843: Reimplement ByteArray and ByteArrayLittleEndian with Unsafe Changes: https://git.openjdk.org/jdk/pull/19616/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19616&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8310843 Stats: 683 lines in 3 files changed: 444 ins; 95 del; 144 mod Patch: https://git.openjdk.org/jdk/pull/19616.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19616/head:pull/19616 PR: https://git.openjdk.org/jdk/pull/19616 From dholmes at openjdk.org Mon Jun 10 02:38:25 2024 From: dholmes at openjdk.org (David Holmes) Date: Mon, 10 Jun 2024 02:38:25 GMT Subject: RFR: 8330205: Initial troff manpage generation for JDK 24 Message-ID: Sets the version to 24/24-ea and the copyright year to 2025. Content changes related to the start of release (e.g. for removed options in java.1) are handled separately. This initial generation also picks up the unpublished changes from: - JDK-8330807: Update Manpage for obsoletion of ScavengeBeforeFullGC - JDK-8284500: Typo in Supported Named Extensions - BasicContraints - JDK-8324342: Doclet should default @since for a nested class to that of its enclosing class Thanks ------------- Commit messages: - 8330205: Initial troff manpage generation for JDK 24 Changes: https://git.openjdk.org/jdk/pull/19617/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19617&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8330205 Stats: 66 lines in 28 files changed: 12 ins; 13 del; 41 mod Patch: https://git.openjdk.org/jdk/pull/19617.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19617/head:pull/19617 PR: https://git.openjdk.org/jdk/pull/19617 From liach at openjdk.org Mon Jun 10 03:25:17 2024 From: liach at openjdk.org (Chen Liang) Date: Mon, 10 Jun 2024 03:25:17 GMT Subject: RFR: 8310843: Reimplement ByteArray and ByteArrayLittleEndian with Unsafe In-Reply-To: References: Message-ID: <71JH0aiLOdX0-ChyOphMiFlmfH9gOMuw9_-8g6xuX4Y=.de414522-b6f9-4792-aa7c-60af27871efb@github.com> On Mon, 10 Jun 2024 02:12:11 GMT, Glavo wrote: > Things have changed since https://github.com/openjdk/jdk/pull/14636 was closed, so let me reopen it. > > https://github.com/openjdk/jdk/pull/15386 confirmed that `VarHandle` in BALE caused a startup regression. In order to not have any more revert patches, it makes sense to optimize BALE. > > The optimization of https://github.com/openjdk/jdk/pull/16245 allows the traditional expression to have good performance, but BA and BALE save us from having to copy these lengthy expressions everywhere. So it makes sense to keep them. > > Now here's the question, should I rewrite this PR without `Unsafe`? I'll do some research (e.g. does `Unsafe` have better performance during warmup?), but I'd also like to take some advice. No matter if we use unsafe or not, keeping multi-byte write and read operations all to one class so we can update them altogether sounds like a good idea. The only risk is that some operations will happen in early startup, such as ClassFile processing, which prohibits some implementations like VarHandle. Also feel free to choose another title for this patch, I will update the JBS issue for you. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19616#issuecomment-2157121539 From duke at openjdk.org Mon Jun 10 03:51:40 2024 From: duke at openjdk.org (Glavo) Date: Mon, 10 Jun 2024 03:51:40 GMT Subject: RFR: 8310843: Reimplement ByteArray and ByteArrayLittleEndian with Unsafe [v2] In-Reply-To: References: Message-ID: > Things have changed since https://github.com/openjdk/jdk/pull/14636 was closed, so let me reopen it. > > https://github.com/openjdk/jdk/pull/15386 confirmed that `VarHandle` in BALE caused a startup regression. In order to not have any more revert patches, it makes sense to optimize BALE. > > The optimization of https://github.com/openjdk/jdk/pull/16245 allows the traditional expression to have good performance, but BA and BALE save us from having to copy these lengthy expressions everywhere. So it makes sense to keep them. > > Now here's the question, should I rewrite this PR without `Unsafe`? I'll do some research (e.g. does `Unsafe` have better performance during warmup?), but I'd also like to take some advice. Glavo has updated the pull request incrementally with one additional commit since the last revision: update copyright ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19616/files - new: https://git.openjdk.org/jdk/pull/19616/files/b3920c86..332bb270 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19616&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19616&range=00-01 Stats: 3 lines in 3 files changed: 0 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/19616.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19616/head:pull/19616 PR: https://git.openjdk.org/jdk/pull/19616 From liach at openjdk.org Mon Jun 10 04:08:41 2024 From: liach at openjdk.org (Chen Liang) Date: Mon, 10 Jun 2024 04:08:41 GMT Subject: RFR: 8333854: IllegalAccessError with proxies after JDK-8332457 [v2] In-Reply-To: References: Message-ID: > Please review this patch that fixes a critical issue that breaks some Proxy usages. > > CONSTANT_Class and CONSTANT_MethodType must fail resolution for inaccessible package-private types per JVMS 5.4.3.1 and 5.4.3.5, yet such types can appear in method descriptors in the same class. The proposed way to bypass is to store the MethodType as its descriptor string in the bootstrap method arguments, and use MethodType.fromMethodDescriptorString to restore the arguments, which does not have this restriction and does not eagerly load the parameter classes. This case isn't covered by existing tests, so a new test has been added. Chen Liang has updated the pull request incrementally with one additional commit since the last revision: Obtain classloader in security manager friendly code path ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19615/files - new: https://git.openjdk.org/jdk/pull/19615/files/8e8dcdd0..8448db2a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19615&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19615&range=00-01 Stats: 38 lines in 1 file changed: 34 ins; 1 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/19615.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19615/head:pull/19615 PR: https://git.openjdk.org/jdk/pull/19615 From pminborg at openjdk.org Mon Jun 10 07:03:11 2024 From: pminborg at openjdk.org (Per Minborg) Date: Mon, 10 Jun 2024 07:03:11 GMT Subject: RFR: 8310843: Reimplement ByteArray and ByteArrayLittleEndian with Unsafe [v2] In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 03:51:40 GMT, Glavo wrote: >> Things have changed since https://github.com/openjdk/jdk/pull/14636 was closed, so let me reopen it. >> >> https://github.com/openjdk/jdk/pull/15386 confirmed that `VarHandle` in BALE caused a startup regression. In order to not have any more revert patches, it makes sense to optimize BALE. >> >> The optimization of https://github.com/openjdk/jdk/pull/16245 allows the traditional expression to have good performance, but BA and BALE save us from having to copy these lengthy expressions everywhere. So it makes sense to keep them. >> >> Now here's the question, should I rewrite this PR without `Unsafe`? I'll do some research (e.g. does `Unsafe` have better performance during warmup?), but I'd also like to take some advice. > > Glavo has updated the pull request incrementally with one additional commit since the last revision: > > update copyright Would it be possible to add a benchmark for some of the methods here so we can see if there is a difference? Also, it would be interesting to see if startup performance is impacted. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19616#issuecomment-2157489839 From alanb at openjdk.org Mon Jun 10 07:18:11 2024 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 10 Jun 2024 07:18:11 GMT Subject: RFR: 8330205: Initial troff manpage generation for JDK 24 In-Reply-To: References: Message-ID: <3hAM5el3W8wXMgyjuCGXpmRjCxld2dvHMiUbvarBPhU=.62cd1645-6bf1-4da4-b70e-70c12e6377c8@github.com> On Mon, 10 Jun 2024 02:31:00 GMT, David Holmes wrote: > Sets the version to 24/24-ea and the copyright year to 2025. > > Content changes related to the start of release (e.g. for removed options in java.1) are handled separately. > > This initial generation also picks up the unpublished changes from: > > - JDK-8330807: Update Manpage for obsoletion of ScavengeBeforeFullGC > - JDK-8284500: Typo in Supported Named Extensions - BasicContraints > - JDK-8324342: Doclet should default @since for a nested class to that of its enclosing class > > Thanks Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/19617#pullrequestreview-2106832118 From duke at openjdk.org Mon Jun 10 07:32:26 2024 From: duke at openjdk.org (Shaojin Wen) Date: Mon, 10 Jun 2024 07:32:26 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v7] In-Reply-To: References: Message-ID: > After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: Update src/java.base/share/classes/jdk/internal/util/HexDigits.java Co-authored-by: Claes Redestad ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19610/files - new: https://git.openjdk.org/jdk/pull/19610/files/035a07ab..780abdf1 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19610&range=06 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19610&range=05-06 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/19610.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19610/head:pull/19610 PR: https://git.openjdk.org/jdk/pull/19610 From redestad at openjdk.org Mon Jun 10 07:32:27 2024 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 10 Jun 2024 07:32:27 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v6] In-Reply-To: References: Message-ID: On Sun, 9 Jun 2024 22:45:26 GMT, Shaojin Wen wrote: >> After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. > > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: > > better parameter names src/java.base/share/classes/jdk/internal/util/HexDigits.java line 118: > 116: /** > 117: * Insert the unsigned 2-byte integer into the buffer as 4 hexadecimal digit ASCII bytes, > 118: * only least significant 16 bits of {@code i} are used. Suggestion: * only least significant 16 bits of {@code value} are used. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1632711983 From redestad at openjdk.org Mon Jun 10 07:51:14 2024 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 10 Jun 2024 07:51:14 GMT Subject: RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v7] In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 07:32:26 GMT, Shaojin Wen wrote: >> After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. > > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: > > Update src/java.base/share/classes/jdk/internal/util/HexDigits.java > > Co-authored-by: Claes Redestad Thanks. I hate to nitpick, but is it OK if I rename the RFE as "Remove the use of ByteArrayLittleEndian from UUID::toString" (the PR need to follow suit). I think the current name might be read as doing something completely different. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19610#issuecomment-2157580938 From redestad at openjdk.org Mon Jun 10 07:58:12 2024 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 10 Jun 2024 07:58:12 GMT Subject: RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator [v2] In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 18:58:36 GMT, Claes Redestad wrote: >> This PR refactors type matching in BootstrapMethodInvoker and adds a few types, seeking to improve bootstrap overheads of some ConstantBootstraps and in particular the ProxyGenerator condys generated for e.g. annotation proxies since [JDK-8332457](https://bugs.openjdk.org/browse/JDK-8332457) >> >> I've adjusted the micro-benchmark added by JDK-8332457 to not only generate a proxy but also call into one of the proxied methodt (`Object::hashCode`). >> >> Running org.openjdk.bench.java.lang.reflect.ProxyGenBench as a one-off startup benchmark sees significant improvement (-9% instructions, -6% cycles): >> >> Name Cnt Base Error Test Error Unit Change >> Perfstartup-JMH 20 154,000 ? 8,165 148,000 ? 23,164 ms/op 1,04x (p = 0,352 ) >> :.cycles 925335973,200 ? 47147600,262 842221278,800 ? 46836254,964 cycles 0,91x (p = 0,000*) >> :.instructions 2101588857,600 ? 81105850,361 1966307798,400 ? 22011043,908 instructions 0,94x (p = 0,000*) >> :.taskclock 291,500 ? 16,494 262,000 ? 15,328 ms 0,90x (p = 0,000*) >> * = significant >> >> Number of classes loaded drops from 1096 to 1092 >> >> Running the micro regularly shows no significant difference: >> >> Name Cnt Base Error Test Error Unit Change >> ProxyGenBench.generateAndProxy100 10 26,827 ? 8,954 26,855 ? 7,531 ms/op 1,00x (p = 0,991 ) >> * = significant > > Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: > > Adress review comments, add ConstantBootstraps#invoke to list of recognized type signatures Sure. If you can show how you'd do that I'd be happy to test it. Maybe there are excess native linkers I'm not seeing from using `invokeExact`, but AFAICT there are no linkers being spun when the type match is made exact via static casts (which is what these exact matches in BMI achieves). So I remain a bit confused about what we would be able to improve. Thanks for reviewing! ------------- PR Comment: https://git.openjdk.org/jdk/pull/19598#issuecomment-2157595699 From dholmes at openjdk.org Mon Jun 10 08:04:12 2024 From: dholmes at openjdk.org (David Holmes) Date: Mon, 10 Jun 2024 08:04:12 GMT Subject: RFR: 8330205: Initial troff manpage generation for JDK 24 In-Reply-To: <3hAM5el3W8wXMgyjuCGXpmRjCxld2dvHMiUbvarBPhU=.62cd1645-6bf1-4da4-b70e-70c12e6377c8@github.com> References: <3hAM5el3W8wXMgyjuCGXpmRjCxld2dvHMiUbvarBPhU=.62cd1645-6bf1-4da4-b70e-70c12e6377c8@github.com> Message-ID: On Mon, 10 Jun 2024 07:15:51 GMT, Alan Bateman wrote: >> Sets the version to 24/24-ea and the copyright year to 2025. >> >> Content changes related to the start of release (e.g. for removed options in java.1) are handled separately. >> >> This initial generation also picks up the unpublished changes from: >> >> - JDK-8330807: Update Manpage for obsoletion of ScavengeBeforeFullGC >> - JDK-8284500: Typo in Supported Named Extensions - BasicContraints >> - JDK-8324342: Doclet should default `@since` for a nested class to that of its enclosing class >> >> Thanks > > Marked as reviewed by alanb (Reviewer). Thanks for the review @AlanBateman ! ------------- PR Comment: https://git.openjdk.org/jdk/pull/19617#issuecomment-2157606095 From redestad at openjdk.org Mon Jun 10 08:14:13 2024 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 10 Jun 2024 08:14:13 GMT Subject: RFR: 8333833: Remove the use of ByteArrayLittleEndian from UUID::toString [v7] In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 07:32:26 GMT, Shaojin Wen wrote: >> After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. > > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: > > Update src/java.base/share/classes/jdk/internal/util/HexDigits.java > > Co-authored-by: Claes Redestad Great, go ahead and /integrate again and I'll sponsor. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19610#issuecomment-2157627942 From duke at openjdk.org Mon Jun 10 08:21:22 2024 From: duke at openjdk.org (Shaojin Wen) Date: Mon, 10 Jun 2024 08:21:22 GMT Subject: Integrated: 8333833: Remove the use of ByteArrayLittleEndian from UUID::toString In-Reply-To: References: Message-ID: On Sat, 8 Jun 2024 00:19:55 GMT, Shaojin Wen wrote: > After PR #16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster. This pull request has now been integrated. Changeset: 8aa35cac Author: Shaojin Wen Committer: Claes Redestad URL: https://git.openjdk.org/jdk/commit/8aa35cacfcc94d261de102b628eb954c71eae98e Stats: 52 lines in 2 files changed: 5 ins; 25 del; 22 mod 8333833: Remove the use of ByteArrayLittleEndian from UUID::toString Reviewed-by: liach, redestad ------------- PR: https://git.openjdk.org/jdk/pull/19610 From dholmes at openjdk.org Mon Jun 10 08:23:13 2024 From: dholmes at openjdk.org (David Holmes) Date: Mon, 10 Jun 2024 08:23:13 GMT Subject: RFR: 8332400: isspace argument should be a valid unsigned char In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 06:07:17 GMT, Thomas Stuefe wrote: > "To use these functions safely with plain chars (or signed chars), the argument should first be converted to unsigned char" @tstuefe wow! Okay. That is a surprise to me. A cast to unsigned char doesn't actually do anything. Every char is "representable" as an unsigned char because it holds a bit pattern between 0x00 and 0xff i.e. the function is well defined if the incoming int is either EOF (int -1) or else in the range 0x00 to 0xff. But I did a bit of searching and it seems it comes down to potential arithmetic operations on the "char" the might behave differently depending on the signed-ness. :( ------------- PR Comment: https://git.openjdk.org/jdk/pull/19567#issuecomment-2157677944 From redestad at openjdk.org Mon Jun 10 08:35:33 2024 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 10 Jun 2024 08:35:33 GMT Subject: RFR: 8333824: Unused ClassValue in VarHandles Message-ID: <6KN_iIs0lFWMqTfprFbMOoDiaIdxjLY47EY94ZV3OJ0=.e8368989-634e-45d6-9e06-d8cb959eadfc@github.com> Trivially removing the a leftover, unused `ClassValue` from `java.lang.invoke.VarHandle` ------------- Commit messages: - 8333824: Unused ClassValue in VarHandles Changes: https://git.openjdk.org/jdk/pull/19620/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19620&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333824 Stats: 10 lines in 1 file changed: 0 ins; 10 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/19620.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19620/head:pull/19620 PR: https://git.openjdk.org/jdk/pull/19620 From stuefe at openjdk.org Mon Jun 10 08:38:13 2024 From: stuefe at openjdk.org (Thomas Stuefe) Date: Mon, 10 Jun 2024 08:38:13 GMT Subject: RFR: 8332400: isspace argument should be a valid unsigned char In-Reply-To: References: Message-ID: <2wSWEMk4oW4U2wYJQZq5AXgxIrCqAtuEt11kVDVTJ2E=.4e61e441-ef51-4e5d-b286-952174312e2e@github.com> On Mon, 10 Jun 2024 08:20:38 GMT, David Holmes wrote: > > "To use these functions safely with plain chars (or signed chars), the argument should first be converted to unsigned char" > > @tstuefe wow! Okay. That is a surprise to me. A cast to unsigned char doesn't actually do anything. Every char is "representable" as an unsigned char because it holds a bit pattern between 0x00 and 0xff i.e. the function is well defined if the incoming int is either EOF (int -1) or else in the range 0x00 to 0xff. But I did a bit of searching and it seems it comes down to potential arithmetic operations on the "char" the might behave differently depending on the signed-ness. :( I was surprised as well. Turns out you can use something for 20+ years and not notice :) ------------- PR Comment: https://git.openjdk.org/jdk/pull/19567#issuecomment-2157711653 From mcimadamore at openjdk.org Mon Jun 10 09:00:14 2024 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Mon, 10 Jun 2024 09:00:14 GMT Subject: RFR: 8333824: Unused ClassValue in VarHandles In-Reply-To: <6KN_iIs0lFWMqTfprFbMOoDiaIdxjLY47EY94ZV3OJ0=.e8368989-634e-45d6-9e06-d8cb959eadfc@github.com> References: <6KN_iIs0lFWMqTfprFbMOoDiaIdxjLY47EY94ZV3OJ0=.e8368989-634e-45d6-9e06-d8cb959eadfc@github.com> Message-ID: On Mon, 10 Jun 2024 08:30:59 GMT, Claes Redestad wrote: > Trivially removing the a leftover, unused `ClassValue` from `java.lang.invoke.VarHandle` Good catch! ------------- Marked as reviewed by mcimadamore (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19620#pullrequestreview-2107142866 From jsjolen at openjdk.org Mon Jun 10 09:05:13 2024 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Mon, 10 Jun 2024 09:05:13 GMT Subject: RFR: 8332400: isspace argument should be a valid unsigned char In-Reply-To: References: Message-ID: <-yrsMojgotrB89wb1ePgtP_iqPDbLCp3VhMhpaDWGh0=.55afc438-1f30-4ac7-9ed2-ffebc35a5083@github.com> On Wed, 5 Jun 2024 20:08:10 GMT, Robert Toyonaga wrote: > ### Summary > This change ensures we don't get undefined behavior when calling[`isspace`](https://pubs.opengroup.org/onlinepubs/007904975/functions/isspace.html). `isspace` accepts an `int` argument that "the application shall ensure is a character representable as an unsigned char or equal to the value of the macro EOF.". > > Previously, there was no checking of the values passed to `isspace`. I've replaced direct calls with a new wrapper `os::is_space` that performs a range check and prevents the possibility of undefined behavior from happening. For instances outside of Hotspot, I've added casts to `unsigned char`. > > **Testing** > - Added a new test in `test/hotspot/gtest/runtime/test_os.cpp` to check `os::is_space` is working correctly. > - tier1 Hi Robert, Here's a third opinion: The wrapper is fine, but it should mimic the name of the function it wraps exactly: `os::isspace`. It's also good that it does the range check as regular code as opposed to an assert, as this function is used to parse external input. It's fine to be excessive when parsing strings as those parts of the code are not really performance critical. All the best, Johan src/hotspot/share/runtime/os.cpp line 96: > 94: DEBUG_ONLY(bool os::_mutex_init_done = false;) > 95: > 96: int os::is_space(int c) { `os::isspace` test/hotspot/gtest/runtime/test_os.cpp line 43: > 41: > 42: # include > 43: Not necessary. ------------- PR Review: https://git.openjdk.org/jdk/pull/19567#pullrequestreview-2107152152 PR Review Comment: https://git.openjdk.org/jdk/pull/19567#discussion_r1632873691 PR Review Comment: https://git.openjdk.org/jdk/pull/19567#discussion_r1632873309 From jvernee at openjdk.org Mon Jun 10 09:40:13 2024 From: jvernee at openjdk.org (Jorn Vernee) Date: Mon, 10 Jun 2024 09:40:13 GMT Subject: RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator [v2] In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 07:56:03 GMT, Claes Redestad wrote: >> Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: >> >> Adress review comments, add ConstantBootstraps#invoke to list of recognized type signatures > > Sure. If you can show how you'd do that I'd be happy to test it. Maybe there are excess native linkers I'm not seeing from using `invokeExact`, but AFAICT there are no linkers being spun when the type match is made exact via static casts (which is what these exact matches in BMI achieves). So I remain a bit confused about what we would be able to improve. > > Thanks for reviewing! @cl4es I'm talking about the linker being spun in `Invokers::invokeHandleForm`. When either `invoke` or `invokeExact` is called, the VM calls `MethodHandleNatives::linkMethod` and we eventually end up there. That code creates a new `LambdaForm` that has the type check (for `invokeExact`) and customization check, and then forwards the arguments to `invokeBasic`. The idea would be to call `invokeBasic` directly instead of `invokeExact` (similar to what we do in `VarHandleGuards`) ------------- PR Comment: https://git.openjdk.org/jdk/pull/19598#issuecomment-2157839857 From jvernee at openjdk.org Mon Jun 10 09:40:14 2024 From: jvernee at openjdk.org (Jorn Vernee) Date: Mon, 10 Jun 2024 09:40:14 GMT Subject: RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator [v2] In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 18:58:36 GMT, Claes Redestad wrote: >> This PR refactors type matching in BootstrapMethodInvoker and adds a few types, seeking to improve bootstrap overheads of some ConstantBootstraps and in particular the ProxyGenerator condys generated for e.g. annotation proxies since [JDK-8332457](https://bugs.openjdk.org/browse/JDK-8332457) >> >> I've adjusted the micro-benchmark added by JDK-8332457 to not only generate a proxy but also call into one of the proxied methodt (`Object::hashCode`). >> >> Running org.openjdk.bench.java.lang.reflect.ProxyGenBench as a one-off startup benchmark sees significant improvement (-9% instructions, -6% cycles): >> >> Name Cnt Base Error Test Error Unit Change >> Perfstartup-JMH 20 154,000 ? 8,165 148,000 ? 23,164 ms/op 1,04x (p = 0,352 ) >> :.cycles 925335973,200 ? 47147600,262 842221278,800 ? 46836254,964 cycles 0,91x (p = 0,000*) >> :.instructions 2101588857,600 ? 81105850,361 1966307798,400 ? 22011043,908 instructions 0,94x (p = 0,000*) >> :.taskclock 291,500 ? 16,494 262,000 ? 15,328 ms 0,90x (p = 0,000*) >> * = significant >> >> Number of classes loaded drops from 1096 to 1092 >> >> Running the micro regularly shows no significant difference: >> >> Name Cnt Base Error Test Error Unit Change >> ProxyGenBench.generateAndProxy100 10 26,827 ? 8,954 26,855 ? 7,531 ms/op 1,00x (p = 0,991 ) >> * = significant > > Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: > > Adress review comments, add ConstantBootstraps#invoke to list of recognized type signatures But any way, if you don't see those linkers being spun in profiles, maybe it's not important, and the extra safety is more worthwhile. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19598#issuecomment-2157852363 From jvernee at openjdk.org Mon Jun 10 09:47:17 2024 From: jvernee at openjdk.org (Jorn Vernee) Date: Mon, 10 Jun 2024 09:47:17 GMT Subject: RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator [v2] In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 18:58:36 GMT, Claes Redestad wrote: >> This PR refactors type matching in BootstrapMethodInvoker and adds a few types, seeking to improve bootstrap overheads of some ConstantBootstraps and in particular the ProxyGenerator condys generated for e.g. annotation proxies since [JDK-8332457](https://bugs.openjdk.org/browse/JDK-8332457) >> >> I've adjusted the micro-benchmark added by JDK-8332457 to not only generate a proxy but also call into one of the proxied methodt (`Object::hashCode`). >> >> Running org.openjdk.bench.java.lang.reflect.ProxyGenBench as a one-off startup benchmark sees significant improvement (-9% instructions, -6% cycles): >> >> Name Cnt Base Error Test Error Unit Change >> Perfstartup-JMH 20 154,000 ? 8,165 148,000 ? 23,164 ms/op 1,04x (p = 0,352 ) >> :.cycles 925335973,200 ? 47147600,262 842221278,800 ? 46836254,964 cycles 0,91x (p = 0,000*) >> :.instructions 2101588857,600 ? 81105850,361 1966307798,400 ? 22011043,908 instructions 0,94x (p = 0,000*) >> :.taskclock 291,500 ? 16,494 262,000 ? 15,328 ms 0,90x (p = 0,000*) >> * = significant >> >> Number of classes loaded drops from 1096 to 1092 >> >> Running the micro regularly shows no significant difference: >> >> Name Cnt Base Error Test Error Unit Change >> ProxyGenBench.generateAndProxy100 10 26,827 ? 8,954 26,855 ? 7,531 ms/op 1,00x (p = 0,991 ) >> * = significant > > Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: > > Adress review comments, add ConstantBootstraps#invoke to list of recognized type signatures Marked as reviewed by jvernee (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/19598#pullrequestreview-2107307077 From redestad at openjdk.org Mon Jun 10 10:08:16 2024 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 10 Jun 2024 10:08:16 GMT Subject: RFR: 8333824: Unused ClassValue in VarHandles In-Reply-To: References: <6KN_iIs0lFWMqTfprFbMOoDiaIdxjLY47EY94ZV3OJ0=.e8368989-634e-45d6-9e06-d8cb959eadfc@github.com> Message-ID: On Mon, 10 Jun 2024 08:57:23 GMT, Maurizio Cimadamore wrote: > Good catch! Thanks! ------------- PR Comment: https://git.openjdk.org/jdk/pull/19620#issuecomment-2157910277 From redestad at openjdk.org Mon Jun 10 10:08:17 2024 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 10 Jun 2024 10:08:17 GMT Subject: Integrated: 8333824: Unused ClassValue in VarHandles In-Reply-To: <6KN_iIs0lFWMqTfprFbMOoDiaIdxjLY47EY94ZV3OJ0=.e8368989-634e-45d6-9e06-d8cb959eadfc@github.com> References: <6KN_iIs0lFWMqTfprFbMOoDiaIdxjLY47EY94ZV3OJ0=.e8368989-634e-45d6-9e06-d8cb959eadfc@github.com> Message-ID: On Mon, 10 Jun 2024 08:30:59 GMT, Claes Redestad wrote: > Trivially removing the a leftover, unused `ClassValue` from `java.lang.invoke.VarHandle` This pull request has now been integrated. Changeset: 7b43a8cd Author: Claes Redestad URL: https://git.openjdk.org/jdk/commit/7b43a8cd7c663facbe490f889838d7ead0eba0f9 Stats: 10 lines in 1 file changed: 0 ins; 10 del; 0 mod 8333824: Unused ClassValue in VarHandles Reviewed-by: mcimadamore ------------- PR: https://git.openjdk.org/jdk/pull/19620 From redestad at openjdk.org Mon Jun 10 10:09:38 2024 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 10 Jun 2024 10:09:38 GMT Subject: RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator [v3] In-Reply-To: References: Message-ID: > This PR refactors type matching in BootstrapMethodInvoker and adds a few types, seeking to improve bootstrap overheads of some ConstantBootstraps and in particular the ProxyGenerator condys generated for e.g. annotation proxies since [JDK-8332457](https://bugs.openjdk.org/browse/JDK-8332457) > > I've adjusted the micro-benchmark added by JDK-8332457 to not only generate a proxy but also call into one of the proxied methodt (`Object::hashCode`). > > Running org.openjdk.bench.java.lang.reflect.ProxyGenBench as a one-off startup benchmark sees significant improvement (-9% instructions, -6% cycles): > > Name Cnt Base Error Test Error Unit Change > Perfstartup-JMH 20 154,000 ? 8,165 148,000 ? 23,164 ms/op 1,04x (p = 0,352 ) > :.cycles 925335973,200 ? 47147600,262 842221278,800 ? 46836254,964 cycles 0,91x (p = 0,000*) > :.instructions 2101588857,600 ? 81105850,361 1966307798,400 ? 22011043,908 instructions 0,94x (p = 0,000*) > :.taskclock 291,500 ? 16,494 262,000 ? 15,328 ms 0,90x (p = 0,000*) > * = significant > > Number of classes loaded drops from 1096 to 1092 > > Running the micro regularly shows no significant difference: > > Name Cnt Base Error Test Error Unit Change > ProxyGenBench.generateAndProxy100 10 26,827 ? 8,954 26,855 ? 7,531 ms/op 1,00x (p = 0,991 ) > * = significant Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: Copy-paste error; CONDY_INVOKE returns Object. Fixes TestDynamicConstant.java ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19598/files - new: https://git.openjdk.org/jdk/pull/19598/files/532966a4..2d64ae1c Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19598&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19598&range=01-02 Stats: 5 lines in 1 file changed: 0 ins; 2 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/19598.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19598/head:pull/19598 PR: https://git.openjdk.org/jdk/pull/19598 From redestad at openjdk.org Mon Jun 10 10:09:38 2024 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 10 Jun 2024 10:09:38 GMT Subject: RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator [v2] In-Reply-To: References: Message-ID: <_GJeL6RYoPjD_uoK-i_o3dUjIXf7kJR-MFn8RogLz0c=.2c5caefe-0c0e-4aab-b5bc-50a3a16cf1af@github.com> On Fri, 7 Jun 2024 18:58:36 GMT, Claes Redestad wrote: >> This PR refactors type matching in BootstrapMethodInvoker and adds a few types, seeking to improve bootstrap overheads of some ConstantBootstraps and in particular the ProxyGenerator condys generated for e.g. annotation proxies since [JDK-8332457](https://bugs.openjdk.org/browse/JDK-8332457) >> >> I've adjusted the micro-benchmark added by JDK-8332457 to not only generate a proxy but also call into one of the proxied methodt (`Object::hashCode`). >> >> Running org.openjdk.bench.java.lang.reflect.ProxyGenBench as a one-off startup benchmark sees significant improvement (-9% instructions, -6% cycles): >> >> Name Cnt Base Error Test Error Unit Change >> Perfstartup-JMH 20 154,000 ? 8,165 148,000 ? 23,164 ms/op 1,04x (p = 0,352 ) >> :.cycles 925335973,200 ? 47147600,262 842221278,800 ? 46836254,964 cycles 0,91x (p = 0,000*) >> :.instructions 2101588857,600 ? 81105850,361 1966307798,400 ? 22011043,908 instructions 0,94x (p = 0,000*) >> :.taskclock 291,500 ? 16,494 262,000 ? 15,328 ms 0,90x (p = 0,000*) >> * = significant >> >> Number of classes loaded drops from 1096 to 1092 >> >> Running the micro regularly shows no significant difference: >> >> Name Cnt Base Error Test Error Unit Change >> ProxyGenBench.generateAndProxy100 10 26,827 ? 8,954 26,855 ? 7,531 ms/op 1,00x (p = 0,991 ) >> * = significant > > Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: > > Adress review comments, add ConstantBootstraps#invoke to list of recognized type signatures Thanks, I'll see if I can get that working and if it has any effect as a follow-up. Testing caught a bug introduced by a copy-paste error in 532966a, re-running a few more tests now. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19598#issuecomment-2157922124 From jpai at openjdk.org Mon Jun 10 11:14:27 2024 From: jpai at openjdk.org (Jaikiran Pai) Date: Mon, 10 Jun 2024 11:14:27 GMT Subject: RFR: 8173970: jar tool should have a way to extract to a directory [v7] In-Reply-To: References: Message-ID: > Can I please get a review for this patch which proposes to implement the enhancement request noted in https://bugs.openjdk.java.net/browse/JDK-8173970? > > The commit in this PR introduces the `-o` and `--output-dir` option to the `jar` command. The option takes a path to a destination directory as a value and extracts the contents of the jar into that directory. This is an optional option and the changes in the commit continue to maintain backward compatibility where the jar is extracted into current directory, if no `-o` or `--output-dir` option has been specified. > > As far as I know, there hasn't been any discussion on what the name of this new option should be. I was initially thinking of using `-d` but that is currently used by the `jar` command for a different purpose. So I decided to use `-o` and `--output-dir`. This is of course open for change depending on any suggestions in this PR. > > The commit in this PR also updates the `jar.properties` file which contains the English version of the jar command's `--help` output. However, no changes have been done to the internationalization files corresponding to this one (for example: `jar_de.properties`), because I don't know what process needs to be followed to have those files updated (if at all they need to be updated). > > The commit also includes a jtreg testcase which verifies the usage of this new option. Jaikiran Pai has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 17 commits: - merge latest from master branch - merge latest from master branch - cleanup testExtractNoDestDirWithPFlag() test - merge latest from master branch - merge latest from master branch - convert the new test to junit - merge latest from master branch - Lance's review - include tests for --extract long form option - cleanup after each test - Adjust test for new error messages - ... and 7 more: https://git.openjdk.org/jdk/compare/7b43a8cd...2bd13ece ------------- Changes: https://git.openjdk.org/jdk/pull/2752/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=2752&range=06 Stats: 569 lines in 4 files changed: 558 ins; 0 del; 11 mod Patch: https://git.openjdk.org/jdk/pull/2752.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/2752/head:pull/2752 PR: https://git.openjdk.org/jdk/pull/2752 From pminborg at openjdk.org Mon Jun 10 11:55:29 2024 From: pminborg at openjdk.org (Per Minborg) Date: Mon, 10 Jun 2024 11:55:29 GMT Subject: RFR: 8330465: Stable Values and Collections (Internal) [v20] In-Reply-To: References: <-KSimQo5kkmCzzMShqGe5QZ9yCSzpWL98gN13v4wP0k=.11dd8d06-18a6-4577-8342-66632cea0b6e@github.com> Message-ID: On Fri, 17 May 2024 09:31:33 GMT, Per Minborg wrote: >> # Stable Values & Collections (Internal) >> >> ## Summary >> This PR proposes to introduce an internal _Stable Values & Collections_ API, which provides immutable value holders where elements are initialized _at most once_. Stable Values & Collections offer the performance and safety benefits of final fields while offering greater flexibility as to the timing of initialization. >> >> ## Goals >> * Provide an easy and intuitive API to describe value holders that can change at most once. >> * Decouple declaration from initialization without significant footprint or performance penalties. >> * Reduce the amount of static initializer and/or field initialization code. >> * Uphold integrity and consistency, even in a multi-threaded environment. >> >> For more details, see the draft JEP: https://openjdk.org/jeps/8312611 >> >> ## Performance >> Performance compared to instance variables using two `AtomicReference` and two protected by double-checked locking under concurrent access by all threads: >> >> >> Benchmark Mode Cnt Score Error Units >> StableBenchmark.atomic thrpt 10 259.478 ? 36.809 ops/us >> StableBenchmark.dcl thrpt 10 225.710 ? 26.638 ops/us >> StableBenchmark.stable thrpt 10 4382.478 ? 1151.472 ops/us <- StableValue significantly faster >> >> >> Performance compared to static variables protected by `AtomicReference`, class-holder idiom holder, and double-checked locking (all threads): >> >> >> Benchmark Mode Cnt Score Error Units >> StableStaticBenchmark.atomic thrpt 10 6487.835 ? 385.639 ops/us >> StableStaticBenchmark.dcl thrpt 10 6605.239 ? 210.610 ops/us >> StableStaticBenchmark.stable thrpt 10 14338.239 ? 1426.874 ops/us >> StableStaticBenchmark.staticCHI thrpt 10 13780.341 ? 1839.651 ops/us >> >> >> Performance for stable lists (thread safe) in both instance and static contexts whereby we access a single value compared to `ArrayList` instances (which are not thread-safe) (all threads): >> >> >> Benchmark Mode Cnt Score Error Units >> StableListElementBenchmark.instanceArrayList thrpt 10 5812.992 ? 1169.730 ops/us >> StableListElementBenchmark.instanceList thrpt 10 4818.643 ? 704.893 ops/us >> StableListElementBenchmark... > > Per Minborg has updated the pull request incrementally with two additional commits since the last revision: > > - Add benchmarks for memoized IntFunction and Function > - Add benchmark for memoized supplier A new PR will be made available shortly. ------------- PR Comment: https://git.openjdk.org/jdk/pull/18794#issuecomment-2158140833 From pminborg at openjdk.org Mon Jun 10 11:55:30 2024 From: pminborg at openjdk.org (Per Minborg) Date: Mon, 10 Jun 2024 11:55:30 GMT Subject: Withdrawn: 8330465: Stable Values and Collections (Internal) In-Reply-To: <-KSimQo5kkmCzzMShqGe5QZ9yCSzpWL98gN13v4wP0k=.11dd8d06-18a6-4577-8342-66632cea0b6e@github.com> References: <-KSimQo5kkmCzzMShqGe5QZ9yCSzpWL98gN13v4wP0k=.11dd8d06-18a6-4577-8342-66632cea0b6e@github.com> Message-ID: On Tue, 16 Apr 2024 11:47:23 GMT, Per Minborg wrote: > # Stable Values & Collections (Internal) > > ## Summary > This PR proposes to introduce an internal _Stable Values & Collections_ API, which provides immutable value holders where elements are initialized _at most once_. Stable Values & Collections offer the performance and safety benefits of final fields while offering greater flexibility as to the timing of initialization. > > ## Goals > * Provide an easy and intuitive API to describe value holders that can change at most once. > * Decouple declaration from initialization without significant footprint or performance penalties. > * Reduce the amount of static initializer and/or field initialization code. > * Uphold integrity and consistency, even in a multi-threaded environment. > > For more details, see the draft JEP: https://openjdk.org/jeps/8312611 > > ## Performance > Performance compared to instance variables using two `AtomicReference` and two protected by double-checked locking under concurrent access by all threads: > > > Benchmark Mode Cnt Score Error Units > StableBenchmark.atomic thrpt 10 259.478 ? 36.809 ops/us > StableBenchmark.dcl thrpt 10 225.710 ? 26.638 ops/us > StableBenchmark.stable thrpt 10 4382.478 ? 1151.472 ops/us <- StableValue significantly faster > > > Performance compared to static variables protected by `AtomicReference`, class-holder idiom holder, and double-checked locking (all threads): > > > Benchmark Mode Cnt Score Error Units > StableStaticBenchmark.atomic thrpt 10 6487.835 ? 385.639 ops/us > StableStaticBenchmark.dcl thrpt 10 6605.239 ? 210.610 ops/us > StableStaticBenchmark.stable thrpt 10 14338.239 ? 1426.874 ops/us > StableStaticBenchmark.staticCHI thrpt 10 13780.341 ? 1839.651 ops/us > > > Performance for stable lists (thread safe) in both instance and static contexts whereby we access a single value compared to `ArrayList` instances (which are not thread-safe) (all threads): > > > Benchmark Mode Cnt Score Error Units > StableListElementBenchmark.instanceArrayList thrpt 10 5812.992 ? 1169.730 ops/us > StableListElementBenchmark.instanceList thrpt 10 4818.643 ? 704.893 ops/us > StableListElementBenchmark.staticArrayList thrpt 10 7614.741 ? 564.777 ops/us > StableListElementBe... This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/jdk/pull/18794 From vklang at openjdk.org Mon Jun 10 12:00:16 2024 From: vklang at openjdk.org (Viktor Klang) Date: Mon, 10 Jun 2024 12:00:16 GMT Subject: RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations [v3] In-Reply-To: References: Message-ID: <07xy6VKJPhEQMoj2jx5F63pWeIYbzU8O_GsnIqOD70I=.3bce6a0b-fdab-4efd-bc99-9ca95e612038@github.com> On Thu, 6 Jun 2024 14:29:46 GMT, Aleksey Shipilev wrote: >> `clone()` performs a shallow copy, so there is currently no `Object[]` allocated and therefore nothing to optimize. I don't think there's any work to do here. >> >> @DougLea @viktorklang-ora can you confirm? > >> clone() performs a shallow copy, so there is currently no Object[] allocated and therefore nothing to optimize. > > Yes, I believe so. ? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19527#discussion_r1633127845 From vklang at openjdk.org Mon Jun 10 12:14:11 2024 From: vklang at openjdk.org (Viktor Klang) Date: Mon, 10 Jun 2024 12:14:11 GMT Subject: RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations [v3] In-Reply-To: References: Message-ID: On Thu, 6 Jun 2024 12:46:36 GMT, jengebr wrote: >> Improve `java/util/concurrent/CopyOnWriteArrayList` by eliminating needless cloning of Object[0] instances. This cloning is intended to prevent callers from changing array contents, but many `CopyOnWriteArrayList`s are allocated to size zero, or are otherwise maintained empty, so cloning is unnecessary. >> >> Results from the included JMH benchmark: >> Before: >> >> Benchmark Mode Cnt Score Error Units >> CopyOnWriteArrayListBenchmark.clear avgt 5 74.487 ? 1.793 ns/op >> CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 27.918 ? 0.759 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.656 ? 0.375 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 15.415 ? 0.489 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.608 ? 0.363 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 15.374 ? 0.260 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 15.688 ? 0.350 ns/op >> CopyOnWriteArrayListBenchmark.readInstance avgt 10 2625.125 ? 71.802 ns/op >> CopyOnWriteArrayListBenchmark.readInstanceEmpty avgt 10 2607.447 ? 46.400 ns/op >> >> >> After: >> >> Benchmark Mode Cnt Score Error Units >> CopyOnWriteArrayListBenchmark.clear avgt 5 75.365 ? 2.092 ns/op >> CopyOnWriteArrayListBenchmark.clearEmpty avgt 5 20.803 ? 0.539 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArray avgt 5 16.808 ? 0.582 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceArrayEmpty avgt 5 12.980 ? 0.418 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollection avgt 5 21.627 ? 0.173 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceCollectionEmpty avgt 5 12.864 ? 0.408 ns/op >> CopyOnWriteArrayListBenchmark.createInstanceDefault avgt 5 12.931 ? 0.255 ns/op >> CopyOnWriteArrayListBenchmark.readInstance avgt 10 2615.500 ? 30.771 ns/op >> CopyOnWriteArrayListBenchmark.readInstanceEmpty avgt 10 2583.892 ? 62.086 ns/op > > jengebr has updated the pull request incrementally with one additional commit since the last revision: > > Adding benchmarks for readObject I think this one looks OK now. @AlanBateman might want to provide his take on this. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19527#issuecomment-2158177971 From redestad at openjdk.org Mon Jun 10 12:19:11 2024 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 10 Jun 2024 12:19:11 GMT Subject: RFR: 8333854: IllegalAccessError with proxies after JDK-8332457 [v2] In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 04:08:41 GMT, Chen Liang wrote: >> Please review this patch that fixes a critical issue that breaks some Proxy usages. >> >> CONSTANT_Class and CONSTANT_MethodType must fail resolution for inaccessible package-private types per JVMS 5.4.3.1 and 5.4.3.5, yet such types can appear in method descriptors in the same class. The proposed way to bypass is to store the MethodType as its descriptor string in the bootstrap method arguments, and use MethodType.fromMethodDescriptorString to restore the arguments, which does not have this restriction and does not eagerly load the parameter classes. This case isn't covered by existing tests, so a new test has been added. > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > Obtain classloader in security manager friendly code path Original code did all the classloading in the `` - should we do that here, too? Can you explain the need to `getPlatformClassLoader` when `classEntry.getClassLoader == null`? Pre-JDK-8332457 did no such thing. I'll park #19598 until this stabilizes. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19615#issuecomment-2158189721 From liach at openjdk.org Mon Jun 10 12:33:12 2024 From: liach at openjdk.org (Chen Liang) Date: Mon, 10 Jun 2024 12:33:12 GMT Subject: RFR: 8333854: IllegalAccessError with proxies after JDK-8332457 [v2] In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 04:08:41 GMT, Chen Liang wrote: >> Please review this patch that fixes a critical issue that breaks some Proxy usages. >> >> CONSTANT_Class and CONSTANT_MethodType must fail resolution for inaccessible package-private types per JVMS 5.4.3.1 and 5.4.3.5, yet such types can appear in method descriptors in the same class. The proposed way to bypass is to store the MethodType as its descriptor string in the bootstrap method arguments, and use MethodType.fromMethodDescriptorString to restore the arguments, which does not have this restriction and does not eagerly load the parameter classes. This case isn't covered by existing tests, so a new test has been added. > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > Obtain classloader in security manager friendly code path The condy bootstrap is not trusted by SecurityManager, therefore it cannot use the `null` ClassLoader to parse method descriptors. https://github.com/openjdk/jdk/blob/7b43a8cd7c663facbe490f889838d7ead0eba0f9/src/java.base/share/classes/java/lang/invoke/MethodType.java#L1193 Meanwhile, condy bootstrap cannot take MethodType or Class, as those constants cannot resolve a package private type appearing in method descriptors. Thus, my approach is to obtain a valid non-null ClassLoader in ``, which is called from `Proxy` so there's no SecurityManager problems. Then I use that ClassLoader to perform actual resolution lazily in the condy. The call to `getPlatformClassLoader` emulates the same call in `MethodType.fromMethodDescriptorString`, which resolves classes in the bootstrap loader. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19615#issuecomment-2158217420 From prappo at openjdk.org Mon Jun 10 12:34:23 2024 From: prappo at openjdk.org (Pavel Rappo) Date: Mon, 10 Jun 2024 12:34:23 GMT Subject: RFR: 8333358: java/io/IO/IO.java test fails intermittently Message-ID: Please review this fix for an intermittent test failure. On some configurations, the default `expect` timeout of 10 seconds is insufficient. It is increased to 20; it's hard to imagine a configuration for which that new value would still be insufficient, but we'll see. Aside from that, test-generated diagnostics are improved: the version of the `expect` command and the duration of each test method are recorded. `output.exp` is modified for robustness and clear indication of the timeout condition. I was reminded, out-of-band, that test timeouts should be scaled with `test.timeout.factor`. I propose to integrate this PR first and then separately update all the affected tests to scale their `expect` timeouts. ------------- Commit messages: - Initial commit Changes: https://git.openjdk.org/jdk/pull/19627/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19627&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333358 Stats: 68 lines in 3 files changed: 62 ins; 2 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/19627.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19627/head:pull/19627 PR: https://git.openjdk.org/jdk/pull/19627 From redestad at openjdk.org Mon Jun 10 13:00:14 2024 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 10 Jun 2024 13:00:14 GMT Subject: RFR: 8333854: IllegalAccessError with proxies after JDK-8332457 [v2] In-Reply-To: References: Message-ID: <72NZyUHvjomdSsVM3aJ4T3ZWvxCgk4UzA5m-R-74w4s=.1930a514-e11b-4e14-9875-3c7849054366@github.com> On Mon, 10 Jun 2024 04:08:41 GMT, Chen Liang wrote: >> Please review this patch that fixes a critical issue that breaks some Proxy usages. >> >> CONSTANT_Class and CONSTANT_MethodType must fail resolution for inaccessible package-private types per JVMS 5.4.3.1 and 5.4.3.5, yet such types can appear in method descriptors in the same class. The proposed way to bypass is to store the MethodType as its descriptor string in the bootstrap method arguments, and use MethodType.fromMethodDescriptorString to restore the arguments, which does not have this restriction and does not eagerly load the parameter classes. This case isn't covered by existing tests, so a new test has been added. > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > Obtain classloader in security manager friendly code path I'm wary about the subtle semantic differences that might result from that and would be more comfortable reverting this behavior to what we did before JDK-8332457. Perhaps even backing that one out and re-examine the changes with less urgency. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19615#issuecomment-2158280708 From jwaters at openjdk.org Mon Jun 10 13:07:48 2024 From: jwaters at openjdk.org (Julian Waters) Date: Mon, 10 Jun 2024 13:07:48 GMT Subject: RFR: 8330988: Implementation of 8288293: Windows/gcc Port for hsdis [v3] In-Reply-To: References: Message-ID: > WIP > > This changeset contains hsdis for Windows/gcc Port. It supports both the binutils and capstone backends, though the LLVM backend is left out due to compatibility issues encountered during the build. Currently, which gcc distributions are supported is still to be clarified, as several, ranging from Cygwin, to MinGW64, to the gcc subsystems from MSYS2. For this reason, the build system hack in place at the moment to compile the binutils backend on Windows is still left in place, for now. Julian Waters has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision: - Capstone Support - Add check for compiler in configure - 8330988: Implementation of 8288293: Windows/gcc Port for hsdis ------------- Changes: - all: https://git.openjdk.org/jdk/pull/18915/files - new: https://git.openjdk.org/jdk/pull/18915/files/09fb3d65..b0b088e9 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=18915&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=18915&range=01-02 Stats: 121745 lines in 2137 files changed: 85534 ins; 24227 del; 11984 mod Patch: https://git.openjdk.org/jdk/pull/18915.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/18915/head:pull/18915 PR: https://git.openjdk.org/jdk/pull/18915 From pminborg at openjdk.org Mon Jun 10 13:24:35 2024 From: pminborg at openjdk.org (Per Minborg) Date: Mon, 10 Jun 2024 13:24:35 GMT Subject: RFR: 8333884: MemorySegment::reinterpret removes read-only property Message-ID: This PR proposes to retain the read-only state when any of the `MemorySegment::reinterpret` methods is called. Previously, the read-only state was lost and the returned `MemorySegment` was always writable regardless of the original segment's read-only state. ------------- Commit messages: - Make reinterpret retain read-only state Changes: https://git.openjdk.org/jdk/pull/19629/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19629&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333884 Stats: 37 lines in 4 files changed: 9 ins; 1 del; 27 mod Patch: https://git.openjdk.org/jdk/pull/19629.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19629/head:pull/19629 PR: https://git.openjdk.org/jdk/pull/19629 From duke at openjdk.org Mon Jun 10 13:39:13 2024 From: duke at openjdk.org (Robert Toyonaga) Date: Mon, 10 Jun 2024 13:39:13 GMT Subject: RFR: 8332400: isspace argument should be a valid unsigned char In-Reply-To: References: Message-ID: <4AzGl1zKsp5sPygdzdbG1WFTgsdNBJrF4FLSUxuhcQQ=.50d7ebb8-fd74-43db-9b4c-4cb02f82f2f0@github.com> On Wed, 5 Jun 2024 20:08:10 GMT, Robert Toyonaga wrote: > ### Summary > This change ensures we don't get undefined behavior when calling[`isspace`](https://pubs.opengroup.org/onlinepubs/007904975/functions/isspace.html). `isspace` accepts an `int` argument that "the application shall ensure is a character representable as an unsigned char or equal to the value of the macro EOF.". > > Previously, there was no checking of the values passed to `isspace`. I've replaced direct calls with a new wrapper `os::is_space` that performs a range check and prevents the possibility of undefined behavior from happening. For instances outside of Hotspot, I've added casts to `unsigned char`. > > **Testing** > - Added a new test in `test/hotspot/gtest/runtime/test_os.cpp` to check `os::is_space` is working correctly. > - tier1 Thanks for the feedback everyone! > But I did a bit of searching and it seems it comes down to potential arithmetic operations on the "char" the might behave differently depending on the signed-ness. :( Ok, so it seems like we ought to cast to unsigned char whenever char is passed, even if the representable range is the same. One more argument in favor of the current wrapper approach is that it makes it easy to at-a-glance confirm `isspace` is being used correctly everywhere. However, I am fine with just using casts wherever there is char and removing the wrapper. This is simpler and also avoids the cast to int. But what about when an int is passed to `isspace`? Maybe having the range check here would be better than casting to unsigned char or leaving as is? ------------- PR Comment: https://git.openjdk.org/jdk/pull/19567#issuecomment-2158401790 From david.lloyd at redhat.com Mon Jun 10 13:40:12 2024 From: david.lloyd at redhat.com (David Lloyd) Date: Mon, 10 Jun 2024 08:40:12 -0500 Subject: [External] : Re: New candidate JEP: 471: Deprecate the Memory-Access Methods in sun.misc.Unsafe for Removal In-Reply-To: References: <20240503151140.68BE06C9AEE@eggemoggin.niobe.net> <990521CB-66E1-45E6-8019-79E2C0BF7FEE@oracle.com> <835bfb2c-3318-4869-b8ff-6b1d3c1b70ad@oracle.com> Message-ID: On Fri, Jun 7, 2024 at 1:19?PM Ron Pressler wrote: > > > On 6 Jun 2024, at 18:37, David Lloyd wrote: > > > > Just bumping this one more time. I intend to start by opening a JIRA to > add the two proposed methods to `ReflectionFactory`, and go from there. I > guess that we might need a JEP for the proposed serialization restrictions, > which is going to be considerably more involved, so I'm putting that off as > a second step for now, pending further discussion. > > > Hi. > > Seven years before the upcoming delivery of JEP 471 we [announced that the > world of accessing JDK internals would be coming to an end]( > https://openjdk.org/jeps/260). Four years later, the JDK [started > enforcing that](https://openjdk.org/jeps/403), but to give extra time to > laggards who have not yet adapted to either refraining from accessing > internals or instructing their users on the proper configuration of the JDK > to allow doing so, we left some unsupported mechanisms in place to > temporarily allow hacking around the restrictions until they can properly > adapt. Now, three years later, we're starting the process of removing the > temporary hacks, although we don't yet know how long the process should > last. > > My first question is, how many more years do you think we should wait for > libraries to finish the process by which they either refrain from accessing > internals or instruct their users on the proper configuration that allows > them to do so? Knowing how long we should wait for the libraries that have > not yet finished their adaptation in the past seven years, and how far > along they are in the process, could help inform how long we should wait > until the actual removal of Unsafe. > > My second question has to do with the consideration that any serialization > procedure should no longer bypass constructors (at least not without > `--add-opens`, that is). I'd be interested to know about the difficulties > serialization libraries have encountered in their process of migrating away > from accessing internals and toward custom serializers for JDK classes, > such as what public constructors are missing. This would help us identify > what constructors we should add to support serialization that doesn't > violate integrity. > The first thing to understand is that, unlike APIs in the JDK which may only be implemented *in* the JDK, serialization is governed by a specification [1]. This specification is still implemented by multiple external libraries (including the OpenJDK ORB) as well as the JDK itself. We aren't talking about libraries which invent some arbitrary kind of serialization that requires unsafe object creation. We're talking about libraries which conform to some or all of the serialization specification. If you look back at the history of the discussion of serialization support with regards to the JDK (which is referenced in the history of this email thread), it was determined at the time of Java 9 that serialization would be considered an exception to the rule of reflection restrictions, for purely pragmatic reasons. Brian Goetz has talked frequently about the limitations of existing serialization and how this impacts the platform in various ways. He's also hinted at a future where some alternative serialization mechanism exists which would presumably avoid the need for the things we find in `ReflectionFactory`. However we don't live in that world just yet. So, to answer your first question ("How many more years...") I would start by modifying the question. It's not about waiting for libraries; I think this greatly mischaracterizes the problem. It's about waiting for OpenJDK to have a new serialization mechanism. Until then, there is no replacement, so we're in a holding pattern, like it or not. At best we're talking about small, monotonic improvements which bring the platform closer to the goal of integrity. And so the answer to the first question is, "however many years it takes for there to be an alternative, blessed OpenJDK serialization mechanism", which presumably will involve both language and core library modifications. For your second question, serialization *must*, by specification, bypass constructors in the bottom part of the serializable class's type hierarchy which correspond to serializable classes (most frequently this means everything other than `Object` itself, but occasionally there are more levels involved). If the platform were to drop that support, then all serialization libraries would break, including the OpenJDK ORB, and the specification would be unimplementable. The serialization specification is not deprecated. Nor are the classes which support serialization in the JDK. So in my opinion it would not yet be appropriate to break these things. In order to tackle this particular corner of platform integrity, those two problems must be addressed first and foremost, and such an action would necessarily involve a deprecation cycle on serialization as a whole. I would also like to be very clear that I am not proposing adding a mechanism to bypass constructors. Such a mechanism already exists on ReflectionFactory, and has not been deprecated. I am proposing that any caller which already has permission to do such a thing (and the other integrity-bypassing things already provided by this existing API) should also have permission to implement the remainder of the specification as well (reading and writing fields), and to do so using this same API, rather than Unsafe. In my view this is absolutely a monotonic step in the right direction (i.e. towards platform integrity), since we're putting all of the "offenders" into one bucket based on use case. It might be shocking to discover the existence of these APIs if one wasn't already aware of them. Presently, these APIs have essentially no restrictions (ignoring security manager). They're even easier to access than Unsafe, in fact. Therefore, I would suggest that another monotonic improvement would be to restrict these APIs under a command-line switch, like FFM is. In this way, we've unambiguously moved towards platform integrity, at least as far as it is currently possible to do so. Nothing would be enabled that isn't already possible, and some things that are now possible would be unambiguously restricted. Requiring `--add-opens` for ORBs/serialization probably isn't practical. It is important to note that in addition to user classes, a large number of JDK classes are serializable, spanning many packages. The burden on users would be extremely high in this case. Is it really better for users to have to list every package containing a serializable class, than to opt in wholesale to saying "I want serialization to be allowed for module X"? We don't (and wouldn't) do the same for native access for example, even though a similar level of access is given. In fact one *could* use native access to achieve the same thing, though this would be unfortunate on several levels. Another reason that requiring `--add-opens` would be inadequate is that ReflectionFactory allows bypassing not just access restrictions, but also certain provisions of the language and JVM specifications. Do we really want any open package to be accessible in this way? Do we really want this API to remain unrestricted? I would think that we would all agree that we do not. Yet, deprecation is not yet indicated for the reasons given above. I think restriction is the only answer here. And if this API is already restricted, why not let the implicit contract of that restriction carry the user's intent to grant serialization access to certain modules? Surely it could be made clear what such access entails, much as we do for FFM which has similar risks (and more). [1] https://docs.oracle.com/en/java/javase/22/docs/specs/serialization/index.html -- - DML ? he/him -------------- next part -------------- An HTML attachment was scrubbed... URL: From duke at openjdk.org Mon Jun 10 13:47:22 2024 From: duke at openjdk.org (Shaojin Wen) Date: Mon, 10 Jun 2024 13:47:22 GMT Subject: RFR: 8333893: Optimization for StringBuilder append boolean & null Message-ID: After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. This PR rewrites the code of appendNull and append(boolean) methods so that these two methods can be optimized by C2. ------------- Commit messages: - Optimization for StringBuilder append(boolean) & appendNull Changes: https://git.openjdk.org/jdk/pull/19626/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19626&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333893 Stats: 137 lines in 5 files changed: 54 ins; 41 del; 42 mod Patch: https://git.openjdk.org/jdk/pull/19626.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19626/head:pull/19626 PR: https://git.openjdk.org/jdk/pull/19626 From duke at openjdk.org Mon Jun 10 13:47:22 2024 From: duke at openjdk.org (Shaojin Wen) Date: Mon, 10 Jun 2024 13:47:22 GMT Subject: RFR: 8333893: Optimization for StringBuilder append boolean & null In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 12:12:58 GMT, Shaojin Wen wrote: > After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that these two methods can be optimized by C2. # 1. Compare with the master branch 1. master (`a6fc2f8`) https://github.com/wenshao/jdk/tree/upstream_master_a6fc2f8 2. current (`5e815`) https://github.com/wenshao/jdk/tree/optim_str_builder_append_202406 # 2. Benchmark Commands make test TEST="micro:java.lang.StringBuilders.toStringCharWithBool8" make test TEST="micro:java.lang.StringBuilders.toStringCharWithNull8" # 3. Benchmark Numbers The performance numbers under MacBookPro M1 Pro are as follows: -Benchmark Mode Cnt Score Error Units #master (a6fc2f8) -StringBuilders.toStringCharWithBool8Latin1 avgt 15 7.371 ? 0.003 ns/op -StringBuilders.toStringCharWithBool8Utf16 avgt 15 9.613 ? 0.018 ns/op -StringBuilders.toStringCharWithNull8Latin1 avgt 15 7.071 ? 0.003 ns/op -StringBuilders.toStringCharWithNull8Utf16 avgt 15 9.296 ? 0.016 ns/op +Benchmark Mode Cnt Score Error Units #current (5e815) +StringBuilders.toStringCharWithBool8Latin1 avgt 15 6.515 ? 0.121 ns/op +11.61% +StringBuilders.toStringCharWithBool8Utf16 avgt 15 8.654 ? 0.035 ns/op +9.97% +StringBuilders.toStringCharWithNull8Latin1 avgt 15 5.550 ? 0.010 ns/op +21.51% +StringBuilders.toStringCharWithNull8Utf16 avgt 15 8.108 ? 0.041 ns/op +12.77% # 1. Compare with unsafe branch 1. current (`5e815`) https://github.com/wenshao/jdk/tree/optim_str_builder_append_202406 2. unsafe (`adc220`) https://github.com/wenshao/jdk/tree/optim_str_builder_append_202406_unsafe I think the performance of the Unsafe branch may be the best data for the C2 optimizer. @eme64 can help me see if C2 can do it? # 2. Benchmark Commands make test TEST="micro:java.lang.StringBuilders.toStringCharWithBool8" make test TEST="micro:java.lang.StringBuilders.toStringCharWithNull8" # 3. Implementation of Unsafe Branch class AbstractStringBuilder { static final Unsafe UNSAFE = Unsafe.getUnsafe(); static final int NULL_LATIN1; static final int TRUE_LATIN1; static final int FALS_LATIN1; static final long NULL_UTF16; static final long TRUE_UTF16; static final long FALS_UTF16; static { byte[] bytes4 = new byte[4]; byte[] bytes8 = new byte[8]; bytes4[0] = 'n'; bytes4[1] = 'u'; bytes4[2] = 'l'; bytes4[3] = 'l'; NULL_LATIN1 = UNSAFE.getInt(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET); StringUTF16.inflate(bytes4, 0, bytes8, 0, 4); NULL_UTF16 = UNSAFE.getLong(bytes8, Unsafe.ARRAY_BYTE_BASE_OFFSET); bytes4[0] = 't'; bytes4[1] = 'r'; bytes4[2] = 'u'; bytes4[3] = 'e'; TRUE_LATIN1 = UNSAFE.getInt(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET); StringUTF16.inflate(bytes4, 0, bytes8, 0, 4); TRUE_UTF16 = UNSAFE.getLong(bytes8, Unsafe.ARRAY_BYTE_BASE_OFFSET); bytes4[0] = 'f'; bytes4[1] = 'a'; bytes4[2] = 'l'; bytes4[3] = 's'; FALS_LATIN1 = UNSAFE.getInt(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET); StringUTF16.inflate(bytes4, 0, bytes8, 0, 4); FALS_UTF16 = UNSAFE.getLong(bytes8, Unsafe.ARRAY_BYTE_BASE_OFFSET); } private AbstractStringBuilder appendNull() { ensureCapacityInternal(count + 4); int count = this.count; byte[] val = this.value; if (isLatin1()) { UNSAFE.putInt( val, Unsafe.ARRAY_BYTE_BASE_OFFSET + count, NULL_LATIN1); } else { UNSAFE.putLong( val, Unsafe.ARRAY_BYTE_BASE_OFFSET + (count << 1), NULL_UTF16); } this.count = count + 4; return this; } public AbstractStringBuilder append(boolean b) { int count = this.count; int spaceNeeded = count + (b ? 4 : 5); ensureCapacityInternal(spaceNeeded); byte[] val = this.value; if (isLatin1()) { UNSAFE.putInt( val, Unsafe.ARRAY_BYTE_BASE_OFFSET + count, b ? TRUE_LATIN1 : FALS_LATIN1); if (!b) { val[count + 4] = 'e'; } } else { UNSAFE.putLong( val, Unsafe.ARRAY_BYTE_BASE_OFFSET + (count << 1), b ? TRUE_UTF16 : FALS_UTF16); if (!b) { StringUTF16.putChar(val, count + 4, 'e'); } } this.count = spaceNeeded; return this; } } # 4. Benchmark Numbers The performance numbers under MacBookPro M1 Pro are as follows: -Benchmark Mode Cnt Score Error Units # unsafe (adc220) -StringBuilders.toStringCharWithBool8Latin1 avgt 15 6.415 ? 0.061 ns/op -StringBuilders.toStringCharWithBool8Utf16 avgt 15 7.307 ? 0.013 ns/op -StringBuilders.toStringCharWithNull8Latin1 avgt 15 5.443 ? 0.011 ns/op -StringBuilders.toStringCharWithNull8Utf16 avgt 15 6.944 ? 0.102 ns/op +Benchmark Mode Cnt Score Error Units #current (5e815) +StringBuilders.toStringCharWithBool8Latin1 avgt 15 6.515 ? 0.121 ns/op -1.55% +StringBuilders.toStringCharWithBool8Utf16 avgt 15 8.654 ? 0.035 ns/op -18.44% +StringBuilders.toStringCharWithNull8Latin1 avgt 15 5.550 ? 0.010 ns/op -1.96% +StringBuilders.toStringCharWithNull8Utf16 avgt 15 8.108 ? 0.041 ns/op -16.76% ------------- PR Comment: https://git.openjdk.org/jdk/pull/19626#issuecomment-2158201904 PR Comment: https://git.openjdk.org/jdk/pull/19626#issuecomment-2158296234 From mcimadamore at openjdk.org Mon Jun 10 13:48:14 2024 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Mon, 10 Jun 2024 13:48:14 GMT Subject: RFR: 8333884: MemorySegment::reinterpret removes read-only property In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 13:18:43 GMT, Per Minborg wrote: > This PR proposes to retain the read-only state when any of the `MemorySegment::reinterpret` methods is called. > > Previously, the read-only state was lost and the returned `MemorySegment` was always writable regardless of the original segment's read-only state. Note that `asSlice` methods also lacks a similar guarantee on read-only (but the impl works fine there) src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 708: > 706: /** > 707: * Returns a new memory segment that has the same address, scope, and > 708: * read-only state as this segment, but with the provided size. In other parts of the javadoc we say something like this: * If the buffer is {@linkplain Buffer#isReadOnly() read-only}, the resulting segment * is also {@linkplain ByteBuffer#isReadOnly() read-only} I think this is better, as read-only is a bit of info that is not IMHO worth spelling out in the method javadoc first para, Also, the term "read-only state" does not appear anywhere else in the FFM javadoc, so I'd recommend against using it. We can just say "if this segment is (link) read-only, the returned segment is read-only", or something like that. ------------- PR Review: https://git.openjdk.org/jdk/pull/19629#pullrequestreview-2107854767 PR Review Comment: https://git.openjdk.org/jdk/pull/19629#discussion_r1633280123 From rriggs at openjdk.org Mon Jun 10 13:51:13 2024 From: rriggs at openjdk.org (Roger Riggs) Date: Mon, 10 Jun 2024 13:51:13 GMT Subject: RFR: 8333742: ProcessImpl and ProcessHandleImpl may mishandle processes that exit with code 259 In-Reply-To: References: <1CvkxMiIsaatbXRqxy6MIPKRisHyifLU5VCr7OA-Lso=.6a1a2f1a-bfbb-4e59-ab2e-1a367b8f6492@github.com> <6FHMmdtAGyWE8HqW4etXrG0VSKrTektVEUXgJ2TXqs4=.bbaf0570-12eb-440a-848d-41674e8d29c6@github.com> Message-ID: On Fri, 7 Jun 2024 21:13:56 GMT, Roger Riggs wrote: >> Interesting. Could you point me to a related bug / documentation / evidence? I tested the WaitForSingleObject version (commit 6524747a5ebc51c760b14e90309c5f18b58b20e2) on Windows 11, and I didn't observe any problems with shutting down the VM > > I don't have a test or counter example and don't have a detailed understanding of the blocking needs of Hotspot. Another reason to retain the checking of GetThreadInterruptEvent is to be belt and suspenders against the Java code changing and opening up a potential error. At the moment, the reaper thread is encapsulated and not likely to get an interrupt, but that might not always be the case and someone changing the Java code might be unaware of the native code details. $.02 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19586#discussion_r1633285990 From duke at openjdk.org Mon Jun 10 13:58:13 2024 From: duke at openjdk.org (Shaojin Wen) Date: Mon, 10 Jun 2024 13:58:13 GMT Subject: RFR: 8310843: Reimplement ByteArray and ByteArrayLittleEndian with Unsafe [v2] In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 03:51:40 GMT, Glavo wrote: >> Things have changed since https://github.com/openjdk/jdk/pull/14636 was closed, so let me reopen it. >> >> https://github.com/openjdk/jdk/pull/15386 confirmed that `VarHandle` in BALE caused a startup regression. In order to not have any more revert patches, it makes sense to optimize BALE. >> >> The optimization of https://github.com/openjdk/jdk/pull/16245 allows the traditional expression to have good performance, but BA and BALE save us from having to copy these lengthy expressions everywhere. So it makes sense to keep them. >> >> Now here's the question, should I rewrite this PR without `Unsafe`? I'll do some research (e.g. does `Unsafe` have better performance during warmup?), but I'd also like to take some advice. > > Glavo has updated the pull request incrementally with one additional commit since the last revision: > > update copyright #16245 combining values ??into larger store, Instead of using Unsafe, can we implement it as follows, similar to the early versions of java.nio.Bits? class ByteArrayLittleEndian { // ... public static void setInt(byte[] array, int offset, int value) { array[offset ] = (byte) value; array[offset + 1] = (byte) (value >> 8); array[offset + 2] = (byte) (value >> 16); array[offset + 3] = (byte) (value >> 24); } public static void setLong(byte[] bytes, int off, long value) { array[offset] = (byte) value; array[offset + 1] = (byte) (value >> 8); array[offset + 2] = (byte) (value >> 16); array[offset + 3] = (byte) (value >> 24); array[offset + 4] = (byte) (value >> 32); array[offset + 5] = (byte) (value >> 40); array[offset + 6] = (byte) (value >> 48); array[offset + 7] = (byte) (value >> 56); } // ... } ------------- PR Comment: https://git.openjdk.org/jdk/pull/19616#issuecomment-2158447800 From liach at openjdk.org Mon Jun 10 14:22:11 2024 From: liach at openjdk.org (Chen Liang) Date: Mon, 10 Jun 2024 14:22:11 GMT Subject: RFR: 8333893: Optimization for StringBuilder append boolean & null In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 12:12:58 GMT, Shaojin Wen wrote: > After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that these two methods can be optimized by C2. I think for that C2 JIT to work, we need to merge the `'t' 'r' 'u' 'e'` ascii bytes into an int constant. Same for `false`. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19626#issuecomment-2158504397 From kevinw at openjdk.org Mon Jun 10 14:28:34 2024 From: kevinw at openjdk.org (Kevin Walls) Date: Mon, 10 Jun 2024 14:28:34 GMT Subject: RFR: 8333344: JMX attaching of Subject does not work when security manager not allowed Message-ID: JMX uses APIs related to the Security Mananger which are deprecated. Use of AccessControlContext will be removed when Security Manager is removed. Until then, updates are needed to not require setting -Djava.security.manager=allow to use JMX authentication. ------------- Commit messages: - Additional test combination, old getSubject call with sm=allow - Test updates - whitespace - Merge remote-tracking branch 'upstream/master' into 8333344_JMX_Subject - 8333344: JMX attaching of Subject does not work when security manager not allowed Changes: https://git.openjdk.org/jdk/pull/19624/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19624&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333344 Stats: 160 lines in 19 files changed: 109 ins; 10 del; 41 mod Patch: https://git.openjdk.org/jdk/pull/19624.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19624/head:pull/19624 PR: https://git.openjdk.org/jdk/pull/19624 From kevinw at openjdk.org Mon Jun 10 14:28:34 2024 From: kevinw at openjdk.org (Kevin Walls) Date: Mon, 10 Jun 2024 14:28:34 GMT Subject: RFR: 8333344: JMX attaching of Subject does not work when security manager not allowed In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 11:28:28 GMT, Kevin Walls wrote: > JMX uses APIs related to the Security Mananger which are deprecated. Use of AccessControlContext will be removed when Security Manager is removed. > > Until then, updates are needed to not require setting -Djava.security.manager=allow to use JMX authentication. When SecurityManager is not permitted, which is the default, use the Subject.current() call. If SM is permitted, due to -Djava.security.manager=allow then the old Subject.getSubject(AccessController.getContext()) call is used. Tests are updated to not require -Djava.security.manager=allow and will test with and without that setting. Also additionally update tests to use Subject.current(), but also have a setting to test the old Subject.getSubject(AccessController.getContext()) call with -Djava.security.manager=allow (see ThreadPoolAccTest and test/jdk/javax/management/remote/mandatory/passwordAuthenticator). ------------- PR Comment: https://git.openjdk.org/jdk/pull/19624#issuecomment-2158515271 From alanb at openjdk.org Mon Jun 10 14:31:12 2024 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 10 Jun 2024 14:31:12 GMT Subject: RFR: 8333344: JMX attaching of Subject does not work when security manager not allowed In-Reply-To: References: Message-ID: <98jFZxRQloFmqxvUlo20WiICow96XWt1ZiDkFsuj728=.760dcba6-ddd6-4e36-a59f-079b6dc414fe@github.com> On Mon, 10 Jun 2024 11:28:28 GMT, Kevin Walls wrote: > JMX uses APIs related to the Security Mananger which are deprecated. Use of AccessControlContext will be removed when Security Manager is removed. > > Until then, updates are needed to not require setting -Djava.security.manager=allow to use JMX authentication. src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java line 1634: > 1632: } else { > 1633: // We have ACC therefore SM is permitted, and Subject must be non-null: > 1634: return Subject.doAs(subject, (PrivilegedExceptionAction) () -> AccessController.doPrivileged((PrivilegedExceptionAction) () -> wrappedClass.cast(mo.get()), acc)); This is not readable. If you create the PAEs explicitly then the casts will go away and it will be much easier to read. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19624#discussion_r1633351429 From epeter at openjdk.org Mon Jun 10 14:35:13 2024 From: epeter at openjdk.org (Emanuel Peter) Date: Mon, 10 Jun 2024 14:35:13 GMT Subject: RFR: 8333893: Optimization for StringBuilder append boolean & null In-Reply-To: References: Message-ID: <9_OMKYvdx-xW6KC3sKovIYawgaRZfkKyvU97jcuskzM=.484f62c9-521c-47b5-a68a-6abc89c0e768@github.com> On Mon, 10 Jun 2024 13:04:08 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that these two methods can be optimized by C2. > > # 1. Compare with unsafe branch > > 1. current (`5e815`) https://github.com/wenshao/jdk/tree/optim_str_builder_append_202406 > 2. unsafe (`adc220`) https://github.com/wenshao/jdk/tree/optim_str_builder_append_202406_unsafe > > I think the performance of the Unsafe branch may be the best data for the C2 optimizer. @eme64 can help me see if C2 can do it? > > # 2. Benchmark Commands > > make test TEST="micro:java.lang.StringBuilders.toStringCharWithBool8" > make test TEST="micro:java.lang.StringBuilders.toStringCharWithNull8" > > > # 3. Implementation of Unsafe Branch > > class AbstractStringBuilder { > static final Unsafe UNSAFE = Unsafe.getUnsafe(); > > static final int NULL_LATIN1; > static final int TRUE_LATIN1; > static final int FALS_LATIN1; > > static final long NULL_UTF16; > static final long TRUE_UTF16; > static final long FALS_UTF16; > > static { > byte[] bytes4 = new byte[4]; > byte[] bytes8 = new byte[8]; > > bytes4[0] = 'n'; > bytes4[1] = 'u'; > bytes4[2] = 'l'; > bytes4[3] = 'l'; > NULL_LATIN1 = UNSAFE.getInt(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET); > StringUTF16.inflate(bytes4, 0, bytes8, 0, 4); > NULL_UTF16 = UNSAFE.getLong(bytes8, Unsafe.ARRAY_BYTE_BASE_OFFSET); > > bytes4[0] = 't'; > bytes4[1] = 'r'; > bytes4[2] = 'u'; > bytes4[3] = 'e'; > TRUE_LATIN1 = UNSAFE.getInt(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET); > StringUTF16.inflate(bytes4, 0, bytes8, 0, 4); > TRUE_UTF16 = UNSAFE.getLong(bytes8, Unsafe.ARRAY_BYTE_BASE_OFFSET); > > bytes4[0] = 'f'; > bytes4[1] = 'a'; > bytes4[2] = 'l'; > bytes4[3] = 's'; > FALS_LATIN1 = UNSAFE.getInt(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET); > StringUTF16.inflate(bytes4, 0, bytes8, 0, 4); > FALS_UTF16 = UNSAFE.getLong(bytes8, Unsafe.ARRAY_BYTE_BASE_OFFSET); > } > > private AbstractStringBuilder appendNull() { > ensureCapacityInternal(count + 4); > int count = this.count; > byte[] val = this.value; > if (isLatin1()) { > UNSAFE.putInt( > val, > Unsafe.ARRAY_BYTE_BASE_OFFSET + count, > NULL_LATIN1); > } else { > UNSAFE.putLong( > val, > Unsafe.ARRAY_BYTE_BASE_OFFSET + (count << 1), > NULL_UTF16); > } > this.count = count + 4; > return this; > } > > public AbstractStringBuilder append(boolean b) { > int count = th... @wenshao > I think the performance of the Unsafe branch may be the best data for the C2 optimizer. @eme64 can help me see if C2 can do it? Have you tried to see if the optimization actually was done/taken? You can use the `TraceMergeStores,` flag. Can you present the generated assembly code of the benchmarks, and explain the difference based on the generated assembly code? You can run JMH penchmarks with `perf`. These two blogs may help you: http://psy-lob-saw.blogspot.com/2015/07/jmh-perfasm.html https://shipilev.net/blog/2016/arrays-wisdom-ancients/#_meet_jmh_prof_perfasm @liach I don't think it makes a difference if it is `int` or `byte` constants. Or what exactly is the code change you are proposing? ------------- PR Comment: https://git.openjdk.org/jdk/pull/19626#issuecomment-2158533469 From pminborg at openjdk.org Mon Jun 10 14:59:42 2024 From: pminborg at openjdk.org (Per Minborg) Date: Mon, 10 Jun 2024 14:59:42 GMT Subject: RFR: 8333884: MemorySegment::reinterpret removes read-only property [v2] In-Reply-To: References: Message-ID: > This PR proposes to retain the read-only state when any of the `MemorySegment::reinterpret` methods is called. > > Previously, the read-only state was lost and the returned `MemorySegment` was always writable regardless of the original segment's read-only state. Per Minborg has updated the pull request incrementally with one additional commit since the last revision: Rework docs ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19629/files - new: https://git.openjdk.org/jdk/pull/19629/files/acebad9b..538eb2ed Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19629&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19629&range=00-01 Stats: 29 lines in 1 file changed: 9 ins; 0 del; 20 mod Patch: https://git.openjdk.org/jdk/pull/19629.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19629/head:pull/19629 PR: https://git.openjdk.org/jdk/pull/19629 From mcimadamore at openjdk.org Mon Jun 10 15:09:13 2024 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Mon, 10 Jun 2024 15:09:13 GMT Subject: RFR: 8333884: MemorySegment::reinterpret removes read-only property [v2] In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 14:59:42 GMT, Per Minborg wrote: >> This PR proposes to retain the read-only state when any of the `MemorySegment::reinterpret` methods is called. >> >> Previously, the read-only state was lost and the returned `MemorySegment` was always writable regardless of the original segment's read-only state. > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Rework docs Marked as reviewed by mcimadamore (Reviewer). src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 710: > 708: * but with the provided size. > 709: *

> 710: * If, and only if, this segment is {@linkplain MemorySegment#isReadOnly() read-only}, Correct, but the `, and only if, ` seems a tad too pedantic? I'll leave that to your consideration, not a strong feeling. ------------- PR Review: https://git.openjdk.org/jdk/pull/19629#pullrequestreview-2108075180 PR Review Comment: https://git.openjdk.org/jdk/pull/19629#discussion_r1633412181 From pminborg at openjdk.org Mon Jun 10 15:17:12 2024 From: pminborg at openjdk.org (Per Minborg) Date: Mon, 10 Jun 2024 15:17:12 GMT Subject: RFR: 8333884: MemorySegment::reinterpret removes read-only property [v2] In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 13:45:16 GMT, Maurizio Cimadamore wrote: > Note that `asSlice` methods also lacks a similar guarantee on read-only (but the impl works fine there) Even though not mentioned in the original issue, we could add documentation for this here as well. Or maybe via https://bugs.openjdk.org/browse/JDK-8333886 ? ------------- PR Comment: https://git.openjdk.org/jdk/pull/19629#issuecomment-2158628430 From mcimadamore at openjdk.org Mon Jun 10 15:21:12 2024 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Mon, 10 Jun 2024 15:21:12 GMT Subject: RFR: 8333884: MemorySegment::reinterpret removes read-only property [v2] In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 15:12:59 GMT, Per Minborg wrote: > > Note that `asSlice` methods also lacks a similar guarantee on read-only (but the impl works fine there) > > Even though not mentioned in the original issue, we could add documentation for this here as well. Or maybe via https://bugs.openjdk.org/browse/JDK-8333886 ? Or a new issue - I'm fine with both approaches. Whatever requires less work. Since you are already adding these "if this segment is read-only... ", maybe it would be simpler to review as part of this PR? ------------- PR Comment: https://git.openjdk.org/jdk/pull/19629#issuecomment-2158641151 From pminborg at openjdk.org Mon Jun 10 15:30:39 2024 From: pminborg at openjdk.org (Per Minborg) Date: Mon, 10 Jun 2024 15:30:39 GMT Subject: RFR: 8333884: MemorySegment::reinterpret removes read-only property [v3] In-Reply-To: References: Message-ID: <7H7M_D7ts36-xW-fmIJoPutBunL8DChqAmBeFmLXqFs=.2c5fdc63-24d2-45af-b261-c84ddff16118@github.com> > This PR proposes to retain the read-only state when any of the `MemorySegment::reinterpret` methods is called. > > Previously, the read-only state was lost and the returned `MemorySegment` was always writable regardless of the original segment's read-only state. Per Minborg has updated the pull request incrementally with one additional commit since the last revision: Add read-only comment on asSegment too ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19629/files - new: https://git.openjdk.org/jdk/pull/19629/files/538eb2ed..bc0ade8a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19629&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19629&range=01-02 Stats: 19 lines in 1 file changed: 13 ins; 0 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/19629.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19629/head:pull/19629 PR: https://git.openjdk.org/jdk/pull/19629 From rgiulietti at openjdk.org Mon Jun 10 15:31:15 2024 From: rgiulietti at openjdk.org (Raffaello Giulietti) Date: Mon, 10 Jun 2024 15:31:15 GMT Subject: RFR: 8333599: Improve description of \b matcher in j.u.r.Pattern In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 00:23:10 GMT, Stuart Marks wrote: >> A documentation-only change to match the original intent and the implemented behavior. > > Oh, this needs a CSR too, since it's a change to a normative assertion. Should be pretty simple though. @stuart-marks A [CSR](https://bugs.openjdk.org/browse/JDK-8333782) has been added. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19583#issuecomment-2158661490 From kevinw at openjdk.org Mon Jun 10 15:37:14 2024 From: kevinw at openjdk.org (Kevin Walls) Date: Mon, 10 Jun 2024 15:37:14 GMT Subject: RFR: 8333344: JMX attaching of Subject does not work when security manager not allowed In-Reply-To: <98jFZxRQloFmqxvUlo20WiICow96XWt1ZiDkFsuj728=.760dcba6-ddd6-4e36-a59f-079b6dc414fe@github.com> References: <98jFZxRQloFmqxvUlo20WiICow96XWt1ZiDkFsuj728=.760dcba6-ddd6-4e36-a59f-079b6dc414fe@github.com> Message-ID: On Mon, 10 Jun 2024 14:28:25 GMT, Alan Bateman wrote: >> JMX uses APIs related to the Security Mananger which are deprecated. Use of AccessControlContext will be removed when Security Manager is removed. >> >> Until then, updates are needed to not require setting -Djava.security.manager=allow to use JMX authentication. > > src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java line 1634: > >> 1632: } else { >> 1633: // We have ACC therefore SM is permitted, and Subject must be non-null: >> 1634: return Subject.doAs(subject, (PrivilegedExceptionAction) () -> AccessController.doPrivileged((PrivilegedExceptionAction) () -> wrappedClass.cast(mo.get()), acc)); > > This is not readable. If you create the PAEs explicitly then the casts will go away and it will be much easier to read. Yes will simplify this! This style was actually from the idea of moving to Subject.callAs, and nesting calls to keep the doPrivileged, but I don't think it will be necessary. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19624#discussion_r1633455244 From pminborg at openjdk.org Mon Jun 10 15:49:18 2024 From: pminborg at openjdk.org (Per Minborg) Date: Mon, 10 Jun 2024 15:49:18 GMT Subject: RFR: 8333886: Explicitly specify that asSlice and reinterpret return a memory segment backed by the same region of memory. Message-ID: This PR proposes to explicitly state that returned segments form the `asSlice` and `reinterpret` method share memory regions with `this` memory segment. Note: The term "subset" means a true subset or the same set. ------------- Commit messages: - Add segments share the same backing store in docs Changes: https://git.openjdk.org/jdk/pull/19633/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19633&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333886 Stats: 21 lines in 1 file changed: 21 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/19633.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19633/head:pull/19633 PR: https://git.openjdk.org/jdk/pull/19633 From liach at openjdk.org Mon Jun 10 15:59:11 2024 From: liach at openjdk.org (Chen Liang) Date: Mon, 10 Jun 2024 15:59:11 GMT Subject: RFR: 8333893: Optimization for StringBuilder append boolean & null In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 12:12:58 GMT, Shaojin Wen wrote: > After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into primitive arrays by combining values ??into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that these two methods can be optimized by C2. You are right, I was thinking about the case where you have 2 short variables, you should combine them into a long explicitly for C2 to generate a 4-byte write, otherwise it would be 2 2-bytes. Omitted the constant part which already eliminates this restriction. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19626#issuecomment-2158743190 From djelinski at openjdk.org Mon Jun 10 16:28:39 2024 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Mon, 10 Jun 2024 16:28:39 GMT Subject: RFR: 8333742: ProcessImpl and ProcessHandleImpl may mishandle processes that exit with code 259 [v2] In-Reply-To: <1CvkxMiIsaatbXRqxy6MIPKRisHyifLU5VCr7OA-Lso=.6a1a2f1a-bfbb-4e59-ab2e-1a367b8f6492@github.com> References: <1CvkxMiIsaatbXRqxy6MIPKRisHyifLU5VCr7OA-Lso=.6a1a2f1a-bfbb-4e59-ab2e-1a367b8f6492@github.com> Message-ID: > `GetExitCodeProcess` method is not reliable for checking if a process exited already; it returns 259 (STILL_ACTIVE) if the process hasn't exited yet, but the same value is returned when the process exited with code 259. In order to check if the process exited, we need to check if its handle is in a signaled state using one of the wait methods. > > This PR fixes the onExit, exitValue, isAlive, and waitFor(timeout) methods to correctly handle the problematic exit code. > > I haven't fixed the ProcessImpl.toString method. I'm not sure the problem is important enough to justify an extra JNI call in the (probably typical) still-alive case. > > Tier1-3 testing clean. I modified the existing OnExitTest to cover this case. Daniel Jeli?ski has updated the pull request incrementally with one additional commit since the last revision: waitForProcessExit0 should ignore interrupts ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19586/files - new: https://git.openjdk.org/jdk/pull/19586/files/e2b457bf..4ff37ced Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19586&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19586&range=00-01 Stats: 11 lines in 1 file changed: 0 ins; 8 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/19586.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19586/head:pull/19586 PR: https://git.openjdk.org/jdk/pull/19586 From djelinski at openjdk.org Mon Jun 10 16:28:39 2024 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Mon, 10 Jun 2024 16:28:39 GMT Subject: RFR: 8333742: ProcessImpl and ProcessHandleImpl may mishandle processes that exit with code 259 [v2] In-Reply-To: References: <1CvkxMiIsaatbXRqxy6MIPKRisHyifLU5VCr7OA-Lso=.6a1a2f1a-bfbb-4e59-ab2e-1a367b8f6492@github.com> <6FHMmdtAGyWE8HqW4etXrG0VSKrTektVEUXgJ2TXqs4=.bbaf0570-12eb-440a-848d-41674e8d29c6@github.com> Message-ID: On Mon, 10 Jun 2024 13:48:08 GMT, Roger Riggs wrote: >> I don't have a test or counter example and don't have a detailed understanding of the blocking needs of Hotspot. > > Another reason to retain the checking of GetThreadInterruptEvent is to be belt and suspenders against the Java code changing and opening up a potential error. At the moment, the reaper thread is encapsulated and not likely to get an interrupt, but that might not always be the case and someone changing the Java code might be unaware of the native code details. $.02 I did some research, and now I'm pretty confident that WaitForSingleObject is the right option: - the thread involved here is a daemon thread, i.e. it doesn't prevent JVM exit - the Unix version of `waitForProcessExit0` ignores interrupts and signals, it only ends when the wait succeeds or fails - I didn't observe any problems with exiting the JVM while waiting on a process handle - it's not clear to me what action we would take if the thread was cancelled; completing a CompletableFuture with an InterruptedException doesn't feel right. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19586#discussion_r1633522031 From pminborg at openjdk.org Mon Jun 10 16:41:30 2024 From: pminborg at openjdk.org (Per Minborg) Date: Mon, 10 Jun 2024 16:41:30 GMT Subject: RFR: 8316493: Remove the caching fields in AbstractMap [v11] In-Reply-To: <4tW3v7m0W_M4bmmLcywMRC5Gm26VhCt6pb16Bg7idTA=.c85a1df3-2208-439a-ac82-e9d16c537196@github.com> References: <4tW3v7m0W_M4bmmLcywMRC5Gm26VhCt6pb16Bg7idTA=.c85a1df3-2208-439a-ac82-e9d16c537196@github.com> Message-ID: On Fri, 10 Nov 2023 08:17:22 GMT, Per Minborg wrote: >> This PR outlines a solution for making immutable maps `@ValueBased` by removing cacheing of certain values in `AbstractMap`. >> >> By removing these caching fields in `AbstractMap`, we can make the immutable maps `@ValueBased` and at the same time, performance is likely improved because the JVM is probably able to optimize away object creation anyway via escape analysis. Also, all maps will occupy less space as we get rid of a number of objects and references stored for each map. >> >> We need to benchmark this solution to better understand its implications. > > Per Minborg has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 14 commits: > > - Merge branch 'master' into vb-map2 > - Fix formatting > - Remove caching in TreeMap > - Remove caching from CHM and CSLM > - Move back clone to original position > - Reintroduce AbstractMap::clone > - Add 'fresh' to implSpec > - Remove AbstractMap::clone > - Merge master > - Merge branch 'master' into vb-map2 > - ... and 4 more: https://git.openjdk.org/jdk/compare/9cce9fe0...b1bfcd17 Keep alive ------------- PR Comment: https://git.openjdk.org/jdk/pull/15614#issuecomment-2158838349 From kevinw at openjdk.org Mon Jun 10 16:52:26 2024 From: kevinw at openjdk.org (Kevin Walls) Date: Mon, 10 Jun 2024 16:52:26 GMT Subject: RFR: 8333344: JMX attaching of Subject does not work when security manager not allowed [v2] In-Reply-To: References: Message-ID: > JMX uses APIs related to the Security Mananger which are deprecated. Use of AccessControlContext will be removed when Security Manager is removed. > > Until then, updates are needed to not require setting -Djava.security.manager=allow to use JMX authentication. Kevin Walls has updated the pull request incrementally with one additional commit since the last revision: More consistent style of calls and comments. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19624/files - new: https://git.openjdk.org/jdk/pull/19624/files/22424a8e..d43f9a34 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19624&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19624&range=00-01 Stats: 12 lines in 1 file changed: 5 ins; 0 del; 7 mod Patch: https://git.openjdk.org/jdk/pull/19624.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19624/head:pull/19624 PR: https://git.openjdk.org/jdk/pull/19624 From jvernee at openjdk.org Mon Jun 10 17:04:15 2024 From: jvernee at openjdk.org (Jorn Vernee) Date: Mon, 10 Jun 2024 17:04:15 GMT Subject: RFR: 8333884: MemorySegment::reinterpret removes read-only property [v3] In-Reply-To: <7H7M_D7ts36-xW-fmIJoPutBunL8DChqAmBeFmLXqFs=.2c5fdc63-24d2-45af-b261-c84ddff16118@github.com> References: <7H7M_D7ts36-xW-fmIJoPutBunL8DChqAmBeFmLXqFs=.2c5fdc63-24d2-45af-b261-c84ddff16118@github.com> Message-ID: On Mon, 10 Jun 2024 15:30:39 GMT, Per Minborg wrote: >> This PR proposes to retain the read-only state when any of the `MemorySegment::reinterpret` methods is called. >> >> Previously, the read-only state was lost and the returned `MemorySegment` was always writable regardless of the original segment's read-only state. > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Add read-only comment on asSegment too Marked as reviewed by jvernee (Reviewer). Thanks for fixing! ------------- PR Review: https://git.openjdk.org/jdk/pull/19629#pullrequestreview-2108320145 PR Comment: https://git.openjdk.org/jdk/pull/19629#issuecomment-2158879695 From rgiulietti at openjdk.org Mon Jun 10 17:05:12 2024 From: rgiulietti at openjdk.org (Raffaello Giulietti) Date: Mon, 10 Jun 2024 17:05:12 GMT Subject: RFR: 8333828: Use value javadoc tag in java.lang.{Float, Double} [v2] In-Reply-To: <8EttkjTur6Og1vappqkT2az4EOh5G4FU2nA_b1anHYw=.80dd6f49-5182-4146-8e04-6f31e212b3aa@github.com> References: <8EttkjTur6Og1vappqkT2az4EOh5G4FU2nA_b1anHYw=.80dd6f49-5182-4146-8e04-6f31e212b3aa@github.com> Message-ID: On Fri, 7 Jun 2024 22:16:36 GMT, Joe Darcy wrote: >> Use the value tag to make the javadoc for various format-related constants more informative to readers. Currently the information is available by following the "Constant Field Values" link. >> >> I'll reflow the paragraphs before a push. > > Joe Darcy has updated the pull request incrementally with one additional commit since the last revision: > > Implement review feedback. LGTM ------------- Marked as reviewed by rgiulietti (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19607#pullrequestreview-2108321549 From darcy at openjdk.org Mon Jun 10 17:12:24 2024 From: darcy at openjdk.org (Joe Darcy) Date: Mon, 10 Jun 2024 17:12:24 GMT Subject: RFR: 8333828: Use value javadoc tag in java.lang.{Float, Double} [v3] In-Reply-To: References: Message-ID: > Use the value tag to make the javadoc for various format-related constants more informative to readers. Currently the information is available by following the "Constant Field Values" link. > > I'll reflow the paragraphs before a push. Joe Darcy has updated the pull request incrementally with one additional commit since the last revision: Reflow paragraphs. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19607/files - new: https://git.openjdk.org/jdk/pull/19607/files/ea23aaf0..5d140fb2 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19607&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19607&range=01-02 Stats: 23 lines in 2 files changed: 4 ins; 0 del; 19 mod Patch: https://git.openjdk.org/jdk/pull/19607.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19607/head:pull/19607 PR: https://git.openjdk.org/jdk/pull/19607 From jvernee at openjdk.org Mon Jun 10 17:14:11 2024 From: jvernee at openjdk.org (Jorn Vernee) Date: Mon, 10 Jun 2024 17:14:11 GMT Subject: RFR: 8333886: Explicitly specify that asSlice and reinterpret return a memory segment backed by the same region of memory. In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 15:45:07 GMT, Per Minborg wrote: > This PR proposes to explicitly state that returned segments form the `asSlice` and `reinterpret` method share memory regions with `this` memory segment. > > Note: The term "subset" means a true subset or the same set. The term 'subset' doesn't feel right to me here, since we're only talking about a single memory region (not a set of memory region**s**). I suggest 'sub-region' instead. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19633#issuecomment-2158892356 From jvernee at openjdk.org Mon Jun 10 17:14:11 2024 From: jvernee at openjdk.org (Jorn Vernee) Date: Mon, 10 Jun 2024 17:14:11 GMT Subject: RFR: 8333886: Explicitly specify that asSlice and reinterpret return a memory segment backed by the same region of memory. In-Reply-To: References: Message-ID: <1jySJvszszWTPX_IaMEu8EhbDHqkvY7BtDMcSiFI-l4=.83375e41-0c48-4b66-9e82-f073cc5df933@github.com> On Mon, 10 Jun 2024 17:09:27 GMT, Jorn Vernee wrote: > The term 'subset' doesn't feel right to me here, since we're only talking about a single memory region (not a set of memory region**s**). I suggest 'sub-region' instead. Actually, nvm, that doesn't work for `reinterpret` since the returned segment can also cover a larger region of memory. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19633#issuecomment-2158895439 From darcy at openjdk.org Mon Jun 10 17:18:15 2024 From: darcy at openjdk.org (Joe Darcy) Date: Mon, 10 Jun 2024 17:18:15 GMT Subject: Integrated: 8333828: Use value javadoc tag in java.lang.{Float, Double} In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 21:05:33 GMT, Joe Darcy wrote: > Use the value tag to make the javadoc for various format-related constants more informative to readers. Currently the information is available by following the "Constant Field Values" link. > > I'll reflow the paragraphs before a push. This pull request has now been integrated. Changeset: 13642cb4 Author: Joe Darcy URL: https://git.openjdk.org/jdk/commit/13642cb4b8895ad07b2249c9e215a6a037e5cf71 Stats: 23 lines in 2 files changed: 4 ins; 0 del; 19 mod 8333828: Use value javadoc tag in java.lang.{Float, Double} Reviewed-by: liach, rgiulietti ------------- PR: https://git.openjdk.org/jdk/pull/19607 From iris at openjdk.org Mon Jun 10 17:30:15 2024 From: iris at openjdk.org (Iris Clark) Date: Mon, 10 Jun 2024 17:30:15 GMT Subject: RFR: 8330205: Initial troff manpage generation for JDK 24 In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 02:31:00 GMT, David Holmes wrote: > Sets the version to 24/24-ea and the copyright year to 2025. > > Content changes related to the start of release (e.g. for removed options in java.1) are handled separately. > > This initial generation also picks up the unpublished changes from: > > - JDK-8330807: Update Manpage for obsoletion of ScavengeBeforeFullGC > - JDK-8284500: Typo in Supported Named Extensions - BasicContraints > - JDK-8324342: Doclet should default `@since` for a nested class to that of its enclosing class > > Thanks Marked as reviewed by iris (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/19617#pullrequestreview-2108383696 From darcy at openjdk.org Mon Jun 10 17:42:27 2024 From: darcy at openjdk.org (Joe Darcy) Date: Mon, 10 Jun 2024 17:42:27 GMT Subject: RFR: 8333768: Minor doc updates to java.lang.{Float, Double} [v2] In-Reply-To: References: Message-ID: > Misc small doc updates and addition of `@Overrides` annotations. Joe Darcy has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision: - Merge branch 'master' into JDK-8333768 - JDK-8333768: Minor doc updates to java.lang.{Float, Double} ------------- Changes: - all: https://git.openjdk.org/jdk/pull/19590/files - new: https://git.openjdk.org/jdk/pull/19590/files/99f1ade0..cfe77e62 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=19590&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19590&range=00-01 Stats: 8759 lines in 137 files changed: 7210 ins; 936 del; 613 mod Patch: https://git.openjdk.org/jdk/pull/19590.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19590/head:pull/19590 PR: https://git.openjdk.org/jdk/pull/19590 From rriggs at openjdk.org Mon Jun 10 19:48:13 2024 From: rriggs at openjdk.org (Roger Riggs) Date: Mon, 10 Jun 2024 19:48:13 GMT Subject: RFR: 8333742: ProcessImpl and ProcessHandleImpl may mishandle processes that exit with code 259 [v2] In-Reply-To: References: <1CvkxMiIsaatbXRqxy6MIPKRisHyifLU5VCr7OA-Lso=.6a1a2f1a-bfbb-4e59-ab2e-1a367b8f6492@github.com> Message-ID: On Mon, 10 Jun 2024 16:28:39 GMT, Daniel Jeli?ski wrote: >> `GetExitCodeProcess` method is not reliable for checking if a process exited already; it returns 259 (STILL_ACTIVE) if the process hasn't exited yet, but the same value is returned when the process exited with code 259. In order to check if the process exited, we need to check if its handle is in a signaled state using one of the wait methods. >> >> This PR fixes the onExit, exitValue, isAlive, and waitFor(timeout) methods to correctly handle the problematic exit code. >> >> I haven't fixed the ProcessImpl.toString method. I'm not sure the problem is important enough to justify an extra JNI call in the (probably typical) still-alive case. >> >> Tier1-3 testing clean. I modified the existing OnExitTest to cover this case. > > Daniel Jeli?ski has updated the pull request incrementally with one additional commit since the last revision: > > waitForProcessExit0 should ignore interrupts LGTM ------------- Marked as reviewed by rriggs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19586#pullrequestreview-2108626204 From rriggs at openjdk.org Mon Jun 10 19:48:14 2024 From: rriggs at openjdk.org (Roger Riggs) Date: Mon, 10 Jun 2024 19:48:14 GMT Subject: RFR: 8333742: ProcessImpl and ProcessHandleImpl may mishandle processes that exit with code 259 [v2] In-Reply-To: References: <1CvkxMiIsaatbXRqxy6MIPKRisHyifLU5VCr7OA-Lso=.6a1a2f1a-bfbb-4e59-ab2e-1a367b8f6492@github.com> <6FHMmdtAGyWE8HqW4etXrG0VSKrTektVEUXgJ2TXqs4=.bbaf0570-12eb-440a-848d-41674e8d29c6@github.com> Message-ID: On Mon, 10 Jun 2024 16:24:27 GMT, Daniel Jeli?ski wrote: >> Another reason to retain the checking of GetThreadInterruptEvent is to be belt and suspenders against the Java code changing and opening up a potential error. At the moment, the reaper thread is encapsulated and not likely to get an interrupt, but that might not always be the case and someone changing the Java code might be unaware of the native code details. $.02 > > I did some research, and now I'm pretty confident that WaitForSingleObject is the right option: > - the thread involved here is a daemon thread, i.e. it doesn't prevent JVM exit > - the Unix version of `waitForProcessExit0` ignores interrupts and signals, it only ends when the wait succeeds or fails > - I didn't observe any problems with exiting the JVM while waiting on a process handle > - it's not clear to me what action we would take if the thread was cancelled; completing a CompletableFuture with an InterruptedException doesn't feel right. ok, I'll buy that argument ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19586#discussion_r1633748785 From naoto at openjdk.org Mon Jun 10 19:49:15 2024 From: naoto at openjdk.org (Naoto Sato) Date: Mon, 10 Jun 2024 19:49:15 GMT Subject: RFR: 8333358: java/io/IO/IO.java test fails intermittently In-Reply-To: References: Message-ID: On Mon, 10 Jun 2024 12:29:32 GMT, Pavel Rappo wrote: > Please review this fix for an intermittent test failure. > > On some configurations, the default `expect` timeout of 10 seconds is insufficient. It is increased to 20; it's hard to imagine a configuration for which that new value would still be insufficient, but we'll see. > > Aside from that, test-generated diagnostics are improved: the version of the `expect` command and the duration of each test method are recorded. `output.exp` is modified for robustness and clear indication of the timeout condition. > > I was reminded, out-of-band, that test timeouts should be scaled with `test.timeout.factor`. I propose to integrate this PR first and then separately update all the affected tests to scale their `expect` timeouts. LGTM test/jdk/java/io/IO/IO.java line 190: > 188: > 189: > 190: // adapted from https://raw.githubusercontent.com/junit-team/junit5/main/documentation/src/test/java/example/timing/TimingExtension.java Probably better to refer to the user guide on the web (https://junit.org/junit5/docs/snapshot/user-guide/#extensions-lifecycle-callbacks-before-after-execution) ------------- Marked as reviewed by naoto (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19627#pullrequestreview-2108625709 PR Review Comment: https://git.openjdk.org/jdk/pull/19627#discussion_r1633749196 From dnguyen at openjdk.org Mon Jun 10 20:05:33 2024 From: dnguyen at openjdk.org (Damon Nguyen) Date: Mon, 10 Jun 2024 20:05:33 GMT Subject: RFR: 8333827: JDK 23 RDP1 L10n resource files update Message-ID: This issue is responsible for updating the translations of all the localize(able) resources in the JDK. Primarily, the changes between JDK 22 RDP 1 and the integration of the JDK 23 RDP 1 L10n drop will be translated. The translation tool adjusted some definitions, which causes some changes in localized files where the source file had no changes. This causes some words being reverted from localized languages to English, and some had its definitions changed. Alternatively, the diffs are viewable here and was generated using John Gibbon's diff tool for l10n: https://cr.openjdk.org/~dnguyen/output2/ ------------- Commit messages: - Review comment edits - Initial localization changes Changes: https://git.openjdk.org/jdk/pull/19609/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19609&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333827 Stats: 239 lines in 39 files changed: 133 ins; 57 del; 49 mod Patch: https://git.openjdk.org/jdk/pull/19609.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19609/head:pull/19609 PR: https://git.openjdk.org/jdk/pull/19609 From achung at openjdk.org Mon Jun 10 20:05:33 2024 From: achung at openjdk.org (Alisen Chung) Date: Mon, 10 Jun 2024 20:05:33 GMT Subject: RFR: 8333827: JDK 23 RDP1 L10n resource files update In-Reply-To: References: Message-ID: On Fri, 7 Jun 2024 22:46:44 GMT, Damon Nguyen wrote: > This issue is responsible for updating the translations of all the localize(able) resources in the JDK. Primarily, the changes between JDK 22 RDP 1 and the integration of the JDK 23 RDP 1 L10n drop will be translated. > > The translation tool adjusted some definitions, which causes some changes in localized files where the source file had no changes. This causes some words being reverted from localized languages to English, and some had its definitions changed. > > Alternatively, the diffs are viewable here and was generated using John Gibbon's diff tool for l10n: > https://cr.openjdk.org/~dnguyen/output2/ Just a question about the reverted translations, otherwise LGTM > The translation tool adjusted some definitions, which causes some changes in localized files where the source file had no changes. This causes some words being reverted from localized languages to English, and some had its definitions changed. Any particular reason you know that the tool had the definitions adjusted? I see some of the changes look like like command line options not being translated, but it's a bit hard to tell. Do you know if the reverted words should be translated (and possibly will be re-translated in future drops?) or should they be left untranslated? ------------- PR Review: https://git.openjdk.org/jdk/pull/19609#pullrequestreview-2105526180 PR Comment: https://git.openjdk.org/jdk/pull/19609#issuecomment-2155723513 From jlu at openjdk.org Mon Jun 10 20:05:33 2024 From: jlu at openjdk.org (Justin Lu) Date: Mon, 10 Jun 2024 20:05:33 GMT Subject: RFR: 8333827: JDK 23 RDP1 L10n resource files update In-Reply-To: References: Message-ID: <6x05vtOnVTgxlyzPvesvYR9v3NUNHNkinbbaXJtXzxU=.492b5e27-02dd-4457-a725-705a3d6be7f9@github.com> On Fri, 7 Jun 2024 22:46:44 GMT, Damon Nguyen wrote: > This issue is responsible for updating the translations of all the localize(able) resources in the JDK. Primarily, the changes between JDK 22 RDP 1 and the integration of the JDK 23 RDP 1 L10n drop will be translated. > > The translation tool adjusted some definitions, which causes some changes in localized files where the source file had no changes. This causes some words being reverted from localized languages to English, and some had its definitions changed. > > Alternatively, the diffs are viewable here and was generated using John Gibbon's diff tool for l10n: > https://cr.openjdk.org/~dnguyen/output2/ Cannot speak to the translations themselves, but in general the changes LGTM pending the comments. src/java.desktop/share/classes/sun/print/resources/serviceui_de.properties line 1: > 1: # It looks like these .properties files need to have their copyright years bumped. I believe since the original was not bumped, the translation tool did not reflect the correct year in the localized versions. src/java.desktop/share/classes/sun/print/resources/serviceui_zh_CN.properties line 66: > 64: label.size=??(&Z): > 65: label.source=??(&C): > 66: label.outputbins=????(&P)? Looks like the translation tool changed this from a colon (U+003A) to a full width colon (U+FF1A). There are l10n rules when it comes to punctuation, I am not sure if this is a result of that. It looks like the surrounding key/values are simply using (U+003A) colons. If we decide to revert this colon change, we need to also probably file a bug against the translation tool. src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties line 278: > 276: UndeclaredElementInContentSpec = Contentmodell des Elements "{0}" verweist auf das nicht deklarierte Element "{1}". > 277: UniqueNotationName = Deklaration f?r die Notation "{0}" ist nicht eindeutig. Ein jeweiliger Name darf nicht in mehreren Notationsdeklarationen deklariert werden. > 278: ENTITYFailedInitializeGrammar = ENTITYDatatype-Validator: Nicht erfolgreich. Initialisierungsmethode muss mit einer g?ltigen Grammatikreferenz aufgerufen werden. \t It looks like the _zh_CN_ file should also have the `\t` removed, but such changes are done by the translation tool. I think in this case, we should manually remove it, and then file a bug against the translation tool. src/jdk.jconsole/share/classes/sun/tools/jconsole/resources/messages_de.properties line 285: > 283: VIRTUAL_MACHINE=Virtuelle Maschine > 284: VM_ARGUMENTS=VM-Argumente > 285: VMINTERNAL_FRAME_ACCESSIBLE_DESCRIPTION=Innerer Frame f?r das Monitoring einer Java Virtual Machine This one-off change is consistent with the change in _src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_de.java_. src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_de.properties line 183: > 181: jshell.fix.wrong.shortcut =Unerwartetes Zeichen nach Umschalt+Tab.\nVerwenden Sie "I" f?r automatischen Import, "V" zur Variablenerstellung oder "M" zur Methodenerstellung.\nWeitere Informationen finden Sie unter:\n/help shortcuts > 182: > 183: help.usage = Verwendung: jshell