From jvernee at openjdk.org Thu Jun 1 00:00:07 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 1 Jun 2023 00:00:07 GMT Subject: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v2] In-Reply-To: References: Message-ID: On Wed, 31 May 2023 23:36:33 GMT, Maurizio Cimadamore wrote: >> src/java.base/share/classes/java/lang/foreign/Linker.java line 368: >> >>> 366: *

Variadic functions

>>> 367: * >>> 368: * Variadic functions (e.g. a C function declared with a trailing ellipses {@code ...} at the end of the formal parameter >> >> Optional suggestion for improvement (maybe now, or maybe later). When reading this great para, I understand that there are two things that fall under the "variadic function" umbrella. Some are declared with `...` and some with `()`. This is a very good definition and I wonder if we should expand a bit more on it - e.g. in a way, we never explain what a variadic function is - we merely define it by saying how it is declared in C. I wonder if we might very very briefly explain that in C, some functions (variadic functions) can take a variable number of parameters. Then we go on to say that these functions can be declared in two ways (e.g. ellipsis and prototype-less). Perhaps if we used a bullet-list to define the two ways in which variadic function can be declared, the definition could stand out even more? > > Also, should we say somewhere that, for prototype-less functions, `firstVariadicArg` should always have an index of 0 (e.g. any other value is illegal, trivially). It's not super important, just one of those little things that can reinforce understanding. > Perhaps if we used a bullet-list to define the two ways in which variadic function can be declared, the definition could stand out even more? Yes, I think this is a good idea. I'll do another pass. > Also, should we say somewhere that, for prototype-less functions, firstVariadicArg should always have an index of 0 I think this is also a good idea. It help hammer the point home. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14225#discussion_r1212426680 From jvernee at openjdk.org Thu Jun 1 00:08:06 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 1 Jun 2023 00:08:06 GMT Subject: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v2] In-Reply-To: References: Message-ID: On Wed, 31 May 2023 23:41:25 GMT, Maurizio Cimadamore wrote: >> Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: >> >> review comments > > src/java.base/share/classes/java/lang/foreign/Linker.java line 379: > >> 377: * type {@code float} is converted to {@code double}, and each integral type smaller than {@code int} is converted to >> 378: * {@code int}. As such, the native linker will reject attempts to link function descriptors with certain variadic argument >> 379: * layouts. Namely, {@linkplain ValueLayout value layouts} that have a carrier type of {@code boolean}, {@code byte}, > > Is there any reason as to why you decided to say which layouts are **not** allowed as variadic layouts? I'm wondering whether, if we add more carriers in the future, this list will probably need to be updated? Or do the restriction only involve these "small" types, and stuff like `long double` is always allowed? (in which case the set of unsupported layouts would remain stable over time) No real reason for the current polarity. The specification explicitly calls out the float -> double conversion, and then for the integral types it refers to ['integer promotions'](https://en.cppreference.com/w/c/language/conversion#Integer_promotions), which is a somewhat complex rule set for assigning ranks to integer types. So, I think if we add more carriers in the future, we would have to worry about integral types that have a rank less than (unsigned) int when considering this list. This is currently only the types I've listed (though, `char` is a bit of a special case), and this seems relatively stable to me. e.g. `long double` would not need to be added here. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14225#discussion_r1212432229 From rriggs at openjdk.org Thu Jun 1 00:54:05 2023 From: rriggs at openjdk.org (Roger Riggs) Date: Thu, 1 Jun 2023 00:54:05 GMT Subject: RFR: 8308748: JNU_GetStringPlatformChars may write to String's internal memory array [v2] In-Reply-To: References: Message-ID: On Fri, 26 May 2023 19:54:07 GMT, Rudi Horn wrote: >> This change prevents the contents of the internal string array from being copied back when releasing it. > > Rudi Horn has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains one commit: > > Use JNI_ABORT to release string bytes Looks good for core-libs. ------------- Marked as reviewed by rriggs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14117#pullrequestreview-1454378418 From dholmes at openjdk.org Thu Jun 1 02:19:08 2023 From: dholmes at openjdk.org (David Holmes) Date: Thu, 1 Jun 2023 02:19:08 GMT Subject: RFR: 8308090: Add container tests for on-the-fly resource quota updates [v2] In-Reply-To: References: Message-ID: On Wed, 31 May 2023 12:07:49 GMT, Severin Gehwolf wrote: >> 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 three additional commits since the last revision: >> >> - Merge branch 'master' into jdk-8308090-tests-container-on-fly-updates >> - Fix whitespace >> - 8308090: Add container tests for on-the-fly resource quota updates > > Anyone willing to review this? @jerboaa I can't really review the tests themselves but will run through our CI to see if they cause any problems. If not then they should be okay to add. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14090#issuecomment-1571223360 From dholmes at openjdk.org Thu Jun 1 03:17:05 2023 From: dholmes at openjdk.org (David Holmes) Date: Thu, 1 Jun 2023 03:17:05 GMT Subject: RFR: 8309191: Reduce JDK dependencies of cgroup support In-Reply-To: <9UqqGOmXLkrwGFFsrX1IdUCOzdHPOb_bh6rZTi5SgQw=.3b73ac88-8410-409a-b057-cb4837a4a48c@github.com> References: <9UqqGOmXLkrwGFFsrX1IdUCOzdHPOb_bh6rZTi5SgQw=.3b73ac88-8410-409a-b057-cb4837a4a48c@github.com> Message-ID: <1g6MduzNkaQY5jXr2kWzFLhGwbYqFdwQIcIzvGKCVDo=.5e66b381-147a-462c-a028-da5d8df80d76@github.com> On Wed, 31 May 2023 13:49:46 GMT, Aleksandar Pejovi? wrote: >>> I guess I'll have to wait for OCA verification. >> >> Yes. >> >>> One failure is due to a lack of reviewers, so would you be able to do a review? >> >> Yes, I'll try to do a review later today or tomorrow. >> >> Thanks! > >> Yes, I'll try to do a review later today or tomorrow. > > Awesome, thanks! @pejovica what testing have you done in relation to these changes? We run our container tests in tier5 - have you tested that? Thanks. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14216#issuecomment-1571265772 From alanb at openjdk.org Thu Jun 1 06:14:08 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 1 Jun 2023 06:14:08 GMT Subject: RFR: 8308748: JNU_GetStringPlatformChars may write to String's internal memory array [v2] In-Reply-To: References: Message-ID: On Fri, 26 May 2023 19:54:07 GMT, Rudi Horn wrote: >> This change prevents the contents of the internal string array from being copied back when releasing it. > > Rudi Horn has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains one commit: > > Use JNI_ABORT to release string bytes Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14117#pullrequestreview-1454646625 From alanb at openjdk.org Thu Jun 1 06:14:10 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 1 Jun 2023 06:14:10 GMT Subject: RFR: 8308748: JNU_GetStringPlatformChars may write to String's internal memory array [v2] In-Reply-To: <-XXQZS3DTQRNCh0bgkkX0bCep65VZTxkyho-j_FPCQw=.bfb344b3-26fd-47bc-9903-235fe224346a@github.com> References: <-XXQZS3DTQRNCh0bgkkX0bCep65VZTxkyho-j_FPCQw=.bfb344b3-26fd-47bc-9903-235fe224346a@github.com> Message-ID: <3OPEPQkI_OgWVT_O460ilZ71m8U08f7nuX-N0IEGAiA=.917940b8-7ee6-4d2b-90f5-752f84c45799@github.com> On Wed, 31 May 2023 11:49:00 GMT, Rudi Horn wrote: > I have not checked other uses, but they are probably not as critical yet given the special status and frequent use of strings. I can possibly revisit this issue in the future in a further issue / PR if I find time at some stage. Okay, we should create an issue in JBS to follow-up on that, as there may be other opportunities to avoid the copy back. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14117#issuecomment-1571415559 From alanb at openjdk.org Thu Jun 1 06:19:04 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 1 Jun 2023 06:19:04 GMT Subject: RFR: 8309191: Reduce JDK dependencies of cgroup support In-Reply-To: References: Message-ID: On Tue, 30 May 2023 13:03:27 GMT, Aleksandar Pejovi? wrote: > The current code for cgroup support in the JDK has large and expensive dependencies: it uses NIO, streams, and regular expressions. This leads to unnecessary class loading and slows down startup, especially when the code is executed early during an application startup. This is especially a problem for GraalVM, which executes this code during VM startup. > > This PR reduces the dependencies: > - NIO is replaced with regular `java.io` for file access. > - Streams are replaced with loops (a side effect of this is that files are read in full whereas previously they could be read up to a certain point, e.g., until a match is found). > - Regular expressions are replaced with manual tokenization (and for usages of `String.split`, the "regex" is changed to single characters for which `String.split` has a fast-path implementation that avoids the regular expression engine). This seems a real backward step. I think some finer grain analysis is needed to work through specific issues, e.g. maybe startup with the regex usage and report back on how much that helps. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14216#issuecomment-1571420444 From dholmes at openjdk.org Thu Jun 1 06:23:07 2023 From: dholmes at openjdk.org (David Holmes) Date: Thu, 1 Jun 2023 06:23:07 GMT Subject: RFR: 8308090: Add container tests for on-the-fly resource quota updates [v2] In-Reply-To: References: Message-ID: On Tue, 23 May 2023 09:04:11 GMT, Severin Gehwolf wrote: >> Please review these test changes which implement automatic testing of container resource updates without JVM restart. Note that this merely tests container detection code handling this case. It doesn't do anything special for the JVM itself, though it might make sense to add some sanity checks should we detect certain limits changing. In another PR, though. >> >> As to the test design, it works similar to the shared temp tests: Interact between the two containers by virtue of a shared filesystem `/tmp` and creating marker files there in order to make them cooperate. Note that the new test needs `podman` version `4.3.0` and better (`4.5` is current). >> >> Testing: >> - [x] GHA >> - [x] Linux x86_64 container tests on cg v1 and cg v2 system >> - [x] Newly added tests on Linux x86_64 cg v1 and cg v2 (`podman` and `docker`) > > 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 three additional commits since the last revision: > > - Merge branch 'master' into jdk-8308090-tests-container-on-fly-updates > - Fix whitespace > - 8308090: Add container tests for on-the-fly resource quota updates These tests didn't fail but I couldn't properly validate the output as we don't seem to save the process stdout file. But I guess these are okay. Thanks. ------------- Marked as reviewed by dholmes (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14090#pullrequestreview-1454663420 From duke at openjdk.org Thu Jun 1 06:58:32 2023 From: duke at openjdk.org (SUN Guoyun) Date: Thu, 1 Jun 2023 06:58:32 GMT Subject: RFR: 8289220: [Shenandoah] TestAllocObjectArrays fails intermittently [v2] In-Reply-To: References: Message-ID: > command: make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp" TEST=gc/TestAllocHumongousFragment.java > error info: > > Caused by: java.lang.NullPointerException: Cannot invoke "sun.util.locale.BaseLocale.getVariant()" because "base" is null > at java.base/java.util.Locale.forLanguageTag(Locale.java:1802) > at java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.(CLDRBaseLocaleDataMetaInfo.java:41) > ... 24 more > > Note that the test runs with -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot and SoftReferences are involved (LocaleObjectCache uses SoftReferences, used by printf method called in getRandomInstance(Utils.java:511)). > > Maybe we have to deal with the case where the getBaseLocale() return value is null. the call stack is: > > at java.base/sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:64) > at java.base/sun.util.locale.BaseLocale.getInstance(BaseLocale.java:169) > at java.base/sun.util.locale.InternalLocaleBuilder.getBaseLocale(InternalLocaleBuilder.java:524) > at java.base/java.util.Locale.forLanguageTag(Locale.java:1874) > > in LocaleObjectCache.java:64 > > 62 if (key == null || newVal == null) { > 63 // subclass must return non-null key/value object > 64 return null; // run here > 65 } SUN Guoyun has updated the pull request incrementally with one additional commit since the last revision: 8289220: [Shenandoah] TestAllocObjectArrays fails intermittently ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14211/files - new: https://git.openjdk.org/jdk/pull/14211/files/31137f12..51883706 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14211&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14211&range=00-01 Stats: 20 lines in 3 files changed: 14 ins; 4 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/14211.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14211/head:pull/14211 PR: https://git.openjdk.org/jdk/pull/14211 From alanb at openjdk.org Thu Jun 1 07:12:09 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 1 Jun 2023 07:12:09 GMT Subject: RFR: 8289220: [Shenandoah] TestAllocObjectArrays fails intermittently [v2] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 06:58:32 GMT, SUN Guoyun wrote: >> command: make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp" TEST=gc/TestAllocHumongousFragment.java >> error info: >> >> Caused by: java.lang.NullPointerException: Cannot invoke "sun.util.locale.BaseLocale.getVariant()" because "base" is null >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1802) >> at java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.(CLDRBaseLocaleDataMetaInfo.java:41) >> ... 24 more >> >> Note that the test runs with -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot and SoftReferences are involved (LocaleObjectCache uses SoftReferences, used by printf method called in getRandomInstance(Utils.java:511)). >> >> Maybe we have to deal with the case where the getBaseLocale() return value is null. the call stack is: >> >> at java.base/sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:64) >> at java.base/sun.util.locale.BaseLocale.getInstance(BaseLocale.java:169) >> at java.base/sun.util.locale.InternalLocaleBuilder.getBaseLocale(InternalLocaleBuilder.java:524) >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1874) >> >> in LocaleObjectCache.java:64 >> >> 62 if (key == null || newVal == null) { >> 63 // subclass must return non-null key/value object >> 64 return null; // run here >> 65 } > > SUN Guoyun has updated the pull request incrementally with one additional commit since the last revision: > > 8289220: [Shenandoah] TestAllocObjectArrays fails intermittently I've moved the issue to core-libs/java.util:i18n and change the title of the JBS issue to make it clearer what this is about. Can you adjust the PR description too as this is not ShenandoahGC issue. @naotoj We might want to think about adding more tests in this area to ensure that the locale cache is stress tested. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14211#issuecomment-1571481539 From jwaters at openjdk.org Thu Jun 1 07:12:39 2023 From: jwaters at openjdk.org (Julian Waters) Date: Thu, 1 Jun 2023 07:12:39 GMT Subject: RFR: 8308780: Fix the Java Integer types on Windows [v2] In-Reply-To: <-mAb3g-jnRbOa0PFdM8gVP-8zI8CRGwxPvSdXd3uPm8=.2e6ab688-3ca1-4b8a-8674-5245c3f7557f@github.com> References: <-mAb3g-jnRbOa0PFdM8gVP-8zI8CRGwxPvSdXd3uPm8=.2e6ab688-3ca1-4b8a-8674-5245c3f7557f@github.com> Message-ID: > On Windows, the basic Java Integer types are defined as long and __int64 respectively. In particular, the former is rather problematic since it breaks compilation as the Visual C++ becomes stricter and more compliant with every release, which means the way Windows code treats long as a typedef for int is no longer correct, especially with -permissive- enabled. Instead of changing every piece of broken code to match the jint = long typedef, which is far too time consuming, we can instead change jint to an int (which is still the same 32 bit number type as long), as there are far fewer problems caused by this definition. It's better to get this over and done with sooner than later when a future version of Visual C++ finally starts to break on existing code Julian Waters has updated the pull request incrementally with one additional commit since the last revision: Revert changes to jaccesswalker and add proper cast to offending callsite ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14125/files - new: https://git.openjdk.org/jdk/pull/14125/files/b925f5ee..628be6b2 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14125&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14125&range=00-01 Stats: 7 lines in 2 files changed: 0 ins; 0 del; 7 mod Patch: https://git.openjdk.org/jdk/pull/14125.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14125/head:pull/14125 PR: https://git.openjdk.org/jdk/pull/14125 From jwaters at openjdk.org Thu Jun 1 07:14:55 2023 From: jwaters at openjdk.org (Julian Waters) Date: Thu, 1 Jun 2023 07:14:55 GMT Subject: RFR: 8308780: Fix the Java Integer types on Windows [v3] In-Reply-To: <-mAb3g-jnRbOa0PFdM8gVP-8zI8CRGwxPvSdXd3uPm8=.2e6ab688-3ca1-4b8a-8674-5245c3f7557f@github.com> References: <-mAb3g-jnRbOa0PFdM8gVP-8zI8CRGwxPvSdXd3uPm8=.2e6ab688-3ca1-4b8a-8674-5245c3f7557f@github.com> Message-ID: > On Windows, the basic Java Integer types are defined as long and __int64 respectively. In particular, the former is rather problematic since it breaks compilation as the Visual C++ becomes stricter and more compliant with every release, which means the way Windows code treats long as a typedef for int is no longer correct, especially with -permissive- enabled. Instead of changing every piece of broken code to match the jint = long typedef, which is far too time consuming, we can instead change jint to an int (which is still the same 32 bit number type as long), as there are far fewer problems caused by this definition. It's better to get this over and done with sooner than later when a future version of Visual C++ finally starts to break on existing code Julian Waters has updated the pull request incrementally with one additional commit since the last revision: Nevermind ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14125/files - new: https://git.openjdk.org/jdk/pull/14125/files/628be6b2..29b93688 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14125&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14125&range=01-02 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14125.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14125/head:pull/14125 PR: https://git.openjdk.org/jdk/pull/14125 From sgehwolf at openjdk.org Thu Jun 1 08:24:06 2023 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Thu, 1 Jun 2023 08:24:06 GMT Subject: RFR: 8308090: Add container tests for on-the-fly resource quota updates [v2] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 02:16:12 GMT, David Holmes wrote: >> Anyone willing to review this? > > @jerboaa I can't really review the tests themselves but will run through our CI to see if they cause any problems. If not then they should be okay to add. Thanks @dholmes-ora for running them through your CI. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14090#issuecomment-1571584032 From shade at openjdk.org Thu Jun 1 08:58:17 2023 From: shade at openjdk.org (Aleksey Shipilev) Date: Thu, 1 Jun 2023 08:58:17 GMT Subject: RFR: 8308803: Improve java/util/UUID/UUIDTest.java [v3] In-Reply-To: <1uO4gDP7bumdfeOHtKPz_jeu25sS0djvvpAmuI44XjU=.113adccc-9bff-421b-be26-5350e00126d5@github.com> References: <1uO4gDP7bumdfeOHtKPz_jeu25sS0djvvpAmuI44XjU=.113adccc-9bff-421b-be26-5350e00126d5@github.com> Message-ID: On Wed, 31 May 2023 14:53:09 GMT, Aleksey Shipilev wrote: >> UUID is very important class that is used to track identities of objects in large scale systems. Yet, the coverage in JDK test is disappointing: it tests only 100 of UUID instances per test, which is way too small to detect collisions due to the bad randomness for example. >> >> I have some pending work to improve UUID performance, and tests should be improved. >> >> The improved test still runs in less than 5 seconds on my laptop. > > Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision: > > Collect collisions and report them once at the end Thanks! ------------- PR Comment: https://git.openjdk.org/jdk/pull/14134#issuecomment-1571630408 From duke at openjdk.org Thu Jun 1 08:58:23 2023 From: duke at openjdk.org (SUN Guoyun) Date: Thu, 1 Jun 2023 08:58:23 GMT Subject: RFR: 8289220: [Shenandoah] TestAllocObjectArrays fails intermittently [v3] In-Reply-To: References: Message-ID: > command: make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp" TEST=gc/TestAllocHumongousFragment.java > error info: > > Caused by: java.lang.NullPointerException: Cannot invoke "sun.util.locale.BaseLocale.getVariant()" because "base" is null > at java.base/java.util.Locale.forLanguageTag(Locale.java:1802) > at java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.(CLDRBaseLocaleDataMetaInfo.java:41) > ... 24 more > > Note that the test runs with -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot and SoftReferences are involved (LocaleObjectCache uses SoftReferences, used by printf method called in getRandomInstance(Utils.java:511)). > > Maybe we have to deal with the case where the getBaseLocale() return value is null. the call stack is: > > at java.base/sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:64) > at java.base/sun.util.locale.BaseLocale.getInstance(BaseLocale.java:169) > at java.base/sun.util.locale.InternalLocaleBuilder.getBaseLocale(InternalLocaleBuilder.java:524) > at java.base/java.util.Locale.forLanguageTag(Locale.java:1874) > > in LocaleObjectCache.java:64 > > 62 if (key == null || newVal == null) { > 63 // subclass must return non-null key/value object > 64 return null; // run here > 65 } SUN Guoyun has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14211/files - new: https://git.openjdk.org/jdk/pull/14211/files/51883706..a09f1b6f Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14211&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14211&range=01-02 Stats: 0 lines in 0 files changed: 0 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/14211.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14211/head:pull/14211 PR: https://git.openjdk.org/jdk/pull/14211 From shade at openjdk.org Thu Jun 1 08:58:18 2023 From: shade at openjdk.org (Aleksey Shipilev) Date: Thu, 1 Jun 2023 08:58:18 GMT Subject: Integrated: 8308803: Improve java/util/UUID/UUIDTest.java In-Reply-To: References: Message-ID: On Wed, 24 May 2023 19:18:33 GMT, Aleksey Shipilev wrote: > UUID is very important class that is used to track identities of objects in large scale systems. Yet, the coverage in JDK test is disappointing: it tests only 100 of UUID instances per test, which is way too small to detect collisions due to the bad randomness for example. > > I have some pending work to improve UUID performance, and tests should be improved. > > The improved test still runs in less than 5 seconds on my laptop. This pull request has now been integrated. Changeset: 4460429d Author: Aleksey Shipilev URL: https://git.openjdk.org/jdk/commit/4460429d7a50b9a7a99058ef4e5ae36fb30b956f Stats: 187 lines in 1 file changed: 107 ins; 0 del; 80 mod 8308803: Improve java/util/UUID/UUIDTest.java Reviewed-by: jpai, rriggs ------------- PR: https://git.openjdk.org/jdk/pull/14134 From duke at openjdk.org Thu Jun 1 09:06:09 2023 From: duke at openjdk.org (SUN Guoyun) Date: Thu, 1 Jun 2023 09:06:09 GMT Subject: RFR: 8289220: [Shenandoah] TestAllocObjectArrays fails intermittently [v3] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 08:58:23 GMT, SUN Guoyun wrote: >> command: make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp" TEST=gc/TestAllocHumongousFragment.java >> error info: >> >> Caused by: java.lang.NullPointerException: Cannot invoke "sun.util.locale.BaseLocale.getVariant()" because "base" is null >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1802) >> at java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.(CLDRBaseLocaleDataMetaInfo.java:41) >> ... 24 more >> >> Note that the test runs with -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot and SoftReferences are involved (LocaleObjectCache uses SoftReferences, used by printf method called in getRandomInstance(Utils.java:511)). >> >> Maybe we have to deal with the case where the getBaseLocale() return value is null. the call stack is: >> >> at java.base/sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:64) >> at java.base/sun.util.locale.BaseLocale.getInstance(BaseLocale.java:169) >> at java.base/sun.util.locale.InternalLocaleBuilder.getBaseLocale(InternalLocaleBuilder.java:524) >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1874) >> >> in LocaleObjectCache.java:64 >> >> 62 if (key == null || newVal == null) { >> 63 // subclass must return non-null key/value object >> 64 return null; // run here >> 65 } > > SUN Guoyun has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision: > > 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared I've done basic testing jtreg tier1-3 and partial shenandoah testing with vmoptions `-Xcomp -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot`, the results are all OK. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14211#issuecomment-1571644464 From mdoerr at openjdk.org Thu Jun 1 09:11:16 2023 From: mdoerr at openjdk.org (Martin Doerr) Date: Thu, 1 Jun 2023 09:11:16 GMT Subject: RFR: 8308452: Extend internal Architecture enum with byte order and address size [v4] In-Reply-To: References: <_Fr_0vFGxkzKl26U0eh0V088HjtpWmOjR6E5vYrwVLw=.9d7b5195-778c-4546-92bf-1730a8550fbc@github.com> Message-ID: <2lQeeCNjItICpnVrL0J04ny7JA-Z7vNXZvitH-oALLc=.93aeb01f-9885-4e26-8c2a-dffb016589c4@github.com> On Wed, 31 May 2023 18:25:18 GMT, Roger Riggs wrote: >> The internal enum jdk.internal.util.Architecture does not provide information about the big or little endianness or the address size (64 or 32 bits). The endian-ness and address size are intrinsic to the architecture. >> >> The values of the enum are extended to separately identify the big endian and little-endian uses of the ISA. >> For example, `PPC64` and `PPC64LE` for the big and little-endian versions. >> The enum values directly reflect the build-time artifacts and resulting executables. >> >> This information about an architecture will make the enum more useful especially to identify a target platform in a cross-platform use case. A method is added to map well known aliases for the platforms to the Architecture enum. > > Roger Riggs has updated the pull request incrementally with one additional commit since the last revision: > > Remove duplicate import Thanks for the updates! LGTM. ------------- Marked as reviewed by mdoerr (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14063#pullrequestreview-1454964630 From stuefe at openjdk.org Thu Jun 1 09:13:16 2023 From: stuefe at openjdk.org (Thomas Stuefe) Date: Thu, 1 Jun 2023 09:13:16 GMT Subject: RFR: 8307990: jspawnhelper must close its writing side of a pipe before reading from it [v8] In-Reply-To: References: Message-ID: On Tue, 30 May 2023 13:19:37 GMT, Volker Simonis wrote: >> Since JDK13, executing commands in a sub-process defaults to the so called `POSIX_SPAWN` launching mechanism (i.e. `-Djdk.lang.Process.launchMechanism=POSIX_SPAWN`) on Linux. This works by using `posix_spawn(3)` to firstly start a tiny helper program called `jspawnhelper` in a subprocess. In a second step, `jspawnhelper` reads the command data from the parent Java process over a Unix pipe and finally executes (i.e. `execvp(3)`) the requested command. >> >> In cases where the parent process terminates abnormally before `jspawnhelper` has read all the expected data from the pipe, `jspawnhelper` will block indefinitely on the reading end of the pipe. This is especially harmful if the parent process had open sockets, because in that case, the forked `jspawnhelper` process will inherit them and keep all the corresponding ports open effectively preventing other processes to bind to them. Notice that this is not an abstract scenario. We've observed this regularly in production with services which couldn't be restarted after a crash after migrating to JDK 17. >> >> The fix of the issue is rather trivial. `jspawnhelper` has to close its writing end of the pipe which connects it with the parent Java process *before* starting to read from that pipe such that reads from the pipe can immediately return with EOF if the parent process terminates abnormally. >> >> Also did some cleanup: >> - in `jspawnhelper.c` correctly chek the result of `readFully()` >> - in `ProcessImpl_md.c` use `restartableWrite()` instead of `write()` to write the command data from the parent process to `jspawnhelper` >> - in `childproc.{c,h}` remove remaining traces of `MODE_CLONE` because that's long gone. > > Volker Simonis has updated the pull request incrementally with one additional commit since the last revision: > > Enable JspawnhelperProtocol test on AIX as well because AIX also uses posix_spawn I gave this a cursory eye, unfortunately i'm too snowed in atm for more. It looks good to me, your reasoning makes sense. Very good job finding and fixing this, and describing the issue. About FD_Cloexec , thus can be done in a later change. ------------- Marked as reviewed by stuefe (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/13956#pullrequestreview-1454968540 From shade at openjdk.org Thu Jun 1 09:37:29 2023 From: shade at openjdk.org (Aleksey Shipilev) Date: Thu, 1 Jun 2023 09:37:29 GMT Subject: RFR: 8308804: Improve UUID.randomUUID performance with bulk/scalable PRNG access [v7] In-Reply-To: References: Message-ID: > UUID is the very important class that is used to track identities of objects in large scale systems. On some of our systems, `UUID.randomUUID` takes >1% of total CPU time, and is frequently a scalability bottleneck due to `SecureRandom` synchronization. > > The major issue with UUID code itself is that it reads from the single `SecureRandom` instance by 16 bytes. So the heavily contended `SecureRandom` is bashed with very small requests. This also has a chilling effect on other users of `SecureRandom`, when there is a heavy UUID generation traffic. > > We can improve this by doing the bulk reads from the backing SecureRandom and possibly striping the reads across many instances of it. > > > Benchmark Mode Cnt Score Error Units > > ### AArch64 (m6g.4xlarge, Graviton, 16 cores) > > # Before > UUIDRandomBench.single thrpt 15 3.545 ? 0.058 ops/us > UUIDRandomBench.max thrpt 15 1.832 ? 0.059 ops/us ; negative scaling > > # After > UUIDRandomBench.single thrpt 15 4.823 ? 0.023 ops/us > UUIDRandomBench.max thrpt 15 6.561 ? 0.054 ops/us ; positive scaling, ~1.5x > > ### x86_64 (c6.8xlarge, Xeon, 18 cores) > > # Before > UUIDRandomBench.single thrpt 15 2.710 ? 0.038 ops/us > UUIDRandomBench.max thrpt 15 1.880 ? 0.029 ops/us ; negative scaling > > # After > Benchmark Mode Cnt Score Error Units > UUIDRandomBench.single thrpt 15 3.109 ? 0.026 ops/us > UUIDRandomBench.max thrpt 15 3.561 ? 0.071 ops/us ; positive scaling, ~1.2x > > > Note that there is still a scalability bottleneck in current default random (`NativePRNG`), because it synchronizes over a singleton instance for SHA1 mixer, then the engine itself, etc. -- it is quite a whack-a-mole to figure out the synchronization story there. The scalability fix in current default `SecureRandom` would be much more intrusive and risky, since it would change a core crypto class with unknown bug fanout. > > Using the bulk reads even when the underlying PRNG is heavily synchronized is still a win. A more scalable PRNG would benefit from this as well. This PR adds a system property to select the PRNG implementation, and there we can clearly see the benefit with more scalable PRNG sources: > > > Benchmark Mode Cnt Score Error Units > > ### x86_64 (c6.8xlarge, Xeon, 18 cores) > > # Before, hacked `new SecureRandom()` to `SecureRandom.getInstance("SHA1PRNG")` > UUIDRandomBench.single thrpt 15 3.661 ? 0.008 ops/us > UUIDRandomBench... Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 13 commits: - Revert test changes - Merge branch 'master' into JDK-8308804-uuid-buffers - Simplify clinit - Remove the properties - Swap lsb/msb - Fine-tune exceptions - Handle privileged properties - Use ByteArray to convert. Do version/variant preparations straight on locals. Move init out of optimistic lock section. - More touchups - Comment updates - ... and 3 more: https://git.openjdk.org/jdk/compare/4460429d...fd7eaa1a ------------- Changes: https://git.openjdk.org/jdk/pull/14135/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14135&range=06 Stats: 197 lines in 2 files changed: 186 ins; 8 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/14135.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14135/head:pull/14135 PR: https://git.openjdk.org/jdk/pull/14135 From sgehwolf at openjdk.org Thu Jun 1 10:29:12 2023 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Thu, 1 Jun 2023 10:29:12 GMT Subject: RFR: 8309191: Reduce JDK dependencies of cgroup support In-Reply-To: References: Message-ID: On Tue, 30 May 2023 13:03:27 GMT, Aleksandar Pejovi? wrote: > The current code for cgroup support in the JDK has large and expensive dependencies: it uses NIO, streams, and regular expressions. This leads to unnecessary class loading and slows down startup, especially when the code is executed early during an application startup. This is especially a problem for GraalVM, which executes this code during VM startup. > > This PR reduces the dependencies: > - NIO is replaced with regular `java.io` for file access. > - Streams are replaced with loops (a side effect of this is that files are read in full whereas previously they could be read up to a certain point, e.g., until a match is found). > - Regular expressions are replaced with manual tokenization (and for usages of `String.split`, the "regex" is changed to single characters for which `String.split` has a fast-path implementation that avoids the regular expression engine). I'm concerned about the hard-coding of delimiter values and the added accidential complexity in order to avoid the Regex engine. Note that this test fails due to the delimiter hard-coding: jdk/internal/platform/cgroup/TestCgroupSubsystemFactory.java This change seems hard to maintain. How would you ensure this won't regress? src/java.base/linux/classes/jdk/internal/platform/CgroupInfo.java line 110: > 108: */ > 109: static CgroupInfo fromCgroupsLine(String line) { > 110: String[] tokens = line.split("\t"); With this change, we now hard-code the expected delimiter and, thus, depend on what the kernel does. Do we have sufficient evidence this hasn't changed/won't change in the future? src/java.base/linux/classes/jdk/internal/platform/CgroupSubsystemFactory.java line 97: > 95: Logger logger = System.getLogger("jdk.internal.platform"); > 96: logger.log(Level.DEBUG, msg); > 97: } This seems fine and uncontroversial. Suggested name change `log` over `warn`. Perhaps apply this as a separate change? src/java.base/linux/classes/jdk/internal/platform/CgroupSubsystemFactory.java line 347: > 345: int separatorOrdinal = -1; > 346: // loop over space-separated tokens > 347: for (int tOrdinal = 1, tStart = 0, tEnd = line.indexOf(' '); tEnd != -1; tOrdinal++, tStart = tEnd + 1, tEnd = line.indexOf(' ', tStart)) { AFAIK, this now also hard-codes the delimiter: A single space. If we really want this custom parser, please add a unit test for it and extract it to a separate class. A hypothetical line like the following would confuse the parser, setting ordinal to wrong values: 36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - cgroup /dev/root rw,errors=continue We'd have: `mountRoot = 98:0`, `mountPath = /mnt1`, `fsType = cgroup` since it expects single space separated values. Seems fragile. src/java.base/linux/classes/jdk/internal/platform/cgroupv1/CgroupV1SubsystemController.java line 109: > 107: } > 108: > 109: public static long convertHierachicalLimitLine(String line) { Pre-existing: typo `convertHierarchicalLimitLine` src/java.base/linux/classes/jdk/internal/platform/cgroupv1/CgroupV1SubsystemController.java line 110: > 108: > 109: public static long convertHierachicalLimitLine(String line) { > 110: String[] tokens = line.split(" "); Again, assumes single space (` `) delimited entries in `memory.stat`. I'm not sure we should hard-code this. src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java line 144: > 142: } > 143: // $MAX $PERIOD > 144: String[] tokens = cpuMaxRaw.split(" "); This seems OK. According to https://docs.kernel.org/admin-guide/cgroup-v2.html#format src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java line 362: > 360: return Long.valueOf(0); > 361: } > 362: String[] tokens = line.split(" "); This seems OK. According to https://docs.kernel.org/admin-guide/cgroup-v2.html#format ------------- PR Review: https://git.openjdk.org/jdk/pull/14216#pullrequestreview-1454929344 PR Review Comment: https://git.openjdk.org/jdk/pull/14216#discussion_r1212816038 PR Review Comment: https://git.openjdk.org/jdk/pull/14216#discussion_r1212909205 PR Review Comment: https://git.openjdk.org/jdk/pull/14216#discussion_r1212877800 PR Review Comment: https://git.openjdk.org/jdk/pull/14216#discussion_r1212882937 PR Review Comment: https://git.openjdk.org/jdk/pull/14216#discussion_r1212891278 PR Review Comment: https://git.openjdk.org/jdk/pull/14216#discussion_r1212906805 PR Review Comment: https://git.openjdk.org/jdk/pull/14216#discussion_r1212907029 From jlahoda at openjdk.org Thu Jun 1 10:40:06 2023 From: jlahoda at openjdk.org (Jan Lahoda) Date: Thu, 1 Jun 2023 10:40:06 GMT Subject: RFR: 8308856: jdk.internal.classfile.impl.EntryMap::nextPowerOfTwo math problem [v2] In-Reply-To: References: Message-ID: On Mon, 29 May 2023 08:05:23 GMT, Adam Sotona wrote: >> Fix of jdk.internal.classfile.impl.EntryMap::nextPowerOfTwo returning correct zero power of two. >> >> Please review. >> >> Thanks, >> Adam > > Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: > > Update src/java.base/share/classes/jdk/internal/classfile/impl/EntryMap.java > > Co-authored-by: Andrey Turbanov Looks OK to me. ------------- Marked as reviewed by jlahoda (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14148#pullrequestreview-1455145211 From simonis at openjdk.org Thu Jun 1 11:00:22 2023 From: simonis at openjdk.org (Volker Simonis) Date: Thu, 1 Jun 2023 11:00:22 GMT Subject: RFR: 8307990: jspawnhelper must close its writing side of a pipe before reading from it In-Reply-To: <61e5pVShTICWmDodgIDEACwz-NJB6OMUOw2crLQ2zTE=.2fc8ed80-5979-45c1-8797-ac2a8b47157e@github.com> References: <61e5pVShTICWmDodgIDEACwz-NJB6OMUOw2crLQ2zTE=.2fc8ed80-5979-45c1-8797-ac2a8b47157e@github.com> Message-ID: <7gUtfmZtgqr5ZyxxR24J1CCjWeiFggnWXYpJGcro1Ic=.db7f9ee0-e50f-424a-a7d1-a5ec6853436a@github.com> On Fri, 19 May 2023 15:43:30 GMT, Roger Riggs wrote: >>> Sorry, but I don't understand this argument. If we do a short read we will work with corrupted ChildStuff and SpawnInfo >>> structures. This can in the extreme case execute arbitrary code (e.g. if ChildStuff.argv is not fully read from the parent). You are >>> basically saying it is better to work on corrupted data rather than reporting an error. >> >> No I am simply pointing out that this has changed more than just the issue with close. And maybe a short-read does indicate data "corruption" and maybe it should be a fatal error. But I don't know exactly how this might manifest so perhaps there are benign short-reads that actually do happen. Regardless it might be better to split this part out and focus on the close issue here. > >> > Sorry, but I don't understand this argument. If we do a short read we will work with corrupted ChildStuff and SpawnInfo >> > structures. This can in the extreme case execute arbitrary code (e.g. if ChildStuff.argv is not fully read from the parent). You are >> > basically saying it is better to work on corrupted data rather than reporting an error. >> >> No I am simply pointing out that this has changed more than just the issue with close. And maybe a short-read does indicate data "corruption" and maybe it should be a fatal error. But I don't know exactly how this might manifest so perhaps there are benign short-reads that actually do happen. Regardless it might be better to split this part out and focus on the close issue here. > > Given the purpose and implementation of the `readFully` function, I don't see how it can return anything other than an error or the full requested read length. Thanks @RogerRiggs and @tstuefe for your help and patience with this PR. I've now updated the [Release Note](https://bugs.openjdk.org/browse/JDK-8308297) for this change to also include the error scenario described by @mlichtblau . ------------- PR Comment: https://git.openjdk.org/jdk/pull/13956#issuecomment-1571822491 From simonis at openjdk.org Thu Jun 1 11:00:23 2023 From: simonis at openjdk.org (Volker Simonis) Date: Thu, 1 Jun 2023 11:00:23 GMT Subject: Integrated: 8307990: jspawnhelper must close its writing side of a pipe before reading from it In-Reply-To: References: Message-ID: On Fri, 12 May 2023 15:24:19 GMT, Volker Simonis wrote: > Since JDK13, executing commands in a sub-process defaults to the so called `POSIX_SPAWN` launching mechanism (i.e. `-Djdk.lang.Process.launchMechanism=POSIX_SPAWN`) on Linux. This works by using `posix_spawn(3)` to firstly start a tiny helper program called `jspawnhelper` in a subprocess. In a second step, `jspawnhelper` reads the command data from the parent Java process over a Unix pipe and finally executes (i.e. `execvp(3)`) the requested command. > > In cases where the parent process terminates abnormally before `jspawnhelper` has read all the expected data from the pipe, `jspawnhelper` will block indefinitely on the reading end of the pipe. This is especially harmful if the parent process had open sockets, because in that case, the forked `jspawnhelper` process will inherit them and keep all the corresponding ports open effectively preventing other processes to bind to them. Notice that this is not an abstract scenario. We've observed this regularly in production with services which couldn't be restarted after a crash after migrating to JDK 17. > > The fix of the issue is rather trivial. `jspawnhelper` has to close its writing end of the pipe which connects it with the parent Java process *before* starting to read from that pipe such that reads from the pipe can immediately return with EOF if the parent process terminates abnormally. > > Also did some cleanup: > - in `jspawnhelper.c` correctly chek the result of `readFully()` > - in `ProcessImpl_md.c` use `restartableWrite()` instead of `write()` to write the command data from the parent process to `jspawnhelper` > - in `childproc.{c,h}` remove remaining traces of `MODE_CLONE` because that's long gone. This pull request has now been integrated. Changeset: 39f6d807 Author: Volker Simonis URL: https://git.openjdk.org/jdk/commit/39f6d807dbbe0c9ecd72fe2f76bfbc3091b43c80 Stats: 389 lines in 5 files changed: 351 ins; 11 del; 27 mod 8307990: jspawnhelper must close its writing side of a pipe before reading from it Reviewed-by: stuefe, rriggs ------------- PR: https://git.openjdk.org/jdk/pull/13956 From duke at openjdk.org Thu Jun 1 11:09:26 2023 From: duke at openjdk.org (Marius Lichtblau) Date: Thu, 1 Jun 2023 11:09:26 GMT Subject: RFR: 8307990: jspawnhelper must close its writing side of a pipe before reading from it In-Reply-To: <7gUtfmZtgqr5ZyxxR24J1CCjWeiFggnWXYpJGcro1Ic=.db7f9ee0-e50f-424a-a7d1-a5ec6853436a@github.com> References: <61e5pVShTICWmDodgIDEACwz-NJB6OMUOw2crLQ2zTE=.2fc8ed80-5979-45c1-8797-ac2a8b47157e@github.com> <7gUtfmZtgqr5ZyxxR24J1CCjWeiFggnWXYpJGcro1Ic=.db7f9ee0-e50f-424a-a7d1-a5ec6853436a@github.com> Message-ID: On Thu, 1 Jun 2023 10:55:26 GMT, Volker Simonis wrote: >>> > Sorry, but I don't understand this argument. If we do a short read we will work with corrupted ChildStuff and SpawnInfo >>> > structures. This can in the extreme case execute arbitrary code (e.g. if ChildStuff.argv is not fully read from the parent). You are >>> > basically saying it is better to work on corrupted data rather than reporting an error. >>> >>> No I am simply pointing out that this has changed more than just the issue with close. And maybe a short-read does indicate data "corruption" and maybe it should be a fatal error. But I don't know exactly how this might manifest so perhaps there are benign short-reads that actually do happen. Regardless it might be better to split this part out and focus on the close issue here. >> >> Given the purpose and implementation of the `readFully` function, I don't see how it can return anything other than an error or the full requested read length. > > Thanks @RogerRiggs and @tstuefe for your help and patience with this PR. I've now updated the [Release Note](https://bugs.openjdk.org/browse/JDK-8308297) for this change to also include the error scenario described by @mlichtblau . Hey @simonis, thank you for taking the time to include our problem in the fix. I appreciate the detailed explanation of your fix! ------------- PR Comment: https://git.openjdk.org/jdk/pull/13956#issuecomment-1571841021 From jwaters at openjdk.org Thu Jun 1 11:49:24 2023 From: jwaters at openjdk.org (Julian Waters) Date: Thu, 1 Jun 2023 11:49:24 GMT Subject: RFR: 8308780: Fix the Java Integer types on Windows [v4] In-Reply-To: <-mAb3g-jnRbOa0PFdM8gVP-8zI8CRGwxPvSdXd3uPm8=.2e6ab688-3ca1-4b8a-8674-5245c3f7557f@github.com> References: <-mAb3g-jnRbOa0PFdM8gVP-8zI8CRGwxPvSdXd3uPm8=.2e6ab688-3ca1-4b8a-8674-5245c3f7557f@github.com> Message-ID: <3VAC9z-WjItzbkXeNreX7PGi18ypbaom-RjBJgHb9L4=.1e90295d-c012-47dd-b5fe-fa7889ce2c84@github.com> > On Windows, the basic Java Integer types are defined as long and __int64 respectively. In particular, the former is rather problematic since it breaks compilation as the Visual C++ becomes stricter and more compliant with every release, which means the way Windows code treats long as a typedef for int is no longer correct, especially with -permissive- enabled. Instead of changing every piece of broken code to match the jint = long typedef, which is far too time consuming, we can instead change jint to an int (which is still the same 32 bit number type as long), as there are far fewer problems caused by this definition. It's better to get this over and done with sooner than later when a future version of Visual C++ finally starts to break on existing code Julian Waters has updated the pull request incrementally with one additional commit since the last revision: Fix the code that is actually warning ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14125/files - new: https://git.openjdk.org/jdk/pull/14125/files/29b93688..5fa2d3eb Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14125&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14125&range=02-03 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/14125.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14125/head:pull/14125 PR: https://git.openjdk.org/jdk/pull/14125 From asotona at openjdk.org Thu Jun 1 11:53:13 2023 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 1 Jun 2023 11:53:13 GMT Subject: Integrated: 8308856: jdk.internal.classfile.impl.EntryMap::nextPowerOfTwo math problem In-Reply-To: References: Message-ID: On Thu, 25 May 2023 12:24:59 GMT, Adam Sotona wrote: > Fix of jdk.internal.classfile.impl.EntryMap::nextPowerOfTwo returning correct zero power of two. > > Please review. > > Thanks, > Adam This pull request has now been integrated. Changeset: a6109bf1 Author: Adam Sotona URL: https://git.openjdk.org/jdk/commit/a6109bf1ea2acbebd6a3517813c0b82fdba00c2f Stats: 2 lines in 1 file changed: 0 ins; 1 del; 1 mod 8308856: jdk.internal.classfile.impl.EntryMap::nextPowerOfTwo math problem Reviewed-by: jlahoda ------------- PR: https://git.openjdk.org/jdk/pull/14148 From jwaters at openjdk.org Thu Jun 1 11:59:05 2023 From: jwaters at openjdk.org (Julian Waters) Date: Thu, 1 Jun 2023 11:59:05 GMT Subject: RFR: 8308780: Fix the Java Integer types on Windows [v4] In-Reply-To: <3VAC9z-WjItzbkXeNreX7PGi18ypbaom-RjBJgHb9L4=.1e90295d-c012-47dd-b5fe-fa7889ce2c84@github.com> References: <-mAb3g-jnRbOa0PFdM8gVP-8zI8CRGwxPvSdXd3uPm8=.2e6ab688-3ca1-4b8a-8674-5245c3f7557f@github.com> <3VAC9z-WjItzbkXeNreX7PGi18ypbaom-RjBJgHb9L4=.1e90295d-c012-47dd-b5fe-fa7889ce2c84@github.com> Message-ID: On Thu, 1 Jun 2023 11:49:24 GMT, Julian Waters wrote: >> On Windows, the basic Java Integer types are defined as long and __int64 respectively. In particular, the former is rather problematic since it breaks compilation as the Visual C++ becomes stricter and more compliant with every release, which means the way Windows code treats long as a typedef for int is no longer correct, especially with -permissive- enabled. Instead of changing every piece of broken code to match the jint = long typedef, which is far too time consuming, we can instead change jint to an int (which is still the same 32 bit number type as long), as there are far fewer problems caused by this definition. It's better to get this over and done with sooner than later when a future version of Visual C++ finally starts to break on existing code > > Julian Waters has updated the pull request incrementally with one additional commit since the last revision: > > Fix the code that is actually warning While looking through the code for this I've come to realize that a staggering amount of code in the accessibility binaries specify longs where unsigned longs would be much more appropriate (see the one example in this PR for instance), wonder if this should also be fixed in the long term too ------------- PR Comment: https://git.openjdk.org/jdk/pull/14125#issuecomment-1571912910 From sgehwolf at openjdk.org Thu Jun 1 12:04:08 2023 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Thu, 1 Jun 2023 12:04:08 GMT Subject: RFR: 8309191: Reduce JDK dependencies of cgroup support In-Reply-To: References: Message-ID: On Tue, 30 May 2023 13:03:27 GMT, Aleksandar Pejovi? wrote: > The current code for cgroup support in the JDK has large and expensive dependencies: it uses NIO, streams, and regular expressions. This leads to unnecessary class loading and slows down startup, especially when the code is executed early during an application startup. This is especially a problem for GraalVM, which executes this code during VM startup. > > This PR reduces the dependencies: > - NIO is replaced with regular `java.io` for file access. > - Streams are replaced with loops (a side effect of this is that files are read in full whereas previously they could be read up to a certain point, e.g., until a match is found). > - Regular expressions are replaced with manual tokenization (and for usages of `String.split`, the "regex" is changed to single characters for which `String.split` has a fast-path implementation that avoids the regular expression engine). With my Mandrel hat on I support this change if it helps reducing duplication on the native-image side. It appears, though, we need to find a way that's supportable long-term. It's easy to introduce a new change to this code which accidentally drags in some of those (unwanted) dependencies again. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14216#issuecomment-1571922156 From alanb at openjdk.org Thu Jun 1 12:14:06 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 1 Jun 2023 12:14:06 GMT Subject: RFR: 8309191: Reduce JDK dependencies of cgroup support In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 12:01:15 GMT, Severin Gehwolf wrote: > It's easy to introduce a new change to this code which accidentally drags in some of those (unwanted) dependencies again. I do not like the changes proposed here, they are all crying out for several round cleanups and modernization. One thing that would help is to split this up into a series of changes that could be evaluated, e.g. the use of regex may be a significant part of this so maybe start with that, report back, then work through the iterations to make it clean and maintainable. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14216#issuecomment-1571939629 From jlaskey at openjdk.org Thu Jun 1 12:27:36 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Thu, 1 Jun 2023 12:27:36 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v25] In-Reply-To: References: Message-ID: > Add flexible main methods and anonymous main classes to the Java language. Jim Laskey has updated the pull request incrementally with one additional commit since the last revision: Restrict access to unnamed class members when doing separate compilation. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13689/files - new: https://git.openjdk.org/jdk/pull/13689/files/d0189fc2..4bfb8020 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=24 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=23-24 Stats: 8 lines in 2 files changed: 8 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/13689.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13689/head:pull/13689 PR: https://git.openjdk.org/jdk/pull/13689 From alanb at openjdk.org Thu Jun 1 12:31:34 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 1 Jun 2023 12:31:34 GMT Subject: RFR: 8309196: Remove Thread.countStackFrames Message-ID: <7p3wapZUnzfzFKMyOVexaMVGeh00epZs3ipgw-LpvDM=.86006e6e-060a-4d9b-a883-4983381cdba7@github.com> Thread.countStackFrames is/was an ill-defined method that dates from JDK 1.0 for counting the stack frames of a suspended Thread. The method was deprecated in JDK 1.2 (1998), deprecated for removal in Java 9, and re-specified/degraded to throw UOE unconditionally in Java 14. Java 22 would be a fine time to finally remove this method. Code that wants to count stack frames should be directed to use j.l.StackWalker, or if is a a tool, then it can use JVM TI and other tool APIs. A corpus analysis of 30M classes in 131k artifacts from Maven Central found only 1 usages to this method. The 1 usage appears to be a class that just wraps all methods, it doesn't actually make use of it. ------------- Commit messages: - Initial commit Changes: https://git.openjdk.org/jdk/pull/14257/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14257&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309196 Stats: 20 lines in 2 files changed: 0 ins; 17 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/14257.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14257/head:pull/14257 PR: https://git.openjdk.org/jdk/pull/14257 From jlaskey at openjdk.org Thu Jun 1 12:38:30 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Thu, 1 Jun 2023 12:38:30 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v26] In-Reply-To: References: Message-ID: > Add flexible main methods and anonymous main classes to the Java language. Jim Laskey has updated the pull request incrementally with one additional commit since the last revision: Missing Preview feature enum ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13689/files - new: https://git.openjdk.org/jdk/pull/13689/files/4bfb8020..850a2152 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=25 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=24-25 Stats: 2 lines in 1 file changed: 2 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/13689.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13689/head:pull/13689 PR: https://git.openjdk.org/jdk/pull/13689 From alanb at openjdk.org Thu Jun 1 12:45:10 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 1 Jun 2023 12:45:10 GMT Subject: RFR: 8303530: Redefine JAXP Configuration File [v15] In-Reply-To: <3a89aGPMevtuww_1Dc3KZxJzEzw_6I1jS9fRyp05thM=.a86422a5-13da-4ebb-8e65-16c3e008148b@github.com> References: <3a89aGPMevtuww_1Dc3KZxJzEzw_6I1jS9fRyp05thM=.a86422a5-13da-4ebb-8e65-16c3e008148b@github.com> Message-ID: On Wed, 31 May 2023 21:58:44 GMT, Joe Wang wrote: >> Add a system property, jdk.xml.config.file, to return the path to a custom JAXP configuration file. The current configuration file, jaxp.properties, that the JDK supports will become the default configuration file. >> >> CSR: https://bugs.openjdk.org/browse/JDK-8303531 >> >> Tests: XML SQE and JCK tests passed. > > Joe Wang has updated the pull request incrementally with one additional commit since the last revision: > > adjust javadoc I'm very happy where the spec changes have got to in this PR, esp. the module description and allowing a config file be specified with all configuration. ------------- Marked as reviewed by alanb (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/12985#pullrequestreview-1455379216 From alanb at openjdk.org Thu Jun 1 12:58:19 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 1 Jun 2023 12:58:19 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v16] In-Reply-To: References: Message-ID: On Tue, 23 May 2023 18:09:03 GMT, Jim Laskey wrote: > Yes. There is some juggling going on to get the code to align with the requirement and the interpretation thereof. Is this stable now, specifically the "Selecting a main method" section and the behavior change where an instance main takes precedence over an "inherited" static main? Just checking before doing another pass over the method finder. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1213112842 From duke at openjdk.org Thu Jun 1 13:02:11 2023 From: duke at openjdk.org (Brett Okken) Date: Thu, 1 Jun 2023 13:02:11 GMT Subject: RFR: 8308804: Improve UUID.randomUUID performance with bulk/scalable PRNG access [v7] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 09:37:29 GMT, Aleksey Shipilev wrote: >> UUID is the very important class that is used to track identities of objects in large scale systems. On some of our systems, `UUID.randomUUID` takes >1% of total CPU time, and is frequently a scalability bottleneck due to `SecureRandom` synchronization. >> >> The major issue with UUID code itself is that it reads from the single `SecureRandom` instance by 16 bytes. So the heavily contended `SecureRandom` is bashed with very small requests. This also has a chilling effect on other users of `SecureRandom`, when there is a heavy UUID generation traffic. >> >> We can improve this by doing the bulk reads from the backing SecureRandom and possibly striping the reads across many instances of it. >> >> >> Benchmark Mode Cnt Score Error Units >> >> ### AArch64 (m6g.4xlarge, Graviton, 16 cores) >> >> # Before >> UUIDRandomBench.single thrpt 15 3.545 ? 0.058 ops/us >> UUIDRandomBench.max thrpt 15 1.832 ? 0.059 ops/us ; negative scaling >> >> # After >> UUIDRandomBench.single thrpt 15 4.823 ? 0.023 ops/us >> UUIDRandomBench.max thrpt 15 6.561 ? 0.054 ops/us ; positive scaling, ~1.5x >> >> ### x86_64 (c6.8xlarge, Xeon, 18 cores) >> >> # Before >> UUIDRandomBench.single thrpt 15 2.710 ? 0.038 ops/us >> UUIDRandomBench.max thrpt 15 1.880 ? 0.029 ops/us ; negative scaling >> >> # After >> Benchmark Mode Cnt Score Error Units >> UUIDRandomBench.single thrpt 15 3.109 ? 0.026 ops/us >> UUIDRandomBench.max thrpt 15 3.561 ? 0.071 ops/us ; positive scaling, ~1.2x >> >> >> Note that there is still a scalability bottleneck in current default random (`NativePRNG`), because it synchronizes over a singleton instance for SHA1 mixer, then the engine itself, etc. -- it is quite a whack-a-mole to figure out the synchronization story there. The scalability fix in current default `SecureRandom` would be much more intrusive and risky, since it would change a core crypto class with unknown bug fanout. >> >> Using the bulk reads even when the underlying PRNG is heavily synchronized is still a win. A more scalable PRNG would benefit from this as well. This PR adds a system property to select the PRNG implementation, and there we can clearly see the benefit with more scalable PRNG sources: >> >> >> Benchmark Mode Cnt Score Error Units >> >> ### x86_64 (c6.8xlarge, Xeon, 18 cores) >> >> # Before, hacked `new SecureRandom()` to `SecureRandom.getInstance("SHA1PRNG")` >> UUIDRandomBench.single thrpt ... > > Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 13 commits: > > - Revert test changes > - Merge branch 'master' into JDK-8308804-uuid-buffers > - Simplify clinit > - Remove the properties > - Swap lsb/msb > - Fine-tune exceptions > - Handle privileged properties > - Use ByteArray to convert. Do version/variant preparations straight on locals. Move init out of optimistic lock section. > - More touchups > - Comment updates > - ... and 3 more: https://git.openjdk.org/jdk/compare/4460429d...fd7eaa1a src/java.base/share/classes/java/util/UUID.java line 234: > 232: long msb = ByteArray.getLong(buf, 0); > 233: long lsb = ByteArray.getLong(buf, 8); > 234: return fromRandom(msb, lsb); is there any value in moving this outside of the critical section? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14135#discussion_r1213117598 From shade at openjdk.org Thu Jun 1 13:05:12 2023 From: shade at openjdk.org (Aleksey Shipilev) Date: Thu, 1 Jun 2023 13:05:12 GMT Subject: RFR: 8308804: Improve UUID.randomUUID performance with bulk/scalable PRNG access [v7] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 12:59:14 GMT, Brett Okken wrote: >> Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 13 commits: >> >> - Revert test changes >> - Merge branch 'master' into JDK-8308804-uuid-buffers >> - Simplify clinit >> - Remove the properties >> - Swap lsb/msb >> - Fine-tune exceptions >> - Handle privileged properties >> - Use ByteArray to convert. Do version/variant preparations straight on locals. Move init out of optimistic lock section. >> - More touchups >> - Comment updates >> - ... and 3 more: https://git.openjdk.org/jdk/compare/4460429d...fd7eaa1a > > src/java.base/share/classes/java/util/UUID.java line 234: > >> 232: long msb = ByteArray.getLong(buf, 0); >> 233: long lsb = ByteArray.getLong(buf, 8); >> 234: return fromRandom(msb, lsb); > > is there any value in moving this outside of the critical section? I have tried it before, and it gives no benefit, but significantly complicates the code. This is the part under write lock, where we have spent a significant time refilling the buffer. The little improvement we might get here is drowning in those costs. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14135#discussion_r1213121408 From duke at openjdk.org Thu Jun 1 13:11:26 2023 From: duke at openjdk.org (JoKern65) Date: Thu, 1 Jun 2023 13:11:26 GMT Subject: Withdrawn: JDK-8308288: Fix xlc17 clang warnings in shared code In-Reply-To: References: Message-ID: On Thu, 25 May 2023 09:14:14 GMT, JoKern65 wrote: > When using the new xlc17 compiler (based on a recent clang) to build OpenJDk on AIX , we run into various "warnings as errors". > Some of those are in shared codebase and could be addressed by small adjustments. > A lot of those changes are in hotspot, some might be somewhere else in the OpenJDK C/C++ code. This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/jdk/pull/14146 From duke at openjdk.org Thu Jun 1 13:11:24 2023 From: duke at openjdk.org (JoKern65) Date: Thu, 1 Jun 2023 13:11:24 GMT Subject: RFR: JDK-8308288: Fix xlc17 clang warnings in shared code [v2] In-Reply-To: References: Message-ID: On Fri, 26 May 2023 08:31:46 GMT, JoKern65 wrote: >> When using the new xlc17 compiler (based on a recent clang) to build OpenJDk on AIX , we run into various "warnings as errors". >> Some of those are in shared codebase and could be addressed by small adjustments. >> A lot of those changes are in hotspot, some might be somewhere else in the OpenJDK C/C++ code. > > JoKern65 has updated the pull request incrementally with one additional commit since the last revision: > > forgotton _ Hi, As this PR is big and spans several components I split off the java.base, java.desktop and the sercivability/security issues into extra JBS issues. https://bugs.openjdk.org/browse/JDK-8309219 Fix xlc17 clang 1.5 warnings in java.base https://bugs.openjdk.org/browse/JDK-8309224 Fix xlc17 clang 1.5 warnings in java.desktop https://bugs.openjdk.org/browse/JDK-8309225 Fix xlc17 clang 1.5 warnings in security and servicability I?ll move the changes from this pull request into new pull requests. I will incorporate the requested changes right in the new PRs. I will reuse this issue 8308388 for the hotspot changes but come up with a new, smaller PR. @colleenp, I will move alloca.h to the globalDefinitions_xlc.hpp. @prrace, I will come up with an identical PR for the client files (java.desktop), but improve the comment as @kimbarrett proposed @mbaesken, I will use AIX and take up some of the other fixes you proposed. I guess we need to find a way to fix the issue with the malloc in globalDefinitions_xlc.hpp in the upcoming PR for hotspot. Thanks for your help so far! Hi, As this PR is big and spans several components I split off the java.base, java.desktop and the sercivability/security issues into extra JBS issues. https://bugs.openjdk.org/browse/JDK-8309219 Fix xlc17 clang 1.5 warnings in java.base https://bugs.openjdk.org/browse/JDK-8309224 Fix xlc17 clang 1.5 warnings in java.desktop https://bugs.openjdk.org/browse/JDK-8309225 Fix xlc17 clang 1.5 warnings in security and servicability I?ll move the changes from this pull request into new pull requests. I will incorporate the requested changes right in the new PRs. I will reuse this issue 8308388 for the hotspot changes but come up with a new, smaller PR. @colleenp, I will move alloca.h to the globalDefinitions_xlc.hpp. @prrace, I will come up with an identical PR for the client files (java.desktop), but improve the comment as @kimbarrett proposed @MBaesken, I will use AIX and take up some of the other fixes you proposed. I guess we need to find a way to fix the issue with the malloc in globalDefinitions_xlc.hpp in the upcoming PR for hotspot. Thanks for your help so far! ------------- PR Comment: https://git.openjdk.org/jdk/pull/14146#issuecomment-1572023812 PR Comment: https://git.openjdk.org/jdk/pull/14146#issuecomment-1572024628 From jlaskey at openjdk.org Thu Jun 1 13:13:20 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Thu, 1 Jun 2023 13:13:20 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v16] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 12:55:28 GMT, Alan Bateman wrote: >> Yes. There is some juggling going on to get the code to align with the requirement and the interpretation thereof. > >> Yes. There is some juggling going on to get the code to align with the requirement and the interpretation thereof. > > Is this stable now, specifically the "Selecting a main method" section and the behavior change where an instance main takes precedence over an "inherited" static main? Just checking before doing another pass over the method finder. I think so - additional changes will be coming from Joe via https://github.com/openjdk/jdk/pull/14165 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1213132645 From alanb at openjdk.org Thu Jun 1 13:42:18 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 1 Jun 2023 13:42:18 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: References: Message-ID: <3cPudNa3sSX5YbcoXvPy82F8-djLnh4b56Mdb0huj4k=.ce7e334a-d121-49bd-b478-f9fad49f50af@github.com> On Mon, 29 May 2023 10:53:52 GMT, Maurizio Cimadamore wrote: >> As the FFM API evolved over time, some parts of the javadoc went out of sync. Now that most of the API is stable, it is a good time to look again at the javadoc as a whole, and bring some more consistency. >> >> While most of the changes in this PR are stylistic, I'd like to call out few things which resulted in API changes: >> >> * `MemorySegment::asSlice(long, long, long)` did not (incorrectly) specified requirement that its alignment parameter must be a power of two. >> >> * `MemoryLayout::sliceHandle` did not require the absence of dereference paths in the provided layout path. While that is technically possible to allow, currently the method is specified as returning a "slice" corresponding to some "nested layout", so following pointers seems incompatible with the spec. I have decided to disallow for now - we can always compatibly enable it later, if required. >> >> * `MemorySegment::copy` - most of the overloads did not specify that `UnsupportedOperationException` is thrown if the destination segment is read-only. >> >> * In several places, an extra `@throws IllegalArgumentException` or `@throws IllegalArgumentException` has been added to capture cases where element size * index computation can overflow. This is true for all the element-wise segment copy methods, for the indexed accessors in memory segment (e.g. `MemorySegment.getAtIndex(ValueLayout.OfInt, long)`), as well as for `SegmentAllocator::allocateArray(MemoryLayout, long)`. >> >> In all these cases (except for overflows), new tests have been added to cover the additional API changes (a CSR will also be filed to cover these). >> >> The class with most changes is `MemoryLayout`. I realized that the javadoc there was a bit sloppy around the definition of "layout paths". Now there are several subsection in the class javadoc, which explain how different kinds of paths can be used. I have introduced the notion of "open path elements" to denote those path elements that are not fully specified, and result in additional var handle coordinates to be added. There is also now a definition of what it means for a layout path to be "well-formed", so that all methods accepting a layout path can simply refer to it (this definition is tricky to give inline in the javadoc of the various path-accepting methods, as it depends on many factors). >> >> Another biggie change was in `MemorySegment` as now all dereference methods state precisely their spatial checks requirements, as well also specifying when the API can th... > > Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: > > Fix wrong link in layout well-formedness doc src/java.base/share/classes/java/lang/foreign/AddressLayout.java line 116: > 114: /** > 115: * Returns an address layout with the same carrier, alignment constraint, name and order as this address layout, > 116: * but with no target layout Did you mean to drop the period from the end of the sentence? src/java.base/share/classes/java/lang/foreign/Arena.java line 269: > 267: * @throws IllegalStateException if this arena has already been {@linkplain #close() closed}. > 268: * @throws WrongThreadException if this arena is confined, and this method is called from a thread {@code T} > 269: * other than the arena's owner thread. "thread T" hints that "T" will be used later, maybe it's not needed. src/java.base/share/classes/java/lang/foreign/FunctionDescriptor.java line 38: > 36: /** > 37: * A function descriptor models the signature of a foreign function. A function descriptor is made up of zero or more > 38: * argument layouts and zero or one return layout. A function descriptor is used to create You might want want to put a comma after "layouts" to avoid any ambiguity. src/java.base/share/classes/java/lang/foreign/FunctionDescriptor.java line 57: > 55: > 56: /** > 57: * {@return the argument layouts of this function descriptor (as an immutable list)}. I assume this should be "unmodifiable" rather than immutable here. src/java.base/share/classes/java/lang/foreign/FunctionDescriptor.java line 127: > 125: /** > 126: * Creates a function descriptor with the given argument layouts and no return layout. This is useful to model functions > 127: * which return no values. I think I would use "that return" rather than "which return" here. src/java.base/share/classes/java/lang/foreign/Linker.java line 356: > 354: * attach the segment to some existing {@linkplain Arena arena}, so that the lifetime of the region of memory > 355: * backing the segment can be managed automatically, as for any other native segment created directly from Java code. > 356: * Both these operations are accomplished using the restricted method {@link MemorySegment#reinterpret(long, Arena, Consumer)}, I think this should be "Both of these operations". src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java line 325: > 323: * @return a segment for the newly allocated memory block. > 324: * @throws IllegalArgumentException if {@code elementLayout.byteSize() * count} overflows. > 325: * @throws IllegalArgumentException if {@code count < 0}. Another case where the IAE descriptions should probably be combined. src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java line 363: > 361: * The returned allocator throws {@link IndexOutOfBoundsException} when a slice of the provided > 362: * segment with the requested size and alignment cannot be found. > 363: * @implNote A slicing allocator is not thread-safe. The implNote about thread safety makes me wonder if the SegmentAllocator should say something about thread safety, e.g. should it specify that the allocate methods are thread safe? src/java.base/share/classes/java/lang/foreign/SequenceLayout.java line 75: > 73: * @return a sequence layout with the same characteristics of this layout, but with the given element count. > 74: * @throws IllegalArgumentException if {@code elementCount} is negative. > 75: * @throws IllegalArgumentException if {@code elementLayout.bitSize() * elementCount} overflows. Shouldn't the exception descriptions be combined to avoid IAE being listed twice in the generated javadoc? src/java.base/share/classes/java/lang/foreign/SymbolLookup.java line 57: > 55: *
  • It can be {@linkplain MemorySegment#set(AddressLayout, long, MemorySegment) stored} inside another memory segment.
  • > 56: *
  • It can be used to access the region of memory backing a global variable (this requires > 57: * {@link MemorySegment#reinterpret(long) resizing} the segment first).
  • This one probably should be linkplain. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213115981 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213119694 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213122457 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213123988 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213126349 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213130078 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213141790 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213171901 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213140568 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213138835 From alanb at openjdk.org Thu Jun 1 13:43:33 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 1 Jun 2023 13:43:33 GMT Subject: RFR: 8306647: Implementation of Structured Concurrency (Preview) [v4] In-Reply-To: <6gZZEoP1WXdBcZUiL5890eNsgaRFzZNY_rBItZdXtNc=.5d8f7bd9-44d5-4074-8a5c-35f8203263b2@github.com> References: <6gZZEoP1WXdBcZUiL5890eNsgaRFzZNY_rBItZdXtNc=.5d8f7bd9-44d5-4074-8a5c-35f8203263b2@github.com> Message-ID: > This is the implementation of: > > - JEP 453: Structured Concurrency (Preview) > - JEP 446: Scoped Values (Preview) > > For the most part, this is just moving code and tests. StructuredTaskScope moves to j.u.concurrent as a preview API, ScopedValue moves to j.lang as a preview API, and module jdk.incubator.concurrent has been removed. The significant API changes since incubator are: > > - StructuredTaskScope.fork returns Subtask instead of Future (JEP 453 has a section on this) > - ScopedValue.where methods are replaced with runWhere, callWhere and getWhere Alan Bateman has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 15 commits: - Sync up from loom repo - Merge - Sync with loom repo, re-work ScopedValue class description - Sync up from loom repo - Remove csm.Threads - Merge - Test should not be in update for main line - Sync with loom repo - Sync up tests frmo loom repo - Sync up with loom repo - ... and 5 more: https://git.openjdk.org/jdk/compare/a46b5acc...cc902ce6 ------------- Changes: https://git.openjdk.org/jdk/pull/13932/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13932&range=03 Stats: 9267 lines in 40 files changed: 4880 ins; 4325 del; 62 mod Patch: https://git.openjdk.org/jdk/pull/13932.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13932/head:pull/13932 PR: https://git.openjdk.org/jdk/pull/13932 From asotona at openjdk.org Thu Jun 1 14:49:25 2023 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 1 Jun 2023 14:49:25 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) Message-ID: Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. Please review. Thanks, Adam ------------- Commit messages: - fixed snippets and added SnippetsTest - fixed javadoc - added Classfile context parameter to ClasRemapper::remapClass - records and methods implementations moved from Classfile to ClassfileImpl - added Classfile::buildTo override - implementation of Classfile::withOptions(Option... options) - added test for StackMapsOption.ALWAYS_GENERATE_STACK_MAPS - fixed tests - fixed options and jdk/classfile tests - fixed jdk/classfile tests - ... and 9 more: https://git.openjdk.org/jdk/compare/7d2a7ce2...bcdf0f11 Changes: https://git.openjdk.org/jdk/pull/14180/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8308899 Stats: 1579 lines in 106 files changed: 478 ins; 195 del; 906 mod Patch: https://git.openjdk.org/jdk/pull/14180.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14180/head:pull/14180 PR: https://git.openjdk.org/jdk/pull/14180 From liach at openjdk.org Thu Jun 1 14:49:29 2023 From: liach at openjdk.org (Chen Liang) Date: Thu, 1 Jun 2023 14:49:29 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) In-Reply-To: References: Message-ID: On Fri, 26 May 2023 14:56:57 GMT, Adam Sotona wrote: > Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html > This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. > > Please review. > > Thanks, > Adam A side comment about the API changes: I think we should recommend users to store Classfile instances in static final variables if sharing is reasonable, like in Module and BindingSpecializer; this way, we can cache class hierarchy resolution information across builds. src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 87: > 85: * @param r a function mapping attribute names to attribute mappers > 86: */ > 87: record AttributeMapperOption(Function> attributeMapper) implements Option { We might want to convert these options into interfaces and move the implementation records into ClassfileImpl, like Brian suggested about ClassHierarchyInfo. src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 208: > 206: */ > 207: default ClassModel parse(byte[] bytes) { > 208: return new ClassImpl(bytes, (ClassfileImpl)this); Should we implement this in ClassfileImpl to avoid the redundant cast? src/java.base/share/classes/jdk/internal/classfile/components/ClassRemapper.java line 102: > 100: * @return re-mapped class file bytes > 101: */ > 102: default byte[] remapClass(ClassModel clm) { This api should ask for a Classfile object instead. Thankfully, the new Classfile object actually allows us to find potentially bugs in our code (say if the remapped class refer to declared types outside of system class loader) ------------- PR Review: https://git.openjdk.org/jdk/pull/14180#pullrequestreview-1452244549 PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1211113876 PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1211114779 PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1211116312 From asotona at openjdk.org Thu Jun 1 14:49:30 2023 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 1 Jun 2023 14:49:30 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) In-Reply-To: References: Message-ID: On Wed, 31 May 2023 05:42:58 GMT, Chen Liang wrote: >> Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html >> This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. >> >> Please review. >> >> Thanks, >> Adam > > src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 87: > >> 85: * @param r a function mapping attribute names to attribute mappers >> 86: */ >> 87: record AttributeMapperOption(Function> attributeMapper) implements Option { > > We might want to convert these options into interfaces and move the implementation records into ClassfileImpl, like Brian suggested about ClassHierarchyInfo. Will fix it, thanks. > src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 208: > >> 206: */ >> 207: default ClassModel parse(byte[] bytes) { >> 208: return new ClassImpl(bytes, (ClassfileImpl)this); > > Should we implement this in ClassfileImpl to avoid the redundant cast? yes, several methods should move to ClassfileImpl, thanks. > src/java.base/share/classes/jdk/internal/classfile/components/ClassRemapper.java line 102: > >> 100: * @return re-mapped class file bytes >> 101: */ >> 102: default byte[] remapClass(ClassModel clm) { > > This api should ask for a Classfile object instead. Thankfully, the new Classfile object actually allows us to find potentially bugs in our code (say if the remapped class refer to declared types outside of system class loader) yes, I'll add the parameter, thanks. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1212084790 PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1212094893 PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1212117128 From asemenov at openjdk.org Thu Jun 1 15:01:37 2023 From: asemenov at openjdk.org (Artem Semenov) Date: Thu, 1 Jun 2023 15:01:37 GMT Subject: RFR: 8308286 Fix clang warnings in linux code [v4] In-Reply-To: References: Message-ID: > When using the clang compiler to build OpenJDk on Linux, we encounter various "warnings as errors". > They can be fixed with small changes. Artem Semenov has updated the pull request incrementally with one additional commit since the last revision: update ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14033/files - new: https://git.openjdk.org/jdk/pull/14033/files/d5b70cb2..b423bd4c Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14033&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14033&range=02-03 Stats: 7 lines in 2 files changed: 1 ins; 4 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/14033.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14033/head:pull/14033 PR: https://git.openjdk.org/jdk/pull/14033 From weijun at openjdk.org Thu Jun 1 15:07:12 2023 From: weijun at openjdk.org (Weijun Wang) Date: Thu, 1 Jun 2023 15:07:12 GMT Subject: RFR: 8308286 Fix clang warnings in linux code [v3] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 15:02:16 GMT, Artem Semenov wrote: >> src/java.security.jgss/share/native/libj2gss/gssapi.h line 47: >> >>> 45: >>> 46: // Condition was copied from >>> 47: // Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/gssapi/gssapi.h >> >> In the current version of the file above, it's written as >> >> #if defined(__APPLE__) && (defined(__ppc__) ||... >> >> Is it better? > > done I didn't ask to revert the change. It's `s/TARGET_OS_MAC/defined(__APPLE__)/`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14033#discussion_r1213300305 From asemenov at openjdk.org Thu Jun 1 15:07:11 2023 From: asemenov at openjdk.org (Artem Semenov) Date: Thu, 1 Jun 2023 15:07:11 GMT Subject: RFR: 8308286 Fix clang warnings in linux code [v3] In-Reply-To: References: Message-ID: On Wed, 31 May 2023 13:52:39 GMT, Weijun Wang wrote: >> Artem Semenov has updated the pull request incrementally with one additional commit since the last revision: >> >> update > > src/java.security.jgss/share/native/libj2gss/gssapi.h line 47: > >> 45: >> 46: // Condition was copied from >> 47: // Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/gssapi/gssapi.h > > In the current version of the file above, it's written as > > #if defined(__APPLE__) && (defined(__ppc__) ||... > > Is it better? done ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14033#discussion_r1213297788 From rriggs at openjdk.org Thu Jun 1 15:12:09 2023 From: rriggs at openjdk.org (Roger Riggs) Date: Thu, 1 Jun 2023 15:12:09 GMT Subject: RFR: 8309196: Remove Thread.countStackFrames In-Reply-To: <7p3wapZUnzfzFKMyOVexaMVGeh00epZs3ipgw-LpvDM=.86006e6e-060a-4d9b-a883-4983381cdba7@github.com> References: <7p3wapZUnzfzFKMyOVexaMVGeh00epZs3ipgw-LpvDM=.86006e6e-060a-4d9b-a883-4983381cdba7@github.com> Message-ID: On Thu, 1 Jun 2023 06:40:04 GMT, Alan Bateman wrote: > Thread.countStackFrames is/was an ill-defined method that dates from JDK 1.0 for counting the stack frames of a suspended Thread. The method was deprecated in JDK 1.2 (1998), deprecated for removal in Java 9, and re-specified/degraded to throw UOE unconditionally in Java 14. Java 22 would be a fine time to finally remove this method. > > Code that wants to count stack frames should be directed to use j.l.StackWalker, or if is a a tool, then it can use JVM TI and other tool APIs. > > A corpus analysis of 30M classes in 131k artifacts from Maven Central found only 1 usages to this method. The 1 usage appears to be a class that just wraps all methods, it doesn't actually make use of it. Looks good. ------------- Marked as reviewed by rriggs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14257#pullrequestreview-1455718528 From jvernee at openjdk.org Thu Jun 1 15:16:42 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 1 Jun 2023 15:16:42 GMT Subject: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v3] In-Reply-To: References: Message-ID: > In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and `float` is promoted to `double`, when being passed as variadic argument (see e.g. https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions). This patch restricts the layouts that can be used as variadic layouts to what is allowed by the C specification. > > The fallback linker is also updated to use to correct function to link variadic calls (not doing this turned out not to be a problem so far, but it is problematic for instance on Mac/AArch64 when using the fallback linker). Adding the restriction on layouts for all linkers is also partly motivated by the fallback linker rejecting such unsupported variadic layouts already. > > I've added a small paragraph to the Linker javadoc as well that explains the restriction. Comments on that are welcome, but please explain. > > The tests are updated to no longer try to link variadic functions with the illegal layouts, and I've added some more negative tests to TestIllegalLink. > > Testing: > - local testing on Windows/x64 > - tier1-3 + jdk-tier5 (ongoing) > - manual test run on mac/aarch64 with the fallback linker to verify the correctness of the fallback linker changes. Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: Rework javadoc ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14225/files - new: https://git.openjdk.org/jdk/pull/14225/files/9415e2a1..e806fae5 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14225&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14225&range=01-02 Stats: 23 lines in 3 files changed: 10 ins; 0 del; 13 mod Patch: https://git.openjdk.org/jdk/pull/14225.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14225/head:pull/14225 PR: https://git.openjdk.org/jdk/pull/14225 From jvernee at openjdk.org Thu Jun 1 15:16:42 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 1 Jun 2023 15:16:42 GMT Subject: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v2] In-Reply-To: References: Message-ID: <0lphegECNwzPlpGWIkA6SUkOJL2va0alu_w6PQuj7DI=.90f6e24e-f04f-447e-90ca-8609f798205f@github.com> On Wed, 31 May 2023 23:57:01 GMT, Jorn Vernee wrote: >> Also, should we say somewhere that, for prototype-less functions, `firstVariadicArg` should always have an index of 0 (e.g. any other value is illegal, trivially). It's not super important, just one of those little things that can reinforce understanding. > >> Perhaps if we used a bullet-list to define the two ways in which variadic function can be declared, the definition could stand out even more? > > Yes, I think this is a good idea. I'll do another pass. > >> Also, should we say somewhere that, for prototype-less functions, firstVariadicArg should always have an index of 0 > > I think this is also a good idea. It helps hammer the point home. Did another pass: https://github.com/openjdk/jdk/pull/14225/commits/e806fae5dc295726846d197dad59e6b0ba715ceb There are now 3 paragraphs in the javadoc: One that explains what a variadic function is (in C), one that explains how they are linked using specialized function descriptors, and finally one which explains the limitation on variadic argument layouts. Additionally I've switched the polarity of the check to be the same as it is in the doc, and aligned the exception message with the terminology in the doc. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14225#discussion_r1213310000 From liach at openjdk.org Thu Jun 1 15:17:41 2023 From: liach at openjdk.org (Chen Liang) Date: Thu, 1 Jun 2023 15:17:41 GMT Subject: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v17] In-Reply-To: References: Message-ID: > As John Rose has pointed out in this issue, the current j.l.r.Proxy based implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance interface) > 2. Does not allow future expansion to support SAM[^1] abstract classes > 3. Slow (in fact, very slow) > > This patch addresses all 3 problems: > 1. It updates the WrapperInstance methods to take an `Empty` to avoid method clashes > 2. This patch obtains already generated classes from a ClassValue by the requested interface type; the ClassValue can later be updated to compute implementation generation for abstract classes as well. > 3. This patch's faster than old implementation in general. > > > Benchmark Mode Cnt Score Error Units > MethodHandleProxiesAsIFInstance.baselineAllocCompute avgt 15 1.483 ? 0.025 ns/op > MethodHandleProxiesAsIFInstance.baselineCompute avgt 15 0.264 ? 0.006 ns/op > MethodHandleProxiesAsIFInstance.testCall avgt 15 1.773 ? 0.040 ns/op > MethodHandleProxiesAsIFInstance.testCreate avgt 15 16.754 ? 0.411 ns/op > MethodHandleProxiesAsIFInstance.testCreateCall avgt 15 19.609 ? 1.598 ns/op > MethodHandleProxiesAsIFInstanceCall.callDoable avgt 15 0.424 ? 0.024 ns/op > MethodHandleProxiesAsIFInstanceCall.callHandle avgt 15 1.936 ? 0.008 ns/op > MethodHandleProxiesAsIFInstanceCall.callInterfaceInstance avgt 15 1.766 ? 0.014 ns/op > MethodHandleProxiesAsIFInstanceCall.callLambda avgt 15 0.414 ? 0.005 ns/op > MethodHandleProxiesAsIFInstanceCall.constantDoable avgt 15 0.271 ? 0.006 ns/op > MethodHandleProxiesAsIFInstanceCall.constantHandle avgt 15 0.263 ? 0.004 ns/op > MethodHandleProxiesAsIFInstanceCall.constantInterfaceInstance avgt 15 0.266 ? 0.005 ns/op > MethodHandleProxiesAsIFInstanceCall.constantLambda avgt 15 0.262 ? 0.003 ns/op > MethodHandleProxiesAsIFInstanceCall.direct avgt 15 0.264 ? 0.005 ns/op > MethodHandleProxiesAsIFInstanceCreate.createCallInterfaceInstance avgt 15 18.000 ? 0.181 ns/op > MethodHandleProxiesAsIFInstanceCreate.createCallLambda ... 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 36 additional commits since the last revision: - Some changes per Mandy's review. SecurityManager test fails in this patch - Merge branch 'master' into explore/mhp-iface - Merge branch 'master' into explore/mhp-iface - Merge branch 'master' into explore/mhp-iface - stage, needs to fix is mh proxy instance check - Merge branch 'master' into explore/mhp-iface - Remove assertion, no longer true with teleport definition in MHP - Fix tabs, and tests about modules and constructor access - stupid faults - Revert to shared-class implementation, found a way to deal with security manager - ... and 26 more: https://git.openjdk.org/jdk/compare/7fb93a40...56a282e4 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13197/files - new: https://git.openjdk.org/jdk/pull/13197/files/bd21e68e..56a282e4 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13197&range=16 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13197&range=15-16 Stats: 171579 lines in 3039 files changed: 128195 ins; 20981 del; 22403 mod Patch: https://git.openjdk.org/jdk/pull/13197.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13197/head:pull/13197 PR: https://git.openjdk.org/jdk/pull/13197 From liach at openjdk.org Thu Jun 1 15:17:41 2023 From: liach at openjdk.org (Chen Liang) Date: Thu, 1 Jun 2023 15:17:41 GMT Subject: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v16] In-Reply-To: References: Message-ID: On Sun, 7 May 2023 13:34:54 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance interface) >> 2. Does not allow future expansion to support SAM[^1] abstract classes >> 3. Slow (in fact, very slow) >> >> This patch addresses all 3 problems: >> 1. It updates the WrapperInstance methods to take an `Empty` to avoid method clashes >> 2. This patch obtains already generated classes from a ClassValue by the requested interface type; the ClassValue can later be updated to compute implementation generation for abstract classes as well. >> 3. This patch's faster than old implementation in general. >> >> >> Benchmark Mode Cnt Score Error Units >> MethodHandleProxiesAsIFInstance.baselineAllocCompute avgt 15 1.483 ? 0.025 ns/op >> MethodHandleProxiesAsIFInstance.baselineCompute avgt 15 0.264 ? 0.006 ns/op >> MethodHandleProxiesAsIFInstance.testCall avgt 15 1.773 ? 0.040 ns/op >> MethodHandleProxiesAsIFInstance.testCreate avgt 15 16.754 ? 0.411 ns/op >> MethodHandleProxiesAsIFInstance.testCreateCall avgt 15 19.609 ? 1.598 ns/op >> MethodHandleProxiesAsIFInstanceCall.callDoable avgt 15 0.424 ? 0.024 ns/op >> MethodHandleProxiesAsIFInstanceCall.callHandle avgt 15 1.936 ? 0.008 ns/op >> MethodHandleProxiesAsIFInstanceCall.callInterfaceInstance avgt 15 1.766 ? 0.014 ns/op >> MethodHandleProxiesAsIFInstanceCall.callLambda avgt 15 0.414 ? 0.005 ns/op >> MethodHandleProxiesAsIFInstanceCall.constantDoable avgt 15 0.271 ? 0.006 ns/op >> MethodHandleProxiesAsIFInstanceCall.constantHandle avgt 15 0.263 ? 0.004 ns/op >> MethodHandleProxiesAsIFInstanceCall.constantInterfaceInstance avgt 15 0.266 ? 0.005 ns/op >> MethodHandleProxiesAsIFInstanceCall.constantLambda avgt 15 0.262 ? 0.003 ns/op >> MethodHandleProxiesAsIFInstanceCall.direct avgt 15 0.264 ? 0.005 ns/op >> MethodHandleProxiesAsIFInstanceCreate.createCallInterfaceInstance avgt 15 18.000 ? 0.181 ns/op >> MethodHandleProxiesAsIFInstanceCreat... > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > Remove assertion, no longer true with teleport definition in MHP About the security manager: the proposal to change SecurityManager to permit exporting the internal API packages would change the specification of `SecurityManger::checkPackageAccess`. Should I touch that in this patch and potentially require CSR review about SecurityManager changes, or should I go back to the original Proxy-like checks? ------------- PR Comment: https://git.openjdk.org/jdk/pull/13197#issuecomment-1572243080 From asotona at openjdk.org Thu Jun 1 15:20:27 2023 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 1 Jun 2023 15:20:27 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v2] In-Reply-To: References: Message-ID: > Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html > This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. > > Please review. > > Thanks, > Adam Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: fixed benchmarks ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14180/files - new: https://git.openjdk.org/jdk/pull/14180/files/bcdf0f11..eae9bed3 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14180.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14180/head:pull/14180 PR: https://git.openjdk.org/jdk/pull/14180 From liach at openjdk.org Thu Jun 1 15:25:12 2023 From: liach at openjdk.org (Chen Liang) Date: Thu, 1 Jun 2023 15:25:12 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v2] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 15:20:27 GMT, Adam Sotona wrote: >> Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html >> This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. >> >> Please review. >> >> Thanks, >> Adam > > Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: > > fixed benchmarks In fact, I think we can probably mark Classfile as value-based. Then, whether it's created from a factory at every call or if it's cached (my first 2 review comments) no longer matters as much; the caching behavior will be handled by individual option instances (such as class hierarchy caching in the class hierarchy option's resolver) src/java.base/share/classes/java/lang/Module.java line 1593: > 1591: private Class loadModuleInfoClass(InputStream in) throws IOException { > 1592: final String MODULE_INFO = "module-info"; > 1593: var cc = Classfile.of(Classfile.ConstantPoolSharingOption.DO_NOT_SHARE_CONSTANT_POOL); This `cc` can be stored in a static final field instead. src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 55: > 53: > 54: static Classfile of() { > 55: return new ClassfileImpl(); We can create a static final field in `ClassfileImpl` holding a default instance equivalent to that created by `new ClassfileImpl()` and have the `of()` factory return that instance instead. src/java.base/share/classes/jdk/internal/classfile/impl/StackMapGenerator.java line 840: > 838: try { > 839: //clone SplitConstantPool with alternate context > 840: var cc = Classfile.of(Classfile.StackMapsOption.DO_NOT_GENERATE_STACK_MAPS); This should set the Class hierarchy resolver, patch dead code, and filter dead labels options from the original context. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14180#issuecomment-1572260124 PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1213300095 PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1213302665 PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1213314212 From jvernee at openjdk.org Thu Jun 1 15:28:33 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 1 Jun 2023 15:28:33 GMT Subject: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v4] In-Reply-To: References: Message-ID: > In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and `float` is promoted to `double`, when being passed as variadic argument (see e.g. https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions). This patch restricts the layouts that can be used as variadic layouts to what is allowed by the C specification. > > The fallback linker is also updated to use to correct function to link variadic calls (not doing this turned out not to be a problem so far, but it is problematic for instance on Mac/AArch64 when using the fallback linker). Adding the restriction on layouts for all linkers is also partly motivated by the fallback linker rejecting such unsupported variadic layouts already. > > I've added a small paragraph to the Linker javadoc as well that explains the restriction. Comments on that are welcome, but please explain. > > The tests are updated to no longer try to link variadic functions with the illegal layouts, and I've added some more negative tests to TestIllegalLink. > > Testing: > - local testing on Windows/x64 > - tier1-3 + jdk-tier5 (ongoing) > - manual test run on mac/aarch64 with the fallback linker to verify the correctness of the fallback linker changes. Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: move prototype-less name ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14225/files - new: https://git.openjdk.org/jdk/pull/14225/files/e806fae5..1f1e22eb Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14225&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14225&range=02-03 Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/14225.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14225/head:pull/14225 PR: https://git.openjdk.org/jdk/pull/14225 From mcimadamore at openjdk.org Thu Jun 1 15:28:34 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Thu, 1 Jun 2023 15:28:34 GMT Subject: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v3] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 15:16:42 GMT, Jorn Vernee wrote: >> In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and `float` is promoted to `double`, when being passed as variadic argument (see e.g. https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions). This patch restricts the layouts that can be used as variadic layouts to what is allowed by the C specification. >> >> The fallback linker is also updated to use to correct function to link variadic calls (not doing this turned out not to be a problem so far, but it is problematic for instance on Mac/AArch64 when using the fallback linker). Adding the restriction on layouts for all linkers is also partly motivated by the fallback linker rejecting such unsupported variadic layouts already. >> >> I've added a small paragraph to the Linker javadoc as well that explains the restriction. Comments on that are welcome, but please explain. >> >> The tests are updated to no longer try to link variadic functions with the illegal layouts, and I've added some more negative tests to TestIllegalLink. >> >> Testing: >> - local testing on Windows/x64 >> - tier1-3 + jdk-tier5 (ongoing) >> - manual test run on mac/aarch64 with the fallback linker to verify the correctness of the fallback linker changes. > > Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: > > Rework javadoc Looks good - I left an optional comment. feel free to ignore (or to deal with that as part of some other PR). src/java.base/share/classes/java/lang/foreign/Linker.java line 373: > 371: *
  • With an empty formal parameter list, such as: {@code void foo();}
  • > 372: * > 373: * The latter is often called a prototype-less function as well. The arguments passed in place of the ellipsis, Would it make sense to move the prototype-less name in the second bullet above? ------------- PR Comment: https://git.openjdk.org/jdk/pull/14225#issuecomment-1572258397 PR Review Comment: https://git.openjdk.org/jdk/pull/14225#discussion_r1213320545 From jvernee at openjdk.org Thu Jun 1 15:28:34 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 1 Jun 2023 15:28:34 GMT Subject: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v3] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 15:19:48 GMT, Maurizio Cimadamore wrote: >> Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: >> >> Rework javadoc > > src/java.base/share/classes/java/lang/foreign/Linker.java line 373: > >> 371: *
  • With an empty formal parameter list, such as: {@code void foo();}
  • >> 372: * >> 373: * The latter is often called a prototype-less function as well. The arguments passed in place of the ellipsis, > > Would it make sense to move the prototype-less name in the second bullet above? Yes, will do. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14225#discussion_r1213324562 From jvernee at openjdk.org Thu Jun 1 15:32:13 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 1 Jun 2023 15:32:13 GMT Subject: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v4] In-Reply-To: References: Message-ID: <1g3col7c0paUw_eR0asEOHrdOAR_6QGzsY80myz9RpA=.8dcb2aed-dc29-439e-8d00-18fc83cc907a@github.com> On Thu, 1 Jun 2023 15:28:33 GMT, Jorn Vernee wrote: >> In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and `float` is promoted to `double`, when being passed as variadic argument (see e.g. https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions). This patch restricts the layouts that can be used as variadic layouts to what is allowed by the C specification. >> >> The fallback linker is also updated to use to correct function to link variadic calls (not doing this turned out not to be a problem so far, but it is problematic for instance on Mac/AArch64 when using the fallback linker). Adding the restriction on layouts for all linkers is also partly motivated by the fallback linker rejecting such unsupported variadic layouts already. >> >> I've added a small paragraph to the Linker javadoc as well that explains the restriction. Comments on that are welcome, but please explain. >> >> The tests are updated to no longer try to link variadic functions with the illegal layouts, and I've added some more negative tests to TestIllegalLink. >> >> Testing: >> - local testing on Windows/x64 >> - tier1-3 + jdk-tier5 (ongoing) >> - manual test run on mac/aarch64 with the fallback linker to verify the correctness of the fallback linker changes. > > Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: > > move prototype-less name Thanks for the review! I've updated the CSR with the finalized version of the javadoc. Could you take a look at that as well? https://bugs.openjdk.org/browse/JDK-8309205 ------------- PR Comment: https://git.openjdk.org/jdk/pull/14225#issuecomment-1572275551 From redestad at openjdk.org Thu Jun 1 15:35:22 2023 From: redestad at openjdk.org (Claes Redestad) Date: Thu, 1 Jun 2023 15:35:22 GMT Subject: RFR: 8302822: Method/Field/Constructor/RecordComponent::getGenericInfo() is not thread safe In-Reply-To: References: <1sDlqlKVNOobyFy71f7ud5uL8_WcMPi1qKNa4ltxFQ0=.63cffbd7-e11a-4d7d-9362-cf215a7584ce@github.com> Message-ID: <3iDPU6qFmt8R5gDA6F9CWnJSgi0iEEo9R89hUWcgcxY=.2e33c1f8-d113-4972-a2d4-ae3fa168f7fe@github.com> On Mon, 20 Feb 2023 17:03:33 GMT, Peter Levart wrote: >> We don't fear calling the factory twice for benign races, as the distinct constructor factory instances are behaviorally the same. >> >> The true issue lies in the double getfield operations: Java memory model doesn't require the second read to happen-after a write reflected in the first read, so return this.genericInfo may return null while this.genericInfo == null evaluates to false, in case genericInfo is initialized lazily by another thread. See https://bugs.openjdk.org/browse/JDK-8261404 > > Hi @liach, > > I think @dholmes-ora is worried about the fields in the object being returned by the getGenericInfo() method and similar. In above case this means fields in class ConstructorRepository. > I checked it and the entire hierarchy based on sun.reflect.generics.repository.AbstractRepository with subclasses including ConstructorRepository is modeled such that all fields are either: > - volatile and lazily initialized; or > - final and initialized in constructor > > Such objects may be published via data race and still be seen consistent on the accepting side. I don't have any issue with this version. Making the fields volatile is _currently_ unnecessary to ensure correctness -- thanks @plevart for double-checking that all fields in the hierarchy is either `volatile` or `final` -- but adding it is relatively benign (very minor performance cost to a likely-not-very-performance-sensitive code path), reduces fragility and might avoid extraneous allocations of under race conditions. ------------- PR Comment: https://git.openjdk.org/jdk/pull/12643#issuecomment-1572275936 From liach at openjdk.org Thu Jun 1 15:35:23 2023 From: liach at openjdk.org (Chen Liang) Date: Thu, 1 Jun 2023 15:35:23 GMT Subject: Integrated: 8302822: Method/Field/Constructor/RecordComponent::getGenericInfo() is not thread safe In-Reply-To: <1sDlqlKVNOobyFy71f7ud5uL8_WcMPi1qKNa4ltxFQ0=.63cffbd7-e11a-4d7d-9362-cf215a7584ce@github.com> References: <1sDlqlKVNOobyFy71f7ud5uL8_WcMPi1qKNa4ltxFQ0=.63cffbd7-e11a-4d7d-9362-cf215a7584ce@github.com> Message-ID: On Sun, 19 Feb 2023 18:41:18 GMT, Chen Liang wrote: > 8302822: Method/Field/Constructor/RecordComponent::getGenericInfo() is not thread safe This pull request has now been integrated. Changeset: be36096a Author: Chen Liang Committer: Claes Redestad URL: https://git.openjdk.org/jdk/commit/be36096a19bcfc12e789cdeaaa51d746567ac638 Stats: 16 lines in 4 files changed: 8 ins; 0 del; 8 mod 8302822: Method/Field/Constructor/RecordComponent::getGenericInfo() is not thread safe Reviewed-by: stsypanov, redestad ------------- PR: https://git.openjdk.org/jdk/pull/12643 From mchung at openjdk.org Thu Jun 1 16:16:08 2023 From: mchung at openjdk.org (Mandy Chung) Date: Thu, 1 Jun 2023 16:16:08 GMT Subject: RFR: 8309196: Remove Thread.countStackFrames In-Reply-To: <7p3wapZUnzfzFKMyOVexaMVGeh00epZs3ipgw-LpvDM=.86006e6e-060a-4d9b-a883-4983381cdba7@github.com> References: <7p3wapZUnzfzFKMyOVexaMVGeh00epZs3ipgw-LpvDM=.86006e6e-060a-4d9b-a883-4983381cdba7@github.com> Message-ID: On Thu, 1 Jun 2023 06:40:04 GMT, Alan Bateman wrote: > Thread.countStackFrames is/was an ill-defined method that dates from JDK 1.0 for counting the stack frames of a suspended Thread. The method was deprecated in JDK 1.2 (1998), deprecated for removal in Java 9, and re-specified/degraded to throw UOE unconditionally in Java 14. Java 22 would be a fine time to finally remove this method. > > Code that wants to count stack frames should be directed to use j.l.StackWalker, or if is a a tool, then it can use JVM TI and other tool APIs. > > A corpus analysis of 30M classes in 131k artifacts from Maven Central found only 1 usages to this method. The 1 usage appears to be a class that just wraps all methods, it doesn't actually make use of it. Marked as reviewed by mchung (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14257#pullrequestreview-1455848358 From erikj at openjdk.org Thu Jun 1 16:21:06 2023 From: erikj at openjdk.org (Erik Joelsson) Date: Thu, 1 Jun 2023 16:21:06 GMT Subject: RFR: 8307858: [REDO] JDK-8307194 Add make target for optionally building a complete set of all JDK and hotspot libjvm static libraries [v4] In-Reply-To: References: Message-ID: On Fri, 26 May 2023 20:26:02 GMT, Jiangli Zhou wrote: > > Another possibility might be the user provided `BUILD_LDCXX` includes extra options in the testing build (?). If that's the case, we probably could define a separate `BUILD_LD_PARTIAL` with no added options. In our prototype on JDK 11, we define a separate one for partial linking. > > I tried building `static-libs-image` for linux-aarch64 on Ubuntu machine using `devkit` to reproduce the failure. Also tried building for `linux-ppc64le-server-release` target using `devkit` on Ubuntu. Both built successfully with using `devkit`. I could not build a `devkit` for arm32 (with `make TARGETS="arm-linux-gnueabihf" BASE_OS=Fedora BASE_OS_VERSION=17`, also tried with BASE_OS_VERSION=17). > > @erikj79 Could you please help provide additional insight for the build failure you found for arm32? `BUILD_LIBJVM_partial_link.cmdline` might help shed some light. > There are no extra options. I suspect it's an issue with the older GCC version. Here is one failing command line: $ ( cd /home/erik/git/jdk/build/linux-arm32 ; /var/tmp/jib-erik/install/jpg/infra/builddeps/devkit-linux_x64-to-linux_arm/gcc8.2.0-Fedora27+1.0/devkit-linux_x64-to-linux_arm-gcc8.2.0-Fedora27+1.0.tar.gz/x86_64-linux-gnu-to-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc -r --sysroot=/var/tmp/jib-erik/install/jpg/infra/builddeps/devkit-linux_x64-to-linux_arm/gcc8.2.0-Fedora27+1.0/devkit-linux_x64-to-linux_arm-gcc8.2.0-Fedora27+1.0.tar.gz/x86_64-linux-gnu-to-arm-linux-gnueabihf/arm-linux-gnueabihf/sysroot -o /home/erik/git/jdk/build/linux-arm32/support/native/java.rmi/librmi/static/librmi_relocatable.o /home/erik/git/jdk/build/linux-arm32/support/native/java.rmi/librmi/static/GC.o ) /var/tmp/jib-erik/install/jpg/infra/builddeps/devkit-linux_x64-to-linux_arm/gcc8.2.0-Fedora27+1.0/devkit-linux_x64-to-linux_arm-gcc8.2.0-Fedora27+1.0.tar.gz/x86_64-linux-gnu-to-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.2.0/../../../../arm-linux-gnueabihf/bin/ld: fatal error: cannot mix -r with dynamic object /var/tmp/jib-erik/install/jpg/infra/builddeps/devkit-linux_x64-to-linux_arm/gcc8.2.0-Fedora27+1.0/devkit-linux_x64-to-linux_arm-gcc8.2.0-Fedora27+1.0.tar.gz/x86_64-linux-gnu-to-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.2.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so.1 > The partial linking was originally suggested by C++/Clang toolchain folks to mitigate linker overhead that was observed during final executable link time. For a static library containing any object file (`.o`) that was compiled with ThinLTO (https://clang.llvm.org/docs/ThinLTO.html) enabled, linking an executable using the static library without distributed ThinLTO could experience more overhead and slow down linking. Solving the macosx `ar` limitation is a side-effect/benefit of using partial linking. We probably would want to include the partial linking even without the `ar` limitation. This seems to be Clang specific, so maybe only apply this to Clang and not GCC? Have you measured the difference in link time and concluded that this workaround is needed? If so, how big were the differences? Given that it prints a lot of warnings on mac, I would suggest leaving the partial linking out of this patch to get something in that is actually working. It was included in this patch because of the side effect it had with handling long path names. However, since looking closer at that issue, we were using a different workaround for Clang already and that same workaround should work fine for AR on mac as well. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14064#issuecomment-1572352386 From naoto at openjdk.org Thu Jun 1 16:28:06 2023 From: naoto at openjdk.org (Naoto Sato) Date: Thu, 1 Jun 2023 16:28:06 GMT Subject: RFR: 8289220: [Shenandoah] TestAllocObjectArrays fails intermittently [v3] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 08:58:23 GMT, SUN Guoyun wrote: >> command: make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp" TEST=gc/TestAllocHumongousFragment.java >> error info: >> >> Caused by: java.lang.NullPointerException: Cannot invoke "sun.util.locale.BaseLocale.getVariant()" because "base" is null >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1802) >> at java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.(CLDRBaseLocaleDataMetaInfo.java:41) >> ... 24 more >> >> Note that the test runs with -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot and SoftReferences are involved (LocaleObjectCache uses SoftReferences, used by printf method called in getRandomInstance(Utils.java:511)). >> >> Maybe we have to deal with the case where the getBaseLocale() return value is null. the call stack is: >> >> at java.base/sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:64) >> at java.base/sun.util.locale.BaseLocale.getInstance(BaseLocale.java:169) >> at java.base/sun.util.locale.InternalLocaleBuilder.getBaseLocale(InternalLocaleBuilder.java:524) >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1874) >> >> in LocaleObjectCache.java:64 >> >> 62 if (key == null || newVal == null) { >> 63 // subclass must return non-null key/value object >> 64 return null; // run here >> 65 } > > SUN Guoyun has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision: > > 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared Those SoftReference caches are introduced with this change: https://bugs.openjdk.org/browse/JDK-8196869, and there is a stress test added for it: test/jdk/java/util/Locale/SoftKeys.java @sunny868 Would you be able to add a JMH test to make sure that your change would not affect the startup time? @cl4es would you take a look at this change? Thanks! ------------- PR Comment: https://git.openjdk.org/jdk/pull/14211#issuecomment-1572362241 From mchung at openjdk.org Thu Jun 1 17:17:27 2023 From: mchung at openjdk.org (Mandy Chung) Date: Thu, 1 Jun 2023 17:17:27 GMT Subject: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v17] In-Reply-To: References: Message-ID: <5lE5t4Jkg3tm-bAsVvjQChWCuOJlsZtriy6AvPQuJWM=.e33d2942-1bb1-4e42-aebe-44b4fac5dae7@github.com> On Thu, 1 Jun 2023 15:17:41 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance interface) >> 2. Does not allow future expansion to support SAM[^1] abstract classes >> 3. Slow (in fact, very slow) >> >> This patch addresses all 3 problems: >> 1. It updates the WrapperInstance methods to take an `Empty` to avoid method clashes >> 2. This patch obtains already generated classes from a ClassValue by the requested interface type; the ClassValue can later be updated to compute implementation generation for abstract classes as well. >> 3. This patch's faster than old implementation in general. >> >> >> Benchmark Mode Cnt Score Error Units >> MethodHandleProxiesAsIFInstance.baselineAllocCompute avgt 15 1.483 ? 0.025 ns/op >> MethodHandleProxiesAsIFInstance.baselineCompute avgt 15 0.264 ? 0.006 ns/op >> MethodHandleProxiesAsIFInstance.testCall avgt 15 1.773 ? 0.040 ns/op >> MethodHandleProxiesAsIFInstance.testCreate avgt 15 16.754 ? 0.411 ns/op >> MethodHandleProxiesAsIFInstance.testCreateCall avgt 15 19.609 ? 1.598 ns/op >> MethodHandleProxiesAsIFInstanceCall.callDoable avgt 15 0.424 ? 0.024 ns/op >> MethodHandleProxiesAsIFInstanceCall.callHandle avgt 15 1.936 ? 0.008 ns/op >> MethodHandleProxiesAsIFInstanceCall.callInterfaceInstance avgt 15 1.766 ? 0.014 ns/op >> MethodHandleProxiesAsIFInstanceCall.callLambda avgt 15 0.414 ? 0.005 ns/op >> MethodHandleProxiesAsIFInstanceCall.constantDoable avgt 15 0.271 ? 0.006 ns/op >> MethodHandleProxiesAsIFInstanceCall.constantHandle avgt 15 0.263 ? 0.004 ns/op >> MethodHandleProxiesAsIFInstanceCall.constantInterfaceInstance avgt 15 0.266 ? 0.005 ns/op >> MethodHandleProxiesAsIFInstanceCall.constantLambda avgt 15 0.262 ? 0.003 ns/op >> MethodHandleProxiesAsIFInstanceCall.direct avgt 15 0.264 ? 0.005 ns/op >> MethodHandleProxiesAsIFInstanceCreate.createCallInterfaceInstance avgt 15 18.000 ? 0.181 ns/op >> MethodHandleProxiesAsIFInstanceCreat... > > 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 36 additional commits since the last revision: > > - Some changes per Mandy's review. SecurityManager test fails in this patch > - Merge branch 'master' into explore/mhp-iface > - Merge branch 'master' into explore/mhp-iface > - Merge branch 'master' into explore/mhp-iface > - stage, needs to fix is mh proxy instance check > - Merge branch 'master' into explore/mhp-iface > - Remove assertion, no longer true with teleport definition in MHP > - Fix tabs, and tests about modules and constructor access > - stupid faults > - Revert to shared-class implementation, found a way to deal with security manager > - ... and 26 more: https://git.openjdk.org/jdk/compare/e6f1393e...56a282e4 Thanks for the update. The security permission check is done regardless of whether it passes the access check. So the generated code can't access internal API. For now, I think you can go back to spin bytecode for the check as done in Proxy. We will consider if it can be replaced by a public API in the future. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13197#issuecomment-1572468328 From jlaskey at openjdk.org Thu Jun 1 17:18:29 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Thu, 1 Jun 2023 17:18:29 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v27] In-Reply-To: References: Message-ID: <2qIU0N6p64RU24IJ3EUaeMFo3GKnYYdd1BdN8cfeI8Y=.4d6b67be-aaf3-44b3-af5e-0d37d28e8414@github.com> > Add flexible main methods and anonymous main classes to the Java language. Jim Laskey has updated the pull request incrementally with one additional commit since the last revision: Integrate JDK-8308916 and JDK-8308831 - javax.model ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13689/files - new: https://git.openjdk.org/jdk/pull/13689/files/850a2152..9d111c26 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=26 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=25-26 Stats: 313 lines in 6 files changed: 302 ins; 0 del; 11 mod Patch: https://git.openjdk.org/jdk/pull/13689.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13689/head:pull/13689 PR: https://git.openjdk.org/jdk/pull/13689 From apangin at openjdk.org Thu Jun 1 17:34:11 2023 From: apangin at openjdk.org (Andrei Pangin) Date: Thu, 1 Jun 2023 17:34:11 GMT Subject: RFR: 8308804: Improve UUID.randomUUID performance with bulk/scalable PRNG access [v7] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 09:37:29 GMT, Aleksey Shipilev wrote: >> UUID is the very important class that is used to track identities of objects in large scale systems. On some of our systems, `UUID.randomUUID` takes >1% of total CPU time, and is frequently a scalability bottleneck due to `SecureRandom` synchronization. >> >> The major issue with UUID code itself is that it reads from the single `SecureRandom` instance by 16 bytes. So the heavily contended `SecureRandom` is bashed with very small requests. This also has a chilling effect on other users of `SecureRandom`, when there is a heavy UUID generation traffic. >> >> We can improve this by doing the bulk reads from the backing SecureRandom and possibly striping the reads across many instances of it. >> >> >> Benchmark Mode Cnt Score Error Units >> >> ### AArch64 (m6g.4xlarge, Graviton, 16 cores) >> >> # Before >> UUIDRandomBench.single thrpt 15 3.545 ? 0.058 ops/us >> UUIDRandomBench.max thrpt 15 1.832 ? 0.059 ops/us ; negative scaling >> >> # After >> UUIDRandomBench.single thrpt 15 4.823 ? 0.023 ops/us >> UUIDRandomBench.max thrpt 15 6.561 ? 0.054 ops/us ; positive scaling, ~1.5x >> >> ### x86_64 (c6.8xlarge, Xeon, 18 cores) >> >> # Before >> UUIDRandomBench.single thrpt 15 2.710 ? 0.038 ops/us >> UUIDRandomBench.max thrpt 15 1.880 ? 0.029 ops/us ; negative scaling >> >> # After >> Benchmark Mode Cnt Score Error Units >> UUIDRandomBench.single thrpt 15 3.109 ? 0.026 ops/us >> UUIDRandomBench.max thrpt 15 3.561 ? 0.071 ops/us ; positive scaling, ~1.2x >> >> >> Note that there is still a scalability bottleneck in current default random (`NativePRNG`), because it synchronizes over a singleton instance for SHA1 mixer, then the engine itself, etc. -- it is quite a whack-a-mole to figure out the synchronization story there. The scalability fix in current default `SecureRandom` would be much more intrusive and risky, since it would change a core crypto class with unknown bug fanout. >> >> Using the bulk reads even when the underlying PRNG is heavily synchronized is still a win. A more scalable PRNG would benefit from this as well. This PR adds a system property to select the PRNG implementation, and there we can clearly see the benefit with more scalable PRNG sources: >> >> >> Benchmark Mode Cnt Score Error Units >> >> ### x86_64 (c6.8xlarge, Xeon, 18 cores) >> >> # Before, hacked `new SecureRandom()` to `SecureRandom.getInstance("SHA1PRNG")` >> UUIDRandomBench.single thrpt ... > > Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 13 commits: > > - Revert test changes > - Merge branch 'master' into JDK-8308804-uuid-buffers > - Simplify clinit > - Remove the properties > - Swap lsb/msb > - Fine-tune exceptions > - Handle privileged properties > - Use ByteArray to convert. Do version/variant preparations straight on locals. Move init out of optimistic lock section. > - More touchups > - Comment updates > - ... and 3 more: https://git.openjdk.org/jdk/compare/4460429d...fd7eaa1a src/java.base/share/classes/java/util/UUID.java line 181: > 179: > 180: private static UUID fromRandom(long msb, long lsb) { > 181: // set version to 3 The comment doesn't match the code. Is it version 4? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14135#discussion_r1213472422 From prr at openjdk.org Thu Jun 1 17:46:06 2023 From: prr at openjdk.org (Phil Race) Date: Thu, 1 Jun 2023 17:46:06 GMT Subject: RFR: 8308780: Fix the Java Integer types on Windows [v4] In-Reply-To: <3VAC9z-WjItzbkXeNreX7PGi18ypbaom-RjBJgHb9L4=.1e90295d-c012-47dd-b5fe-fa7889ce2c84@github.com> References: <-mAb3g-jnRbOa0PFdM8gVP-8zI8CRGwxPvSdXd3uPm8=.2e6ab688-3ca1-4b8a-8674-5245c3f7557f@github.com> <3VAC9z-WjItzbkXeNreX7PGi18ypbaom-RjBJgHb9L4=.1e90295d-c012-47dd-b5fe-fa7889ce2c84@github.com> Message-ID: On Thu, 1 Jun 2023 11:49:24 GMT, Julian Waters wrote: >> On Windows, the basic Java Integer types are defined as long and __int64 respectively. In particular, the former is rather problematic since it breaks compilation as the Visual C++ becomes stricter and more compliant with every release, which means the way Windows code treats long as a typedef for int is no longer correct, especially with -permissive- enabled. Instead of changing every piece of broken code to match the jint = long typedef, which is far too time consuming, we can instead change jint to an int (which is still the same 32 bit number type as long), as there are far fewer problems caused by this definition. It's better to get this over and done with sooner than later when a future version of Visual C++ finally starts to break on existing code > > Julian Waters has updated the pull request incrementally with one additional commit since the last revision: > > Fix the code that is actually warning I'm not sure I understand the logic here. I would not want to move to using Java typedefs in places where the windows APIs specify the types they are expecting. If something comes in from a JNI down-call we should convert it to the type expected by Windows using the name expected by Windows. Also "compilation" isn't nearly good enough. How is this being tested ? ------------- PR Comment: https://git.openjdk.org/jdk/pull/14125#issuecomment-1572518377 From mchung at openjdk.org Thu Jun 1 18:26:19 2023 From: mchung at openjdk.org (Mandy Chung) Date: Thu, 1 Jun 2023 18:26:19 GMT Subject: RFR: 8309241: ClassForNameLeak fails intermittently as the class loader hasn't been unloaded Message-ID: Convert `ClassForNameLeak` test to use `jdk.test.lib.util.ForceGC` that would be more reliable in waiting for the class loader to be unloaded. ------------- Commit messages: - 8309241: ClassForNameLeak fails intermittently as the class loader hasn't been unloaded Changes: https://git.openjdk.org/jdk/pull/14269/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14269&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309241 Stats: 58 lines in 1 file changed: 15 ins; 29 del; 14 mod Patch: https://git.openjdk.org/jdk/pull/14269.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14269/head:pull/14269 PR: https://git.openjdk.org/jdk/pull/14269 From dnsimon at openjdk.org Thu Jun 1 19:03:05 2023 From: dnsimon at openjdk.org (Doug Simon) Date: Thu, 1 Jun 2023 19:03:05 GMT Subject: RFR: 8309241: ClassForNameLeak fails intermittently as the class loader hasn't been unloaded In-Reply-To: References: Message-ID: <9PYd_QedzjigZE0D_I4HcICiEMwMusHUALZd-yeo4LU=.99f749a1-7f17-4f51-ab2e-31447a7eb3eb@github.com> On Thu, 1 Jun 2023 18:19:14 GMT, Mandy Chung wrote: > Convert `ClassForNameLeak` test to use `jdk.test.lib.util.ForceGC` that would be more reliable in waiting for the class loader to be unloaded. Marked as reviewed by dnsimon (Committer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14269#pullrequestreview-1456119608 From mchung at openjdk.org Thu Jun 1 19:03:05 2023 From: mchung at openjdk.org (Mandy Chung) Date: Thu, 1 Jun 2023 19:03:05 GMT Subject: RFR: 8309241: ClassForNameLeak fails intermittently as the class loader hasn't been unloaded In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 18:19:14 GMT, Mandy Chung wrote: > Convert `ClassForNameLeak` test to use `jdk.test.lib.util.ForceGC` that would be more reliable in waiting for the class loader to be unloaded. @dougxc has verified that the updated test passes on GraalVM (thanks). ------------- PR Comment: https://git.openjdk.org/jdk/pull/14269#issuecomment-1572619219 From jlaskey at openjdk.org Thu Jun 1 19:09:18 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Thu, 1 Jun 2023 19:09:18 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v28] In-Reply-To: References: Message-ID: > Add flexible main methods and anonymous main classes to the Java language. Jim Laskey has updated the pull request incrementally with one additional commit since the last revision: Integrating JDK-8308913 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13689/files - new: https://git.openjdk.org/jdk/pull/13689/files/9d111c26..f1acdb04 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=27 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=26-27 Stats: 26 lines in 1 file changed: 25 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/13689.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13689/head:pull/13689 PR: https://git.openjdk.org/jdk/pull/13689 From asotona at openjdk.org Thu Jun 1 19:28:11 2023 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 1 Jun 2023 19:28:11 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v2] In-Reply-To: References: Message-ID: <_QQg36e2Gem1E01bN6A6jJXC9x3AfInwMOF3j2kknqQ=.0ebd8190-306f-4e5d-9f32-4c37196e5aec@github.com> On Thu, 1 Jun 2023 15:04:00 GMT, Chen Liang wrote: >> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: >> >> fixed benchmarks > > src/java.base/share/classes/java/lang/Module.java line 1593: > >> 1591: private Class loadModuleInfoClass(InputStream in) throws IOException { >> 1592: final String MODULE_INFO = "module-info"; >> 1593: var cc = Classfile.of(Classfile.ConstantPoolSharingOption.DO_NOT_SHARE_CONSTANT_POOL); > > This `cc` can be stored in a static final field instead. Yes, we can avoid repeated construction of default class hierarchy resolver here. > src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 55: > >> 53: >> 54: static Classfile of() { >> 55: return new ClassfileImpl(); > > We can create a static final field in `ClassfileImpl` holding a default instance equivalent to that created by `new ClassfileImpl()` and have the `of()` factory return that instance instead. Global static default context will hold global shared cached class hierarchy resolver and that we want to avoid. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1213583268 PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1213585474 From asotona at openjdk.org Thu Jun 1 19:39:12 2023 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 1 Jun 2023 19:39:12 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v2] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 15:14:52 GMT, Chen Liang wrote: >> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: >> >> fixed benchmarks > > src/java.base/share/classes/jdk/internal/classfile/impl/StackMapGenerator.java line 840: > >> 838: try { >> 839: //clone SplitConstantPool with alternate context >> 840: var cc = Classfile.of(Classfile.StackMapsOption.DO_NOT_GENERATE_STACK_MAPS); > > This should set the Class hierarchy resolver, patch dead code, and filter dead labels options from the original context. Here the other options are irrelevant. The error report wraps already generated incomplete code attribute into a fake class to be able to print details to the error. I think even the stack map generation suppression is irrelevant here, will double check. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1213598996 From mchung at openjdk.org Thu Jun 1 19:44:11 2023 From: mchung at openjdk.org (Mandy Chung) Date: Thu, 1 Jun 2023 19:44:11 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v3] In-Reply-To: References: Message-ID: On Wed, 17 May 2023 17:20:37 GMT, Chen Liang wrote: >> Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. >> >> A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. >> >> Current problems: >> - [ ] The lazy var handle is quite slow on the first invocation. >> - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. >> - After that, the lazy handle has a performance on par with the regular var handle. >> - [ ] The class-loading-based test is not in a unit test >> - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading >> >> >> Benchmark Mode Cnt Score Error Units >> VarHandleLazyStaticInvocation.initializedInvocation avgt 30 0.769 ? 0.003 ns/op >> VarHandleLazyStaticInvocation.lazyInvocation avgt 30 0.767 ? 0.002 ns/op >> >> >> Benchmark Mode Cnt Score Error Units >> LazyStaticColdStart.methodHandleCreateEager ss 10 73140.100 ? 7735.276 ns/op >> LazyStaticColdStart.methodHandleCreateLazy ss 10 50000.000 ? 8482.883 ns/op >> LazyStaticColdStart.methodHandleInitializeCallEager ss 10 91350.100 ? 9776.343 ns/op >> LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 145540.200 ? 72894.865 ns/op >> LazyStaticColdStart.varHandleCreateEager ss 10 47069.900 ? 3513.909 ns/op >> LazyStaticColdStart.varHandleCreateLazy ss 10 24780.300 ? 5144.540 ns/op >> LazyStaticColdStart.varHandleInitializeCallEager ss 10 85479.700 ? 10816.983 ns/op >> LazyStaticColdStart.varHandleInitializeCallLazy ss 10 413630.100 ? 189370.448 ns/op > > 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 eight additional commits since the last revision: > > - Remove export for removed package > - Merge branch 'master' into lazy-static-varhandle > - Test the creation performance of handles, lazy one indeed better > - Merge branch 'master' into lazy-static-varhandle > - copyright year > - Benchmarks. lazy initialize is SLOW > - nuke meaningless overrides > - make static field var handles lazy and fix NPE in isAccessModeSupported I think the exact argument for `withInvokeExactBehavior` and `withInvokeBehavior` is swapped. I studied the patch and it seems a clever idea. I will do another pass to check if `VarHandle::asDirect` is only invoked when the var handle is doing field access. As for the implementation of `LazyStaticVarHandle`, I expect that `makeFieldHandle` can always create the direct var handle (i.e. `FieldStaticReadXXX` var handle) and then wrapped by `LazyStaticVarHandle` similar to how `IndirectVarHandle` does; something like this: LazyStaticVarHandle(VarHandle target, Class refc, boolean exact) { super(target.vform, exact); this.target = target; this.refc = refc; } Some overridden methods for example `describeConstable` can simply retrun `target.describeConstable()`. Do I miss some issue that it can't be implemented that way? src/java.base/share/classes/java/lang/invoke/LazyStaticVarHandle.java line 126: > 124: var delegate = this.delegate; > 125: return delegate == null ? (hasInvokeExactBehavior() ? this > 126: : new LazyStaticVarHandle(refc, field, writeAllowedOnFinalFields, false)) Suggestion: : new LazyStaticVarHandle(refc, field, writeAllowedOnFinalFields, true)) src/java.base/share/classes/java/lang/invoke/LazyStaticVarHandle.java line 134: > 132: var delegate = this.delegate; > 133: return delegate == null ? (!hasInvokeExactBehavior() ? this > 134: : new LazyStaticVarHandle(refc, field, writeAllowedOnFinalFields, true)) Suggestion: : new LazyStaticVarHandle(refc, field, writeAllowedOnFinalFields, false)) ------------- PR Review: https://git.openjdk.org/jdk/pull/13821#pullrequestreview-1456188245 PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1572667645 PR Review Comment: https://git.openjdk.org/jdk/pull/13821#discussion_r1213602428 PR Review Comment: https://git.openjdk.org/jdk/pull/13821#discussion_r1213602313 From jlaskey at openjdk.org Thu Jun 1 20:07:40 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Thu, 1 Jun 2023 20:07:40 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v29] In-Reply-To: References: Message-ID: <6uEQPQcZ9b-RmEk42cpkRONL_BSNGufigOGBtKqbGFA=.a37c1ed8-e5b0-4720-8a6a-56c32d056256@github.com> > Add flexible main methods and anonymous main classes to the Java language. Jim Laskey has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 45 commits: - Merge branch 'master' into 8306112 - Integrating JDK-8308913 - Integrate JDK-8308916 and JDK-8308831 - javax.model - Missing Preview feature enum - Restrict access to unnamed class members when doing separate compilation. - Merge branch 'master' into 8306112 - Remove mandated flag - Remove trailing whitespace - Add main tests for inferface/enum/record - Improving error recovery in presence of less important syntactic errors in top-level methods and fields. Author: Jan Lahoda - ... and 35 more: https://git.openjdk.org/jdk/compare/2bb19724...e39e3fe9 ------------- Changes: https://git.openjdk.org/jdk/pull/13689/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=28 Stats: 1648 lines in 41 files changed: 1471 ins; 32 del; 145 mod Patch: https://git.openjdk.org/jdk/pull/13689.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13689/head:pull/13689 PR: https://git.openjdk.org/jdk/pull/13689 From jvernee at openjdk.org Thu Jun 1 20:27:35 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 1 Jun 2023 20:27:35 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: References: Message-ID: On Mon, 29 May 2023 10:53:52 GMT, Maurizio Cimadamore wrote: >> As the FFM API evolved over time, some parts of the javadoc went out of sync. Now that most of the API is stable, it is a good time to look again at the javadoc as a whole, and bring some more consistency. >> >> While most of the changes in this PR are stylistic, I'd like to call out few things which resulted in API changes: >> >> * `MemorySegment::asSlice(long, long, long)` did not (incorrectly) specified requirement that its alignment parameter must be a power of two. >> >> * `MemoryLayout::sliceHandle` did not require the absence of dereference paths in the provided layout path. While that is technically possible to allow, currently the method is specified as returning a "slice" corresponding to some "nested layout", so following pointers seems incompatible with the spec. I have decided to disallow for now - we can always compatibly enable it later, if required. >> >> * `MemorySegment::copy` - most of the overloads did not specify that `UnsupportedOperationException` is thrown if the destination segment is read-only. >> >> * In several places, an extra `@throws IllegalArgumentException` or `@throws IllegalArgumentException` has been added to capture cases where element size * index computation can overflow. This is true for all the element-wise segment copy methods, for the indexed accessors in memory segment (e.g. `MemorySegment.getAtIndex(ValueLayout.OfInt, long)`), as well as for `SegmentAllocator::allocateArray(MemoryLayout, long)`. >> >> In all these cases (except for overflows), new tests have been added to cover the additional API changes (a CSR will also be filed to cover these). >> >> The class with most changes is `MemoryLayout`. I realized that the javadoc there was a bit sloppy around the definition of "layout paths". Now there are several subsection in the class javadoc, which explain how different kinds of paths can be used. I have introduced the notion of "open path elements" to denote those path elements that are not fully specified, and result in additional var handle coordinates to be added. There is also now a definition of what it means for a layout path to be "well-formed", so that all methods accepting a layout path can simply refer to it (this definition is tricky to give inline in the javadoc of the various path-accepting methods, as it depends on many factors). >> >> Another biggie change was in `MemorySegment` as now all dereference methods state precisely their spatial checks requirements, as well also specifying when the API can th... > > Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: > > Fix wrong link in layout well-formedness doc Overall a great cleanup, nice work! src/java.base/share/classes/java/lang/foreign/FunctionDescriptor.java line 91: > 89: /** > 90: * Returns a function descriptor with no return layout. > 91: * @return a new function descriptor, with no return layout. Maybe this should be collapsed into a single `{@return ...}` block. src/java.base/share/classes/java/lang/foreign/Linker.java line 201: > 199: *

    > 200: * All native linker implementations operate on a subset of memory layouts. More formally, a layout {@code L} > 201: * is supported by a native linker {@code NL} iff: I think using `iff` (if-and-only-if) is incorrect here, since certain linkers might impose additional constraints. For instance, the fallback linker doesn't support union layouts. Also, we want to further restrict variadic argument layouts as well as part of https://github.com/openjdk/jdk/pull/14225 Maybe we could say that all layouts passed to a linker must _at least_ adhere to the following constraints. src/java.base/share/classes/java/lang/foreign/Linker.java line 203: > 201: * is supported by a native linker {@code NL} iff: > 202: *

      > 203: *
    • {@code L} is a value layout {@code V} and {@code V.withoutName()} is equal to one of the following layout constants: I think the equivalence this is talking about is MemoryLayout::equals? Maybe a plain link should be added to that method as well? Suggestion: *
    • {@code L} is a value layout {@code V} and {@code V.withoutName()} is {@linkplain MemoryLayout#equals(Object) equal} to one of the following layout constants: src/java.base/share/classes/java/lang/foreign/Linker.java line 444: > 442: *

      > 443: * When an upcall stub is passed to a foreign function, a JVM crash might occur, if the foreign code casts the function pointer > 444: * associated with the upcall stub to a type that is incompatible with the type of the upcall stub. Moreover, if the method This kind of makes it sound like a crash can occur at the time of the cast. I think we should mention that the crash can occur when the function is invoked. Suggestion: * When an upcall stub is passed to a foreign function, a JVM crash might occur, if the foreign code casts the function pointer * associated with the upcall stub to a type that is incompatible with the type of the upcall stub, and then attempts to invoke the function through the resulting function pointer. Moreover, if the method src/java.base/share/classes/java/lang/foreign/Linker.java line 473: > 471: > 472: /** > 473: * Creates a method handle which is used to call a foreign function with the given signature and symbol. I always think of a function "symbol" mostly as the _name_ of the function, so it seems that "address" would be more correct here. Though, I might be wrong on that. It's hard to find a clear definition of "symbol" that applies to this specific use case. src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 54: > 52: * There are two leaves in the layout hierarchy, {@linkplain ValueLayout value layouts}, which are used to represent values of given size and kind (see > 53: * and {@linkplain PaddingLayout padding layouts} which are used, as the name suggests, to represent a portion of a memory > 54: * segment whose contents should be ignored, and which are primarily present for alignment reasons (see {@link MemoryLayout#paddingLayout(long)}). I think this `(see {@link MemoryLayout#paddingLayout(long)})` could be removed as well now, as the link was inlined. src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 149: > 147: * Some layout path elements, said open path elements, can select multiple layouts at once. For instance, > 148: * the open path elements {@link PathElement#sequenceElement()}, {@link PathElement#sequenceElement(long, long)} select > 149: * an unspecified element in a sequence layout. A var handles derived from a layout path containing one or more Suggestion: * an unspecified element in a sequence layout. A var handle derived from a layout path containing one or more src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 216: > 214: * layout path can be thought of as a function which updates the current layout {@code C_i-1} to some other layout > 215: * {@code C_i}. That is, for each path element {@code E1, E2, ... En}, in a layout path {@code P}, we compute > 216: * {@code C_i = f_i(C_i-1)}, where {@code f_i} is the selection function expressed the path element under consideration, Suggestion: * {@code C_i = f_i(C_i-1)}, where {@code f_i} is the selection function expressing the path element under consideration, src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 219: > 217: * denoted as {@code E_i}. The final layout {@code C_i} is also called the selected layout. > 218: *

      > 219: * A layout path P is considered well-formed for an initial layout {@code C_0} if all its path elements Using `@code`, as above: Suggestion: * A layout path {@code P} is considered well-formed for an initial layout {@code C_0} if all its path elements src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 271: > 269: * @apiNote This can be useful to compare two layouts that have different names, but are otherwise equal. > 270: * > 271: * @return a memory layout with the same characteristics as this layout, but with no name. Maybe `{@return ...}` should also be used here and for the above `withName` method. src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 297: > 295: * > 296: * @param byteAlignment the layout alignment constraint, expressed in bytes. > 297: * @return a memory layout with the same characteristics of this layout, but with the given alignment constraint. Same here. src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 325: > 323: *

    • its return type is {@code long};
    • > 324: *
    • it has a leading parameter of type {@code MemorySegment}, corresponding to the memory segment > 325: * to be accessed;
    • This is not correct. The returned method handle does not accept a MemorySegment. src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 326: > 324: *
    • it has a leading parameter of type {@code MemorySegment}, corresponding to the memory segment > 325: * to be accessed;
    • > 326: *
    • it has as many parameters of type {@code long}, one for each open path elements Grammatically, I think this should either use the singular form "open path element", or use "each *of the*". Suggestion: *
    • it has as many parameters of type {@code long}, one for each open path element src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 364: > 362: * selected value layout;
    • > 363: *
    • it has as many access coordinates of type {@code long}, one for each > 364: * open path elements in the provided layout path. The order of these access Suggestion: * open path element in the provided layout path. The order of these access src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 393: > 391: *

      > 392: * Multiple paths can be chained, by using dereference path elements. > 393: * A dereference path element allows to obtain a native memory segment whose base address is the address value "allows to obtain" doesn't sound right to me. I think it should either be "allows _subject_ to obtain" (where _subject_ is for instance "the user"), or it could also be "allows obtaining" (the the former seems more natural to me). Suggestion: * A dereference path element allows the user to obtain a native memory segment whose base address is the address value src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 418: > 416: * > 417: * @param elements the layout path elements. > 418: * @return a var handle that accesses a memory segment at the offset selected by the given layout path. This doesn't seem quite right. It is not the memory segment which is found at the offset given by the layout path, it is the base address. Maybe: Suggestion: * @return a var handle that accesses a memory segment whose base address is found at the offset selected by the given layout path. src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 436: > 434: *

    • its return type is {@code MemorySegment};
    • > 435: *
    • it has a leading parameter of type {@code MemorySegment}, corresponding to the memory segment > 436: * to be accessed;
    • Maybe accessed -> sliced, since no direct memory access occurs here. Suggestion: * to be sliced; src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 470: > 468: * @throws IllegalArgumentException if the layout path contains one or more dereference path elements. > 469: * @throws IllegalArgumentException if the layout path contains one or more path elements that select one or more > 470: * sequence element indices, such as {@link PathElement#sequenceElement(long)} and {@link PathElement#sequenceElement(long, long)}). Looks like the first method link should like to `PathElement#sequenceElement()` instead? (I think using a bound `sequenceElement` is fine right?) src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 499: > 497: * an address layout as its target layout. > 498: *
    > 499: * Sequence path elements selecting more than a sequence element layout are called Suggestion: * Sequence path elements selecting more than one sequence element layout are called src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 645: > 643: * is 1. As such, regardless of its size, in the absence of an {@linkplain #withByteAlignment(long) explicit} > 644: * alignment constraint, a padding layout does not affect the alignment constraint of the group or sequence layout > 645: * it is nested into. It is possible to override the alignment constraints of group and sequence layouts, so maybe this should say _natural alignment_. Suggestion: * alignment constraint, a padding layout does not affect the natural alignment of the group or sequence layout * it is nested into. src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 938: > 936: * the properties of this segment. For instance, if this segment is a {@linkplain #isReadOnly() read-only segment}, > 937: * then the resulting buffer is also {@linkplain ByteBuffer#isReadOnly() read-only}. Additionally, if this is a native > 938: * segment, the resulting buffer is a {@linkplain ByteBuffer#isDirect() direct buffer}. (Pre-existing, but seemed useful to mention) Rather than giving a few examples with 'For instance', perhaps this should more explicitly list _all_ the properties that are reflected in the returned buffer (not sure if there are more). src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 943: > 941: * the returned buffer's {@linkplain ByteBuffer#capacity() capacity} and {@linkplain ByteBuffer#limit() limit} > 942: * are both set to this segment' {@linkplain MemorySegment#byteSize() size}. For this reason, a byte buffer cannot be > 943: * returned if this segment' size is greater than {@link Integer#MAX_VALUE}. Suggestion: * returned if this segment's size is greater than {@link Integer#MAX_VALUE}. src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 951: > 949: *

    > 950: * If this segment is {@linkplain #isAccessibleBy(Thread) accessible} from a single thread, calling read/write I/O > 951: * operations on the resulting buffer might result in an unspecified exceptions being thrown. Examples of such problematic operations are Suggestion: * operations on the resulting buffer might result in unspecified exceptions being thrown. Examples of such problematic operations are src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 2196: > 2194: * with the alignment constraint in the source element layout. > 2195: * @throws IllegalArgumentException if {@code srcLayout.byteAlignment() > srcLayout.byteSize()}. > 2196: * @throws UnsupportedOperationException if {@code srcSegment} is {@linkplain #isReadOnly() read-only}. Isn't the source segment being read-only fine? (It seems to work when I test it). src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java line 388: > 386: * knows that they have fully processed the contents of the allocated segment before the subsequent allocation request > 387: * takes place. > 388: * @implNote While a prefix allocator is thread-safe, concurrent access on the same recycling Is the term "thread-safe" defined any where? Should it be? src/java.base/share/classes/java/lang/foreign/ValueLayout.java line 71: > 69: * > 70: * @param order the desired byte order. > 71: * @return a value layout with the same characteristics as this layout, but with the given byte order. Also seems like a candidate for `{@return ...}` test/jdk/java/foreign/TestLayoutPaths.java line 125: > 123: } > 124: > 125: public void testByteOffsetHandleRange() { Missing `@Test`? test/jdk/java/foreign/TestSegmentCopy.java line 92: > 90: if (type.layout.byteSize() > 1) { > 91: MemorySegment segment = MemorySegment.ofArray(new byte[100]); > 92: // check failure with read-only dest Comment seems unrelated? Suggestion: ------------- PR Comment: https://git.openjdk.org/jdk/pull/14098#issuecomment-1572729100 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213428607 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213450622 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213444071 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213513178 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213519613 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213537495 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213543002 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213546737 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213547221 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213549246 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213550462 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213553113 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213554350 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213560057 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213564647 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213567889 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213568928 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213575093 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213577557 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213584838 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213599402 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213600750 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213601348 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213608551 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213613960 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213620105 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213626975 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213628954 From jvernee at openjdk.org Thu Jun 1 20:27:37 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 1 Jun 2023 20:27:37 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: <3cPudNa3sSX5YbcoXvPy82F8-djLnh4b56Mdb0huj4k=.ce7e334a-d121-49bd-b478-f9fad49f50af@github.com> References: <3cPudNa3sSX5YbcoXvPy82F8-djLnh4b56Mdb0huj4k=.ce7e334a-d121-49bd-b478-f9fad49f50af@github.com> Message-ID: On Thu, 1 Jun 2023 13:06:15 GMT, Alan Bateman wrote: >> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix wrong link in layout well-formedness doc > > src/java.base/share/classes/java/lang/foreign/FunctionDescriptor.java line 127: > >> 125: /** >> 126: * Creates a function descriptor with the given argument layouts and no return layout. This is useful to model functions >> 127: * which return no values. > > I think I would use "that return" rather than "which return" here. I [looked this up](https://www.grammarly.com/blog/which-vs-that/), and learned something (thanks!). "which" is used for optional clauses. It implies the sentence could be written as "This is useful to model functions (which, by the way, return no values)". i.e. it is optional information about functions. "that" is used to indicate we're talking about a particular kind of function (implying also that there are multiple kinds). > src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java line 325: > >> 323: * @return a segment for the newly allocated memory block. >> 324: * @throws IllegalArgumentException if {@code elementLayout.byteSize() * count} overflows. >> 325: * @throws IllegalArgumentException if {@code count < 0}. > > Another case where the IAE descriptions should probably be combined. I think having the different failure cases split up like this makes the doc easier to read. (IIRC we used to have everything combined in the past, but got the advice at some point to split things up into separate `@throws` clauses). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213439901 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213611242 From jvernee at openjdk.org Thu Jun 1 20:27:37 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 1 Jun 2023 20:27:37 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 19:24:35 GMT, Jorn Vernee wrote: >> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix wrong link in layout well-formedness doc > > src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 645: > >> 643: * is 1. As such, regardless of its size, in the absence of an {@linkplain #withByteAlignment(long) explicit} >> 644: * alignment constraint, a padding layout does not affect the alignment constraint of the group or sequence layout >> 645: * it is nested into. > > It is possible to override the alignment constraints of group and sequence layouts, so maybe this should say _natural alignment_. > Suggestion: > > * alignment constraint, a padding layout does not affect the natural alignment of the group or sequence layout > * it is nested into. On a related note: should we even allow sequences of padding layouts? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213585708 From smarks at openjdk.org Thu Jun 1 20:36:31 2023 From: smarks at openjdk.org (Stuart Marks) Date: Thu, 1 Jun 2023 20:36:31 GMT Subject: RFR: 8307840: SequencedMap view method specification and implementation adjustments Message-ID: Adjust the specification of the `SequencedMap` sequenced-view methods, and adjust implementations to match. ------------- Commit messages: - Minor wording adjustment. - 8307840: SequencedMap view method specification and implementation adjustments Changes: https://git.openjdk.org/jdk/pull/14267/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14267&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8307840 Stats: 113 lines in 3 files changed: 64 ins; 3 del; 46 mod Patch: https://git.openjdk.org/jdk/pull/14267.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14267/head:pull/14267 PR: https://git.openjdk.org/jdk/pull/14267 From mcimadamore at openjdk.org Thu Jun 1 20:46:10 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Thu, 1 Jun 2023 20:46:10 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: <3cPudNa3sSX5YbcoXvPy82F8-djLnh4b56Mdb0huj4k=.ce7e334a-d121-49bd-b478-f9fad49f50af@github.com> References: <3cPudNa3sSX5YbcoXvPy82F8-djLnh4b56Mdb0huj4k=.ce7e334a-d121-49bd-b478-f9fad49f50af@github.com> Message-ID: <8Ib6l3Ykq0UOD-xVaKUyemJeQDbu5X5cW1mK4u3cnKM=.d6ab1330-7bc6-4c3c-914a-6c3e8b82605c@github.com> On Thu, 1 Jun 2023 13:16:44 GMT, Alan Bateman wrote: >> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix wrong link in layout well-formedness doc > > src/java.base/share/classes/java/lang/foreign/SequenceLayout.java line 75: > >> 73: * @return a sequence layout with the same characteristics of this layout, but with the given element count. >> 74: * @throws IllegalArgumentException if {@code elementCount} is negative. >> 75: * @throws IllegalArgumentException if {@code elementLayout.bitSize() * elementCount} overflows. > > Shouldn't the exception descriptions be combined to avoid IAE being listed twice in the generated javadoc? I think @PaulSandoz suggested this idiom in other places where the `@throws` clause was very hard to break up, so I thought that would have been preferrable than having a single para. But if there are strong opinions, I could tweak in different ways, perhaps with bullet lists (but that will require a lot of work). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213660125 From mcimadamore at openjdk.org Thu Jun 1 21:00:16 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Thu, 1 Jun 2023 21:00:16 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 19:25:38 GMT, Jorn Vernee wrote: >> src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 645: >> >>> 643: * is 1. As such, regardless of its size, in the absence of an {@linkplain #withByteAlignment(long) explicit} >>> 644: * alignment constraint, a padding layout does not affect the alignment constraint of the group or sequence layout >>> 645: * it is nested into. >> >> It is possible to override the alignment constraints of group and sequence layouts, so maybe this should say _natural alignment_. >> Suggestion: >> >> * alignment constraint, a padding layout does not affect the natural alignment of the group or sequence layout >> * it is nested into. > > On a related note: should we even allow sequences of padding layouts? I let sequence of padding slide on the basis that groups of padding are allowed. But it's a somewhat arbitrary line. That said, we do use stuff like that in jextract, where we model types we don't support (or bitfields) as padding. I think starting to ban padding in certain places would result in a less compositional API - and perhaps tools would have to workaround some of these limitations. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213672976 From mcimadamore at openjdk.org Thu Jun 1 21:00:21 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Thu, 1 Jun 2023 21:00:21 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: References: Message-ID: <4C4EUdcFz_tApI7-Nrv6zi_lbgOiDZPTHmwcmrezC5E=.ace6d428-7b07-40df-af44-42ae9222d29f@github.com> On Thu, 1 Jun 2023 19:36:48 GMT, Jorn Vernee wrote: >> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix wrong link in layout well-formedness doc > > src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 938: > >> 936: * the properties of this segment. For instance, if this segment is a {@linkplain #isReadOnly() read-only segment}, >> 937: * then the resulting buffer is also {@linkplain ByteBuffer#isReadOnly() read-only}. Additionally, if this is a native >> 938: * segment, the resulting buffer is a {@linkplain ByteBuffer#isDirect() direct buffer}. > > (Pre-existing, but seemed useful to mention) Rather than giving a few examples with 'For instance', perhaps this should more explicitly list _all_ the properties that are reflected in the returned buffer (not sure if there are more). Good idea - it is not trivial to capture all the properties in a single para. > src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java line 388: > >> 386: * knows that they have fully processed the contents of the allocated segment before the subsequent allocation request >> 387: * takes place. >> 388: * @implNote While a prefix allocator is thread-safe, concurrent access on the same recycling > > Is the term "thread-safe" defined any where? Should it be? I think the term is used pretty much all over the javadoc (not just FFM's) - e.g. look for this preamble: * value-based, * immutable and thread-safe ``` ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213670809 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213669418 From darcy at openjdk.org Thu Jun 1 21:04:30 2023 From: darcy at openjdk.org (Joe Darcy) Date: Thu, 1 Jun 2023 21:04:30 GMT Subject: RFR: JDK-8306584: Start of release updates for JDK 22 [v5] In-Reply-To: References: Message-ID: > Time to get JDK 22 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 29 commits: - Update symbol files for JDK 21 build 25. - Merge branch 'master' into JDK-8306584 - Refactor a few more enums. - Respond to review comments. - Merge branch 'master' into JDK-8306584 - Merge branch 'master' into JDK-8306584 - Merge branch 'master' into JDK-8306584 - Merge branch 'master' into JDK-8306584 - Sync in symbol changes for JDK 21 build 24. - Merge branch 'master' into JDK-8306584 - ... and 19 more: https://git.openjdk.org/jdk/compare/0ab09630...075a2ab6 ------------- Changes: https://git.openjdk.org/jdk/pull/13567/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13567&range=04 Stats: 5956 lines in 69 files changed: 5902 ins; 0 del; 54 mod Patch: https://git.openjdk.org/jdk/pull/13567.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13567/head:pull/13567 PR: https://git.openjdk.org/jdk/pull/13567 From mcimadamore at openjdk.org Thu Jun 1 21:09:14 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Thu, 1 Jun 2023 21:09:14 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: References: Message-ID: <62taiqcs7jZRPCvDZ5Ltd4Fb0QOByg3zvaG7OMEKPoU=.50734a98-539a-4fb4-a2b8-2bb0cfa07d17@github.com> On Thu, 1 Jun 2023 18:12:28 GMT, Jorn Vernee wrote: >> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix wrong link in layout well-formedness doc > > src/java.base/share/classes/java/lang/foreign/Linker.java line 444: > >> 442: *

    >> 443: * When an upcall stub is passed to a foreign function, a JVM crash might occur, if the foreign code casts the function pointer >> 444: * associated with the upcall stub to a type that is incompatible with the type of the upcall stub. Moreover, if the method > > This kind of makes it sound like a crash can occur at the time of the cast. I think we should mention that the crash can occur when the function is invoked. > Suggestion: > > * When an upcall stub is passed to a foreign function, a JVM crash might occur, if the foreign code casts the function pointer > * associated with the upcall stub to a type that is incompatible with the type of the upcall stub, and then attempts to invoke the function through the resulting function pointer. Moreover, if the method I agree that's better - I was also puzzled by the text (I think it's there from before, just shuffled?) > src/java.base/share/classes/java/lang/foreign/Linker.java line 473: > >> 471: >> 472: /** >> 473: * Creates a method handle which is used to call a foreign function with the given signature and symbol. > > I always think of a function "symbol" mostly as the _name_ of the function, so it seems that "address" would be more correct here. Though, I might be wrong on that. It's hard to find a clear definition of "symbol" that applies to this specific use case. the idea behind this is to connect with the javadoc of `SymbolLookup` which defines and then uses symbol all over the place. > src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 393: > >> 391: *

    >> 392: * Multiple paths can be chained, by using dereference path elements. >> 393: * A dereference path element allows to obtain a native memory segment whose base address is the address value > > "allows to obtain" doesn't sound right to me. I think it should either be "allows _subject_ to obtain" (where _subject_ is for instance "the user"), or it could also be "allows obtaining" (the the former seems more natural to me). > Suggestion: > > * A dereference path element allows the user to obtain a native memory segment whose base address is the address value I will also look for some other way to say this - typically when I end up with such convoluted sentences there's a better way to write it :-) > src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 418: > >> 416: * >> 417: * @param elements the layout path elements. >> 418: * @return a var handle that accesses a memory segment at the offset selected by the given layout path. > > This doesn't seem quite right. It is not the memory segment which is found at the offset given by the layout path, it is the base address. > > Maybe: > Suggestion: > > * @return a var handle that accesses a memory segment whose base address is found at the offset selected by the given layout path. Yeah - I meant what you said - but now that you said it, I also saw how what I've written can be prone to an alternate (and wrong) interpretation. I'll clarify. > src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 470: > >> 468: * @throws IllegalArgumentException if the layout path contains one or more dereference path elements. >> 469: * @throws IllegalArgumentException if the layout path contains one or more path elements that select one or more >> 470: * sequence element indices, such as {@link PathElement#sequenceElement(long)} and {@link PathElement#sequenceElement(long, long)}). > > Looks like the first method link should like to `PathElement#sequenceElement()` instead? (I think using a bound `sequenceElement` is fine right?) This is deliberate (but subtle). Basically, for `select` we just want to select a target layout (we don't care which). So the method has a preference for open sequence layout paths: there's no access or offset to model here, the method just needs to end up into some layout at the end of the path. One might argue that these restrictions are unnecessary - but I didn't feel strongly enough to drop them. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213681006 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213679251 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213677679 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213676964 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213675483 From mcimadamore at openjdk.org Thu Jun 1 21:09:16 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Thu, 1 Jun 2023 21:09:16 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: <62taiqcs7jZRPCvDZ5Ltd4Fb0QOByg3zvaG7OMEKPoU=.50734a98-539a-4fb4-a2b8-2bb0cfa07d17@github.com> References: <62taiqcs7jZRPCvDZ5Ltd4Fb0QOByg3zvaG7OMEKPoU=.50734a98-539a-4fb4-a2b8-2bb0cfa07d17@github.com> Message-ID: <02fGvGO-WlGfJeSweM2kgOdXpW2m6Sr4z4gUyIdWFj0=.b484c663-ddbd-4e26-b7b6-04cb9e01b7f4@github.com> On Thu, 1 Jun 2023 21:04:27 GMT, Maurizio Cimadamore wrote: >> src/java.base/share/classes/java/lang/foreign/Linker.java line 473: >> >>> 471: >>> 472: /** >>> 473: * Creates a method handle which is used to call a foreign function with the given signature and symbol. >> >> I always think of a function "symbol" mostly as the _name_ of the function, so it seems that "address" would be more correct here. Though, I might be wrong on that. It's hard to find a clear definition of "symbol" that applies to this specific use case. > > the idea behind this is to connect with the javadoc of `SymbolLookup` which defines and then uses symbol all over the place. Maybe a linkplan could help? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213679476 From mcimadamore at openjdk.org Thu Jun 1 21:12:09 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Thu, 1 Jun 2023 21:12:09 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 17:10:48 GMT, Jorn Vernee wrote: >> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix wrong link in layout well-formedness doc > > src/java.base/share/classes/java/lang/foreign/Linker.java line 201: > >> 199: *

    >> 200: * All native linker implementations operate on a subset of memory layouts. More formally, a layout {@code L} >> 201: * is supported by a native linker {@code NL} iff: > > I think using `iff` (if-and-only-if) is incorrect here, since certain linkers might impose additional constraints. For instance, the fallback linker doesn't support union layouts. Also, we want to further restrict variadic argument layouts as well as part of https://github.com/openjdk/jdk/pull/14225 > > Maybe we could say that all layouts passed to a linker must _at least_ adhere to the following constraints. I'll think about it - it's a bit problematic to specify in terms of "at least" because we need to be able to refer to "supported by NL" recursively in the text. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213683303 From mcimadamore at openjdk.org Thu Jun 1 21:16:10 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Thu, 1 Jun 2023 21:16:10 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: <3cPudNa3sSX5YbcoXvPy82F8-djLnh4b56Mdb0huj4k=.ce7e334a-d121-49bd-b478-f9fad49f50af@github.com> References: <3cPudNa3sSX5YbcoXvPy82F8-djLnh4b56Mdb0huj4k=.ce7e334a-d121-49bd-b478-f9fad49f50af@github.com> Message-ID: On Thu, 1 Jun 2023 13:00:58 GMT, Alan Bateman wrote: >> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix wrong link in layout well-formedness doc > > src/java.base/share/classes/java/lang/foreign/Arena.java line 269: > >> 267: * @throws IllegalStateException if this arena has already been {@linkplain #close() closed}. >> 268: * @throws WrongThreadException if this arena is confined, and this method is called from a thread {@code T} >> 269: * other than the arena's owner thread. > > "thread T" hints that "T" will be used later, maybe it's not needed. Correct - this is mostly a copy/paste issue for similar throws clauses in methods outside arena. > src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java line 363: > >> 361: * The returned allocator throws {@link IndexOutOfBoundsException} when a slice of the provided >> 362: * segment with the requested size and alignment cannot be found. >> 363: * @implNote A slicing allocator is not thread-safe. > > The implNote about thread safety makes me wonder if the SegmentAllocator should say something about thread safety, e.g. should it specify that the allocate methods are thread safe? I think SegmentAllocator should be agnostic re. thread safety. Allocation is a world of compromises, where if you give up (thread) safety you can gain more performance (and viceversa). So I think having a "one size fits all" thread-safety blanket might not work very well. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213686844 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213685702 From jvernee at openjdk.org Thu Jun 1 21:23:08 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 1 Jun 2023 21:23:08 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: <02fGvGO-WlGfJeSweM2kgOdXpW2m6Sr4z4gUyIdWFj0=.b484c663-ddbd-4e26-b7b6-04cb9e01b7f4@github.com> References: <62taiqcs7jZRPCvDZ5Ltd4Fb0QOByg3zvaG7OMEKPoU=.50734a98-539a-4fb4-a2b8-2bb0cfa07d17@github.com> <02fGvGO-WlGfJeSweM2kgOdXpW2m6Sr4z4gUyIdWFj0=.b484c663-ddbd-4e26-b7b6-04cb9e01b7f4@github.com> Message-ID: On Thu, 1 Jun 2023 21:04:42 GMT, Maurizio Cimadamore wrote: >> the idea behind this is to connect with the javadoc of `SymbolLookup` which defines and then uses symbol all over the place. > > Maybe a linkplan could help? Okay, but `SymbolLookup` also says this: "A symbol lookup retrieves the address of a symbol in one or more libraries." and "This symbol lookup, which is known as a default lookup, helps clients to quickly find addresses of well-known symbols." This seems to imply that "symbol" and "address" are two different things. I get the connection between the address and the SymbolLookup, but I'll note that it's also not necessary for a function address to come from a SymbolLookup (e.g. the address could be returned from native code, or be the address of an upcall stub). So, I feel like sticking with "address" is better. Maybe a paragraph (or just a `@see` tag) could be added to refer to SymbolLookup instead? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213693435 From liach at openjdk.org Thu Jun 1 21:26:25 2023 From: liach at openjdk.org (Chen Liang) Date: Thu, 1 Jun 2023 21:26:25 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v4] In-Reply-To: References: Message-ID: > Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. > > A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. > > Current problems: > - [ ] The lazy var handle is quite slow on the first invocation. > - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. > - After that, the lazy handle has a performance on par with the regular var handle. > - [ ] The class-loading-based test is not in a unit test > - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading > > > Benchmark Mode Cnt Score Error Units > VarHandleLazyStaticInvocation.initializedInvocation avgt 30 0.769 ? 0.003 ns/op > VarHandleLazyStaticInvocation.lazyInvocation avgt 30 0.767 ? 0.002 ns/op > > > Benchmark Mode Cnt Score Error Units > LazyStaticColdStart.methodHandleCreateEager ss 10 73140.100 ? 7735.276 ns/op > LazyStaticColdStart.methodHandleCreateLazy ss 10 50000.000 ? 8482.883 ns/op > LazyStaticColdStart.methodHandleInitializeCallEager ss 10 91350.100 ? 9776.343 ns/op > LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 145540.200 ? 72894.865 ns/op > LazyStaticColdStart.varHandleCreateEager ss 10 47069.900 ? 3513.909 ns/op > LazyStaticColdStart.varHandleCreateLazy ss 10 24780.300 ? 5144.540 ns/op > LazyStaticColdStart.varHandleInitializeCallEager ss 10 85479.700 ? 10816.983 ns/op > LazyStaticColdStart.varHandleInitializeCallLazy ss 10 413630.100 ? 189370.448 ns/op Chen Liang has updated the pull request incrementally with one additional commit since the last revision: Fix exact swap Co-authored-by: Mandy Chung ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13821/files - new: https://git.openjdk.org/jdk/pull/13821/files/6ed6b805..d347ee7e Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13821&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13821&range=02-03 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/13821.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13821/head:pull/13821 PR: https://git.openjdk.org/jdk/pull/13821 From liach at openjdk.org Thu Jun 1 21:26:27 2023 From: liach at openjdk.org (Chen Liang) Date: Thu, 1 Jun 2023 21:26:27 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v3] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 19:39:27 GMT, Mandy Chung wrote: > As for the implementation of `LazyStaticVarHandle`, I expect that `makeFieldHandle` can always create the direct var handle (i.e. `FieldStaticReadXXX` var handle) and then wrapped by `LazyStaticVarHandle` similar to how `IndirectVarHandle` does; Since I am not familiar with hotspot internals, I assumed that staticFieldBase and staticFieldOffset shouldn't be used until the class is initialized (rather than linked). This for certain can be done if they are ready once a class is linked, and we should probably update unsafe's comment as well. Can you confirm that they staticFieldBase/Offset are safe to be called before initialization? If this change is safe, we can significantly reduce the initial-call overhead of the lazy VH significantly as well. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1572801392 From naoto at openjdk.org Thu Jun 1 21:46:13 2023 From: naoto at openjdk.org (Naoto Sato) Date: Thu, 1 Jun 2023 21:46:13 GMT Subject: RFR: 8289220: [Shenandoah] TestAllocObjectArrays fails intermittently [v3] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 08:58:23 GMT, SUN Guoyun wrote: >> command: make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp" TEST=gc/TestAllocHumongousFragment.java >> error info: >> >> Caused by: java.lang.NullPointerException: Cannot invoke "sun.util.locale.BaseLocale.getVariant()" because "base" is null >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1802) >> at java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.(CLDRBaseLocaleDataMetaInfo.java:41) >> ... 24 more >> >> Note that the test runs with -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot and SoftReferences are involved (LocaleObjectCache uses SoftReferences, used by printf method called in getRandomInstance(Utils.java:511)). >> >> Maybe we have to deal with the case where the getBaseLocale() return value is null. the call stack is: >> >> at java.base/sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:64) >> at java.base/sun.util.locale.BaseLocale.getInstance(BaseLocale.java:169) >> at java.base/sun.util.locale.InternalLocaleBuilder.getBaseLocale(InternalLocaleBuilder.java:524) >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1874) >> >> in LocaleObjectCache.java:64 >> >> 62 if (key == null || newVal == null) { >> 63 // subclass must return non-null key/value object >> 64 return null; // run here >> 65 } > > SUN Guoyun has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision: > > 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared As to the patch, would you please elaborate on your changes more? To me, it is simply inlining `Key.normalize(key)` content into `Cache.createObject()`, and not sure how it prevents the issue in which the referent got GC'ed during the reference creation and use. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14211#issuecomment-1572826469 From jvernee at openjdk.org Thu Jun 1 21:51:12 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 1 Jun 2023 21:51:12 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: References: Message-ID: <5emZKvH2QID-_4OoGMZBeRhvu4QgIE4kyerwbEjcHIs=.03dabc86-edd0-40c1-a73f-e6dca3991bf7@github.com> On Thu, 1 Jun 2023 20:57:25 GMT, Maurizio Cimadamore wrote: >> On a related note: should we even allow sequences of padding layouts? > > I let sequence of padding slide on the basis that groups of padding are allowed. But it's a somewhat arbitrary line. That said, we do use stuff like that in jextract, where we model types we don't support (or bitfields) as padding. I think starting to ban padding in certain places would result in a less compositional API - and perhaps tools would have to workaround some of these limitations. Thanks, I agree with that analogy ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213714285 From jvernee at openjdk.org Thu Jun 1 21:51:10 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 1 Jun 2023 21:51:10 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: <62taiqcs7jZRPCvDZ5Ltd4Fb0QOByg3zvaG7OMEKPoU=.50734a98-539a-4fb4-a2b8-2bb0cfa07d17@github.com> References: <62taiqcs7jZRPCvDZ5Ltd4Fb0QOByg3zvaG7OMEKPoU=.50734a98-539a-4fb4-a2b8-2bb0cfa07d17@github.com> Message-ID: On Thu, 1 Jun 2023 21:00:33 GMT, Maurizio Cimadamore wrote: >> src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 470: >> >>> 468: * @throws IllegalArgumentException if the layout path contains one or more dereference path elements. >>> 469: * @throws IllegalArgumentException if the layout path contains one or more path elements that select one or more >>> 470: * sequence element indices, such as {@link PathElement#sequenceElement(long)} and {@link PathElement#sequenceElement(long, long)}). >> >> Looks like the first method link should like to `PathElement#sequenceElement()` instead? (I think using a bound `sequenceElement` is fine right?) > > This is deliberate (but subtle). Basically, for `select` we just want to select a target layout (we don't care which). So the method has a preference for open sequence layout paths: there's no access or offset to model here, the method just needs to end up into some layout at the end of the path. One might argue that these restrictions are unnecessary - but I didn't feel strongly enough to drop them. Ok, thanks for explaining. >> src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java line 388: >> >>> 386: * knows that they have fully processed the contents of the allocated segment before the subsequent allocation request >>> 387: * takes place. >>> 388: * @implNote While a prefix allocator is thread-safe, concurrent access on the same recycling >> >> Is the term "thread-safe" defined any where? Should it be? > > I think the term is used pretty much all over the javadoc (not just FFM's) - e.g. look for this preamble: > > * value-based, > * immutable and thread-safe > ``` Right, I guess I'm asking: can/should we do better? ;) It might be nice to define the term once and for all for the entire JDK, similar to how 'reachability' also has a central definition. (and then add a link from here). But, arguably, that seems like too much scope creep for this PR, so let's save it for a potential followup. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213714496 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213716230 From mseledtsov at openjdk.org Thu Jun 1 22:01:08 2023 From: mseledtsov at openjdk.org (Mikhailo Seledtsov) Date: Thu, 1 Jun 2023 22:01:08 GMT Subject: RFR: 8308090: Add container tests for on-the-fly resource quota updates [v2] In-Reply-To: References: Message-ID: On Tue, 23 May 2023 09:04:11 GMT, Severin Gehwolf wrote: >> Please review these test changes which implement automatic testing of container resource updates without JVM restart. Note that this merely tests container detection code handling this case. It doesn't do anything special for the JVM itself, though it might make sense to add some sanity checks should we detect certain limits changing. In another PR, though. >> >> As to the test design, it works similar to the shared temp tests: Interact between the two containers by virtue of a shared filesystem `/tmp` and creating marker files there in order to make them cooperate. Note that the new test needs `podman` version `4.3.0` and better (`4.5` is current). >> >> Testing: >> - [x] GHA >> - [x] Linux x86_64 container tests on cg v1 and cg v2 system >> - [x] Newly added tests on Linux x86_64 cg v1 and cg v2 (`podman` and `docker`) > > 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 three additional commits since the last revision: > > - Merge branch 'master' into jdk-8308090-tests-container-on-fly-updates > - Fix whitespace > - 8308090: Add container tests for on-the-fly resource quota updates Changes look good to me. Thank you for adding these tests. ------------- Marked as reviewed by mseledtsov (Committer). PR Review: https://git.openjdk.org/jdk/pull/14090#pullrequestreview-1456374316 From mchung at openjdk.org Thu Jun 1 23:25:09 2023 From: mchung at openjdk.org (Mandy Chung) Date: Thu, 1 Jun 2023 23:25:09 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v4] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 21:26:25 GMT, Chen Liang wrote: >> Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. >> >> A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. >> >> Current problems: >> - [ ] The lazy var handle is quite slow on the first invocation. >> - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. >> - After that, the lazy handle has a performance on par with the regular var handle. >> - [ ] The class-loading-based test is not in a unit test >> - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading >> >> >> Benchmark Mode Cnt Score Error Units >> VarHandleLazyStaticInvocation.initializedInvocation avgt 30 0.769 ? 0.003 ns/op >> VarHandleLazyStaticInvocation.lazyInvocation avgt 30 0.767 ? 0.002 ns/op >> >> >> Benchmark Mode Cnt Score Error Units >> LazyStaticColdStart.methodHandleCreateEager ss 10 73140.100 ? 7735.276 ns/op >> LazyStaticColdStart.methodHandleCreateLazy ss 10 50000.000 ? 8482.883 ns/op >> LazyStaticColdStart.methodHandleInitializeCallEager ss 10 91350.100 ? 9776.343 ns/op >> LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 145540.200 ? 72894.865 ns/op >> LazyStaticColdStart.varHandleCreateEager ss 10 47069.900 ? 3513.909 ns/op >> LazyStaticColdStart.varHandleCreateLazy ss 10 24780.300 ? 5144.540 ns/op >> LazyStaticColdStart.varHandleInitializeCallEager ss 10 85479.700 ? 10816.983 ns/op >> LazyStaticColdStart.varHandleInitializeCallLazy ss 10 413630.100 ? 189370.448 ns/op > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > Fix exact swap > > Co-authored-by: Mandy Chung `staticFieldBase` and `staticFieldOffset` can be called before initialization once a class has been linked. They are unsafe operations and so the code has to ensure class initialization before it accesses a static field. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1572912754 From jiangli at openjdk.org Thu Jun 1 23:41:08 2023 From: jiangli at openjdk.org (Jiangli Zhou) Date: Thu, 1 Jun 2023 23:41:08 GMT Subject: RFR: 8307858: [REDO] JDK-8307194 Add make target for optionally building a complete set of all JDK and hotspot libjvm static libraries [v4] In-Reply-To: References: Message-ID: <2f--_CXGRLyMkNXfMQe66aDhJ-zPPU7hplrNYRyKDMU=.9797a05f-36dd-4eea-bc12-aecb49749a1e@github.com> On Thu, 1 Jun 2023 16:18:24 GMT, Erik Joelsson wrote: > > > Another possibility might be the user provided `BUILD_LDCXX` includes extra options in the testing build (?). If that's the case, we probably could define a separate `BUILD_LD_PARTIAL` with no added options. In our prototype on JDK 11, we define a separate one for partial linking. > > > > > > I tried building `static-libs-image` for linux-aarch64 on Ubuntu machine using `devkit` to reproduce the failure. Also tried building for `linux-ppc64le-server-release` target using `devkit` on Ubuntu. Both built successfully with using `devkit`. I could not build a `devkit` for arm32 (with `make TARGETS="arm-linux-gnueabihf" BASE_OS=Fedora BASE_OS_VERSION=17`, also tried with BASE_OS_VERSION=17). > > @erikj79 Could you please help provide additional insight for the build failure you found for arm32? `BUILD_LIBJVM_partial_link.cmdline` might help shed some light. > > There are no extra options. I suspect it's an issue with the older GCC version. Here is one failing command line: > > ``` > $ ( cd /home/erik/git/jdk/build/linux-arm32 ; /var/tmp/jib-erik/install/jpg/infra/builddeps/devkit-linux_x64-to-linux_arm/gcc8.2.0-Fedora27+1.0/devkit-linux_x64-to-linux_arm-gcc8.2.0-Fedora27+1.0.tar.gz/x86_64-linux-gnu-to-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc -r --sysroot=/var/tmp/jib-erik/install/jpg/infra/builddeps/devkit-linux_x64-to-linux_arm/gcc8.2.0-Fedora27+1.0/devkit-linux_x64-to-linux_arm-gcc8.2.0-Fedora27+1.0.tar.gz/x86_64-linux-gnu-to-arm-linux-gnueabihf/arm-linux-gnueabihf/sysroot -o /home/erik/git/jdk/build/linux-arm32/support/native/java.rmi/librmi/static/librmi_relocatable.o /home/erik/git/jdk/build/linux-arm32/support/native/java.rmi/librmi/static/GC.o ) > /var/tmp/jib-erik/install/jpg/infra/builddeps/devkit-linux_x64-to-linux_arm/gcc8.2.0-Fedora27+1.0/devkit-linux_x64-to-linux_arm-gcc8.2.0-Fedora27+1.0.tar.gz/x86_64-linux-gnu-to-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.2.0/../../../../arm-linux-gnueabihf/bin/ld: fatal error: cannot mix -r with dynamic object /var/tmp/jib-erik/install/jpg/infra/builddeps/devkit-linux_x64-to-linux_arm/gcc8.2.0-Fedora27+1.0/devkit-linux_x64-to-linux_arm-gcc8.2.0-Fedora27+1.0.tar.gz/x86_64-linux-gnu-to-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.2.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so.1 > ``` > Thanks a lot for looking into the issue. > > The partial linking was originally suggested by C++/Clang toolchain folks to mitigate linker overhead that was observed during final executable link time. For a static library containing any object file (`.o`) that was compiled with ThinLTO (https://clang.llvm.org/docs/ThinLTO.html) enabled, linking an executable using the static library without distributed ThinLTO could experience more overhead and slow down linking. Solving the macosx `ar` limitation is a side-effect/benefit of using partial linking. We probably would want to include the partial linking even without the `ar` limitation. > > This seems to be Clang specific, so maybe only apply this to Clang and not GCC? Have you measured the difference in link time and concluded that this workaround is needed? If so, how big were the differences? It was noticeably slower (which prompted me looked into it at that time) when linking the executable using the static libraries created without partial linking workaround. In my experiments, it took >2m when linking final executable. With the mitigation the final linking took a few seconds. > Given that it prints a lot of warnings on mac, I would suggest leaving the partial linking out of this patch to get something in that is actually working. It was included in this patch because of the side effect it had with handling long path names. However, since looking closer at that issue, we were using a different workaround for Clang already and that same workaround should work fine for AR on mac as well. Sounds good for solving the macosx `ar` limitation differently. I'll change that. We can also exclude the partial linking part for gcc (due the older tool issue that you've found). Any concerns with including partial linking step for clang on Linux? ------------- PR Comment: https://git.openjdk.org/jdk/pull/14064#issuecomment-1572922666 From bpb at openjdk.org Fri Jun 2 00:07:12 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Fri, 2 Jun 2023 00:07:12 GMT Subject: RFR: 8309216: Cast from jchar* to char* in test java/io/GetXSpace.java Message-ID: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> For Unix, copy the `jchar`s into an allocated `char` array. ------------- Commit messages: - 8309216: Cast from jchar* to char* in test java/io/GetXSpace.java Changes: https://git.openjdk.org/jdk/pull/14276/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14276&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309216 Stats: 23 lines in 1 file changed: 19 ins; 0 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/14276.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14276/head:pull/14276 PR: https://git.openjdk.org/jdk/pull/14276 From bpb at openjdk.org Fri Jun 2 00:07:13 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Fri, 2 Jun 2023 00:07:13 GMT Subject: RFR: 8309216: Cast from jchar* to char* in test java/io/GetXSpace.java In-Reply-To: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> References: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> Message-ID: On Fri, 2 Jun 2023 00:00:07 GMT, Brian Burkhalter wrote: > For Unix, copy the `jchar`s into an allocated `char` array. Preliminary test run passes. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14276#issuecomment-1572936688 From dholmes at openjdk.org Fri Jun 2 01:08:08 2023 From: dholmes at openjdk.org (David Holmes) Date: Fri, 2 Jun 2023 01:08:08 GMT Subject: RFR: 8309196: Remove Thread.countStackFrames In-Reply-To: <7p3wapZUnzfzFKMyOVexaMVGeh00epZs3ipgw-LpvDM=.86006e6e-060a-4d9b-a883-4983381cdba7@github.com> References: <7p3wapZUnzfzFKMyOVexaMVGeh00epZs3ipgw-LpvDM=.86006e6e-060a-4d9b-a883-4983381cdba7@github.com> Message-ID: On Thu, 1 Jun 2023 06:40:04 GMT, Alan Bateman wrote: > Thread.countStackFrames is/was an ill-defined method that dates from JDK 1.0 for counting the stack frames of a suspended Thread. The method was deprecated in JDK 1.2 (1998), deprecated for removal in Java 9, and re-specified/degraded to throw UOE unconditionally in Java 14. Java 22 would be a fine time to finally remove this method. > > Code that wants to count stack frames should be directed to use j.l.StackWalker, or if is a a tool, then it can use JVM TI and other tool APIs. > > A corpus analysis of 30M classes in 131k artifacts from Maven Central found only 1 usages to this method. The 1 usage appears to be a class that just wraps all methods, it doesn't actually make use of it. Yes :) ------------- Marked as reviewed by dholmes (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14257#pullrequestreview-1456506531 From duke at openjdk.org Fri Jun 2 01:10:11 2023 From: duke at openjdk.org (SUN Guoyun) Date: Fri, 2 Jun 2023 01:10:11 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v3] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 08:58:23 GMT, SUN Guoyun wrote: >> command: make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp" TEST=gc/TestAllocHumongousFragment.java >> error info: >> >> Caused by: java.lang.NullPointerException: Cannot invoke "sun.util.locale.BaseLocale.getVariant()" because "base" is null >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1802) >> at java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.(CLDRBaseLocaleDataMetaInfo.java:41) >> ... 24 more >> >> Note that the test runs with -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot and SoftReferences are involved (LocaleObjectCache uses SoftReferences, used by printf method called in getRandomInstance(Utils.java:511)). >> >> Maybe we have to deal with the case where the getBaseLocale() return value is null. the call stack is: >> >> at java.base/sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:64) >> at java.base/sun.util.locale.BaseLocale.getInstance(BaseLocale.java:169) >> at java.base/sun.util.locale.InternalLocaleBuilder.getBaseLocale(InternalLocaleBuilder.java:524) >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1874) >> >> in LocaleObjectCache.java:64 >> >> 62 if (key == null || newVal == null) { >> 63 // subclass must return non-null key/value object >> 64 return null; // run here >> 65 } > > SUN Guoyun has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision: > > 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared src/java.base/share/classes/sun/util/locale/BaseLocale.java line 369: > 367: BaseLocale l = key.holder; > 368: BaseLocale locale = new BaseLocale(l.getLanguage(), l.getScript(), l.getRegion(), l.getVariant(), true); > 369: return (new Key(locale)).getBaseLocale(); Perhaps a more rigorous approach would look like this?

    
    BaseLocale locale = new BaseLocale(l.getLanguage(), l.getScript(), l.getRegion(), l.getVariant(), true);
    BaseLocal value = (new Key(locale)).getBaseLocale();
    Reference.reachabilityFence(locale);
    return value;
    
    But the current patch has passed the tests with `-XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot`, so I think the current patch is OK. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14211#discussion_r1213813143 From liach at openjdk.org Fri Jun 2 01:13:12 2023 From: liach at openjdk.org (Chen Liang) Date: Fri, 2 Jun 2023 01:13:12 GMT Subject: RFR: 8307149: MethodHandles.arrayConstructor can be cached In-Reply-To: References: Message-ID: On Thu, 4 May 2023 23:29:17 GMT, Chen Liang wrote: > This patch migrates `MethodHandles::arrayConstructor`, added in Java 9 as a hotfix to the incorrect constructor found on arrays via Lookup, to share the array access caching features. The result is that calling `MethodHandles.arrayConstructor` to create method handles is much faster. > > Oracle JDK 20: > > Benchmark Mode Cnt Score Error Units > MethodHandlesArrayConstructor.createWithAnewarray avgt 15 2.739 ? 0.058 ns/op > MethodHandlesArrayConstructor.createWithMethodHandle avgt 15 3.313 ? 0.041 ns/op > MethodHandlesArrayConstructor.methodHandleCreation avgt 15 61.874 ? 0.397 ns/op > > > This patch: > > Benchmark Mode Cnt Score Error Units > MethodHandlesArrayConstructor.createWithAnewarray avgt 15 3.067 ? 0.026 ns/op > MethodHandlesArrayConstructor.createWithMethodHandle avgt 15 3.699 ? 0.042 ns/op > MethodHandlesArrayConstructor.methodHandleCreation avgt 15 1.447 ? 0.004 ns/op keep-alive. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13819#issuecomment-1572983914 From liach at openjdk.org Fri Jun 2 01:22:07 2023 From: liach at openjdk.org (Chen Liang) Date: Fri, 2 Jun 2023 01:22:07 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v4] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 21:26:25 GMT, Chen Liang wrote: >> Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. >> >> A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. >> >> Current problems: >> - [ ] The lazy var handle is quite slow on the first invocation. >> - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. >> - After that, the lazy handle has a performance on par with the regular var handle. >> - [ ] The class-loading-based test is not in a unit test >> - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading >> >> >> Benchmark Mode Cnt Score Error Units >> VarHandleLazyStaticInvocation.initializedInvocation avgt 30 0.769 ? 0.003 ns/op >> VarHandleLazyStaticInvocation.lazyInvocation avgt 30 0.767 ? 0.002 ns/op >> >> >> Benchmark Mode Cnt Score Error Units >> LazyStaticColdStart.methodHandleCreateEager ss 10 73140.100 ? 7735.276 ns/op >> LazyStaticColdStart.methodHandleCreateLazy ss 10 50000.000 ? 8482.883 ns/op >> LazyStaticColdStart.methodHandleInitializeCallEager ss 10 91350.100 ? 9776.343 ns/op >> LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 145540.200 ? 72894.865 ns/op >> LazyStaticColdStart.varHandleCreateEager ss 10 47069.900 ? 3513.909 ns/op >> LazyStaticColdStart.varHandleCreateLazy ss 10 24780.300 ? 5144.540 ns/op >> LazyStaticColdStart.varHandleInitializeCallEager ss 10 85479.700 ? 10816.983 ns/op >> LazyStaticColdStart.varHandleInitializeCallLazy ss 10 413630.100 ? 189370.448 ns/op > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > Fix exact swap > > Co-authored-by: Mandy Chung In addition, should we initialize the ref class or the declaring class only? I don't think we need to initialize the ref class when declaring class initialization should be sufficient, but that is a change in behavior. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1572991154 From duke at openjdk.org Fri Jun 2 01:30:06 2023 From: duke at openjdk.org (SUN Guoyun) Date: Fri, 2 Jun 2023 01:30:06 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v3] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 09:03:23 GMT, SUN Guoyun wrote: >> SUN Guoyun has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision: >> >> 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared > > I've done basic testing jtreg tier1-3 and partial shenandoah testing with vmoptions `-Xcomp -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot`, the results are all OK. > @sunny868 Would you be able to add a JMH test to make sure that your change would not affect the startup time? All JMH tests or some of them? I had trigger JMH test, waiting for run results. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14211#issuecomment-1572999255 From duke at openjdk.org Fri Jun 2 02:10:09 2023 From: duke at openjdk.org (SUN Guoyun) Date: Fri, 2 Jun 2023 02:10:09 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v3] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 08:58:23 GMT, SUN Guoyun wrote: >> command: make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp" TEST=gc/TestAllocHumongousFragment.java >> error info: >> >> Caused by: java.lang.NullPointerException: Cannot invoke "sun.util.locale.BaseLocale.getVariant()" because "base" is null >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1802) >> at java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.(CLDRBaseLocaleDataMetaInfo.java:41) >> ... 24 more >> >> Note that the test runs with -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot and SoftReferences are involved (LocaleObjectCache uses SoftReferences, used by printf method called in getRandomInstance(Utils.java:511)). >> >> Maybe we have to deal with the case where the getBaseLocale() return value is null. the call stack is: >> >> at java.base/sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:64) >> at java.base/sun.util.locale.BaseLocale.getInstance(BaseLocale.java:169) >> at java.base/sun.util.locale.InternalLocaleBuilder.getBaseLocale(InternalLocaleBuilder.java:524) >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1874) >> >> in LocaleObjectCache.java:64 >> >> 62 if (key == null || newVal == null) { >> 63 // subclass must return non-null key/value object >> 64 return null; // run here >> 65 } > > SUN Guoyun has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision: > > 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared `make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot" TEST=java/util/Locale/SoftKeys.java` can trigger same error:
    
    Caused by: java.lang.NullPointerException: Cannot invoke "sun.util.locale.BaseLocale.getVariant()" because "base" is null
    	at java.base/java.util.Locale.forLanguageTag(Locale.java:1876)
    	at java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.(CLDRBaseLocaleDataMetaInfo.java:45)
    	... 19 more
    
    this patch can fix it. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14211#issuecomment-1573032287 From liach at openjdk.org Fri Jun 2 02:12:30 2023 From: liach at openjdk.org (Chen Liang) Date: Fri, 2 Jun 2023 02:12:30 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: References: Message-ID: > Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. > > A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. > > Current problems: > - [ ] The lazy var handle is quite slow on the first invocation. > - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. > - After that, the lazy handle has a performance on par with the regular var handle. > - [ ] The class-loading-based test is not in a unit test > - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading > > > Benchmark Mode Cnt Score Error Units > VarHandleLazyStaticInvocation.initializedInvocation avgt 30 0.769 ? 0.003 ns/op > VarHandleLazyStaticInvocation.lazyInvocation avgt 30 0.767 ? 0.002 ns/op > > > Benchmark Mode Cnt Score Error Units > LazyStaticColdStart.methodHandleCreateEager ss 10 73140.100 ? 7735.276 ns/op > LazyStaticColdStart.methodHandleCreateLazy ss 10 50000.000 ? 8482.883 ns/op > LazyStaticColdStart.methodHandleInitializeCallEager ss 10 91350.100 ? 9776.343 ns/op > LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 145540.200 ? 72894.865 ns/op > LazyStaticColdStart.varHandleCreateEager ss 10 47069.900 ? 3513.909 ns/op > LazyStaticColdStart.varHandleCreateLazy ss 10 24780.300 ? 5144.540 ns/op > LazyStaticColdStart.varHandleInitializeCallEager ss 10 85479.700 ? 10816.983 ns/op > LazyStaticColdStart.varHandleInitializeCallLazy ss 10 413630.100 ? 189370.448 ns/op 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 11 additional commits since the last revision: - Compute base and offset right after linking, simplify code - Merge branch 'master' into lazy-static-varhandle - Fix exact swap Co-authored-by: Mandy Chung - Remove export for removed package - Merge branch 'master' into lazy-static-varhandle - Test the creation performance of handles, lazy one indeed better - Merge branch 'master' into lazy-static-varhandle - copyright year - Benchmarks. lazy initialize is SLOW - nuke meaningless overrides - ... and 1 more: https://git.openjdk.org/jdk/compare/a32cfd30...27e18b7c ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13821/files - new: https://git.openjdk.org/jdk/pull/13821/files/d347ee7e..27e18b7c Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13821&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13821&range=03-04 Stats: 66891 lines in 1457 files changed: 47041 ins; 10823 del; 9027 mod Patch: https://git.openjdk.org/jdk/pull/13821.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13821/head:pull/13821 PR: https://git.openjdk.org/jdk/pull/13821 From mchung at openjdk.org Fri Jun 2 02:12:30 2023 From: mchung at openjdk.org (Mandy Chung) Date: Fri, 2 Jun 2023 02:12:30 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v4] In-Reply-To: References: Message-ID: <_-V-Ciz-CZV5h_1BMNM9-wfjf13Cb8EOrATGp5TKPl4=.0234d077-f447-4e78-9650-08210c88ffc0@github.com> On Fri, 2 Jun 2023 01:19:26 GMT, Chen Liang wrote: > In addition, should we initialize the ref class or the declaring class only? I don't think we need to initialize the ref class when declaring class initialization should be sufficient, but that is a change in behavior. Declaring class will be initialized [1]. refc should be equals to the declaring class because the static field to be looked up can only be found in the declaring class. There should be no behavioral change. [1] https://download.java.net/java/early_access/jdk21/docs/api/java.base/java/lang/invoke/MethodHandles.Lookup.html#findStaticVarHandle(java.lang.Class,java.lang.String,java.lang.Class) ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1573031355 From liach at openjdk.org Fri Jun 2 02:42:11 2023 From: liach at openjdk.org (Chen Liang) Date: Fri, 2 Jun 2023 02:42:11 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 02:12:30 GMT, Chen Liang wrote: >> Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. >> >> A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. >> >> Current problems: >> - [ ] The lazy var handle is quite slow on the first invocation. >> - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. >> - After that, the lazy handle has a performance on par with the regular var handle. >> - [ ] The class-loading-based test is not in a unit test >> - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading >> >> >> Benchmark Mode Cnt Score Error Units >> VarHandleLazyStaticInvocation.initializedInvocation avgt 30 12.668 ? 0.069 ns/op >> VarHandleLazyStaticInvocation.lazyInvocation avgt 30 12.683 ? 0.069 ns/op >> >> >> Benchmark Mode Cnt Score Error Units >> LazyStaticColdStart.methodHandleCreateEager ss 10 50.980 ? 9.454 us/op >> LazyStaticColdStart.methodHandleCreateLazy ss 10 24.350 ? 6.701 us/op >> LazyStaticColdStart.methodHandleInitializeCallEager ss 10 65.140 ? 7.552 us/op >> LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 118.360 ? 20.320 us/op >> LazyStaticColdStart.varHandleCreateEager ss 10 49.500 ? 4.277 us/op >> LazyStaticColdStart.varHandleCreateLazy ss 10 26.690 ? 5.157 us/op >> LazyStaticColdStart.varHandleInitializeCallEager ss 10 87.930 ? 12.643 us/op >> LazyStaticColdStart.varHandleInitializeCallLazy ss 10 1057.120 ? 189.810 us/op > > 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 11 additional commits since the last revision: > > - Compute base and offset right after linking, simplify code > - Merge branch 'master' into lazy-static-varhandle > - Fix exact swap > > Co-authored-by: Mandy Chung > - Remove export for removed package > - Merge branch 'master' into lazy-static-varhandle > - Test the creation performance of handles, lazy one indeed better > - Merge branch 'master' into lazy-static-varhandle > - copyright year > - Benchmarks. lazy initialize is SLOW > - nuke meaningless overrides > - ... and 1 more: https://git.openjdk.org/jdk/compare/b9ba7a85...27e18b7c Not quite. I mean scenarios like this: import java.lang.invoke.*; class Parent { public static final int[] value = {34}; } class Child extends Parent {} public class Test { public static void main(String... args) throws Throwable { System.out.println(Child.value[0]); var lookup = MethodHandles.lookup(); var getter = lookup.findStaticVarHandle(Child.class, "value", int[].class); System.out.println(((int[]) getter.getAcquire())[0]); } } Here, the `value` field is in parent, but it's accessed via a subclass and is resolved successfully. Are the refc and declaring class still equal here? I think we only need to initialize Parent without initializing Child in this case. I've also updated the benchmark for the latest patch. Unfortunately the regular invocations and lazy var handle initial call performance saw a decrease. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1573054150 From darcy at openjdk.org Fri Jun 2 02:46:26 2023 From: darcy at openjdk.org (Joe Darcy) Date: Fri, 2 Jun 2023 02:46:26 GMT Subject: RFR: JDK-8308913: Update core reflection for JEP 445 (preview) [v3] In-Reply-To: References: Message-ID: > Explain in java.lang.Class how unnamed classes are modeled in core reflection. 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 eight additional commits since the last revision: - Merge branch 'master' into JDK-8308913 - Merge branch 'master' into JDK-8308913 - Implement review feedback. - Merge branch 'master' into JDK-8308913 - Cleanup and edit text. - Respond to review comments. - Appease jcheck. - JDK-8308913: Update core reflection for JEP 445 (preview) ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14165/files - new: https://git.openjdk.org/jdk/pull/14165/files/ffdbbecd..05244653 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14165&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14165&range=01-02 Stats: 9712 lines in 220 files changed: 7677 ins; 1116 del; 919 mod Patch: https://git.openjdk.org/jdk/pull/14165.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14165/head:pull/14165 PR: https://git.openjdk.org/jdk/pull/14165 From liach at openjdk.org Fri Jun 2 03:36:35 2023 From: liach at openjdk.org (Chen Liang) Date: Fri, 2 Jun 2023 03:36:35 GMT Subject: RFR: 8304425: ClassHierarchyResolver from Reflection [v8] In-Reply-To: <08Hy6pEhV75yr_F4mCP-dkKOKMCSoFxWI2E7OnM4iyQ=.cfa14992-8e94-4d6d-bdf9-e6689549c83e@github.com> References: <08Hy6pEhV75yr_F4mCP-dkKOKMCSoFxWI2E7OnM4iyQ=.cfa14992-8e94-4d6d-bdf9-e6689549c83e@github.com> Message-ID: > Add API to explore Class Hierarchy with a `ClassLoader` or a `Lookup` with proper privileges, with tests. > > This addition is useful in case classes at runtime are not loaded from the system class loader, such as Proxy. This is also useful to APIs that generate bytecode with a `Lookup` object, such as a custom single-abstract-method class implementations from a method handle. > > See https://mail.openjdk.org/pipermail/classfile-api-dev/2023-March/000249.html as well. > > Current questions, which I wish to discuss with @asotona: > 1. Should the resolver fail fast on `IllegalAccessException` from the lookup? This usually indicates the hierarchy resolver is set up improperly, and proceeding may simply yield verification errors in class loading that are hard to track. For bytecode-generating APIs, throwing access errors for the Lookup eagerly is also more preferable than later silent generation failure. > 2. Whether the default resolver should be reading from jrt alone, reflection alone, or jrt then reflection. I personally believe reflection alone is more reliable, for classes may redefined with instrumentation or jfr, which may not be reflected in the system resources. > 3. In addition, I don't think chaining system class loader reflection after system resource retrieval is really meaningful: is there any case where reflection always works while the system resource retrieval always fails? Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 12 commits: - 1. Moved the default resolver to a static method, in anticipation of future changes 2. Removed SecurityManager related content 3. Changed ClassHierarchyInfo into an interface 4. Moved caching method from static to instance method - Merge branch 'master' into hierarchy-resolve - rename to ofClassLoading/ofResourceParsing convert the default class provider to bypass security manager restrictions - Merge branch 'master' into hierarchy-resolve - Merge branch 'master' into hierarchy-resolve - Test both cached and uncached resolvers - Update the class hierarchy resolver api as per mailing list last week - Merge branch 'master' into hierarchy-resolve - Update src/java.base/share/classes/jdk/internal/classfile/impl/ClassHierarchyImpl.java Co-authored-by: Andrey Turbanov - Make lookup based resolver throw on illegal access eagerly - ... and 2 more: https://git.openjdk.org/jdk/compare/101bf229...9e9079fb ------------- Changes: https://git.openjdk.org/jdk/pull/13082/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13082&range=07 Stats: 388 lines in 8 files changed: 294 ins; 29 del; 65 mod Patch: https://git.openjdk.org/jdk/pull/13082.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13082/head:pull/13082 PR: https://git.openjdk.org/jdk/pull/13082 From liach at openjdk.org Fri Jun 2 03:41:08 2023 From: liach at openjdk.org (Chen Liang) Date: Fri, 2 Jun 2023 03:41:08 GMT Subject: RFR: 8304425: ClassHierarchyResolver from Reflection [v8] In-Reply-To: References: <08Hy6pEhV75yr_F4mCP-dkKOKMCSoFxWI2E7OnM4iyQ=.cfa14992-8e94-4d6d-bdf9-e6689549c83e@github.com> Message-ID: On Fri, 2 Jun 2023 03:36:35 GMT, Chen Liang wrote: >> Add API to explore Class Hierarchy with a `ClassLoader` or a `Lookup` with proper privileges, with tests. >> >> This addition is useful in case classes at runtime are not loaded from the system class loader, such as Proxy. This is also useful to APIs that generate bytecode with a `Lookup` object, such as a custom single-abstract-method class implementations from a method handle. >> >> See https://mail.openjdk.org/pipermail/classfile-api-dev/2023-March/000249.html as well. >> >> Current questions, which I wish to discuss with @asotona: >> 1. Should the resolver fail fast on `IllegalAccessException` from the lookup? This usually indicates the hierarchy resolver is set up improperly, and proceeding may simply yield verification errors in class loading that are hard to track. For bytecode-generating APIs, throwing access errors for the Lookup eagerly is also more preferable than later silent generation failure. >> 2. Whether the default resolver should be reading from jrt alone, reflection alone, or jrt then reflection. I personally believe reflection alone is more reliable, for classes may redefined with instrumentation or jfr, which may not be reflected in the system resources. >> 3. In addition, I don't think chaining system class loader reflection after system resource retrieval is really meaningful: is there any case where reflection always works while the system resource retrieval always fails? > > Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 12 commits: > > - 1. Moved the default resolver to a static method, in anticipation of future changes > 2. Removed SecurityManager related content > 3. Changed ClassHierarchyInfo into an interface > 4. Moved caching method from static to instance method > - Merge branch 'master' into hierarchy-resolve > - rename to ofClassLoading/ofResourceParsing > convert the default class provider to bypass security manager restrictions > - Merge branch 'master' into hierarchy-resolve > - Merge branch 'master' into hierarchy-resolve > - Test both cached and uncached resolvers > - Update the class hierarchy resolver api as per mailing list last week > - Merge branch 'master' into hierarchy-resolve > - Update src/java.base/share/classes/jdk/internal/classfile/impl/ClassHierarchyImpl.java > > Co-authored-by: Andrey Turbanov > - Make lookup based resolver throw on illegal access eagerly > - ... and 2 more: https://git.openjdk.org/jdk/compare/101bf229...9e9079fb A brief summary of the latest update: 1. I've moved to implement all 3 API changes to ClassHierarchyResolver discussed on classfile-api-dev 2. I've dropped SecurityManager content; if they are needed by another patch, those patches can add on their own. This will be in conflict with the Classfile object update; I can update accordingly if that one is integrated first. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13082#issuecomment-1573096991 From darcy at openjdk.org Fri Jun 2 04:48:35 2023 From: darcy at openjdk.org (Joe Darcy) Date: Fri, 2 Jun 2023 04:48:35 GMT Subject: RFR: JDK-8308913: Update core reflection for JEP 445 (preview) [v4] In-Reply-To: References: Message-ID: > Explain in java.lang.Class how unnamed classes are modeled in core reflection. Joe Darcy has updated the pull request incrementally with one additional commit since the last revision: Update reflective support. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14165/files - new: https://git.openjdk.org/jdk/pull/14165/files/05244653..eead727d Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14165&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14165&range=02-03 Stats: 36 lines in 1 file changed: 29 ins; 0 del; 7 mod Patch: https://git.openjdk.org/jdk/pull/14165.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14165/head:pull/14165 PR: https://git.openjdk.org/jdk/pull/14165 From darcy at openjdk.org Fri Jun 2 04:51:06 2023 From: darcy at openjdk.org (Joe Darcy) Date: Fri, 2 Jun 2023 04:51:06 GMT Subject: RFR: JDK-8308913: Update core reflection for JEP 445 (preview) In-Reply-To: <8Yl9LB0CtuI0st9nNAd6BiKgnP0Ef77mWU2smcLRmRA=.b030f3d2-f511-41b0-be47-2abd5e3fd369@github.com> References: <8Yl9LB0CtuI0st9nNAd6BiKgnP0Ef77mWU2smcLRmRA=.b030f3d2-f511-41b0-be47-2abd5e3fd369@github.com> Message-ID: On Fri, 26 May 2023 20:37:39 GMT, Joe Darcy wrote: > > > Looks fine. This version matches the current implementation where `getCanonicalName` returns non-null. When the implementation of `getCanonicalName` is updated to return null, the spec should be updated. > > > Nit: `

    ` is needed assuming the section of "Unnamed Classes" has 3 paragraphs. > > > > > > Thanks @mlchung. > > Yes, the current spec matches what the implementation in @JimLaskey 's PR #13689 does at the time of writing. > > Discussions are on-going with the JEP 445 team regarding whether and how to implement a "isUnnamedClass" predicate for core reflection which would allow the `getCanonicalName` method to screen for unnamed classes and return null, as would reasonably be implied by a reading of the most current draft JLS updates. > > PS Depending on the result of those discussion, the specification for `getCanonicalName` may be changed to return `null`. PPS PR updated along those line; the changes will likely end up being integrated through Jim's existing JEP 445 PR. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14165#issuecomment-1573138645 From jpai at openjdk.org Fri Jun 2 05:04:05 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Fri, 2 Jun 2023 05:04:05 GMT Subject: RFR: 8309196: Remove Thread.countStackFrames In-Reply-To: <7p3wapZUnzfzFKMyOVexaMVGeh00epZs3ipgw-LpvDM=.86006e6e-060a-4d9b-a883-4983381cdba7@github.com> References: <7p3wapZUnzfzFKMyOVexaMVGeh00epZs3ipgw-LpvDM=.86006e6e-060a-4d9b-a883-4983381cdba7@github.com> Message-ID: On Thu, 1 Jun 2023 06:40:04 GMT, Alan Bateman wrote: > Thread.countStackFrames is/was an ill-defined method that dates from JDK 1.0 for counting the stack frames of a suspended Thread. The method was deprecated in JDK 1.2 (1998), deprecated for removal in Java 9, and re-specified/degraded to throw UOE unconditionally in Java 14. Java 22 would be a fine time to finally remove this method. > > Code that wants to count stack frames should be directed to use j.l.StackWalker, or if is a a tool, then it can use JVM TI and other tool APIs. > > A corpus analysis of 30M classes in 131k artifacts from Maven Central found only 1 usages to this method. The 1 usage appears to be a class that just wraps all methods, it doesn't actually make use of it. Marked as reviewed by jpai (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14257#pullrequestreview-1456650687 From iris at openjdk.org Fri Jun 2 05:59:03 2023 From: iris at openjdk.org (Iris Clark) Date: Fri, 2 Jun 2023 05:59:03 GMT Subject: RFR: 8309196: Remove Thread.countStackFrames In-Reply-To: <7p3wapZUnzfzFKMyOVexaMVGeh00epZs3ipgw-LpvDM=.86006e6e-060a-4d9b-a883-4983381cdba7@github.com> References: <7p3wapZUnzfzFKMyOVexaMVGeh00epZs3ipgw-LpvDM=.86006e6e-060a-4d9b-a883-4983381cdba7@github.com> Message-ID: On Thu, 1 Jun 2023 06:40:04 GMT, Alan Bateman wrote: > Thread.countStackFrames is/was an ill-defined method that dates from JDK 1.0 for counting the stack frames of a suspended Thread. The method was deprecated in JDK 1.2 (1998), deprecated for removal in Java 9, and re-specified/degraded to throw UOE unconditionally in Java 14. Java 22 would be a fine time to finally remove this method. > > Code that wants to count stack frames should be directed to use j.l.StackWalker, or if is a a tool, then it can use JVM TI and other tool APIs. > > A corpus analysis of 30M classes in 131k artifacts from Maven Central found only 1 usages to this method. The 1 usage appears to be a class that just wraps all methods, it doesn't actually make use of it. Happy to see this being removed early in JDK 22! ------------- Marked as reviewed by iris (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14257#pullrequestreview-1456700929 From smarks at openjdk.org Fri Jun 2 06:41:36 2023 From: smarks at openjdk.org (Stuart Marks) Date: Fri, 2 Jun 2023 06:41:36 GMT Subject: RFR: 8308167: SequencedMap::firstEntry throws NPE when first entry has null key or value Message-ID: <4oXToDIsaO3U3IzQqHeqccp2c6C2ZgeqLsldzqrHyiQ=.21611d5d-2941-4b99-9883-b6e0b8e2db3b@github.com> Create and use new NullableKeyValueHolder class to accommodate map entries whose key or value might be null. ------------- Commit messages: - 8308167: SequencedMap::firstEntry throws NPE when first entry has null key or value Changes: https://git.openjdk.org/jdk/pull/14278/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14278&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8308167 Stats: 214 lines in 4 files changed: 208 ins; 0 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/14278.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14278/head:pull/14278 PR: https://git.openjdk.org/jdk/pull/14278 From pminborg at openjdk.org Fri Jun 2 08:11:12 2023 From: pminborg at openjdk.org (Per Minborg) Date: Fri, 2 Jun 2023 08:11:12 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: References: <62taiqcs7jZRPCvDZ5Ltd4Fb0QOByg3zvaG7OMEKPoU=.50734a98-539a-4fb4-a2b8-2bb0cfa07d17@github.com> Message-ID: <-YkZMoSJbS9OS1h2cwsimnNYxZU7OhPENB4_ysuElmw=.ea0486c2-000c-4662-846f-d0143d0ae7f9@github.com> On Thu, 1 Jun 2023 21:47:23 GMT, Jorn Vernee wrote: >> I think the term is used pretty much all over the javadoc (not just FFM's) - e.g. look for this preamble: >> >> * value-based, >> * immutable and thread-safe >> ``` > > Right, I guess I'm asking: can/should we do better? ;) It might be nice to define the term once and for all for the entire JDK, similar to how 'reachability' also has a central definition. (and then add a link from here). > > But, arguably, that seems like too much scope creep for this PR, so let's save it for a potential followup. I think there is something we could start off from: https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/annotations/ThreadSafe.html This could be made under a separate issue. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1214060977 From pminborg at openjdk.org Fri Jun 2 08:25:11 2023 From: pminborg at openjdk.org (Per Minborg) Date: Fri, 2 Jun 2023 08:25:11 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: <-YkZMoSJbS9OS1h2cwsimnNYxZU7OhPENB4_ysuElmw=.ea0486c2-000c-4662-846f-d0143d0ae7f9@github.com> References: <62taiqcs7jZRPCvDZ5Ltd4Fb0QOByg3zvaG7OMEKPoU=.50734a98-539a-4fb4-a2b8-2bb0cfa07d17@github.com> <-YkZMoSJbS9OS1h2cwsimnNYxZU7OhPENB4_ysuElmw=.ea0486c2-000c-4662-846f-d0143d0ae7f9@github.com> Message-ID: On Fri, 2 Jun 2023 08:08:17 GMT, Per Minborg wrote: >> Right, I guess I'm asking: can/should we do better? ;) It might be nice to define the term once and for all for the entire JDK, similar to how 'reachability' also has a central definition. (and then add a link from here). >> >> But, arguably, that seems like too much scope creep for this PR, so let's save it for a potential followup. > > I think there is something we could start off from: https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/annotations/ThreadSafe.html > > This could be made under a separate issue. https://bugs.openjdk.org/browse/JDK-8309342 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1214075735 From alanb at openjdk.org Fri Jun 2 08:41:11 2023 From: alanb at openjdk.org (Alan Bateman) Date: Fri, 2 Jun 2023 08:41:11 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: References: <3cPudNa3sSX5YbcoXvPy82F8-djLnh4b56Mdb0huj4k=.ce7e334a-d121-49bd-b478-f9fad49f50af@github.com> Message-ID: On Thu, 1 Jun 2023 21:12:08 GMT, Maurizio Cimadamore wrote: > I think SegmentAllocator should be agnostic re. thread safety. Allocation is a world of compromises, where if you give up (thread) safety you can gain more performance (and viceversa). So I think having a "one size fits all" thread-safety blanket might not work very well. I'm just trying to think about the practical implications of this. Arena is specified to be thread-safe so I can allocate from a non-confined Arena, and from concurrent threads, without needing to coordinate. However, if you hand me a SegmentAllocator that is not an Arena then I don't know if I need to coordinate allocation with other parties. I'm not too concerned about the slicingAllocator and prefixAllocator factory methods as the result SegmentAllocators will likely be wrapped. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1214092803 From sgehwolf at openjdk.org Fri Jun 2 09:01:16 2023 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Fri, 2 Jun 2023 09:01:16 GMT Subject: RFR: 8308090: Add container tests for on-the-fly resource quota updates [v2] In-Reply-To: References: Message-ID: On Tue, 23 May 2023 09:04:11 GMT, Severin Gehwolf wrote: >> Please review these test changes which implement automatic testing of container resource updates without JVM restart. Note that this merely tests container detection code handling this case. It doesn't do anything special for the JVM itself, though it might make sense to add some sanity checks should we detect certain limits changing. In another PR, though. >> >> As to the test design, it works similar to the shared temp tests: Interact between the two containers by virtue of a shared filesystem `/tmp` and creating marker files there in order to make them cooperate. Note that the new test needs `podman` version `4.3.0` and better (`4.5` is current). >> >> Testing: >> - [x] GHA >> - [x] Linux x86_64 container tests on cg v1 and cg v2 system >> - [x] Newly added tests on Linux x86_64 cg v1 and cg v2 (`podman` and `docker`) > > 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 three additional commits since the last revision: > > - Merge branch 'master' into jdk-8308090-tests-container-on-fly-updates > - Fix whitespace > - 8308090: Add container tests for on-the-fly resource quota updates Thanks for the review! ------------- PR Comment: https://git.openjdk.org/jdk/pull/14090#issuecomment-1573393329 From sgehwolf at openjdk.org Fri Jun 2 09:01:19 2023 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Fri, 2 Jun 2023 09:01:19 GMT Subject: Integrated: 8308090: Add container tests for on-the-fly resource quota updates In-Reply-To: References: Message-ID: On Mon, 22 May 2023 16:40:40 GMT, Severin Gehwolf wrote: > Please review these test changes which implement automatic testing of container resource updates without JVM restart. Note that this merely tests container detection code handling this case. It doesn't do anything special for the JVM itself, though it might make sense to add some sanity checks should we detect certain limits changing. In another PR, though. > > As to the test design, it works similar to the shared temp tests: Interact between the two containers by virtue of a shared filesystem `/tmp` and creating marker files there in order to make them cooperate. Note that the new test needs `podman` version `4.3.0` and better (`4.5` is current). > > Testing: > - [x] GHA > - [x] Linux x86_64 container tests on cg v1 and cg v2 system > - [x] Newly added tests on Linux x86_64 cg v1 and cg v2 (`podman` and `docker`) This pull request has now been integrated. Changeset: dc8bc6c9 Author: Severin Gehwolf URL: https://git.openjdk.org/jdk/commit/dc8bc6c98ca1f9b441cf71c641675fe29dda9162 Stats: 434 lines in 5 files changed: 431 ins; 2 del; 1 mod 8308090: Add container tests for on-the-fly resource quota updates Reviewed-by: dholmes, mseledtsov ------------- PR: https://git.openjdk.org/jdk/pull/14090 From mcimadamore at openjdk.org Fri Jun 2 10:02:11 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Fri, 2 Jun 2023 10:02:11 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: References: <3cPudNa3sSX5YbcoXvPy82F8-djLnh4b56Mdb0huj4k=.ce7e334a-d121-49bd-b478-f9fad49f50af@github.com> Message-ID: On Fri, 2 Jun 2023 08:38:36 GMT, Alan Bateman wrote: >> I think SegmentAllocator should be agnostic re. thread safety. Allocation is a world of compromises, where if you give up (thread) safety you can gain more performance (and viceversa). So I think having a "one size fits all" thread-safety blanket might not work very well. > >> I think SegmentAllocator should be agnostic re. thread safety. Allocation is a world of compromises, where if you give up (thread) safety you can gain more performance (and viceversa). So I think having a "one size fits all" thread-safety blanket might not work very well. > > I'm just trying to think about the practical implications of this. Arena is specified to be thread-safe so I can allocate from a non-confined Arena, and from concurrent threads, without needing to coordinate. However, if you hand me a SegmentAllocator that is not an Arena then I don't know if I need to coordinate allocation with other parties. I'm not too concerned about the slicingAllocator and prefixAllocator factory methods as the result SegmentAllocators will likely be wrapped. In practice, SegmentAllocator will be used in two cases: * as a parameter to a downcall method handle which returns a by-value struct * as a building block to construct a custom arena In both cases, I think it's up to the client to decide how thread-safe allocation should be. For instance, if you use a SegmentAllocator in a custom arena, and the allocator is not thread-safe, well, you can always attach it to a custom _confined_ arena (so that thread-unsafety is not a problem). I think using a SegmentAllocator in isolation will be quite rare. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1214174042 From mcimadamore at openjdk.org Fri Jun 2 10:12:10 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Fri, 2 Jun 2023 10:12:10 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: References: <3cPudNa3sSX5YbcoXvPy82F8-djLnh4b56Mdb0huj4k=.ce7e334a-d121-49bd-b478-f9fad49f50af@github.com> Message-ID: On Fri, 2 Jun 2023 09:58:54 GMT, Maurizio Cimadamore wrote: >>> I think SegmentAllocator should be agnostic re. thread safety. Allocation is a world of compromises, where if you give up (thread) safety you can gain more performance (and viceversa). So I think having a "one size fits all" thread-safety blanket might not work very well. >> >> I'm just trying to think about the practical implications of this. Arena is specified to be thread-safe so I can allocate from a non-confined Arena, and from concurrent threads, without needing to coordinate. However, if you hand me a SegmentAllocator that is not an Arena then I don't know if I need to coordinate allocation with other parties. I'm not too concerned about the slicingAllocator and prefixAllocator factory methods as the result SegmentAllocators will likely be wrapped. > > In practice, SegmentAllocator will be used in two cases: > * as a parameter to a downcall method handle which returns a by-value struct > * as a building block to construct a custom arena > > In both cases, I think it's up to the client to decide how thread-safe allocation should be. For instance, if you use a SegmentAllocator in a custom arena, and the allocator is not thread-safe, well, you can always attach it to a custom _confined_ arena (so that thread-unsafety is not a problem). I think using a SegmentAllocator in isolation will be quite rare. Note that, beside thread-safety, there are other things that are inconvenient about a segment allocator: * an allocator is not constrained to return segments with the same lifetime; * an allocator does not provide any guarantee re. aliasing memory. Same memory region could be written over and over (this is what prefixAllocator does); These facts make it hard for clients SegmentAllocator to interact with a SegmentAllocator they don't own (unless they have to allocate precisely _one_ segment, on behalf of the client, and return it to them - which, not surprisingly is also what the Linker does). So, with SegmentAllocators there's always an element of trust: a client gave me an allocator to obtain a slab of memory, I trust the client to have done what it needed to do so that my operation can be safe. If I happen to allocate garbage (as a result of a race) it's on them. If you need to allocate multiple segments in a single "session", and have some lifetime guarantees of the segments that have been allocated and/or you want to make sure that what you get is not garbage (e.g. thread-safety, aliasing, etc.), then you need Arena. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1214183868 From duke at openjdk.org Fri Jun 2 10:14:00 2023 From: duke at openjdk.org (JoKern65) Date: Fri, 2 Jun 2023 10:14:00 GMT Subject: RFR: JDK-8309219: Fix xlc17 clang 15 warnings in java.base Message-ID: Compiling on AIX with xlc17 which contains the new clang 15 frontend shows the following warnings. built by make/modules/java.base/Lib.gmk src/java.base/unix/native/libnet/DefaultProxySelector.c:378:41:22: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error); ^ src/java.base/unix/native/libnet/NetworkInterface.c:1612:24: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wgnu-pointer-arith] end = (void *)nddp + size; ~~~~~~~~~~~~ ^ src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c:1251:7: error: '_ALLBSD_SOURCE' is not defined, evaluates to 0 [-Werror,-Wundef] #elif _ALLBSD_SOURCE built by make/modules/java.base/lib/CoreLibraries.gmk src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c:638 comparison of integers of different signs: 'int' and 'unsigned long' if (ret < sizeof(psinfo_t)) { ^ src/java.base/aix/native/libjli/java_md_aix.c:42:38: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wgnu-pointer-arith] addr < p->ldinfo_textorg + p->ldinfo_textsize) { ~~~~~~~~~~~~~~~~~ ^ src/java.base/share/native/libzip/zlib/inffast.c:74:20: error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] void ZLIB_INTERNAL inflate_fast(strm, start) ^ src/java.base/share/native/libjli/java.c:2311:22: error: format string is not a string literal [-Werror,-Wformat-nonliteral] vfprintf(stderr, fmt, vl); ^~~ The test library libGetXSpace.c also shows a warning. In addition, the cast in that lib is wrong, we opened "[JDK-8309216](https://bugs.openjdk.org/browse/JDK-8309216) cast from jchar* to char* in test GetXSpace.java" for that. ------------- Commit messages: - JDK-8309219 Changes: https://git.openjdk.org/jdk/pull/14281/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14281&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309219 Stats: 12 lines in 6 files changed: 3 ins; 0 del; 9 mod Patch: https://git.openjdk.org/jdk/pull/14281.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14281/head:pull/14281 PR: https://git.openjdk.org/jdk/pull/14281 From mcimadamore at openjdk.org Fri Jun 2 10:19:09 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Fri, 2 Jun 2023 10:19:09 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: <3cPudNa3sSX5YbcoXvPy82F8-djLnh4b56Mdb0huj4k=.ce7e334a-d121-49bd-b478-f9fad49f50af@github.com> References: <3cPudNa3sSX5YbcoXvPy82F8-djLnh4b56Mdb0huj4k=.ce7e334a-d121-49bd-b478-f9fad49f50af@github.com> Message-ID: On Thu, 1 Jun 2023 13:04:22 GMT, Alan Bateman wrote: >> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix wrong link in layout well-formedness doc > > src/java.base/share/classes/java/lang/foreign/FunctionDescriptor.java line 57: > >> 55: >> 56: /** >> 57: * {@return the argument layouts of this function descriptor (as an immutable list)}. > > I assume this should be "unmodifiable" rather than immutable here. This was derived from MethodType::parameterList, which also mentions immutable. I'm fine changing to "unmodifiable". ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1214190239 From asotona at openjdk.org Fri Jun 2 10:47:06 2023 From: asotona at openjdk.org (Adam Sotona) Date: Fri, 2 Jun 2023 10:47:06 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v2] In-Reply-To: <_QQg36e2Gem1E01bN6A6jJXC9x3AfInwMOF3j2kknqQ=.0ebd8190-306f-4e5d-9f32-4c37196e5aec@github.com> References: <_QQg36e2Gem1E01bN6A6jJXC9x3AfInwMOF3j2kknqQ=.0ebd8190-306f-4e5d-9f32-4c37196e5aec@github.com> Message-ID: On Thu, 1 Jun 2023 19:23:05 GMT, Adam Sotona wrote: >> src/java.base/share/classes/java/lang/Module.java line 1593: >> >>> 1591: private Class loadModuleInfoClass(InputStream in) throws IOException { >>> 1592: final String MODULE_INFO = "module-info"; >>> 1593: var cc = Classfile.of(Classfile.ConstantPoolSharingOption.DO_NOT_SHARE_CONSTANT_POOL); >> >> This `cc` can be stored in a static final field instead. > > Yes, we can avoid repeated construction of default class hierarchy resolver here. In this situation the ClassHierarchyResolver is never used and have no caching function. Adding static field with initializer does not make much sense here. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1214214987 From mcimadamore at openjdk.org Fri Jun 2 10:48:14 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Fri, 2 Jun 2023 10:48:14 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 21:09:12 GMT, Maurizio Cimadamore wrote: >> src/java.base/share/classes/java/lang/foreign/Linker.java line 201: >> >>> 199: *

    >>> 200: * All native linker implementations operate on a subset of memory layouts. More formally, a layout {@code L} >>> 201: * is supported by a native linker {@code NL} iff: >> >> I think using `iff` (if-and-only-if) is incorrect here, since certain linkers might impose additional constraints. For instance, the fallback linker doesn't support union layouts. Also, we want to further restrict variadic argument layouts as well as part of https://github.com/openjdk/jdk/pull/14225 >> >> Maybe we could say that all layouts passed to a linker must _at least_ adhere to the following constraints. > > I'll think about it - it's a bit problematic to specify in terms of "at least" because we need to be able to refer to "supported by NL" recursively in the text. I'll replace "if" with "iff". I think to address your comment on linker options affecting what's supported, we can add a paragraph in that sense (but I think I'd like to do that after we fix https://git.openjdk.org/jdk/pull/14225, so that I can add a link to somewhere concrete. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1214215055 From mcimadamore at openjdk.org Fri Jun 2 10:51:10 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Fri, 2 Jun 2023 10:51:10 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 19:58:49 GMT, Jorn Vernee wrote: >> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix wrong link in layout well-formedness doc > > src/java.base/share/classes/java/lang/foreign/ValueLayout.java line 71: > >> 69: * >> 70: * @param order the desired byte order. >> 71: * @return a value layout with the same characteristics as this layout, but with the given byte order. > > Also seems like a candidate for `{@return ...}` Possibly. The text is consistent in using different wording between the header and return (as I did a pass in that sense), but perhaps that's a bug. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1214217959 From mcimadamore at openjdk.org Fri Jun 2 11:10:09 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Fri, 2 Jun 2023 11:10:09 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: <62taiqcs7jZRPCvDZ5Ltd4Fb0QOByg3zvaG7OMEKPoU=.50734a98-539a-4fb4-a2b8-2bb0cfa07d17@github.com> References: <62taiqcs7jZRPCvDZ5Ltd4Fb0QOByg3zvaG7OMEKPoU=.50734a98-539a-4fb4-a2b8-2bb0cfa07d17@github.com> Message-ID: On Thu, 1 Jun 2023 21:02:13 GMT, Maurizio Cimadamore wrote: >> src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 418: >> >>> 416: * >>> 417: * @param elements the layout path elements. >>> 418: * @return a var handle that accesses a memory segment at the offset selected by the given layout path. >> >> This doesn't seem quite right. It is not the memory segment which is found at the offset given by the layout path, it is the base address. >> >> Maybe: >> Suggestion: >> >> * @return a var handle that accesses a memory segment whose base address is found at the offset selected by the given layout path. > > Yeah - I meant what you said - but now that you said it, I also saw how what I've written can be prone to an alternate (and wrong) interpretation. I'll clarify. Actually, looking back at this I'm not sure it's correct? We have an input memory segment MS. And a layout path. A layout path identifies an offset O at which MS has to be accessed in order to read a value (of some type). I'm not sure any of this depends on "base address" ? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1214235804 From asotona at openjdk.org Fri Jun 2 11:24:20 2023 From: asotona at openjdk.org (Adam Sotona) Date: Fri, 2 Jun 2023 11:24:20 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v3] In-Reply-To: References: Message-ID: > Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html > This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. > > Please review. > > Thanks, > 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 22 additional commits since the last revision: - fixed StackMapGenerator::generatorError and removed obsolete SplitConstantPool clone constructor - Merge branch 'master' into JDK-8308899-context - fixed benchmarks - fixed snippets and added SnippetsTest - fixed javadoc - added Classfile context parameter to ClasRemapper::remapClass - records and methods implementations moved from Classfile to ClassfileImpl - added Classfile::buildTo override - implementation of Classfile::withOptions(Option... options) ClassfileImpl made immutable "options" use across implementation renamed to "context" - added test for StackMapsOption.ALWAYS_GENERATE_STACK_MAPS fixed DirectCodeBuilder and added fast bypass when stack map is not needed - ... and 12 more: https://git.openjdk.org/jdk/compare/0945a741...f8915f91 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14180/files - new: https://git.openjdk.org/jdk/pull/14180/files/eae9bed3..f8915f91 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=01-02 Stats: 20638 lines in 447 files changed: 15729 ins; 1904 del; 3005 mod Patch: https://git.openjdk.org/jdk/pull/14180.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14180/head:pull/14180 PR: https://git.openjdk.org/jdk/pull/14180 From mcimadamore at openjdk.org Fri Jun 2 11:41:38 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Fri, 2 Jun 2023 11:41:38 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v5] In-Reply-To: References: Message-ID: > As the FFM API evolved over time, some parts of the javadoc went out of sync. Now that most of the API is stable, it is a good time to look again at the javadoc as a whole, and bring some more consistency. > > While most of the changes in this PR are stylistic, I'd like to call out few things which resulted in API changes: > > * `MemorySegment::asSlice(long, long, long)` did not (incorrectly) specified requirement that its alignment parameter must be a power of two. > > * `MemoryLayout::sliceHandle` did not require the absence of dereference paths in the provided layout path. While that is technically possible to allow, currently the method is specified as returning a "slice" corresponding to some "nested layout", so following pointers seems incompatible with the spec. I have decided to disallow for now - we can always compatibly enable it later, if required. > > * `MemorySegment::copy` - most of the overloads did not specify that `UnsupportedOperationException` is thrown if the destination segment is read-only. > > * In several places, an extra `@throws IllegalArgumentException` or `@throws IllegalArgumentException` has been added to capture cases where element size * index computation can overflow. This is true for all the element-wise segment copy methods, for the indexed accessors in memory segment (e.g. `MemorySegment.getAtIndex(ValueLayout.OfInt, long)`), as well as for `SegmentAllocator::allocateArray(MemoryLayout, long)`. > > In all these cases (except for overflows), new tests have been added to cover the additional API changes (a CSR will also be filed to cover these). > > The class with most changes is `MemoryLayout`. I realized that the javadoc there was a bit sloppy around the definition of "layout paths". Now there are several subsection in the class javadoc, which explain how different kinds of paths can be used. I have introduced the notion of "open path elements" to denote those path elements that are not fully specified, and result in additional var handle coordinates to be added. There is also now a definition of what it means for a layout path to be "well-formed", so that all methods accepting a layout path can simply refer to it (this definition is tricky to give inline in the javadoc of the various path-accepting methods, as it depends on many factors). > > Another biggie change was in `MemorySegment` as now all dereference methods state precisely their spatial checks requirements, as well also specifying when the API can throw because of an ... Maurizio Cimadamore has updated the pull request incrementally with three additional commits since the last revision: - Missed a review comment - Use more `{@return}` tags - Address review comments ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14098/files - new: https://git.openjdk.org/jdk/pull/14098/files/265e0d5b..44b382dd Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14098&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14098&range=03-04 Stats: 79 lines in 12 files changed: 12 ins; 15 del; 52 mod Patch: https://git.openjdk.org/jdk/pull/14098.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14098/head:pull/14098 PR: https://git.openjdk.org/jdk/pull/14098 From mcimadamore at openjdk.org Fri Jun 2 11:44:23 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Fri, 2 Jun 2023 11:44:23 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: References: Message-ID: <1OUz3rHrOqiGV5EsjJxqWUJa6xjhPsJZxdri320sPoY=.5e92ec5b-3638-42a4-b32f-d5e73714c16b@github.com> On Mon, 29 May 2023 10:53:52 GMT, Maurizio Cimadamore wrote: >> As the FFM API evolved over time, some parts of the javadoc went out of sync. Now that most of the API is stable, it is a good time to look again at the javadoc as a whole, and bring some more consistency. >> >> While most of the changes in this PR are stylistic, I'd like to call out few things which resulted in API changes: >> >> * `MemorySegment::asSlice(long, long, long)` did not (incorrectly) specified requirement that its alignment parameter must be a power of two. >> >> * `MemoryLayout::sliceHandle` did not require the absence of dereference paths in the provided layout path. While that is technically possible to allow, currently the method is specified as returning a "slice" corresponding to some "nested layout", so following pointers seems incompatible with the spec. I have decided to disallow for now - we can always compatibly enable it later, if required. >> >> * `MemorySegment::copy` - most of the overloads did not specify that `UnsupportedOperationException` is thrown if the destination segment is read-only. >> >> * In several places, an extra `@throws IllegalArgumentException` or `@throws IllegalArgumentException` has been added to capture cases where element size * index computation can overflow. This is true for all the element-wise segment copy methods, for the indexed accessors in memory segment (e.g. `MemorySegment.getAtIndex(ValueLayout.OfInt, long)`), as well as for `SegmentAllocator::allocateArray(MemoryLayout, long)`. >> >> In all these cases (except for overflows), new tests have been added to cover the additional API changes (a CSR will also be filed to cover these). >> >> The class with most changes is `MemoryLayout`. I realized that the javadoc there was a bit sloppy around the definition of "layout paths". Now there are several subsection in the class javadoc, which explain how different kinds of paths can be used. I have introduced the notion of "open path elements" to denote those path elements that are not fully specified, and result in additional var handle coordinates to be added. There is also now a definition of what it means for a layout path to be "well-formed", so that all methods accepting a layout path can simply refer to it (this definition is tricky to give inline in the javadoc of the various path-accepting methods, as it depends on many factors). >> >> Another biggie change was in `MemorySegment` as now all dereference methods state precisely their spatial checks requirements, as well also specifying when the API can th... > > Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: > > Fix wrong link in layout well-formedness doc Thanks for the comments so far, I've updated the javadoc in place: https://cr.openjdk.org/~mcimadamore/jdk/8308645/javadoc/java.base/java/lang/foreign/package-summary.html ------------- PR Comment: https://git.openjdk.org/jdk/pull/14098#issuecomment-1573599201 From jvernee at openjdk.org Fri Jun 2 11:49:11 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Fri, 2 Jun 2023 11:49:11 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: References: <62taiqcs7jZRPCvDZ5Ltd4Fb0QOByg3zvaG7OMEKPoU=.50734a98-539a-4fb4-a2b8-2bb0cfa07d17@github.com> Message-ID: On Fri, 2 Jun 2023 11:07:42 GMT, Maurizio Cimadamore wrote: >> Yeah - I meant what you said - but now that you said it, I also saw how what I've written can be prone to an alternate (and wrong) interpretation. I'll clarify. > > Actually, looking back at this I'm not sure it's correct? We have an input memory segment MS. And a layout path. A layout path identifies an offset O at which MS has to be accessed in order to read a value (of some type). I'm not sure any of this depends on "base address" ? Hmm, that's true. The base address that we read and turn into a memory segment isn't necessarily accessed, but the MS we read the base address from is. So, on second thought, I think the current text is good as it is. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1214272188 From jlaskey at openjdk.org Fri Jun 2 11:51:24 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Fri, 2 Jun 2023 11:51:24 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v30] In-Reply-To: References: Message-ID: > Add flexible main methods and anonymous main classes to the Java language. Jim Laskey has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 47 commits: - Merge branch 'master' into 8306112 - Update reflection to follow spec - Merge branch 'master' into 8306112 - Integrating JDK-8308913 - Integrate JDK-8308916 and JDK-8308831 - javax.model - Missing Preview feature enum - Restrict access to unnamed class members when doing separate compilation. - Merge branch 'master' into 8306112 - Remove mandated flag - Remove trailing whitespace - ... and 37 more: https://git.openjdk.org/jdk/compare/dc8bc6c9...0edcd9ae ------------- Changes: https://git.openjdk.org/jdk/pull/13689/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=29 Stats: 1678 lines in 41 files changed: 1500 ins; 32 del; 146 mod Patch: https://git.openjdk.org/jdk/pull/13689.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13689/head:pull/13689 PR: https://git.openjdk.org/jdk/pull/13689 From jwaters at openjdk.org Fri Jun 2 11:55:05 2023 From: jwaters at openjdk.org (Julian Waters) Date: Fri, 2 Jun 2023 11:55:05 GMT Subject: RFR: 8308780: Fix the Java Integer types on Windows [v4] In-Reply-To: References: <-mAb3g-jnRbOa0PFdM8gVP-8zI8CRGwxPvSdXd3uPm8=.2e6ab688-3ca1-4b8a-8674-5245c3f7557f@github.com> <3VAC9z-WjItzbkXeNreX7PGi18ypbaom-RjBJgHb9L4=.1e90295d-c012-47dd-b5fe-fa7889ce2c84@github.com> Message-ID: On Thu, 1 Jun 2023 17:43:02 GMT, Phil Race wrote: > I'm not sure I understand the logic here. I would not want to move to using Java typedefs in places where the windows APIs specify the types they are expecting. If something comes in from a JNI down-call we should convert it to the type expected by Windows using the name expected by Windows. I can change the jints in this PR to regular ints if required. As listed above, the native Windows API routines that the java.desktop code calls are actually expecting ints, so our existing declarations of passing longs to them are also wrong regardless, even without the Java typedefs Actually, now that I revisit this issue (shown in the list above), the only actual calls in this change that _don't_ take Java typedefs are the calls to ::Arc and ::Pie, so this is less of a problem than initially expected > Also "compilation" isn't nearly good enough. How is this being tested? `-permissive-` ------------- PR Comment: https://git.openjdk.org/jdk/pull/14125#issuecomment-1573611091 From erikj at openjdk.org Fri Jun 2 14:07:09 2023 From: erikj at openjdk.org (Erik Joelsson) Date: Fri, 2 Jun 2023 14:07:09 GMT Subject: RFR: 8307858: [REDO] JDK-8307194 Add make target for optionally building a complete set of all JDK and hotspot libjvm static libraries [v4] In-Reply-To: <2f--_CXGRLyMkNXfMQe66aDhJ-zPPU7hplrNYRyKDMU=.9797a05f-36dd-4eea-bc12-aecb49749a1e@github.com> References: <2f--_CXGRLyMkNXfMQe66aDhJ-zPPU7hplrNYRyKDMU=.9797a05f-36dd-4eea-bc12-aecb49749a1e@github.com> Message-ID: On Thu, 1 Jun 2023 23:38:03 GMT, Jiangli Zhou wrote: > Sounds good for solving the macosx `ar` limitation differently. I'll change that. We can also exclude the partial linking part for gcc (due the older tool issue that you've found). Any concerns with including partial linking step for clang on Linux? I have no concerns regarding clang on Linux. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14064#issuecomment-1573796012 From jvernee at openjdk.org Fri Jun 2 15:11:34 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Fri, 2 Jun 2023 15:11:34 GMT Subject: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v5] In-Reply-To: References: Message-ID: <0U6OHpqxSagnCFgRmh9lsYVn8cFfoImNp1SYL8To3Yc=.8e312520-78c6-4f0c-ab91-e8accddcbeb0@github.com> > In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and `float` is promoted to `double`, when being passed as variadic argument (see e.g. https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions). This patch restricts the layouts that can be used as variadic layouts to what is allowed by the C specification. > > The fallback linker is also updated to use to correct function to link variadic calls (not doing this turned out not to be a problem so far, but it is problematic for instance on Mac/AArch64 when using the fallback linker). Adding the restriction on layouts for all linkers is also partly motivated by the fallback linker rejecting such unsupported variadic layouts already. > > I've added a small paragraph to the Linker javadoc as well that explains the restriction. Comments on that are welcome, but please explain. > > The tests are updated to no longer try to link variadic functions with the illegal layouts, and I've added some more negative tests to TestIllegalLink. > > Testing: > - local testing on Windows/x64 > - tier1-3 + jdk-tier5 (ongoing) > - manual test run on mac/aarch64 with the fallback linker to verify the correctness of the fallback linker changes. Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: automatically apply variadic promotions ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14225/files - new: https://git.openjdk.org/jdk/pull/14225/files/1f1e22eb..38d759d6 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14225&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14225&range=03-04 Stats: 177 lines in 8 files changed: 110 ins; 51 del; 16 mod Patch: https://git.openjdk.org/jdk/pull/14225.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14225/head:pull/14225 PR: https://git.openjdk.org/jdk/pull/14225 From rriggs at openjdk.org Fri Jun 2 15:14:23 2023 From: rriggs at openjdk.org (Roger Riggs) Date: Fri, 2 Jun 2023 15:14:23 GMT Subject: RFR: 8304006: jlink should create the jimage file in the native endian for the target platform [v17] In-Reply-To: References: Message-ID: On Wed, 29 Mar 2023 01:40:36 GMT, Jaikiran Pai wrote: >> Can I please get a review for this change which proposes to fix the issue reported in https://bugs.openjdk.org/browse/JDK-8206890? >> >> The `jlink` command allows a `--endian` option to specify the byte order in the generated image. Before this change, when such a image was being launched, the code would assume the byte order in the image to be the native order of the host where the image is being launched. That would result in failure to launch java, as noted in the linked issue. >> >> The commit in this PR, changes relevant places to not assume native order and instead determine the byte order by reading the magic bytes in the image file's header content. >> >> A new jtreg test has been added which reproduces the issue and verifies the fix. > > Jaikiran Pai has updated the pull request incrementally with two additional commits since the last revision: > > - cleanup test - rename method and update code comment as suggested by Alan > - Rename KNOWN_ENDIANNESS to PLATFORM_PROPERTIES PR#[14063](https://github.com/openjdk/jdk/pull/14063) to add byte order and address size to Architecture has been updated but not integrated. It has no immediate use except perhaps this PR. So I think it can/should wait for integration until after the fork @ RPD1. ------------- PR Comment: https://git.openjdk.org/jdk/pull/11943#issuecomment-1573892813 From jvernee at openjdk.org Fri Jun 2 15:16:28 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Fri, 2 Jun 2023 15:16:28 GMT Subject: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v6] In-Reply-To: References: Message-ID: > In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and `float` is promoted to `double`, when being passed as variadic argument (see e.g. https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions). This patch restricts the layouts that can be used as variadic layouts to what is allowed by the C specification. > > The fallback linker is also updated to use to correct function to link variadic calls (not doing this turned out not to be a problem so far, but it is problematic for instance on Mac/AArch64 when using the fallback linker). Adding the restriction on layouts for all linkers is also partly motivated by the fallback linker rejecting such unsupported variadic layouts already. > > I've added a small paragraph to the Linker javadoc as well that explains the restriction. Comments on that are welcome, but please explain. > > The tests are updated to no longer try to link variadic functions with the illegal layouts, and I've added some more negative tests to TestIllegalLink. > > Testing: > - local testing on Windows/x64 > - tier1-3 + jdk-tier5 (ongoing) > - manual test run on mac/aarch64 with the fallback linker to verify the correctness of the fallback linker changes. Jorn Vernee 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 branch 'master' into VAFixes - undo spurious whitespace changes - automatically apply variadic promotions - move prototype-less name - Rework javadoc - review comments - fix word order - adjust whitespace - simplify test changes - reject invalid variadic layouts - ... and 1 more: https://git.openjdk.org/jdk/compare/ad4d487a...9daadbfc ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14225/files - new: https://git.openjdk.org/jdk/pull/14225/files/38d759d6..9daadbfc Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14225&range=05 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14225&range=04-05 Stats: 16078 lines in 335 files changed: 13372 ins; 1441 del; 1265 mod Patch: https://git.openjdk.org/jdk/pull/14225.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14225/head:pull/14225 PR: https://git.openjdk.org/jdk/pull/14225 From jvernee at openjdk.org Fri Jun 2 15:16:30 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Fri, 2 Jun 2023 15:16:30 GMT Subject: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v4] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 15:28:33 GMT, Jorn Vernee wrote: >> In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and `float` is promoted to `double`, when being passed as variadic argument (see e.g. https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions). This patch restricts the layouts that can be used as variadic layouts to what is allowed by the C specification. >> >> The fallback linker is also updated to use to correct function to link variadic calls (not doing this turned out not to be a problem so far, but it is problematic for instance on Mac/AArch64 when using the fallback linker). Adding the restriction on layouts for all linkers is also partly motivated by the fallback linker rejecting such unsupported variadic layouts already. >> >> I've added a small paragraph to the Linker javadoc as well that explains the restriction. Comments on that are welcome, but please explain. >> >> The tests are updated to no longer try to link variadic functions with the illegal layouts, and I've added some more negative tests to TestIllegalLink. >> >> Testing: >> - local testing on Windows/x64 >> - tier1-3 + jdk-tier5 (ongoing) >> - manual test run on mac/aarch64 with the fallback linker to verify the correctness of the fallback linker changes. > > Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: > > move prototype-less name After some offline discussion with Maurizio, we concluded that the linker should automatically apply the needed argument promotions, rather than reject the 'incorrect' layouts. This is more convenient to the user because they don't have to figure out how to do the promotions, but also because they don't have to figure out the platform dependent promotion process. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14225#issuecomment-1573892839 From mcimadamore at openjdk.org Fri Jun 2 15:55:13 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Fri, 2 Jun 2023 15:55:13 GMT Subject: RFR: 8308031: Linkers should promote variadic arguments [v6] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 15:16:28 GMT, Jorn Vernee wrote: >> In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and `float` is promoted to `double`, when being passed as variadic argument (see e.g. https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions). This patch adds the automatic argument promotion for variadic arguments, to align the implementation with the C specification. >> >> The fallback linker is also updated to use to correct function to link variadic calls (not doing this turned out not to be a problem so far, but it is problematic for instance on Mac/AArch64 when using the fallback linker). Adding the restriction on layouts for all linkers is also partly motivated by the fallback linker rejecting such unsupported variadic layouts already. >> >> I've added a small paragraph to the Linker javadoc as well that explains this. >> >> TestVarArgs needed to be updated in order to account for the difference in the promoted `float` values. >> >> Testing: >> - local testing on Windows/x64 >> - local testing on Linux/x64 using the fallback linker >> - tier1-3 + jdk-tier5 >> - manual test run on mac/aarch64 with the fallback linker to verify the correctness of the fallback linker changes. > > Jorn Vernee 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 branch 'master' into VAFixes > - undo spurious whitespace changes > - automatically apply variadic promotions > - move prototype-less name > - Rework javadoc > - review comments > - fix word order > - adjust whitespace > - simplify test changes > - reject invalid variadic layouts > - ... and 1 more: https://git.openjdk.org/jdk/compare/5aae3daf...9daadbfc Looks good. I left minor stylistic comments. src/java.base/share/classes/jdk/internal/foreign/abi/AbstractLinker.java line 261: > 259: // and float is promoted to double > 260: // See: https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions > 261: private static FunctionDescriptor promoteVariadicArgs(FunctionDescriptor function, int firstVariadicArgIndex) { Maybe it's unneeded optimization, but we're scanning the list of layouts once, and then once again to determine the resulting method type. Should we try to do both in one pass? src/java.base/share/classes/jdk/internal/foreign/abi/AbstractLinker.java line 327: > 325: } > 326: > 327: private static boolean requiresVariadicFloatPromotion(ValueLayout vl) { Should this be called `requiresVariadicDoublePromotion` ? (In the other method we say `int`, which is the target of the conversion). ------------- Marked as reviewed by mcimadamore (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14225#pullrequestreview-1457862860 PR Review Comment: https://git.openjdk.org/jdk/pull/14225#discussion_r1214549997 PR Review Comment: https://git.openjdk.org/jdk/pull/14225#discussion_r1214545214 From bpb at openjdk.org Fri Jun 2 15:57:31 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Fri, 2 Jun 2023 15:57:31 GMT Subject: RFR: 8309216: Cast from jchar* to char* in test java/io/GetXSpace.java [v2] In-Reply-To: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> References: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> Message-ID: > For Unix, copy the `jchar`s into an allocated `char` array. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8309216: Reformat malloc size calculation ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14276/files - new: https://git.openjdk.org/jdk/pull/14276/files/fb730a18..18506101 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14276&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14276&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14276.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14276/head:pull/14276 PR: https://git.openjdk.org/jdk/pull/14276 From jvernee at openjdk.org Fri Jun 2 15:59:09 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Fri, 2 Jun 2023 15:59:09 GMT Subject: RFR: 8308031: Linkers should promote variadic arguments [v6] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 15:47:05 GMT, Maurizio Cimadamore wrote: >> Jorn Vernee 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 branch 'master' into VAFixes >> - undo spurious whitespace changes >> - automatically apply variadic promotions >> - move prototype-less name >> - Rework javadoc >> - review comments >> - fix word order >> - adjust whitespace >> - simplify test changes >> - reject invalid variadic layouts >> - ... and 1 more: https://git.openjdk.org/jdk/compare/973fe55b...9daadbfc > > src/java.base/share/classes/jdk/internal/foreign/abi/AbstractLinker.java line 327: > >> 325: } >> 326: >> 327: private static boolean requiresVariadicFloatPromotion(ValueLayout vl) { > > Should this be called `requiresVariadicDoublePromotion` ? (In the other method we say `int`, which is the target of the conversion). Yes, I can do that. I was going for 'int' meaning 'integral' and 'float' meaning floating point. But I think your suggestion is clearer. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14225#discussion_r1214553721 From jvernee at openjdk.org Fri Jun 2 16:22:43 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Fri, 2 Jun 2023 16:22:43 GMT Subject: RFR: 8308031: Linkers should promote variadic arguments [v7] In-Reply-To: References: Message-ID: > In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and `float` is promoted to `double`, when being passed as variadic argument (see e.g. https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions). This patch adds the automatic argument promotion for variadic arguments, to align the implementation with the C specification. > > The fallback linker is also updated to use to correct function to link variadic calls (not doing this turned out not to be a problem so far, but it is problematic for instance on Mac/AArch64 when using the fallback linker). Adding the restriction on layouts for all linkers is also partly motivated by the fallback linker rejecting such unsupported variadic layouts already. > > I've added a small paragraph to the Linker javadoc as well that explains this. > > TestVarArgs needed to be updated in order to account for the difference in the promoted `float` values. > > Testing: > - local testing on Windows/x64 > - local testing on Linux/x64 using the fallback linker > - tier1-3 + jdk-tier5 > - manual test run on mac/aarch64 with the fallback linker to verify the correctness of the fallback linker changes. Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: address review comment ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14225/files - new: https://git.openjdk.org/jdk/pull/14225/files/9daadbfc..3ec04fa6 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14225&range=06 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14225&range=05-06 Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/14225.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14225/head:pull/14225 PR: https://git.openjdk.org/jdk/pull/14225 From jvernee at openjdk.org Fri Jun 2 16:22:45 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Fri, 2 Jun 2023 16:22:45 GMT Subject: RFR: 8308031: Linkers should promote variadic arguments [v6] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 15:52:06 GMT, Maurizio Cimadamore wrote: >> Jorn Vernee 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 branch 'master' into VAFixes >> - undo spurious whitespace changes >> - automatically apply variadic promotions >> - move prototype-less name >> - Rework javadoc >> - review comments >> - fix word order >> - adjust whitespace >> - simplify test changes >> - reject invalid variadic layouts >> - ... and 1 more: https://git.openjdk.org/jdk/compare/16267ba7...9daadbfc > > src/java.base/share/classes/jdk/internal/foreign/abi/AbstractLinker.java line 261: > >> 259: // and float is promoted to double >> 260: // See: https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions >> 261: private static FunctionDescriptor promoteVariadicArgs(FunctionDescriptor function, int firstVariadicArgIndex) { > > Maybe it's unneeded optimization, but we're scanning the list of layouts once, and then once again to determine the resulting method type. Should we try to do both in one pass? I considered keeping track of the promoted args in a boolean[], but I figured it was simpler to just scan the layouts again. And this is not really performance critical code. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14225#discussion_r1214570923 From psandoz at openjdk.org Fri Jun 2 16:32:10 2023 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 2 Jun 2023 16:32:10 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: References: Message-ID: <6lpkAjfDuU46l1k6iDWwuNhFgaxkLICRQNv5Sxh3U-Q=.957d4c50-5ee9-468c-b092-248dfbd56153@github.com> On Fri, 2 Jun 2023 02:12:30 GMT, Chen Liang wrote: >> Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. >> >> A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. >> >> Current problems: >> - [ ] The lazy var handle is quite slow on the first invocation. >> - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. >> - After that, the lazy handle has a performance on par with the regular var handle. >> - [ ] The class-loading-based test is not in a unit test >> - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading >> >> >> Benchmark Mode Cnt Score Error Units >> VarHandleLazyStaticInvocation.initializedInvocation avgt 30 12.668 ? 0.069 ns/op >> VarHandleLazyStaticInvocation.lazyInvocation avgt 30 12.683 ? 0.069 ns/op >> >> >> Benchmark Mode Cnt Score Error Units >> LazyStaticColdStart.methodHandleCreateEager ss 10 50.980 ? 9.454 us/op >> LazyStaticColdStart.methodHandleCreateLazy ss 10 24.350 ? 6.701 us/op >> LazyStaticColdStart.methodHandleInitializeCallEager ss 10 65.140 ? 7.552 us/op >> LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 118.360 ? 20.320 us/op >> LazyStaticColdStart.varHandleCreateEager ss 10 49.500 ? 4.277 us/op >> LazyStaticColdStart.varHandleCreateLazy ss 10 26.690 ? 5.157 us/op >> LazyStaticColdStart.varHandleInitializeCallEager ss 10 87.930 ? 12.643 us/op >> LazyStaticColdStart.varHandleInitializeCallLazy ss 10 1057.120 ? 189.810 us/op > > 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 11 additional commits since the last revision: > > - Compute base and offset right after linking, simplify code > - Merge branch 'master' into lazy-static-varhandle > - Fix exact swap > > Co-authored-by: Mandy Chung > - Remove export for removed package > - Merge branch 'master' into lazy-static-varhandle > - Test the creation performance of handles, lazy one indeed better > - Merge branch 'master' into lazy-static-varhandle > - copyright year > - Benchmarks. lazy initialize is SLOW > - nuke meaningless overrides > - ... and 1 more: https://git.openjdk.org/jdk/compare/cf71f03a...27e18b7c The latest revision looks a much better arrangement. I wonder if it is possible to transition from an lazy (indirect) VH to a direct VH once initialized i.e., `checkAccessModeThenIsDirect` returns the value of `initialized`. Thereby we reduce the potential footprint cost of inflating further MHs and take the more efficient route through the guard method on subsequent invocations. Not thought through all the implications of this, but since this will all occur in the interpreter it may well work out. We then get closer, conceptually at least, to the behavior of static field access using direct MHs. ------------- PR Review: https://git.openjdk.org/jdk/pull/13821#pullrequestreview-1457968612 From jvernee at openjdk.org Fri Jun 2 16:36:14 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Fri, 2 Jun 2023 16:36:14 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v5] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 11:41:38 GMT, Maurizio Cimadamore wrote: >> As the FFM API evolved over time, some parts of the javadoc went out of sync. Now that most of the API is stable, it is a good time to look again at the javadoc as a whole, and bring some more consistency. >> >> While most of the changes in this PR are stylistic, I'd like to call out few things which resulted in API changes: >> >> * `MemorySegment::asSlice(long, long, long)` did not (incorrectly) specified requirement that its alignment parameter must be a power of two. >> >> * `MemoryLayout::sliceHandle` did not require the absence of dereference paths in the provided layout path. While that is technically possible to allow, currently the method is specified as returning a "slice" corresponding to some "nested layout", so following pointers seems incompatible with the spec. I have decided to disallow for now - we can always compatibly enable it later, if required. >> >> * `MemorySegment::copy` - most of the overloads did not specify that `UnsupportedOperationException` is thrown if the destination segment is read-only. >> >> * In several places, an extra `@throws IllegalArgumentException` or `@throws IllegalArgumentException` has been added to capture cases where element size * index computation can overflow. This is true for all the element-wise segment copy methods, for the indexed accessors in memory segment (e.g. `MemorySegment.getAtIndex(ValueLayout.OfInt, long)`), as well as for `SegmentAllocator::allocateArray(MemoryLayout, long)`. >> >> In all these cases (except for overflows), new tests have been added to cover the additional API changes (a CSR will also be filed to cover these). >> >> The class with most changes is `MemoryLayout`. I realized that the javadoc there was a bit sloppy around the definition of "layout paths". Now there are several subsection in the class javadoc, which explain how different kinds of paths can be used. I have introduced the notion of "open path elements" to denote those path elements that are not fully specified, and result in additional var handle coordinates to be added. There is also now a definition of what it means for a layout path to be "well-formed", so that all methods accepting a layout path can simply refer to it (this definition is tricky to give inline in the javadoc of the various path-accepting methods, as it depends on many factors). >> >> Another biggie change was in `MemorySegment` as now all dereference methods state precisely their spatial checks requirements, as well also specifying when the API can th... > > Maurizio Cimadamore has updated the pull request incrementally with three additional commits since the last revision: > > - Missed a review comment > - Use more `{@return}` tags > - Address review comments Marked as reviewed by jvernee (Reviewer). src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 945: > 943: * cannot be returned if this segment's size is greater than {@link Integer#MAX_VALUE}; > 944: *

  • It is a {@linkplain ByteBuffer#isDirect() direct buffer}, if this is a native segment.
  • > 945: * Nice! ------------- PR Review: https://git.openjdk.org/jdk/pull/14098#pullrequestreview-1457977686 PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1214587551 From mchung at openjdk.org Fri Jun 2 16:47:09 2023 From: mchung at openjdk.org (Mandy Chung) Date: Fri, 2 Jun 2023 16:47:09 GMT Subject: RFR: JDK-8308913: Update core reflection for JEP 445 (preview) [v4] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 04:48:35 GMT, Joe Darcy wrote: >> Explain in java.lang.Class how unnamed classes are modeled in core reflection. > > Joe Darcy has updated the pull request incrementally with one additional commit since the last revision: > > Update reflective support. src/java.base/share/classes/java/lang/Class.java line 1884: > 1882: reflective=true) > 1883: public boolean isUnnamedClass() { > 1884: return isSynthetic() && PreviewFeatures.isEnabled() && isTopLevelClass(); Should this include more tests such as not abstract, final, package access, in an unnamed package, etc to accurately determine it's an unnamed class? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14165#discussion_r1214597498 From mchung at openjdk.org Fri Jun 2 17:19:07 2023 From: mchung at openjdk.org (Mandy Chung) Date: Fri, 2 Jun 2023 17:19:07 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 02:37:13 GMT, Chen Liang wrote: > I think we only need to initialize Parent without initializing Child in this case. The bytecode behavior to access the field via `lookup.findStaticVarHandle(Child.class, "value", int[].class)` is `Child.value;`. The class or interface that declared the resolved field is initialized per JVMS `getStatic` and `putStatic`. So I think `Parent` is initialized but not `Child`. @PaulSandoz can confirm. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1574063904 From darcy at openjdk.org Fri Jun 2 17:28:08 2023 From: darcy at openjdk.org (Joe Darcy) Date: Fri, 2 Jun 2023 17:28:08 GMT Subject: RFR: JDK-8308913: Update core reflection for JEP 445 (preview) [v4] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 16:44:35 GMT, Mandy Chung wrote: >> Joe Darcy has updated the pull request incrementally with one additional commit since the last revision: >> >> Update reflective support. > > src/java.base/share/classes/java/lang/Class.java line 1884: > >> 1882: reflective=true) >> 1883: public boolean isUnnamedClass() { >> 1884: return isSynthetic() && PreviewFeatures.isEnabled() && isTopLevelClass(); > > Should this include more tests such as not abstract, final, package access, in an unnamed package, etc to accurately determine it's an unnamed class? Hmm. I think adding at least a check for ACC_FINAL should be fine as it should have near-zero cost on top of the existing predicate once the method get compiled. (In future iterations of the JEP, the idiom to identify isUnnamed will likely change.) ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14165#discussion_r1214633943 From naoto at openjdk.org Fri Jun 2 17:32:11 2023 From: naoto at openjdk.org (Naoto Sato) Date: Fri, 2 Jun 2023 17:32:11 GMT Subject: RFR: 8303530: Redefine JAXP Configuration File [v15] In-Reply-To: <3a89aGPMevtuww_1Dc3KZxJzEzw_6I1jS9fRyp05thM=.a86422a5-13da-4ebb-8e65-16c3e008148b@github.com> References: <3a89aGPMevtuww_1Dc3KZxJzEzw_6I1jS9fRyp05thM=.a86422a5-13da-4ebb-8e65-16c3e008148b@github.com> Message-ID: On Wed, 31 May 2023 21:58:44 GMT, Joe Wang wrote: >> Add a system property, jdk.xml.config.file, to return the path to a custom JAXP configuration file. The current configuration file, jaxp.properties, that the JDK supports will become the default configuration file. >> >> CSR: https://bugs.openjdk.org/browse/JDK-8303531 >> >> Tests: XML SQE and JCK tests passed. > > Joe Wang has updated the pull request incrementally with one additional commit since the last revision: > > adjust javadoc Marked as reviewed by naoto (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/12985#pullrequestreview-1458112588 From bchristi at openjdk.org Fri Jun 2 18:01:06 2023 From: bchristi at openjdk.org (Brent Christian) Date: Fri, 2 Jun 2023 18:01:06 GMT Subject: RFR: 8309241: ClassForNameLeak fails intermittently as the class loader hasn't been unloaded In-Reply-To: References: Message-ID: <_cpHHwjwKmLlXTKbg6OMb7Oa9eCZLMjy0MvOiLBFewk=.ccd50eda-dd38-4df8-99fa-a4b2482e71a3@github.com> On Thu, 1 Jun 2023 18:19:14 GMT, Mandy Chung wrote: > Convert `ClassForNameLeak` test to use `jdk.test.lib.util.ForceGC` that would be more reliable in waiting for the class loader to be unloaded. Good changes. ------------- Marked as reviewed by bchristi (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14269#pullrequestreview-1458179600 From jlaskey at openjdk.org Fri Jun 2 18:12:07 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Fri, 2 Jun 2023 18:12:07 GMT Subject: RFR: JDK-8308913: Update core reflection for JEP 445 (preview) [v4] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 17:25:20 GMT, Joe Darcy wrote: >> src/java.base/share/classes/java/lang/Class.java line 1884: >> >>> 1882: reflective=true) >>> 1883: public boolean isUnnamedClass() { >>> 1884: return isSynthetic() && PreviewFeatures.isEnabled() && isTopLevelClass(); >> >> Should this include more tests such as not abstract, final, package access, in an unnamed package, etc to accurately determine it's an unnamed class? > > Hmm. I think adding at least a check for ACC_FINAL should be fine as it should have near-zero cost on top of the existing predicate once the method get compiled. (In future iterations of the JEP, the idiom to identify isUnnamed will likely change.) As mentioned in https://bugs.openjdk.org/browse/JDK-8308916 the expression should be `PreviewFeatures.isEnabled() && isSynthetic() && isTopLevelClass()` as `PreviewFeatures.isEnabled()` is a private static final test that will effectively make the full expression constant `false` when not in preview mode. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14165#discussion_r1214670484 From mchung at openjdk.org Fri Jun 2 18:15:12 2023 From: mchung at openjdk.org (Mandy Chung) Date: Fri, 2 Jun 2023 18:15:12 GMT Subject: Integrated: 8309241: ClassForNameLeak fails intermittently as the class loader hasn't been unloaded In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 18:19:14 GMT, Mandy Chung wrote: > Convert `ClassForNameLeak` test to use `jdk.test.lib.util.ForceGC` that would be more reliable in waiting for the class loader to be unloaded. This pull request has now been integrated. Changeset: a23bbea9 Author: Mandy Chung URL: https://git.openjdk.org/jdk/commit/a23bbea9593a85a9d60431e68805efa6f960a4d4 Stats: 58 lines in 1 file changed: 15 ins; 29 del; 14 mod 8309241: ClassForNameLeak fails intermittently as the class loader hasn't been unloaded Reviewed-by: dnsimon, bchristi ------------- PR: https://git.openjdk.org/jdk/pull/14269 From smarks at openjdk.org Fri Jun 2 18:19:12 2023 From: smarks at openjdk.org (Stuart Marks) Date: Fri, 2 Jun 2023 18:19:12 GMT Subject: RFR: 8303530: Redefine JAXP Configuration File [v15] In-Reply-To: <3a89aGPMevtuww_1Dc3KZxJzEzw_6I1jS9fRyp05thM=.a86422a5-13da-4ebb-8e65-16c3e008148b@github.com> References: <3a89aGPMevtuww_1Dc3KZxJzEzw_6I1jS9fRyp05thM=.a86422a5-13da-4ebb-8e65-16c3e008148b@github.com> Message-ID: On Wed, 31 May 2023 21:58:44 GMT, Joe Wang wrote: >> Add a system property, jdk.xml.config.file, to return the path to a custom JAXP configuration file. The current configuration file, jaxp.properties, that the JDK supports will become the default configuration file. >> >> CSR: https://bugs.openjdk.org/browse/JDK-8303531 >> >> Tests: XML SQE and JCK tests passed. > > Joe Wang has updated the pull request incrementally with one additional commit since the last revision: > > adjust javadoc src/java.xml/share/classes/jdk/xml/internal/JdkConstants.java line 291: > 289: */ > 290: public static final String CONFIG_FILE = "java.xml.config.file"; > 291: This isn't the name of the config file but instead is the name of the _property_ that points to the config file. At some point maybe this could be renamed, maybe to CONFIG_FILE_PROPNAME or something. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/12985#discussion_r1214676010 From bpb at openjdk.org Fri Jun 2 18:40:08 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Fri, 2 Jun 2023 18:40:08 GMT Subject: RFR: 8309216: Cast from jchar* to char* in test java/io/GetXSpace.java [v2] In-Reply-To: References: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> Message-ID: On Fri, 2 Jun 2023 18:26:33 GMT, Roger Riggs wrote: >> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: >> >> 8309216: Reformat malloc size calculation > > test/jdk/java/io/File/libGetXSpace.c line 85: > >> 83: // use GetDiskSpaceInformationW >> 84: DISK_SPACE_INFORMATION diskSpaceInfo; >> 85: BOOL hres = pfnGetDiskSpaceInformation(path, &diskSpaceInfo); > > The strchars/path could be released before checking the return; keeping the cleanup in the common flow. > Here and below after calling GetDiskFreeSpaceExW. > Your call. Good idea; will update. > test/jdk/java/io/File/libGetXSpace.c line 142: > >> 140: for (int i = 0; i < len; i++) { >> 141: chars[i] = (char)strchars[i]; >> 142: } > > Is this `memcpy(chars, strchars, len);` I don't think so if `chars` is `char *` and `strchars` is `jchar*` as I think `char` is 8 bits and `jchar` is 16 bits. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14276#discussion_r1214692423 PR Review Comment: https://git.openjdk.org/jdk/pull/14276#discussion_r1214692051 From rriggs at openjdk.org Fri Jun 2 18:40:07 2023 From: rriggs at openjdk.org (Roger Riggs) Date: Fri, 2 Jun 2023 18:40:07 GMT Subject: RFR: 8309216: Cast from jchar* to char* in test java/io/GetXSpace.java [v2] In-Reply-To: References: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> Message-ID: On Fri, 2 Jun 2023 15:57:31 GMT, Brian Burkhalter wrote: >> For Unix, copy the `jchar`s into an allocated `char` array. > > Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: > > 8309216: Reformat malloc size calculation test/jdk/java/io/File/libGetXSpace.c line 85: > 83: // use GetDiskSpaceInformationW > 84: DISK_SPACE_INFORMATION diskSpaceInfo; > 85: BOOL hres = pfnGetDiskSpaceInformation(path, &diskSpaceInfo); The strchars/path could be released before checking the return; keeping the cleanup in the common flow. Here and below after calling GetDiskFreeSpaceExW. Your call. test/jdk/java/io/File/libGetXSpace.c line 142: > 140: for (int i = 0; i < len; i++) { > 141: chars[i] = (char)strchars[i]; > 142: } Is this `memcpy(chars, strchars, len);` ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14276#discussion_r1214684070 PR Review Comment: https://git.openjdk.org/jdk/pull/14276#discussion_r1214683954 From mchung at openjdk.org Fri Jun 2 18:45:08 2023 From: mchung at openjdk.org (Mandy Chung) Date: Fri, 2 Jun 2023 18:45:08 GMT Subject: RFR: JDK-8308913: Update core reflection for JEP 445 (preview) [v4] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 18:09:23 GMT, Jim Laskey wrote: >> Hmm. I think adding at least a check for ACC_FINAL should be fine as it should have near-zero cost on top of the existing predicate once the method get compiled. (In future iterations of the JEP, the idiom to identify isUnnamed will likely change.) > > As mentioned in https://bugs.openjdk.org/browse/JDK-8308916 the expression should be `PreviewFeatures.isEnabled() && isSynthetic() && isTopLevelClass()` as `PreviewFeatures.isEnabled()` is a private static final test that will effectively make the full expression constant `false` when not in preview mode. Checking package access should also have near-zero cost. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14165#discussion_r1214695722 From psandoz at openjdk.org Fri Jun 2 18:46:10 2023 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 2 Jun 2023 18:46:10 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 17:16:09 GMT, Mandy Chung wrote: > > I think we only need to initialize Parent without initializing Child in this case. > > The bytecode behavior to access the field via `lookup.findStaticVarHandle(Child.class, "value", int[].class)` is `Child.value;`. The class or interface that declared the resolved field is initialized per JVMS `getStatic` and `putStatic`. So I think `Parent` is initialized but not `Child`. @PaulSandoz can confirm. Yes, confirmed (verified both with explicit field access, `Child.value`, and access using a direct method handle). ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1574162809 From smarks at openjdk.org Fri Jun 2 19:12:10 2023 From: smarks at openjdk.org (Stuart Marks) Date: Fri, 2 Jun 2023 19:12:10 GMT Subject: RFR: 8303530: Redefine JAXP Configuration File [v15] In-Reply-To: <3a89aGPMevtuww_1Dc3KZxJzEzw_6I1jS9fRyp05thM=.a86422a5-13da-4ebb-8e65-16c3e008148b@github.com> References: <3a89aGPMevtuww_1Dc3KZxJzEzw_6I1jS9fRyp05thM=.a86422a5-13da-4ebb-8e65-16c3e008148b@github.com> Message-ID: On Wed, 31 May 2023 21:58:44 GMT, Joe Wang wrote: >> Add a system property, jdk.xml.config.file, to return the path to a custom JAXP configuration file. The current configuration file, jaxp.properties, that the JDK supports will become the default configuration file. >> >> CSR: https://bugs.openjdk.org/browse/JDK-8303531 >> >> Tests: XML SQE and JCK tests passed. > > Joe Wang has updated the pull request incrementally with one additional commit since the last revision: > > adjust javadoc src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java line 562: > 560: //invalid setting > 561: throw new NumberFormatException("Invalid setting for system property: " + limit.systemProperty()); > 562: } Kind of a questionable idiom here to catch NFE and then throw a new NFE, discarding the previous one. Maybe wrap instead? But the larger question is, I think, what should happen in this case. If the user sets a malformed property, will this cause exceptions to be thrown at arbitrary points in the program? Both items are things to consider for later. src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java line 581: > 579: } > 580: } > 581: } It's a little hard to see what's going on here but this essentially boils down to a Map mapping new names to old names. This or further refactoring should be considered. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/12985#discussion_r1214725620 PR Review Comment: https://git.openjdk.org/jdk/pull/12985#discussion_r1214726907 From mchung at openjdk.org Fri Jun 2 19:14:04 2023 From: mchung at openjdk.org (Mandy Chung) Date: Fri, 2 Jun 2023 19:14:04 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: <6lpkAjfDuU46l1k6iDWwuNhFgaxkLICRQNv5Sxh3U-Q=.957d4c50-5ee9-468c-b092-248dfbd56153@github.com> References: <6lpkAjfDuU46l1k6iDWwuNhFgaxkLICRQNv5Sxh3U-Q=.957d4c50-5ee9-468c-b092-248dfbd56153@github.com> Message-ID: On Fri, 2 Jun 2023 16:29:13 GMT, Paul Sandoz wrote: > I wonder if it is possible to transition from an lazy (indirect) VH to a direct VH once initialized i.e., `checkAccessModeThenIsDirect` returns the value of `initialized`. Sounds a good idea. Once the class is initialized, the lazy VH becomes a direct VH that may help the performance. In that case, the VarHandleGuards would need to ensure it links with the direct VH not the lazy VH. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1574191781 From mchung at openjdk.org Fri Jun 2 19:14:11 2023 From: mchung at openjdk.org (Mandy Chung) Date: Fri, 2 Jun 2023 19:14:11 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 02:12:30 GMT, Chen Liang wrote: >> Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. >> >> A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. >> >> Current problems: >> - [ ] The lazy var handle is quite slow on the first invocation. >> - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. >> - After that, the lazy handle has a performance on par with the regular var handle. >> - [ ] The class-loading-based test is not in a unit test >> - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading >> >> >> Benchmark Mode Cnt Score Error Units >> VarHandleLazyStaticInvocation.initializedInvocation avgt 30 12.668 ? 0.069 ns/op >> VarHandleLazyStaticInvocation.lazyInvocation avgt 30 12.683 ? 0.069 ns/op >> >> >> Benchmark Mode Cnt Score Error Units >> LazyStaticColdStart.methodHandleCreateEager ss 10 50.980 ? 9.454 us/op >> LazyStaticColdStart.methodHandleCreateLazy ss 10 24.350 ? 6.701 us/op >> LazyStaticColdStart.methodHandleInitializeCallEager ss 10 65.140 ? 7.552 us/op >> LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 118.360 ? 20.320 us/op >> LazyStaticColdStart.varHandleCreateEager ss 10 49.500 ? 4.277 us/op >> LazyStaticColdStart.varHandleCreateLazy ss 10 26.690 ? 5.157 us/op >> LazyStaticColdStart.varHandleInitializeCallEager ss 10 87.930 ? 12.643 us/op >> LazyStaticColdStart.varHandleInitializeCallLazy ss 10 1057.120 ? 189.810 us/op > > 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 11 additional commits since the last revision: > > - Compute base and offset right after linking, simplify code > - Merge branch 'master' into lazy-static-varhandle > - Fix exact swap > > Co-authored-by: Mandy Chung > - Remove export for removed package > - Merge branch 'master' into lazy-static-varhandle > - Test the creation performance of handles, lazy one indeed better > - Merge branch 'master' into lazy-static-varhandle > - copyright year > - Benchmarks. lazy initialize is SLOW > - nuke meaningless overrides > - ... and 1 more: https://git.openjdk.org/jdk/compare/d89020de...27e18b7c src/java.base/share/classes/java/lang/invoke/LazyInitializingVarHandle.java line 75: > 73: public VarHandle withInvokeExactBehavior() { > 74: var updatedDelegate = target.withInvokeExactBehavior(); > 75: return initialized ? new LazyInitializingVarHandle(updatedDelegate, refc) : updatedDelegate; Suggestion: return initialized ? updatedDelegate: new LazyInitializingVarHandle(updatedDelegate, refc); If initialized, should return `updatedDelegate` instead. Same for `withInvokeBehavior` ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13821#discussion_r1214729466 From bpb at openjdk.org Fri Jun 2 19:23:10 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Fri, 2 Jun 2023 19:23:10 GMT Subject: RFR: 8309216: Cast from jchar* to char* in test java/io/GetXSpace.java [v3] In-Reply-To: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> References: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> Message-ID: > For Unix, copy the `jchar`s into an allocated `char` array. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8309216: Move string release into common flow (win) ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14276/files - new: https://git.openjdk.org/jdk/pull/14276/files/18506101..0ecf89b1 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14276&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14276&range=01-02 Stats: 8 lines in 1 file changed: 2 ins; 3 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/14276.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14276/head:pull/14276 PR: https://git.openjdk.org/jdk/pull/14276 From bpb at openjdk.org Fri Jun 2 19:23:12 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Fri, 2 Jun 2023 19:23:12 GMT Subject: RFR: 8309216: Cast from jchar* to char* in test java/io/GetXSpace.java [v2] In-Reply-To: References: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> Message-ID: On Fri, 2 Jun 2023 18:37:27 GMT, Brian Burkhalter wrote: >> test/jdk/java/io/File/libGetXSpace.c line 85: >> >>> 83: // use GetDiskSpaceInformationW >>> 84: DISK_SPACE_INFORMATION diskSpaceInfo; >>> 85: BOOL hres = pfnGetDiskSpaceInformation(path, &diskSpaceInfo); >> >> The strchars/path could be released before checking the return; keeping the cleanup in the common flow. >> Here and below after calling GetDiskFreeSpaceExW. >> Your call. > > Good idea; will update. So changed in 0ecf89b1d060bb8c1a35402ec108cbe9f3f35bb9. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14276#discussion_r1214735984 From smarks at openjdk.org Fri Jun 2 19:27:12 2023 From: smarks at openjdk.org (Stuart Marks) Date: Fri, 2 Jun 2023 19:27:12 GMT Subject: RFR: 8303530: Redefine JAXP Configuration File [v15] In-Reply-To: <3a89aGPMevtuww_1Dc3KZxJzEzw_6I1jS9fRyp05thM=.a86422a5-13da-4ebb-8e65-16c3e008148b@github.com> References: <3a89aGPMevtuww_1Dc3KZxJzEzw_6I1jS9fRyp05thM=.a86422a5-13da-4ebb-8e65-16c3e008148b@github.com> Message-ID: On Wed, 31 May 2023 21:58:44 GMT, Joe Wang wrote: >> Add a system property, jdk.xml.config.file, to return the path to a custom JAXP configuration file. The current configuration file, jaxp.properties, that the JDK supports will become the default configuration file. >> >> CSR: https://bugs.openjdk.org/browse/JDK-8303531 >> >> Tests: XML SQE and JCK tests passed. > > Joe Wang has updated the pull request incrementally with one additional commit since the last revision: > > adjust javadoc Marked as reviewed by smarks (Reviewer). Overall I think this is OK to go in as it stands. The specs have been thoroughly reviewed and the loading of the new config file needs to match the specs and it's been well tested. I especially like how the duplicated logic in the factory finders has been converted to centralized infrastructure. Now that things are centralized, it's easier to find and highlight additional items for cleanup. This probably can be considered as technical debt that can be worked on over time. I've mentioned a few things near individual places in the code; I'll repeat them here for completeness. In addition there are a few other things I noticed that we should also probably look at at some point in the future. JdkConstants.CONFIG_FILE could probably be renamed. NameMap is mapping from new to old property names. This could probably be changed to a Map instead of a search through the enum's values. There are only three enums (I think) so this isn't terrible, but it does add some extra code that could be simplified if it were changed to an actual Map. Another alternative is to merge the old name into the Limits enum itself, as another field; that would save a lookup and avoid having to keep a separate data structure in sync. There are a few places where NumberFormatException is caught and then a new NFE is thrown, discarding the old one. The new one provides more information but it's a bit odd not to chain the exceptions. Unfortunately NFE doesn't have a chaining constructor; maybe one should be added? Alternatively, initCause() could be called. A larger question is whether we want exceptions to be thrown from initialization code. This will have the effect of causing an exception to be thrown to arbitrary user code. (Or will it?) For property-reading code I think a better alternative is to ignore errant values, possibly issuing a warning message. However this will require further discussion. There are two XMLSecurityManager files: * com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java * jdk/xml/internal/XMLSecurityManager.java It seems like there's a lot of duplication between them. This should be revisited. Meanwhile, in both XMLSecurityManagers the state loaded from config files, properties, etc. is stored in parallel arrays indexed by the enum's ordinals. This suggests an alternative which is to use an EnumMap. The value of the EnumMap could be a record consisting of the property value and its state (origin) and possibly whether it was set explicitly. At some point we also might want to take another look at the tests. Testing configuration files indeed requires multiple invocations of the JVM. There are ways a single jtreg test can invoke multiple JVMs using multiple `@run` lines. Each can pass different arguments in order to run different test cases, even different test classes if necessary. But this will require additional thinking and discussion. ------------- PR Review: https://git.openjdk.org/jdk/pull/12985#pullrequestreview-1458364801 PR Comment: https://git.openjdk.org/jdk/pull/12985#issuecomment-1574210212 From mchung at openjdk.org Fri Jun 2 19:38:11 2023 From: mchung at openjdk.org (Mandy Chung) Date: Fri, 2 Jun 2023 19:38:11 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 02:12:30 GMT, Chen Liang wrote: >> Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. >> >> A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. >> >> Current problems: >> - [ ] The lazy var handle is quite slow on the first invocation. >> - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. >> - After that, the lazy handle has a performance on par with the regular var handle. >> - [ ] The class-loading-based test is not in a unit test >> - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading >> >> >> Benchmark Mode Cnt Score Error Units >> VarHandleLazyStaticInvocation.initializedInvocation avgt 30 12.668 ? 0.069 ns/op >> VarHandleLazyStaticInvocation.lazyInvocation avgt 30 12.683 ? 0.069 ns/op >> >> >> Benchmark Mode Cnt Score Error Units >> LazyStaticColdStart.methodHandleCreateEager ss 10 50.980 ? 9.454 us/op >> LazyStaticColdStart.methodHandleCreateLazy ss 10 24.350 ? 6.701 us/op >> LazyStaticColdStart.methodHandleInitializeCallEager ss 10 65.140 ? 7.552 us/op >> LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 118.360 ? 20.320 us/op >> LazyStaticColdStart.varHandleCreateEager ss 10 49.500 ? 4.277 us/op >> LazyStaticColdStart.varHandleCreateLazy ss 10 26.690 ? 5.157 us/op >> LazyStaticColdStart.varHandleInitializeCallEager ss 10 87.930 ? 12.643 us/op >> LazyStaticColdStart.varHandleInitializeCallLazy ss 10 1057.120 ? 189.810 us/op > > 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 11 additional commits since the last revision: > > - Compute base and offset right after linking, simplify code > - Merge branch 'master' into lazy-static-varhandle > - Fix exact swap > > Co-authored-by: Mandy Chung > - Remove export for removed package > - Merge branch 'master' into lazy-static-varhandle > - Test the creation performance of handles, lazy one indeed better > - Merge branch 'master' into lazy-static-varhandle > - copyright year > - Benchmarks. lazy initialize is SLOW > - nuke meaningless overrides > - ... and 1 more: https://git.openjdk.org/jdk/compare/4978eac7...27e18b7c test/jdk/java/lang/invoke/VarHandles/LazyStaticTest.java line 42: > 40: assert initialized.isEmpty() : "Incorrect initial state"; > 41: > 42: class Sample1 { Nit: suggest to move this inner class outside of the method body. I think it helps readability. maybe name it as `Sample` or `Test` or sth. I expect `Sample2` when I read `Sample1`. test/jdk/java/lang/invoke/VarHandles/LazyStaticTest.java line 59: > 57: > 58: assert initialized.contains(Sample1.class) : "Sample1 class initialized after VarHandle use"; > 59: assert Sample1.apple == 42 : "The value is not set correctly to Sample1.apple"; It may be good to extend the test case to invoke the lazy VH multiple times that will exercise in the case if lazy VH transitions to direct VH. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13821#discussion_r1214748270 PR Review Comment: https://git.openjdk.org/jdk/pull/13821#discussion_r1214752797 From joehw at openjdk.org Fri Jun 2 19:44:15 2023 From: joehw at openjdk.org (Joe Wang) Date: Fri, 2 Jun 2023 19:44:15 GMT Subject: RFR: 8303530: Redefine JAXP Configuration File [v15] In-Reply-To: <3a89aGPMevtuww_1Dc3KZxJzEzw_6I1jS9fRyp05thM=.a86422a5-13da-4ebb-8e65-16c3e008148b@github.com> References: <3a89aGPMevtuww_1Dc3KZxJzEzw_6I1jS9fRyp05thM=.a86422a5-13da-4ebb-8e65-16c3e008148b@github.com> Message-ID: On Wed, 31 May 2023 21:58:44 GMT, Joe Wang wrote: >> Add a system property, jdk.xml.config.file, to return the path to a custom JAXP configuration file. The current configuration file, jaxp.properties, that the JDK supports will become the default configuration file. >> >> CSR: https://bugs.openjdk.org/browse/JDK-8303531 >> >> Tests: XML SQE and JCK tests passed. > > Joe Wang has updated the pull request incrementally with one additional commit since the last revision: > > adjust javadoc Thanks! Will discuss these issues in separate threads for each of them. The question on the duplication of XMLSecurityManager has an easier answer: the later was added to replace the former that was specific to Xerces. Note that the one for Xalan was already deleted. There were too many references. Since this changeset is already pretty large, I decided to leave it to a simpler changeset (e.g. DTD) to do it. ------------- PR Comment: https://git.openjdk.org/jdk/pull/12985#issuecomment-1574226021 From joehw at openjdk.org Fri Jun 2 20:13:30 2023 From: joehw at openjdk.org (Joe Wang) Date: Fri, 2 Jun 2023 20:13:30 GMT Subject: Integrated: 8303530: Redefine JAXP Configuration File In-Reply-To: References: Message-ID: On Sat, 11 Mar 2023 04:28:16 GMT, Joe Wang wrote: > Add a system property, jdk.xml.config.file, to return the path to a custom JAXP configuration file. The current configuration file, jaxp.properties, that the JDK supports will become the default configuration file. > > CSR: https://bugs.openjdk.org/browse/JDK-8303531 > > Tests: XML SQE and JCK tests passed. This pull request has now been integrated. Changeset: aff9cea0 Author: Joe Wang URL: https://git.openjdk.org/jdk/commit/aff9cea05468daf60fa80c7d9993b3aa8497b0c5 Stats: 3948 lines in 56 files changed: 3177 ins; 581 del; 190 mod 8303530: Redefine JAXP Configuration File Reviewed-by: naoto, lancea, alanb, smarks ------------- PR: https://git.openjdk.org/jdk/pull/12985 From jlaskey at openjdk.org Fri Jun 2 20:18:07 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Fri, 2 Jun 2023 20:18:07 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v31] In-Reply-To: References: Message-ID: > Add flexible main methods and anonymous main classes to the Java language. Jim Laskey has updated the pull request incrementally with two additional commits since the last revision: - Use getQualifiedName() to indicate unnamed class - ClassSymbol#getSimpleName() returning empty name breaks some tools ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13689/files - new: https://git.openjdk.org/jdk/pull/13689/files/0edcd9ae..97a522f7 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=30 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=29-30 Stats: 10 lines in 2 files changed: 4 ins; 0 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/13689.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13689/head:pull/13689 PR: https://git.openjdk.org/jdk/pull/13689 From rriggs at openjdk.org Fri Jun 2 21:08:05 2023 From: rriggs at openjdk.org (Roger Riggs) Date: Fri, 2 Jun 2023 21:08:05 GMT Subject: RFR: 8309216: Cast from jchar* to char* in test java/io/GetXSpace.java [v3] In-Reply-To: References: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> Message-ID: On Fri, 2 Jun 2023 19:23:10 GMT, Brian Burkhalter wrote: >> For Unix, copy the `jchar`s into an allocated `char` array. > > Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: > > 8309216: Move string release into common flow (win) looks good; give someone else a chance to review also. ------------- Marked as reviewed by rriggs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14276#pullrequestreview-1458477087 From cjplummer at openjdk.org Fri Jun 2 21:38:08 2023 From: cjplummer at openjdk.org (Chris Plummer) Date: Fri, 2 Jun 2023 21:38:08 GMT Subject: RFR: 8309334: ProcessTools.main() does not properly set thread names when using the virtual thread wrapper Message-ID: Normally when a virtual thread wrapper is used to run a test, the main thread is renamed to "old-m-a-i-n" and the new virtual thread that will act as the main thread is named "main". Neither is being done by `ProcessTools.main()`. This can cause problems for tests that expect the main thread that the test is running in to be called "main". It is instead left unnamed. This is causing the following 4 tests to fail: com/sun/jdi/JdbMethodExitTest.java com/sun/jdi/JdbStepTest.java com/sun/jdi/JdbStopThreadTest.java com/sun/jdi/JdbStopThreadidTest.java These tests also fail due to [JDK-8309397](https://bugs.openjdk.org/browse/JDK-8309397), which will be fixed after this CR, and also com/sun/jdi/JdbMethodExitTest.java fails due to [JDK-8309396](https://bugs.openjdk.org/browse/JDK-8309396), which will also subsequently be fixed. Note this fix messed up one runtime test. It was expecting an exception message to mention the "main" thread rather than "old-m-a-i-n". Loosening the exception message matching pattern a bit solved the problem. Testing was done by running all of tier1 and tier5. ------------- Commit messages: - when using virtual threads, properly name the main threads Changes: https://git.openjdk.org/jdk/pull/14292/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14292&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309334 Stats: 11 lines in 2 files changed: 5 ins; 0 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/14292.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14292/head:pull/14292 PR: https://git.openjdk.org/jdk/pull/14292 From naoto at openjdk.org Fri Jun 2 22:04:05 2023 From: naoto at openjdk.org (Naoto Sato) Date: Fri, 2 Jun 2023 22:04:05 GMT Subject: RFR: 8309216: Cast from jchar* to char* in test java/io/GetXSpace.java [v2] In-Reply-To: References: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> Message-ID: On Fri, 2 Jun 2023 18:36:56 GMT, Brian Burkhalter wrote: >> test/jdk/java/io/File/libGetXSpace.c line 142: >> >>> 140: for (int i = 0; i < len; i++) { >>> 141: chars[i] = (char)strchars[i]; >>> 142: } >> >> Is this `memcpy(chars, strchars, len);` > > I don't think so if `chars` is `char *` and `strchars` is `jchar*` as I think `char` is 8 bits and `jchar` is 16 bits. I just wonder if jchar is UTF-16 and char is platform encoding, would it work by simply casting the low 8bit to char? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14276#discussion_r1214882192 From jlaskey at openjdk.org Fri Jun 2 22:10:44 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Fri, 2 Jun 2023 22:10:44 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v32] In-Reply-To: References: Message-ID: > Add flexible main methods and anonymous main classes to the Java language. Jim Laskey has updated the pull request incrementally with one additional commit since the last revision: Update the specification for TypeElement#getQualifiedName and TypeElement#getSimpleName ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13689/files - new: https://git.openjdk.org/jdk/pull/13689/files/97a522f7..55b6be5b Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=31 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=30-31 Stats: 8 lines in 1 file changed: 5 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/13689.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13689/head:pull/13689 PR: https://git.openjdk.org/jdk/pull/13689 From bpb at openjdk.org Fri Jun 2 22:21:04 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Fri, 2 Jun 2023 22:21:04 GMT Subject: RFR: 8309216: Cast from jchar* to char* in test java/io/GetXSpace.java [v2] In-Reply-To: References: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> Message-ID: On Fri, 2 Jun 2023 22:00:48 GMT, Naoto Sato wrote: >> I don't think so if `chars` is `char *` and `strchars` is `jchar*` as I think `char` is 8 bits and `jchar` is 16 bits. > > I just wonder if jchar is UTF-16 and char is platform encoding, would it work by simply casting the low 8bit to char? Probably not. This is only intended to cover the constrained case of this test. Something like the macro `WITH_PLATFORM_STRING` in `libjava/io_util.h` would be needed for the general case, but I thought that that might be overdoing it for here. I could of course be mistaken. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14276#discussion_r1214895770 From naoto at openjdk.org Fri Jun 2 22:26:06 2023 From: naoto at openjdk.org (Naoto Sato) Date: Fri, 2 Jun 2023 22:26:06 GMT Subject: RFR: 8309216: Cast from jchar* to char* in test java/io/GetXSpace.java [v3] In-Reply-To: References: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> Message-ID: <_UUiLEq9i8_8bytdefQowLqhjm2A5rN8rHN0JoIvgQk=.87a5c2ed-5b9b-4242-b42a-9fba14863338@github.com> On Fri, 2 Jun 2023 19:23:10 GMT, Brian Burkhalter wrote: >> For Unix, copy the `jchar`s into an allocated `char` array. > > Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: > > 8309216: Move string release into common flow (win) Marked as reviewed by naoto (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14276#pullrequestreview-1458536200 From mcimadamore at openjdk.org Fri Jun 2 22:26:09 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Fri, 2 Jun 2023 22:26:09 GMT Subject: RFR: 8308031: Linkers should promote variadic arguments [v7] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 16:22:43 GMT, Jorn Vernee wrote: >> In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and `float` is promoted to `double`, when being passed as variadic argument (see e.g. https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions). This patch adds the automatic argument promotion for variadic arguments, to align the implementation with the C specification. >> >> The fallback linker is also updated to use to correct function to link variadic calls (not doing this turned out not to be a problem so far, but it is problematic for instance on Mac/AArch64 when using the fallback linker). Adding the restriction on layouts for all linkers is also partly motivated by the fallback linker rejecting such unsupported variadic layouts already. >> >> I've added a small paragraph to the Linker javadoc as well that explains this. >> >> TestVarArgs needed to be updated in order to account for the difference in the promoted `float` values. >> >> Testing: >> - local testing on Windows/x64 >> - local testing on Linux/x64 using the fallback linker >> - tier1-3 + jdk-tier5 >> - manual test run on mac/aarch64 with the fallback linker to verify the correctness of the fallback linker changes. > > Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: > > address review comment Marked as reviewed by mcimadamore (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14225#pullrequestreview-1458536809 From naoto at openjdk.org Fri Jun 2 22:26:08 2023 From: naoto at openjdk.org (Naoto Sato) Date: Fri, 2 Jun 2023 22:26:08 GMT Subject: RFR: 8309216: Cast from jchar* to char* in test java/io/GetXSpace.java [v2] In-Reply-To: References: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> Message-ID: On Fri, 2 Jun 2023 22:18:45 GMT, Brian Burkhalter wrote: >> I just wonder if jchar is UTF-16 and char is platform encoding, would it work by simply casting the low 8bit to char? > > Probably not. This is only intended to cover the constrained case of this test. Something like the macro `WITH_PLATFORM_STRING` in `libjava/io_util.h` would be needed for the general case, but I thought that that might be overdoing it for here. I could of course be mistaken. OK, if the usage is limited and covers the required test cases, that sounds reasonable. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14276#discussion_r1214899665 From bpb at openjdk.org Fri Jun 2 22:31:05 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Fri, 2 Jun 2023 22:31:05 GMT Subject: RFR: 8309216: Cast from jchar* to char* in test java/io/GetXSpace.java [v2] In-Reply-To: References: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> Message-ID: On Fri, 2 Jun 2023 22:23:12 GMT, Naoto Sato wrote: >> Probably not. This is only intended to cover the constrained case of this test. Something like the macro `WITH_PLATFORM_STRING` in `libjava/io_util.h` would be needed for the general case, but I thought that that might be overdoing it for here. I could of course be mistaken. > > OK, if the usage is limited and covers the required test cases, that sounds reasonable. Only file system roots are passed as the paths handed to the `getSpace0()` method so hopefully it should be all right. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14276#discussion_r1214903127 From liach at openjdk.org Fri Jun 2 22:39:05 2023 From: liach at openjdk.org (Chen Liang) Date: Fri, 2 Jun 2023 22:39:05 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: <6lpkAjfDuU46l1k6iDWwuNhFgaxkLICRQNv5Sxh3U-Q=.957d4c50-5ee9-468c-b092-248dfbd56153@github.com> References: <6lpkAjfDuU46l1k6iDWwuNhFgaxkLICRQNv5Sxh3U-Q=.957d4c50-5ee9-468c-b092-248dfbd56153@github.com> Message-ID: On Fri, 2 Jun 2023 16:29:13 GMT, Paul Sandoz wrote: > I wonder if it is possible to transition from an lazy (indirect) VH to a direct VH once initialized i.e., `checkAccessModeThenIsDirect` returns the value of `initialized`. Thereby we reduce the potential footprint cost of inflating further MHs and take the more efficient route through the guard method on subsequent invocations. Currently, the VH passed to linkToStatic-linked implementation methods must be of the correct implementation type. As a result, we have to at least add an `asDirect` call when we pass the VH instance, like the invocation for indirect VH's MHs. Would that be an acceptable refactor, or is that too costly as after constant folding, the two VHs already have similar performance? ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1574393507 From mchung at openjdk.org Fri Jun 2 22:53:22 2023 From: mchung at openjdk.org (Mandy Chung) Date: Fri, 2 Jun 2023 22:53:22 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 02:12:30 GMT, Chen Liang wrote: >> Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. >> >> A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. >> >> Current problems: >> - [ ] The lazy var handle is quite slow on the first invocation. >> - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. >> - After that, the lazy handle has a performance on par with the regular var handle. >> - [ ] The class-loading-based test is not in a unit test >> - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading >> >> >> Benchmark Mode Cnt Score Error Units >> VarHandleLazyStaticInvocation.initializedInvocation avgt 30 12.668 ? 0.069 ns/op >> VarHandleLazyStaticInvocation.lazyInvocation avgt 30 12.683 ? 0.069 ns/op >> >> >> Benchmark Mode Cnt Score Error Units >> LazyStaticColdStart.methodHandleCreateEager ss 10 50.980 ? 9.454 us/op >> LazyStaticColdStart.methodHandleCreateLazy ss 10 24.350 ? 6.701 us/op >> LazyStaticColdStart.methodHandleInitializeCallEager ss 10 65.140 ? 7.552 us/op >> LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 118.360 ? 20.320 us/op >> LazyStaticColdStart.varHandleCreateEager ss 10 49.500 ? 4.277 us/op >> LazyStaticColdStart.varHandleCreateLazy ss 10 26.690 ? 5.157 us/op >> LazyStaticColdStart.varHandleInitializeCallEager ss 10 87.930 ? 12.643 us/op >> LazyStaticColdStart.varHandleInitializeCallLazy ss 10 1057.120 ? 189.810 us/op > > 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 11 additional commits since the last revision: > > - Compute base and offset right after linking, simplify code > - Merge branch 'master' into lazy-static-varhandle > - Fix exact swap > > Co-authored-by: Mandy Chung > - Remove export for removed package > - Merge branch 'master' into lazy-static-varhandle > - Test the creation performance of handles, lazy one indeed better > - Merge branch 'master' into lazy-static-varhandle > - copyright year > - Benchmarks. lazy initialize is SLOW > - nuke meaningless overrides > - ... and 1 more: https://git.openjdk.org/jdk/compare/01dce019...27e18b7c what performance results do you see with this change? ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1574406514 From amenkov at openjdk.org Fri Jun 2 23:00:08 2023 From: amenkov at openjdk.org (Alex Menkov) Date: Fri, 2 Jun 2023 23:00:08 GMT Subject: RFR: 8309334: ProcessTools.main() does not properly set thread names when using the virtual thread wrapper In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 21:30:46 GMT, Chris Plummer wrote: > Normally when a virtual thread wrapper is used to run a test, the main thread is renamed to "old-m-a-i-n" and the new virtual thread that will act as the main thread is named "main". Neither is being done by `ProcessTools.main()`. This can cause problems for tests that expect the main thread that the test is running in to be called "main". It is instead left unnamed. This is causing the following 4 tests to fail: > > com/sun/jdi/JdbMethodExitTest.java > com/sun/jdi/JdbStepTest.java > com/sun/jdi/JdbStopThreadTest.java > com/sun/jdi/JdbStopThreadidTest.java > > These tests also fail due to [JDK-8309397](https://bugs.openjdk.org/browse/JDK-8309397), which will be fixed after this CR, and also com/sun/jdi/JdbMethodExitTest.java fails due to [JDK-8309396](https://bugs.openjdk.org/browse/JDK-8309396), which will also subsequently be fixed. > > Note this fix messed up one runtime test. It was expecting an exception message to mention the "main" thread rather than "old-m-a-i-n". Loosening the exception message matching pattern a bit solved the problem. > > Testing was done by running all of tier1 and tier5. Marked as reviewed by amenkov (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14292#pullrequestreview-1458569741 From liach at openjdk.org Fri Jun 2 23:10:06 2023 From: liach at openjdk.org (Chen Liang) Date: Fri, 2 Jun 2023 23:10:06 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 22:50:21 GMT, Mandy Chung wrote: > what performance results do you see with this change? The indirect VH invocation already has a performance similar to the direct invocation in JMH. Do you mean that I should add `asDirect` to the direct paths in VH and check the benchmark results? ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1574420828 From liach at openjdk.org Fri Jun 2 23:50:09 2023 From: liach at openjdk.org (Chen Liang) Date: Fri, 2 Jun 2023 23:50:09 GMT Subject: RFR: JDK-8308913: Update core reflection for JEP 445 (preview) [v4] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 18:41:57 GMT, Mandy Chung wrote: >> As mentioned in https://bugs.openjdk.org/browse/JDK-8308916 the expression should be `PreviewFeatures.isEnabled() && isSynthetic() && isTopLevelClass()` as `PreviewFeatures.isEnabled()` is a private static final test that will effectively make the full expression constant `false` when not in preview mode. > > Checking package access should also have near-zero cost. Will this accidentally return `true` for classes from other JVM programming languages? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14165#discussion_r1214969195 From liach at openjdk.org Sat Jun 3 00:02:25 2023 From: liach at openjdk.org (Chen Liang) Date: Sat, 3 Jun 2023 00:02:25 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v6] In-Reply-To: References: Message-ID: > Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. > > A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. > > Current problems: > - [ ] The lazy var handle is quite slow on the first invocation. > - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. > - After that, the lazy handle has a performance on par with the regular var handle. > - [ ] The class-loading-based test is not in a unit test > - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading > > > Benchmark Mode Cnt Score Error Units > VarHandleLazyStaticInvocation.initializedInvocation avgt 30 12.668 ? 0.069 ns/op > VarHandleLazyStaticInvocation.lazyInvocation avgt 30 12.683 ? 0.069 ns/op > > > Benchmark Mode Cnt Score Error Units > LazyStaticColdStart.methodHandleCreateEager ss 10 50.980 ? 9.454 us/op > LazyStaticColdStart.methodHandleCreateLazy ss 10 24.350 ? 6.701 us/op > LazyStaticColdStart.methodHandleInitializeCallEager ss 10 65.140 ? 7.552 us/op > LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 118.360 ? 20.320 us/op > LazyStaticColdStart.varHandleCreateEager ss 10 49.500 ? 4.277 us/op > LazyStaticColdStart.varHandleCreateLazy ss 10 26.690 ? 5.157 us/op > LazyStaticColdStart.varHandleInitializeCallEager ss 10 87.930 ? 12.643 us/op > LazyStaticColdStart.varHandleInitializeCallLazy ss 10 1057.120 ? 189.810 us/op 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 13 additional commits since the last revision: - Fix withBehavior and test - Merge branch 'master' into lazy-static-varhandle - Compute base and offset right after linking, simplify code - Merge branch 'master' into lazy-static-varhandle - Fix exact swap Co-authored-by: Mandy Chung - Remove export for removed package - Merge branch 'master' into lazy-static-varhandle - Test the creation performance of handles, lazy one indeed better - Merge branch 'master' into lazy-static-varhandle - copyright year - ... and 3 more: https://git.openjdk.org/jdk/compare/dd539201...e21733c1 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13821/files - new: https://git.openjdk.org/jdk/pull/13821/files/27e18b7c..e21733c1 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13821&range=05 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13821&range=04-05 Stats: 7044 lines in 133 files changed: 5823 ins; 774 del; 447 mod Patch: https://git.openjdk.org/jdk/pull/13821.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13821/head:pull/13821 PR: https://git.openjdk.org/jdk/pull/13821 From mchung at openjdk.org Sat Jun 3 00:05:06 2023 From: mchung at openjdk.org (Mandy Chung) Date: Sat, 3 Jun 2023 00:05:06 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 02:37:13 GMT, Chen Liang wrote: > I've also updated the benchmark for the latest patch. Unfortunately the regular invocations and lazy var handle initial call performance saw a decrease. Maybe I misunderstood what you meant about "a decrease in performance". > The indirect VH invocation already has a performance similar to the direct invocation in JMH. Do you mean that I should add asDirect to the direct paths in VH and check the benchmark results? I guess there would be no difference then. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1574454947 From liach at openjdk.org Sat Jun 3 00:16:23 2023 From: liach at openjdk.org (Chen Liang) Date: Sat, 3 Jun 2023 00:16:23 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v7] In-Reply-To: References: Message-ID: > Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. > > A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. > > Current problems: > - [ ] The lazy var handle is quite slow on the first invocation. > - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. > - After that, the lazy handle has a performance on par with the regular var handle. > - [ ] The class-loading-based test is not in a unit test > - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading > > > Benchmark Mode Cnt Score Error Units > VarHandleLazyStaticInvocation.initializedInvocation avgt 30 12.668 ? 0.069 ns/op > VarHandleLazyStaticInvocation.lazyInvocation avgt 30 12.683 ? 0.069 ns/op > > > Benchmark Mode Cnt Score Error Units > LazyStaticColdStart.methodHandleCreateEager ss 10 50.980 ? 9.454 us/op > LazyStaticColdStart.methodHandleCreateLazy ss 10 24.350 ? 6.701 us/op > LazyStaticColdStart.methodHandleInitializeCallEager ss 10 65.140 ? 7.552 us/op > LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 118.360 ? 20.320 us/op > LazyStaticColdStart.varHandleCreateEager ss 10 49.500 ? 4.277 us/op > LazyStaticColdStart.varHandleCreateLazy ss 10 26.690 ? 5.157 us/op > LazyStaticColdStart.varHandleInitializeCallEager ss 10 87.930 ? 12.643 us/op > LazyStaticColdStart.varHandleInitializeCallLazy ss 10 1057.120 ? 189.810 us/op Chen Liang has updated the pull request incrementally with one additional commit since the last revision: Remove lazy init of MH, for all invocation of the Lazy VH needs this MH ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13821/files - new: https://git.openjdk.org/jdk/pull/13821/files/e21733c1..0d44a0d3 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13821&range=06 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13821&range=05-06 Stats: 24 lines in 1 file changed: 10 ins; 13 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/13821.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13821/head:pull/13821 PR: https://git.openjdk.org/jdk/pull/13821 From darcy at openjdk.org Sat Jun 3 00:25:30 2023 From: darcy at openjdk.org (Joe Darcy) Date: Sat, 3 Jun 2023 00:25:30 GMT Subject: RFR: JDK-8308913: Update core reflection for JEP 445 (preview) [v4] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 23:46:57 GMT, Chen Liang wrote: > Will this accidentally return `true` for classes from other JVM programming languages? That is a potential concern. Future iteration of this work will likely use a different idiom to determine is-unnamed that would be more robust against false positives from class files generated for non-Java languages. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14165#discussion_r1215028194 From liach at openjdk.org Sat Jun 3 01:02:08 2023 From: liach at openjdk.org (Chen Liang) Date: Sat, 3 Jun 2023 01:02:08 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v7] In-Reply-To: References: Message-ID: On Sat, 3 Jun 2023 00:16:23 GMT, Chen Liang wrote: >> Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. >> >> A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. >> >> Current problems: >> - [ ] The lazy var handle is quite slow on the first invocation. >> - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. >> - After that, the lazy handle has a performance on par with the regular var handle. >> - [ ] The class-loading-based test is not in a unit test >> - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading >> >> >> Benchmark Mode Cnt Score Error Units >> VarHandleLazyStaticInvocation.initializedInvocation avgt 30 12.668 ? 0.069 ns/op >> VarHandleLazyStaticInvocation.lazyInvocation avgt 30 12.683 ? 0.069 ns/op >> >> >> Benchmark Mode Cnt Score Error Units >> LazyStaticColdStart.methodHandleCreateEager ss 10 50.980 ? 9.454 us/op >> LazyStaticColdStart.methodHandleCreateLazy ss 10 24.350 ? 6.701 us/op >> LazyStaticColdStart.methodHandleInitializeCallEager ss 10 65.140 ? 7.552 us/op >> LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 118.360 ? 20.320 us/op >> LazyStaticColdStart.varHandleCreateEager ss 10 49.500 ? 4.277 us/op >> LazyStaticColdStart.varHandleCreateLazy ss 10 26.690 ? 5.157 us/op >> LazyStaticColdStart.varHandleInitializeCallEager ss 10 87.930 ? 12.643 us/op >> LazyStaticColdStart.varHandleInitializeCallLazy ss 10 1057.120 ? 189.810 us/op > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > Remove lazy init of MH, for all invocation of the Lazy VH needs this MH Yeah, I was referring the performance drop from 0.5ns/op to 12ns/op for botg direct and indirect; don't know what caused the problems of general slowdown on my end. Also, is there anything I can do to fix the windows build failures? ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1574509072 From lmesnik at openjdk.org Sat Jun 3 01:11:03 2023 From: lmesnik at openjdk.org (Leonid Mesnik) Date: Sat, 3 Jun 2023 01:11:03 GMT Subject: RFR: 8309334: ProcessTools.main() does not properly set thread names when using the virtual thread wrapper In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 21:30:46 GMT, Chris Plummer wrote: > Normally when a virtual thread wrapper is used to run a test, the main thread is renamed to "old-m-a-i-n" and the new virtual thread that will act as the main thread is named "main". Neither is being done by `ProcessTools.main()`. This can cause problems for tests that expect the main thread that the test is running in to be called "main". It is instead left unnamed. This is causing the following 4 tests to fail: > > com/sun/jdi/JdbMethodExitTest.java > com/sun/jdi/JdbStepTest.java > com/sun/jdi/JdbStopThreadTest.java > com/sun/jdi/JdbStopThreadidTest.java > > These tests also fail due to [JDK-8309397](https://bugs.openjdk.org/browse/JDK-8309397), which will be fixed after this CR, and also com/sun/jdi/JdbMethodExitTest.java fails due to [JDK-8309396](https://bugs.openjdk.org/browse/JDK-8309396), which will also subsequently be fixed. > > Note this fix messed up one runtime test. It was expecting an exception message to mention the "main" thread rather than "old-m-a-i-n". Loosening the exception message matching pattern a bit solved the problem. > > Testing was done by running all of tier1 and tier5. Marked as reviewed by lmesnik (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14292#pullrequestreview-1458712928 From darcy at openjdk.org Sat Jun 3 01:56:18 2023 From: darcy at openjdk.org (Joe Darcy) Date: Sat, 3 Jun 2023 01:56:18 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v32] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 22:10:44 GMT, Jim Laskey wrote: >> Add flexible main methods and anonymous main classes to the Java language. > > Jim Laskey has updated the pull request incrementally with one additional commit since the last revision: > > Update the specification for TypeElement#getQualifiedName and TypeElement#getSimpleName src/java.base/share/classes/java/lang/Class.java line 1884: > 1882: reflective=true) > 1883: public boolean isUnnamedClass() { > 1884: return PreviewFeatures.isEnabled() && isSynthetic() && isTopLevelClass(); Please add a check for final-ness as @mlchung suggested in the other PR of the reflection changes stand-alone. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1215095660 From duke at openjdk.org Sat Jun 3 02:32:12 2023 From: duke at openjdk.org (ExE Boss) Date: Sat, 3 Jun 2023 02:32:12 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v7] In-Reply-To: References: Message-ID: On Sat, 3 Jun 2023 00:16:23 GMT, Chen Liang wrote: >> Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. >> >> A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. >> >> Current problems: >> - [ ] The lazy var handle is quite slow on the first invocation. >> - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. >> - After that, the lazy handle has a performance on par with the regular var handle. >> - [ ] The class-loading-based test is not in a unit test >> - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading >> >> >> Benchmark Mode Cnt Score Error Units >> VarHandleLazyStaticInvocation.initializedInvocation avgt 30 12.668 ? 0.069 ns/op >> VarHandleLazyStaticInvocation.lazyInvocation avgt 30 12.683 ? 0.069 ns/op >> >> >> Benchmark Mode Cnt Score Error Units >> LazyStaticColdStart.methodHandleCreateEager ss 10 50.980 ? 9.454 us/op >> LazyStaticColdStart.methodHandleCreateLazy ss 10 24.350 ? 6.701 us/op >> LazyStaticColdStart.methodHandleInitializeCallEager ss 10 65.140 ? 7.552 us/op >> LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 118.360 ? 20.320 us/op >> LazyStaticColdStart.varHandleCreateEager ss 10 49.500 ? 4.277 us/op >> LazyStaticColdStart.varHandleCreateLazy ss 10 26.690 ? 5.157 us/op >> LazyStaticColdStart.varHandleInitializeCallEager ss 10 87.930 ? 12.643 us/op >> LazyStaticColdStart.varHandleInitializeCallLazy ss 10 1057.120 ? 189.810 us/op > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > Remove lazy init of MH, for all invocation of the Lazy VH needs this MH src/java.base/share/classes/java/lang/invoke/LazyInitializingVarHandle.java line 106: > 104: UNSAFE.ensureClassInitialized(refc); > 105: this.initialized = true; > 106: } This?should probably?have a?fast?path when?`this.initialized` is?`true`, so?that it?can be?better constant?folded by?the?**JIT**: Suggestion: private void ensureInitialized() { if (this.initialized) { return; } UNSAFE.ensureClassInitialized(refc); this.initialized = true; } ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13821#discussion_r1215132431 From liach at openjdk.org Sat Jun 3 03:50:13 2023 From: liach at openjdk.org (Chen Liang) Date: Sat, 3 Jun 2023 03:50:13 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v7] In-Reply-To: References: Message-ID: On Sat, 3 Jun 2023 02:25:59 GMT, ExE Boss wrote: >> Chen Liang has updated the pull request incrementally with one additional commit since the last revision: >> >> Remove lazy init of MH, for all invocation of the Lazy VH needs this MH > > src/java.base/share/classes/java/lang/invoke/LazyInitializingVarHandle.java line 106: > >> 104: UNSAFE.ensureClassInitialized(refc); >> 105: this.initialized = true; >> 106: } > > This?should probably?have a?fast?path when?`this.initialized` is?`true`, so?that it?can be?better constant?folded by?the?**JIT**: > Suggestion: > > private void ensureInitialized() { > if (this.initialized) { > return; > } > UNSAFE.ensureClassInitialized(refc); > this.initialized = true; > } I think I should probably update the MH lambda form as well, to skip the ensure call entirely if JVM has not constant-fold the inefficient form yet. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13821#discussion_r1215184529 From dfuchs at openjdk.org Sat Jun 3 10:21:08 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Sat, 3 Jun 2023 10:21:08 GMT Subject: RFR: 8306647: Implementation of Structured Concurrency (Preview) [v4] In-Reply-To: References: <6gZZEoP1WXdBcZUiL5890eNsgaRFzZNY_rBItZdXtNc=.5d8f7bd9-44d5-4074-8a5c-35f8203263b2@github.com> Message-ID: On Thu, 1 Jun 2023 13:43:33 GMT, Alan Bateman wrote: >> This is the implementation of: >> >> - JEP 453: Structured Concurrency (Preview) >> - JEP 446: Scoped Values (Preview) >> >> For the most part, this is just moving code and tests. StructuredTaskScope moves to j.u.concurrent as a preview API, ScopedValue moves to j.lang as a preview API, and module jdk.incubator.concurrent has been removed. The significant API changes since incubator are: >> >> - StructuredTaskScope.fork returns Subtask instead of Future (JEP 453 has a section on this) >> - ScopedValue.where methods are replaced with runWhere, callWhere and getWhere > > Alan Bateman has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 15 commits: > > - Sync up from loom repo > - Merge > - Sync with loom repo, re-work ScopedValue class description > - Sync up from loom repo > - Remove csm.Threads > - Merge > - Test should not be in update for main line > - Sync with loom repo > - Sync up tests frmo loom repo > - Sync up with loom repo > - ... and 5 more: https://git.openjdk.org/jdk/compare/a46b5acc...cc902ce6 I reviewed the API documentation of `ScopedValue` (mostly the class level API documentation, but I had a look at the methods API too) and it looks good. It reads well, and when I had question they were usually answered in the next paragraph that followed what I was reading. I didn't look at Structured Concurrency. ------------- Marked as reviewed by dfuchs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/13932#pullrequestreview-1459172232 From dnsimon at openjdk.org Sat Jun 3 11:40:32 2023 From: dnsimon at openjdk.org (Doug Simon) Date: Sat, 3 Jun 2023 11:40:32 GMT Subject: RFR: 8309390: [JVMCI] improve copying system properties into libgraal Message-ID: <9bsjzlbHK31VVyGwzyhpSBjSILWFxmAX0IfiWK6Wb_w=.197d2b45-dba5-43bc-ac4e-4f993d3e777a@github.com> This PR improves the startup time for libgraal by speeding up how `VM.savedProps` is copied into libgraal. This data structure is now serialized to a native buffer directly from C++ and the native buffer is then directly decoded by libgraal. ## Times The basic benchmarking below shows that this change brings the time for a nop Java app with eager libgraal initialization (2) down to almost the same time as lazy libgraal initialization (1). The latter typically means no libgraal initialization happens as a top tier JIT compilation is never scheduled in such a short running app. public class Nop { public static void main(String[] args) {} } (1) Baseline (no options): > for i in (seq 10); java Nop; end 0.05 real 0.04 user 0.01 sys 0.04 real 0.03 user 0.01 sys 0.04 real 0.03 user 0.01 sys 0.04 real 0.03 user 0.01 sys 0.03 real 0.03 user 0.00 sys 0.04 real 0.03 user 0.01 sys 0.04 real 0.03 user 0.00 sys 0.03 real 0.03 user 0.00 sys 0.04 real 0.03 user 0.01 sys 0.03 real 0.03 user 0.00 sys (2) Eagerly initialize libgraal (with PR): > for i in (seq 10); /usr/bin/time java -XX:+EagerJVMCI Nop; end 0.06 real 0.04 user 0.01 sys 0.05 real 0.03 user 0.01 sys 0.05 real 0.03 user 0.01 sys 0.05 real 0.03 user 0.01 sys 0.05 real 0.03 user 0.01 sys 0.05 real 0.03 user 0.01 sys 0.05 real 0.03 user 0.01 sys 0.05 real 0.03 user 0.01 sys 0.05 real 0.03 user 0.01 sys 0.05 real 0.03 user 0.01 sys (3) Eagerly initialize libgraal (without PR): > for i in (seq 10); /usr/bin/time java -XX:+EagerJVMCI Nop; end 0.11 real 0.08 user 0.02 sys 0.08 real 0.06 user 0.01 sys 0.08 real 0.07 user 0.01 sys 0.10 real 0.07 user 0.01 sys 0.08 real 0.06 user 0.01 sys 0.10 real 0.07 user 0.01 sys 0.08 real 0.07 user 0.01 sys 0.08 real 0.07 user 0.01 sys 0.08 real 0.06 user 0.01 sys 0.08 real 0.06 user 0.01 sys ------------- Commit messages: - more efficient copying of system properties into libjvmci Changes: https://git.openjdk.org/jdk/pull/14291/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14291&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309390 Stats: 242 lines in 8 files changed: 172 ins; 30 del; 40 mod Patch: https://git.openjdk.org/jdk/pull/14291.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14291/head:pull/14291 PR: https://git.openjdk.org/jdk/pull/14291 From dnsimon at openjdk.org Sat Jun 3 11:40:32 2023 From: dnsimon at openjdk.org (Doug Simon) Date: Sat, 3 Jun 2023 11:40:32 GMT Subject: RFR: 8309390: [JVMCI] improve copying system properties into libgraal In-Reply-To: <9bsjzlbHK31VVyGwzyhpSBjSILWFxmAX0IfiWK6Wb_w=.197d2b45-dba5-43bc-ac4e-4f993d3e777a@github.com> References: <9bsjzlbHK31VVyGwzyhpSBjSILWFxmAX0IfiWK6Wb_w=.197d2b45-dba5-43bc-ac4e-4f993d3e777a@github.com> Message-ID: On Fri, 2 Jun 2023 20:32:14 GMT, Doug Simon wrote: > This PR improves the startup time for libgraal by speeding up how `VM.savedProps` is copied into libgraal. This data structure is now serialized to a native buffer directly from C++ and the native buffer is then directly decoded by libgraal. > > ## Times > > The basic benchmarking below shows that this change brings the time for a nop Java app with eager libgraal initialization (2) down to almost the same time as lazy libgraal initialization (1). The latter typically means no libgraal initialization happens as a top tier JIT compilation is never scheduled in such a short running app. > > > public class Nop { > public static void main(String[] args) {} > } > > > (1) Baseline (no options): > >> for i in (seq 10); java Nop; end > 0.05 real 0.04 user 0.01 sys > 0.04 real 0.03 user 0.01 sys > 0.04 real 0.03 user 0.01 sys > 0.04 real 0.03 user 0.01 sys > 0.03 real 0.03 user 0.00 sys > 0.04 real 0.03 user 0.01 sys > 0.04 real 0.03 user 0.00 sys > 0.03 real 0.03 user 0.00 sys > 0.04 real 0.03 user 0.01 sys > 0.03 real 0.03 user 0.00 sys > > > (2) Eagerly initialize libgraal (with PR): > >> for i in (seq 10); /usr/bin/time java -XX:+EagerJVMCI Nop; end > 0.06 real 0.04 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > > > (3) Eagerly initialize libgraal (without PR): > >> for i in (seq 10); /usr/bin/time java -XX:+EagerJVMCI Nop; end > 0.11 real 0.08 user 0.02 sys > 0.08 real 0.06 user 0.01 sys > 0.08 real 0.07 user 0.01 sys > 0.10 real 0.07 user 0.01 sys > 0.08 real 0.06 user 0.01 sys > 0.10 real 0.07 user 0.01 sys > 0.08 real 0.07 user 0.01 sys > 0.08 real 0.07 user 0.01 sys > 0.08 real ... src/java.base/share/classes/jdk/internal/util/SystemProps.java line 62: > 60: * are initialized by VersionProps.java-template. > 61: * > 62: * @return a Properties instance initialized with all of the properties I took the liberty of correcting this javadoc to reflect the code. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14291#discussion_r1215453699 From alanb at openjdk.org Sat Jun 3 14:11:05 2023 From: alanb at openjdk.org (Alan Bateman) Date: Sat, 3 Jun 2023 14:11:05 GMT Subject: RFR: 8309334: ProcessTools.main() does not properly set thread names when using the virtual thread wrapper In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 21:30:46 GMT, Chris Plummer wrote: > Normally when a virtual thread wrapper is used to run a test, the main thread is renamed to "old-m-a-i-n" and the new virtual thread that will act as the main thread is named "main". Neither is being done by `ProcessTools.main()`. This can cause problems for tests that expect the main thread that the test is running in to be called "main". It is instead left unnamed. This is causing the following 4 tests to fail: > > com/sun/jdi/JdbMethodExitTest.java > com/sun/jdi/JdbStepTest.java > com/sun/jdi/JdbStopThreadTest.java > com/sun/jdi/JdbStopThreadidTest.java > > These tests also fail due to [JDK-8309397](https://bugs.openjdk.org/browse/JDK-8309397), which will be fixed after this CR, and also com/sun/jdi/JdbMethodExitTest.java fails due to [JDK-8309396](https://bugs.openjdk.org/browse/JDK-8309396), which will also subsequently be fixed. > > Note this fix messed up one runtime test. It was expecting an exception message to mention the "main" thread rather than "old-m-a-i-n". Loosening the exception message matching pattern a bit solved the problem. > > Testing was done by running all of tier1 and tier5. test/lib/jdk/test/lib/process/ProcessTools.java line 899: > 897: // when main is executed in virtual thread > 898: MainThreadGroup tg = new MainThreadGroup(); > 899: Thread vthread = createVirtualThread(() -> { You can replace this with `Thread.ofVirtual().unstarted(() -> {` and remove the helper method. I think that helper method dates from the jtreg wrapper solution. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14292#discussion_r1215549528 From cjplummer at openjdk.org Sat Jun 3 18:24:04 2023 From: cjplummer at openjdk.org (Chris Plummer) Date: Sat, 3 Jun 2023 18:24:04 GMT Subject: RFR: 8309334: ProcessTools.main() does not properly set thread names when using the virtual thread wrapper In-Reply-To: References: Message-ID: <1BSXXnlH2oe9TenR2t-oiwJAqWlrEjyhSZk_fht2SDE=.d27a4cd5-1b74-4974-8f51-4f73816fcb98@github.com> On Sat, 3 Jun 2023 14:07:52 GMT, Alan Bateman wrote: >> Normally when a virtual thread wrapper is used to run a test, the main thread is renamed to "old-m-a-i-n" and the new virtual thread that will act as the main thread is named "main". Neither is being done by `ProcessTools.main()`. This can cause problems for tests that expect the main thread that the test is running in to be called "main". It is instead left unnamed. This is causing the following 4 tests to fail: >> >> com/sun/jdi/JdbMethodExitTest.java >> com/sun/jdi/JdbStepTest.java >> com/sun/jdi/JdbStopThreadTest.java >> com/sun/jdi/JdbStopThreadidTest.java >> >> These tests also fail due to [JDK-8309397](https://bugs.openjdk.org/browse/JDK-8309397), which will be fixed after this CR, and also com/sun/jdi/JdbMethodExitTest.java fails due to [JDK-8309396](https://bugs.openjdk.org/browse/JDK-8309396), which will also subsequently be fixed. >> >> Note this fix messed up one runtime test. It was expecting an exception message to mention the "main" thread rather than "old-m-a-i-n". Loosening the exception message matching pattern a bit solved the problem. >> >> Testing was done by running all of tier1 and tier5. > > test/lib/jdk/test/lib/process/ProcessTools.java line 899: > >> 897: // when main is executed in virtual thread >> 898: MainThreadGroup tg = new MainThreadGroup(); >> 899: Thread vthread = createVirtualThread(() -> { > > You can replace this with `Thread.ofVirtual().unstarted(() -> {` and remove the helper method. I think that helper method dates from the jtreg wrapper solution. Better still, maybe you could use `Thread.ofVirtual().name("main").start(() -> {`. Yes, I already brought this up with Leonid. I was going to file a separate bug for it, but I can fix it with this CR if you'd like. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14292#discussion_r1215705793 From cjplummer at openjdk.org Sat Jun 3 21:18:23 2023 From: cjplummer at openjdk.org (Chris Plummer) Date: Sat, 3 Jun 2023 21:18:23 GMT Subject: RFR: 8309334: ProcessTools.main() does not properly set thread names when using the virtual thread wrapper [v2] In-Reply-To: References: Message-ID: > Normally when a virtual thread wrapper is used to run a test, the main thread is renamed to "old-m-a-i-n" and the new virtual thread that will act as the main thread is named "main". Neither is being done by `ProcessTools.main()`. This can cause problems for tests that expect the main thread that the test is running in to be called "main". It is instead left unnamed. This is causing the following 4 tests to fail: > > com/sun/jdi/JdbMethodExitTest.java > com/sun/jdi/JdbStepTest.java > com/sun/jdi/JdbStopThreadTest.java > com/sun/jdi/JdbStopThreadidTest.java > > These tests also fail due to [JDK-8309397](https://bugs.openjdk.org/browse/JDK-8309397), which will be fixed after this CR, and also com/sun/jdi/JdbMethodExitTest.java fails due to [JDK-8309396](https://bugs.openjdk.org/browse/JDK-8309396), which will also subsequently be fixed. > > Note this fix messed up one runtime test. It was expecting an exception message to mention the "main" thread rather than "old-m-a-i-n". Loosening the exception message matching pattern a bit solved the problem. > > Testing was done by running all of tier1 and tier5. Chris Plummer 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 8309334_processtools merge - when using virtual threads, properly name the main threads ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14292/files - new: https://git.openjdk.org/jdk/pull/14292/files/e53abaf4..de5ca147 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14292&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14292&range=00-01 Stats: 4052 lines in 65 files changed: 3213 ins; 625 del; 214 mod Patch: https://git.openjdk.org/jdk/pull/14292.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14292/head:pull/14292 PR: https://git.openjdk.org/jdk/pull/14292 From cjplummer at openjdk.org Sat Jun 3 21:34:16 2023 From: cjplummer at openjdk.org (Chris Plummer) Date: Sat, 3 Jun 2023 21:34:16 GMT Subject: RFR: 8309334: ProcessTools.main() does not properly set thread names when using the virtual thread wrapper [v3] In-Reply-To: References: Message-ID: > Normally when a virtual thread wrapper is used to run a test, the main thread is renamed to "old-m-a-i-n" and the new virtual thread that will act as the main thread is named "main". Neither is being done by `ProcessTools.main()`. This can cause problems for tests that expect the main thread that the test is running in to be called "main". It is instead left unnamed. This is causing the following 4 tests to fail: > > com/sun/jdi/JdbMethodExitTest.java > com/sun/jdi/JdbStepTest.java > com/sun/jdi/JdbStopThreadTest.java > com/sun/jdi/JdbStopThreadidTest.java > > These tests also fail due to [JDK-8309397](https://bugs.openjdk.org/browse/JDK-8309397), which will be fixed after this CR, and also com/sun/jdi/JdbMethodExitTest.java fails due to [JDK-8309396](https://bugs.openjdk.org/browse/JDK-8309396), which will also subsequently be fixed. > > Note this fix messed up one runtime test. It was expecting an exception message to mention the "main" thread rather than "old-m-a-i-n". Loosening the exception message matching pattern a bit solved the problem. > > Testing was done by running all of tier1 and tier5. Chris Plummer has updated the pull request incrementally with two additional commits since the last revision: - No longer need reflection to call Thread.ofVirtual().unstarted() - Remove from problem list tests that are fixed by this PR. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14292/files - new: https://git.openjdk.org/jdk/pull/14292/files/de5ca147..9bcc200b Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14292&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14292&range=01-02 Stats: 17 lines in 2 files changed: 0 ins; 16 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14292.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14292/head:pull/14292 PR: https://git.openjdk.org/jdk/pull/14292 From sspitsyn at openjdk.org Sat Jun 3 23:11:07 2023 From: sspitsyn at openjdk.org (Serguei Spitsyn) Date: Sat, 3 Jun 2023 23:11:07 GMT Subject: RFR: 8309334: ProcessTools.main() does not properly set thread names when using the virtual thread wrapper [v3] In-Reply-To: References: Message-ID: On Sat, 3 Jun 2023 21:34:16 GMT, Chris Plummer wrote: >> Normally when a virtual thread wrapper is used to run a test, the main thread is renamed to "old-m-a-i-n" and the new virtual thread that will act as the main thread is named "main". Neither is being done by `ProcessTools.main()`. This can cause problems for tests that expect the main thread that the test is running in to be called "main". It is instead left unnamed. This is causing the following 4 tests to fail: >> >> com/sun/jdi/JdbMethodExitTest.java >> com/sun/jdi/JdbStepTest.java >> com/sun/jdi/JdbStopThreadTest.java >> com/sun/jdi/JdbStopThreadidTest.java >> >> These tests also fail due to [JDK-8309397](https://bugs.openjdk.org/browse/JDK-8309397), which will be fixed after this CR, and also com/sun/jdi/JdbMethodExitTest.java fails due to [JDK-8309396](https://bugs.openjdk.org/browse/JDK-8309396), which will also subsequently be fixed. >> >> Note this fix messed up one runtime test. It was expecting an exception message to mention the "main" thread rather than "old-m-a-i-n". Loosening the exception message matching pattern a bit solved the problem. >> >> Testing was done by running all of tier1 and tier5. > > Chris Plummer has updated the pull request incrementally with two additional commits since the last revision: > > - No longer need reflection to call Thread.ofVirtual().unstarted() > - Remove from problem list tests that are fixed by this PR. Looks good. Thanks, Serguei ------------- Marked as reviewed by sspitsyn (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14292#pullrequestreview-1460389726 From darcy at openjdk.org Sat Jun 3 23:18:17 2023 From: darcy at openjdk.org (Joe Darcy) Date: Sat, 3 Jun 2023 23:18:17 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v32] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 22:10:44 GMT, Jim Laskey wrote: >> Add flexible main methods and anonymous main classes to the Java language. > > Jim Laskey has updated the pull request incrementally with one additional commit since the last revision: > > Update the specification for TypeElement#getQualifiedName and TypeElement#getSimpleName src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java line 1379: > 1377: @Override @DefinedBy(Api.LANGUAGE_MODEL) > 1378: public Name getSimpleName() { > 1379: // return isUnnamed() ? name.subName(0, 0) /* empty name */ : name; This line could be deleted. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1215925243 From darcy at openjdk.org Sat Jun 3 23:24:19 2023 From: darcy at openjdk.org (Joe Darcy) Date: Sat, 3 Jun 2023 23:24:19 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v32] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 22:10:44 GMT, Jim Laskey wrote: >> Add flexible main methods and anonymous main classes to the Java language. > > Jim Laskey has updated the pull request incrementally with one additional commit since the last revision: > > Update the specification for TypeElement#getQualifiedName and TypeElement#getSimpleName test/langtools/tools/javac/processing/model/element/TestUnnamedClass.java line 140: > 138: } > 139: > 140: if (unnamedClass.getSimpleName().isEmpty()) { Presumably the sense of the predicates testing names needs to now be reserved due to subsequent updates to the javax.lang.model support. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1215928629 From darcy at openjdk.org Sat Jun 3 23:33:19 2023 From: darcy at openjdk.org (Joe Darcy) Date: Sat, 3 Jun 2023 23:33:19 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v32] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 22:10:44 GMT, Jim Laskey wrote: >> Add flexible main methods and anonymous main classes to the Java language. > > Jim Laskey has updated the pull request incrementally with one additional commit since the last revision: > > Update the specification for TypeElement#getQualifiedName and TypeElement#getSimpleName Core reflection and javax.lang.model APIs look fine. ------------- Marked as reviewed by darcy (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/13689#pullrequestreview-1460430032 From alanb at openjdk.org Sun Jun 4 07:18:08 2023 From: alanb at openjdk.org (Alan Bateman) Date: Sun, 4 Jun 2023 07:18:08 GMT Subject: RFR: 8309334: ProcessTools.main() does not properly set thread names when using the virtual thread wrapper [v3] In-Reply-To: References: Message-ID: <5DZfskNZrZY5sENy22fgCrs6CAsoNo9GgnsM3gYVBdU=.dbbf65ec-dd7e-4afe-b80d-49151b23511e@github.com> On Sat, 3 Jun 2023 21:34:16 GMT, Chris Plummer wrote: >> Normally when a virtual thread wrapper is used to run a test, the main thread is renamed to "old-m-a-i-n" and the new virtual thread that will act as the main thread is named "main". Neither is being done by `ProcessTools.main()`. This can cause problems for tests that expect the main thread that the test is running in to be called "main". It is instead left unnamed. This is causing the following 4 tests to fail: >> >> com/sun/jdi/JdbMethodExitTest.java >> com/sun/jdi/JdbStepTest.java >> com/sun/jdi/JdbStopThreadTest.java >> com/sun/jdi/JdbStopThreadidTest.java >> >> These tests also fail due to [JDK-8309397](https://bugs.openjdk.org/browse/JDK-8309397), which will be fixed after this CR, and also com/sun/jdi/JdbMethodExitTest.java fails due to [JDK-8309396](https://bugs.openjdk.org/browse/JDK-8309396), which will also subsequently be fixed. >> >> Note this fix messed up one runtime test. It was expecting an exception message to mention the "main" thread rather than "old-m-a-i-n". Loosening the exception message matching pattern a bit solved the problem. >> >> Testing was done by running all of tier1 and tier5. > > Chris Plummer has updated the pull request incrementally with two additional commits since the last revision: > > - No longer need reflection to call Thread.ofVirtual().unstarted() > - Remove from problem list tests that are fixed by this PR. Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14292#pullrequestreview-1460999128 From liach at openjdk.org Sun Jun 4 13:23:46 2023 From: liach at openjdk.org (Chen Liang) Date: Sun, 4 Jun 2023 13:23:46 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v8] In-Reply-To: References: Message-ID: > Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. > > A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. > > Current problems: > - [ ] The lazy var handle is quite slow on the first invocation. > - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. > - After that, the lazy handle has a performance on par with the regular var handle. > - [ ] The class-loading-based test is not in a unit test > - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading > > > Benchmark Mode Cnt Score Error Units > VarHandleLazyStaticInvocation.initializedInvocation avgt 30 0.817 ? 0.012 ns/op > VarHandleLazyStaticInvocation.lazyInvocation avgt 30 0.805 ? 0.007 ns/op > > > Benchmark Mode Cnt Score Error Units > LazyStaticColdStart.methodHandleCreateEager ss 10 50.980 ? 9.454 us/op > LazyStaticColdStart.methodHandleCreateLazy ss 10 24.350 ? 6.701 us/op > LazyStaticColdStart.methodHandleInitializeCallEager ss 10 65.140 ? 7.552 us/op > LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 118.360 ? 20.320 us/op > LazyStaticColdStart.varHandleCreateEager ss 10 49.500 ? 4.277 us/op > LazyStaticColdStart.varHandleCreateLazy ss 10 26.690 ? 5.157 us/op > LazyStaticColdStart.varHandleInitializeCallEager ss 10 87.930 ? 12.643 us/op > LazyStaticColdStart.varHandleInitializeCallLazy ss 10 1057.120 ? 189.810 us/op Chen Liang has updated the pull request incrementally with one additional commit since the last revision: Improve subsequent VH call performance, thanks exeboss ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13821/files - new: https://git.openjdk.org/jdk/pull/13821/files/0d44a0d3..dc3e73e9 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13821&range=07 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13821&range=06-07 Stats: 20 lines in 1 file changed: 20 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/13821.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13821/head:pull/13821 PR: https://git.openjdk.org/jdk/pull/13821 From liach at openjdk.org Sun Jun 4 13:23:46 2023 From: liach at openjdk.org (Chen Liang) Date: Sun, 4 Jun 2023 13:23:46 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v7] In-Reply-To: References: Message-ID: On Sat, 3 Jun 2023 03:47:40 GMT, Chen Liang wrote: >> src/java.base/share/classes/java/lang/invoke/LazyInitializingVarHandle.java line 106: >> >>> 104: UNSAFE.ensureClassInitialized(refc); >>> 105: this.initialized = true; >>> 106: } >> >> This?should probably?have a?fast?path when?`this.initialized` is?`true`, so?that it?can be?better constant?folded by?the?**JIT**: >> Suggestion: >> >> private void ensureInitialized() { >> if (this.initialized) { >> return; >> } >> UNSAFE.ensureClassInitialized(refc); >> this.initialized = true; >> } > > I think I should probably update the MH lambda form as well, to skip the ensure call entirely if JVM has not constant-fold the inefficient form yet. Indeed, updating lambda form and cached mh works: the average invocation performance becomes ~0.8ns/op, equal to the direct version, compared to the original ~1ms/op. See the updated benchmark results in the main PR body. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13821#discussion_r1216694641 From duke at openjdk.org Sun Jun 4 16:16:10 2023 From: duke at openjdk.org (ExE Boss) Date: Sun, 4 Jun 2023 16:16:10 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v8] In-Reply-To: References: Message-ID: On Sun, 4 Jun 2023 13:23:46 GMT, Chen Liang wrote: >> Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. >> >> A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. >> >> Current problems: >> - [ ] The lazy var handle is quite slow on the first invocation. >> - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. >> - After that, the lazy handle has a performance on par with the regular var handle. >> - [ ] The class-loading-based test is not in a unit test >> - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading >> >> >> Benchmark Mode Cnt Score Error Units >> VarHandleLazyStaticInvocation.initializedInvocation avgt 30 0.817 ? 0.012 ns/op >> VarHandleLazyStaticInvocation.lazyInvocation avgt 30 0.805 ? 0.007 ns/op >> >> >> Benchmark Mode Cnt Score Error Units >> LazyStaticColdStart.methodHandleCreateEager ss 10 50.980 ? 9.454 us/op >> LazyStaticColdStart.methodHandleCreateLazy ss 10 24.350 ? 6.701 us/op >> LazyStaticColdStart.methodHandleInitializeCallEager ss 10 65.140 ? 7.552 us/op >> LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 118.360 ? 20.320 us/op >> LazyStaticColdStart.varHandleCreateEager ss 10 49.500 ? 4.277 us/op >> LazyStaticColdStart.varHandleCreateLazy ss 10 26.690 ? 5.157 us/op >> LazyStaticColdStart.varHandleInitializeCallEager ss 10 87.930 ? 12.643 us/op >> LazyStaticColdStart.varHandleInitializeCallLazy ss 10 1057.120 ? 189.810 us/op > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > Improve subsequent VH call performance, thanks exeboss src/java.base/share/classes/java/lang/invoke/LazyInitializingVarHandle.java line 125: > 123: cache[i] = callTarget; > 124: } > 125: } Unlike?calling `Unsafe::ensureClassInitialized(?)` (which?performs its?own?synchronisation) or?writing?`true` to?`this.initialized` (which?is a?benign?race), updating?the?lambda?forms this?way is?probably not?quite?correct to?do?under?a?race and?probably?needs some?synchronisation. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13821#discussion_r1216862767 From cjplummer at openjdk.org Sun Jun 4 18:21:12 2023 From: cjplummer at openjdk.org (Chris Plummer) Date: Sun, 4 Jun 2023 18:21:12 GMT Subject: RFR: 8309334: ProcessTools.main() does not properly set thread names when using the virtual thread wrapper [v3] In-Reply-To: References: Message-ID: On Sat, 3 Jun 2023 21:34:16 GMT, Chris Plummer wrote: >> Normally when a virtual thread wrapper is used to run a test, the main thread is renamed to "old-m-a-i-n" and the new virtual thread that will act as the main thread is named "main". Neither is being done by `ProcessTools.main()`. This can cause problems for tests that expect the main thread that the test is running in to be called "main". It is instead left unnamed. This is causing the following 4 tests to fail: >> >> com/sun/jdi/JdbMethodExitTest.java >> com/sun/jdi/JdbStepTest.java >> com/sun/jdi/JdbStopThreadTest.java >> com/sun/jdi/JdbStopThreadidTest.java >> >> These tests also fail due to [JDK-8309397](https://bugs.openjdk.org/browse/JDK-8309397), which will be fixed after this CR, and also com/sun/jdi/JdbMethodExitTest.java fails due to [JDK-8309396](https://bugs.openjdk.org/browse/JDK-8309396), which will also subsequently be fixed. >> >> Note this fix messed up one runtime test. It was expecting an exception message to mention the "main" thread rather than "old-m-a-i-n". Loosening the exception message matching pattern a bit solved the problem. >> >> Testing was done by running all of tier1 and tier5. > > Chris Plummer has updated the pull request incrementally with two additional commits since the last revision: > > - No longer need reflection to call Thread.ofVirtual().unstarted() > - Remove from problem list tests that are fixed by this PR. Thanks for the reviews Leonid, Alan, Serguei and Alex! ------------- PR Comment: https://git.openjdk.org/jdk/pull/14292#issuecomment-1575663199 From cjplummer at openjdk.org Sun Jun 4 18:21:14 2023 From: cjplummer at openjdk.org (Chris Plummer) Date: Sun, 4 Jun 2023 18:21:14 GMT Subject: Integrated: 8309334: ProcessTools.main() does not properly set thread names when using the virtual thread wrapper In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 21:30:46 GMT, Chris Plummer wrote: > Normally when a virtual thread wrapper is used to run a test, the main thread is renamed to "old-m-a-i-n" and the new virtual thread that will act as the main thread is named "main". Neither is being done by `ProcessTools.main()`. This can cause problems for tests that expect the main thread that the test is running in to be called "main". It is instead left unnamed. This is causing the following 4 tests to fail: > > com/sun/jdi/JdbMethodExitTest.java > com/sun/jdi/JdbStepTest.java > com/sun/jdi/JdbStopThreadTest.java > com/sun/jdi/JdbStopThreadidTest.java > > These tests also fail due to [JDK-8309397](https://bugs.openjdk.org/browse/JDK-8309397), which will be fixed after this CR, and also com/sun/jdi/JdbMethodExitTest.java fails due to [JDK-8309396](https://bugs.openjdk.org/browse/JDK-8309396), which will also subsequently be fixed. > > Note this fix messed up one runtime test. It was expecting an exception message to mention the "main" thread rather than "old-m-a-i-n". Loosening the exception message matching pattern a bit solved the problem. > > Testing was done by running all of tier1 and tier5. This pull request has now been integrated. Changeset: ecb17532 Author: Chris Plummer URL: https://git.openjdk.org/jdk/commit/ecb17532dc8f3e271ad2d6550127a2253569cf9b Stats: 24 lines in 3 files changed: 5 ins; 16 del; 3 mod 8309334: ProcessTools.main() does not properly set thread names when using the virtual thread wrapper Reviewed-by: amenkov, lmesnik, sspitsyn, alanb ------------- PR: https://git.openjdk.org/jdk/pull/14292 From liach at openjdk.org Sun Jun 4 21:19:06 2023 From: liach at openjdk.org (Chen Liang) Date: Sun, 4 Jun 2023 21:19:06 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v8] In-Reply-To: References: Message-ID: <3qfyy7p3A-q8vug3coD6uM7q3bzYzznOWW6lgiPRTlk=.084ed5ee-5407-435a-82fb-6b81fde72f29@github.com> On Sun, 4 Jun 2023 16:12:46 GMT, ExE Boss wrote: >> Chen Liang has updated the pull request incrementally with one additional commit since the last revision: >> >> Improve subsequent VH call performance, thanks exeboss > > src/java.base/share/classes/java/lang/invoke/LazyInitializingVarHandle.java line 125: > >> 123: cache[i] = callTarget; >> 124: } >> 125: } > > Unlike?calling `Unsafe::ensureClassInitialized(?)` (which?performs its?own?synchronisation) or?writing?`true` to?`this.initialized` (which?is a?benign?race), updating?the?lambda?forms this?way is?probably not?quite?correct to?do?under?a?race and?probably?needs some?synchronisation. The form update is a benign race. The array update might need some fences, but I'm not sure, as the read MH should be complete when the updated value is already observed. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13821#discussion_r1217150854 From liach at openjdk.org Sun Jun 4 23:52:37 2023 From: liach at openjdk.org (Chen Liang) Date: Sun, 4 Jun 2023 23:52:37 GMT Subject: RFR: 8309413: General improvements to MethodTypeDesc implementation [v5] In-Reply-To: References: Message-ID: > This patch aims to improve the performance of MethodTypeDesc in general, as it is currently a performance bottleneck in the Classfile API. A previous revision changed the parameter storage from an array to a list; this is dropped now. Sorry for the force push. > > > Benchmark (descString) Mode Cnt Score Error Units > MethodTypeDescFactories.descriptorString (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 27.778 ? 0.573 ns/op > MethodTypeDescFactories.descriptorString ()V avgt 6 13.343 ? 0.235 ns/op > MethodTypeDescFactories.descriptorString ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 40.828 ? 0.448 ns/op > MethodTypeDescFactories.descriptorString ()[Ljava/lang/String; avgt 6 14.754 ? 0.162 ns/op > MethodTypeDescFactories.ofArray (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 8.616 ? 0.132 ns/op > MethodTypeDescFactories.ofArray ()V avgt 6 2.146 ? 0.293 ns/op > MethodTypeDescFactories.ofArray ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 14.595 ? 0.235 ns/op > MethodTypeDescFactories.ofArray ()[Ljava/lang/String; avgt 6 2.064 ? 0.085 ns/op > MethodTypeDescFactories.ofDescriptor (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 97.077 ? 2.482 ns/op > MethodTypeDescFactories.ofDescriptor ()V avgt 6 13.563 ? 0.111 ns/op > MethodTypeDescFactories.ofDescriptor ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 130.543 ? 2.847 ns/op > MethodTypeDescFactories.ofDescriptor ()[Ljava/lang/String; avgt 6 35.286 ? 0.260 ns/op > MethodTypeDescFactories.ofList (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 4.156 ? 0.258 ns/op > MethodTypeDescFactories.ofList ()V avgt 6 2.192 ? 0.063 ns/op > MethodTypeDescFactories.ofList ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 41.002 ? 0.235 ns/op > MethodTypeDescFactories.ofList ()[Ljava/lang/String; avgt 6 2.200 ? 0.041 ns/op Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits: - Forgot to upload latest micro - general optimizations to MTD, no longer change backing storage ------------- Changes: https://git.openjdk.org/jdk/pull/13186/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13186&range=04 Stats: 305 lines in 7 files changed: 201 ins; 42 del; 62 mod Patch: https://git.openjdk.org/jdk/pull/13186.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13186/head:pull/13186 PR: https://git.openjdk.org/jdk/pull/13186 From liach at openjdk.org Sun Jun 4 23:52:37 2023 From: liach at openjdk.org (Chen Liang) Date: Sun, 4 Jun 2023 23:52:37 GMT Subject: RFR: 8309413: General improvements to MethodTypeDesc implementation [v4] In-Reply-To: References: Message-ID: On Fri, 26 May 2023 20:41:36 GMT, Mandy Chung wrote: >> Chen Liang has refreshed the contents of this pull request, and previous commits have been removed. Incremental views are not available. > > The microbenchmark shows the performance of using the `MethodTypeDesc` factory methods. With [#13671](https://github.com/openjdk/jdk/pull/13671), `MethodTypeDesc` is cached and I wonder if this is no longer the bottleneck of ClassFile API performance. > > [JDK-8304932](https://bugs.openjdk.org/browse/JDK-8304932) is a bug that can simply be fixed by > > diff --git a/src/java.base/share/classes/java/lang/constant/MethodTypeDesc.java b/src/java.base/share/classes/java/lang/constant/MethodTypeDesc.java > index 738c4d68a43..ed23887c9ef 100644 > --- a/src/java.base/share/classes/java/lang/constant/MethodTypeDesc.java > +++ b/src/java.base/share/classes/java/lang/constant/MethodTypeDesc.java > @@ -95,7 +95,7 @@ public sealed interface MethodTypeDesc > * {@link ClassDesc} for {@code void} > */ > static MethodTypeDesc of(ClassDesc returnDesc, ClassDesc... paramDescs) { > - return new MethodTypeDescImpl(returnDesc, paramDescs); > + return new MethodTypeDescImpl(returnDesc, paramDescs.clone()); > } > > /** > diff --git a/src/java.base/share/classes/java/lang/constant/MethodTypeDescImpl.java b/src/java.base/share/classes/java/lang/constant/MethodTypeDescImpl.java > index 4341c3fb56f..8586bfb5926 100644 > --- a/src/java.base/share/classes/java/lang/constant/MethodTypeDescImpl.java > +++ b/src/java.base/share/classes/java/lang/constant/MethodTypeDescImpl.java > @@ -41,7 +41,7 @@ import static java.util.Objects.requireNonNull; > */ > final class MethodTypeDescImpl implements MethodTypeDesc { > private final ClassDesc returnType; > - private final ClassDesc[] argTypes; > + private final ClassDesc[] argTypes; // trusted array > > /** > * Constructs a {@linkplain MethodTypeDesc} with the specified return type > @@ -102,14 +102,14 @@ final class MethodTypeDescImpl implements MethodTypeDesc { > > @Override > public MethodTypeDesc changeReturnType(ClassDesc returnType) { > - return MethodTypeDesc.of(returnType, argTypes); > + return new MethodTypeDescImpl(returnType, argTypes); > } > > @Override > public MethodTypeDesc changeParameterType(int index, ClassDesc paramType) { > ClassDesc[] newArgs = argTypes.clone(); > newArgs[index] = paramType; > - return MethodTypeDesc.of(returnType, newArgs); > + return new MethodTypeDescImpl(returnType, newArgs); > } > > @Override > @@ -120,7 +120,7 @@ final class MethodTypeDescImpl implements MethodTypeDesc { > Cl... @mlchung I have updated this patch to no longer change the array to a list. Could you take a look? I wish this to be integrated into JDK 21 as it does bring a lot of performance benefits. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13186#issuecomment-1575808993 From darcy at openjdk.org Mon Jun 5 01:18:26 2023 From: darcy at openjdk.org (Joe Darcy) Date: Mon, 5 Jun 2023 01:18:26 GMT Subject: RFR: JDK-8295071: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number Message-ID: Document existing behavior. Please also review the CSR https://bugs.openjdk.org/browse/JDK-8309415 ------------- Commit messages: - JDK-8309415: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number Changes: https://git.openjdk.org/jdk/pull/14305/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14305&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8295071 Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14305.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14305/head:pull/14305 PR: https://git.openjdk.org/jdk/pull/14305 From alanb at openjdk.org Mon Jun 5 06:08:05 2023 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 5 Jun 2023 06:08:05 GMT Subject: RFR: JDK-8295071: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 01:11:54 GMT, Joe Darcy wrote: > Document existing behavior. > > Please also review the CSR https://bugs.openjdk.org/browse/JDK-8309415 src/java.base/share/classes/java/lang/System.java line 758: > 756: * Greatest Java class file format version recognized by the runtime as {@code "MAJOR.MINOR"} > 757: * where {@link java.lang.reflect.ClassFileFormatVersion#major() MAJOR} and {@code MINOR} > 758: * are both formatted as decimal integers I'm not sure about using the adjective "Greatest" here, only because "Greatest ... recognized" reads a bit like recognition of greatness when it really wants to convey that it's the highest version recognized. Does the wording need to take account of running with preview features enabled? The table uses "Java runtime" rather than "runtime" in the description of some of the other properties. In passing, should the descriptions of RELEASE_xxx in ClassFileFormatVersion say "The highest version recognized" rather than the "The version recognized"? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14305#discussion_r1217548926 From alanb at openjdk.org Mon Jun 5 06:19:27 2023 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 5 Jun 2023 06:19:27 GMT Subject: RFR: 8309408: Thread.sleep cleanup Message-ID: Thread.sleep has had quite a bit of churn recently to support virtual threads, add sleep(Duration), a JFR event, and the change the underlying implementation to support sub-millis precision. I think the changes have settled down now so we can do some small cleanups that came up in PR discussions. The cleanups were kicked down the road as it requires tracking down faraway tests that depend on the stack depth and the names of internal methods. The two cleanups proposed here are: 1. Add a private sleepNanos method that creates/commits the JFR event around the sleep, this avoids duplicate code in the 3 sleep methods. 2. Rename JVM_Sleep to JVM_SleepNanos to make it clear that it takes the sleep time in nanoseconds, esp. when Thread.sleep's parameter is milliseconds. ------------- Commit messages: - Initial commit Changes: https://git.openjdk.org/jdk/pull/14303/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14303&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309408 Stats: 75 lines in 10 files changed: 27 ins; 32 del; 16 mod Patch: https://git.openjdk.org/jdk/pull/14303.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14303/head:pull/14303 PR: https://git.openjdk.org/jdk/pull/14303 From dholmes at openjdk.org Mon Jun 5 07:31:12 2023 From: dholmes at openjdk.org (David Holmes) Date: Mon, 5 Jun 2023 07:31:12 GMT Subject: RFR: 8309408: Thread.sleep cleanup In-Reply-To: References: Message-ID: On Sun, 4 Jun 2023 11:28:33 GMT, Alan Bateman wrote: > Thread.sleep has had quite a bit of churn recently to support virtual threads, add sleep(Duration), a JFR event, and the change the underlying implementation to support sub-millis precision. I think the changes have settled down now so we can do some small cleanups that came up in PR discussions. The cleanups were kicked down the road as it requires tracking down faraway tests that depend on the stack depth and the names of internal methods. The two cleanups proposed here are: > > 1. Add a private sleepNanos method that creates/commits the JFR event around the sleep, this avoids duplicate code in the 3 sleep methods. > 2. Rename JVM_Sleep to JVM_SleepNanos to make it clear that it takes the sleep time in nanoseconds, esp. when Thread.sleep's parameter is milliseconds. Looks good! Keeping these tests up-to-date is painful, but as you note this is hopefully stabilized now. There is one potential, pre-existing, test omission noted below. Thanks. test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.java line 660: > 658: expectedMethods.add(Thread.class.getName() + ".sleep"); > 659: expectedMethods.add(Thread.class.getName() + ".sleepNanos"); > 660: expectedMethods.add(Thread.class.getName() + ".sleepNanos0"); I'm surprised this test doesn't list `beforeSleep` and `afterSleep`. ------------- Marked as reviewed by dholmes (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14303#pullrequestreview-1461876843 PR Review Comment: https://git.openjdk.org/jdk/pull/14303#discussion_r1217641284 From stefank at openjdk.org Mon Jun 5 08:23:05 2023 From: stefank at openjdk.org (Stefan Karlsson) Date: Mon, 5 Jun 2023 08:23:05 GMT Subject: RFR: 8309408: Thread.sleep cleanup In-Reply-To: References: Message-ID: <5QMR3WIYHEm2QUPqwMEb5fX_eHEYZv9qrv9BeJeeooI=.c53f6306-26cf-4d32-966a-c6f6795b760c@github.com> On Sun, 4 Jun 2023 11:28:33 GMT, Alan Bateman wrote: > Thread.sleep has had quite a bit of churn recently to support virtual threads, add sleep(Duration), a JFR event, and the change the underlying implementation to support sub-millis precision. I think the changes have settled down now so we can do some small cleanups that came up in PR discussions. The cleanups were kicked down the road as it requires tracking down faraway tests that depend on the stack depth and the names of internal methods. The two cleanups proposed here are: > > 1. Add a private sleepNanos method that creates/commits the JFR event around the sleep, this avoids duplicate code in the 3 sleep methods. > 2. Rename JVM_Sleep to JVM_SleepNanos to make it clear that it takes the sleep time in nanoseconds, esp. when Thread.sleep's parameter is milliseconds. I welcome this change. We were looking at this code on Friday and was thinking that it would have been good to rename sleep0 and JVM_Sleep. :) ------------- Marked as reviewed by stefank (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14303#pullrequestreview-1461982066 From apejovic at openjdk.org Mon Jun 5 09:04:07 2023 From: apejovic at openjdk.org (Aleksandar Pejovic) Date: Mon, 5 Jun 2023 09:04:07 GMT Subject: RFR: 8309191: Reduce JDK dependencies of cgroup support In-Reply-To: <9UqqGOmXLkrwGFFsrX1IdUCOzdHPOb_bh6rZTi5SgQw=.3b73ac88-8410-409a-b057-cb4837a4a48c@github.com> References: <9UqqGOmXLkrwGFFsrX1IdUCOzdHPOb_bh6rZTi5SgQw=.3b73ac88-8410-409a-b057-cb4837a4a48c@github.com> Message-ID: On Wed, 31 May 2023 13:49:46 GMT, Aleksandar Pejovic wrote: >>> I guess I'll have to wait for OCA verification. >> >> Yes. >> >>> One failure is due to a lack of reviewers, so would you be able to do a review? >> >> Yes, I'll try to do a review later today or tomorrow. >> >> Thanks! > >> Yes, I'll try to do a review later today or tomorrow. > > Awesome, thanks! > @pejovica what testing have you done in relation to these changes? We run our container tests in tier5 - have you tested that? Thanks. @dholmes-ora Thanks for the pointer, I'll post back when I run them. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14216#issuecomment-1576407433 From apejovic at openjdk.org Mon Jun 5 09:04:10 2023 From: apejovic at openjdk.org (Aleksandar Pejovic) Date: Mon, 5 Jun 2023 09:04:10 GMT Subject: RFR: 8309191: Reduce JDK dependencies of cgroup support In-Reply-To: References: Message-ID: <1k0o3AhR5gZkMrmtdpGqRg3MM77JTsh9pcFXraWYydE=.7e768396-ab2f-4778-9dcb-3716f28fddcc@github.com> On Thu, 1 Jun 2023 08:50:33 GMT, Severin Gehwolf wrote: >> The current code for cgroup support in the JDK has large and expensive dependencies: it uses NIO, streams, and regular expressions. This leads to unnecessary class loading and slows down startup, especially when the code is executed early during an application startup. This is especially a problem for GraalVM, which executes this code during VM startup. >> >> This PR reduces the dependencies: >> - NIO is replaced with regular `java.io` for file access. >> - Streams are replaced with loops (a side effect of this is that files are read in full whereas previously they could be read up to a certain point, e.g., until a match is found). >> - Regular expressions are replaced with manual tokenization (and for usages of `String.split`, the "regex" is changed to single characters for which `String.split` has a fast-path implementation that avoids the regular expression engine). > > src/java.base/linux/classes/jdk/internal/platform/CgroupInfo.java line 110: > >> 108: */ >> 109: static CgroupInfo fromCgroupsLine(String line) { >> 110: String[] tokens = line.split("\t"); > > With this change, we now hard-code the expected delimiter and, thus, depend on what the kernel does. Do we have sufficient evidence this hasn't changed/won't change in the future? As far as I can tell, the delimiter hasn't changed since the file was introduced, and judging by the kernel mailing list (e.g., see [the following](https://lore.kernel.org/all/Yr5JVHhSUCrbT8OH at mtj.duckdns.org/)), I don't think it will change any time soon. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14216#discussion_r1217759178 From apejovic at openjdk.org Mon Jun 5 09:10:08 2023 From: apejovic at openjdk.org (Aleksandar Pejovic) Date: Mon, 5 Jun 2023 09:10:08 GMT Subject: RFR: 8309191: Reduce JDK dependencies of cgroup support In-Reply-To: References: Message-ID: <5_0qa5a7BPRpPsD1q2i5ZFioDEDTXgtMyY006a8uCCg=.63a64099-70ed-4a33-af86-25203f8aefed@github.com> On Thu, 1 Jun 2023 09:47:29 GMT, Severin Gehwolf wrote: >> The current code for cgroup support in the JDK has large and expensive dependencies: it uses NIO, streams, and regular expressions. This leads to unnecessary class loading and slows down startup, especially when the code is executed early during an application startup. This is especially a problem for GraalVM, which executes this code during VM startup. >> >> This PR reduces the dependencies: >> - NIO is replaced with regular `java.io` for file access. >> - Streams are replaced with loops (a side effect of this is that files are read in full whereas previously they could be read up to a certain point, e.g., until a match is found). >> - Regular expressions are replaced with manual tokenization (and for usages of `String.split`, the "regex" is changed to single characters for which `String.split` has a fast-path implementation that avoids the regular expression engine). > > src/java.base/linux/classes/jdk/internal/platform/cgroupv1/CgroupV1SubsystemController.java line 110: > >> 108: >> 109: public static long convertHierachicalLimitLine(String line) { >> 110: String[] tokens = line.split(" "); > > Again, assumes single space (` `) delimited entries in `memory.stat`. I'm not sure we should hard-code this. This delimiter also hasn't changed since the `memory.stat` file was introduced, and since cgroup v1 is in maintenance mode I'd expect it to stay that way. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14216#discussion_r1217765452 From duke at openjdk.org Mon Jun 5 09:39:10 2023 From: duke at openjdk.org (SUN Guoyun) Date: Mon, 5 Jun 2023 09:39:10 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v3] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 08:58:23 GMT, SUN Guoyun wrote: >> command: make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp" TEST=gc/TestAllocHumongousFragment.java >> error info: >> >> Caused by: java.lang.NullPointerException: Cannot invoke "sun.util.locale.BaseLocale.getVariant()" because "base" is null >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1802) >> at java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.(CLDRBaseLocaleDataMetaInfo.java:41) >> ... 24 more >> >> Note that the test runs with -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot and SoftReferences are involved (LocaleObjectCache uses SoftReferences, used by printf method called in getRandomInstance(Utils.java:511)). >> >> Maybe we have to deal with the case where the getBaseLocale() return value is null. the call stack is: >> >> at java.base/sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:64) >> at java.base/sun.util.locale.BaseLocale.getInstance(BaseLocale.java:169) >> at java.base/sun.util.locale.InternalLocaleBuilder.getBaseLocale(InternalLocaleBuilder.java:524) >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1874) >> >> in LocaleObjectCache.java:64 >> >> 62 if (key == null || newVal == null) { >> 63 // subclass must return non-null key/value object >> 64 return null; // run here >> 65 } > > SUN Guoyun has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision: > > 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared Existing JMH Local test results be tested on LOONGARCH64 show no performance fallback.
    
    // parent
    Benchmark                         Mode  Cnt   Score   Error  Units
    LocaleDefaults.getDefault         avgt    3  35.731 ? 0.805  ns/op
    LocaleDefaults.getDefaultDisplay  avgt    3  36.099 ? 1.037  ns/op
    LocaleDefaults.getDefaultFormat   avgt    3  36.123 ? 1.718  ns/op
    
    // current
    Benchmark                         Mode  Cnt   Score   Error  Units
    LocaleDefaults.getDefault         avgt    3  35.649 ? 0.264  ns/op
    LocaleDefaults.getDefaultDisplay  avgt    3  36.141 ? 1.283  ns/op
    LocaleDefaults.getDefaultFormat   avgt    3  36.092 ? 1.371  ns/op
    
    
    ------------- PR Comment: https://git.openjdk.org/jdk/pull/14211#issuecomment-1576462477 From sgehwolf at openjdk.org Mon Jun 5 09:47:06 2023 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Mon, 5 Jun 2023 09:47:06 GMT Subject: RFR: 8309191: Reduce JDK dependencies of cgroup support In-Reply-To: <1k0o3AhR5gZkMrmtdpGqRg3MM77JTsh9pcFXraWYydE=.7e768396-ab2f-4778-9dcb-3716f28fddcc@github.com> References: <1k0o3AhR5gZkMrmtdpGqRg3MM77JTsh9pcFXraWYydE=.7e768396-ab2f-4778-9dcb-3716f28fddcc@github.com> Message-ID: On Mon, 5 Jun 2023 09:02:06 GMT, Aleksandar Pejovic wrote: >> src/java.base/linux/classes/jdk/internal/platform/CgroupInfo.java line 110: >> >>> 108: */ >>> 109: static CgroupInfo fromCgroupsLine(String line) { >>> 110: String[] tokens = line.split("\t"); >> >> With this change, we now hard-code the expected delimiter and, thus, depend on what the kernel does. Do we have sufficient evidence this hasn't changed/won't change in the future? > > As far as I can tell, the delimiter hasn't changed since the file was introduced, and judging by the kernel mailing list (e.g., see [the following](https://lore.kernel.org/all/Yr5JVHhSUCrbT8OH at mtj.duckdns.org/)), I don't think it will change any time soon. I'm not convinced this is a good change. Going by that mailing list thread, it suggests that people considered changing it. If one of those attempts were successful, it would have broken this code. It makes it rather fragile. The issue, with container detection code going wrong is that you most likely never notice. Translating this to GraalVM means that the native image, would a) detect the wrong version in use or b) fail detection and use host values. In both cases the application will likely misbehave in a container setup with resource limits applied and you won't (easily) know why. So even though it's unlikely to be a problem, there is a chance it could be and it's asking for trouble for no good reason. Therefore, being conservative about delimiters makes sense here. My choice in this case would be more robust code over relying on external factors. YMMV. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14216#discussion_r1217815148 From alanb at openjdk.org Mon Jun 5 10:28:10 2023 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 5 Jun 2023 10:28:10 GMT Subject: RFR: JDK-8308913: Update core reflection for JEP 445 (preview) [v4] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 04:48:35 GMT, Joe Darcy wrote: >> Explain in java.lang.Class how unnamed classes are modeled in core reflection. > > Joe Darcy has updated the pull request incrementally with one additional commit since the last revision: > > Update reflective support. Will this method be tested by the changes in pull/13689? src/java.base/share/classes/java/lang/Class.java line 29: > 27: > 28: import jdk.internal.javac.PreviewFeature; > 29: import jdk.internal.misc.PreviewFeatures; Can you move this so that it's with the other imports of jdk.internal classes? src/java.base/share/classes/java/lang/Class.java line 194: > 192: *

    Unnamed Classes

    > 193: * > 194: * A {@code class} file representing an {@linkplain #isUnnamedClass unnamed class} is generated by Are you going to reflow this paragraph before you are done, only wondering as there is one line sticking out compared the rest of the paragraph. src/java.base/share/classes/java/lang/Class.java line 216: > 214: * {@linkplain #getSimpleName > 215: * simple name} of such an unnamed class is the empty string and the > 216: * {@linkplain #getCanonicalName canonical name} is {@code null}. This sentence is quite long. You might to consider splitting it up, or at minimally put a comma after "empty string" to allow the reader draw breath. src/java.base/share/classes/java/lang/Class.java line 1881: > 1879: * @since 21 > 1880: */ > 1881: @PreviewFeature(feature=PreviewFeature.Feature.UNNAMED_CLASSES, Is there a JLS section to reference? ------------- PR Review: https://git.openjdk.org/jdk/pull/14165#pullrequestreview-1462196037 PR Review Comment: https://git.openjdk.org/jdk/pull/14165#discussion_r1217845247 PR Review Comment: https://git.openjdk.org/jdk/pull/14165#discussion_r1217846409 PR Review Comment: https://git.openjdk.org/jdk/pull/14165#discussion_r1217854569 PR Review Comment: https://git.openjdk.org/jdk/pull/14165#discussion_r1217848157 From jlahoda at openjdk.org Mon Jun 5 10:51:16 2023 From: jlahoda at openjdk.org (Jan Lahoda) Date: Mon, 5 Jun 2023 10:51:16 GMT Subject: Integrated: 8291966: SwitchBootstrap.typeSwitch could be faster In-Reply-To: References: Message-ID: On Fri, 5 Aug 2022 16:12:08 GMT, Jan Lahoda wrote: > The pattern matching switches are using a bootstrap method `SwitchBootstrap.typeSwitch` to implement the jumps in the switch. Basically, for a switch like: > > switch (obj) { > case String s when s.isEmpty() -> {} > case String s -> {} > case CharSequence cs -> {} > ... > } > > > this method will produce a MethodHandle that will be analyze the provided selector value (`obj` in the example), and will return the case index to which the switch should jump. This method also accepts a (re)start index for the search, which is used to handle guards. For example, if the `s.isEmpty()` guard in the above sample returns false, the matching is restarted on the next case. > > The current implementation is fairly slow, it basically goes through the labels in a loop. The proposal here is to replace that with a MethodHandle structure like this: > > obj == null ? -1 > : switch (restartIndex) { > case 0 -> obj instanceof String ? 0 : obj instanceof CharSequence ? 2 : ... ; > case 1 -> obj instanceof String ? 1 : obj instanceof CharSequence ? 2 : ... ; > case 2 -> obj instanceof CharSequence ? 2 : ... ; > ... > default -> ; > } > > > This appear to run faster than the current implementation, using testcase similar to the one used for https://github.com/openjdk/jdk/pull/9746 , these are the results > > PatternsOptimizationTest.testLegacyIndyLongSwitch thrpt 25 1515989.562 ? 32047.918 ops/s > PatternsOptimizationTest.testHandleIndyLongSwitch thrpt 25 2630707.585 ? 37202.210 ops/s > > PatternsOptimizationTest.testLegacyIndyShortSwitch thrpt 25 6789310.900 ? 61921.636 ops/s > PatternsOptimizationTest.testHandleIndyShortSwitch thrpt 25 10771729.464 ? 69607.467 ops/s > > > The "LegacyIndy" is the current implementation, "HandleIndy" is the one proposed here. The translation in javac used is the one from #9746 in all cases. This pull request has now been integrated. Changeset: 9be5769a Author: Jan Lahoda URL: https://git.openjdk.org/jdk/commit/9be5769a68d7cc9dced732649adc4c977b8eac8d Stats: 197 lines in 2 files changed: 110 ins; 15 del; 72 mod 8291966: SwitchBootstrap.typeSwitch could be faster Reviewed-by: asotona ------------- PR: https://git.openjdk.org/jdk/pull/9779 From alanb at openjdk.org Mon Jun 5 12:45:11 2023 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 5 Jun 2023 12:45:11 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v7] In-Reply-To: References: <8hwJYhcT5DQJpsC0Zzlj_kcWqpw9b8yBcVXMLVJurqA=.593e7ec9-f221-4c09-803a-a2de35bfcdb3@github.com> Message-ID: On Fri, 26 May 2023 15:57:15 GMT, Brian Burkhalter wrote: > > Would you please review this PR ? > > We are in the last two weeks before JDK 21 rampdown phase 1 and so are rather busy. This PR has not been forgotten. Thanks for your patience. Yeah, this is docs only so okay to do after the fork for RDP1. I think the current PR is okay but this method, plus FileSystem::getRootDirectories, need a sentence to that something like ?There is no guarantee that the root directory can be accessed?. I don't have an opinion on whether it is this PR or another one. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13526#issuecomment-1576719785 From jlaskey at openjdk.org Mon Jun 5 12:47:23 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Mon, 5 Jun 2023 12:47:23 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v32] In-Reply-To: References: Message-ID: On Sat, 3 Jun 2023 01:53:41 GMT, Joe Darcy wrote: >> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision: >> >> Update the specification for TypeElement#getQualifiedName and TypeElement#getSimpleName > > src/java.base/share/classes/java/lang/Class.java line 1884: > >> 1882: reflective=true) >> 1883: public boolean isUnnamedClass() { >> 1884: return PreviewFeatures.isEnabled() && isSynthetic() && isTopLevelClass(); > > Please add a check for final-ness as @mlchung suggested in the other PR of the reflection changes stand-alone. Changing > src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java line 1379: > >> 1377: @Override @DefinedBy(Api.LANGUAGE_MODEL) >> 1378: public Name getSimpleName() { >> 1379: // return isUnnamed() ? name.subName(0, 0) /* empty name */ : name; > > This line could be deleted. Changing > test/langtools/tools/javac/processing/model/element/TestUnnamedClass.java line 140: > >> 138: } >> 139: >> 140: if (unnamedClass.getSimpleName().isEmpty()) { > > Presumably the sense of the predicates testing names needs to now be reserved due to subsequent updates to the javax.lang.model support. True, but we should ensure that what we are shipping now does what we claim. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1218020010 PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1218020222 PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1218022085 From jlaskey at openjdk.org Mon Jun 5 12:51:11 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Mon, 5 Jun 2023 12:51:11 GMT Subject: RFR: JDK-8308913: Update core reflection for JEP 445 (preview) [v4] In-Reply-To: References: Message-ID: <0rctTE2XA0-LgFZvupeJi89ozvPWxKe7A9mbFodVOV4=.4fabf801-fb61-4a01-a14c-a4cfd812e842@github.com> On Mon, 5 Jun 2023 10:08:59 GMT, Alan Bateman wrote: >> Joe Darcy has updated the pull request incrementally with one additional commit since the last revision: >> >> Update reflective support. > > src/java.base/share/classes/java/lang/Class.java line 29: > >> 27: >> 28: import jdk.internal.javac.PreviewFeature; >> 29: import jdk.internal.misc.PreviewFeatures; > > Can you move this so that it's with the other imports of jdk.internal classes? Changing in primary PR - https://github.com/openjdk/jdk/pull/13689 > src/java.base/share/classes/java/lang/Class.java line 194: > >> 192: *

    Unnamed Classes

    >> 193: * >> 194: * A {@code class} file representing an {@linkplain #isUnnamedClass unnamed class} is generated by > > Are you going to reflow this paragraph before you are done, only wondering as there is one line sticking out compared the rest of the paragraph. Changing in primary PR - https://github.com/openjdk/jdk/pull/13689 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14165#discussion_r1218025885 PR Review Comment: https://git.openjdk.org/jdk/pull/14165#discussion_r1218027536 From jlaskey at openjdk.org Mon Jun 5 12:55:11 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Mon, 5 Jun 2023 12:55:11 GMT Subject: RFR: JDK-8308913: Update core reflection for JEP 445 (preview) [v4] In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 10:11:17 GMT, Alan Bateman wrote: >> Joe Darcy has updated the pull request incrementally with one additional commit since the last revision: >> >> Update reflective support. > > src/java.base/share/classes/java/lang/Class.java line 1881: > >> 1879: * @since 21 >> 1880: */ >> 1881: @PreviewFeature(feature=PreviewFeature.Feature.UNNAMED_CLASSES, > > Is there a JLS section to reference? Changing in primary PR - https://github.com/openjdk/jdk/pull/13689 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14165#discussion_r1218031133 From jlaskey at openjdk.org Mon Jun 5 13:00:08 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Mon, 5 Jun 2023 13:00:08 GMT Subject: RFR: JDK-8308913: Update core reflection for JEP 445 (preview) [v4] In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 10:17:01 GMT, Alan Bateman wrote: >> Joe Darcy has updated the pull request incrementally with one additional commit since the last revision: >> >> Update reflective support. > > src/java.base/share/classes/java/lang/Class.java line 216: > >> 214: * {@linkplain #getSimpleName >> 215: * simple name} of such an unnamed class is the empty string and the >> 216: * {@linkplain #getCanonicalName canonical name} is {@code null}. > > This sentence is quite long. You might to consider splitting it up, or at minimally put a comma after "empty string" to allow the reader draw breath. This was the agreed wording. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14165#discussion_r1218038932 From jlaskey at openjdk.org Mon Jun 5 13:40:07 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Mon, 5 Jun 2023 13:40:07 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v33] In-Reply-To: References: Message-ID: > Add flexible main methods and anonymous main classes to the Java language. Jim Laskey has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 53 commits: - Merge branch 'master' into 8306112 - Requested clean ups - Source code launcher to use getSimpleName() when launching unnamed class - Update the specification for TypeElement#getQualifiedName and TypeElement#getSimpleName - Use getQualifiedName() to indicate unnamed class - ClassSymbol#getSimpleName() returning empty name breaks some tools - Merge branch 'master' into 8306112 - Update reflection to follow spec - Merge branch 'master' into 8306112 - Integrating JDK-8308913 - ... and 43 more: https://git.openjdk.org/jdk/compare/6d511f13...94d1eefd ------------- Changes: https://git.openjdk.org/jdk/pull/13689/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=32 Stats: 1690 lines in 41 files changed: 1512 ins; 32 del; 146 mod Patch: https://git.openjdk.org/jdk/pull/13689.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13689/head:pull/13689 PR: https://git.openjdk.org/jdk/pull/13689 From dl at openjdk.org Mon Jun 5 13:52:36 2023 From: dl at openjdk.org (Doug Lea) Date: Mon, 5 Jun 2023 13:52:36 GMT Subject: RFR: 8288899: java/util/concurrent/ExecutorService/CloseTest.java failed with "InterruptedException: sleep interrupted" Message-ID: Addresses Jdk 8288899 : java/util/concurrent/ExecutorService/CloseTest.java failed with "InterruptedException: sleep interrupted" and related issues. This is a major ForkJoin update (and hard to review -- sorry) that finally addresses incompatibilities between ExecutorService and ForkJoinPool (which claims to implement it), with the goal of avoiding continuing bug reports and incompatibilities. Doing this required reworking internal control to use phaser/seqlock-style versioning schemes (affecting nearly every method) that ensure consistent data structures and actions without requiring global synchronization or locking on every task execution that would massively degrade performance. The previous lack of a solution to this was the main reason for these incompatibilities. ------------- Commit messages: - Rework versioning - Merge branch 'openjdk:master' into JDK-8288899 - Merge branch 'openjdk:master' into JDK-8288899 - Merge branch 'openjdk:master' into JDK-8288899 - Merge branch 'openjdk:master' into JDK-8288899 - Merge branch 'openjdk:master' into JDK-8288899 - Reduce contention - minor improvements and renamings - Merge branch 'openjdk:master' into JDK-8288899 - Add invokeAnyUninterruptibly - ... and 29 more: https://git.openjdk.org/jdk/compare/6edd786b...6a116f50 Changes: https://git.openjdk.org/jdk/pull/14301/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14301&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8288899 Stats: 2951 lines in 6 files changed: 1125 ins; 658 del; 1168 mod Patch: https://git.openjdk.org/jdk/pull/14301.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14301/head:pull/14301 PR: https://git.openjdk.org/jdk/pull/14301 From asotona at openjdk.org Mon Jun 5 14:31:46 2023 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 5 Jun 2023 14:31:46 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v4] In-Reply-To: References: Message-ID: > Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html > This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. > > Please review. > > Thanks, > 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 23 additional commits since the last revision: - Merge branch 'master' into JDK-8308899-context - fixed StackMapGenerator::generatorError and removed obsolete SplitConstantPool clone constructor - Merge branch 'master' into JDK-8308899-context - fixed benchmarks - fixed snippets and added SnippetsTest - fixed javadoc - added Classfile context parameter to ClasRemapper::remapClass - records and methods implementations moved from Classfile to ClassfileImpl - added Classfile::buildTo override - implementation of Classfile::withOptions(Option... options) ClassfileImpl made immutable "options" use across implementation renamed to "context" - ... and 13 more: https://git.openjdk.org/jdk/compare/7990f646...7d431af9 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14180/files - new: https://git.openjdk.org/jdk/pull/14180/files/f8915f91..7d431af9 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=02-03 Stats: 6081 lines in 122 files changed: 4664 ins; 863 del; 554 mod Patch: https://git.openjdk.org/jdk/pull/14180.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14180/head:pull/14180 PR: https://git.openjdk.org/jdk/pull/14180 From asotona at openjdk.org Mon Jun 5 14:38:47 2023 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 5 Jun 2023 14:38:47 GMT Subject: RFR: 8308842: Consolidate exceptions thrown from Class-File API [v3] In-Reply-To: References: Message-ID: > Class-File API actually throws wide variety of exceptions based on the actual situation. Complete error handling code must cover `IndexOutOfBoundsException`, `IllegalStateException` and `IllegalArgumentException`. > > Based on previous discussions we decided to consolidate on `IllegalArgumentException` with possible sub-classes. > > It allows easy common error handling in majority of use case, however it allows also to distinguish source of the error when needed (for example `javap` needs to know if the exception comes from constant poll or not). > > Newly introduced `ConstantPoolException` extends `IllegalArgumentException` to indicate the source of the problem is in constant pool. > > Please review. > > Thanks, > 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 three additional commits since the last revision: - Merge branch 'master' into JDK-8308842-exceptions - fixed javadoc - 8308842: Consolidate exceptions thrown from Class-File API ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14143/files - new: https://git.openjdk.org/jdk/pull/14143/files/8bc444df..65a7e70a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14143&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14143&range=01-02 Stats: 36795 lines in 720 files changed: 29233 ins; 3454 del; 4108 mod Patch: https://git.openjdk.org/jdk/pull/14143.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14143/head:pull/14143 PR: https://git.openjdk.org/jdk/pull/14143 From asotona at openjdk.org Mon Jun 5 14:42:32 2023 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 5 Jun 2023 14:42:32 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v5] In-Reply-To: References: Message-ID: > Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html > This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. > > Please review. > > Thanks, > Adam Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: fixed copyright header ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14180/files - new: https://git.openjdk.org/jdk/pull/14180/files/7d431af9..965dcba8 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=03-04 Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14180.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14180/head:pull/14180 PR: https://git.openjdk.org/jdk/pull/14180 From briangoetz at openjdk.org Mon Jun 5 15:07:11 2023 From: briangoetz at openjdk.org (Brian Goetz) Date: Mon, 5 Jun 2023 15:07:11 GMT Subject: RFR: 8308842: Consolidate exceptions thrown from Class-File API [v3] In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 14:38:47 GMT, Adam Sotona wrote: >> Class-File API actually throws wide variety of exceptions based on the actual situation. Complete error handling code must cover `IndexOutOfBoundsException`, `IllegalStateException` and `IllegalArgumentException`. >> >> Based on previous discussions we decided to consolidate on `IllegalArgumentException` with possible sub-classes. >> >> It allows easy common error handling in majority of use case, however it allows also to distinguish source of the error when needed (for example `javap` needs to know if the exception comes from constant poll or not). >> >> Newly introduced `ConstantPoolException` extends `IllegalArgumentException` to indicate the source of the problem is in constant pool. >> >> Please review. >> >> Thanks, >> 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 three additional commits since the last revision: > > - Merge branch 'master' into JDK-8308842-exceptions > - fixed javadoc > - 8308842: Consolidate exceptions thrown from Class-File API Reviewed, only minor comment is the one about constructors in the new exception class. src/java.base/share/classes/jdk/internal/classfile/constantpool/ConstantPoolException.java line 42: > 40: super(); > 41: } > 42: Exception classes in the JDK generally have four constructors: (), (Throwable), (String), and (String, Throwable). ------------- Marked as reviewed by briangoetz (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14143#pullrequestreview-1462765241 PR Review Comment: https://git.openjdk.org/jdk/pull/14143#discussion_r1218206593 From alanb at openjdk.org Mon Jun 5 15:13:06 2023 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 5 Jun 2023 15:13:06 GMT Subject: RFR: 8309408: Thread.sleep cleanup In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 07:26:57 GMT, David Holmes wrote: >> Thread.sleep has had quite a bit of churn recently to support virtual threads, add sleep(Duration), a JFR event, and the change the underlying implementation to support sub-millis precision. I think the changes have settled down now so we can do some small cleanups that came up in PR discussions. The cleanups were kicked down the road as it requires tracking down faraway tests that depend on the stack depth and the names of internal methods. The two cleanups proposed here are: >> >> 1. Add a private sleepNanos method that creates/commits the JFR event around the sleep, this avoids duplicate code in the 3 sleep methods. >> 2. Rename JVM_Sleep to JVM_SleepNanos to make it clear that it takes the sleep time in nanoseconds, esp. when Thread.sleep's parameter is milliseconds. > > test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.java line 660: > >> 658: expectedMethods.add(Thread.class.getName() + ".sleep"); >> 659: expectedMethods.add(Thread.class.getName() + ".sleepNanos"); >> 660: expectedMethods.add(Thread.class.getName() + ".sleepNanos0"); > > I'm surprised this test doesn't list `beforeSleep` and `afterSleep`. > There is one potential, pre-existing, test omission noted below. > I'm surprised this test doesn't list `beforeSleep` and `afterSleep`. The monitoring/stress/thread tests will fail if they observe an unexpected method name in the stack trace. I don't think it can happen because the tests poll the thread state and for SleepingThread, it will sample the stack trace when the thread state is timed-wait. The beforeSleep/afterSleep methods won't in the stack trace when sleeping. It would be harmless to add them in that they aren't going to cause these tests to fail but might help with any further changes. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14303#discussion_r1218215964 From asotona at openjdk.org Mon Jun 5 16:08:13 2023 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 5 Jun 2023 16:08:13 GMT Subject: RFR: 8308842: Consolidate exceptions thrown from Class-File API [v3] In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 15:03:01 GMT, Brian Goetz wrote: >> 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 three additional commits since the last revision: >> >> - Merge branch 'master' into JDK-8308842-exceptions >> - fixed javadoc >> - 8308842: Consolidate exceptions thrown from Class-File API > > src/java.base/share/classes/jdk/internal/classfile/constantpool/ConstantPoolException.java line 42: > >> 40: super(); >> 41: } >> 42: > > Exception classes in the JDK generally have four constructors: (), (Throwable), (String), and (String, Throwable). I'll add missing constructors, thanks. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14143#discussion_r1218289371 From jlaskey at openjdk.org Mon Jun 5 16:11:24 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Mon, 5 Jun 2023 16:11:24 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v34] In-Reply-To: References: Message-ID: > Add flexible main methods and anonymous main classes to the Java language. Jim Laskey has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 55 commits: - Merge branch 'master' into 8306112 - Final clean up - Merge branch 'master' into 8306112 - Requested clean ups - Source code launcher to use getSimpleName() when launching unnamed class - Update the specification for TypeElement#getQualifiedName and TypeElement#getSimpleName - Use getQualifiedName() to indicate unnamed class - ClassSymbol#getSimpleName() returning empty name breaks some tools - Merge branch 'master' into 8306112 - Update reflection to follow spec - ... and 45 more: https://git.openjdk.org/jdk/compare/5cd8af76...663ca88f ------------- Changes: https://git.openjdk.org/jdk/pull/13689/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=33 Stats: 1685 lines in 40 files changed: 1510 ins; 32 del; 143 mod Patch: https://git.openjdk.org/jdk/pull/13689.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13689/head:pull/13689 PR: https://git.openjdk.org/jdk/pull/13689 From asotona at openjdk.org Mon Jun 5 16:29:28 2023 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 5 Jun 2023 16:29:28 GMT Subject: RFR: 8308842: Consolidate exceptions thrown from Class-File API [v4] In-Reply-To: References: Message-ID: > Class-File API actually throws wide variety of exceptions based on the actual situation. Complete error handling code must cover `IndexOutOfBoundsException`, `IllegalStateException` and `IllegalArgumentException`. > > Based on previous discussions we decided to consolidate on `IllegalArgumentException` with possible sub-classes. > > It allows easy common error handling in majority of use case, however it allows also to distinguish source of the error when needed (for example `javap` needs to know if the exception comes from constant poll or not). > > Newly introduced `ConstantPoolException` extends `IllegalArgumentException` to indicate the source of the problem is in constant pool. > > Please review. > > Thanks, > Adam Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: added missing ConstantPoolException constructors ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14143/files - new: https://git.openjdk.org/jdk/pull/14143/files/65a7e70a..36d29858 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14143&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14143&range=02-03 Stats: 30 lines in 1 file changed: 27 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/14143.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14143/head:pull/14143 PR: https://git.openjdk.org/jdk/pull/14143 From briangoetz at openjdk.org Mon Jun 5 16:38:20 2023 From: briangoetz at openjdk.org (Brian Goetz) Date: Mon, 5 Jun 2023 16:38:20 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v5] In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 14:42:32 GMT, Adam Sotona wrote: >> Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html >> This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. >> >> Please review. >> >> Thanks, >> Adam > > Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: > > fixed copyright header Overall this looks pretty clean. I like how simply it flows through the implementation classes. There are a number of methods and classes, especially in Classfile, which need some more spec. src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 50: > 48: /** > 49: * Main entry points for parsing, transforming, and generating classfiles. > 50: */ Now that this is not just a bag of static methods any more, we need to have some spec text about what a Classfile is. Something like: Represents a context for parsing, transforming, and generating classfiles. A `Classfile` has a set of options that condition how parsing and generation is done. src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 54: > 52: permits ClassfileImpl { > 53: > 54: static Classfile of() { Classfile::of needs specification src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 63: > 61: > 62: Classfile withOptions(Option... options); > 63: Classfile::withOptions needs specification src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 66: > 64: /** > 65: * An option that affects the writing of classfiles. > 66: */ Options affect parsing as well as writing now src/java.base/share/classes/jdk/internal/classfile/constantpool/ConstantPoolBuilder.java line 82: > 80: static ConstantPoolBuilder of() { > 81: return new SplitConstantPool(); > 82: } The old ctors here were (ClassModel) and (Options), where the ClassModel version had a trail of breadcrumbs back to options. The new ctors are (ClassModel) and no-args, which is a slight departure. What use did CPB make of options in the first place, if any? ------------- PR Review: https://git.openjdk.org/jdk/pull/14180#pullrequestreview-1462788383 PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1218222043 PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1218223437 PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1218223102 PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1218223991 PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1218316864 From asotona at openjdk.org Mon Jun 5 16:44:23 2023 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 5 Jun 2023 16:44:23 GMT Subject: RFR: 8308842: Consolidate exceptions thrown from Class-File API [v5] In-Reply-To: References: Message-ID: > Class-File API actually throws wide variety of exceptions based on the actual situation. Complete error handling code must cover `IndexOutOfBoundsException`, `IllegalStateException` and `IllegalArgumentException`. > > Based on previous discussions we decided to consolidate on `IllegalArgumentException` with possible sub-classes. > > It allows easy common error handling in majority of use case, however it allows also to distinguish source of the error when needed (for example `javap` needs to know if the exception comes from constant poll or not). > > Newly introduced `ConstantPoolException` extends `IllegalArgumentException` to indicate the source of the problem is in constant pool. > > Please review. > > Thanks, > Adam Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: javadoc fix ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14143/files - new: https://git.openjdk.org/jdk/pull/14143/files/36d29858..2454c8e2 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14143&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14143&range=03-04 Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/14143.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14143/head:pull/14143 PR: https://git.openjdk.org/jdk/pull/14143 From jlaskey at openjdk.org Mon Jun 5 16:55:08 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Mon, 5 Jun 2023 16:55:08 GMT Subject: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v35] In-Reply-To: References: Message-ID: > Add flexible main methods and anonymous main classes to the Java language. Jim Laskey has updated the pull request incrementally with one additional commit since the last revision: -Xprint unnamed classes to use e.getSimpleName() ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13689/files - new: https://git.openjdk.org/jdk/pull/13689/files/663ca88f..d0fdf694 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=34 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13689&range=33-34 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/13689.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13689/head:pull/13689 PR: https://git.openjdk.org/jdk/pull/13689 From shade at openjdk.org Mon Jun 5 17:28:08 2023 From: shade at openjdk.org (Aleksey Shipilev) Date: Mon, 5 Jun 2023 17:28:08 GMT Subject: RFR: 8309408: Thread.sleep cleanup In-Reply-To: References: Message-ID: On Sun, 4 Jun 2023 11:28:33 GMT, Alan Bateman wrote: > Thread.sleep has had quite a bit of churn recently to support virtual threads, add sleep(Duration), a JFR event, and the change the underlying implementation to support sub-millis precision. I think the changes have settled down now so we can do some small cleanups that came up in PR discussions. The cleanups were kicked down the road as it requires tracking down faraway tests that depend on the stack depth and the names of internal methods. The two cleanups proposed here are: > > 1. Add a private sleepNanos method that creates/commits the JFR event around the sleep, this avoids duplicate code in the 3 sleep methods. > 2. Rename JVM_Sleep to JVM_SleepNanos to make it clear that it takes the sleep time in nanoseconds, esp. when Thread.sleep's parameter is milliseconds. I think we need to delay this until [JDK-8309361](https://bugs.openjdk.org/browse/JDK-8309361) is resolved, in case we would like to revert [JDK-8305092](https://bugs.openjdk.org/browse/JDK-8305092). ------------- PR Review: https://git.openjdk.org/jdk/pull/14303#pullrequestreview-1463041304 From asotona at openjdk.org Mon Jun 5 17:42:07 2023 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 5 Jun 2023 17:42:07 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v5] In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 16:30:16 GMT, Brian Goetz wrote: >> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: >> >> fixed copyright header > > src/java.base/share/classes/jdk/internal/classfile/constantpool/ConstantPoolBuilder.java line 82: > >> 80: static ConstantPoolBuilder of() { >> 81: return new SplitConstantPool(); >> 82: } > > The old ctors here were (ClassModel) and (Options), where the ClassModel version had a trail of breadcrumbs back to options. The new ctors are (ClassModel) and no-args, which is a slight departure. What use did CPB make of options in the first place, if any? CPB was only holder of options and others took the options from CPB. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1218391052 From darcy at openjdk.org Mon Jun 5 18:01:54 2023 From: darcy at openjdk.org (Joe Darcy) Date: Mon, 5 Jun 2023 18:01:54 GMT Subject: RFR: JDK-8295071: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number [v2] In-Reply-To: References: Message-ID: > Document existing behavior. > > Please also review the CSR https://bugs.openjdk.org/browse/JDK-8309415 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-8295071 - JDK-8309415: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14305/files - new: https://git.openjdk.org/jdk/pull/14305/files/9d744d5b..5c7e4172 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14305&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14305&range=00-01 Stats: 1564 lines in 38 files changed: 1084 ins; 184 del; 296 mod Patch: https://git.openjdk.org/jdk/pull/14305.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14305/head:pull/14305 PR: https://git.openjdk.org/jdk/pull/14305 From mchung at openjdk.org Mon Jun 5 18:05:21 2023 From: mchung at openjdk.org (Mandy Chung) Date: Mon, 5 Jun 2023 18:05:21 GMT Subject: RFR: 8309413: General improvements to MethodTypeDesc implementation [v5] In-Reply-To: References: Message-ID: <7QpluTpgWuXPhJixDBTovoZsOsQAVUUmd8LJ4q9L8Kg=.65b21779-218e-4e16-b69a-3bff366c42a5@github.com> On Sun, 4 Jun 2023 23:52:37 GMT, Chen Liang wrote: >> This patch aims to improve the performance of MethodTypeDesc in general, as it is currently a performance bottleneck in the Classfile API. A previous revision changed the parameter storage from an array to a list; this is dropped now. Sorry for the force push. >> >> >> Benchmark (descString) Mode Cnt Score Error Units >> MethodTypeDescFactories.descriptorString (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 27.778 ? 0.573 ns/op >> MethodTypeDescFactories.descriptorString ()V avgt 6 13.343 ? 0.235 ns/op >> MethodTypeDescFactories.descriptorString ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 40.828 ? 0.448 ns/op >> MethodTypeDescFactories.descriptorString ()[Ljava/lang/String; avgt 6 14.754 ? 0.162 ns/op >> MethodTypeDescFactories.ofArray (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 8.616 ? 0.132 ns/op >> MethodTypeDescFactories.ofArray ()V avgt 6 2.146 ? 0.293 ns/op >> MethodTypeDescFactories.ofArray ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 14.595 ? 0.235 ns/op >> MethodTypeDescFactories.ofArray ()[Ljava/lang/String; avgt 6 2.064 ? 0.085 ns/op >> MethodTypeDescFactories.ofDescriptor (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 97.077 ? 2.482 ns/op >> MethodTypeDescFactories.ofDescriptor ()V avgt 6 13.563 ? 0.111 ns/op >> MethodTypeDescFactories.ofDescriptor ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 130.543 ? 2.847 ns/op >> MethodTypeDescFactories.ofDescriptor ()[Ljava/lang/String; avgt 6 35.286 ? 0.260 ns/op >> MethodTypeDescFactories.ofList (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 4.156 ? 0.258 ns/op >> MethodTypeDescFactories.ofList ()V avgt 6 2.192 ? 0.063 ns/op >> MethodTypeDescFactories.ofList ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 41.002 ? 0.235 ns/op >> MethodTypeDescFactories.ofList ()[Ljava/lang/String; avgt 6 2.200 ? 0.041 ns/op > > Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits: > > - Forgot to upload latest micro > - general optimizations to MTD, no longer change backing storage Some comments in `MethodTypeDesc` and its implementation. Will take a look at the test. I'd like to see the ClassFile implementation changes in a separate PR that needs @asotona to give input and review. The proposed change in the ClassFile implementation is trivial but I can't really tell what the performance issue is (of course, I know it avoids the array allocation). For ClassFile performance issues, it would be useful to have the understanding of the major issues that contribute to the performance overhead. That would help consider the fixes and alternatives. src/java.base/share/classes/java/lang/constant/MethodTypeDesc.java line 99: > 97: */ > 98: static MethodTypeDesc of(ClassDesc returnDesc, ClassDesc... paramDescs) { > 99: if (paramDescs.length == 0) `paramDescs` could be null. src/java.base/share/classes/java/lang/constant/MethodTypeDesc.java line 205: > 203: */ > 204: default String descriptorString() { > 205: var sj = new StringJoiner("", "(", ")" + returnType().descriptorString()); `MethodTypeDescImpl` is the only class implementing `MethodTypeDesc` and implements `descriptorString()`. This default implementation is not needed. Should the implementation be moved to `MethodTypeDescImpl::descriptorString`? src/java.base/share/classes/java/lang/constant/MethodTypeDescImpl.java line 84: > 82: paramTypes = new ClassDesc[paramCount]; > 83: for (int i = 0; i < paramCount; i++) { > 84: paramTypes[i] = validateParameter(ClassDesc.ofDescriptor(types.get(i + 1))); It seems useful to have a static factory method to take a trusted copy of parameter types and it will validate the parameters before constructing `MethodTypeDescImpl` instance. Parameter validation in one single place. Several methods doing the validation can simply call this factory method and the code would be cleaner. `insertParameterTypes` can call it as well and overhead of re-validating existing parameter types isn't a big issue. test/jdk/java/lang/constant/MethodTypeDescTest.java line 64: > 62: assertEquals(r, MethodTypeDesc.of(r.returnType(), r.parameterList().stream().toArray(ClassDesc[]::new))); > 63: assertEquals(r, MethodTypeDesc.of(r.returnType(), IntStream.range(0, r.parameterCount()) > 64: .mapToObj(r::parameterType) this reformatting may be accidental. Please keep the original format. Same applies to other reformatted lines in this file. ------------- PR Review: https://git.openjdk.org/jdk/pull/13186#pullrequestreview-1463008651 PR Review Comment: https://git.openjdk.org/jdk/pull/13186#discussion_r1218356523 PR Review Comment: https://git.openjdk.org/jdk/pull/13186#discussion_r1218369052 PR Review Comment: https://git.openjdk.org/jdk/pull/13186#discussion_r1218377366 PR Review Comment: https://git.openjdk.org/jdk/pull/13186#discussion_r1218380489 From bpb at openjdk.org Mon Jun 5 18:17:37 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Mon, 5 Jun 2023 18:17:37 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v7] In-Reply-To: References: Message-ID: On Mon, 22 May 2023 07:27:00 GMT, Nagata-Haruhito wrote: >> I fixed File.listRoots description. >> * remove "the insertion or ejection of removable media" >> * change "available" to "existing" >> >> Please review this change. > > Nagata-Haruhito has updated the pull request incrementally with one additional commit since the last revision: > > Move SecurityException paragraph src/java.base/share/classes/java/io/File.java line 1821: > 1819: * root directories of the available filesystem roots. It is guaranteed > 1820: * that the canonical pathname of any file physically present on the local > 1821: * machine will begin with one of the roots returned by this method. @Nagata-Haruhito Per @AlanBateman 's suggestion, would you please add this sentence ?There is no guarantee that the root directory can be accessed? or the equivalent here after ?returned by this method? and after the sentence that begins with ?A file system ...? in the specification of `java.nio.file.FileSystem::getRootDirectories` and so update this PR? Thanks. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13526#discussion_r1218417925 From darcy at openjdk.org Mon Jun 5 18:17:53 2023 From: darcy at openjdk.org (Joe Darcy) Date: Mon, 5 Jun 2023 18:17:53 GMT Subject: RFR: JDK-8295071: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number [v2] In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 06:05:14 GMT, Alan Bateman wrote: >> 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-8295071 >> - JDK-8309415: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number > > src/java.base/share/classes/java/lang/System.java line 758: > >> 756: * Greatest Java class file format version recognized by the runtime as {@code "MAJOR.MINOR"} >> 757: * where {@link java.lang.reflect.ClassFileFormatVersion#major() MAJOR} and {@code MINOR} >> 758: * are both formatted as decimal integers > > I'm not sure about using the adjective "Greatest" here, only because "Greatest ... recognized" reads a bit like recognition of greatness when it really wants to convey that it's the highest version recognized. > > Does the wording need to take account of running with preview features enabled? > > The table uses "Java runtime" rather than "runtime" in the description of some of the other properties. > > In passing, should the descriptions of RELEASE_xxx in ClassFileFormatVersion say "The highest version recognized" rather than the "The version recognized"? Update PR and CSR to use the wording: "Latest Java class file format version recognized by the Java runtime as "MAJOR.MINOR" where MAJOR and MINOR are both formatted as decimal integers" While it wouldn't be unreasonable to assume that when running under --enable-preview that the minor version was 65535, it is printed out as 0 with or without preview being enabled. I didn't want to broach preview-ness as part of this update to either promise or document the current behavior. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14305#discussion_r1218416628 From asotona at openjdk.org Mon Jun 5 18:23:52 2023 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 5 Jun 2023 18:23:52 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v6] In-Reply-To: References: Message-ID: > Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html > This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. > > Please review. > > Thanks, > Adam Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: - added missing javadoc - simplified options names ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14180/files - new: https://git.openjdk.org/jdk/pull/14180/files/965dcba8..9c20d929 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=05 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=04-05 Stats: 81 lines in 20 files changed: 13 ins; 5 del; 63 mod Patch: https://git.openjdk.org/jdk/pull/14180.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14180/head:pull/14180 PR: https://git.openjdk.org/jdk/pull/14180 From asotona at openjdk.org Mon Jun 5 18:23:58 2023 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 5 Jun 2023 18:23:58 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v5] In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 15:14:35 GMT, Brian Goetz wrote: >> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: >> >> fixed copyright header > > src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 50: > >> 48: /** >> 49: * Main entry points for parsing, transforming, and generating classfiles. >> 50: */ > > Now that this is not just a bag of static methods any more, we need to have some spec text about what a Classfile is. Something like: > > Represents a context for parsing, transforming, and generating classfiles. A `Classfile` has a set of options that condition how parsing and generation is done. Fixed, thanks. > src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 54: > >> 52: permits ClassfileImpl { >> 53: >> 54: static Classfile of() { > > Classfile::of needs specification Fixed, thanks. > src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 63: > >> 61: >> 62: Classfile withOptions(Option... options); >> 63: > > Classfile::withOptions needs specification Fixed, thanks. > src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 66: > >> 64: /** >> 65: * An option that affects the writing of classfiles. >> 66: */ > > Options affect parsing as well as writing now Fixed, thanks. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1218431266 PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1218431345 PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1218431300 PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1218431386 From asotona at openjdk.org Mon Jun 5 18:30:23 2023 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 5 Jun 2023 18:30:23 GMT Subject: Integrated: 8308842: Consolidate exceptions thrown from Class-File API In-Reply-To: References: Message-ID: On Thu, 25 May 2023 08:29:37 GMT, Adam Sotona wrote: > Class-File API actually throws wide variety of exceptions based on the actual situation. Complete error handling code must cover `IndexOutOfBoundsException`, `IllegalStateException` and `IllegalArgumentException`. > > Based on previous discussions we decided to consolidate on `IllegalArgumentException` with possible sub-classes. > > It allows easy common error handling in majority of use case, however it allows also to distinguish source of the error when needed (for example `javap` needs to know if the exception comes from constant poll or not). > > Newly introduced `ConstantPoolException` extends `IllegalArgumentException` to indicate the source of the problem is in constant pool. > > Please review. > > Thanks, > Adam This pull request has now been integrated. Changeset: 4b8922f5 Author: Adam Sotona URL: https://git.openjdk.org/jdk/commit/4b8922f57611d06a9bea5c94e2f4493dc42a2053 Stats: 154 lines in 15 files changed: 90 ins; 7 del; 57 mod 8308842: Consolidate exceptions thrown from Class-File API Reviewed-by: briangoetz ------------- PR: https://git.openjdk.org/jdk/pull/14143 From jlaskey at openjdk.org Mon Jun 5 18:48:56 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Mon, 5 Jun 2023 18:48:56 GMT Subject: Integrated: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) In-Reply-To: References: Message-ID: On Thu, 27 Apr 2023 12:38:11 GMT, Jim Laskey wrote: > Add flexible main methods and anonymous main classes to the Java language. This pull request has now been integrated. Changeset: 98b53c06 Author: Jim Laskey URL: https://git.openjdk.org/jdk/commit/98b53c06cfffe7b2e21968546b4aa1523f31132e Stats: 1685 lines in 40 files changed: 1510 ins; 32 del; 143 mod 8306112: Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) 8308613: javax.lang.model updates for JEP 445 (preview) 8308913: Update core reflection for JEP 445 (preview) Co-authored-by: Maurizio Cimadamore Co-authored-by: Joe Darcy Co-authored-by: Jan Lahoda Co-authored-by: Jim Laskey Co-authored-by: Adam Sotona Reviewed-by: mcimadamore, vromero, darcy ------------- PR: https://git.openjdk.org/jdk/pull/13689 From dl at openjdk.org Mon Jun 5 18:58:58 2023 From: dl at openjdk.org (Doug Lea) Date: Mon, 5 Jun 2023 18:58:58 GMT Subject: RFR: 8301341: LinkedTransferQueue does not respect timeout for poll() Message-ID: This now uses Thread.isVirtual to distinguish spin vs immediate block cases, enabling re-introduction of spin control from the previous version, removing anomalies like this one. ------------- Commit messages: - Use Thread.isVirtual to distinguish spin vs immediate block cases Changes: https://git.openjdk.org/jdk/pull/14317/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14317&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8301341 Stats: 131 lines in 1 file changed: 73 ins; 28 del; 30 mod Patch: https://git.openjdk.org/jdk/pull/14317.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14317/head:pull/14317 PR: https://git.openjdk.org/jdk/pull/14317 From asotona at openjdk.org Mon Jun 5 18:59:07 2023 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 5 Jun 2023 18:59:07 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v7] In-Reply-To: References: Message-ID: > Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html > This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. > > Please review. > > Thanks, > 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 27 commits: - Merge branch 'master' into JDK-8308899-context # Conflicts: # src/java.base/share/classes/jdk/internal/classfile/Classfile.java # src/java.base/share/classes/jdk/internal/classfile/impl/DirectCodeBuilder.java # test/jdk/jdk/classfile/DiscontinuedInstructionsTest.java # test/jdk/jdk/classfile/FilterDeadLabelsTest.java # test/jdk/jdk/classfile/ShortJumpsFixTest.java # test/jdk/jdk/classfile/StackMapsTest.java - added missing javadoc - simplified options names - fixed copyright header - Merge branch 'master' into JDK-8308899-context - fixed StackMapGenerator::generatorError and removed obsolete SplitConstantPool clone constructor - Merge branch 'master' into JDK-8308899-context - fixed benchmarks - fixed snippets and added SnippetsTest - fixed javadoc - ... and 17 more: https://git.openjdk.org/jdk/compare/4b8922f5...0c3c1913 ------------- Changes: https://git.openjdk.org/jdk/pull/14180/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=06 Stats: 1603 lines in 106 files changed: 491 ins; 212 del; 900 mod Patch: https://git.openjdk.org/jdk/pull/14180.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14180/head:pull/14180 PR: https://git.openjdk.org/jdk/pull/14180 From never at openjdk.org Mon Jun 5 19:01:23 2023 From: never at openjdk.org (Tom Rodriguez) Date: Mon, 5 Jun 2023 19:01:23 GMT Subject: RFR: 8309390: [JVMCI] improve copying system properties into libgraal In-Reply-To: <9bsjzlbHK31VVyGwzyhpSBjSILWFxmAX0IfiWK6Wb_w=.197d2b45-dba5-43bc-ac4e-4f993d3e777a@github.com> References: <9bsjzlbHK31VVyGwzyhpSBjSILWFxmAX0IfiWK6Wb_w=.197d2b45-dba5-43bc-ac4e-4f993d3e777a@github.com> Message-ID: <1vHZFp-j2AKjYTX2bd_1RxQ2Ix252OCbqJ0m-AGaVTs=.b64ea885-8b22-45ad-8a76-b041a764a5de@github.com> On Fri, 2 Jun 2023 20:32:14 GMT, Doug Simon wrote: > This PR improves the startup time for libgraal by speeding up how `VM.savedProps` is copied into libgraal. This data structure is now serialized to a native buffer directly from C++ and the native buffer is then directly decoded by libgraal. > > ## Times > > The basic benchmarking below shows that this change brings the time for a nop Java app with eager libgraal initialization (2) down to almost the same time as lazy libgraal initialization (1). The latter typically means no libgraal initialization happens as a top tier JIT compilation is never scheduled in such a short running app. > > > public class Nop { > public static void main(String[] args) {} > } > > > (1) Baseline (no options): > >> for i in (seq 10); java Nop; end > 0.05 real 0.04 user 0.01 sys > 0.04 real 0.03 user 0.01 sys > 0.04 real 0.03 user 0.01 sys > 0.04 real 0.03 user 0.01 sys > 0.03 real 0.03 user 0.00 sys > 0.04 real 0.03 user 0.01 sys > 0.04 real 0.03 user 0.00 sys > 0.03 real 0.03 user 0.00 sys > 0.04 real 0.03 user 0.01 sys > 0.03 real 0.03 user 0.00 sys > > > (2) Eagerly initialize libgraal (with PR): > >> for i in (seq 10); /usr/bin/time java -XX:+EagerJVMCI Nop; end > 0.06 real 0.04 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > > > (3) Eagerly initialize libgraal (without PR): > >> for i in (seq 10); /usr/bin/time java -XX:+EagerJVMCI Nop; end > 0.11 real 0.08 user 0.02 sys > 0.08 real 0.06 user 0.01 sys > 0.08 real 0.07 user 0.01 sys > 0.10 real 0.07 user 0.01 sys > 0.08 real 0.06 user 0.01 sys > 0.10 real 0.07 user 0.01 sys > 0.08 real 0.07 user 0.01 sys > 0.08 real 0.07 user 0.01 sys > 0.08 real ... I don't really love the hard code parsing of the HashMap. What properties are actually required for JVMCI? It seems to me that the contents of Arguments::system_properties() should contain all the properties we want to advertise to JVMCI. That would have avoid having to decode them after they've been converted into Java objects. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14291#issuecomment-1577305531 From never at openjdk.org Mon Jun 5 19:20:25 2023 From: never at openjdk.org (Tom Rodriguez) Date: Mon, 5 Jun 2023 19:20:25 GMT Subject: RFR: 8309501: Remove workaround in bin/idea.sh for non standard JVMCI file layout Message-ID: <7xLLhe3TF96ZnkpiOiAm6Km8T3mV1sd26SPHGTPBp7I=.8b884a99-aeae-47f6-b211-b5fc4ca11a8e@github.com> This allows bin/idea.sh to properly see the JVMCI files again. ------------- Commit messages: - 8309501: Remove workaround in bin/idea.sh for non standard JVMCI file layout Changes: https://git.openjdk.org/jdk/pull/14318/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14318&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309501 Stats: 12 lines in 1 file changed: 0 ins; 10 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/14318.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14318/head:pull/14318 PR: https://git.openjdk.org/jdk/pull/14318 From mchung at openjdk.org Mon Jun 5 19:41:04 2023 From: mchung at openjdk.org (Mandy Chung) Date: Mon, 5 Jun 2023 19:41:04 GMT Subject: RFR: 8301721: lookup.findSpecial fails on Object method call from interface Message-ID: Lookup.findSpecial fails on Object method call from an interface because of a bug in the implementation calling `Class::getSuperclass` on an interface which has no superclass. The implementation should only search the method from its superclass only if it's a class. This patch is trivial and skip the superclass search if it's an interface. ------------- Commit messages: - clean up test - Merge branch 'master' of https://github.com/openjdk/jdk into JDK-8301721 - 8301721: lookup.findSpecial fails on Object method call from interface Changes: https://git.openjdk.org/jdk/pull/14319/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14319&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8301721 Stats: 80 lines in 2 files changed: 79 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14319.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14319/head:pull/14319 PR: https://git.openjdk.org/jdk/pull/14319 From alanb at openjdk.org Mon Jun 5 19:46:53 2023 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 5 Jun 2023 19:46:53 GMT Subject: RFR: 8309408: Thread.sleep cleanup In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 17:25:43 GMT, Aleksey Shipilev wrote: > I think we need to delay this until [JDK-8309361](https://bugs.openjdk.org/browse/JDK-8309361) is resolved, in case we would like to revert [JDK-8305092](https://bugs.openjdk.org/browse/JDK-8305092). Okay, I won't integrate this until we see what the issue is. That said, if the sub-mills support needs to be reverted then I think we should keep the interface as nanos on the bound between the VM and the libraries. The reason is that it's mostly nanos at the Java level now, meaning 2 out of the 3 sleep methods support sub-mills, and the virtual thread sleep and the JFR event are in nanos too. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14303#issuecomment-1577374410 From dnsimon at openjdk.org Mon Jun 5 19:58:58 2023 From: dnsimon at openjdk.org (Doug Simon) Date: Mon, 5 Jun 2023 19:58:58 GMT Subject: RFR: 8309501: Remove workaround in bin/idea.sh for non standard JVMCI file layout In-Reply-To: <7xLLhe3TF96ZnkpiOiAm6Km8T3mV1sd26SPHGTPBp7I=.8b884a99-aeae-47f6-b211-b5fc4ca11a8e@github.com> References: <7xLLhe3TF96ZnkpiOiAm6Km8T3mV1sd26SPHGTPBp7I=.8b884a99-aeae-47f6-b211-b5fc4ca11a8e@github.com> Message-ID: <0Gk3T7xF9-LaTG7tpYdH3oa-hb8OKXw4jIkTb9DtIT4=.06bc15b6-4503-456a-bcb9-bb913d7e2ea1@github.com> On Mon, 5 Jun 2023 19:12:52 GMT, Tom Rodriguez wrote: > This allows bin/idea.sh to properly see the JVMCI files again. Marked as reviewed by dnsimon (Committer). Finally ;-) ------------- PR Review: https://git.openjdk.org/jdk/pull/14318#pullrequestreview-1463296723 PR Comment: https://git.openjdk.org/jdk/pull/14318#issuecomment-1577386454 From cjplummer at openjdk.org Mon Jun 5 20:10:54 2023 From: cjplummer at openjdk.org (Chris Plummer) Date: Mon, 5 Jun 2023 20:10:54 GMT Subject: RFR: 8309408: Thread.sleep cleanup In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 15:10:18 GMT, Alan Bateman wrote: >> test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.java line 660: >> >>> 658: expectedMethods.add(Thread.class.getName() + ".sleep"); >>> 659: expectedMethods.add(Thread.class.getName() + ".sleepNanos"); >>> 660: expectedMethods.add(Thread.class.getName() + ".sleepNanos0"); >> >> I'm surprised this test doesn't list `beforeSleep` and `afterSleep`. > >> There is one potential, pre-existing, test omission noted below. >> I'm surprised this test doesn't list `beforeSleep` and `afterSleep`. > > The monitoring/stress/thread tests will fail if they observe an unexpected method name in the stack trace. I don't think it can happen because the tests poll the thread state and for SleepingThread, it will sample the stack trace when the thread state is timed-wait. The beforeSleep/afterSleep methods won't in the stack trace when sleeping. It would be harmless to add them in that they aren't going to cause these tests to fail but might help with any further changes. The following commit in loom heavily modified this file with a lot of added expected methods. There are other related tests with similar changes. I'm not so sure I understand the need for so many additions, and also why expectedLength is so out of sync with the number of added method. I don't believe this commit was reviewed individually, but was just part of the overall loom review when merge into jdk. Perhaps it should be revisited. https://github.com/openjdk/loom/commit/26e66bc1a6a0dd735c8138a696809caba3e82b26 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14303#discussion_r1218539693 From mchung at openjdk.org Mon Jun 5 20:11:56 2023 From: mchung at openjdk.org (Mandy Chung) Date: Mon, 5 Jun 2023 20:11:56 GMT Subject: RFR: 8306647: Implementation of Structured Concurrency (Preview) [v4] In-Reply-To: References: <6gZZEoP1WXdBcZUiL5890eNsgaRFzZNY_rBItZdXtNc=.5d8f7bd9-44d5-4074-8a5c-35f8203263b2@github.com> Message-ID: On Thu, 1 Jun 2023 13:43:33 GMT, Alan Bateman wrote: >> This is the implementation of: >> >> - JEP 453: Structured Concurrency (Preview) >> - JEP 446: Scoped Values (Preview) >> >> For the most part, this is just moving code and tests. StructuredTaskScope moves to j.u.concurrent as a preview API, ScopedValue moves to j.lang as a preview API, and module jdk.incubator.concurrent has been removed. The significant API changes since incubator are: >> >> - StructuredTaskScope.fork returns Subtask instead of Future (JEP 453 has a section on this) >> - ScopedValue.where methods are replaced with runWhere, callWhere and getWhere > > Alan Bateman has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 15 commits: > > - Sync up from loom repo > - Merge > - Sync with loom repo, re-work ScopedValue class description > - Sync up from loom repo > - Remove csm.Threads > - Merge > - Test should not be in update for main line > - Sync with loom repo > - Sync up tests frmo loom repo > - Sync up with loom repo > - ... and 5 more: https://git.openjdk.org/jdk/compare/a46b5acc...cc902ce6 I reviewed the implementation changes to promote an incubating API to a preview API. That part looks good. ------------- Marked as reviewed by mchung (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/13932#pullrequestreview-1463317525 From erikj at openjdk.org Mon Jun 5 20:14:51 2023 From: erikj at openjdk.org (Erik Joelsson) Date: Mon, 5 Jun 2023 20:14:51 GMT Subject: RFR: 8309501: Remove workaround in bin/idea.sh for non standard JVMCI file layout In-Reply-To: <7xLLhe3TF96ZnkpiOiAm6Km8T3mV1sd26SPHGTPBp7I=.8b884a99-aeae-47f6-b211-b5fc4ca11a8e@github.com> References: <7xLLhe3TF96ZnkpiOiAm6Km8T3mV1sd26SPHGTPBp7I=.8b884a99-aeae-47f6-b211-b5fc4ca11a8e@github.com> Message-ID: On Mon, 5 Jun 2023 19:12:52 GMT, Tom Rodriguez wrote: > This allows bin/idea.sh to properly see the JVMCI files again. Marked as reviewed by erikj (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14318#pullrequestreview-1463324474 From darcy at openjdk.org Mon Jun 5 20:19:07 2023 From: darcy at openjdk.org (Joe Darcy) Date: Mon, 5 Jun 2023 20:19:07 GMT Subject: RFR: JDK-8308913: Update core reflection for JEP 445 (preview) [v4] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 04:48:35 GMT, Joe Darcy wrote: >> Explain in java.lang.Class how unnamed classes are modeled in core reflection. > > Joe Darcy has updated the pull request incrementally with one additional commit since the last revision: > > Update reflective support. The changes for JDK-8308913 were integrated as part of the main JEP 445 PR; closing this. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14165#issuecomment-1577416694 From darcy at openjdk.org Mon Jun 5 20:19:09 2023 From: darcy at openjdk.org (Joe Darcy) Date: Mon, 5 Jun 2023 20:19:09 GMT Subject: Withdrawn: JDK-8308913: Update core reflection for JEP 445 (preview) In-Reply-To: References: Message-ID: <0x4tHZLix1QJgmih0k2gHKDNXDJcyKNsjsqheKpRXZ4=.dde59617-56c8-44cc-b73b-c9e4c6e8a8f9@github.com> On Fri, 26 May 2023 02:06:55 GMT, Joe Darcy wrote: > Explain in java.lang.Class how unnamed classes are modeled in core reflection. This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/jdk/pull/14165 From duke at openjdk.org Mon Jun 5 21:04:10 2023 From: duke at openjdk.org (ExE Boss) Date: Mon, 5 Jun 2023 21:04:10 GMT Subject: RFR: 8291966: SwitchBootstrap.typeSwitch could be faster [v3] In-Reply-To: References: Message-ID: On Wed, 31 May 2023 14:05:56 GMT, Jan Lahoda wrote: >> Jan Lahoda has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains six commits: >> >> - Reflecting review feedback. >> - Merge branch 'master' into JDK-8291966 >> - Adding comments >> - Improving performance >> - Merge branch 'master' into JDK-8291966 >> - 8291966: SwitchBootstrap.typeSwitch could be faster > > This patch is intended to eliminate some consecutive unnecessary tests like in case like: > > switch (o) { > case Runnable r when ... -> {} > case Runnable r when ... -> {} > case Runnable r when ... -> {} > case Object o -> {} > } > > > If `o` is not a `Runnable`, the `instanceof` will only happen for the first case, and the rest will be skipped, as these tests could not pass. But (as a current limitation), if it is not a consecutive run, the duplicate `instanceof` checks will still happen. > > I am quite sure there are ways to improve the bootstrap further, but might be better to have some (more) real-world examples to know what to optimize for. @lahodaj > This patch is intended to eliminate some consecutive unnecessary tests like in case like: > > ```java > switch (o) { > case Runnable r when ... -> {} > case Runnable r when ... -> {} > case Runnable r when ... -> {} > case Object o -> {} > } > ``` I would expect that the above code would produce bytecode equivalent to: loop: for (int _i = 0;;) { switch (invokedynamic typeSwitch(o, _i) { Runnable.class, Object.class }) { case 0 /* Runnable */ -> { _i++; Runnable r = (Runnable) o; if (...) { break loop; } else if (...) { break loop; } else if (...) { break loop; } continue loop; } case 1 /* Object */ -> { _i++; break loop; } case -1 -> throw new NullPointerException(); default -> throw new MatchException(); } } ------------- PR Comment: https://git.openjdk.org/jdk/pull/9779#issuecomment-1577468813 From darcy at openjdk.org Mon Jun 5 21:14:46 2023 From: darcy at openjdk.org (Joe Darcy) Date: Mon, 5 Jun 2023 21:14:46 GMT Subject: RFR: JDK-8295071: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number [v3] In-Reply-To: References: Message-ID: > Document existing behavior. > > Please also review the CSR https://bugs.openjdk.org/browse/JDK-8309415 Joe Darcy has updated the pull request incrementally with one additional commit since the last revision: Respond to review feedback. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14305/files - new: https://git.openjdk.org/jdk/pull/14305/files/5c7e4172..33bb646b Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14305&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14305&range=01-02 Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14305.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14305/head:pull/14305 PR: https://git.openjdk.org/jdk/pull/14305 From mchung at openjdk.org Mon Jun 5 21:36:52 2023 From: mchung at openjdk.org (Mandy Chung) Date: Mon, 5 Jun 2023 21:36:52 GMT Subject: RFR: JDK-8295071: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number [v3] In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 18:02:34 GMT, Joe Darcy wrote: >> src/java.base/share/classes/java/lang/System.java line 758: >> >>> 756: * Greatest Java class file format version recognized by the runtime as {@code "MAJOR.MINOR"} >>> 757: * where {@link java.lang.reflect.ClassFileFormatVersion#major() MAJOR} and {@code MINOR} >>> 758: * are both formatted as decimal integers >> >> I'm not sure about using the adjective "Greatest" here, only because "Greatest ... recognized" reads a bit like recognition of greatness when it really wants to convey that it's the highest version recognized. >> >> Does the wording need to take account of running with preview features enabled? >> >> The table uses "Java runtime" rather than "runtime" in the description of some of the other properties. >> >> In passing, should the descriptions of RELEASE_xxx in ClassFileFormatVersion say "The highest version recognized" rather than the "The version recognized"? > > Update PR and CSR to use the wording: > > "Latest Java class file format version recognized by the Java runtime as "MAJOR.MINOR" where MAJOR and MINOR are both formatted as decimal integers" > > While it wouldn't be unreasonable to assume that when running under --enable-preview that the minor version was 65535, it is printed out as 0 with or without preview being enabled. > > I didn't want to broach preview-ness as part of this update to either promise or document the current behavior. Related to Alan's comment on RELEASE_xxx in ClassFileFormatVersion, perhaps the class description can clarify that a class file version has major version number `M` and minor version number `m` and a Java Virtual Machine implementation can support a class file format of version v if and only if v lies in some contiguous range Mi.0 ? v ? Mj.m. RELEASE_xxx represents the major version number. That way, the description of RELEASE_xxx can remain to say "The version recognized...". ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14305#discussion_r1218619362 From iris at openjdk.org Mon Jun 5 21:42:55 2023 From: iris at openjdk.org (Iris Clark) Date: Mon, 5 Jun 2023 21:42:55 GMT Subject: RFR: JDK-8295071: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number [v3] In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 21:14:46 GMT, Joe Darcy wrote: >> Document existing behavior. >> >> Please also review the CSR https://bugs.openjdk.org/browse/JDK-8309415 > > Joe Darcy has updated the pull request incrementally with one additional commit since the last revision: > > Respond to review feedback. Marked as reviewed by iris (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14305#pullrequestreview-1463528177 From iris at openjdk.org Mon Jun 5 21:42:56 2023 From: iris at openjdk.org (Iris Clark) Date: Mon, 5 Jun 2023 21:42:56 GMT Subject: RFR: JDK-8295071: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number [v3] In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 21:34:04 GMT, Mandy Chung wrote: >> Update PR and CSR to use the wording: >> >> "Latest Java class file format version recognized by the Java runtime as "MAJOR.MINOR" where MAJOR and MINOR are both formatted as decimal integers" >> >> While it wouldn't be unreasonable to assume that when running under --enable-preview that the minor version was 65535, it is printed out as 0 with or without preview being enabled. >> >> I didn't want to broach preview-ness as part of this update to either promise or document the current behavior. > > Related to Alan's comment on RELEASE_xxx in ClassFileFormatVersion, perhaps the class description can clarify that a class file version has major version number `M` and minor version number `m` and a Java Virtual Machine implementation can support a class file format of version v if and only if v lies in some contiguous range Mi.0 ? v ? Mj.m. RELEASE_xxx represents the major version number. > > That way, the description of RELEASE_xxx can remain to say "The version recognized...". The decimal integer should be unsigned and without leading zeros. A regex similar to that provided by Runtime.Version would make things clear. I think that Mandy's suggestion would be a reasonable alternative as the Java class file version number isn't truly arbitrary. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14305#discussion_r1218623501 From naoto at openjdk.org Mon Jun 5 21:50:56 2023 From: naoto at openjdk.org (Naoto Sato) Date: Mon, 5 Jun 2023 21:50:56 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v3] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 01:07:27 GMT, SUN Guoyun wrote: >> SUN Guoyun has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision: >> >> 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared > > src/java.base/share/classes/sun/util/locale/BaseLocale.java line 369: > >> 367: BaseLocale l = key.holder; >> 368: BaseLocale locale = new BaseLocale(l.getLanguage(), l.getScript(), l.getRegion(), l.getVariant(), true); >> 369: return (new Key(locale)).getBaseLocale(); > > Perhaps a more rigorous approach would look like this? >
    
    > BaseLocale locale = new BaseLocale(l.getLanguage(), l.getScript(), l.getRegion(), l.getVariant(), true);
    > BaseLocal value = (new Key(locale)).getBaseLocale();
    > Reference.reachabilityFence(locale);
    > return value;
    > 
    > But the current patch has passed the tests with `-XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot`, so I think the current patch is OK. I still don't see a clear explanation of how the proposed patch fixes the problem. Also, I would appreciate the reasoning in the comments. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14211#discussion_r1218629550 From bchristi at openjdk.org Mon Jun 5 22:03:55 2023 From: bchristi at openjdk.org (Brent Christian) Date: Mon, 5 Jun 2023 22:03:55 GMT Subject: RFR: 8308167: SequencedMap::firstEntry throws NPE when first entry has null key or value In-Reply-To: <4oXToDIsaO3U3IzQqHeqccp2c6C2ZgeqLsldzqrHyiQ=.21611d5d-2941-4b99-9883-b6e0b8e2db3b@github.com> References: <4oXToDIsaO3U3IzQqHeqccp2c6C2ZgeqLsldzqrHyiQ=.21611d5d-2941-4b99-9883-b6e0b8e2db3b@github.com> Message-ID: On Fri, 2 Jun 2023 01:12:32 GMT, Stuart Marks wrote: > Create and use new NullableKeyValueHolder class to accommodate map entries whose key or value might be null. Changes look good. An observation: `TreeMap` implements `SequencedMap`, and I see that its `firstEntry()` and related methods use `AbstractMap.SimpleImmutableEntry` (via `exportEntry()`), despite it being serializable. However, this is long-standing code (from 1.6, perhaps?), and `TreeMap` is itself serializable. So, leaving it as is seems the right thing to do. src/java.base/share/classes/jdk/internal/util/NullableKeyValueHolder.java line 65: > 63: * Map.of might still need to reject nulls, and so would Map.ofEntries) but allowing > 64: * a Map.Entry itself to contain nulls seems beneficial in general. If this is done, > 65: * merging KeyValueHolder and NullableKeyValueHolder should be reconsidered. I think having this background and explanation in the docs for this internal class is fine. IMO, this information would also be useful to have in the bug report. ------------- Marked as reviewed by bchristi (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14278#pullrequestreview-1463441861 PR Review Comment: https://git.openjdk.org/jdk/pull/14278#discussion_r1218591121 From liach at openjdk.org Mon Jun 5 22:36:53 2023 From: liach at openjdk.org (Chen Liang) Date: Mon, 5 Jun 2023 22:36:53 GMT Subject: RFR: 8309413: General improvements to MethodTypeDesc implementation [v5] In-Reply-To: <7QpluTpgWuXPhJixDBTovoZsOsQAVUUmd8LJ4q9L8Kg=.65b21779-218e-4e16-b69a-3bff366c42a5@github.com> References: <7QpluTpgWuXPhJixDBTovoZsOsQAVUUmd8LJ4q9L8Kg=.65b21779-218e-4e16-b69a-3bff366c42a5@github.com> Message-ID: On Mon, 5 Jun 2023 17:27:19 GMT, Mandy Chung wrote: >> Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits: >> >> - Forgot to upload latest micro >> - general optimizations to MTD, no longer change backing storage > > src/java.base/share/classes/java/lang/constant/MethodTypeDescImpl.java line 84: > >> 82: paramTypes = new ClassDesc[paramCount]; >> 83: for (int i = 0; i < paramCount; i++) { >> 84: paramTypes[i] = validateParameter(ClassDesc.ofDescriptor(types.get(i + 1))); > > It seems useful to have a static factory method to take a trusted copy of parameter types and it will validate the parameters before constructing `MethodTypeDescImpl` instance. Parameter validation in one single place. Several methods doing the validation can simply call this factory method and the code would be cleaner. > > `insertParameterTypes` can call it as well and overhead of re-validating existing parameter types isn't a big issue. Should I just keep track of the slot count of MethodTypeDesc instead? Having a slot count implicitly requires validating the parameters, and the slot count can be used to eagerly reject `resolveConstantDesc` on MTD with over 255 slots. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13186#discussion_r1218664978 From mchung at openjdk.org Mon Jun 5 23:06:53 2023 From: mchung at openjdk.org (Mandy Chung) Date: Mon, 5 Jun 2023 23:06:53 GMT Subject: RFR: 8309413: General improvements to MethodTypeDesc implementation [v5] In-Reply-To: References: <7QpluTpgWuXPhJixDBTovoZsOsQAVUUmd8LJ4q9L8Kg=.65b21779-218e-4e16-b69a-3bff366c42a5@github.com> Message-ID: On Mon, 5 Jun 2023 22:34:23 GMT, Chen Liang wrote: >> src/java.base/share/classes/java/lang/constant/MethodTypeDescImpl.java line 84: >> >>> 82: paramTypes = new ClassDesc[paramCount]; >>> 83: for (int i = 0; i < paramCount; i++) { >>> 84: paramTypes[i] = validateParameter(ClassDesc.ofDescriptor(types.get(i + 1))); >> >> It seems useful to have a static factory method to take a trusted copy of parameter types and it will validate the parameters before constructing `MethodTypeDescImpl` instance. Parameter validation in one single place. Several methods doing the validation can simply call this factory method and the code would be cleaner. >> >> `insertParameterTypes` can call it as well and overhead of re-validating existing parameter types isn't a big issue. > > Should I just keep track of the slot count of MethodTypeDesc instead? Having a slot count implicitly requires validating the parameters, and the slot count can be used to eagerly reject `resolveConstantDesc` on MTD with over 255 slots. I don't think `resolveConstantDesc` is performance-sensitive that needs the eager checking of the number of parameter slots. Also the common case is to resolve a good MethodType with <= 255 parameter slots. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13186#discussion_r1218681876 From liach at openjdk.org Mon Jun 5 23:38:11 2023 From: liach at openjdk.org (Chen Liang) Date: Mon, 5 Jun 2023 23:38:11 GMT Subject: RFR: 8309413: General improvements to MethodTypeDesc implementation [v6] In-Reply-To: References: Message-ID: <7Fdmlm1dPVZvr0ZVDtdqLS12AYtOJrG0qGOYdpy4Fzk=.2ee01753-e3e6-4879-8f66-9e81b4e2b7d8@github.com> > This patch aims to improve the performance of MethodTypeDesc in general, as it is currently a performance bottleneck in the Classfile API. A previous revision changed the parameter storage from an array to a list; this is dropped now. Sorry for the force push. > > > Benchmark (descString) Mode Cnt Score Error Units > MethodTypeDescFactories.descriptorString (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 27.778 ? 0.573 ns/op > MethodTypeDescFactories.descriptorString ()V avgt 6 13.343 ? 0.235 ns/op > MethodTypeDescFactories.descriptorString ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 40.828 ? 0.448 ns/op > MethodTypeDescFactories.descriptorString ()[Ljava/lang/String; avgt 6 14.754 ? 0.162 ns/op > MethodTypeDescFactories.ofArray (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 8.616 ? 0.132 ns/op > MethodTypeDescFactories.ofArray ()V avgt 6 2.146 ? 0.293 ns/op > MethodTypeDescFactories.ofArray ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 14.595 ? 0.235 ns/op > MethodTypeDescFactories.ofArray ()[Ljava/lang/String; avgt 6 2.064 ? 0.085 ns/op > MethodTypeDescFactories.ofDescriptor (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 97.077 ? 2.482 ns/op > MethodTypeDescFactories.ofDescriptor ()V avgt 6 13.563 ? 0.111 ns/op > MethodTypeDescFactories.ofDescriptor ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 130.543 ? 2.847 ns/op > MethodTypeDescFactories.ofDescriptor ()[Ljava/lang/String; avgt 6 35.286 ? 0.260 ns/op > MethodTypeDescFactories.ofList (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 4.156 ? 0.258 ns/op > MethodTypeDescFactories.ofList ()V avgt 6 2.192 ? 0.063 ns/op > MethodTypeDescFactories.ofList ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 41.002 ? 0.235 ns/op > MethodTypeDescFactories.ofList ()[Ljava/lang/String; avgt 6 2.200 ? 0.041 ns/op Chen Liang has updated the pull request incrementally with one additional commit since the last revision: Fixes for review ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13186/files - new: https://git.openjdk.org/jdk/pull/13186/files/f71c0fab..6d47e9bf Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13186&range=05 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13186&range=04-05 Stats: 84 lines in 6 files changed: 22 ins; 21 del; 41 mod Patch: https://git.openjdk.org/jdk/pull/13186.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13186/head:pull/13186 PR: https://git.openjdk.org/jdk/pull/13186 From liach at openjdk.org Mon Jun 5 23:38:12 2023 From: liach at openjdk.org (Chen Liang) Date: Mon, 5 Jun 2023 23:38:12 GMT Subject: RFR: 8309413: General improvements to MethodTypeDesc implementation [v5] In-Reply-To: References: Message-ID: <77iNBjcSyZDhdgJBQXwMEz3B9cMVKjRQtDHQWFgLsv0=.a4c37a2e-5262-45cf-89eb-366aa3683aae@github.com> On Sun, 4 Jun 2023 23:52:37 GMT, Chen Liang wrote: >> This patch aims to improve the performance of MethodTypeDesc in general, as it is currently a performance bottleneck in the Classfile API. A previous revision changed the parameter storage from an array to a list; this is dropped now. Sorry for the force push. >> >> >> Benchmark (descString) Mode Cnt Score Error Units >> MethodTypeDescFactories.descriptorString (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 27.778 ? 0.573 ns/op >> MethodTypeDescFactories.descriptorString ()V avgt 6 13.343 ? 0.235 ns/op >> MethodTypeDescFactories.descriptorString ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 40.828 ? 0.448 ns/op >> MethodTypeDescFactories.descriptorString ()[Ljava/lang/String; avgt 6 14.754 ? 0.162 ns/op >> MethodTypeDescFactories.ofArray (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 8.616 ? 0.132 ns/op >> MethodTypeDescFactories.ofArray ()V avgt 6 2.146 ? 0.293 ns/op >> MethodTypeDescFactories.ofArray ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 14.595 ? 0.235 ns/op >> MethodTypeDescFactories.ofArray ()[Ljava/lang/String; avgt 6 2.064 ? 0.085 ns/op >> MethodTypeDescFactories.ofDescriptor (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 97.077 ? 2.482 ns/op >> MethodTypeDescFactories.ofDescriptor ()V avgt 6 13.563 ? 0.111 ns/op >> MethodTypeDescFactories.ofDescriptor ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 130.543 ? 2.847 ns/op >> MethodTypeDescFactories.ofDescriptor ()[Ljava/lang/String; avgt 6 35.286 ? 0.260 ns/op >> MethodTypeDescFactories.ofList (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 4.156 ? 0.258 ns/op >> MethodTypeDescFactories.ofList ()V avgt 6 2.192 ? 0.063 ns/op >> MethodTypeDescFactories.ofList ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 41.002 ? 0.235 ns/op >> MethodTypeDescFactories.ofList ()[Ljava/lang/String; avgt 6 2.200 ? 0.041 ns/op > > Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits: > > - Forgot to upload latest micro > - general optimizations to MTD, no longer change backing storage I added an `ofTrusted` factory in MTD impl to validate a trusted parameter array. The name is intentionally chosen to distinguish from the regular `MethodTypeDesc.of` which accepts untrusted arrays. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13186#issuecomment-1577686771 From smarks at openjdk.org Tue Jun 6 00:23:08 2023 From: smarks at openjdk.org (Stuart Marks) Date: Tue, 6 Jun 2023 00:23:08 GMT Subject: Integrated: 8308167: SequencedMap::firstEntry throws NPE when first entry has null key or value In-Reply-To: <4oXToDIsaO3U3IzQqHeqccp2c6C2ZgeqLsldzqrHyiQ=.21611d5d-2941-4b99-9883-b6e0b8e2db3b@github.com> References: <4oXToDIsaO3U3IzQqHeqccp2c6C2ZgeqLsldzqrHyiQ=.21611d5d-2941-4b99-9883-b6e0b8e2db3b@github.com> Message-ID: On Fri, 2 Jun 2023 01:12:32 GMT, Stuart Marks wrote: > Create and use new NullableKeyValueHolder class to accommodate map entries whose key or value might be null. This pull request has now been integrated. Changeset: 6d155a47 Author: Stuart Marks URL: https://git.openjdk.org/jdk/commit/6d155a47f13ff80cf7a9de363fc5ae2943b6603a Stats: 214 lines in 4 files changed: 208 ins; 0 del; 6 mod 8308167: SequencedMap::firstEntry throws NPE when first entry has null key or value Reviewed-by: bchristi ------------- PR: https://git.openjdk.org/jdk/pull/14278 From smarks at openjdk.org Tue Jun 6 00:23:06 2023 From: smarks at openjdk.org (Stuart Marks) Date: Tue, 6 Jun 2023 00:23:06 GMT Subject: RFR: 8308167: SequencedMap::firstEntry throws NPE when first entry has null key or value In-Reply-To: References: <4oXToDIsaO3U3IzQqHeqccp2c6C2ZgeqLsldzqrHyiQ=.21611d5d-2941-4b99-9883-b6e0b8e2db3b@github.com> Message-ID: On Mon, 5 Jun 2023 21:03:18 GMT, Brent Christian wrote: >> Create and use new NullableKeyValueHolder class to accommodate map entries whose key or value might be null. > > src/java.base/share/classes/jdk/internal/util/NullableKeyValueHolder.java line 65: > >> 63: * Map.of might still need to reject nulls, and so would Map.ofEntries) but allowing >> 64: * a Map.Entry itself to contain nulls seems beneficial in general. If this is done, >> 65: * merging KeyValueHolder and NullableKeyValueHolder should be reconsidered. > > I think having this background and explanation in the docs for this internal class is fine. > IMO, this information would also be useful to have in the bug report. I'll add a note to the bug report pointing to this rationale. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14278#discussion_r1218735097 From smarks at openjdk.org Tue Jun 6 00:23:04 2023 From: smarks at openjdk.org (Stuart Marks) Date: Tue, 6 Jun 2023 00:23:04 GMT Subject: RFR: 8308167: SequencedMap::firstEntry throws NPE when first entry has null key or value In-Reply-To: <4oXToDIsaO3U3IzQqHeqccp2c6C2ZgeqLsldzqrHyiQ=.21611d5d-2941-4b99-9883-b6e0b8e2db3b@github.com> References: <4oXToDIsaO3U3IzQqHeqccp2c6C2ZgeqLsldzqrHyiQ=.21611d5d-2941-4b99-9883-b6e0b8e2db3b@github.com> Message-ID: On Fri, 2 Jun 2023 01:12:32 GMT, Stuart Marks wrote: > Create and use new NullableKeyValueHolder class to accommodate map entries whose key or value might be null. Thanks for looking at this. Yeah, the serializability of various Entry objects that are exposed through the APIs is all over the map, so to speak. Note that entries obtained from the entrySet() of HashMap and TreeMap are _not_ serializable. These are actual internal nodes of the respective Map implementations. But TreeMap uses AbstractMap.SimpleImmutableEntry in several places to disconnect the returned entry from the map, and that class is serializable. Oh well. (And yes that code dated back to the beginning of the available OpenJDK history, which puts it at JDK 1.6 or at least certainly before 7.) ------------- PR Comment: https://git.openjdk.org/jdk/pull/14278#issuecomment-1577719707 From mchung at openjdk.org Tue Jun 6 00:24:59 2023 From: mchung at openjdk.org (Mandy Chung) Date: Tue, 6 Jun 2023 00:24:59 GMT Subject: RFR: 8309413: General improvements to MethodTypeDesc implementation [v6] In-Reply-To: <7Fdmlm1dPVZvr0ZVDtdqLS12AYtOJrG0qGOYdpy4Fzk=.2ee01753-e3e6-4879-8f66-9e81b4e2b7d8@github.com> References: <7Fdmlm1dPVZvr0ZVDtdqLS12AYtOJrG0qGOYdpy4Fzk=.2ee01753-e3e6-4879-8f66-9e81b4e2b7d8@github.com> Message-ID: On Mon, 5 Jun 2023 23:38:11 GMT, Chen Liang wrote: >> This patch aims to improve the performance of MethodTypeDesc in general, as it is currently a performance bottleneck in the Classfile API. A previous revision changed the parameter storage from an array to a list; this is dropped now. Sorry for the force push. >> >> >> Benchmark (descString) Mode Cnt Score Error Units >> MethodTypeDescFactories.descriptorString (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 27.778 ? 0.573 ns/op >> MethodTypeDescFactories.descriptorString ()V avgt 6 13.343 ? 0.235 ns/op >> MethodTypeDescFactories.descriptorString ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 40.828 ? 0.448 ns/op >> MethodTypeDescFactories.descriptorString ()[Ljava/lang/String; avgt 6 14.754 ? 0.162 ns/op >> MethodTypeDescFactories.ofArray (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 8.616 ? 0.132 ns/op >> MethodTypeDescFactories.ofArray ()V avgt 6 2.146 ? 0.293 ns/op >> MethodTypeDescFactories.ofArray ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 14.595 ? 0.235 ns/op >> MethodTypeDescFactories.ofArray ()[Ljava/lang/String; avgt 6 2.064 ? 0.085 ns/op >> MethodTypeDescFactories.ofDescriptor (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 97.077 ? 2.482 ns/op >> MethodTypeDescFactories.ofDescriptor ()V avgt 6 13.563 ? 0.111 ns/op >> MethodTypeDescFactories.ofDescriptor ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 130.543 ? 2.847 ns/op >> MethodTypeDescFactories.ofDescriptor ()[Ljava/lang/String; avgt 6 35.286 ? 0.260 ns/op >> MethodTypeDescFactories.ofList (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 4.156 ? 0.258 ns/op >> MethodTypeDescFactories.ofList ()V avgt 6 2.192 ? 0.063 ns/op >> MethodTypeDescFactories.ofList ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 41.002 ? 0.235 ns/op >> MethodTypeDescFactories.ofList ()[Ljava/lang/String; avgt 6 2.200 ? 0.041 ns/op > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > Fixes for review Thanks for the change and it looks better. I updated the description of JDK-8309413 to make it clearer. src/java.base/share/classes/java/lang/constant/MethodTypeDescImpl.java line 57: > 55: * @param validatedArgTypes {@link ClassDesc}s describing the trusted and validated parameter types > 56: */ > 57: MethodTypeDescImpl(ClassDesc returnType, ClassDesc[] validatedArgTypes) { Can make this constructor private to prevent accidental use with invalidated argTypes. `MethodTypeDesc.of(ClassDesc returnDesc)` can call `ofTrusted` factory method. src/java.base/share/classes/java/lang/constant/MethodTypeDescImpl.java line 106: > 104: } else { > 105: result = new MethodTypeDescImpl(returnType, ConstantUtils.EMPTY_CLASSDESC); > 106: } Suggestion: int paramCount = types.size() - 1; var paramTypes = paramCount > 0 ? new ClassDesc[paramCount] : ConstantUtils.EMPTY_CLASSDESC; for (int i = 0; i < paramCount; i++) { paramTypes[i] = ClassDesc.ofDescriptor(types.get(i + 1)); } result = ofTrusted(returnType, paramTypes); ------------- PR Review: https://git.openjdk.org/jdk/pull/13186#pullrequestreview-1463810992 PR Review Comment: https://git.openjdk.org/jdk/pull/13186#discussion_r1218713450 PR Review Comment: https://git.openjdk.org/jdk/pull/13186#discussion_r1218736291 From liach at openjdk.org Tue Jun 6 00:37:18 2023 From: liach at openjdk.org (Chen Liang) Date: Tue, 6 Jun 2023 00:37:18 GMT Subject: RFR: 8309413: Improve the performance of MethodTypeDesc::descriptorString [v7] In-Reply-To: References: Message-ID: > This patch aims to improve the performance of MethodTypeDesc in general, as it is currently a performance bottleneck in the Classfile API. A previous revision changed the parameter storage from an array to a list; this is dropped now. Sorry for the force push. > > > Benchmark (descString) Mode Cnt Score Error Units > MethodTypeDescFactories.descriptorString (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 27.778 ? 0.573 ns/op > MethodTypeDescFactories.descriptorString ()V avgt 6 13.343 ? 0.235 ns/op > MethodTypeDescFactories.descriptorString ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 40.828 ? 0.448 ns/op > MethodTypeDescFactories.descriptorString ()[Ljava/lang/String; avgt 6 14.754 ? 0.162 ns/op > MethodTypeDescFactories.ofArray (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 8.616 ? 0.132 ns/op > MethodTypeDescFactories.ofArray ()V avgt 6 2.146 ? 0.293 ns/op > MethodTypeDescFactories.ofArray ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 14.595 ? 0.235 ns/op > MethodTypeDescFactories.ofArray ()[Ljava/lang/String; avgt 6 2.064 ? 0.085 ns/op > MethodTypeDescFactories.ofDescriptor (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 97.077 ? 2.482 ns/op > MethodTypeDescFactories.ofDescriptor ()V avgt 6 13.563 ? 0.111 ns/op > MethodTypeDescFactories.ofDescriptor ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 130.543 ? 2.847 ns/op > MethodTypeDescFactories.ofDescriptor ()[Ljava/lang/String; avgt 6 35.286 ? 0.260 ns/op > MethodTypeDescFactories.ofList (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 4.156 ? 0.258 ns/op > MethodTypeDescFactories.ofList ()V avgt 6 2.192 ? 0.063 ns/op > MethodTypeDescFactories.ofList ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 41.002 ? 0.235 ns/op > MethodTypeDescFactories.ofList ()[Ljava/lang/String; avgt 6 2.200 ? 0.041 ns/op Chen Liang has updated the pull request incrementally with two additional commits since the last revision: - Review changes - Apply suggestions from code review Co-authored-by: Mandy Chung ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13186/files - new: https://git.openjdk.org/jdk/pull/13186/files/6d47e9bf..fa66020a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13186&range=06 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13186&range=05-06 Stats: 13 lines in 2 files changed: 1 ins; 7 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/13186.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13186/head:pull/13186 PR: https://git.openjdk.org/jdk/pull/13186 From mchung at openjdk.org Tue Jun 6 01:08:54 2023 From: mchung at openjdk.org (Mandy Chung) Date: Tue, 6 Jun 2023 01:08:54 GMT Subject: RFR: 8309413: Improve the performance of MethodTypeDesc::descriptorString [v7] In-Reply-To: References: Message-ID: <4vPDkJ5nuZJAcnATKO3WrThcR_zxbrzoUmM8S-Eixqc=.1ed0ca7e-e319-4704-b554-f08a12c65342@github.com> On Tue, 6 Jun 2023 00:37:18 GMT, Chen Liang wrote: >> This patch aims to improve the performance of MethodTypeDesc in general, as it is currently a performance bottleneck in the Classfile API. A previous revision changed the parameter storage from an array to a list; this is dropped now. Sorry for the force push. >> >> >> Benchmark (descString) Mode Cnt Score Error Units >> MethodTypeDescFactories.descriptorString (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 27.778 ? 0.573 ns/op >> MethodTypeDescFactories.descriptorString ()V avgt 6 13.343 ? 0.235 ns/op >> MethodTypeDescFactories.descriptorString ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 40.828 ? 0.448 ns/op >> MethodTypeDescFactories.descriptorString ()[Ljava/lang/String; avgt 6 14.754 ? 0.162 ns/op >> MethodTypeDescFactories.ofArray (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 8.616 ? 0.132 ns/op >> MethodTypeDescFactories.ofArray ()V avgt 6 2.146 ? 0.293 ns/op >> MethodTypeDescFactories.ofArray ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 14.595 ? 0.235 ns/op >> MethodTypeDescFactories.ofArray ()[Ljava/lang/String; avgt 6 2.064 ? 0.085 ns/op >> MethodTypeDescFactories.ofDescriptor (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 97.077 ? 2.482 ns/op >> MethodTypeDescFactories.ofDescriptor ()V avgt 6 13.563 ? 0.111 ns/op >> MethodTypeDescFactories.ofDescriptor ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 130.543 ? 2.847 ns/op >> MethodTypeDescFactories.ofDescriptor ()[Ljava/lang/String; avgt 6 35.286 ? 0.260 ns/op >> MethodTypeDescFactories.ofList (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 4.156 ? 0.258 ns/op >> MethodTypeDescFactories.ofList ()V avgt 6 2.192 ? 0.063 ns/op >> MethodTypeDescFactories.ofList ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 41.002 ? 0.235 ns/op >> MethodTypeDescFactories.ofList ()[Ljava/lang/String; avgt 6 2.200 ? 0.041 ns/op > > Chen Liang has updated the pull request incrementally with two additional commits since the last revision: > > - Review changes > - Apply suggestions from code review > > Co-authored-by: Mandy Chung Marked as reviewed by mchung (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/13186#pullrequestreview-1463960042 From darcy at openjdk.org Tue Jun 6 01:36:54 2023 From: darcy at openjdk.org (Joe Darcy) Date: Tue, 6 Jun 2023 01:36:54 GMT Subject: RFR: JDK-8295071: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number [v3] In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 21:39:49 GMT, Iris Clark wrote: > The decimal integer should be unsigned and without leading zeros. A regex similar to that provided by Runtime.Version would make things clear. I think that Mandy's suggestion would be a reasonable alternative as the Java class file version number isn't truly arbitrary. A quick note on API philosophy, in its current version the PR proposes to go from very imprecise information: "Java class format version number" to to moderate level of precision: "Latest Java class file format version recognized by the Java runtime as "MAJOR.MINOR" where MAJOR and MINOR are both formatted as decimal integers" Especially given the terse description of most of the property keys, I don't think grammar-level detailing is necessary in this context. For example, to me the specification of, say, Method.toString is unhelpful to the reader since the gist of the semantics are overwhelmed with details as if the primary consumer was a parser rather than a human reader. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14305#discussion_r1218767482 From duke at openjdk.org Tue Jun 6 02:33:52 2023 From: duke at openjdk.org (SUN Guoyun) Date: Tue, 6 Jun 2023 02:33:52 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v3] In-Reply-To: References: Message-ID: <_V0eAue8-9jim47bfCMBJj04CxR8flt1ZH33dQNswcM=.08fbe5a4-3839-4128-add8-e7649411a426@github.com> On Mon, 5 Jun 2023 21:48:23 GMT, Naoto Sato wrote: >> src/java.base/share/classes/sun/util/locale/BaseLocale.java line 369: >> >>> 367: BaseLocale l = key.holder; >>> 368: BaseLocale locale = new BaseLocale(l.getLanguage(), l.getScript(), l.getRegion(), l.getVariant(), true); >>> 369: return (new Key(locale)).getBaseLocale(); >> >> Perhaps a more rigorous approach would look like this? >>
    
    >> BaseLocale locale = new BaseLocale(l.getLanguage(), l.getScript(), l.getRegion(), l.getVariant(), true);
    >> BaseLocal value = (new Key(locale)).getBaseLocale();
    >> Reference.reachabilityFence(locale);
    >> return value;
    >> 
    >> But the current patch has passed the tests with `-XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot`, so I think the current patch is OK. > > I still don't see a clear explanation of how the proposed patch fixes the problem. Also, I would appreciate the reasoning in the comments. For hotspot, when GC occurs, it causes all threads to run to the nearest safepoint and then freeze. Generally, safepoints are generated at branch jumps, method ends(ret instructions), loops instructions, and so on. Therefore, the purpose of this patch is to make the creation and use of a softReferences in the same method without branch, jumps and loops in between, that is ensure that GC will not occur in the process of the sofeReferences be created and used. That's why I didn't use `Reference.reachabilityFence(locale)`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14211#discussion_r1218793510 From duke at openjdk.org Tue Jun 6 03:03:30 2023 From: duke at openjdk.org (SUN Guoyun) Date: Tue, 6 Jun 2023 03:03:30 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v4] In-Reply-To: References: Message-ID: > command: make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp" TEST=gc/TestAllocHumongousFragment.java > error info: > > Caused by: java.lang.NullPointerException: Cannot invoke "sun.util.locale.BaseLocale.getVariant()" because "base" is null > at java.base/java.util.Locale.forLanguageTag(Locale.java:1802) > at java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.(CLDRBaseLocaleDataMetaInfo.java:41) > ... 24 more > > Note that the test runs with -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot and SoftReferences are involved (LocaleObjectCache uses SoftReferences, used by printf method called in getRandomInstance(Utils.java:511)). > > Maybe we have to deal with the case where the getBaseLocale() return value is null. the call stack is: > > at java.base/sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:64) > at java.base/sun.util.locale.BaseLocale.getInstance(BaseLocale.java:169) > at java.base/sun.util.locale.InternalLocaleBuilder.getBaseLocale(InternalLocaleBuilder.java:524) > at java.base/java.util.Locale.forLanguageTag(Locale.java:1874) > > in LocaleObjectCache.java:64 > > 62 if (key == null || newVal == null) { > 63 // subclass must return non-null key/value object > 64 return null; // run here > 65 } SUN Guoyun has updated the pull request incrementally with one additional commit since the last revision: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14211/files - new: https://git.openjdk.org/jdk/pull/14211/files/a09f1b6f..75fd5951 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14211&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14211&range=02-03 Stats: 6 lines in 2 files changed: 5 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14211.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14211/head:pull/14211 PR: https://git.openjdk.org/jdk/pull/14211 From jpai at openjdk.org Tue Jun 6 04:57:51 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Tue, 6 Jun 2023 04:57:51 GMT Subject: RFR: 8307840: SequencedMap view method specification and implementation adjustments In-Reply-To: References: Message-ID: <98fLhdNGS8lR2zjfCGVclbqpuizh5Bh2-F9_sBM_dwE=.a3ac2d37-219a-456e-8063-0c15fe460ecd@github.com> On Thu, 1 Jun 2023 16:18:12 GMT, Stuart Marks wrote: > Adjust the specification of the `SequencedMap` sequenced-view methods, and adjust implementations to match. src/java.base/share/classes/java/util/SequencedMap.java line 268: > 266: * Its {@link SequencedSet#reversed reversed} method returns the {@link > 267: * #sequencedKeySet sequencedKeySet} view of the {@link #reversed reversed} view of > 268: * this map. Each of its other methods calls the corresponding method of the {@link Hello Stuart, should this (and other similar places in this PR) instead be: Each of its other methods call call instead of calls? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14267#discussion_r1218897055 From jpai at openjdk.org Tue Jun 6 05:01:51 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Tue, 6 Jun 2023 05:01:51 GMT Subject: RFR: 8307840: SequencedMap view method specification and implementation adjustments In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 16:18:12 GMT, Stuart Marks wrote: > Adjust the specification of the `SequencedMap` sequenced-view methods, and adjust implementations to match. src/java.base/share/classes/java/util/AbstractMap.java line 908: > 906: public boolean add(E t) { throw uoe(); } > 907: public boolean addAll(Collection c) { throw uoe(); } > 908: public void clear() { view().clear(); } Each of these methods should perhaps have the `@Override` to make it clear that these correspond to the interface this class is implementing. But I see that the `AbstractMap` class itself doesn't use `@Override` anywhere, so I think it's OK to keep it consistent in its current form in this PR. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14267#discussion_r1218900019 From darcy at openjdk.org Tue Jun 6 05:07:52 2023 From: darcy at openjdk.org (Joe Darcy) Date: Tue, 6 Jun 2023 05:07:52 GMT Subject: RFR: 8307840: SequencedMap view method specification and implementation adjustments In-Reply-To: References: Message-ID: <36STI0UbvTjXyJJ7b7bZLoQyPjqY1lnzgTElu1Jly2Q=.3a93204a-2a73-4339-bdea-bcd89d9158fa@github.com> On Thu, 1 Jun 2023 16:18:12 GMT, Stuart Marks wrote: > Adjust the specification of the `SequencedMap` sequenced-view methods, and adjust implementations to match. Marked as reviewed by darcy (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14267#pullrequestreview-1464266624 From alanb at openjdk.org Tue Jun 6 07:13:15 2023 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 6 Jun 2023 07:13:15 GMT Subject: RFR: 8306647: Implementation of Structured Concurrency (Preview) [v5] In-Reply-To: <6gZZEoP1WXdBcZUiL5890eNsgaRFzZNY_rBItZdXtNc=.5d8f7bd9-44d5-4074-8a5c-35f8203263b2@github.com> References: <6gZZEoP1WXdBcZUiL5890eNsgaRFzZNY_rBItZdXtNc=.5d8f7bd9-44d5-4074-8a5c-35f8203263b2@github.com> Message-ID: > This is the implementation of: > > - JEP 453: Structured Concurrency (Preview) > - JEP 446: Scoped Values (Preview) > > For the most part, this is just moving code and tests. StructuredTaskScope moves to j.u.concurrent as a preview API, ScopedValue moves to j.lang as a preview API, and module jdk.incubator.concurrent has been removed. The significant API changes since incubator are: > > - StructuredTaskScope.fork returns Subtask instead of Future (JEP 453 has a section on this) > - ScopedValue.where methods are replaced with runWhere, callWhere and getWhere Alan Bateman has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 18 commits: - Fix typo in javadoc - Merge - Merge - Sync up from loom repo - Merge - Sync with loom repo, re-work ScopedValue class description - Sync up from loom repo - Remove csm.Threads - Merge - Test should not be in update for main line - ... and 8 more: https://git.openjdk.org/jdk/compare/2e9eff56...0f514588 ------------- Changes: https://git.openjdk.org/jdk/pull/13932/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13932&range=04 Stats: 9229 lines in 40 files changed: 4856 ins; 4315 del; 58 mod Patch: https://git.openjdk.org/jdk/pull/13932.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13932/head:pull/13932 PR: https://git.openjdk.org/jdk/pull/13932 From goetz at openjdk.org Tue Jun 6 08:23:51 2023 From: goetz at openjdk.org (Goetz Lindenmaier) Date: Tue, 6 Jun 2023 08:23:51 GMT Subject: RFR: JDK-8309219: Fix xlc17 clang 15 warnings in java.base In-Reply-To: References: Message-ID: <-yWpqiFZdPQLUCdoh0AObCt0RLIgVZpXIBdQFTAKidQ=.f35114ab-6248-4c50-9f50-d9015dbc204b@github.com> On Fri, 2 Jun 2023 10:08:09 GMT, JoKern65 wrote: > This pr is a split off from JDK-8308288: Fix xlc17 clang warnings in shared code https://github.com/openjdk/jdk/pull/14146 > It handles the part in java.base. > > Compiling on AIX with xlc17 which contains the new clang 15 frontend > shows the following warnings. > > built by make/modules/java.base/Lib.gmk > > src/java.base/unix/native/libnet/DefaultProxySelector.c:378:41:22: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error); > ^ > > > src/java.base/unix/native/libnet/NetworkInterface.c:1612:24: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wgnu-pointer-arith] > end = (void *)nddp + size; > > src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c:1251:7: error: '_ALLBSD_SOURCE' is not defined, evaluates to 0 [-Werror,-Wundef] > #elif _ALLBSD_SOURCE > The whole file checks whether _ALLBSD_SOURCE is defined, only where #elif is used the call to defined() was forgotten. > > built by make/modules/java.base/lib/CoreLibraries.gmk > > src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c:638 comparison of integers of different signs: 'int' and 'unsigned long' > if (ret < sizeof(psinfo_t)) { > ProcessHandleImpl_unix.c: Just using the proper type `size_t` instead of `int`. > > > src/java.base/aix/native/libjli/java_md_aix.c:42:38: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wgnu-pointer-arith] > addr < p->ldinfo_textorg + p->ldinfo_textsize) { > we can fix this with temporary casting the `void*` pointer to `char*` or by disabling the warning in CoreLibraries.gmk > > src/java.base/share/native/libzip/zlib/inffast.c:74:20: error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > void ZLIB_INTERNAL inflate_fast(strm, start) > ^ > src/java.base/share/native/libjli/java.c:2311:22: error: format string is not a string literal [-Werror,-Wformat-nonliteral] > vfprintf(stderr, fmt, vl); > ^~~ > > The test library libGetXSpace.c also shows a warning. > In addition, the cast in that lib is wrong, we opened "[JDK-8309216](https://bugs.openjdk.org/browse/JDK-8309216) cast from jchar* to char* in test GetXSpace.java" for that. Lib.gmk / DefaultProxySelector.c Fixing this in the file would require a larger rework. Good. Lib.gmk / NetworkInterface.c This looks as if it could also be fixed in the code. But previously, other warnings have not been fixed either. So I'm fine with this. CoreLibraries / deprecated-non-prototype Fixes warning in zlib, we should not touch the code there as it is from external. Good. CoreLibraries / format-nonliteral In hotspot, these warnings have been fixed, or an attribute is used to disable them locally. These places pop up in code scanners, too. See compilerWarnings.hpp / ATTRIBUTE_PRINTF(). The code here can not be fixed, and I don't see any usage of the attribute or similar in java.base, so disabling the warning seems fine to me. Also, it's treated similar in the other compile block. java_md_aix.c: good. ProcessHandleImpl_unix.c: good UnixNativeDispatcher.c: definitely an improvement to the code! libGetXSpace.c: good. A test library ------------- Marked as reviewed by goetz (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14281#pullrequestreview-1464571177 From alanb at openjdk.org Tue Jun 6 08:43:52 2023 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 6 Jun 2023 08:43:52 GMT Subject: RFR: JDK-8295071: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number [v3] In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 01:34:03 GMT, Joe Darcy wrote: > "Latest Java class file format version recognized by the Java runtime as "MAJOR.MINOR" where MAJOR and MINOR are both formatted as decimal integers" Okay, and linking to ClassFileFormatVersion.latest() is good. Again, just to lobby for putting an adjective into the ClassFileFormatVersion.RELEASE_XX descriptions to make it clearer than the value is the latest version recognized rather than single version that the wording currently suggests. > While it wouldn't be unreasonable to assume that when running under --enable-preview that the minor version was 65535, it is printed out as 0 with or without preview being enabled. > > I didn't want to broach preview-ness as part of this update to either promise or document the current behavior. You're right, I shouldn't have brought this up here. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14305#discussion_r1219189988 From alanb at openjdk.org Tue Jun 6 10:12:54 2023 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 6 Jun 2023 10:12:54 GMT Subject: RFR: 8309408: Thread.sleep cleanup In-Reply-To: References: Message-ID: <8l9FG4c1c4Ydlv3gQBiramw0YpSthxC-4wXOxVWiIOE=.b14f4319-2ecf-47ea-8118-5a3fe60d92c2@github.com> On Mon, 5 Jun 2023 20:05:24 GMT, Chris Plummer wrote: > The following commit in loom heavily modified this file with a lot of added expected methods. There are other related tests with similar changes. I'm not so sure I understand the need for so many additions, and also why expectedLength is so out of sync with the number of added method. I don't believe this commit was reviewed individually, but was just part of the overall loom review when merge into jdk. Perhaps it should be revisited. These tests aren't easy to read or maintain, it would be good to re-visit them. In some cases, the tests capture the stack trace asynchronously so the test needs to know about all code paths. As regards ThreadController, used by the nsk/monitoring/stress/thread/straceXXX tests, the main thread waits at a barrier (a CountDownLatch) until all sleeping threads are ready to sleep. Once the main thread is released, it checks all the sleepers are in TIMED_WAITING state and samples their stack traces with the ThreadMXBean and related APIs. The test fails if there are frames corresponding to methods that the test doesn't know about. If a thread is sleeping then we shouldn't see frames for beforeSleep/afterSlee. My reading of these tests is that the main thread could poll a SleepingThread after it counts down and before it parks in sleep. It's doing an expensive ThreadMXBean::getAllThreadIds once released and that may explain why it hasn't been seen. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14303#discussion_r1219348675 From apejovic at openjdk.org Tue Jun 6 10:13:53 2023 From: apejovic at openjdk.org (Aleksandar Pejovic) Date: Tue, 6 Jun 2023 10:13:53 GMT Subject: RFR: 8309191: Reduce JDK dependencies of cgroup support In-Reply-To: References: <1k0o3AhR5gZkMrmtdpGqRg3MM77JTsh9pcFXraWYydE=.7e768396-ab2f-4778-9dcb-3716f28fddcc@github.com> Message-ID: On Mon, 5 Jun 2023 09:44:31 GMT, Severin Gehwolf wrote: >> As far as I can tell, the delimiter hasn't changed since the file was introduced, and judging by the kernel mailing list (e.g., see [the following](https://lore.kernel.org/all/Yr5JVHhSUCrbT8OH at mtj.duckdns.org/)), I don't think it will change any time soon. > > I'm not convinced this is a good change. Going by that mailing list thread, it suggests that people considered changing it. If one of those attempts were successful, it would have broken this code. It makes it rather fragile. The issue, with container detection code going wrong is that you most likely never notice. Translating this to GraalVM means that the native image, would a) detect the wrong version in use or b) fail detection and use host values. In both cases the application will likely misbehave in a container setup with resource limits applied and you won't (easily) know why. So even though it's unlikely to be a problem, there is a chance it could be and it's asking for trouble for no good reason. > > Therefore, being conservative about delimiters makes sense here. My choice in this case would be more robust code over relying on external factors. YMMV. Okay, so how about something like the following, would that be more acceptable? Suggestion: String[] tokens = Collections.list(new StringTokenizer(line, " \t")).toArray(new String[0]); ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14216#discussion_r1219348952 From mcimadamore at openjdk.org Tue Jun 6 10:35:09 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Tue, 6 Jun 2023 10:35:09 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v6] In-Reply-To: References: Message-ID: > As the FFM API evolved over time, some parts of the javadoc went out of sync. Now that most of the API is stable, it is a good time to look again at the javadoc as a whole, and bring some more consistency. > > While most of the changes in this PR are stylistic, I'd like to call out few things which resulted in API changes: > > * `MemorySegment::asSlice(long, long, long)` did not (incorrectly) specified requirement that its alignment parameter must be a power of two. > > * `MemoryLayout::sliceHandle` did not require the absence of dereference paths in the provided layout path. While that is technically possible to allow, currently the method is specified as returning a "slice" corresponding to some "nested layout", so following pointers seems incompatible with the spec. I have decided to disallow for now - we can always compatibly enable it later, if required. > > * `MemorySegment::copy` - most of the overloads did not specify that `UnsupportedOperationException` is thrown if the destination segment is read-only. > > * In several places, an extra `@throws IllegalArgumentException` or `@throws IllegalArgumentException` has been added to capture cases where element size * index computation can overflow. This is true for all the element-wise segment copy methods, for the indexed accessors in memory segment (e.g. `MemorySegment.getAtIndex(ValueLayout.OfInt, long)`), as well as for `SegmentAllocator::allocateArray(MemoryLayout, long)`. > > In all these cases (except for overflows), new tests have been added to cover the additional API changes (a CSR will also be filed to cover these). > > The class with most changes is `MemoryLayout`. I realized that the javadoc there was a bit sloppy around the definition of "layout paths". Now there are several subsection in the class javadoc, which explain how different kinds of paths can be used. I have introduced the notion of "open path elements" to denote those path elements that are not fully specified, and result in additional var handle coordinates to be added. There is also now a definition of what it means for a layout path to be "well-formed", so that all methods accepting a layout path can simply refer to it (this definition is tricky to give inline in the javadoc of the various path-accepting methods, as it depends on many factors). > > Another biggie change was in `MemorySegment` as now all dereference methods state precisely their spatial checks requirements, as well also specifying when the API can throw because of an ... Maurizio Cimadamore has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 29 commits: - Merge branch 'master' into javadoc_fixes - Fix issue with ArithmeticException not being wrapped in IAE for SequenceLayout::withElementCount Fix issue with IAE thrown instead of UOE for ValueLayout::arrayElementVarHandle Add apiNote to MemorySegment::address re. reachability - Missed a review comment - Use more `{@return}` tags - Address review comments - Fix wrong link in layout well-formedness doc - Improve javadoc on supported linker layouts - Tweak javadoc of MemorySegment::get/setUtf8String to deal with overflow - Merge branch 'master' into javadoc_fixes - Add overflow tests - ... and 19 more: https://git.openjdk.org/jdk/compare/01455a07...b59edd93 ------------- Changes: https://git.openjdk.org/jdk/pull/14098/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14098&range=05 Stats: 963 lines in 28 files changed: 357 ins; 138 del; 468 mod Patch: https://git.openjdk.org/jdk/pull/14098.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14098/head:pull/14098 PR: https://git.openjdk.org/jdk/pull/14098 From alanb at openjdk.org Tue Jun 6 10:39:53 2023 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 6 Jun 2023 10:39:53 GMT Subject: RFR: 8307840: SequencedMap view method specification and implementation adjustments In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 16:18:12 GMT, Stuart Marks wrote: > Adjust the specification of the `SequencedMap` sequenced-view methods, and adjust implementations to match. Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14267#pullrequestreview-1464867310 From liach at openjdk.org Tue Jun 6 11:16:57 2023 From: liach at openjdk.org (Chen Liang) Date: Tue, 6 Jun 2023 11:16:57 GMT Subject: RFR: 8294977: Convert test/jdk/java tests from ASM library to Classfile API [v8] In-Reply-To: References: Message-ID: On Tue, 9 May 2023 04:17:28 GMT, Chen Liang wrote: >> Summaries: >> 1. A few recommendations about updating the constant API is made at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-March/000233.html and I may update this patch shall the API changes be integrated before >> 2. One ASM library-specific test, `LambdaAsm` is removed. Others have their code generation infrastructure upgraded from ASM to Classfile API. >> 3. Most tests are included in tier1, but some are not: >> In `:jdk_io`: (tier2, part 2) >> >> test/jdk/java/io/Serializable/records/SerialPersistentFieldsTest.java >> test/jdk/java/io/Serializable/records/ProhibitedMethods.java >> test/jdk/java/io/Serializable/records/BadCanonicalCtrTest.java >> >> In `:jdk_instrument`: (tier 3) >> >> test/jdk/java/lang/instrument/RetransformAgent.java >> test/jdk/java/lang/instrument/NativeMethodPrefixAgent.java >> test/jdk/java/lang/instrument/asmlib/Instrumentor.java >> >> >> @asotona Would you mind reviewing? > > Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 12 commits: > > - Merge branch 'master' into invoke-test-classfile > - Switch to ConstantDescs for and void constants > - Merge AnnotationsTest, remove ModuleTargetAttribute call > - Merge branch 'invoke-test-classfile' of https://github.com/liachmodded/jdk into invoke-test-classfile > - Update test/jdk/java/lang/invoke/8022701/MHIllegalAccess.java > > Co-authored-by: Andrey Turbanov > - Merge branch 'master' into invoke-test-classfile > - Fix LambdaStackTrace after running > - formatting > - Fix failed LambdaStackTrace test, use more convenient APIs > - Merge branch 'master' of https://git.openjdk.java.net/jdk into invoke-test-classfile > - ... and 2 more: https://git.openjdk.org/jdk/compare/d9052b94...5db1e957 keep-alive; this will be updated for the classfile object update. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13009#issuecomment-1578507931 From alanb at openjdk.org Tue Jun 6 11:44:53 2023 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 6 Jun 2023 11:44:53 GMT Subject: RFR: 8301341: LinkedTransferQueue does not respect timeout for poll() In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 18:52:00 GMT, Doug Lea
    wrote: > This now uses Thread.isVirtual to distinguish spin vs immediate block cases, enabling re-introduction of spin control from the previous version, removing anomalies like this one. This looks okay to me, it was a bit easier than I expected. The only comment I have is an interrupt while spinning won't be noticed until count goes to 0, that should be rare enough that it doesn't matter. We might have to tune SPIN_FOR_TIMEOUT_THRESHOLD at some point for virtual threads. ------------- Marked as reviewed by alanb (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14317#pullrequestreview-1464982532 From asotona at openjdk.org Tue Jun 6 12:15:07 2023 From: asotona at openjdk.org (Adam Sotona) Date: Tue, 6 Jun 2023 12:15:07 GMT Subject: RFR: 8294969: Convert jdk.jdeps javap to use the Classfile API [v4] In-Reply-To: References: Message-ID: <1l1hrTeZ3i2uTju6KVyTWCoSIJJ-A7nWOATG6b6FGQ8=.a327ed72-3e20-4f2b-8c94-ca257c69bdf8@github.com> > javap uses proprietary com.sun.tools.classfile library to parse class files. > > This patch converts javap to use Classfile API. > > Please review. > > Thanks, > 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 218 commits: - Merge branch 'master' into JDK-8294969-javap # Conflicts: # src/java.base/share/classes/jdk/internal/classfile/constantpool/ConstantPoolException.java - fixed build - Merge branch 'master' into JDK-8294969-javap # Conflicts: # src/java.base/share/classes/module-info.java - more consolidation on IllegalArgumentException - Merge branch 'master' into JDK-8294969-javap - fixed TestClassNameWarning - Merge branch 'master' into JDK-8294969-javap # Conflicts: # src/java.base/share/classes/module-info.java - consolidated safeguarding of IAE in javap - consolidation of constant pool originating IAEs and IOOBEs into ConstantPoolException extending IAE - Safeguarding CP errors + test - ... and 208 more: https://git.openjdk.org/jdk/compare/98b53c06...a688bf49 ------------- Changes: https://git.openjdk.org/jdk/pull/11411/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11411&range=03 Stats: 3638 lines in 22 files changed: 835 ins; 1716 del; 1087 mod Patch: https://git.openjdk.org/jdk/pull/11411.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/11411/head:pull/11411 PR: https://git.openjdk.org/jdk/pull/11411 From sgehwolf at openjdk.org Tue Jun 6 12:23:54 2023 From: sgehwolf at openjdk.org (Severin Gehwolf) Date: Tue, 6 Jun 2023 12:23:54 GMT Subject: RFR: 8309191: Reduce JDK dependencies of cgroup support In-Reply-To: References: <1k0o3AhR5gZkMrmtdpGqRg3MM77JTsh9pcFXraWYydE=.7e768396-ab2f-4778-9dcb-3716f28fddcc@github.com> Message-ID: On Tue, 6 Jun 2023 10:10:38 GMT, Aleksandar Pejovic wrote: >> I'm not convinced this is a good change. Going by that mailing list thread, it suggests that people considered changing it. If one of those attempts were successful, it would have broken this code. It makes it rather fragile. The issue, with container detection code going wrong is that you most likely never notice. Translating this to GraalVM means that the native image, would a) detect the wrong version in use or b) fail detection and use host values. In both cases the application will likely misbehave in a container setup with resource limits applied and you won't (easily) know why. So even though it's unlikely to be a problem, there is a chance it could be and it's asking for trouble for no good reason. >> >> Therefore, being conservative about delimiters makes sense here. My choice in this case would be more robust code over relying on external factors. YMMV. > > Okay, so how about something like the following, would that be more acceptable? > Suggestion: > > String[] tokens = Collections.list(new StringTokenizer(line, " \t")).toArray(new String[0]); `StringTokenizer()` is a legacy class and is discouraged in new code. So not ideal either. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14216#discussion_r1219542380 From jlaskey at openjdk.org Tue Jun 6 12:46:52 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Tue, 6 Jun 2023 12:46:52 GMT Subject: RFR: JDK-8309534 @JEP(number=430, title="String Templates") should use default status Message-ID: Status was incorrectly specified as @JEP(number=430, title="String Templates", status="First Preview") Should be @JEP(number=430, title="String Templates) ------------- Commit messages: - Status incorrectly specified Changes: https://git.openjdk.org/jdk/pull/14332/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14332&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309534 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14332.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14332/head:pull/14332 PR: https://git.openjdk.org/jdk/pull/14332 From alanb at openjdk.org Tue Jun 6 12:57:53 2023 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 6 Jun 2023 12:57:53 GMT Subject: RFR: JDK-8309534 @JEP(number=430, title="String Templates") should use default status In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 12:39:58 GMT, Jim Laskey wrote: > Status was incorrectly specified as > > @JEP(number=430, title="String Templates", status="First Preview") > > Should be > > @JEP(number=430, title="String Templates) Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14332#pullrequestreview-1465139430 From duke at openjdk.org Tue Jun 6 13:02:06 2023 From: duke at openjdk.org (Rudi Horn) Date: Tue, 6 Jun 2023 13:02:06 GMT Subject: Integrated: 8308748: JNU_GetStringPlatformChars may write to String's internal memory array In-Reply-To: References: Message-ID: On Wed, 24 May 2023 09:24:46 GMT, Rudi Horn wrote: > This change prevents the contents of the internal string array from being copied back when releasing it. This pull request has now been integrated. Changeset: 8f0839bc Author: Rudi Horn Committer: Alan Bateman URL: https://git.openjdk.org/jdk/commit/8f0839bc55036a8a663a83a02d300c60e71ceb6c Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod 8308748: JNU_GetStringPlatformChars may write to String's internal memory array Reviewed-by: dholmes, rriggs, alanb ------------- PR: https://git.openjdk.org/jdk/pull/14117 From jlaskey at openjdk.org Tue Jun 6 13:04:00 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Tue, 6 Jun 2023 13:04:00 GMT Subject: Integrated: JDK-8309534 @JEP(number=430, title="String Templates") should use default status In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 12:39:58 GMT, Jim Laskey wrote: > Status was incorrectly specified as > > @JEP(number=430, title="String Templates", status="First Preview") > > Should be > > @JEP(number=430, title="String Templates) This pull request has now been integrated. Changeset: ca6f07f9 Author: Jim Laskey URL: https://git.openjdk.org/jdk/commit/ca6f07f9ab70d552061a2715342f1227287f2d94 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod 8309534: @JEP(number=430, title="String Templates") should use default status Reviewed-by: alanb ------------- PR: https://git.openjdk.org/jdk/pull/14332 From alanb at openjdk.org Tue Jun 6 14:20:53 2023 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 6 Jun 2023 14:20:53 GMT Subject: RFR: 8301721: lookup.findSpecial fails on Object method call from interface In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 19:33:48 GMT, Mandy Chung wrote: > Lookup.findSpecial fails on Object method call from an interface because of a bug in the implementation calling `Class::getSuperclass` on an interface which has no superclass. The implementation should only search the method from its superclass only if it's a class. This patch is trivial and skip the superclass search if it's an interface. This looks right, there's no superclass to search. ------------- Marked as reviewed by alanb (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14319#pullrequestreview-1465328491 From jvernee at openjdk.org Tue Jun 6 15:17:26 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Tue, 6 Jun 2023 15:17:26 GMT Subject: RFR: 8308031: Linkers should promote variadic arguments [v8] In-Reply-To: References: Message-ID: > In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and `float` is promoted to `double`, when being passed as variadic argument (see e.g. https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions). This patch adds the automatic argument promotion for variadic arguments, to align the implementation with the C specification. > > The fallback linker is also updated to use to correct function to link variadic calls (not doing this turned out not to be a problem so far, but it is problematic for instance on Mac/AArch64 when using the fallback linker). Adding the restriction on layouts for all linkers is also partly motivated by the fallback linker rejecting such unsupported variadic layouts already. > > I've added a small paragraph to the Linker javadoc as well that explains this. > > TestVarArgs needed to be updated in order to account for the difference in the promoted `float` values. > > Testing: > - local testing on Windows/x64 > - local testing on Linux/x64 using the fallback linker > - tier1-3 + jdk-tier5 > - manual test run on mac/aarch64 with the fallback linker to verify the correctness of the fallback linker changes. Jorn Vernee has updated the pull request incrementally with two additional commits since the last revision: - Improve javadoc, align implementation - Revert "automatically apply variadic promotions" This reverts commit 38d759d615b79b0c508bdf2231699c0aea0ad94f. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14225/files - new: https://git.openjdk.org/jdk/pull/14225/files/3ec04fa6..ca56fade Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14225&range=07 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14225&range=06-07 Stats: 202 lines in 7 files changed: 70 ins; 116 del; 16 mod Patch: https://git.openjdk.org/jdk/pull/14225.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14225/head:pull/14225 PR: https://git.openjdk.org/jdk/pull/14225 From jvernee at openjdk.org Tue Jun 6 15:17:48 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Tue, 6 Jun 2023 15:17:48 GMT Subject: RFR: 8308031: Linkers should promote variadic arguments [v7] In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 16:22:43 GMT, Jorn Vernee wrote: >> In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and `float` is promoted to `double`, when being passed as variadic argument (see e.g. https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions). This patch adds the automatic argument promotion for variadic arguments, to align the implementation with the C specification. >> >> The fallback linker is also updated to use to correct function to link variadic calls (not doing this turned out not to be a problem so far, but it is problematic for instance on Mac/AArch64 when using the fallback linker). Adding the restriction on layouts for all linkers is also partly motivated by the fallback linker rejecting such unsupported variadic layouts already. >> >> I've added a small paragraph to the Linker javadoc as well that explains this. >> >> TestVarArgs needed to be updated in order to account for the difference in the promoted `float` values. >> >> Testing: >> - local testing on Windows/x64 >> - local testing on Linux/x64 using the fallback linker >> - tier1-3 + jdk-tier5 >> - manual test run on mac/aarch64 with the fallback linker to verify the correctness of the fallback linker changes. > > Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: > > address review comment After more offline discussion we concluded that by applying argument promotions automatically we create an issue for unsigned types. We currently allow an unsigned value to be represented with the signed equivalent. For example, `JAVA_SHORT` can represent both the C `short` and `unsigned short` types. The issue is that if we were to promote `short` values to `int`, it is ambiguous whether sign extension should take place. As a result, we decided to go back to the approach of rejecting variadic layouts representing a C type that would undergo default argument promotion. If/when we add better support for unsigned types, we can revisit. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14225#issuecomment-1578960268 From bpb at openjdk.org Tue Jun 6 15:19:02 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Tue, 6 Jun 2023 15:19:02 GMT Subject: Integrated: 8309216: Cast from jchar* to char* in test java/io/GetXSpace.java In-Reply-To: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> References: <2150X7B6eiNJ_bCMRVfINiJcbkU1LKymWKdHz7LjjTA=.2ce227da-bcec-436c-941b-1fc1a21e7a3c@github.com> Message-ID: On Fri, 2 Jun 2023 00:00:07 GMT, Brian Burkhalter wrote: > For Unix, copy the `jchar`s into an allocated `char` array. This pull request has now been integrated. Changeset: 91881426 Author: Brian Burkhalter URL: https://git.openjdk.org/jdk/commit/9188142698d8fdcee43c0b0519fde5c63b0010f8 Stats: 24 lines in 1 file changed: 18 ins; 0 del; 6 mod 8309216: Cast from jchar* to char* in test java/io/GetXSpace.java Reviewed-by: rriggs, naoto ------------- PR: https://git.openjdk.org/jdk/pull/14276 From duke at openjdk.org Tue Jun 6 15:24:12 2023 From: duke at openjdk.org (duke) Date: Tue, 6 Jun 2023 15:24:12 GMT Subject: Withdrawn: 8305774: String.join(CharSequence, Iterable) can be optimized if Iterable is a Collection In-Reply-To: References: Message-ID: <7X4rZP0xrnofRHe8epTrQ5hY_gQ1Hg_fQDSvT87dIpI=.113b82c7-cb07-4a38-908f-62daeb333981@github.com> On Fri, 7 Apr 2023 08:27:18 GMT, Tingjun Yuan wrote: > In the current implementation of `String.join(CharSequence, Iterable)`, the temp array `elems` is always initialized with a length of 8. It will cause many array recreations when the `Iterable` contains more than 8 elements. Furthermore, it's very common that an `Iterable` is also a `Collection`. So if the `Iterable` is an instance of `Collection`, the initial length of the array can be `((Collection)elements).size()`. It will not change the current behavior even if the `Collection` is modified asynchronously. > > I don't know whether this change requires a CSR request. This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/jdk/pull/13383 From jwaters at openjdk.org Tue Jun 6 15:36:57 2023 From: jwaters at openjdk.org (Julian Waters) Date: Tue, 6 Jun 2023 15:36:57 GMT Subject: RFR: 8308780: Fix the Java Integer types on Windows [v4] In-Reply-To: <3VAC9z-WjItzbkXeNreX7PGi18ypbaom-RjBJgHb9L4=.1e90295d-c012-47dd-b5fe-fa7889ce2c84@github.com> References: <-mAb3g-jnRbOa0PFdM8gVP-8zI8CRGwxPvSdXd3uPm8=.2e6ab688-3ca1-4b8a-8674-5245c3f7557f@github.com> <3VAC9z-WjItzbkXeNreX7PGi18ypbaom-RjBJgHb9L4=.1e90295d-c012-47dd-b5fe-fa7889ce2c84@github.com> Message-ID: On Thu, 1 Jun 2023 11:49:24 GMT, Julian Waters wrote: >> On Windows, the basic Java Integer types are defined as long and __int64 respectively. In particular, the former is rather problematic since it breaks compilation as the Visual C++ becomes stricter and more compliant with every release, which means the way Windows code treats long as a typedef for int is no longer correct, especially with -permissive- enabled. Instead of changing every piece of broken code to match the jint = long typedef, which is far too time consuming, we can instead change jint to an int (which is still the same 32 bit number type as long), as there are far fewer problems caused by this definition. It's better to get this over and done with sooner than later when a future version of Visual C++ finally starts to break on existing code > > Julian Waters has updated the pull request incrementally with one additional commit since the last revision: > > Fix the code that is actually warning Bumping ------------- PR Comment: https://git.openjdk.org/jdk/pull/14125#issuecomment-1578995624 From jwaters at openjdk.org Tue Jun 6 15:37:00 2023 From: jwaters at openjdk.org (Julian Waters) Date: Tue, 6 Jun 2023 15:37:00 GMT Subject: RFR: 8305341: Alignment should be enforced by alignas instead of compiler specific attributes [v4] In-Reply-To: References: <2d60fxZxeWZEngMaSE1N4JZz07XkvbXj8jrN_hMbo-0=.51ffb82f-2beb-43f7-9195-062555599d0b@github.com> Message-ID: On Wed, 12 Apr 2023 07:12:10 GMT, Julian Waters wrote: >> C11 has been stable for a long time on all platforms, so native code can use the standard alignas operator for alignment requirements > > Julian Waters has updated the pull request incrementally with four additional commits since the last revision: > > - Restore visCPP > - Restore gcc attribute > - Revert gcc > - Revert Bumping ------------- PR Comment: https://git.openjdk.org/jdk/pull/13258#issuecomment-1578994674 From aturbanov at openjdk.org Tue Jun 6 15:47:54 2023 From: aturbanov at openjdk.org (Andrey Turbanov) Date: Tue, 6 Jun 2023 15:47:54 GMT Subject: RFR: 8301341: LinkedTransferQueue does not respect timeout for poll() In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 18:52:00 GMT, Doug Lea
    wrote: > This now uses Thread.isVirtual to distinguish spin vs immediate block cases, enabling re-introduction of spin control from the previous version, removing anomalies like this one. src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java line 408: > 406: * variety of processors, numbers of CPUs, and OSes. > 407: */ > 408: private static final int FRONT_SPINS = 1 << 7; nit Suggestion: private static final int FRONT_SPINS = 1 << 7; ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14317#discussion_r1219891442 From never at openjdk.org Tue Jun 6 15:57:05 2023 From: never at openjdk.org (Tom Rodriguez) Date: Tue, 6 Jun 2023 15:57:05 GMT Subject: Integrated: 8309501: Remove workaround in bin/idea.sh for non standard JVMCI file layout In-Reply-To: <7xLLhe3TF96ZnkpiOiAm6Km8T3mV1sd26SPHGTPBp7I=.8b884a99-aeae-47f6-b211-b5fc4ca11a8e@github.com> References: <7xLLhe3TF96ZnkpiOiAm6Km8T3mV1sd26SPHGTPBp7I=.8b884a99-aeae-47f6-b211-b5fc4ca11a8e@github.com> Message-ID: On Mon, 5 Jun 2023 19:12:52 GMT, Tom Rodriguez wrote: > This allows bin/idea.sh to properly see the JVMCI files again. This pull request has now been integrated. Changeset: 7edd0540 Author: Tom Rodriguez URL: https://git.openjdk.org/jdk/commit/7edd0540e06444313647acd133c230785ddaf8ee Stats: 12 lines in 1 file changed: 0 ins; 10 del; 2 mod 8309501: Remove workaround in bin/idea.sh for non standard JVMCI file layout Reviewed-by: dnsimon, erikj ------------- PR: https://git.openjdk.org/jdk/pull/14318 From liach at openjdk.org Tue Jun 6 16:00:11 2023 From: liach at openjdk.org (Chen Liang) Date: Tue, 6 Jun 2023 16:00:11 GMT Subject: Integrated: 8309413: Improve the performance of MethodTypeDesc::descriptorString In-Reply-To: References: Message-ID: On Sun, 26 Mar 2023 05:23:54 GMT, Chen Liang wrote: > This patch aims to improve the performance of MethodTypeDesc in general, as it is currently a performance bottleneck in the Classfile API. A previous revision changed the parameter storage from an array to a list; this is dropped now. Sorry for the force push. > > > Benchmark (descString) Mode Cnt Score Error Units > MethodTypeDescFactories.descriptorString (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 27.778 ? 0.573 ns/op > MethodTypeDescFactories.descriptorString ()V avgt 6 13.343 ? 0.235 ns/op > MethodTypeDescFactories.descriptorString ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 40.828 ? 0.448 ns/op > MethodTypeDescFactories.descriptorString ()[Ljava/lang/String; avgt 6 14.754 ? 0.162 ns/op > MethodTypeDescFactories.ofArray (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 8.616 ? 0.132 ns/op > MethodTypeDescFactories.ofArray ()V avgt 6 2.146 ? 0.293 ns/op > MethodTypeDescFactories.ofArray ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 14.595 ? 0.235 ns/op > MethodTypeDescFactories.ofArray ()[Ljava/lang/String; avgt 6 2.064 ? 0.085 ns/op > MethodTypeDescFactories.ofDescriptor (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 97.077 ? 2.482 ns/op > MethodTypeDescFactories.ofDescriptor ()V avgt 6 13.563 ? 0.111 ns/op > MethodTypeDescFactories.ofDescriptor ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 130.543 ? 2.847 ns/op > MethodTypeDescFactories.ofDescriptor ()[Ljava/lang/String; avgt 6 35.286 ? 0.260 ns/op > MethodTypeDescFactories.ofList (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 4.156 ? 0.258 ns/op > MethodTypeDescFactories.ofList ()V avgt 6 2.192 ? 0.063 ns/op > MethodTypeDescFactories.ofList ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 41.002 ? 0.235 ns/op > MethodTypeDescFactories.ofList ()[Ljava/lang/String; avgt 6 2.200 ? 0.041 ns/op This pull request has now been integrated. Changeset: 38cef2ad Author: Chen Liang Committer: Mandy Chung URL: https://git.openjdk.org/jdk/commit/38cef2adbd956ac1e953ea7a7e7952fe093a9872 Stats: 283 lines in 4 files changed: 198 ins; 44 del; 41 mod 8309413: Improve the performance of MethodTypeDesc::descriptorString 8304932: MethodTypeDescImpl can be mutated by argument passed to MethodTypeDesc.of Reviewed-by: mchung ------------- PR: https://git.openjdk.org/jdk/pull/13186 From mchung at openjdk.org Tue Jun 6 16:23:06 2023 From: mchung at openjdk.org (Mandy Chung) Date: Tue, 6 Jun 2023 16:23:06 GMT Subject: Integrated: 8301721: lookup.findSpecial fails on Object method call from interface In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 19:33:48 GMT, Mandy Chung wrote: > Lookup.findSpecial fails on Object method call from an interface because of a bug in the implementation calling `Class::getSuperclass` on an interface which has no superclass. The implementation should only search the method from its superclass only if it's a class. This patch is trivial and skip the superclass search if it's an interface. This pull request has now been integrated. Changeset: 74dc50b7 Author: Mandy Chung URL: https://git.openjdk.org/jdk/commit/74dc50b7f0b0b9440746ff329fc3324c477ae421 Stats: 80 lines in 2 files changed: 79 ins; 0 del; 1 mod 8301721: lookup.findSpecial fails on Object method call from interface Reviewed-by: alanb ------------- PR: https://git.openjdk.org/jdk/pull/14319 From mcimadamore at openjdk.org Tue Jun 6 16:27:44 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Tue, 6 Jun 2023 16:27:44 GMT Subject: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v8] In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 15:17:26 GMT, Jorn Vernee wrote: >> In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and `float` is promoted to `double`, when being passed as variadic argument (see e.g. https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions). This patch adds the automatic argument promotion for variadic arguments, to align the implementation with the C specification. >> >> The fallback linker is also updated to use to correct function to link variadic calls (not doing this turned out not to be a problem so far, but it is problematic for instance on Mac/AArch64 when using the fallback linker). Adding the restriction on layouts for all linkers is also partly motivated by the fallback linker rejecting such unsupported variadic layouts already. >> >> I've added a small paragraph to the Linker javadoc as well that explains this. >> >> TestVarArgs needed to be updated in order to account for the difference in the promoted `float` values. >> >> Testing: >> - local testing on Windows/x64 >> - local testing on Linux/x64 using the fallback linker >> - tier1-3 + jdk-tier5 >> - manual test run on mac/aarch64 with the fallback linker to verify the correctness of the fallback linker changes. > > Jorn Vernee has updated the pull request incrementally with two additional commits since the last revision: > > - Improve javadoc, align implementation > - Revert "automatically apply variadic promotions" > > This reverts commit 38d759d615b79b0c508bdf2231699c0aea0ad94f. Marked as reviewed by mcimadamore (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14225#pullrequestreview-1465598652 From jiangli at openjdk.org Tue Jun 6 16:28:59 2023 From: jiangli at openjdk.org (Jiangli Zhou) Date: Tue, 6 Jun 2023 16:28:59 GMT Subject: RFR: 8307858: [REDO] JDK-8307194 Add make target for optionally building a complete set of all JDK and hotspot libjvm static libraries [v5] In-Reply-To: References: Message-ID: <4U4zG-gKBcankqMtYc3p1EEuHrQ-_AvyS6J_P4Gww50=.88fd8d13-3f4f-46d6-9049-4371a3755bb1@github.com> On Fri, 19 May 2023 21:20:19 GMT, Erik Joelsson wrote: >> Jiangli Zhou has updated the pull request incrementally with one additional commit since the last revision: >> >> Update make/common/NativeCompilation.gmk >> >> Thanks you! >> >> Co-authored-by: Erik Joelsson <37597443+erikj79 at users.noreply.github.com> > > I ran this patch in our internal build and test system and got failures on macos and windows. I think I know the cause for the mac failure, but the Windows failure I don't know. It looks like the same error I saw before after the original patch went in. > > > [2023-05-19T20:51:31,466Z] c:\sb\prod\1684529071\workspace\open\src\hotspot\share\compiler\disassembler.cpp(792): error C2220: the following warning is treated as an error > [2023-05-19T20:51:31,466Z] c:\sb\prod\1684529071\workspace\open\src\hotspot\share\compiler\disassembler.cpp(792): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data > [2023-05-19T20:51:31,466Z] lib/CompileJvm.gmk:152: recipe for target '/cygdrive/c/sb/prod/1684529071/workspace/build/windows-x64-open/hotspot/variant-server/libjvm/objs/static/disassembler.obj' failed > [2023-05-19T20:51:31,466Z] make[3]: *** [/cygdrive/c/sb/prod/1684529071/workspace/build/windows-x64-open/hotspot/variant-server/libjvm/objs/static/disassembler.obj] Error 1 Thanks for running tests!! ------------- PR Comment: https://git.openjdk.org/jdk/pull/14064#issuecomment-1555291522 From liach at openjdk.org Tue Jun 6 16:32:47 2023 From: liach at openjdk.org (Chen Liang) Date: Tue, 6 Jun 2023 16:32:47 GMT Subject: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v6] In-Reply-To: References: Message-ID: On Thu, 6 Apr 2023 03:44:07 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance interface) >> 2. Does not allow future expansion to support SAM[^1] abstract classes >> 3. Slow (in fact, very slow) >> >> This patch addresses all 3 problems: >> 1. It updates the WrapperInstance methods to take an `Empty` to avoid method clashes >> 2. This patch obtains already generated classes from a ClassValue by the requested interface type; the ClassValue can later be updated to compute implementation generation for abstract classes as well. >> 3. This patch's faster than old implementation in general. >> >> >> Benchmark Mode Cnt Score Error Units >> MethodHandleProxiesAsIFInstance.baselineAllocCompute avgt 15 1.483 ? 0.025 ns/op >> MethodHandleProxiesAsIFInstance.baselineCompute avgt 15 0.264 ? 0.006 ns/op >> MethodHandleProxiesAsIFInstance.testCall avgt 15 1.773 ? 0.040 ns/op >> MethodHandleProxiesAsIFInstance.testCreate avgt 15 16.754 ? 0.411 ns/op >> MethodHandleProxiesAsIFInstance.testCreateCall avgt 15 19.609 ? 1.598 ns/op >> MethodHandleProxiesAsIFInstanceCall.callDoable avgt 15 0.424 ? 0.024 ns/op >> MethodHandleProxiesAsIFInstanceCall.callHandle avgt 15 1.936 ? 0.008 ns/op >> MethodHandleProxiesAsIFInstanceCall.callInterfaceInstance avgt 15 1.766 ? 0.014 ns/op >> MethodHandleProxiesAsIFInstanceCall.callLambda avgt 15 0.414 ? 0.005 ns/op >> MethodHandleProxiesAsIFInstanceCall.constantDoable avgt 15 0.271 ? 0.006 ns/op >> MethodHandleProxiesAsIFInstanceCall.constantHandle avgt 15 0.263 ? 0.004 ns/op >> MethodHandleProxiesAsIFInstanceCall.constantInterfaceInstance avgt 15 0.266 ? 0.005 ns/op >> MethodHandleProxiesAsIFInstanceCall.constantLambda avgt 15 0.262 ? 0.003 ns/op >> MethodHandleProxiesAsIFInstanceCall.direct avgt 15 0.264 ? 0.005 ns/op >> MethodHandleProxiesAsIFInstanceCreate.createCallInterfaceInstance avgt 15 18.000 ? 0.181 ns/op >> MethodHandleProxiesAsIFInstanceCreat... > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > Whitespace, cleanup, rename benchmarks to be informative @JornVernee Thanks for your review! Updated per your comments and refined the benchmark as well. > I think the call benchmark could be fleshed out a bit more as well. It would be interesting to see these cases: > 1. direct call to `doWork` (this would be the baseline) > 2. call through non-constant method handle > 3. call through non-constant interface instance created with lambda (existing `lambdaCall`) > 4. call through non-constant interface instance created with MHP::asInterfaceInstance (existing `testCall`) > 5. call through constant (`static final`) method handle > 6. call through constant (`static final`) interface instance created with lambda > 7. call through constant (`static final`) interface instance created with MHP::asInterfaceInstance Here's the latest benchmark results: Benchmark Mode Cnt Score Error Units MethodHandleProxiesAsIFInstanceCall.callDoable avgt 15 0.609 ? 0.290 ns/op MethodHandleProxiesAsIFInstanceCall.callHandle avgt 15 1.952 ? 0.014 ns/op MethodHandleProxiesAsIFInstanceCall.callInterfaceInstance avgt 15 0.411 ? 0.005 ns/op MethodHandleProxiesAsIFInstanceCall.callLambda avgt 15 0.408 ? 0.002 ns/op MethodHandleProxiesAsIFInstanceCall.constantDoable avgt 15 0.260 ? 0.005 ns/op MethodHandleProxiesAsIFInstanceCall.constantHandle avgt 15 0.259 ? 0.004 ns/op MethodHandleProxiesAsIFInstanceCall.constantInterfaceInstance avgt 15 0.260 ? 0.007 ns/op MethodHandleProxiesAsIFInstanceCall.constantLambda avgt 15 0.257 ? 0.004 ns/op MethodHandleProxiesAsIFInstanceCall.direct avgt 15 0.256 ? 0.003 ns/op MethodHandleProxiesAsIFInstanceCreate.createCallInterfaceInstance avgt 15 22033.536 ? 3300.920 ns/op MethodHandleProxiesAsIFInstanceCreate.createCallLambda avgt 15 20081.732 ? 4523.516 ns/op MethodHandleProxiesAsIFInstanceCreate.createInterfaceInstance avgt 15 18523.812 ? 2585.683 ns/op MethodHandleProxiesAsIFInstanceCreate.createLambda avgt 15 19206.093 ? 4743.297 ns/op 1. call through constant all has similar performance as direct call 2. call through non-constant method handle is significantly slower over than others, as anticipated 3. call through non-constant interface instance created with lambda, MHP::asInterfaceInstance and anonymous class instance (Doable) have similar performance @DasBrain Thanks for the recommendation to test with SecurityManager, added a test and found two places that needs to do privileged indeed. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13197#issuecomment-1498450131 From xliu at openjdk.org Tue Jun 6 16:34:06 2023 From: xliu at openjdk.org (Xin Liu) Date: Tue, 6 Jun 2023 16:34:06 GMT Subject: RFR: 8284493: Improve computeNextExponential tail performance and accuracy In-Reply-To: <3gh4M864NnJhhWbV7CAj6HcmxGnf8SWTC2Q-uqhGe98=.209577f8-d69e-4794-944f-4379beecf2f7@github.com> References: <3gh4M864NnJhhWbV7CAj6HcmxGnf8SWTC2Q-uqhGe98=.209577f8-d69e-4794-944f-4379beecf2f7@github.com> Message-ID: On Wed, 6 Apr 2022 17:47:53 GMT, Chris Hennick wrote: > This PR improves both the worst-case performance of `nextExponential` and `nextGaussian` and the distribution of output at the tails. It fixes the following imperfections: > > * Repeatedly adding DoubleZigguratTables.exponentialX0 to extra causes a rounding error to accumulate at the tail of the distribution (probably starting around `2*exponentialX0 == 0x1.e46eff20739afp3 ~ 15.1`); this PR fixes that by tracking the multiple of exponentialX0 as a long. (This distortion is worst when `x > 0x1.0p56` since in that case, a rounding error means `extra + x == extra`. > * Reduces several equations using `Math.fma`. (This will almost certainly improve performance, and may or may not improve output distribution.) > * Uses the newly-extracted `computeWinsorizedNextExponential` function to prevent `nextGaussian` from going into the `nextExponential` tail twice. @Pr0methean is an employee of Amazon. ------------- PR Comment: https://git.openjdk.org/jdk/pull/8131#issuecomment-1090965245 From simonis at openjdk.org Tue Jun 6 16:34:06 2023 From: simonis at openjdk.org (Volker Simonis) Date: Tue, 6 Jun 2023 16:34:06 GMT Subject: RFR: 8284493: Improve computeNextExponential tail performance and accuracy In-Reply-To: <3gh4M864NnJhhWbV7CAj6HcmxGnf8SWTC2Q-uqhGe98=.209577f8-d69e-4794-944f-4379beecf2f7@github.com> References: <3gh4M864NnJhhWbV7CAj6HcmxGnf8SWTC2Q-uqhGe98=.209577f8-d69e-4794-944f-4379beecf2f7@github.com> Message-ID: On Wed, 6 Apr 2022 17:47:53 GMT, Chris Hennick wrote: > This PR improves both the worst-case performance of `nextExponential` and `nextGaussian` and the distribution of output at the tails. It fixes the following imperfections: > > * Repeatedly adding DoubleZigguratTables.exponentialX0 to extra causes a rounding error to accumulate at the tail of the distribution (probably starting around `2*exponentialX0 == 0x1.e46eff20739afp3 ~ 15.1`); this PR fixes that by tracking the multiple of exponentialX0 as a long. (This distortion is worst when `x > 0x1.0p56` since in that case, a rounding error means `extra + x == extra`. > * Reduces several equations using `Math.fma`. (This will almost certainly improve performance, and may or may not improve output distribution.) > * Uses the newly-extracted `computeWinsorizedNextExponential` function to prevent `nextGaussian` from going into the `nextExponential` tail twice. @robilad, can you please verify Chris Hennick's (@Pr0methean) OCA status? He's an Amazon employee and covered by Amazons OCA. ------------- PR Comment: https://git.openjdk.org/jdk/pull/8131#issuecomment-1099080229 From liach at openjdk.org Tue Jun 6 16:35:02 2023 From: liach at openjdk.org (Chen Liang) Date: Tue, 6 Jun 2023 16:35:02 GMT Subject: RFR: 8309413: Improve the performance of MethodTypeDesc::descriptorString [v2] In-Reply-To: References: Message-ID: On Sun, 26 Mar 2023 20:45:19 GMT, Chen Liang wrote: >> This patch aims to improve the performance of MethodTypeDesc in general, as it is currently a performance bottleneck in the Classfile API. A previous revision changed the parameter storage from an array to a list; this is dropped now. Sorry for the force push. >> >> >> Benchmark (descString) Mode Cnt Score Error Units >> MethodTypeDescFactories.descriptorString (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 27.778 ? 0.573 ns/op >> MethodTypeDescFactories.descriptorString ()V avgt 6 13.343 ? 0.235 ns/op >> MethodTypeDescFactories.descriptorString ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 40.828 ? 0.448 ns/op >> MethodTypeDescFactories.descriptorString ()[Ljava/lang/String; avgt 6 14.754 ? 0.162 ns/op >> MethodTypeDescFactories.ofArray (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 8.616 ? 0.132 ns/op >> MethodTypeDescFactories.ofArray ()V avgt 6 2.146 ? 0.293 ns/op >> MethodTypeDescFactories.ofArray ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 14.595 ? 0.235 ns/op >> MethodTypeDescFactories.ofArray ()[Ljava/lang/String; avgt 6 2.064 ? 0.085 ns/op >> MethodTypeDescFactories.ofDescriptor (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 97.077 ? 2.482 ns/op >> MethodTypeDescFactories.ofDescriptor ()V avgt 6 13.563 ? 0.111 ns/op >> MethodTypeDescFactories.ofDescriptor ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 130.543 ? 2.847 ns/op >> MethodTypeDescFactories.ofDescriptor ()[Ljava/lang/String; avgt 6 35.286 ? 0.260 ns/op >> MethodTypeDescFactories.ofList (Ljava/lang/Object;Ljava/lang/String;)I avgt 6 4.156 ? 0.258 ns/op >> MethodTypeDescFactories.ofList ()V avgt 6 2.192 ? 0.063 ns/op >> MethodTypeDescFactories.ofList ([IJLjava/lang/String;Z)Ljava/util/List; avgt 6 41.002 ? 0.235 ns/op >> MethodTypeDescFactories.ofList ()[Ljava/lang/String; avgt 6 2.200 ? 0.041 ns/op > > Chen Liang has updated the pull request incrementally with one additional commit since the last revision: > > Fix some inconsistencies in the method descriptor derivation methods Moved this patch to another issue that focus on converting the storage from array to immutable list. The fix for mutation is now a side effect of this patch. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13186#issuecomment-1522789129 From smarks at openjdk.org Tue Jun 6 16:49:39 2023 From: smarks at openjdk.org (Stuart Marks) Date: Tue, 6 Jun 2023 16:49:39 GMT Subject: RFR: 8307840: SequencedMap view method specification and implementation adjustments In-Reply-To: References: Message-ID: <-F6HytMIA0fBCP2R4Ag3sCQEF8KVfnB18nXflbuiPYg=.14f0e965-5c53-47f3-91a6-a995d824a1f2@github.com> On Tue, 6 Jun 2023 04:58:46 GMT, Jaikiran Pai wrote: >> Adjust the specification of the `SequencedMap` sequenced-view methods, and adjust implementations to match. > > src/java.base/share/classes/java/util/AbstractMap.java line 908: > >> 906: public boolean add(E t) { throw uoe(); } >> 907: public boolean addAll(Collection c) { throw uoe(); } >> 908: public void clear() { view().clear(); } > > Each of these methods should perhaps have the `@Override` to make it clear that these correspond to the interface this class is implementing. But I see that the `AbstractMap` class itself doesn't use `@Override` anywhere, so I think it's OK to keep it consistent in its current form in this PR. Yeah the collections classes are inconsistent about using `@Override`. Some maintainers (Martin Buchholz, Doug Lea) prefer not to use it at all. However, some usage has crept in from time to time. Personally I tend not to use it, as I think it adds a lot of clutter and doesn't provide much value. The main value this annotation provides detecting an incorrectly declared override (e.g., declaring an equals(Foo) method instead of equals(Object) method). In practice this doesn't seem to happen. These skeletons of these internal collection classes are usually auto-generated by an IDE, which won't make this mistake. The collections are usually pretty well tested so if something isn't overridden properly it will usually be caught. I'm considering ripping out all occurrences of `@Override` from collections and declaring the prevailing style not to use it. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14267#discussion_r1219984529 From jvernee at openjdk.org Tue Jun 6 17:01:25 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Tue, 6 Jun 2023 17:01:25 GMT Subject: RFR: 8308445: Linker should check that capture state segment is big enough Message-ID: Fix the bug mentioned in the JBS issue. The implementation is updated to slice the capture state segment using the capture state layout. This checks both that the segment is big enough, and that it is properly aligned. Additionally, I added a check for `MS::NULL` since this is also an illegal value we can catch early. Test cases are added for all three invalid values. Testing: `jdk_foreign` test suite. ------------- Commit messages: - Apply checks on capture state segment Changes: https://git.openjdk.org/jdk/pull/14339/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14339&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8308445 Stats: 48 lines in 4 files changed: 46 ins; 1 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14339.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14339/head:pull/14339 PR: https://git.openjdk.org/jdk/pull/14339 From smarks at openjdk.org Tue Jun 6 17:05:40 2023 From: smarks at openjdk.org (Stuart Marks) Date: Tue, 6 Jun 2023 17:05:40 GMT Subject: Integrated: 8307840: SequencedMap view method specification and implementation adjustments In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 16:18:12 GMT, Stuart Marks wrote: > Adjust the specification of the `SequencedMap` sequenced-view methods, and adjust implementations to match. This pull request has now been integrated. Changeset: 95261908 Author: Stuart Marks URL: https://git.openjdk.org/jdk/commit/952619086358326c2fb3fcbada654fc2edd09f07 Stats: 113 lines in 3 files changed: 64 ins; 3 del; 46 mod 8307840: SequencedMap view method specification and implementation adjustments Reviewed-by: darcy, alanb ------------- PR: https://git.openjdk.org/jdk/pull/14267 From smarks at openjdk.org Tue Jun 6 17:05:38 2023 From: smarks at openjdk.org (Stuart Marks) Date: Tue, 6 Jun 2023 17:05:38 GMT Subject: RFR: 8307840: SequencedMap view method specification and implementation adjustments In-Reply-To: <98fLhdNGS8lR2zjfCGVclbqpuizh5Bh2-F9_sBM_dwE=.a3ac2d37-219a-456e-8063-0c15fe460ecd@github.com> References: <98fLhdNGS8lR2zjfCGVclbqpuizh5Bh2-F9_sBM_dwE=.a3ac2d37-219a-456e-8063-0c15fe460ecd@github.com> Message-ID: On Tue, 6 Jun 2023 04:55:10 GMT, Jaikiran Pai wrote: >> Adjust the specification of the `SequencedMap` sequenced-view methods, and adjust implementations to match. > > src/java.base/share/classes/java/util/SequencedMap.java line 268: > >> 266: * Its {@link SequencedSet#reversed reversed} method returns the {@link >> 267: * #sequencedKeySet sequencedKeySet} view of the {@link #reversed reversed} view of >> 268: * this map. Each of its other methods calls the corresponding method of the {@link > > Hello Stuart, should this (and other similar places in this PR) instead be: > > Each of its other methods call > > call instead of calls? "Each" is usually considered singular so "Each ... calls" is proper. It looks weird though since the plural "methods" is right next to "calls." ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14267#discussion_r1220010473 From darcy at openjdk.org Tue Jun 6 17:15:34 2023 From: darcy at openjdk.org (Joe Darcy) Date: Tue, 6 Jun 2023 17:15:34 GMT Subject: RFR: JDK-8295071: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number [v4] In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 08:41:28 GMT, Alan Bateman wrote: > > "Latest Java class file format version recognized by the Java runtime as "MAJOR.MINOR" where MAJOR and MINOR are both formatted as decimal integers" > > Okay, and linking to ClassFileFormatVersion.latest() is good. > > Again, just to lobby for putting an adjective into the ClassFileFormatVersion.RELEASE_XX descriptions to make it clearer than the value is the latest version recognized rather than single version that the wording currently suggests. Okay, for the constants for 1.2 and later, I switched to "The version introduced by...". The 1.0.2 and 1.1 versions of the platform use the same class file format version. Explanatory apiNote for ClassFileFormatVersion also added. I don't think those are spec changes per se, so I didn't update the CSR to include them. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14305#discussion_r1220026016 From darcy at openjdk.org Tue Jun 6 17:15:32 2023 From: darcy at openjdk.org (Joe Darcy) Date: Tue, 6 Jun 2023 17:15:32 GMT Subject: RFR: JDK-8295071: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number [v4] In-Reply-To: References: Message-ID: > Document existing behavior. > > Please also review the CSR https://bugs.openjdk.org/browse/JDK-8309415 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 five additional commits since the last revision: - Respond to review feedback. - Merge branch 'master' into JDK-8295071 - Respond to review feedback. - Merge branch 'master' into JDK-8295071 - JDK-8309415: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14305/files - new: https://git.openjdk.org/jdk/pull/14305/files/33bb646b..018a5dc2 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14305&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14305&range=02-03 Stats: 1867 lines in 57 files changed: 1607 ins; 39 del; 221 mod Patch: https://git.openjdk.org/jdk/pull/14305.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14305/head:pull/14305 PR: https://git.openjdk.org/jdk/pull/14305 From psandoz at openjdk.org Tue Jun 6 17:16:36 2023 From: psandoz at openjdk.org (Paul Sandoz) Date: Tue, 6 Jun 2023 17:16:36 GMT Subject: RFR: 8306647: Implementation of Structured Concurrency (Preview) [v5] In-Reply-To: References: <6gZZEoP1WXdBcZUiL5890eNsgaRFzZNY_rBItZdXtNc=.5d8f7bd9-44d5-4074-8a5c-35f8203263b2@github.com> Message-ID: On Tue, 6 Jun 2023 07:13:15 GMT, Alan Bateman wrote: >> This is the implementation of: >> >> - JEP 453: Structured Concurrency (Preview) >> - JEP 446: Scoped Values (Preview) >> >> For the most part, this is just moving code and tests. StructuredTaskScope moves to j.u.concurrent as a preview API, ScopedValue moves to j.lang as a preview API, and module jdk.incubator.concurrent has been removed. The significant API changes since incubator are: >> >> - StructuredTaskScope.fork returns Subtask instead of Future (JEP 453 has a section on this) >> - ScopedValue.where methods are replaced with runWhere, callWhere and getWhere > > Alan Bateman has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 18 commits: > > - Fix typo in javadoc > - Merge > - Merge > - Sync up from loom repo > - Merge > - Sync with loom repo, re-work ScopedValue class description > - Sync up from loom repo > - Remove csm.Threads > - Merge > - Test should not be in update for main line > - ... and 8 more: https://git.openjdk.org/jdk/compare/2e9eff56...0f514588 Marked as reviewed by psandoz (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/13932#pullrequestreview-1465700542 From mcimadamore at openjdk.org Tue Jun 6 17:18:44 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Tue, 6 Jun 2023 17:18:44 GMT Subject: RFR: 8308445: Linker should check that capture state segment is big enough In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 16:22:41 GMT, Jorn Vernee wrote: > Fix the bug mentioned in the JBS issue. > > The implementation is updated to slice the capture state segment using the capture state layout. This checks both that the segment is big enough, and that it is properly aligned. > > Additionally, I added a check for `MS::NULL` since this is also an illegal value we can catch early. > > Test cases are added for all three invalid values. > > Testing: `jdk_foreign` test suite. Looks good src/java.base/share/classes/jdk/internal/foreign/abi/SharedUtils.java line 114: > 112: MH_CHECK_SYMBOL = lookup.findStatic(SharedUtils.class, "checkSymbol", > 113: methodType(void.class, MemorySegment.class)); > 114: MH_SLICE_CAPTURE_SEGMENT = lookup.findStatic(SharedUtils.class, "checkCaptureSegment", Is the name of the field correct? test/jdk/java/foreign/capturecallstate/TestCaptureCallState.java line 152: > 150: {Arena.ofAuto().allocate(1), IndexOutOfBoundsException.class, ".*Out of bound access on segment.*"}, > 151: {MemorySegment.NULL, IllegalArgumentException.class, ".*Capture segment is NULL.*"}, > 152: {Arena.ofAuto().allocate(Linker.Option.captureStateLayout().byteSize() + 3).asSlice(3), // misaligned This last one is very nice! ------------- Marked as reviewed by mcimadamore (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14339#pullrequestreview-1465703809 PR Review Comment: https://git.openjdk.org/jdk/pull/14339#discussion_r1220030249 PR Review Comment: https://git.openjdk.org/jdk/pull/14339#discussion_r1220033212 From jvernee at openjdk.org Tue Jun 6 17:18:45 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Tue, 6 Jun 2023 17:18:45 GMT Subject: RFR: 8308445: Linker should check that capture state segment is big enough In-Reply-To: References: Message-ID: <73Xv-7x2cHmxM5vnIuVkIRNr4evVgh0Xf0nzz7i1pS4=.b7f221dc-b4a7-4549-a33f-556248c27396@github.com> On Tue, 6 Jun 2023 17:13:23 GMT, Maurizio Cimadamore wrote: >> Fix the bug mentioned in the JBS issue. >> >> The implementation is updated to slice the capture state segment using the capture state layout. This checks both that the segment is big enough, and that it is properly aligned. >> >> Additionally, I added a check for `MS::NULL` since this is also an illegal value we can catch early. >> >> Test cases are added for all three invalid values. >> >> Testing: `jdk_foreign` test suite. > > src/java.base/share/classes/jdk/internal/foreign/abi/SharedUtils.java line 114: > >> 112: MH_CHECK_SYMBOL = lookup.findStatic(SharedUtils.class, "checkSymbol", >> 113: methodType(void.class, MemorySegment.class)); >> 114: MH_SLICE_CAPTURE_SEGMENT = lookup.findStatic(SharedUtils.class, "checkCaptureSegment", > > Is the name of the field correct? That's a leftover from an earlier version, will fix ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14339#discussion_r1220031575 From jvernee at openjdk.org Tue Jun 6 17:24:34 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Tue, 6 Jun 2023 17:24:34 GMT Subject: RFR: 8308445: Linker should check that capture state segment is big enough [v2] In-Reply-To: References: Message-ID: > Fix the bug mentioned in the JBS issue. > > The implementation is updated to slice the capture state segment using the capture state layout. This checks both that the segment is big enough, and that it is properly aligned. > > Additionally, I added a check for `MS::NULL` since this is also an illegal value we can catch early. > > Test cases are added for all three invalid values. > > Testing: `jdk_foreign` test suite. Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: rename MH field ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14339/files - new: https://git.openjdk.org/jdk/pull/14339/files/ccc35e63..9200f57f Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14339&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14339&range=00-01 Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/14339.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14339/head:pull/14339 PR: https://git.openjdk.org/jdk/pull/14339 From asemenov at openjdk.org Tue Jun 6 17:35:34 2023 From: asemenov at openjdk.org (Artem Semenov) Date: Tue, 6 Jun 2023 17:35:34 GMT Subject: RFR: 8308286 Fix clang warnings in linux code [v3] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 15:04:09 GMT, Weijun Wang wrote: >> done > > I didn't ask to revert the change. It's `s/TARGET_OS_MAC/defined(__APPLE__)/`. This is rarely used in the code and is not the essence of the current changes. If you introduce such changes, then throughout the code. Moreover, this can lead to problems, such as, for example, here: https://bugs.openjdk.org/browse/JDK-8309225 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14033#discussion_r1220056527 From weijun at openjdk.org Tue Jun 6 17:50:00 2023 From: weijun at openjdk.org (Weijun Wang) Date: Tue, 6 Jun 2023 17:50:00 GMT Subject: RFR: 8308286 Fix clang warnings in linux code [v3] In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 17:32:35 GMT, Artem Semenov wrote: >> I didn't ask to revert the change. It's `s/TARGET_OS_MAC/defined(__APPLE__)/`. > > This is rarely used in the code and is not the essence of the current changes. > If you introduce such changes, then throughout the code. > Moreover, this can lead to problems, such as, for example, here: https://bugs.openjdk.org/browse/JDK-8309225 I'm not a clang expect, I was just asking if modifying the current `#if TARGET_OS_MAC` check into `#if defined(__APPLE__)` is also a solution. The comment on lines 46-47 says the condition was copied from a macOS SDK file and that's what the file is using now. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14033#discussion_r1220071779 From alanb at openjdk.org Tue Jun 6 18:25:57 2023 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 6 Jun 2023 18:25:57 GMT Subject: RFR: JDK-8295071: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number [v4] In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 17:15:32 GMT, Joe Darcy wrote: >> Document existing behavior. >> >> Please also review the CSR https://bugs.openjdk.org/browse/JDK-8309415 > > 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 five additional commits since the last revision: > > - Respond to review feedback. > - Merge branch 'master' into JDK-8295071 > - Respond to review feedback. > - Merge branch 'master' into JDK-8295071 > - JDK-8309415: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14305#pullrequestreview-1465816431 From rriggs at openjdk.org Tue Jun 6 18:28:57 2023 From: rriggs at openjdk.org (Roger Riggs) Date: Tue, 6 Jun 2023 18:28:57 GMT Subject: RFR: JDK-8295071: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number [v4] In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 17:15:32 GMT, Joe Darcy wrote: >> Document existing behavior. >> >> Please also review the CSR https://bugs.openjdk.org/browse/JDK-8309415 > > 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 five additional commits since the last revision: > > - Respond to review feedback. > - Merge branch 'master' into JDK-8295071 > - Respond to review feedback. > - Merge branch 'master' into JDK-8295071 > - JDK-8309415: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number The updated descriptions of major and minor look good. ------------- Marked as reviewed by rriggs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14305#pullrequestreview-1465821521 From darcy at openjdk.org Tue Jun 6 18:37:04 2023 From: darcy at openjdk.org (Joe Darcy) Date: Tue, 6 Jun 2023 18:37:04 GMT Subject: Integrated: JDK-8295071: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number In-Reply-To: References: Message-ID: <4rvM3xehe3wZ4xAOW2b1CZnZsB5a0iCf13QFCof9Re8=.5325bb0b-f7a7-4328-9c6c-a417b3d676ac@github.com> On Mon, 5 Jun 2023 01:11:54 GMT, Joe Darcy wrote: > Document existing behavior. > > Please also review the CSR https://bugs.openjdk.org/browse/JDK-8309415 This pull request has now been integrated. Changeset: d82436e4 Author: Joe Darcy URL: https://git.openjdk.org/jdk/commit/d82436e4e33a33b1a2ea5ad01c7370ccaf4eb2c5 Stats: 31 lines in 2 files changed: 10 ins; 0 del; 21 mod 8295071: Spec Clarification : ClassFileFormatVersion: System property java.class.version | Java class format version number Reviewed-by: iris, alanb, rriggs ------------- PR: https://git.openjdk.org/jdk/pull/14305 From jrose at openjdk.org Tue Jun 6 18:51:00 2023 From: jrose at openjdk.org (John R Rose) Date: Tue, 6 Jun 2023 18:51:00 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v3] In-Reply-To: References: <_V0eAue8-9jim47bfCMBJj04CxR8flt1ZH33dQNswcM=.08fbe5a4-3839-4128-add8-e7649411a426@github.com> Message-ID: On Tue, 6 Jun 2023 18:45:50 GMT, Erik ?sterlund wrote: >> For hotspot, when GC occurs, it causes all threads to run to the nearest safepoint and then freeze. Generally, safepoints are generated at branch jumps, method ends(ret instructions), loops instructions, and so on. Therefore, the purpose of this patch is to make the creation and use of a softReferences in the same method without branch, jumps and loops in between, that is ensure that GC will not occur in the process of the sofeReferences be created and used. >> >> That's why I didn't use `Reference.reachabilityFence(locale)`. > > This reasoning seems invalid. There are method calls in there, and you rely on inlining heuristics for this not to break. Please use reachabilityFence instead. It appears you are assuming that some combination of bytecodes constitutes a critical section that excludes the GC. But the JVMS makes no guarantees about GC exclusion across bytecodes. A thread can be pre-empted at any bytecode (even in the middle of a bytecode). Another thread can trigger a GC. Maybe the first thread will be rolled forward to a place convenient to the JVM, but you cannot predict what that will be, because the JVMS does not give you any contract about that matter. For example, some JITs deoptimize (branch to the interpreter) at unpredictable points for reasons no Java programmer should ever think about (because it?s not in the JVMS contract). Deoptimizing can allocate storage (for example, to materialize objects whose allocation was deferred by escape analysis). Thus, it is not safe to assume that any particular bytecode is immune from GC. Also, some JITs (like C2) inject synthetic safepoints injected as part of arbitrarily complex loop transformations. A GC at such a safepoint might possibly appear to be tied to a bytecode which is simply a fall-through from a previous bytecode. This can happen if the loop is rotated, and a fallthrough point begins to function as a back-branch in the IR. The rule of thumb for non-JIT engineers is, if you find yourself trying to predict what how ?the JIT must work?, stop. The net of this is that, if you need to preserve an object across a critical section, don?t try to read the JIT?s mind or expect it to read yours. Put in a reachability fence that spans that critical section. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14211#discussion_r1220148743 From eosterlund at openjdk.org Tue Jun 6 18:50:59 2023 From: eosterlund at openjdk.org (Erik =?UTF-8?B?w5ZzdGVybHVuZA==?=) Date: Tue, 6 Jun 2023 18:50:59 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v3] In-Reply-To: <_V0eAue8-9jim47bfCMBJj04CxR8flt1ZH33dQNswcM=.08fbe5a4-3839-4128-add8-e7649411a426@github.com> References: <_V0eAue8-9jim47bfCMBJj04CxR8flt1ZH33dQNswcM=.08fbe5a4-3839-4128-add8-e7649411a426@github.com> Message-ID: On Tue, 6 Jun 2023 02:31:19 GMT, SUN Guoyun wrote: >> I still don't see a clear explanation of how the proposed patch fixes the problem. Also, I would appreciate the reasoning in the comments. > > For hotspot, when GC occurs, it causes all threads to run to the nearest safepoint and then freeze. Generally, safepoints are generated at branch jumps, method ends(ret instructions), loops instructions, and so on. Therefore, the purpose of this patch is to make the creation and use of a softReferences in the same method without branch, jumps and loops in between, that is ensure that GC will not occur in the process of the sofeReferences be created and used. > > That's why I didn't use `Reference.reachabilityFence(locale)`. This reasoning seems invalid. There are method calls in there, and you rely on inlining heuristics for this not to break. Please use reachabilityFence instead. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14211#discussion_r1220145376 From psandoz at openjdk.org Tue Jun 6 21:32:59 2023 From: psandoz at openjdk.org (Paul Sandoz) Date: Tue, 6 Jun 2023 21:32:59 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: References: <6lpkAjfDuU46l1k6iDWwuNhFgaxkLICRQNv5Sxh3U-Q=.957d4c50-5ee9-468c-b092-248dfbd56153@github.com> Message-ID: On Fri, 2 Jun 2023 19:09:49 GMT, Mandy Chung wrote: > > I wonder if it is possible to transition from an lazy (indirect) VH to a direct VH once initialized i.e., `checkAccessModeThenIsDirect` returns the value of `initialized`. > > Sounds a good idea. Once the class is initialized, the lazy VH becomes a direct VH that may help the performance. In that case, the VarHandleGuards would need to ensure it links with the direct VH not the lazy VH. I believe instead of changing the guards we can change the implementation of the static methods on the concrete static VHs to call `asDirect()` (lets also add `@ForceInline` on `asDirect`), since `linkToStatic` will pass the args to the static method described by the member name (since the lazy and direct VH handles share the same var form). That has the nice effect of pushing the complexity closer to where it is needed. Its subtle but i think can be explained. Thereby we can reduce the memory footprint for subsequent access modes. Perhaps we can even "zero" out the MH cache on initialization? ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1579476316 From liach at openjdk.org Tue Jun 6 22:37:59 2023 From: liach at openjdk.org (Chen Liang) Date: Tue, 6 Jun 2023 22:37:59 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: References: <6lpkAjfDuU46l1k6iDWwuNhFgaxkLICRQNv5Sxh3U-Q=.957d4c50-5ee9-468c-b092-248dfbd56153@github.com> Message-ID: On Tue, 6 Jun 2023 21:29:49 GMT, Paul Sandoz wrote: > I believe instead of changing the guards we can change the implementation of the static methods on the concrete static VHs to call `asDirect()` (lets also add `@ForceInline` on `asDirect`), since `linkToStatic` will pass the args to the static method described by the member name (since the lazy and direct VH handles share the same var form). > > That has the nice effect of pushing the complexity closer to where it is needed. Its subtle but i think can be explained. Thereby we can reduce the memory footprint for subsequent access modes. Perhaps we can even "zero" out the MH cache on initialization? Is this aimed at decreasing long-term invocation cost or the initial invocation cost? FYI long-term invocation is already efficient enough; if this is for initial invocation, which can potentially bypass costly MH construction, I recommend creating an alternative method to `asDirect` for the purpose to be called and casted by X-VarHandle implementations. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1579550628 From dnsimon at openjdk.org Tue Jun 6 23:04:55 2023 From: dnsimon at openjdk.org (Doug Simon) Date: Tue, 6 Jun 2023 23:04:55 GMT Subject: RFR: 8309390: [JVMCI] improve copying system properties into libgraal In-Reply-To: <1vHZFp-j2AKjYTX2bd_1RxQ2Ix252OCbqJ0m-AGaVTs=.b64ea885-8b22-45ad-8a76-b041a764a5de@github.com> References: <9bsjzlbHK31VVyGwzyhpSBjSILWFxmAX0IfiWK6Wb_w=.197d2b45-dba5-43bc-ac4e-4f993d3e777a@github.com> <1vHZFp-j2AKjYTX2bd_1RxQ2Ix252OCbqJ0m-AGaVTs=.b64ea885-8b22-45ad-8a76-b041a764a5de@github.com> Message-ID: On Mon, 5 Jun 2023 18:58:36 GMT, Tom Rodriguez wrote: > I don't really love the hard code parsing of the HashMap. What properties are actually required for JVMCI? It seems to me that the contents of Arguments::system_properties() should contain all the properties we want to advertise to JVMCI. That would have avoid having to decode them after they've been converted into Java objects. I tired this but unfortunately, Graal relies on some properties that are only initialized in Java: Caused by: java.lang.NullPointerException: Cannot invoke "String.compareTo(String)" because "this.javaSpecVersion" is null at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.JVMCIVersionCheck.run(JVMCIVersionCheck.java:181) at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.JVMCIVersionCheck.check(JVMCIVersionCheck.java:166) at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.initialize(HotSpotGraalCompilerFactory.java:117) at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.ensureInitialized(HotSpotGraalCompilerFactory.java:90) at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:180) at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:53) at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.getCompiler(HotSpotJVMCIRuntime.java:810) at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.GraalAccess.(GraalAccess.java:50) That code is reading the "java.specification.version" property which is initialized in `java.lang.VersionProps#init`. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14291#issuecomment-1579573072 From psandoz at openjdk.org Wed Jun 7 00:13:56 2023 From: psandoz at openjdk.org (Paul Sandoz) Date: Wed, 7 Jun 2023 00:13:56 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: References: <6lpkAjfDuU46l1k6iDWwuNhFgaxkLICRQNv5Sxh3U-Q=.957d4c50-5ee9-468c-b092-248dfbd56153@github.com> Message-ID: <-kOBGesTZAI0Gq7kG8AlOYlyilTDv03nIAi9mpuDv7s=.258247ca-a044-4407-b2df-e86fae1b22b4@github.com> On Tue, 6 Jun 2023 22:34:57 GMT, Chen Liang wrote: > Is this aimed at decreasing long-term invocation cost or the initial invocation cost? FYI long-term invocation is already efficient enough; if this is for initial invocation, which can potentially bypass costly MH construction, I recommend creating an alternative method to `asDirect` for the purpose to be called and casted by X-VarHandle implementations. It aims to reduce the cost of getting to peak performance (the work that C2 has to perform) and reduce the overall memory footprint of such VHs (as long as the user does not explicitly request MHs from them). Assuming of course that the peak performance is good! For this pattern i not sure we need to create another method returning the target that effectively does the same as `asDirect`, and instead it may come down to better naming and documentation of the concepts. There is already a tight coupling between the `LazyInitializingVarHandle` and its target via the sharing of the var forms. Renaming `asDirect` to `target` might do it, and we refine a what a direct handle is to mean the guards just pass along the handle that is given to it, otherwise we use a (lazily created) method handle to its target. Thereby a VH implementation free to switch between indirect and direct and is further free to deal with any implementation specific indirection in its own implementation. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1579631030 From never at openjdk.org Wed Jun 7 00:15:57 2023 From: never at openjdk.org (Tom Rodriguez) Date: Wed, 7 Jun 2023 00:15:57 GMT Subject: RFR: 8309390: [JVMCI] improve copying system properties into libgraal In-Reply-To: <9bsjzlbHK31VVyGwzyhpSBjSILWFxmAX0IfiWK6Wb_w=.197d2b45-dba5-43bc-ac4e-4f993d3e777a@github.com> References: <9bsjzlbHK31VVyGwzyhpSBjSILWFxmAX0IfiWK6Wb_w=.197d2b45-dba5-43bc-ac4e-4f993d3e777a@github.com> Message-ID: On Fri, 2 Jun 2023 20:32:14 GMT, Doug Simon wrote: > This PR improves the startup time for libgraal by speeding up how `VM.savedProps` is copied into libgraal. This data structure is now serialized to a native buffer directly from C++ and the native buffer is then directly decoded by libgraal. > > ## Times > > The basic benchmarking below shows that this change brings the time for a nop Java app with eager libgraal initialization (2) down to almost the same time as lazy libgraal initialization (1). The latter typically means no libgraal initialization happens as a top tier JIT compilation is never scheduled in such a short running app. > > > public class Nop { > public static void main(String[] args) {} > } > > > (1) Baseline (no options): > >> for i in (seq 10); java Nop; end > 0.05 real 0.04 user 0.01 sys > 0.04 real 0.03 user 0.01 sys > 0.04 real 0.03 user 0.01 sys > 0.04 real 0.03 user 0.01 sys > 0.03 real 0.03 user 0.00 sys > 0.04 real 0.03 user 0.01 sys > 0.04 real 0.03 user 0.00 sys > 0.03 real 0.03 user 0.00 sys > 0.04 real 0.03 user 0.01 sys > 0.03 real 0.03 user 0.00 sys > > > (2) Eagerly initialize libgraal (with PR): > >> for i in (seq 10); /usr/bin/time java -XX:+EagerJVMCI Nop; end > 0.06 real 0.04 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > > > (3) Eagerly initialize libgraal (without PR): > >> for i in (seq 10); /usr/bin/time java -XX:+EagerJVMCI Nop; end > 0.11 real 0.08 user 0.02 sys > 0.08 real 0.06 user 0.01 sys > 0.08 real 0.07 user 0.01 sys > 0.10 real 0.07 user 0.01 sys > 0.08 real 0.06 user 0.01 sys > 0.10 real 0.07 user 0.01 sys > 0.08 real 0.07 user 0.01 sys > 0.08 real 0.07 user 0.01 sys > 0.08 real 0.06 user 0.01 sys > 0.08 real ... HotSpot sets `java.vm.specification.version` which has the same value so we could change Graal to read that instead. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14291#issuecomment-1579632648 From duke at openjdk.org Wed Jun 7 01:53:04 2023 From: duke at openjdk.org (SUN Guoyun) Date: Wed, 7 Jun 2023 01:53:04 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v5] In-Reply-To: References: Message-ID: > command: make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp" TEST=gc/TestAllocHumongousFragment.java > error info: > > Caused by: java.lang.NullPointerException: Cannot invoke "sun.util.locale.BaseLocale.getVariant()" because "base" is null > at java.base/java.util.Locale.forLanguageTag(Locale.java:1802) > at java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.(CLDRBaseLocaleDataMetaInfo.java:41) > ... 24 more > > Note that the test runs with -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot and SoftReferences are involved (LocaleObjectCache uses SoftReferences, used by printf method called in getRandomInstance(Utils.java:511)). > > Maybe we have to deal with the case where the getBaseLocale() return value is null. the call stack is: > > at java.base/sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:64) > at java.base/sun.util.locale.BaseLocale.getInstance(BaseLocale.java:169) > at java.base/sun.util.locale.InternalLocaleBuilder.getBaseLocale(InternalLocaleBuilder.java:524) > at java.base/java.util.Locale.forLanguageTag(Locale.java:1874) > > in LocaleObjectCache.java:64 > > 62 if (key == null || newVal == null) { > 63 // subclass must return non-null key/value object > 64 return null; // run here > 65 } SUN Guoyun has updated the pull request incrementally with one additional commit since the last revision: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14211/files - new: https://git.openjdk.org/jdk/pull/14211/files/75fd5951..d133a15c Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14211&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14211&range=03-04 Stats: 4 lines in 1 file changed: 3 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14211.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14211/head:pull/14211 PR: https://git.openjdk.org/jdk/pull/14211 From smarks at openjdk.org Wed Jun 7 01:53:05 2023 From: smarks at openjdk.org (Stuart Marks) Date: Wed, 7 Jun 2023 01:53:05 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v3] In-Reply-To: References: <_V0eAue8-9jim47bfCMBJj04CxR8flt1ZH33dQNswcM=.08fbe5a4-3839-4128-add8-e7649411a426@github.com> Message-ID: <0SrlLvQQ8ZSU8I8y89VnPDy_DbLtS-_iqYDfiO2yoSM=.06cf5806-221b-47f1-b4f3-4a44655d5e2a@github.com> On Tue, 6 Jun 2023 18:48:35 GMT, John R Rose wrote: >> This reasoning seems invalid. There are method calls in there, and you rely on inlining heuristics for this not to break. Please use reachabilityFence instead. > > It appears you are assuming that some combination of bytecodes constitutes a critical section that excludes the GC. But the JVMS makes no guarantees about GC exclusion across bytecodes. > > A thread can be pre-empted at any bytecode (even in the middle of a bytecode). Another thread can trigger a GC. Maybe the first thread will be rolled forward to a place convenient to the JVM, but you cannot predict what that will be, because the JVMS does not give you any contract about that matter. > > For example, some JITs deoptimize (branch to the interpreter) at unpredictable points for reasons no Java programmer should ever think about (because it?s not in the JVMS contract). Deoptimizing can allocate storage (for example, to materialize objects whose allocation was deferred by escape analysis). Thus, it is not safe to assume that any particular bytecode is immune from GC. > > Also, some JITs (like C2) inject synthetic safepoints injected as part of arbitrarily complex loop transformations. A GC at such a safepoint might possibly appear to be tied to a bytecode which is simply a fall-through from a previous bytecode. This can happen if the loop is rotated, and a fallthrough point begins to function as a back-branch in the IR. > > The rule of thumb for non-JIT engineers is, if you find yourself trying to predict what how ?the JIT must work?, stop. > > The net of this is that, if you need to preserve an object across a critical section, don?t try to read the JIT?s mind or expect it to read yours. Put in a reachability fence that spans that critical section. I don't know what the right fix for this is. If it involves reachabilityFence, then a try-finally statement should be used, with the "critical section" being within the try-clause and the reachabilityFence within the finally-clause. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14211#discussion_r1220682487 From liach at openjdk.org Wed Jun 7 02:03:41 2023 From: liach at openjdk.org (Chen Liang) Date: Wed, 7 Jun 2023 02:03:41 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v9] In-Reply-To: References: Message-ID: > Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. > > A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. > > Current problems: > - [ ] The lazy var handle is quite slow on the first invocation. > - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. > - After that, the lazy handle has a performance on par with the regular var handle. > - [ ] The class-loading-based test is not in a unit test > - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading > > > Benchmark Mode Cnt Score Error Units > VarHandleLazyStaticInvocation.initializedInvocation avgt 30 0.817 ? 0.012 ns/op > VarHandleLazyStaticInvocation.lazyInvocation avgt 30 0.805 ? 0.007 ns/op > > > Benchmark Mode Cnt Score Error Units > Benchmark Mode Cnt Score Error Units > LazyStaticColdStart.methodHandleCreateEager ss 10 36.890 ? 2.891 us/op > LazyStaticColdStart.methodHandleCreateLazy ss 10 18.340 ? 1.537 us/op > LazyStaticColdStart.methodHandleInitializeCallEager ss 10 50.000 ? 5.590 us/op > LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 90.550 ? 10.142 us/op > LazyStaticColdStart.varHandleCreateEager ss 10 36.610 ? 2.685 us/op > LazyStaticColdStart.varHandleCreateLazy ss 10 18.200 ? 1.811 us/op > LazyStaticColdStart.varHandleInitializeCallEager ss 10 71.680 ? 11.097 us/op > LazyStaticColdStart.varHandleInitializeCallLazy ss 10 72.090 ? 4.494 us/op 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 19 additional commits since the last revision: - Merge branch 'master' into lazy-static-varhandle - Significantly improve Lazy VH initial call performance - Rename asDirect to target - Merge branch 'master' into lazy-static-varhandle - Improve subsequent VH call performance, thanks exeboss - Remove lazy init of MH, for all invocation of the Lazy VH needs this MH - Fix withBehavior and test - Merge branch 'master' into lazy-static-varhandle - Compute base and offset right after linking, simplify code - Merge branch 'master' into lazy-static-varhandle - ... and 9 more: https://git.openjdk.org/jdk/compare/7c776661...f414e8f8 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13821/files - new: https://git.openjdk.org/jdk/pull/13821/files/dc3e73e9..f414e8f8 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13821&range=08 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13821&range=07-08 Stats: 8687 lines in 195 files changed: 6695 ins; 711 del; 1281 mod Patch: https://git.openjdk.org/jdk/pull/13821.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13821/head:pull/13821 PR: https://git.openjdk.org/jdk/pull/13821 From liach at openjdk.org Wed Jun 7 02:03:43 2023 From: liach at openjdk.org (Chen Liang) Date: Wed, 7 Jun 2023 02:03:43 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: <-kOBGesTZAI0Gq7kG8AlOYlyilTDv03nIAi9mpuDv7s=.258247ca-a044-4407-b2df-e86fae1b22b4@github.com> References: <6lpkAjfDuU46l1k6iDWwuNhFgaxkLICRQNv5Sxh3U-Q=.957d4c50-5ee9-468c-b092-248dfbd56153@github.com> <-kOBGesTZAI0Gq7kG8AlOYlyilTDv03nIAi9mpuDv7s=.258247ca-a044-4407-b2df-e86fae1b22b4@github.com> Message-ID: On Wed, 7 Jun 2023 00:10:59 GMT, Paul Sandoz wrote: >>> I believe instead of changing the guards we can change the implementation of the static methods on the concrete static VHs to call `asDirect()` (lets also add `@ForceInline` on `asDirect`), since `linkToStatic` will pass the args to the static method described by the member name (since the lazy and direct VH handles share the same var form). >>> >>> That has the nice effect of pushing the complexity closer to where it is needed. Its subtle but i think can be explained. Thereby we can reduce the memory footprint for subsequent access modes. Perhaps we can even "zero" out the MH cache on initialization? >> >> Is this aimed at decreasing long-term invocation cost or the initial invocation cost? FYI long-term invocation is already efficient enough; if this is for initial invocation, which can potentially bypass costly MH construction, I recommend creating an alternative method to `asDirect` for the purpose to be called and casted by X-VarHandle implementations. > >> Is this aimed at decreasing long-term invocation cost or the initial invocation cost? FYI long-term invocation is already efficient enough; if this is for initial invocation, which can potentially bypass costly MH construction, I recommend creating an alternative method to `asDirect` for the purpose to be called and casted by X-VarHandle implementations. > > It aims to reduce the cost of getting to peak performance (the work that C2 has to perform) and reduce the overall memory footprint of such VHs (as long as the user does not explicitly request MHs from them). Assuming of course that the peak performance is good! > > For this pattern i not sure we need to create another method returning the target that effectively does the same as `asDirect`, and instead it may come down to better naming and documentation of the concepts. > > There is already a tight coupling between the `LazyInitializingVarHandle` and its target via the sharing of the var forms. Renaming `asDirect` to `target` might do it, and we refine a what a direct handle is to mean the guards just pass along the handle that is given to it, otherwise we use a (lazily created) method handle to its target. Thereby a VH implementation free to switch between indirect and direct and is further free to deal with any implementation specific indirection in its own implementation. @PaulSandoz Thank you for your suggestion! It might be harder to measure the time to get to peak performance, but at least for the initial invocation, the lazy VH is almost no different from the eager VH now. The old overhead was mostly from LambdaForm spinning, same for the lazy DMH overhead. Is this what you've envisioned? ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1579742481 From darcy at openjdk.org Wed Jun 7 02:52:24 2023 From: darcy at openjdk.org (Joe Darcy) Date: Wed, 7 Jun 2023 02:52:24 GMT Subject: RFR: JDK-8309574: Improve core reflection tests for JEP 445 Message-ID: Add some basic core reflections tests for unnamed classes. ------------- Commit messages: - JDK-8309574: Improve core reflection tests for JEP 445 Changes: https://git.openjdk.org/jdk/pull/14345/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14345&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309574 Stats: 99 lines in 2 files changed: 95 ins; 0 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/14345.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14345/head:pull/14345 PR: https://git.openjdk.org/jdk/pull/14345 From duke at openjdk.org Wed Jun 7 03:37:26 2023 From: duke at openjdk.org (SUN Guoyun) Date: Wed, 7 Jun 2023 03:37:26 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v6] In-Reply-To: References: Message-ID: > command: make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp" TEST=gc/TestAllocHumongousFragment.java > error info: > > Caused by: java.lang.NullPointerException: Cannot invoke "sun.util.locale.BaseLocale.getVariant()" because "base" is null > at java.base/java.util.Locale.forLanguageTag(Locale.java:1802) > at java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.(CLDRBaseLocaleDataMetaInfo.java:41) > ... 24 more > > Note that the test runs with -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot and SoftReferences are involved (LocaleObjectCache uses SoftReferences, used by printf method called in getRandomInstance(Utils.java:511)). > > Maybe we have to deal with the case where the getBaseLocale() return value is null. the call stack is: > > at java.base/sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:64) > at java.base/sun.util.locale.BaseLocale.getInstance(BaseLocale.java:169) > at java.base/sun.util.locale.InternalLocaleBuilder.getBaseLocale(InternalLocaleBuilder.java:524) > at java.base/java.util.Locale.forLanguageTag(Locale.java:1874) > > in LocaleObjectCache.java:64 > > 62 if (key == null || newVal == null) { > 63 // subclass must return non-null key/value object > 64 return null; // run here > 65 } SUN Guoyun has updated the pull request incrementally with one additional commit since the last revision: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14211/files - new: https://git.openjdk.org/jdk/pull/14211/files/d133a15c..98a8bd62 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14211&range=05 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14211&range=04-05 Stats: 6 lines in 1 file changed: 3 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/14211.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14211/head:pull/14211 PR: https://git.openjdk.org/jdk/pull/14211 From duke at openjdk.org Wed Jun 7 03:37:26 2023 From: duke at openjdk.org (SUN Guoyun) Date: Wed, 7 Jun 2023 03:37:26 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v3] In-Reply-To: References: <_V0eAue8-9jim47bfCMBJj04CxR8flt1ZH33dQNswcM=.08fbe5a4-3839-4128-add8-e7649411a426@github.com> Message-ID: On Tue, 6 Jun 2023 18:45:50 GMT, Erik ?sterlund wrote: >> For hotspot, when GC occurs, it causes all threads to run to the nearest safepoint and then freeze. Generally, safepoints are generated at branch jumps, method ends(ret instructions), loops instructions, and so on. Therefore, the purpose of this patch is to make the creation and use of a softReferences in the same method without branch, jumps and loops in between, that is ensure that GC will not occur in the process of the sofeReferences be created and used. >> >> That's why I didn't use `Reference.reachabilityFence(locale)`. > > This reasoning seems invalid. There are method calls in there, and you rely on inlining heuristics for this not to break. Please use reachabilityFence instead. Thanks @fisk @rose00 for the explanation. This patch is indeed based on the idea that small functions are inlined, cause `-Xcomp` be used, and I have seen with parameter `-XX:+PrintCompilation -XX:+PrintInlining` that functions `Key::` and `getBaseLocale` are inlined. But as @rose00 say, it's not safe, so reachabilityFence should be used. please review again. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14211#discussion_r1220780841 From jpai at openjdk.org Wed Jun 7 06:34:57 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 7 Jun 2023 06:34:57 GMT Subject: RFR: 8301569: list mode of jmod and jimage cannot be used normally in turkish locale In-Reply-To: References: Message-ID: On Wed, 31 May 2023 19:46:57 GMT, Glavo wrote: > > Hello @Glavo, I see you reopened this PR, so I'm guessing you are still interested in pursuing this further. Are you considering updating this PR to implement Alan's suggestion to do similar changes in `JImageTask.java` and `JlinkTask.java` to use `Locale.ROOT` or update this proposed change to use `Locale.ENGLISH`? > > @jaikiran Hi Jaikiran, as my previous reply, I do not agree that `Locale.ENGLISH` should be used here, I think `Locale.ROOT` is more reasonable. Sounds fine to me and as other have agreed `Locale.ROOT` would be more appropriate. Would you be willing to update this PR to update the few other occurences in some classes (`JImageTask`, `JlinkTask` and `VersionPropsPlugin`) as noted by Mandy and Alan in their comments? ------------- PR Comment: https://git.openjdk.org/jdk/pull/12281#issuecomment-1579985432 From alanb at openjdk.org Wed Jun 7 06:44:13 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 7 Jun 2023 06:44:13 GMT Subject: Integrated: 8306647: Implementation of Structured Concurrency (Preview) In-Reply-To: <6gZZEoP1WXdBcZUiL5890eNsgaRFzZNY_rBItZdXtNc=.5d8f7bd9-44d5-4074-8a5c-35f8203263b2@github.com> References: <6gZZEoP1WXdBcZUiL5890eNsgaRFzZNY_rBItZdXtNc=.5d8f7bd9-44d5-4074-8a5c-35f8203263b2@github.com> Message-ID: On Thu, 11 May 2023 13:08:55 GMT, Alan Bateman wrote: > This is the implementation of: > > - JEP 453: Structured Concurrency (Preview) > - JEP 446: Scoped Values (Preview) > > For the most part, this is just moving code and tests. StructuredTaskScope moves to j.u.concurrent as a preview API, ScopedValue moves to j.lang as a preview API, and module jdk.incubator.concurrent has been removed. The significant API changes since incubator are: > > - StructuredTaskScope.fork returns Subtask instead of Future (JEP 453 has a section on this) > - ScopedValue.where methods are replaced with runWhere, callWhere and getWhere This pull request has now been integrated. Changeset: f1c7afcc Author: Alan Bateman URL: https://git.openjdk.org/jdk/commit/f1c7afcc3fe39622c33ac7bac1ebdd9f96fa333d Stats: 9229 lines in 40 files changed: 4856 ins; 4315 del; 58 mod 8306647: Implementation of Structured Concurrency (Preview) 8306572: Implementation of Scoped Values (Preview) Co-authored-by: Alan Bateman Co-authored-by: Andrew Haley Reviewed-by: psandoz, dfuchs, mchung ------------- PR: https://git.openjdk.org/jdk/pull/13932 From avu at openjdk.org Wed Jun 7 07:00:59 2023 From: avu at openjdk.org (Alexey Ushakov) Date: Wed, 7 Jun 2023 07:00:59 GMT Subject: RFR: 8308286 Fix clang warnings in linux code [v4] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 15:01:37 GMT, Artem Semenov wrote: >> When using the clang compiler to build OpenJDk on Linux, we encounter various "warnings as errors". >> They can be fixed with small changes. > > Artem Semenov has updated the pull request incrementally with one additional commit since the last revision: > > update Marked as reviewed by avu (Committer). The latest changes look good to me. ------------- PR Review: https://git.openjdk.org/jdk/pull/14033#pullrequestreview-1466776433 PR Comment: https://git.openjdk.org/jdk/pull/14033#issuecomment-1580043192 From duke at openjdk.org Wed Jun 7 08:16:19 2023 From: duke at openjdk.org (Nagata-Haruhito) Date: Wed, 7 Jun 2023 08:16:19 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v8] In-Reply-To: References: Message-ID: > I fixed File.listRoots description. > * remove "the insertion or ejection of removable media" > * change "available" to "existing" > > Please review this change. Nagata-Haruhito has updated the pull request incrementally with one additional commit since the last revision: Refer review comment ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13526/files - new: https://git.openjdk.org/jdk/pull/13526/files/3d4aed98..840cd7dc Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13526&range=07 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13526&range=06-07 Stats: 3 lines in 2 files changed: 2 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/13526.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13526/head:pull/13526 PR: https://git.openjdk.org/jdk/pull/13526 From duke at openjdk.org Wed Jun 7 08:16:35 2023 From: duke at openjdk.org (Nagata-Haruhito) Date: Wed, 7 Jun 2023 08:16:35 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v7] In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 18:04:09 GMT, Brian Burkhalter wrote: >> Nagata-Haruhito has updated the pull request incrementally with one additional commit since the last revision: >> >> Move SecurityException paragraph > > src/java.base/share/classes/java/io/File.java line 1821: > >> 1819: * root directories of the available filesystem roots. It is guaranteed >> 1820: * that the canonical pathname of any file physically present on the local >> 1821: * machine will begin with one of the roots returned by this method. > > @Nagata-Haruhito Per @AlanBateman 's suggestion, would you please add this sentence > > ?There is no guarantee that the root directory can be accessed? > > or the equivalent here after ?returned by this method? and after the sentence that begins with ?A file system ...? in the specification of `java.nio.file.FileSystem::getRootDirectories` and so update this PR? > > Thanks. Thanks for your advice. I changed description as your advice. I will publish CSR with this change. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13526#discussion_r1221124434 From asotona at openjdk.org Wed Jun 7 08:20:03 2023 From: asotona at openjdk.org (Adam Sotona) Date: Wed, 7 Jun 2023 08:20:03 GMT Subject: RFR: 8304425: ClassHierarchyResolver from Reflection [v8] In-Reply-To: References: <08Hy6pEhV75yr_F4mCP-dkKOKMCSoFxWI2E7OnM4iyQ=.cfa14992-8e94-4d6d-bdf9-e6689549c83e@github.com> Message-ID: On Fri, 2 Jun 2023 03:36:35 GMT, Chen Liang wrote: >> Add API to explore Class Hierarchy with a `ClassLoader` or a `Lookup` with proper privileges, with tests. >> >> This addition is useful in case classes at runtime are not loaded from the system class loader, such as Proxy. This is also useful to APIs that generate bytecode with a `Lookup` object, such as a custom single-abstract-method class implementations from a method handle. >> >> See https://mail.openjdk.org/pipermail/classfile-api-dev/2023-March/000249.html as well. >> >> Current questions, which I wish to discuss with @asotona: >> 1. Should the resolver fail fast on `IllegalAccessException` from the lookup? This usually indicates the hierarchy resolver is set up improperly, and proceeding may simply yield verification errors in class loading that are hard to track. For bytecode-generating APIs, throwing access errors for the Lookup eagerly is also more preferable than later silent generation failure. >> 2. Whether the default resolver should be reading from jrt alone, reflection alone, or jrt then reflection. I personally believe reflection alone is more reliable, for classes may redefined with instrumentation or jfr, which may not be reflected in the system resources. >> 3. In addition, I don't think chaining system class loader reflection after system resource retrieval is really meaningful: is there any case where reflection always works while the system resource retrieval always fails? > > Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 12 commits: > > - 1. Moved the default resolver to a static method, in anticipation of future changes > 2. Removed SecurityManager related content > 3. Changed ClassHierarchyInfo into an interface > 4. Moved caching method from static to instance method > - Merge branch 'master' into hierarchy-resolve > - rename to ofClassLoading/ofResourceParsing > convert the default class provider to bypass security manager restrictions > - Merge branch 'master' into hierarchy-resolve > - Merge branch 'master' into hierarchy-resolve > - Test both cached and uncached resolvers > - Update the class hierarchy resolver api as per mailing list last week > - Merge branch 'master' into hierarchy-resolve > - Update src/java.base/share/classes/jdk/internal/classfile/impl/ClassHierarchyImpl.java > > Co-authored-by: Andrey Turbanov > - Make lookup based resolver throw on illegal access eagerly > - ... and 2 more: https://git.openjdk.org/jdk/compare/101bf229...9e9079fb Globas static cache needs to be synchronised If this PR goes in before #14180 Or a `defaultResolver()` should create a new cache instance (and document it is thread-unsafe) if it goes after #14180 src/java.base/share/classes/jdk/internal/classfile/ClassHierarchyResolver.java line 57: > 55: */ > 56: static ClassHierarchyResolver defaultResolver() { > 57: return ClassHierarchyImpl.DEFAULT_RESOLVER; defaultResolver() delegates to a thread-unsafe global static instance of cached resolver. src/java.base/share/classes/jdk/internal/classfile/impl/ClassHierarchyImpl.java line 130: > 128: @Override > 129: public ClassHierarchyInfo getClassInfo(ClassDesc classDesc) { > 130: var ret = resolvedCache.computeIfAbsent(classDesc, new Function<>() { couldn't this function be cached? test/jdk/jdk/classfile/ClassHierarchyInfoTest.java line 34: > 32: * java.base/jdk.internal.classfile.impl > 33: * java.base/jdk.internal.classfile.impl.verifier > 34: * java.base/jdk.internal.classfile.java.lang.constant jdk.internal.classfile.java.lang.constant package has been removed ------------- Changes requested by asotona (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/13082#pullrequestreview-1466930855 PR Review Comment: https://git.openjdk.org/jdk/pull/13082#discussion_r1221124185 PR Review Comment: https://git.openjdk.org/jdk/pull/13082#discussion_r1221102574 PR Review Comment: https://git.openjdk.org/jdk/pull/13082#discussion_r1221108184 From aturbanov at openjdk.org Wed Jun 7 08:55:57 2023 From: aturbanov at openjdk.org (Andrey Turbanov) Date: Wed, 7 Jun 2023 08:55:57 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v6] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 03:37:26 GMT, SUN Guoyun wrote: >> command: make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp" TEST=gc/TestAllocHumongousFragment.java >> error info: >> >> Caused by: java.lang.NullPointerException: Cannot invoke "sun.util.locale.BaseLocale.getVariant()" because "base" is null >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1802) >> at java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.(CLDRBaseLocaleDataMetaInfo.java:41) >> ... 24 more >> >> Note that the test runs with -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot and SoftReferences are involved (LocaleObjectCache uses SoftReferences, used by printf method called in getRandomInstance(Utils.java:511)). >> >> Maybe we have to deal with the case where the getBaseLocale() return value is null. the call stack is: >> >> at java.base/sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:64) >> at java.base/sun.util.locale.BaseLocale.getInstance(BaseLocale.java:169) >> at java.base/sun.util.locale.InternalLocaleBuilder.getBaseLocale(InternalLocaleBuilder.java:524) >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1874) >> >> in LocaleObjectCache.java:64 >> >> 62 if (key == null || newVal == null) { >> 63 // subclass must return non-null key/value object >> 64 return null; // run here >> 65 } > > SUN Guoyun has updated the pull request incrementally with one additional commit since the last revision: > > 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared src/java.base/share/classes/sun/util/locale/BaseLocale.java line 371: > 369: BaseLocale locale = new BaseLocale(l.getLanguage(), l.getScript(), l.getRegion(), l.getVariant(), true); > 370: try { > 371: BaseLocale value = (new Key(locale)).getBaseLocale(); I don't understand. Why do we need to create thrown-away `new Key` here? Can we just use locale? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14211#discussion_r1221187752 From duke at openjdk.org Wed Jun 7 09:03:27 2023 From: duke at openjdk.org (JoKern65) Date: Wed, 7 Jun 2023 09:03:27 GMT Subject: RFR: JDK-8309219: Fix xlc17 clang 15 warnings in java.base [v2] In-Reply-To: References: Message-ID: > This pr is a split off from JDK-8308288: Fix xlc17 clang warnings in shared code https://github.com/openjdk/jdk/pull/14146 > It handles the part in java.base. > > Compiling on AIX with xlc17 which contains the new clang 15 frontend > shows the following warnings. > > built by make/modules/java.base/Lib.gmk > > src/java.base/unix/native/libnet/DefaultProxySelector.c:378:41:22: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error); > ^ > > > src/java.base/unix/native/libnet/NetworkInterface.c:1612:24: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wgnu-pointer-arith] > end = (void *)nddp + size; > > src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c:1251:7: error: '_ALLBSD_SOURCE' is not defined, evaluates to 0 [-Werror,-Wundef] > #elif _ALLBSD_SOURCE > The whole file checks whether _ALLBSD_SOURCE is defined, only where #elif is used the call to defined() was forgotten. > > built by make/modules/java.base/lib/CoreLibraries.gmk > > src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c:638 comparison of integers of different signs: 'int' and 'unsigned long' > if (ret < sizeof(psinfo_t)) { > ProcessHandleImpl_unix.c: Just using the proper type `size_t` instead of `int`. > > > src/java.base/aix/native/libjli/java_md_aix.c:42:38: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wgnu-pointer-arith] > addr < p->ldinfo_textorg + p->ldinfo_textsize) { > we can fix this with temporary casting the `void*` pointer to `char*` or by disabling the warning in CoreLibraries.gmk > > src/java.base/share/native/libzip/zlib/inffast.c:74:20: error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > void ZLIB_INTERNAL inflate_fast(strm, start) > ^ > src/java.base/share/native/libjli/java.c:2311:22: error: format string is not a string literal [-Werror,-Wformat-nonliteral] > vfprintf(stderr, fmt, vl); > ^~~ > > The test library libGetXSpace.c also shows a warning. > In addition, the cast in that lib is wrong, we opened "[JDK-8309216](https://bugs.openjdk.org/browse/JDK-8309216) cast from jchar* to char* in test GetXSpace.java" for that. JoKern65 has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits: - Merge branch 'master' into JDK-8309219 - JDK-8309219 ------------- Changes: https://git.openjdk.org/jdk/pull/14281/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14281&range=01 Stats: 12 lines in 6 files changed: 3 ins; 0 del; 9 mod Patch: https://git.openjdk.org/jdk/pull/14281.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14281/head:pull/14281 PR: https://git.openjdk.org/jdk/pull/14281 From mdoerr at openjdk.org Wed Jun 7 09:42:56 2023 From: mdoerr at openjdk.org (Martin Doerr) Date: Wed, 7 Jun 2023 09:42:56 GMT Subject: RFR: JDK-8309219: Fix xlc17 clang 15 warnings in java.base [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 09:03:27 GMT, JoKern65 wrote: >> This pr is a split off from JDK-8308288: Fix xlc17 clang warnings in shared code https://github.com/openjdk/jdk/pull/14146 >> It handles the part in java.base. >> >> Compiling on AIX with xlc17 which contains the new clang 15 frontend >> shows the following warnings. >> >> built by make/modules/java.base/Lib.gmk >> >> src/java.base/unix/native/libnet/DefaultProxySelector.c:378:41:22: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error); >> ^ >> >> >> src/java.base/unix/native/libnet/NetworkInterface.c:1612:24: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wgnu-pointer-arith] >> end = (void *)nddp + size; >> >> src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c:1251:7: error: '_ALLBSD_SOURCE' is not defined, evaluates to 0 [-Werror,-Wundef] >> #elif _ALLBSD_SOURCE >> The whole file checks whether _ALLBSD_SOURCE is defined, only where #elif is used the call to defined() was forgotten. >> >> built by make/modules/java.base/lib/CoreLibraries.gmk >> >> src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c:638 comparison of integers of different signs: 'int' and 'unsigned long' >> if (ret < sizeof(psinfo_t)) { >> ProcessHandleImpl_unix.c: Just using the proper type `size_t` instead of `int`. >> >> >> src/java.base/aix/native/libjli/java_md_aix.c:42:38: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wgnu-pointer-arith] >> addr < p->ldinfo_textorg + p->ldinfo_textsize) { >> we can fix this with temporary casting the `void*` pointer to `char*` or by disabling the warning in CoreLibraries.gmk >> >> src/java.base/share/native/libzip/zlib/inffast.c:74:20: error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> void ZLIB_INTERNAL inflate_fast(strm, start) >> ^ >> src/java.base/share/native/libjli/java.c:2311:22: error: format string is not a string literal [-Werror,-Wformat-nonliteral] >> vfprintf(stderr, fmt, vl); >> ^~~ >> >> The test library libGetXSpace.c also shows a warning. >> In addition, the cast in that lib is wrong, we opened "[JDK-8309216](https://bugs.openjdk.org/browse/JDK-8309216) cast from jchar* to char* in test GetXSpace.java" for that. > > JoKern65 has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits: > > - Merge branch 'master' into JDK-8309219 > - JDK-8309219 LGTM. ------------- Marked as reviewed by mdoerr (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14281#pullrequestreview-1467159943 From mcimadamore at openjdk.org Wed Jun 7 10:21:55 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Wed, 7 Jun 2023 10:21:55 GMT Subject: RFR: 8308445: Linker should check that capture state segment is big enough [v2] In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 17:24:34 GMT, Jorn Vernee wrote: >> Fix the bug mentioned in the JBS issue. >> >> The implementation is updated to slice the capture state segment using the capture state layout. This checks both that the segment is big enough, and that it is properly aligned. >> >> Additionally, I added a check for `MS::NULL` since this is also an illegal value we can catch early. >> >> Test cases are added for all three invalid values. >> >> Testing: `jdk_foreign` test suite. > > Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: > > rename MH field Marked as reviewed by mcimadamore (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14339#pullrequestreview-1467264730 From duke at openjdk.org Wed Jun 7 11:00:10 2023 From: duke at openjdk.org (duke) Date: Wed, 7 Jun 2023 11:00:10 GMT Subject: Withdrawn: 8293806: JDK_JAVA_OPTIONS picked up twice if launcher re-executes itself In-Reply-To: References: Message-ID: On Tue, 6 Dec 2022 14:04:44 GMT, Dmitry Samersoff wrote: > If the user has set LD_LIBRARY_PATH to use a particular libjvm.so, options from the JDK_JAVA_OPTIONS environment variable are picked up twice. > > If an option cannot be accepted twice (e.g., -agentlib), the application fails to start. > > The same happens on operating systems that doesn't support $RPATH/$ORIGIN and always have to set LD_LIBRARY_PATH and re-exec the launcher. > > This fix takes the approach to re-launch as early as possible, as discussed here: > > https://github.com/openjdk/jdk/pull/10430 > > This PR consists of three commits: > 1. Cleanup of java_md.c > 2. The implementation of early re-launch > 3. Performance optimization > > @AlanBateman, @dholmes-ora Alan, David - any comments are appreciated. This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/jdk/pull/11538 From duke at openjdk.org Wed Jun 7 11:23:26 2023 From: duke at openjdk.org (JoKern65) Date: Wed, 7 Jun 2023 11:23:26 GMT Subject: RFR: JDK-8309219: Fix xlc17 clang 15 warnings in java.base [v3] In-Reply-To: References: Message-ID: > This pr is a split off from JDK-8308288: Fix xlc17 clang warnings in shared code https://github.com/openjdk/jdk/pull/14146 > It handles the part in java.base. > > Compiling on AIX with xlc17 which contains the new clang 15 frontend > shows the following warnings. > > built by make/modules/java.base/Lib.gmk > > src/java.base/unix/native/libnet/DefaultProxySelector.c:378:41:22: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error); > ^ > > > src/java.base/unix/native/libnet/NetworkInterface.c:1612:24: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wgnu-pointer-arith] > end = (void *)nddp + size; > > src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c:1251:7: error: '_ALLBSD_SOURCE' is not defined, evaluates to 0 [-Werror,-Wundef] > #elif _ALLBSD_SOURCE > The whole file checks whether _ALLBSD_SOURCE is defined, only where #elif is used the call to defined() was forgotten. > > built by make/modules/java.base/lib/CoreLibraries.gmk > > src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c:638 comparison of integers of different signs: 'int' and 'unsigned long' > if (ret < sizeof(psinfo_t)) { > ProcessHandleImpl_unix.c: Just using the proper type `size_t` instead of `int`. > > > src/java.base/aix/native/libjli/java_md_aix.c:42:38: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wgnu-pointer-arith] > addr < p->ldinfo_textorg + p->ldinfo_textsize) { > we can fix this with temporary casting the `void*` pointer to `char*` or by disabling the warning in CoreLibraries.gmk > > src/java.base/share/native/libzip/zlib/inffast.c:74:20: error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > void ZLIB_INTERNAL inflate_fast(strm, start) > ^ > src/java.base/share/native/libjli/java.c:2311:22: error: format string is not a string literal [-Werror,-Wformat-nonliteral] > vfprintf(stderr, fmt, vl); > ^~~ > > The test library libGetXSpace.c also shows a warning. > In addition, the cast in that lib is wrong, we opened "[JDK-8309216](https://bugs.openjdk.org/browse/JDK-8309216) cast from jchar* to char* in test GetXSpace.java" for that. JoKern65 has updated the pull request incrementally with one additional commit since the last revision: Update libGetXSpace.c cast not necessary ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14281/files - new: https://git.openjdk.org/jdk/pull/14281/files/f185fa5d..7e8f5376 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14281&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14281&range=01-02 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14281.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14281/head:pull/14281 PR: https://git.openjdk.org/jdk/pull/14281 From rgiulietti at openjdk.org Wed Jun 7 11:27:14 2023 From: rgiulietti at openjdk.org (Raffaello Giulietti) Date: Wed, 7 Jun 2023 11:27:14 GMT Subject: RFR: 8309515: Stale cached data from Matcher.namedGroups() after Matcher.usePattern() Message-ID: The cached `namedGroup` field must be invalidated during an invocation of `Matcher.usePattern()` ------------- Commit messages: - 8309515: Stale cached data from Matcher.namedGroups() after Matcher.usePattern() Changes: https://git.openjdk.org/jdk/pull/14350/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14350&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309515 Stats: 24 lines in 2 files changed: 23 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14350.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14350/head:pull/14350 PR: https://git.openjdk.org/jdk/pull/14350 From rgiulietti at openjdk.org Wed Jun 7 11:27:15 2023 From: rgiulietti at openjdk.org (Raffaello Giulietti) Date: Wed, 7 Jun 2023 11:27:15 GMT Subject: RFR: 8309515: Stale cached data from Matcher.namedGroups() after Matcher.usePattern() In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 11:20:02 GMT, Raffaello Giulietti wrote: > The cached `namedGroup` field must be invalidated during an invocation of `Matcher.usePattern()` Also added a test for this change. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14350#issuecomment-1580578032 From rgiulietti at openjdk.org Wed Jun 7 11:51:19 2023 From: rgiulietti at openjdk.org (Raffaello Giulietti) Date: Wed, 7 Jun 2023 11:51:19 GMT Subject: RFR: 8309515: Stale cached data from Matcher.namedGroups() after Matcher.usePattern() [v2] In-Reply-To: References: Message-ID: > The cached `namedGroup` field must be invalidated during an invocation of `Matcher.usePattern()` Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision: Renamed the additional test. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14350/files - new: https://git.openjdk.org/jdk/pull/14350/files/29d8047f..dbe40b98 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14350&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14350&range=00-01 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/14350.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14350/head:pull/14350 PR: https://git.openjdk.org/jdk/pull/14350 From djelinski at openjdk.org Wed Jun 7 11:59:57 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Wed, 7 Jun 2023 11:59:57 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v6] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 03:37:26 GMT, SUN Guoyun wrote: >> command: make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp" TEST=gc/TestAllocHumongousFragment.java >> error info: >> >> Caused by: java.lang.NullPointerException: Cannot invoke "sun.util.locale.BaseLocale.getVariant()" because "base" is null >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1802) >> at java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.(CLDRBaseLocaleDataMetaInfo.java:41) >> ... 24 more >> >> Note that the test runs with -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot and SoftReferences are involved (LocaleObjectCache uses SoftReferences, used by printf method called in getRandomInstance(Utils.java:511)). >> >> Maybe we have to deal with the case where the getBaseLocale() return value is null. the call stack is: >> >> at java.base/sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:64) >> at java.base/sun.util.locale.BaseLocale.getInstance(BaseLocale.java:169) >> at java.base/sun.util.locale.InternalLocaleBuilder.getBaseLocale(InternalLocaleBuilder.java:524) >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1874) >> >> in LocaleObjectCache.java:64 >> >> 62 if (key == null || newVal == null) { >> 63 // subclass must return non-null key/value object >> 64 return null; // run here >> 65 } > > SUN Guoyun has updated the pull request incrementally with one additional commit since the last revision: > > 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared In its current form the `BaseLocale.Cache.createObject` function can return `null`; the object returned by `BaseLocale.Key.normalizeKey(key)` holds a soft reference to locale, and by the time `getBaseLocale` is called, the reference may be cleared. `Key` only uses `SoftReferences` because it must not hold a reference to the object returned by `createObject`. We could refactor `createObject` to return a clone of the `BaseLocale` referenced by `Key`, and then `Key` would not need to use `SoftReference`s. That being said, the number of long-lived `BaseLocale` objects is very limited; we only keep them in Locale, LocaleKey, and Locale.CONSTANT_LOCALES. Unless I'm missing something, we could solve this problem by removing `BaseLocale` caching, and improve performance at the same time. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14211#issuecomment-1580652895 From alanb at openjdk.org Wed Jun 7 12:11:57 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 7 Jun 2023 12:11:57 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v8] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 08:16:19 GMT, Nagata-Haruhito wrote: >> I fixed File.listRoots description. >> * remove "the insertion or ejection of removable media" >> * change "available" to "existing" >> >> Please review this change. > > Nagata-Haruhito has updated the pull request incrementally with one additional commit since the last revision: > > Refer review comment src/java.base/share/classes/java/io/File.java line 1822: > 1820: * that the canonical pathname of any file physically present on the local > 1821: * machine will begin with one of the roots returned by this method. > 1822: * There is no guarantee that the root directory can be accessed. The current patch looks okay, just need to change "the root directory" to "a root directory", here and also in FileSystem::getRootDirectories. I see a CSR has been created. If you don't mind, I will edit it to make it clearer what this is about. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13526#discussion_r1221472561 From jvernee at openjdk.org Wed Jun 7 12:18:04 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Wed, 7 Jun 2023 12:18:04 GMT Subject: Integrated: 8308031: Linkers should reject unpromoted variadic parameters In-Reply-To: References: Message-ID: <0PKueH81WPdbGKLm79f0gJCJX1YiXeHZ_xJkdjt4AoM=.0842851a-c89d-4c99-8942-7ad8927c7795@github.com> On Tue, 30 May 2023 17:25:35 GMT, Jorn Vernee wrote: > In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and `float` is promoted to `double`, when being passed as variadic argument (see e.g. https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions). This patch adds the automatic argument promotion for variadic arguments, to align the implementation with the C specification. > > The fallback linker is also updated to use to correct function to link variadic calls (not doing this turned out not to be a problem so far, but it is problematic for instance on Mac/AArch64 when using the fallback linker). Adding the restriction on layouts for all linkers is also partly motivated by the fallback linker rejecting such unsupported variadic layouts already. > > I've added a small paragraph to the Linker javadoc as well that explains this. > > TestVarArgs needed to be updated in order to account for the difference in the promoted `float` values. > > Testing: > - local testing on Windows/x64 > - local testing on Linux/x64 using the fallback linker > - tier1-3 + jdk-tier5 > - manual test run on mac/aarch64 with the fallback linker to verify the correctness of the fallback linker changes. This pull request has now been integrated. Changeset: fa791119 Author: Jorn Vernee URL: https://git.openjdk.org/jdk/commit/fa791119f0b73cd1e110d6a62d3bed58fee5740a Stats: 144 lines in 11 files changed: 120 ins; 6 del; 18 mod 8308031: Linkers should reject unpromoted variadic parameters Reviewed-by: mcimadamore ------------- PR: https://git.openjdk.org/jdk/pull/14225 From jvernee at openjdk.org Wed Jun 7 12:28:06 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Wed, 7 Jun 2023 12:28:06 GMT Subject: Integrated: 8308445: Linker should check that capture state segment is big enough In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 16:22:41 GMT, Jorn Vernee wrote: > Fix the bug mentioned in the JBS issue. > > The implementation is updated to slice the capture state segment using the capture state layout. This checks both that the segment is big enough, and that it is properly aligned. > > Additionally, I added a check for `MS::NULL` since this is also an illegal value we can catch early. > > Test cases are added for all three invalid values. > > Testing: `jdk_foreign` test suite. This pull request has now been integrated. Changeset: c49129f5 Author: Jorn Vernee URL: https://git.openjdk.org/jdk/commit/c49129f54580b431881ffdb97b5478aff6097154 Stats: 48 lines in 4 files changed: 46 ins; 1 del; 1 mod 8308445: Linker should check that capture state segment is big enough Reviewed-by: mcimadamore ------------- PR: https://git.openjdk.org/jdk/pull/14339 From alanb at openjdk.org Wed Jun 7 12:46:07 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 7 Jun 2023 12:46:07 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v6] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 03:37:26 GMT, SUN Guoyun wrote: >> command: make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp" TEST=gc/TestAllocHumongousFragment.java >> error info: >> >> Caused by: java.lang.NullPointerException: Cannot invoke "sun.util.locale.BaseLocale.getVariant()" because "base" is null >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1802) >> at java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.(CLDRBaseLocaleDataMetaInfo.java:41) >> ... 24 more >> >> Note that the test runs with -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot and SoftReferences are involved (LocaleObjectCache uses SoftReferences, used by printf method called in getRandomInstance(Utils.java:511)). >> >> Maybe we have to deal with the case where the getBaseLocale() return value is null. the call stack is: >> >> at java.base/sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:64) >> at java.base/sun.util.locale.BaseLocale.getInstance(BaseLocale.java:169) >> at java.base/sun.util.locale.InternalLocaleBuilder.getBaseLocale(InternalLocaleBuilder.java:524) >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1874) >> >> in LocaleObjectCache.java:64 >> >> 62 if (key == null || newVal == null) { >> 63 // subclass must return non-null key/value object >> 64 return null; // run here >> 65 } > > SUN Guoyun has updated the pull request incrementally with one additional commit since the last revision: > > 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared src/java.base/share/classes/sun/util/locale/LocaleObjectCache.java line 63: > 61: if (newVal == null) { > 62: // subclass must return non-null key/value object > 63: throw new NullPointerException(); Is this caught somewhere, it seem strange to throw NPE here. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14211#discussion_r1221526553 From alanb at openjdk.org Wed Jun 7 12:51:01 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 7 Jun 2023 12:51:01 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v6] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 11:55:57 GMT, Daniel Jeli?ski wrote: > That being said, the number of long-lived `BaseLocale` objects is very limited; we only keep them in Locale, LocaleKey, and Locale.CONSTANT_LOCALES. Unless I'm missing something, we could solve this problem by removing `BaseLocale` caching, and improve performance at the same time. The motivation seems to be startup ([JDK-8196869](https://bugs.openjdk.org/browse/JDK-8196869)). It looks like it needs to be re-evaluated and if we continue with caching in this area then I think we'll need some stress tests to go with it. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14211#issuecomment-1580746429 From mdoerr at openjdk.org Wed Jun 7 12:52:57 2023 From: mdoerr at openjdk.org (Martin Doerr) Date: Wed, 7 Jun 2023 12:52:57 GMT Subject: RFR: JDK-8309219: Fix xlc17 clang 15 warnings in java.base [v3] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 11:23:26 GMT, JoKern65 wrote: >> This pr is a split off from JDK-8308288: Fix xlc17 clang warnings in shared code https://github.com/openjdk/jdk/pull/14146 >> It handles the part in java.base. >> >> Compiling on AIX with xlc17 which contains the new clang 15 frontend >> shows the following warnings. >> >> built by make/modules/java.base/Lib.gmk >> >> src/java.base/unix/native/libnet/DefaultProxySelector.c:378:41:22: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error); >> ^ >> >> >> src/java.base/unix/native/libnet/NetworkInterface.c:1612:24: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wgnu-pointer-arith] >> end = (void *)nddp + size; >> >> src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c:1251:7: error: '_ALLBSD_SOURCE' is not defined, evaluates to 0 [-Werror,-Wundef] >> #elif _ALLBSD_SOURCE >> The whole file checks whether _ALLBSD_SOURCE is defined, only where #elif is used the call to defined() was forgotten. >> >> built by make/modules/java.base/lib/CoreLibraries.gmk >> >> src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c:638 comparison of integers of different signs: 'int' and 'unsigned long' >> if (ret < sizeof(psinfo_t)) { >> ProcessHandleImpl_unix.c: Just using the proper type `size_t` instead of `int`. >> >> >> src/java.base/aix/native/libjli/java_md_aix.c:42:38: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wgnu-pointer-arith] >> addr < p->ldinfo_textorg + p->ldinfo_textsize) { >> we can fix this with temporary casting the `void*` pointer to `char*` or by disabling the warning in CoreLibraries.gmk >> >> src/java.base/share/native/libzip/zlib/inffast.c:74:20: error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> void ZLIB_INTERNAL inflate_fast(strm, start) >> ^ >> src/java.base/share/native/libjli/java.c:2311:22: error: format string is not a string literal [-Werror,-Wformat-nonliteral] >> vfprintf(stderr, fmt, vl); >> ^~~ >> >> The test library libGetXSpace.c also shows a warning. >> In addition, the cast in that lib is wrong, we opened "[JDK-8309216](https://bugs.openjdk.org/browse/JDK-8309216) cast from jchar* to char* in test GetXSpace.java" for that. > > JoKern65 has updated the pull request incrementally with one additional commit since the last revision: > > Update libGetXSpace.c > > cast not necessary Marked as reviewed by mdoerr (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14281#pullrequestreview-1467571356 From duke at openjdk.org Wed Jun 7 13:45:02 2023 From: duke at openjdk.org (JoKern65) Date: Wed, 7 Jun 2023 13:45:02 GMT Subject: Integrated: JDK-8309219: Fix xlc17 clang 15 warnings in java.base In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 10:08:09 GMT, JoKern65 wrote: > This pr is a split off from JDK-8308288: Fix xlc17 clang warnings in shared code https://github.com/openjdk/jdk/pull/14146 > It handles the part in java.base. > > Compiling on AIX with xlc17 which contains the new clang 15 frontend > shows the following warnings. > > built by make/modules/java.base/Lib.gmk > > src/java.base/unix/native/libnet/DefaultProxySelector.c:378:41:22: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error); > ^ > > > src/java.base/unix/native/libnet/NetworkInterface.c:1612:24: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wgnu-pointer-arith] > end = (void *)nddp + size; > > src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c:1251:7: error: '_ALLBSD_SOURCE' is not defined, evaluates to 0 [-Werror,-Wundef] > #elif _ALLBSD_SOURCE > The whole file checks whether _ALLBSD_SOURCE is defined, only where #elif is used the call to defined() was forgotten. > > built by make/modules/java.base/lib/CoreLibraries.gmk > > src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c:638 comparison of integers of different signs: 'int' and 'unsigned long' > if (ret < sizeof(psinfo_t)) { > ProcessHandleImpl_unix.c: Just using the proper type `size_t` instead of `int`. > > > src/java.base/aix/native/libjli/java_md_aix.c:42:38: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wgnu-pointer-arith] > addr < p->ldinfo_textorg + p->ldinfo_textsize) { > we can fix this with temporary casting the `void*` pointer to `char*` or by disabling the warning in CoreLibraries.gmk > > src/java.base/share/native/libzip/zlib/inffast.c:74:20: error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > void ZLIB_INTERNAL inflate_fast(strm, start) > ^ > src/java.base/share/native/libjli/java.c:2311:22: error: format string is not a string literal [-Werror,-Wformat-nonliteral] > vfprintf(stderr, fmt, vl); > ^~~ > > The test library libGetXSpace.c also shows a warning. > In addition, the cast in that lib is wrong, we opened "[JDK-8309216](https://bugs.openjdk.org/browse/JDK-8309216) cast from jchar* to char* in test GetXSpace.java" for that. This pull request has now been integrated. Changeset: 6eddbe26 Author: JoKern65 <128386669+JoKern65 at users.noreply.github.com> Committer: Martin Doerr URL: https://git.openjdk.org/jdk/commit/6eddbe26dd0b9afb83fc029d77e18212e63f98f4 Stats: 12 lines in 6 files changed: 3 ins; 0 del; 9 mod 8309219: Fix xlc17 clang 15 warnings in java.base Reviewed-by: goetz, mdoerr ------------- PR: https://git.openjdk.org/jdk/pull/14281 From liach at openjdk.org Wed Jun 7 14:15:10 2023 From: liach at openjdk.org (Chen Liang) Date: Wed, 7 Jun 2023 14:15:10 GMT Subject: RFR: 8304425: ClassHierarchyResolver from Reflection [v9] In-Reply-To: <08Hy6pEhV75yr_F4mCP-dkKOKMCSoFxWI2E7OnM4iyQ=.cfa14992-8e94-4d6d-bdf9-e6689549c83e@github.com> References: <08Hy6pEhV75yr_F4mCP-dkKOKMCSoFxWI2E7OnM4iyQ=.cfa14992-8e94-4d6d-bdf9-e6689549c83e@github.com> Message-ID: <0RmULuYLatKjDyzBQB7Qxep-oSkpCKdh7zBDzuQiPvM=.2eed570e-cc6d-4103-b733-8cca3c4eaf33@github.com> > Add API to explore Class Hierarchy with a `ClassLoader` or a `Lookup` with proper privileges, with tests. > > This addition is useful in case classes at runtime are not loaded from the system class loader, such as Proxy. This is also useful to APIs that generate bytecode with a `Lookup` object, such as a custom single-abstract-method class implementations from a method handle. > > See https://mail.openjdk.org/pipermail/classfile-api-dev/2023-March/000249.html as well. > > Current questions, which I wish to discuss with @asotona: > 1. Should the resolver fail fast on `IllegalAccessException` from the lookup? This usually indicates the hierarchy resolver is set up improperly, and proceeding may simply yield verification errors in class loading that are hard to track. For bytecode-generating APIs, throwing access errors for the Lookup eagerly is also more preferable than later silent generation failure. > 2. Whether the default resolver should be reading from jrt alone, reflection alone, or jrt then reflection. I personally believe reflection alone is more reliable, for classes may redefined with instrumentation or jfr, which may not be reflected in the system resources. > 3. In addition, I don't think chaining system class loader reflection after system resource retrieval is really meaningful: is there any case where reflection always works while the system resource retrieval always fails? Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 14 commits: - Review changes, fixed tests - Merge branch 'master' into hierarchy-resolve - 1. Moved the default resolver to a static method, in anticipation of future changes 2. Removed SecurityManager related content 3. Changed ClassHierarchyInfo into an interface 4. Moved caching method from static to instance method - Merge branch 'master' into hierarchy-resolve - rename to ofClassLoading/ofResourceParsing convert the default class provider to bypass security manager restrictions - Merge branch 'master' into hierarchy-resolve - Merge branch 'master' into hierarchy-resolve - Test both cached and uncached resolvers - Update the class hierarchy resolver api as per mailing list last week - Merge branch 'master' into hierarchy-resolve - ... and 4 more: https://git.openjdk.org/jdk/compare/a1ab377d...90645b6f ------------- Changes: https://git.openjdk.org/jdk/pull/13082/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13082&range=08 Stats: 401 lines in 10 files changed: 304 ins; 29 del; 68 mod Patch: https://git.openjdk.org/jdk/pull/13082.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13082/head:pull/13082 PR: https://git.openjdk.org/jdk/pull/13082 From liach at openjdk.org Wed Jun 7 14:15:13 2023 From: liach at openjdk.org (Chen Liang) Date: Wed, 7 Jun 2023 14:15:13 GMT Subject: RFR: 8304425: ClassHierarchyResolver from Reflection [v8] In-Reply-To: References: <08Hy6pEhV75yr_F4mCP-dkKOKMCSoFxWI2E7OnM4iyQ=.cfa14992-8e94-4d6d-bdf9-e6689549c83e@github.com> Message-ID: On Fri, 2 Jun 2023 03:36:35 GMT, Chen Liang wrote: >> Add API to explore Class Hierarchy with a `ClassLoader` or a `Lookup` with proper privileges, with tests. >> >> This addition is useful in case classes at runtime are not loaded from the system class loader, such as Proxy. This is also useful to APIs that generate bytecode with a `Lookup` object, such as a custom single-abstract-method class implementations from a method handle. >> >> See https://mail.openjdk.org/pipermail/classfile-api-dev/2023-March/000249.html as well. >> >> Current questions, which I wish to discuss with @asotona: >> 1. Should the resolver fail fast on `IllegalAccessException` from the lookup? This usually indicates the hierarchy resolver is set up improperly, and proceeding may simply yield verification errors in class loading that are hard to track. For bytecode-generating APIs, throwing access errors for the Lookup eagerly is also more preferable than later silent generation failure. >> 2. Whether the default resolver should be reading from jrt alone, reflection alone, or jrt then reflection. I personally believe reflection alone is more reliable, for classes may redefined with instrumentation or jfr, which may not be reflected in the system resources. >> 3. In addition, I don't think chaining system class loader reflection after system resource retrieval is really meaningful: is there any case where reflection always works while the system resource retrieval always fails? > > Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 12 commits: > > - 1. Moved the default resolver to a static method, in anticipation of future changes > 2. Removed SecurityManager related content > 3. Changed ClassHierarchyInfo into an interface > 4. Moved caching method from static to instance method > - Merge branch 'master' into hierarchy-resolve > - rename to ofClassLoading/ofResourceParsing > convert the default class provider to bypass security manager restrictions > - Merge branch 'master' into hierarchy-resolve > - Merge branch 'master' into hierarchy-resolve > - Test both cached and uncached resolvers > - Update the class hierarchy resolver api as per mailing list last week > - Merge branch 'master' into hierarchy-resolve > - Update src/java.base/share/classes/jdk/internal/classfile/impl/ClassHierarchyImpl.java > > Co-authored-by: Andrey Turbanov > - Make lookup based resolver throw on illegal access eagerly > - ... and 2 more: https://git.openjdk.org/jdk/compare/101bf229...9e9079fb Done. I've synchronized the global static cache for now, and thanks for the review! ------------- PR Comment: https://git.openjdk.org/jdk/pull/13082#issuecomment-1580904371 From prappo at openjdk.org Wed Jun 7 14:26:36 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Wed, 7 Jun 2023 14:26:36 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance Message-ID: Please review this long-awaited change to documentation inheritance. This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: ?{@inheritDoc S} Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". ------------- Commit messages: - Disable problematic check - Counterbalance changes to method comments algorithm - Improve diagnostics - Update method comments algorithm - Implement directed documentation inheritance Changes: https://git.openjdk.org/jdk/pull/14357/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14357&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8285368 Stats: 1827 lines in 32 files changed: 1693 ins; 29 del; 105 mod Patch: https://git.openjdk.org/jdk/pull/14357.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14357/head:pull/14357 PR: https://git.openjdk.org/jdk/pull/14357 From jjg at openjdk.org Wed Jun 7 15:29:55 2023 From: jjg at openjdk.org (Jonathan Gibbons) Date: Wed, 7 Jun 2023 15:29:55 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance In-Reply-To: References: Message-ID: <6gQPb_srubW1AqMpi9WmzMRYJDAZXit3-c4xi_T6oVM=.aa70485e-bb3c-4d29-bc0e-868a51051c33@github.com> On Wed, 7 Jun 2023 14:19:16 GMT, Pavel Rappo wrote: > Please review this long-awaited change to documentation inheritance. > > This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: > > ?{@inheritDoc S} > > Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java line 1325: > 1323: // > 1324: // m.at(pos).newInheritDocTree(ref) > 1325: // Although the scary warning is not wrong, I think it would have been enough to say something more concise, like "_use the original legacy method if no ref is given_" ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1221797159 From duke at openjdk.org Wed Jun 7 15:39:58 2023 From: duke at openjdk.org (Viktor Klang) Date: Wed, 7 Jun 2023 15:39:58 GMT Subject: RFR: 8301341: LinkedTransferQueue does not respect timeout for poll() In-Reply-To: References: Message-ID: On Mon, 5 Jun 2023 18:52:00 GMT, Doug Lea
    wrote: > This now uses Thread.isVirtual to distinguish spin vs immediate block cases, enabling re-introduction of spin control from the previous version, removing anomalies like this one. @DougLea @AlanBateman I had a look as well, didn't find anything to comment on. ? ------------- PR Comment: https://git.openjdk.org/jdk/pull/14317#issuecomment-1581078316 From prappo at openjdk.org Wed Jun 7 15:45:01 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Wed, 7 Jun 2023 15:45:01 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance In-Reply-To: <6gQPb_srubW1AqMpi9WmzMRYJDAZXit3-c4xi_T6oVM=.aa70485e-bb3c-4d29-bc0e-868a51051c33@github.com> References: <6gQPb_srubW1AqMpi9WmzMRYJDAZXit3-c4xi_T6oVM=.aa70485e-bb3c-4d29-bc0e-868a51051c33@github.com> Message-ID: On Wed, 7 Jun 2023 15:27:28 GMT, Jonathan Gibbons wrote: >> Please review this long-awaited change to documentation inheritance. >> >> This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: >> >> ?{@inheritDoc S} >> >> Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". > > src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java line 1325: > >> 1323: // >> 1324: // m.at(pos).newInheritDocTree(ref) >> 1325: // > > Although the scary warning is not wrong, I think it would have been enough to say something more concise, like "_use the original legacy method if no ref is given_" I'll tone it down; thanks ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1221821265 From prappo at openjdk.org Wed Jun 7 15:51:56 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Wed, 7 Jun 2023 15:51:56 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 14:19:16 GMT, Pavel Rappo wrote: > Please review this long-awaited change to documentation inheritance. > > This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: > > ?{@inheritDoc S} > > Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". For details on changes to "methods comment algorithm", see the associated CSR: https://bugs.openjdk.org/browse/JDK-8287152 ------------- PR Comment: https://git.openjdk.org/jdk/pull/14357#issuecomment-1581099793 From prappo at openjdk.org Wed Jun 7 16:02:40 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Wed, 7 Jun 2023 16:02:40 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: > Please review this long-awaited change to documentation inheritance. > > This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: > > ?{@inheritDoc S} > > Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: feedback: make warning less scary ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14357/files - new: https://git.openjdk.org/jdk/pull/14357/files/a56253b3..c0fc69c2 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14357&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14357&range=00-01 Stats: 14 lines in 1 file changed: 0 ins; 12 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/14357.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14357/head:pull/14357 PR: https://git.openjdk.org/jdk/pull/14357 From mchung at openjdk.org Wed Jun 7 16:14:11 2023 From: mchung at openjdk.org (Mandy Chung) Date: Wed, 7 Jun 2023 16:14:11 GMT Subject: RFR: 8309532: java/lang/Class/getDeclaredField/FieldSetAccessibleTest should filter modules that depend on JVMCI Message-ID: `FieldSetAccessibleTest` attempts to load all JDK classes and test `setAccessible` on their public fields to work properly. It should filter the modules that directly and indirectly depend on `jdk.internal.vm.compiler` and `jdk.internal.vm.compiler.management` as they are upgradeable and also provide APIs to add qualifed exports dynamically. ------------- Commit messages: - 8309532: java/lang/Class/getDeclaredField/FieldSetAccessibleTest should filter upgradeable modules Changes: https://git.openjdk.org/jdk/pull/14362/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14362&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309532 Stats: 64 lines in 1 file changed: 51 ins; 0 del; 13 mod Patch: https://git.openjdk.org/jdk/pull/14362.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14362/head:pull/14362 PR: https://git.openjdk.org/jdk/pull/14362 From mchung at openjdk.org Wed Jun 7 16:20:56 2023 From: mchung at openjdk.org (Mandy Chung) Date: Wed, 7 Jun 2023 16:20:56 GMT Subject: RFR: JDK-8309574: Improve core reflection tests for JEP 445 In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 02:45:53 GMT, Joe Darcy wrote: > Add some basic core reflections tests for unnamed classes. Marked as reviewed by mchung (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14345#pullrequestreview-1468111408 From naoto at openjdk.org Wed Jun 7 16:25:57 2023 From: naoto at openjdk.org (Naoto Sato) Date: Wed, 7 Jun 2023 16:25:57 GMT Subject: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v6] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 03:37:26 GMT, SUN Guoyun wrote: >> command: make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp" TEST=gc/TestAllocHumongousFragment.java >> error info: >> >> Caused by: java.lang.NullPointerException: Cannot invoke "sun.util.locale.BaseLocale.getVariant()" because "base" is null >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1802) >> at java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.(CLDRBaseLocaleDataMetaInfo.java:41) >> ... 24 more >> >> Note that the test runs with -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot and SoftReferences are involved (LocaleObjectCache uses SoftReferences, used by printf method called in getRandomInstance(Utils.java:511)). >> >> Maybe we have to deal with the case where the getBaseLocale() return value is null. the call stack is: >> >> at java.base/sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:64) >> at java.base/sun.util.locale.BaseLocale.getInstance(BaseLocale.java:169) >> at java.base/sun.util.locale.InternalLocaleBuilder.getBaseLocale(InternalLocaleBuilder.java:524) >> at java.base/java.util.Locale.forLanguageTag(Locale.java:1874) >> >> in LocaleObjectCache.java:64 >> >> 62 if (key == null || newVal == null) { >> 63 // subclass must return non-null key/value object >> 64 return null; // run here >> 65 } > > SUN Guoyun has updated the pull request incrementally with one additional commit since the last revision: > > 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared Good point Daniel. I created an issue for re-examining the cache mechanism in `BaseLocale`: https://bugs.openjdk.org/browse/JDK-8309622 ------------- PR Comment: https://git.openjdk.org/jdk/pull/14211#issuecomment-1581155416 From alanb at openjdk.org Wed Jun 7 17:01:55 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 7 Jun 2023 17:01:55 GMT Subject: RFR: 8309532: java/lang/Class/getDeclaredField/FieldSetAccessibleTest should filter modules that depend on JVMCI In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 16:06:54 GMT, Mandy Chung wrote: > `FieldSetAccessibleTest` attempts to load all JDK classes and test `setAccessible` on their public fields to work properly. It should filter the modules that directly and indirectly depend on `jdk.internal.vm.compiler` and `jdk.internal.vm.compiler.management` as they are upgradeable and also provide APIs to add qualifed exports dynamically. test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java line 314: > 312: }); > 313: > 314: Set deployModules = Set.of("javafx.deploy", "jdk.deploy", "jdk.plugin", "jdk.javaws"); Can deployModules be dropped? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14362#discussion_r1221919712 From alanb at openjdk.org Wed Jun 7 17:33:57 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 7 Jun 2023 17:33:57 GMT Subject: RFR: 8309532: java/lang/Class/getDeclaredField/FieldSetAccessibleTest should filter modules that depend on JVMCI In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 16:06:54 GMT, Mandy Chung wrote: > `FieldSetAccessibleTest` attempts to load all JDK classes and test `setAccessible` on their public fields to work properly. It should filter the modules that directly and indirectly depend on `jdk.internal.vm.compiler` and `jdk.internal.vm.compiler.management` as they are upgradeable and also provide APIs to add qualifed exports dynamically. Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14362#pullrequestreview-1468226263 From alanb at openjdk.org Wed Jun 7 17:34:22 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 7 Jun 2023 17:34:22 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v8] In-Reply-To: References: Message-ID: <1B_vjAxLnuMVEPMuz9EyMWRRwFomFGSpyaACzD1732k=.e76b095a-fd90-4350-a3b4-e3751ca5bc87@github.com> On Wed, 7 Jun 2023 12:09:33 GMT, Alan Bateman wrote: >> Nagata-Haruhito has updated the pull request incrementally with one additional commit since the last revision: >> >> Refer review comment > > src/java.base/share/classes/java/io/File.java line 1822: > >> 1820: * that the canonical pathname of any file physically present on the local >> 1821: * machine will begin with one of the roots returned by this method. >> 1822: * There is no guarantee that the root directory can be accessed. > > The current patch looks okay, just need to change "the root directory" to "a root directory", here and also in FileSystem::getRootDirectories. > > I see a CSR has been created. If you don't mind, I will edit it to make it clearer what this is about. The CSR is updated so it's focused on the two parts of the updated docs. So I think you can finalize. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13526#discussion_r1221944247 From prappo at openjdk.org Wed Jun 7 17:34:22 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Wed, 7 Jun 2023 17:34:22 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 16:02:40 GMT, Pavel Rappo wrote: >> Please review this long-awaited change to documentation inheritance. >> >> This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: >> >> ?{@inheritDoc S} >> >> Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". > > Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: > > feedback: make warning less scary Full disclosure. Here are all the files that are different before (1) and after (2) the change: - https://cr.openjdk.org/~prappo/8285368/1/api - https://cr.openjdk.org/~prappo/8285368/2/api As you can see, the vast majority of differences are in "See Also" sections, which come from `@see` tags. Sadly, `@see` tags are inheritable "by omission". That said, `@see` is also underspecified, somewhat broken, and I believe is not as important as those parts of a doc comment that allow `{@inheritDoc}`. I suggest that we integrate this PR and take care of `@see` in 22. But if the corrections are really required, I can try to introduce explicit `@see` tags, so there are no changes whatsoever. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14357#issuecomment-1581226538 From mchung at openjdk.org Wed Jun 7 17:34:12 2023 From: mchung at openjdk.org (Mandy Chung) Date: Wed, 7 Jun 2023 17:34:12 GMT Subject: RFR: 8309532: java/lang/Class/getDeclaredField/FieldSetAccessibleTest should filter modules that depend on JVMCI In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 16:59:07 GMT, Alan Bateman wrote: >> `FieldSetAccessibleTest` attempts to load all JDK classes and test `setAccessible` on their public fields to work properly. It should filter the modules that directly and indirectly depend on `jdk.internal.vm.compiler` and `jdk.internal.vm.compiler.management` as they are upgradeable and also provide APIs to add qualifed exports dynamically. > > test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java line 314: > >> 312: }); >> 313: >> 314: Set deployModules = Set.of("javafx.deploy", "jdk.deploy", "jdk.plugin", "jdk.javaws"); > > Can deployModules be dropped? There are two other tests that should be updated. I updated this one in this PR. Will create another PR to drop those. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14362#discussion_r1221937427 From alanb at openjdk.org Wed Jun 7 17:34:12 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 7 Jun 2023 17:34:12 GMT Subject: RFR: 8309532: java/lang/Class/getDeclaredField/FieldSetAccessibleTest should filter modules that depend on JVMCI In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 17:16:50 GMT, Mandy Chung wrote: >> test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java line 314: >> >>> 312: }); >>> 313: >>> 314: Set deployModules = Set.of("javafx.deploy", "jdk.deploy", "jdk.plugin", "jdk.javaws"); >> >> Can deployModules be dropped? > > There are two other tests that should be updated. I updated this one in this PR. Will create another PR to drop those. Okay, that's fine. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14362#discussion_r1221945307 From dfuchs at openjdk.org Wed Jun 7 17:47:08 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 7 Jun 2023 17:47:08 GMT Subject: RFR: 8309532: java/lang/Class/getDeclaredField/FieldSetAccessibleTest should filter modules that depend on JVMCI In-Reply-To: References: Message-ID: <4ouOK0W_v-KOj2BGE77UDySO7SCaaO6M5h7XeKKmsCE=.8df7b99e-fc2f-4122-8eb1-cdc9852210fd@github.com> On Wed, 7 Jun 2023 16:06:54 GMT, Mandy Chung wrote: > `FieldSetAccessibleTest` attempts to load all JDK classes and test `setAccessible` on their public fields to work properly. It should filter the modules that directly and indirectly depend on `jdk.internal.vm.compiler` and `jdk.internal.vm.compiler.management` as they are upgradeable and also provide APIs to add qualifed exports dynamically. LGTM. I have suggested adding a comment to explain what's going on in the code added. test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java line 323: > 321: mods.stream() > 322: .flatMap(mn -> findDeps(mn, inverseDeps).stream())) > 323: .collect(Collectors.toSet()); Suggestion: // Build a list of modules that should be filtered out. These are the deploy modules, // plus all modules that directly or indirectly require jdk.internal.vm.compiler and // jdk.internal.vm.compiler.management, as these are upgradeable and also provide // APIs to add qualified exports dynamically. Set filters = Stream.concat(deployModules.stream(), mods.stream() .flatMap(mn -> findDeps(mn, inverseDeps).stream())) .collect(Collectors.toSet()); ------------- Marked as reviewed by dfuchs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14362#pullrequestreview-1468243596 PR Review Comment: https://git.openjdk.org/jdk/pull/14362#discussion_r1221957008 From bpb at openjdk.org Wed Jun 7 17:50:25 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Wed, 7 Jun 2023 17:50:25 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v8] In-Reply-To: <1B_vjAxLnuMVEPMuz9EyMWRRwFomFGSpyaACzD1732k=.e76b095a-fd90-4350-a3b4-e3751ca5bc87@github.com> References: <1B_vjAxLnuMVEPMuz9EyMWRRwFomFGSpyaACzD1732k=.e76b095a-fd90-4350-a3b4-e3751ca5bc87@github.com> Message-ID: On Wed, 7 Jun 2023 17:24:15 GMT, Alan Bateman wrote: > I think you can finalize. @Nagata-Haruhito I took the liberty of finalizing the CSR. If you would make the requested changes (change "the root directory" to "a root directory") in the two classes, then we can approve it and hopefully get this integrated before the JDK 21 fork. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13526#discussion_r1221969128 From rriggs at openjdk.org Wed Jun 7 17:54:46 2023 From: rriggs at openjdk.org (Roger Riggs) Date: Wed, 7 Jun 2023 17:54:46 GMT Subject: RFR: 8309515: Stale cached data from Matcher.namedGroups() after Matcher.usePattern() [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 11:51:19 GMT, Raffaello Giulietti wrote: >> The cached `namedGroup` field must be invalidated during an invocation of `Matcher.usePattern()` > > Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision: > > Renamed the additional test. test/jdk/java/util/regex/NamedGroupsTests.java line 367: > 365: } > 366: if (!m.group("a").equals("bar")) { > 367: throw new RuntimeException(); Failures will be easier to resolve if there is some description of the failure. Having to go back to the stack trace adds extra overhead. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14350#discussion_r1221972763 From mchung at openjdk.org Wed Jun 7 18:08:30 2023 From: mchung at openjdk.org (Mandy Chung) Date: Wed, 7 Jun 2023 18:08:30 GMT Subject: RFR: 8309532: java/lang/Class/getDeclaredField/FieldSetAccessibleTest should filter modules that depend on JVMCI [v2] In-Reply-To: References: Message-ID: > `FieldSetAccessibleTest` attempts to load all JDK classes and test `setAccessible` on their public fields to work properly. It should filter the modules that directly and indirectly depend on `jdk.internal.vm.compiler` and `jdk.internal.vm.compiler.management` as they are upgradeable and also provide APIs to add qualifed exports dynamically. Mandy Chung has updated the pull request incrementally with one additional commit since the last revision: no need to keep filtering deploy module ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14362/files - new: https://git.openjdk.org/jdk/pull/14362/files/dc435ae0..36c1507d Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14362&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14362&range=00-01 Stats: 6 lines in 1 file changed: 0 ins; 3 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/14362.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14362/head:pull/14362 PR: https://git.openjdk.org/jdk/pull/14362 From darcy at openjdk.org Wed Jun 7 18:10:23 2023 From: darcy at openjdk.org (Joe Darcy) Date: Wed, 7 Jun 2023 18:10:23 GMT Subject: RFR: JDK-8309574: Improve core reflection tests for JEP 445 [v2] In-Reply-To: References: Message-ID: > Add some basic core reflections tests for unnamed classes. 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 three additional commits since the last revision: - Added end of file newline. - Merge branch 'master' into JDK-8309574 - JDK-8309574: Improve core reflection tests for JEP 445 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14345/files - new: https://git.openjdk.org/jdk/pull/14345/files/bcf92b02..8a3f4666 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14345&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14345&range=00-01 Stats: 25550 lines in 211 files changed: 20977 ins; 4370 del; 203 mod Patch: https://git.openjdk.org/jdk/pull/14345.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14345/head:pull/14345 PR: https://git.openjdk.org/jdk/pull/14345 From darcy at openjdk.org Wed Jun 7 18:14:45 2023 From: darcy at openjdk.org (Joe Darcy) Date: Wed, 7 Jun 2023 18:14:45 GMT Subject: Integrated: JDK-8309574: Improve core reflection tests for JEP 445 In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 02:45:53 GMT, Joe Darcy wrote: > Add some basic core reflections tests for unnamed classes. This pull request has now been integrated. Changeset: 4ffc8cc2 Author: Joe Darcy URL: https://git.openjdk.org/jdk/commit/4ffc8cc2169c6b34ce5d9cf0ce98125520c4495a Stats: 99 lines in 2 files changed: 95 ins; 0 del; 4 mod 8309574: Improve core reflection tests for JEP 445 Reviewed-by: mchung ------------- PR: https://git.openjdk.org/jdk/pull/14345 From mchung at openjdk.org Wed Jun 7 18:44:02 2023 From: mchung at openjdk.org (Mandy Chung) Date: Wed, 7 Jun 2023 18:44:02 GMT Subject: RFR: 8309532: java/lang/Class/getDeclaredField/FieldSetAccessibleTest should filter modules that depend on JVMCI [v3] In-Reply-To: References: Message-ID: > `FieldSetAccessibleTest` attempts to load all JDK classes and test `setAccessible` on their public fields to work properly. It should filter the modules that directly and indirectly depend on `jdk.internal.vm.compiler` and `jdk.internal.vm.compiler.management` as they are upgradeable and also provide APIs to add qualifed exports dynamically. Mandy Chung has updated the pull request incrementally with three additional commits since the last revision: - clean up - review feedback - add comment ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14362/files - new: https://git.openjdk.org/jdk/pull/14362/files/36c1507d..1bed308c Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14362&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14362&range=01-02 Stats: 7 lines in 1 file changed: 3 ins; 1 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/14362.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14362/head:pull/14362 PR: https://git.openjdk.org/jdk/pull/14362 From mchung at openjdk.org Wed Jun 7 18:47:55 2023 From: mchung at openjdk.org (Mandy Chung) Date: Wed, 7 Jun 2023 18:47:55 GMT Subject: Integrated: 8309532: java/lang/Class/getDeclaredField/FieldSetAccessibleTest should filter modules that depend on JVMCI In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 16:06:54 GMT, Mandy Chung wrote: > `FieldSetAccessibleTest` attempts to load all JDK classes and test `setAccessible` on their public fields to work properly. It should filter the modules that directly and indirectly depend on `jdk.internal.vm.compiler` and `jdk.internal.vm.compiler.management` as they are upgradeable and also provide APIs to add qualifed exports dynamically. This pull request has now been integrated. Changeset: 02bce0b1 Author: Mandy Chung URL: https://git.openjdk.org/jdk/commit/02bce0b1452b804f3a7883ca8bf29a524b73672e Stats: 65 lines in 1 file changed: 51 ins; 1 del; 13 mod 8309532: java/lang/Class/getDeclaredField/FieldSetAccessibleTest should filter modules that depend on JVMCI Reviewed-by: alanb, dfuchs ------------- PR: https://git.openjdk.org/jdk/pull/14362 From rgiulietti at openjdk.org Wed Jun 7 18:54:49 2023 From: rgiulietti at openjdk.org (Raffaello Giulietti) Date: Wed, 7 Jun 2023 18:54:49 GMT Subject: RFR: 8309515: Stale cached data from Matcher.namedGroups() after Matcher.usePattern() [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 17:51:48 GMT, Roger Riggs wrote: >> Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision: >> >> Renamed the additional test. > > test/jdk/java/util/regex/NamedGroupsTests.java line 367: > >> 365: } >> 366: if (!m.group("a").equals("bar")) { >> 367: throw new RuntimeException(); > > Failures will be easier to resolve if there is some description of the failure. Having to go back to the stack trace adds extra overhead. I agree. On the one hand, I would prefer to rewrite these tests (the .java file) JUnit tests, but this would require more review work. On the other hand, adding descriptions just for this specific, additional test is a bit at odd with the other tests in the file. What's the preferred course of action? I have no problems with either way. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14350#discussion_r1222031599 From rriggs at openjdk.org Wed Jun 7 19:00:52 2023 From: rriggs at openjdk.org (Roger Riggs) Date: Wed, 7 Jun 2023 19:00:52 GMT Subject: RFR: 8309515: Stale cached data from Matcher.namedGroups() after Matcher.usePattern() [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 18:51:47 GMT, Raffaello Giulietti wrote: >> test/jdk/java/util/regex/NamedGroupsTests.java line 367: >> >>> 365: } >>> 366: if (!m.group("a").equals("bar")) { >>> 367: throw new RuntimeException(); >> >> Failures will be easier to resolve if there is some description of the failure. Having to go back to the stack trace adds extra overhead. > > I agree. > On the one hand, I would prefer to rewrite these tests (the .java file) JUnit tests, but this would require more review work. > On the other hand, adding descriptions just for this specific, additional test is a bit at odd with the other tests in the file. > What's the preferred course of action? I have no problems with either way. I'd add string descriptions to the new exceptions and file an issue to update the test later. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14350#discussion_r1222038064 From jjg at openjdk.org Wed Jun 7 19:00:53 2023 From: jjg at openjdk.org (Jonathan Gibbons) Date: Wed, 7 Jun 2023 19:00:53 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 16:02:40 GMT, Pavel Rappo wrote: >> Please review this long-awaited change to documentation inheritance. >> >> This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: >> >> ?{@inheritDoc S} >> >> Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". > > Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: > > feedback: make warning less scary src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/InheritDocTaglet.java line 94: > 92: if (supertype == null) { > 93: messages.error(inheritDocPath, "doclet.inheritDocBadSupertype"); > 94: return replacement; `replacement` may be empty. Consider using `HtmlDocletWriter.invalidTagOutput`. (Later, we might want to provide a utility message to wrap `messages.error` and `invalidTagOutput` src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/InheritDocTaglet.java line 110: > 108: for (Element e : methods) { > 109: ExecutableElement m = (ExecutableElement) e; > 110: if (configuration.utils.elementUtils.overrides(method, m, (TypeElement) method.getEnclosingElement())) { Suggestion for eventual future cleanup (not this PR): reduce need for chained fields like`config.utils.elementUtils` src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/InheritDocTaglet.java line 110: > 108: for (Element e : methods) { > 109: ExecutableElement m = (ExecutableElement) e; > 110: if (configuration.utils.elementUtils.overrides(method, m, (TypeElement) method.getEnclosingElement())) { Note that `configuration.utils` is available as `utils` src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/InheritDocTaglet.java line 120: > 118: // that this method overrides > 119: messages.error(inheritDocPath, "doclet.inheritDocBadSupertype"); > 120: return replacement; Another case for `invalidTagOutput` ? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222037366 PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222032679 PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222035009 PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222037884 From mchung at openjdk.org Wed Jun 7 19:10:10 2023 From: mchung at openjdk.org (Mandy Chung) Date: Wed, 7 Jun 2023 19:10:10 GMT Subject: RFR: 8309630: Clean up tests that reference deploy modules Message-ID: Trivial fix. The deploy modules no longer exist. The tests are updated not to reference them. ------------- Commit messages: - 8309630: Clean up tests that reference deploy modules Changes: https://git.openjdk.org/jdk/pull/14367/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14367&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309630 Stats: 20 lines in 2 files changed: 0 ins; 15 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/14367.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14367/head:pull/14367 PR: https://git.openjdk.org/jdk/pull/14367 From jjg at openjdk.org Wed Jun 7 19:10:55 2023 From: jjg at openjdk.org (Jonathan Gibbons) Date: Wed, 7 Jun 2023 19:10:55 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 16:02:40 GMT, Pavel Rappo wrote: >> Please review this long-awaited change to documentation inheritance. >> >> This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: >> >> ?{@inheritDoc S} >> >> Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". > > Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: > > feedback: make warning less scary src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/InheritableTaglet.java line 53: > 51: * > 52: * In the future, this could be reworked using some other mechanism, > 53: * such as throwing an exception. Should `ThrowsTaglet.Failure` (eventually?) be declared here in `InheritableTaglet` ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222046447 From rgiulietti at openjdk.org Wed Jun 7 19:14:36 2023 From: rgiulietti at openjdk.org (Raffaello Giulietti) Date: Wed, 7 Jun 2023 19:14:36 GMT Subject: RFR: 8309515: Stale cached data from Matcher.namedGroups() after Matcher.usePattern() [v3] In-Reply-To: References: Message-ID: > The cached `namedGroup` field must be invalidated during an invocation of `Matcher.usePattern()` Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision: Added descriptions to the RuntimeExceptions in the test. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14350/files - new: https://git.openjdk.org/jdk/pull/14350/files/dbe40b98..b505b42f Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14350&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14350&range=01-02 Stats: 4 lines in 1 file changed: 0 ins; 0 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/14350.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14350/head:pull/14350 PR: https://git.openjdk.org/jdk/pull/14350 From jjg at openjdk.org Wed Jun 7 19:16:53 2023 From: jjg at openjdk.org (Jonathan Gibbons) Date: Wed, 7 Jun 2023 19:16:53 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 16:02:40 GMT, Pavel Rappo wrote: >> Please review this long-awaited change to documentation inheritance. >> >> This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: >> >> ?{@inheritDoc S} >> >> Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". > > Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: > > feedback: make warning less scary src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFinder.java line 54: > 52: > 53: @SuppressWarnings("serial") > 54: public static final class NoOverriddenMethodFound extends Exception { General comment, for future work: Maybe we can combine/merge/unify this exception with `ThrowsTaglet.Failure` src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java line 671: > 669: // .anyMatch(t -> Objects.equals(typeUtils.asElement(t), typeUtils.asElement(t2))); > 670: > 671: return true; /* disabled for causing issues in JDK API Documentation build */ Please describe the issues and/or provide a JBS issue, so that we can decide when to revert the code to the commented-out form. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222051685 PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222053011 From jjg at openjdk.org Wed Jun 7 19:19:51 2023 From: jjg at openjdk.org (Jonathan Gibbons) Date: Wed, 7 Jun 2023 19:19:51 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 16:02:40 GMT, Pavel Rappo wrote: >> Please review this long-awaited change to documentation inheritance. >> >> This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: >> >> ?{@inheritDoc S} >> >> Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". > > Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: > > feedback: make warning less scary src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java line 2847: > 2845: break; > 2846: } > 2847: if (isPlainInterface(peek) && !isPublic(peek) && !isLinkable(peek)) { What is the significance of the `isPublic` check? I'm developing a knee-jerk reaction to such checks, in the face of access-related command-line options. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222055578 From rriggs at openjdk.org Wed Jun 7 19:47:48 2023 From: rriggs at openjdk.org (Roger Riggs) Date: Wed, 7 Jun 2023 19:47:48 GMT Subject: RFR: 8309515: Stale cached data from Matcher.namedGroups() after Matcher.usePattern() [v3] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 19:14:36 GMT, Raffaello Giulietti wrote: >> The cached `namedGroup` field must be invalidated during an invocation of `Matcher.usePattern()` > > Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision: > > Added descriptions to the RuntimeExceptions in the test. LGTM, Thanks for the updates. ------------- Marked as reviewed by rriggs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14350#pullrequestreview-1468436579 From psandoz at openjdk.org Wed Jun 7 20:29:53 2023 From: psandoz at openjdk.org (Paul Sandoz) Date: Wed, 7 Jun 2023 20:29:53 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: <-kOBGesTZAI0Gq7kG8AlOYlyilTDv03nIAi9mpuDv7s=.258247ca-a044-4407-b2df-e86fae1b22b4@github.com> References: <6lpkAjfDuU46l1k6iDWwuNhFgaxkLICRQNv5Sxh3U-Q=.957d4c50-5ee9-468c-b092-248dfbd56153@github.com> <-kOBGesTZAI0Gq7kG8AlOYlyilTDv03nIAi9mpuDv7s=.258247ca-a044-4407-b2df-e86fae1b22b4@github.com> Message-ID: On Wed, 7 Jun 2023 00:10:59 GMT, Paul Sandoz wrote: >>> I believe instead of changing the guards we can change the implementation of the static methods on the concrete static VHs to call `asDirect()` (lets also add `@ForceInline` on `asDirect`), since `linkToStatic` will pass the args to the static method described by the member name (since the lazy and direct VH handles share the same var form). >>> >>> That has the nice effect of pushing the complexity closer to where it is needed. Its subtle but i think can be explained. Thereby we can reduce the memory footprint for subsequent access modes. Perhaps we can even "zero" out the MH cache on initialization? >> >> Is this aimed at decreasing long-term invocation cost or the initial invocation cost? FYI long-term invocation is already efficient enough; if this is for initial invocation, which can potentially bypass costly MH construction, I recommend creating an alternative method to `asDirect` for the purpose to be called and casted by X-VarHandle implementations. > >> Is this aimed at decreasing long-term invocation cost or the initial invocation cost? FYI long-term invocation is already efficient enough; if this is for initial invocation, which can potentially bypass costly MH construction, I recommend creating an alternative method to `asDirect` for the purpose to be called and casted by X-VarHandle implementations. > > It aims to reduce the cost of getting to peak performance (the work that C2 has to perform) and reduce the overall memory footprint of such VHs (as long as the user does not explicitly request MHs from them). Assuming of course that the peak performance is good! > > For this pattern i not sure we need to create another method returning the target that effectively does the same as `asDirect`, and instead it may come down to better naming and documentation of the concepts. > > There is already a tight coupling between the `LazyInitializingVarHandle` and its target via the sharing of the var forms. Renaming `asDirect` to `target` might do it, and we refine a what a direct handle is to mean the guards just pass along the handle that is given to it, otherwise we use a (lazily created) method handle to its target. Thereby a VH implementation free to switch between indirect and direct and is further free to deal with any implementation specific indirection in its own implementation. > @PaulSandoz Thank you for your suggestion! It might be harder to measure the time to get to peak performance, but at least for the initial invocation, the lazy VH is almost no different from the eager VH now. The old overhead was mostly from LambdaForm spinning, same for the lazy DMH overhead. Ok, i did not mean to suggest measuring time to peak performance, it's hard as you say. I was more thinking of an intuitive understanding of the cost (work performed by C2 and runtime memory footprint). > Is this what you've envisioned? Close, I was suggesting the following: - `LazyInitializingVarHandle::target` just returns `target` and does not call `ensureInitialized`. - Override `checkAccessModeThenIsDirect` as you did before, but returns `initialized`. - Change only the static field var handle implementations to call `target()`, since it is unnecessary on the others. However, i think your approach is better as it avoids any implicit MH creation. Suggest refining as follows: - Change only the static field var handle implementations to call `target()`, since it is unnecessary on the others. - Split `ensureInitialized` in two: @ForceInline private void ensureInitialized() { if (this.initialized) return; initialize(); } private void initialize() { UNSAFE.ensureClassInitialized(refc); this.initialized = true; ... } I am wondering if the simplest approach in `initialize` is to set the `methodHandleTable` to null? ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1581461851 From jjg at openjdk.org Wed Jun 7 20:41:57 2023 From: jjg at openjdk.org (Jonathan Gibbons) Date: Wed, 7 Jun 2023 20:41:57 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 16:02:40 GMT, Pavel Rappo wrote: >> Please review this long-awaited change to documentation inheritance. >> >> This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: >> >> ?{@inheritDoc S} >> >> Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". > > Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: > > feedback: make warning less scary test/langtools/jdk/javadoc/doclet/testDirectedInheritance/TestDirectedInheritance.java line 75: > 73: // code is OK, it likely isn't (after all, there's an unknown tag). > 74: setAutomaticCheckNoStacktrace(true); > 75: { // DocLint is on "on" -> "explicit" test/langtools/jdk/javadoc/doclet/testDirectedInheritance/TestDirectedInheritance.java line 85: > 83: } > 84: } > 85: // DocLint is off "off" -> "default" test/langtools/jdk/javadoc/doclet/testDirectedInheritance/TestDirectedInheritance.java line 289: > 287: > 288: /* > 289: * C1.m inherits documentation from B1.m explicitly and undirect. possible typo: do you mean "indirect" test/langtools/jdk/javadoc/doclet/testDirectedInheritance/TestDirectedInheritance.java line 673: > 671: * > 672: * For now a warning is issued if a doc comment inherits from > 673: * an indirect supertype. Not sure I agree with this. Can we discuss? test/langtools/jdk/javadoc/doclet/testMethodCommentAlgorithm/TestMethodCommentsAlgorithm.java line 61: > 59: import toolbox.ToolBox; > 60: > 61: /* Great description! :-) test/langtools/jdk/javadoc/doclet/testMethodCommentAlgorithm/TestMethodCommentsAlgorithm.java line 111: > 109: * built. > 110: */ > 111: public class TestMethodCommentsAlgorithm extends JavadocTester { General comment for entire class: great/clever test! test/langtools/jdk/javadoc/doclet/testMethodCommentAlgorithm/TestMethodCommentsAlgorithm.java line 273: > 271: } > 272: } > 273: System.err.println("Test suite root: " + p); You might want to use `JavadocTester.out` instead of `System.err` ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222117577 PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222117867 PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222119420 PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222122630 PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222124323 PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222130052 PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222126057 From prappo at openjdk.org Wed Jun 7 20:51:53 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Wed, 7 Jun 2023 20:51:53 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 20:29:07 GMT, Jonathan Gibbons wrote: >> Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: >> >> feedback: make warning less scary > > test/langtools/jdk/javadoc/doclet/testDirectedInheritance/TestDirectedInheritance.java line 673: > >> 671: * >> 672: * For now a warning is issued if a doc comment inherits from >> 673: * an indirect supertype. > > Not sure I agree with this. Can we discuss? Sure we can; this relates to an earlier comment of yours on Utils.isDirectSupertype here: https://github.com/openjdk/jdk/pull/14357#discussion_r1222053011 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222141331 From prappo at openjdk.org Wed Jun 7 20:54:52 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Wed, 7 Jun 2023 20:54:52 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 19:13:55 GMT, Jonathan Gibbons wrote: >> Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: >> >> feedback: make warning less scary > > src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java line 671: > >> 669: // .anyMatch(t -> Objects.equals(typeUtils.asElement(t), typeUtils.asElement(t2))); >> 670: >> 671: return true; /* disabled for causing issues in JDK API Documentation build */ > > Please describe the issues and/or provide a JBS issue, so that we can decide when to revert the code to the commented-out form. I mentioned it in the test, here: TestDirectedInheritance.testNotDirectSupertype. I reckon referring to code from a test is okay, but not the other way around. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222148500 From prappo at openjdk.org Wed Jun 7 21:04:53 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Wed, 7 Jun 2023 21:04:53 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 19:16:51 GMT, Jonathan Gibbons wrote: >> Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: >> >> feedback: make warning less scary > > src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java line 2847: > >> 2845: break; >> 2846: } >> 2847: if (isPlainInterface(peek) && !isPublic(peek) && !isLinkable(peek)) { > > What is the significance of the `isPublic` check? > I'm developing a knee-jerk reaction to such checks, in the face of access-related command-line options. That directly mimics the current behaviour at addSuperInterfaces(Utils.java:802), which in turn is used at ImplementedMethods(VisibleMemberTable.java:1064) to collect overridden methods in superinterfaces. If you look around, it's quite an idiom and predates this PR. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222173441 From mchung at openjdk.org Wed Jun 7 21:37:04 2023 From: mchung at openjdk.org (Mandy Chung) Date: Wed, 7 Jun 2023 21:37:04 GMT Subject: RFR: 8305104: Remove old core reflection implementation Message-ID: JEP 416 integrated in JDK 18 and since then, only a couple minor issues has been reported. Those issues were related with exception being thrown with invalid arguments. We propose to remove the old core reflection implementation in JDK 22. The `-Djdk.reflect.useDirectMethodHandle=false` workaround to revert to the old implementation will stop to work. ------------- Commit messages: - clean up - Merge branch 'master' of https://github.com/openjdk/jdk into remove-old-reflection - Merge branch 'master' of https://github.com/openjdk/jdk into remove-old-reflection - Merge branch 'master' of https://github.com/openjdk/jdk into remove-old-reflection - merge - Merge branch 'master' of https://github.com/openjdk/jdk into remove-old-reflection - 8305104: Remove the old core reflection implementation Changes: https://git.openjdk.org/jdk/pull/14371/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14371&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8305104 Stats: 6319 lines in 78 files changed: 13 ins; 6238 del; 68 mod Patch: https://git.openjdk.org/jdk/pull/14371.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14371/head:pull/14371 PR: https://git.openjdk.org/jdk/pull/14371 From rgiulietti at openjdk.org Wed Jun 7 21:42:54 2023 From: rgiulietti at openjdk.org (Raffaello Giulietti) Date: Wed, 7 Jun 2023 21:42:54 GMT Subject: Integrated: 8309515: Stale cached data from Matcher.namedGroups() after Matcher.usePattern() In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 11:20:02 GMT, Raffaello Giulietti wrote: > The cached `namedGroup` field must be invalidated during an invocation of `Matcher.usePattern()` This pull request has now been integrated. Changeset: 90027ff2 Author: Raffaello Giulietti URL: https://git.openjdk.org/jdk/commit/90027ff204fcf441db6bd0076e253474631757c8 Stats: 24 lines in 2 files changed: 23 ins; 0 del; 1 mod 8309515: Stale cached data from Matcher.namedGroups() after Matcher.usePattern() Reviewed-by: rriggs ------------- PR: https://git.openjdk.org/jdk/pull/14350 From jjg at openjdk.org Wed Jun 7 21:43:50 2023 From: jjg at openjdk.org (Jonathan Gibbons) Date: Wed, 7 Jun 2023 21:43:50 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 16:02:40 GMT, Pavel Rappo wrote: >> Please review this long-awaited change to documentation inheritance. >> >> This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: >> >> ?{@inheritDoc S} >> >> Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". > > Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: > > feedback: make warning less scary Great work in a difficult area overflowing with Technical Debt. I've made various (optional) suggestions, I'll approve for now, but will look again if you want to make ore changes. ------------- Marked as reviewed by jjg (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14357#pullrequestreview-1468628610 From jjg at openjdk.org Wed Jun 7 21:43:53 2023 From: jjg at openjdk.org (Jonathan Gibbons) Date: Wed, 7 Jun 2023 21:43:53 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 20:48:58 GMT, Pavel Rappo wrote: >> test/langtools/jdk/javadoc/doclet/testDirectedInheritance/TestDirectedInheritance.java line 673: >> >>> 671: * >>> 672: * For now a warning is issued if a doc comment inherits from >>> 673: * an indirect supertype. >> >> Not sure I agree with this. Can we discuss? > > Sure we can; this relates to an earlier comment of yours on Utils.isDirectSupertype here: https://github.com/openjdk/jdk/pull/14357#discussion_r1222053011 The general criticism here is whether we should restrict in any way the set of super types from which one can inherit documentation, and/or what should the set of checks be? For example, if a method in C inherits a method in B that has no comment but which inherits a method with a comment in A, then it seems unduly restrictive to stop the method in C explicitly referencing the method in A, as compared to only allowing a reference to B, which implicitly gets its comment from A. That being said, there is merit in starting off with restrictions and loosening them in the face of experience, rather than trying to increase the stylistic restrictions later. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222202085 From jjg at openjdk.org Wed Jun 7 21:43:54 2023 From: jjg at openjdk.org (Jonathan Gibbons) Date: Wed, 7 Jun 2023 21:43:54 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 21:37:42 GMT, Jonathan Gibbons wrote: >> Sure we can; this relates to an earlier comment of yours on Utils.isDirectSupertype here: https://github.com/openjdk/jdk/pull/14357#discussion_r1222053011 > > The general criticism here is whether we should restrict in any way the set of super types from which one can inherit documentation, and/or what should the set of checks be? > > For example, if a method in C inherits a method in B that has no comment but which inherits a method with a comment in A, then it seems unduly restrictive to stop the method in C explicitly referencing the method in A, as compared to only allowing a reference to B, which implicitly gets its comment from A. > > That being said, there is merit in starting off with restrictions and loosening them in the face of experience, rather than trying to increase the stylistic restrictions later. > Sure we can; this relates to an earlier comment of yours on Utils.isDirectSupertype here: [#14357 (comment)](https://github.com/openjdk/jdk/pull/14357#discussion_r1222053011) Thanks for tying these together; I had not realized they were related. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222203243 From mchung at openjdk.org Wed Jun 7 22:02:57 2023 From: mchung at openjdk.org (Mandy Chung) Date: Wed, 7 Jun 2023 22:02:57 GMT Subject: RFR: 8305104: Remove the old core reflection implementation [v2] In-Reply-To: References: Message-ID: > JEP 416 integrated in JDK 18 and since then, only a couple minor issues has been reported. Those issues were related with exception being thrown with invalid arguments. We propose to remove the old core reflection implementation in JDK 22. The `-Djdk.reflect.useDirectMethodHandle=false` workaround to revert to the old implementation will stop to work. Mandy Chung has updated the pull request incrementally with one additional commit since the last revision: fix merge issue ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14371/files - new: https://git.openjdk.org/jdk/pull/14371/files/73340aa9..d161a384 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14371&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14371&range=00-01 Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/14371.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14371/head:pull/14371 PR: https://git.openjdk.org/jdk/pull/14371 From liach at openjdk.org Wed Jun 7 22:44:55 2023 From: liach at openjdk.org (Chen Liang) Date: Wed, 7 Jun 2023 22:44:55 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v10] In-Reply-To: References: Message-ID: > Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. > > A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. > > Current problems: > - [ ] The lazy var handle is quite slow on the first invocation. > - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. > - After that, the lazy handle has a performance on par with the regular var handle. > - [ ] The class-loading-based test is not in a unit test > - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading > > > Benchmark Mode Cnt Score Error Units > VarHandleLazyStaticInvocation.initializedInvocation avgt 30 0.817 ? 0.012 ns/op > VarHandleLazyStaticInvocation.lazyInvocation avgt 30 0.805 ? 0.007 ns/op > > > Benchmark Mode Cnt Score Error Units > Benchmark Mode Cnt Score Error Units > LazyStaticColdStart.methodHandleCreateEager ss 10 36.890 ? 2.891 us/op > LazyStaticColdStart.methodHandleCreateLazy ss 10 18.340 ? 1.537 us/op > LazyStaticColdStart.methodHandleInitializeCallEager ss 10 50.000 ? 5.590 us/op > LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 90.550 ? 10.142 us/op > LazyStaticColdStart.varHandleCreateEager ss 10 36.610 ? 2.685 us/op > LazyStaticColdStart.varHandleCreateLazy ss 10 18.200 ? 1.811 us/op > LazyStaticColdStart.varHandleInitializeCallEager ss 10 71.680 ? 11.097 us/op > LazyStaticColdStart.varHandleInitializeCallLazy ss 10 72.090 ? 4.494 us/op Chen Liang has updated the pull request incrementally with one additional commit since the last revision: Split ensureInitialized ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13821/files - new: https://git.openjdk.org/jdk/pull/13821/files/f414e8f8..acca36fe Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13821&range=09 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13821&range=08-09 Stats: 5 lines in 1 file changed: 5 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/13821.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13821/head:pull/13821 PR: https://git.openjdk.org/jdk/pull/13821 From liach at openjdk.org Wed Jun 7 22:44:57 2023 From: liach at openjdk.org (Chen Liang) Date: Wed, 7 Jun 2023 22:44:57 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: References: <6lpkAjfDuU46l1k6iDWwuNhFgaxkLICRQNv5Sxh3U-Q=.957d4c50-5ee9-468c-b092-248dfbd56153@github.com> <-kOBGesTZAI0Gq7kG8AlOYlyilTDv03nIAi9mpuDv7s=.258247ca-a044-4407-b2df-e86fae1b22b4@github.com> Message-ID: On Wed, 7 Jun 2023 20:26:47 GMT, Paul Sandoz wrote: > Change only the static field var handle implementations to call `target()`, since it is unnecessary on the others. Unfortunately, I don't think there is a convenient way for VH implementations to easily unwrap the correct VH; a `target()` call is more convenient than an extra instanceof check and cast and get. > I am wondering if the simplest approach in `initialize` is to set the `methodHandleTable` to null? I update the entries in the table because they are already created and potentially live on the heap or stack. Those entries should benefit from the post-initialization performance benefits as well. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1581603143 From dnsimon at openjdk.org Wed Jun 7 22:56:23 2023 From: dnsimon at openjdk.org (Doug Simon) Date: Wed, 7 Jun 2023 22:56:23 GMT Subject: RFR: 8309390: [JVMCI] improve copying system properties into libgraal [v2] In-Reply-To: <9bsjzlbHK31VVyGwzyhpSBjSILWFxmAX0IfiWK6Wb_w=.197d2b45-dba5-43bc-ac4e-4f993d3e777a@github.com> References: <9bsjzlbHK31VVyGwzyhpSBjSILWFxmAX0IfiWK6Wb_w=.197d2b45-dba5-43bc-ac4e-4f993d3e777a@github.com> Message-ID: > This PR improves the startup time for libgraal by speeding up how `VM.savedProps` is copied into libgraal. This data structure is now serialized to a native buffer directly from C++ and the native buffer is then directly decoded by libgraal. > > ## Times > > The basic benchmarking below shows that this change brings the time for a nop Java app with eager libgraal initialization (2) down to almost the same time as lazy libgraal initialization (1). The latter typically means no libgraal initialization happens as a top tier JIT compilation is never scheduled in such a short running app. > > > public class Nop { > public static void main(String[] args) {} > } > > > (1) Baseline (no options): > >> for i in (seq 10); java Nop; end > 0.05 real 0.04 user 0.01 sys > 0.04 real 0.03 user 0.01 sys > 0.04 real 0.03 user 0.01 sys > 0.04 real 0.03 user 0.01 sys > 0.03 real 0.03 user 0.00 sys > 0.04 real 0.03 user 0.01 sys > 0.04 real 0.03 user 0.00 sys > 0.03 real 0.03 user 0.00 sys > 0.04 real 0.03 user 0.01 sys > 0.03 real 0.03 user 0.00 sys > > > (2) Eagerly initialize libgraal (with PR): > >> for i in (seq 10); /usr/bin/time java -XX:+EagerJVMCI Nop; end > 0.06 real 0.04 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > > > (3) Eagerly initialize libgraal (without PR): > >> for i in (seq 10); /usr/bin/time java -XX:+EagerJVMCI Nop; end > 0.11 real 0.08 user 0.02 sys > 0.08 real 0.06 user 0.01 sys > 0.08 real 0.07 user 0.01 sys > 0.10 real 0.07 user 0.01 sys > 0.08 real 0.06 user 0.01 sys > 0.10 real 0.07 user 0.01 sys > 0.08 real 0.07 user 0.01 sys > 0.08 real 0.07 user 0.01 sys > 0.08 real 0.06 user 0.01 sys > 0.08 real ... Doug Simon has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits: - [skip ci] snapshot Arguments::system_properties() in JVMCI instead of System.savedProps - more efficient copying of system properties into libjvmci ------------- Changes: https://git.openjdk.org/jdk/pull/14291/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14291&range=01 Stats: 277 lines in 17 files changed: 103 ins; 89 del; 85 mod Patch: https://git.openjdk.org/jdk/pull/14291.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14291/head:pull/14291 PR: https://git.openjdk.org/jdk/pull/14291 From dnsimon at openjdk.org Wed Jun 7 22:56:23 2023 From: dnsimon at openjdk.org (Doug Simon) Date: Wed, 7 Jun 2023 22:56:23 GMT Subject: RFR: 8309390: [JVMCI] improve copying system properties into libgraal In-Reply-To: <9bsjzlbHK31VVyGwzyhpSBjSILWFxmAX0IfiWK6Wb_w=.197d2b45-dba5-43bc-ac4e-4f993d3e777a@github.com> References: <9bsjzlbHK31VVyGwzyhpSBjSILWFxmAX0IfiWK6Wb_w=.197d2b45-dba5-43bc-ac4e-4f993d3e777a@github.com> Message-ID: On Fri, 2 Jun 2023 20:32:14 GMT, Doug Simon wrote: > This PR improves the startup time for libgraal by speeding up how `VM.savedProps` is copied into libgraal. This data structure is now serialized to a native buffer directly from C++ and the native buffer is then directly decoded by libgraal. > > ## Times > > The basic benchmarking below shows that this change brings the time for a nop Java app with eager libgraal initialization (2) down to almost the same time as lazy libgraal initialization (1). The latter typically means no libgraal initialization happens as a top tier JIT compilation is never scheduled in such a short running app. > > > public class Nop { > public static void main(String[] args) {} > } > > > (1) Baseline (no options): > >> for i in (seq 10); java Nop; end > 0.05 real 0.04 user 0.01 sys > 0.04 real 0.03 user 0.01 sys > 0.04 real 0.03 user 0.01 sys > 0.04 real 0.03 user 0.01 sys > 0.03 real 0.03 user 0.00 sys > 0.04 real 0.03 user 0.01 sys > 0.04 real 0.03 user 0.00 sys > 0.03 real 0.03 user 0.00 sys > 0.04 real 0.03 user 0.01 sys > 0.03 real 0.03 user 0.00 sys > > > (2) Eagerly initialize libgraal (with PR): > >> for i in (seq 10); /usr/bin/time java -XX:+EagerJVMCI Nop; end > 0.06 real 0.04 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > 0.05 real 0.03 user 0.01 sys > > > (3) Eagerly initialize libgraal (without PR): > >> for i in (seq 10); /usr/bin/time java -XX:+EagerJVMCI Nop; end > 0.11 real 0.08 user 0.02 sys > 0.08 real 0.06 user 0.01 sys > 0.08 real 0.07 user 0.01 sys > 0.10 real 0.07 user 0.01 sys > 0.08 real 0.06 user 0.01 sys > 0.10 real 0.07 user 0.01 sys > 0.08 real 0.07 user 0.01 sys > 0.08 real 0.07 user 0.01 sys > 0.08 real 0.06 user 0.01 sys > 0.08 real ... Ok, I've pushed a change with your suggestion Tom and it seems to work. It assumes `Arguments::system_properties()` is fully initialized and effectively read-only by the time `JVMCIEnv::init_saved_properties` is called. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14291#issuecomment-1581611494 From dnsimon at openjdk.org Wed Jun 7 22:56:23 2023 From: dnsimon at openjdk.org (Doug Simon) Date: Wed, 7 Jun 2023 22:56:23 GMT Subject: RFR: 8309390: [JVMCI] improve copying system properties into libgraal [v2] In-Reply-To: References: <9bsjzlbHK31VVyGwzyhpSBjSILWFxmAX0IfiWK6Wb_w=.197d2b45-dba5-43bc-ac4e-4f993d3e777a@github.com> Message-ID: <3jeOthuzzSjWn2lHwJmkJGK3gzuK7JutCyQDoo4xrKQ=.577bc443-26fc-4da1-9143-1a00bc4c5d91@github.com> On Wed, 7 Jun 2023 22:51:48 GMT, Doug Simon wrote: >> This PR improves the startup time for libgraal by speeding up how `VM.savedProps` is copied into libgraal. This data structure is now serialized to a native buffer directly from C++ and the native buffer is then directly decoded by libgraal. >> >> ## Times >> >> The basic benchmarking below shows that this change brings the time for a nop Java app with eager libgraal initialization (2) down to almost the same time as lazy libgraal initialization (1). The latter typically means no libgraal initialization happens as a top tier JIT compilation is never scheduled in such a short running app. >> >> >> public class Nop { >> public static void main(String[] args) {} >> } >> >> >> (1) Baseline (no options): >> >>> for i in (seq 10); java Nop; end >> 0.05 real 0.04 user 0.01 sys >> 0.04 real 0.03 user 0.01 sys >> 0.04 real 0.03 user 0.01 sys >> 0.04 real 0.03 user 0.01 sys >> 0.03 real 0.03 user 0.00 sys >> 0.04 real 0.03 user 0.01 sys >> 0.04 real 0.03 user 0.00 sys >> 0.03 real 0.03 user 0.00 sys >> 0.04 real 0.03 user 0.01 sys >> 0.03 real 0.03 user 0.00 sys >> >> >> (2) Eagerly initialize libgraal (with PR): >> >>> for i in (seq 10); /usr/bin/time java -XX:+EagerJVMCI Nop; end >> 0.06 real 0.04 user 0.01 sys >> 0.05 real 0.03 user 0.01 sys >> 0.05 real 0.03 user 0.01 sys >> 0.05 real 0.03 user 0.01 sys >> 0.05 real 0.03 user 0.01 sys >> 0.05 real 0.03 user 0.01 sys >> 0.05 real 0.03 user 0.01 sys >> 0.05 real 0.03 user 0.01 sys >> 0.05 real 0.03 user 0.01 sys >> 0.05 real 0.03 user 0.01 sys >> >> >> (3) Eagerly initialize libgraal (without PR): >> >>> for i in (seq 10); /usr/bin/time java -XX:+EagerJVMCI Nop; end >> 0.11 real 0.08 user 0.02 sys >> 0.08 real 0.06 user 0.01 sys >> 0.08 real 0.07 user 0.01 sys >> 0.10 real 0.07 user 0.01 sys >> 0.08 real 0.06 user 0.01 sys >> 0.10 real 0.07 user 0.01 sys >> 0.08 real 0.07 user 0.01 sys >> 0.08 real ... > > Doug Simon has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits: > > - [skip ci] snapshot Arguments::system_properties() in JVMCI instead of System.savedProps > - more efficient copying of system properties into libjvmci src/hotspot/share/jvmci/jvmciJavaClasses.hpp line 60: > 58: jvmci_constructor) \ > 59: start_class(Services, jdk_vm_ci_services_Services) \ > 60: jvmci_method(CallStaticVoidMethod, GetStaticMethodID, call_static, void, Services, initializeSavedProperties, byte_array_void_signature, (JVMCIObject serializedProperties)) \ The final arg for the `jvmci_method` macro is never used so I removed it everywhere. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14291#discussion_r1222257086 From bchristi at openjdk.org Thu Jun 8 00:03:47 2023 From: bchristi at openjdk.org (Brent Christian) Date: Thu, 8 Jun 2023 00:03:47 GMT Subject: RFR: 8309630: Clean up tests that reference deploy modules In-Reply-To: References: Message-ID: <6gIwqDW8XyZwsxxDdsB-7E9sAuS2TOeiLPAdzm4bglY=.9fb94e17-2c6c-4845-9c16-b980c1ed1e3a@github.com> On Wed, 7 Jun 2023 19:03:31 GMT, Mandy Chung wrote: > Trivial fix. The deploy modules no longer exist. The tests are updated not to reference them. Looks fine. ------------- Marked as reviewed by bchristi (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14367#pullrequestreview-1468750248 From psandoz at openjdk.org Thu Jun 8 00:15:51 2023 From: psandoz at openjdk.org (Paul Sandoz) Date: Thu, 8 Jun 2023 00:15:51 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: References: <6lpkAjfDuU46l1k6iDWwuNhFgaxkLICRQNv5Sxh3U-Q=.957d4c50-5ee9-468c-b092-248dfbd56153@github.com> <-kOBGesTZAI0Gq7kG8AlOYlyilTDv03nIAi9mpuDv7s=.258247ca-a044-4407-b2df-e86fae1b22b4@github.com> Message-ID: On Wed, 7 Jun 2023 22:38:29 GMT, Chen Liang wrote: > > Change only the static field var handle implementations to call `target()`, since it is unnecessary on the others. > > Unfortunately, I don't think there is a convenient way for VH implementations to easily unwrap the correct VH; a `target()` call is more convenient than an extra instanceof check and cast and get. > We don't need to update *all* VH implementations to call target. We only need to update the static field VH implementations which we know may be passed an instance of `LazyInitializingVarHandle` or its concrete instance. > > I am wondering if the simplest approach in `initialize` is to set the `methodHandleTable` to null? > > I update the entries in the table because they are already created and potentially live on the heap or stack. Those entries should benefit from the post-initialization performance benefits as well. Ok, yes, it's less likely now but possible a MH has been explicitly obtained before the defining class has been intialized. In this case I still think we can clear the table out after processing any existing entries, since subsequent requests for MHs after initialization will defer to the target's method handle table. We will need some tests covering this edge case. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1581684274 From jiangli at openjdk.org Thu Jun 8 00:29:14 2023 From: jiangli at openjdk.org (Jiangli Zhou) Date: Thu, 8 Jun 2023 00:29:14 GMT Subject: RFR: 8307858: [REDO] JDK-8307194 Add make target for optionally building a complete set of all JDK and hotspot libjvm static libraries [v6] In-Reply-To: References: Message-ID: > Original description for JDK-8307194 change: > ----- > This PR is branched from the makefile changes for https://bugs.openjdk.org/browse/JDK-8303796 and contains the following for handling the JDK/hotspot static libraries: > > - Build hotspot libjvm.a and JDK static libraries for static-libs-image/static-libs-bundles targets; This change does not affect the graal-builder-image target > > - For libjvm.a specifically, exclude operator_new.o > > - Filter out "external" .o files (those are the .o files included from a different JDK library and needed when creating the .so shared library only) from JDK .a libraries; That's to avoid linker failures caused by duplicate symbols > - For libjli.a: Not include inflate.o inftrees.o inffast.o zadler32.o zcrc32.o zutil.o (compiled from zlib sources) if zlib is built as JDK bundled > - For libawt_xawt.a and libawt_head.a: Not include systemScale.o, since it's provided in libawt.a > > - Handle long arguments case for static build in make/common/NativeCompilation.gmk > > - Address @erikj79's comment in https://github.com/openjdk/jdk/pull/13709#discussion_r1180750185 for LIBJLI_STATIC_EXCLUDE_OBJS > ----- > > Updates to address build failures reported on macosx- platforms: > > - For gcc/clang, when building a static library first partially link (using the `-r` linking option) all object files into one object. The output object file from the partial linking is then passed to `ar` to create the static library. > > The original change for JDK-8307194 used @argument_file for all platforms when dealing with long arguments to `ar`, which caused failures on macosx- builds. On darwin (https://www.unix.com/man-page/osx/1/ar/), `ar` does not support @argument_file. The updated change avoids using @argument_file for `ar`. > > The partial linking change is done in make/common/NativeCompilation.gmk. The flag related change is done in make/autoconf/flags-ldflags.m4 mainly. Jiangli Zhou 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 branch 'master' into JDK-8307858 - Address comments/suggestions from @erikj79: - Only do partial linking step for building static libraries with clang on linux. - On macosx, workaround the long argument issue for 'AR' with relative path. Tested building jdk-image and static-libs-image on linux-x64 (for both gcc and clang) and macosx-x64 (clang) manually. - Update make/common/NativeCompilation.gmk Thanks you! Co-authored-by: Erik Joelsson <37597443+erikj79 at users.noreply.github.com> - - Add $$($1_LD) $$($1_SYSROOT_LDFLAGS) to $1_VARDEPS if $(TOOLCHAIN_TYPE) is gcc or clang, as suggested by @erikj79. - Update make/common/NativeCompilation.gmk Co-authored-by: Erik Joelsson <37597443+erikj79 at users.noreply.github.com> - Merge branch 'master' into JDK-8307858 - Merge branch 'master' into JDK-8307858 - Clean up. - In clude $MACHINE_FLAG in partial linking flag. - Use '-m32' instead of '-m elf_i386'. - ... and 7 more: https://git.openjdk.org/jdk/compare/90027ff2...1c2f75dc ------------- Changes: https://git.openjdk.org/jdk/pull/14064/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14064&range=05 Stats: 223 lines in 10 files changed: 172 ins; 34 del; 17 mod Patch: https://git.openjdk.org/jdk/pull/14064.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14064/head:pull/14064 PR: https://git.openjdk.org/jdk/pull/14064 From darcy at openjdk.org Thu Jun 8 00:37:07 2023 From: darcy at openjdk.org (Joe Darcy) Date: Thu, 8 Jun 2023 00:37:07 GMT Subject: RFR: JDK-8306584: Start of release updates for JDK 22 [v6] In-Reply-To: References: Message-ID: > Time to get JDK 22 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 39 commits: - Merge branch 'master' into JDK-8306584 - Merge branch 'master' into JDK-8306584 - Update wording to be consistent with JDK-8295071. - Merge branch 'master' into JDK-8306584 - Update wording of new constant to be consistent with JDK-8309554. - Merge branch 'master' into JDK-8306584 - Merge branch 'master' into JDK-8306584 - Merge branch 'master' into JDK-8306584 - Merge branch 'master' into JDK-8306584 - Merge branch 'master' into JDK-8306584 - ... and 29 more: https://git.openjdk.org/jdk/compare/4ffc8cc2...a03bcd40 ------------- Changes: https://git.openjdk.org/jdk/pull/13567/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13567&range=05 Stats: 5954 lines in 69 files changed: 5902 ins; 0 del; 52 mod Patch: https://git.openjdk.org/jdk/pull/13567.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13567/head:pull/13567 PR: https://git.openjdk.org/jdk/pull/13567 From duke at openjdk.org Thu Jun 8 00:54:28 2023 From: duke at openjdk.org (Nagata-Haruhito) Date: Thu, 8 Jun 2023 00:54:28 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v9] In-Reply-To: References: Message-ID: > I fixed File.listRoots description. > * remove "the insertion or ejection of removable media" > * change "available" to "existing" > > Please review this change. Nagata-Haruhito has updated the pull request incrementally with one additional commit since the last revision: Follow CSR description ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13526/files - new: https://git.openjdk.org/jdk/pull/13526/files/840cd7dc..5b230746 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13526&range=08 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13526&range=07-08 Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/13526.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13526/head:pull/13526 PR: https://git.openjdk.org/jdk/pull/13526 From bpb at openjdk.org Thu Jun 8 00:57:50 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Thu, 8 Jun 2023 00:57:50 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v9] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 00:54:28 GMT, Nagata-Haruhito wrote: >> I fixed File.listRoots description. >> * remove "the insertion or ejection of removable media" >> * change "available" to "existing" >> >> Please review this change. > > Nagata-Haruhito has updated the pull request incrementally with one additional commit since the last revision: > > Follow CSR description Marked as reviewed by bpb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/13526#pullrequestreview-1468800804 From duke at openjdk.org Thu Jun 8 00:57:52 2023 From: duke at openjdk.org (Nagata-Haruhito) Date: Thu, 8 Jun 2023 00:57:52 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v8] In-Reply-To: References: <1B_vjAxLnuMVEPMuz9EyMWRRwFomFGSpyaACzD1732k=.e76b095a-fd90-4350-a3b4-e3751ca5bc87@github.com> Message-ID: <1EiHHSxfgjzJXb6rw0fFd4TTaju4SBv4XzCAm9dAPc8=.f48fd6f8-b0e2-4475-83fd-df30a44d1f35@github.com> On Wed, 7 Jun 2023 17:47:53 GMT, Brian Burkhalter wrote: >> The CSR is updated so it's focused on the two parts of the updated docs. So I think you can finalize. > >> I think you can finalize. > > @Nagata-Haruhito I took the liberty of finalizing the CSR. If you would make the requested changes (change "the root directory" to "a root directory") in the two classes, then we can approve it and hopefully get this integrated before the JDK 21 fork. Thank you very match. I changed as follow the CSR description. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13526#discussion_r1222326058 From bpb at openjdk.org Thu Jun 8 00:57:53 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Thu, 8 Jun 2023 00:57:53 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v8] In-Reply-To: <1EiHHSxfgjzJXb6rw0fFd4TTaju4SBv4XzCAm9dAPc8=.f48fd6f8-b0e2-4475-83fd-df30a44d1f35@github.com> References: <1B_vjAxLnuMVEPMuz9EyMWRRwFomFGSpyaACzD1732k=.e76b095a-fd90-4350-a3b4-e3751ca5bc87@github.com> <1EiHHSxfgjzJXb6rw0fFd4TTaju4SBv4XzCAm9dAPc8=.f48fd6f8-b0e2-4475-83fd-df30a44d1f35@github.com> Message-ID: On Thu, 8 Jun 2023 00:53:18 GMT, Nagata-Haruhito wrote: > Thank you very match. I changed as follow the CSR description. Thank you. I have approved the PR so I think you can integrate now. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13526#discussion_r1222327170 From mchung at openjdk.org Thu Jun 8 01:04:06 2023 From: mchung at openjdk.org (Mandy Chung) Date: Thu, 8 Jun 2023 01:04:06 GMT Subject: Integrated: 8309630: Clean up tests that reference deploy modules In-Reply-To: References: Message-ID: <-ImTUClnge94C3vSfxTHQz1gnKYWfe928eFSZFJdAjw=.28d526c7-73f5-4698-827b-29c020910787@github.com> On Wed, 7 Jun 2023 19:03:31 GMT, Mandy Chung wrote: > Trivial fix. The deploy modules no longer exist. The tests are updated not to reference them. This pull request has now been integrated. Changeset: e8a59843 Author: Mandy Chung URL: https://git.openjdk.org/jdk/commit/e8a59843f21e347ba1494290c393ef7b344e3b70 Stats: 20 lines in 2 files changed: 0 ins; 15 del; 5 mod 8309630: Clean up tests that reference deploy modules Reviewed-by: bchristi ------------- PR: https://git.openjdk.org/jdk/pull/14367 From liach at openjdk.org Thu Jun 8 01:32:20 2023 From: liach at openjdk.org (Chen Liang) Date: Thu, 8 Jun 2023 01:32:20 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5] In-Reply-To: References: <6lpkAjfDuU46l1k6iDWwuNhFgaxkLICRQNv5Sxh3U-Q=.957d4c50-5ee9-468c-b092-248dfbd56153@github.com> <-kOBGesTZAI0Gq7kG8AlOYlyilTDv03nIAi9mpuDv7s=.258247ca-a044-4407-b2df-e86fae1b22b4@github.com> Message-ID: On Thu, 8 Jun 2023 00:12:39 GMT, Paul Sandoz wrote: > Ok, yes, it's less likely now but possible a MH has been explicitly obtained before the defining class has been intialized. In this case I still think we can clear the table out after processing any existing entries, since subsequent requests for MHs after initialization will defer to the target's method handle table. I think I can just replace the lazy VH's MH table with that of the target, as whatever this table's cache has the target table does as well (due to our getMethodHandleUncached delegation). This is effectively GCing the old table as well. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1581752314 From liach at openjdk.org Thu Jun 8 01:32:20 2023 From: liach at openjdk.org (Chen Liang) Date: Thu, 8 Jun 2023 01:32:20 GMT Subject: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v11] In-Reply-To: References: Message-ID: > Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. > > A few implementation-detail methods in VarHandle are now documented with the implied constraints to avoid subtle problems in the future. Changed `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy VarHandle changes. Also changed VarHandleBaseTest to report the whole incorrect type of exception caught than swallow it and leaving only a message. > > Current problems: > - [ ] The lazy var handle is quite slow on the first invocation. > - As seen in the benchmark, users can first call `Lookup::ensureInitialized` to create an eager handle. > - After that, the lazy handle has a performance on par with the regular var handle. > - [ ] The class-loading-based test is not in a unit test > - The test frameworks don't seem to offer fine-grained control for class-loading detection or reliable unloading > > > Benchmark Mode Cnt Score Error Units > VarHandleLazyStaticInvocation.initializedInvocation avgt 30 0.817 ? 0.012 ns/op > VarHandleLazyStaticInvocation.lazyInvocation avgt 30 0.805 ? 0.007 ns/op > > > Benchmark Mode Cnt Score Error Units > Benchmark Mode Cnt Score Error Units > LazyStaticColdStart.methodHandleCreateEager ss 10 36.890 ? 2.891 us/op > LazyStaticColdStart.methodHandleCreateLazy ss 10 18.340 ? 1.537 us/op > LazyStaticColdStart.methodHandleInitializeCallEager ss 10 50.000 ? 5.590 us/op > LazyStaticColdStart.methodHandleInitializeCallLazy ss 10 90.550 ? 10.142 us/op > LazyStaticColdStart.varHandleCreateEager ss 10 36.610 ? 2.685 us/op > LazyStaticColdStart.varHandleCreateLazy ss 10 18.200 ? 1.811 us/op > LazyStaticColdStart.varHandleInitializeCallEager ss 10 71.680 ? 11.097 us/op > LazyStaticColdStart.varHandleInitializeCallLazy ss 10 72.090 ? 4.494 us/op Chen Liang has updated the pull request incrementally with one additional commit since the last revision: Remove meaningless target calls and clear outdated cache as needed ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13821/files - new: https://git.openjdk.org/jdk/pull/13821/files/acca36fe..6a7a41ae Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13821&range=10 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13821&range=09-10 Stats: 126 lines in 4 files changed: 1 ins; 1 del; 124 mod Patch: https://git.openjdk.org/jdk/pull/13821.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13821/head:pull/13821 PR: https://git.openjdk.org/jdk/pull/13821 From liach at openjdk.org Thu Jun 8 01:39:50 2023 From: liach at openjdk.org (Chen Liang) Date: Thu, 8 Jun 2023 01:39:50 GMT Subject: RFR: 8305104: Remove the old core reflection implementation [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 22:02:57 GMT, Mandy Chung wrote: >> JEP 416 integrated in JDK 18 and since then, only a couple minor issues has been reported. Those issues were related with exception being thrown with invalid arguments. We propose to remove the old core reflection implementation in JDK 22. The `-Djdk.reflect.useDirectMethodHandle=false` workaround to revert to the old implementation will stop to work. > > Mandy Chung has updated the pull request incrementally with one additional commit since the last revision: > > fix merge issue test/jdk/java/lang/reflect/Field/NegativeTest.java line 27: > 25: * @test > 26: * @bug 8277451 > 27: * @run testng/othervm NegativeTest Does this still need othervm if it doesn't set system properties? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14371#discussion_r1222350708 From dholmes at openjdk.org Thu Jun 8 01:53:52 2023 From: dholmes at openjdk.org (David Holmes) Date: Thu, 8 Jun 2023 01:53:52 GMT Subject: RFR: 8305104: Remove the old core reflection implementation [v2] In-Reply-To: References: Message-ID: <99mbKbiEdzbFp3PyMA-I8UX3LPWriM6PZFX3itSTObw=.c3238b5d-1552-4455-8ebb-923ccd60480d@github.com> On Wed, 7 Jun 2023 22:02:57 GMT, Mandy Chung wrote: >> JEP 416 integrated in JDK 18 and since then, only a couple minor issues has been reported. Those issues were related with exception being thrown with invalid arguments. We propose to remove the old core reflection implementation in JDK 22. The `-Djdk.reflect.useDirectMethodHandle=false` workaround to revert to the old implementation will stop to work. > > Mandy Chung has updated the pull request incrementally with one additional commit since the last revision: > > fix merge issue Hotspot code and test changes look fine. Thanks. src/hotspot/share/classfile/verifier.cpp line 298: > 296: // NOTE: this is called too early in the bootstrapping process to be > 297: // guarded by Universe::is_gte_jdk14x_version(). > 298: // Also for lambda generated code, gte jdk8 While you are here could you delete these version comments please - they are meaningless these days. Thanks. ------------- Marked as reviewed by dholmes (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14371#pullrequestreview-1468854747 PR Review Comment: https://git.openjdk.org/jdk/pull/14371#discussion_r1222355124 From bpb at openjdk.org Thu Jun 8 02:50:49 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Thu, 8 Jun 2023 02:50:49 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v8] In-Reply-To: References: <1B_vjAxLnuMVEPMuz9EyMWRRwFomFGSpyaACzD1732k=.e76b095a-fd90-4350-a3b4-e3751ca5bc87@github.com> <1EiHHSxfgjzJXb6rw0fFd4TTaju4SBv4XzCAm9dAPc8=.f48fd6f8-b0e2-4475-83fd-df30a44d1f35@github.com> Message-ID: On Thu, 8 Jun 2023 00:54:34 GMT, Brian Burkhalter wrote: > Thank you. I have approved the PR so I think you can `/integrate` now. It needs to be `/integrate`d before I can `/sponsor` it. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13526#discussion_r1222383959 From duke at openjdk.org Thu Jun 8 04:00:34 2023 From: duke at openjdk.org (Nagata-Haruhito) Date: Thu, 8 Jun 2023 04:00:34 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v9] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 00:54:28 GMT, Nagata-Haruhito wrote: >> I fixed File.listRoots description. >> * remove "the insertion or ejection of removable media" >> * change "available" to "existing" >> >> Please review this change. > > Nagata-Haruhito has updated the pull request incrementally with one additional commit since the last revision: > > Follow CSR description Thank you for your many help. I try to sync fork to solve GHA failure. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13526#issuecomment-1581850037 From duke at openjdk.org Thu Jun 8 04:00:31 2023 From: duke at openjdk.org (Nagata-Haruhito) Date: Thu, 8 Jun 2023 04:00:31 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v10] In-Reply-To: References: Message-ID: > I fixed File.listRoots description. > * remove "the insertion or ejection of removable media" > * change "available" to "existing" > > Please review this change. Nagata-Haruhito 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 branch 'openjdk:master' into File_javadoc - Follow CSR description - Refer review comment - Move SecurityException paragraph - Merge branch 'File_javadoc' of https://github.com/Nagata-Haruhito/jdk into File_javadoc - Merge branch 'openjdk:master' into File_javadoc - Merge branch 'openjdk:master' into File_javadoc - Drop exist to available - Merge branch 'master' into File_javadoc - 8306431: The documentation of File.listRoots should be modifid after JDK-8208077 - ... and 1 more: https://git.openjdk.org/jdk/compare/2a65ba10...fe3d1573 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13526/files - new: https://git.openjdk.org/jdk/pull/13526/files/5b230746..fe3d1573 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13526&range=09 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13526&range=08-09 Stats: 113072 lines in 2134 files changed: 83044 ins; 17253 del; 12775 mod Patch: https://git.openjdk.org/jdk/pull/13526.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13526/head:pull/13526 PR: https://git.openjdk.org/jdk/pull/13526 From bpb at openjdk.org Thu Jun 8 04:49:52 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Thu, 8 Jun 2023 04:49:52 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v9] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 03:53:06 GMT, Nagata-Haruhito wrote: >> Nagata-Haruhito has updated the pull request incrementally with one additional commit since the last revision: >> >> Follow CSR description > > Thank you for your many help. I try to sync fork to solve GHA failure. @Nagata-Haruhito Thank you very much for your contribution! ------------- PR Comment: https://git.openjdk.org/jdk/pull/13526#issuecomment-1581884641 From bpb at openjdk.org Thu Jun 8 04:52:50 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Thu, 8 Jun 2023 04:52:50 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v9] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 03:53:06 GMT, Nagata-Haruhito wrote: >> Nagata-Haruhito has updated the pull request incrementally with one additional commit since the last revision: >> >> Follow CSR description > > Thank you for your many help. I try to sync fork to solve GHA failure. @Nagata-Haruhito Per the message you need to re-`/integrate`. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13526#issuecomment-1581886285 From bpb at openjdk.org Thu Jun 8 04:57:50 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Thu, 8 Jun 2023 04:57:50 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v9] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 03:53:06 GMT, Nagata-Haruhito wrote: >> Nagata-Haruhito has updated the pull request incrementally with one additional commit since the last revision: >> >> Follow CSR description > > Thank you for your many help. I try to sync fork to solve GHA failure. > @Nagata-Haruhito Per the message you need to re-`/integrate`. I pulled the fork and the docs, jdk, and images targets all build without problems. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13526#issuecomment-1581888754 From alanb at openjdk.org Thu Jun 8 05:03:53 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 8 Jun 2023 05:03:53 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v10] In-Reply-To: References: Message-ID: <1bqGdfWMl5zUcHJ4nXjbBRYBAFmrr0CY7Ba4KmXZuqc=.68f1c45f-1b32-4ee8-83ce-dcc546a0dd97@github.com> On Thu, 8 Jun 2023 04:00:31 GMT, Nagata-Haruhito wrote: >> I fixed File.listRoots description. >> * remove "the insertion or ejection of removable media" >> * change "available" to "existing" >> >> Please review this change. > > Nagata-Haruhito 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 branch 'openjdk:master' into File_javadoc > - Follow CSR description > - Refer review comment > - Move SecurityException paragraph > - Merge branch 'File_javadoc' of https://github.com/Nagata-Haruhito/jdk into File_javadoc > - Merge branch 'openjdk:master' into File_javadoc > - Merge branch 'openjdk:master' into File_javadoc > - Drop exist to available > - Merge branch 'master' into File_javadoc > - 8306431: The documentation of File.listRoots should be modifid after JDK-8208077 > - ... and 1 more: https://git.openjdk.org/jdk/compare/8c70fa45...fe3d1573 You pushed a sync up of your branch and the bots removed the "sponsor" label, you need to "/integrate" again. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13526#issuecomment-1581893687 From alanb at openjdk.org Thu Jun 8 05:55:56 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 8 Jun 2023 05:55:56 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v10] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 04:00:31 GMT, Nagata-Haruhito wrote: >> I fixed File.listRoots description. >> * remove "the insertion or ejection of removable media" >> * change "available" to "existing" >> >> Please review this change. > > Nagata-Haruhito 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 branch 'openjdk:master' into File_javadoc > - Follow CSR description > - Refer review comment > - Move SecurityException paragraph > - Merge branch 'File_javadoc' of https://github.com/Nagata-Haruhito/jdk into File_javadoc > - Merge branch 'openjdk:master' into File_javadoc > - Merge branch 'openjdk:master' into File_javadoc > - Drop exist to available > - Merge branch 'master' into File_javadoc > - 8306431: The documentation of File.listRoots should be modifid after JDK-8208077 > - ... and 1 more: https://git.openjdk.org/jdk/compare/25da80f6...fe3d1573 Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/13526#pullrequestreview-1469052090 From duke at openjdk.org Thu Jun 8 07:00:55 2023 From: duke at openjdk.org (Nagata-Haruhito) Date: Thu, 8 Jun 2023 07:00:55 GMT Subject: RFR: 8306431: File.listRoots method description should be re-examined [v10] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 04:00:31 GMT, Nagata-Haruhito wrote: >> I fixed File.listRoots description. >> * remove "the insertion or ejection of removable media" >> * change "available" to "existing" >> >> Please review this change. > > Nagata-Haruhito 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 branch 'openjdk:master' into File_javadoc > - Follow CSR description > - Refer review comment > - Move SecurityException paragraph > - Merge branch 'File_javadoc' of https://github.com/Nagata-Haruhito/jdk into File_javadoc > - Merge branch 'openjdk:master' into File_javadoc > - Merge branch 'openjdk:master' into File_javadoc > - Drop exist to available > - Merge branch 'master' into File_javadoc > - 8306431: The documentation of File.listRoots should be modifid after JDK-8208077 > - ... and 1 more: https://git.openjdk.org/jdk/compare/cc32891e...fe3d1573 Sorry. I retyped `/integrate`. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13526#issuecomment-1581993322 From duke at openjdk.org Thu Jun 8 07:06:58 2023 From: duke at openjdk.org (Nagata-Haruhito) Date: Thu, 8 Jun 2023 07:06:58 GMT Subject: Integrated: 8306431: File.listRoots method description should be re-examined In-Reply-To: References: Message-ID: On Wed, 19 Apr 2023 07:34:30 GMT, Nagata-Haruhito wrote: > I fixed File.listRoots description. > * remove "the insertion or ejection of removable media" > * change "available" to "existing" > > Please review this change. This pull request has now been integrated. Changeset: 9d64a9d2 Author: Nagata-Haruhito <84066412+Nagata-Haruhito at users.noreply.github.com> Committer: Alan Bateman URL: https://git.openjdk.org/jdk/commit/9d64a9d22034602d2d195463093268102a583f9f Stats: 28 lines in 2 files changed: 15 ins; 11 del; 2 mod 8306431: File.listRoots method description should be re-examined Reviewed-by: bpb, alanb ------------- PR: https://git.openjdk.org/jdk/pull/13526 From asotona at openjdk.org Thu Jun 8 07:23:56 2023 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 8 Jun 2023 07:23:56 GMT Subject: RFR: 8304425: ClassHierarchyResolver from Reflection [v9] In-Reply-To: <0RmULuYLatKjDyzBQB7Qxep-oSkpCKdh7zBDzuQiPvM=.2eed570e-cc6d-4103-b733-8cca3c4eaf33@github.com> References: <08Hy6pEhV75yr_F4mCP-dkKOKMCSoFxWI2E7OnM4iyQ=.cfa14992-8e94-4d6d-bdf9-e6689549c83e@github.com> <0RmULuYLatKjDyzBQB7Qxep-oSkpCKdh7zBDzuQiPvM=.2eed570e-cc6d-4103-b733-8cca3c4eaf33@github.com> Message-ID: On Wed, 7 Jun 2023 14:15:10 GMT, Chen Liang wrote: >> Add API to explore Class Hierarchy with a `ClassLoader` or a `Lookup` with proper privileges, with tests. >> >> This addition is useful in case classes at runtime are not loaded from the system class loader, such as Proxy. This is also useful to APIs that generate bytecode with a `Lookup` object, such as a custom single-abstract-method class implementations from a method handle. >> >> See https://mail.openjdk.org/pipermail/classfile-api-dev/2023-March/000249.html as well. >> >> Current questions, which I wish to discuss with @asotona: >> 1. Should the resolver fail fast on `IllegalAccessException` from the lookup? This usually indicates the hierarchy resolver is set up improperly, and proceeding may simply yield verification errors in class loading that are hard to track. For bytecode-generating APIs, throwing access errors for the Lookup eagerly is also more preferable than later silent generation failure. >> 2. Whether the default resolver should be reading from jrt alone, reflection alone, or jrt then reflection. I personally believe reflection alone is more reliable, for classes may redefined with instrumentation or jfr, which may not be reflected in the system resources. >> 3. In addition, I don't think chaining system class loader reflection after system resource retrieval is really meaningful: is there any case where reflection always works while the system resource retrieval always fails? > > Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 14 commits: > > - Review changes, fixed tests > - Merge branch 'master' into hierarchy-resolve > - 1. Moved the default resolver to a static method, in anticipation of future changes > 2. Removed SecurityManager related content > 3. Changed ClassHierarchyInfo into an interface > 4. Moved caching method from static to instance method > - Merge branch 'master' into hierarchy-resolve > - rename to ofClassLoading/ofResourceParsing > convert the default class provider to bypass security manager restrictions > - Merge branch 'master' into hierarchy-resolve > - Merge branch 'master' into hierarchy-resolve > - Test both cached and uncached resolvers > - Update the class hierarchy resolver api as per mailing list last week > - Merge branch 'master' into hierarchy-resolve > - ... and 4 more: https://git.openjdk.org/jdk/compare/a1ab377d...90645b6f Marked as reviewed by asotona (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/13082#pullrequestreview-1469177981 From liach at openjdk.org Thu Jun 8 07:29:52 2023 From: liach at openjdk.org (Chen Liang) Date: Thu, 8 Jun 2023 07:29:52 GMT Subject: RFR: 8304425: ClassHierarchyResolver from Reflection [v9] In-Reply-To: <0RmULuYLatKjDyzBQB7Qxep-oSkpCKdh7zBDzuQiPvM=.2eed570e-cc6d-4103-b733-8cca3c4eaf33@github.com> References: <08Hy6pEhV75yr_F4mCP-dkKOKMCSoFxWI2E7OnM4iyQ=.cfa14992-8e94-4d6d-bdf9-e6689549c83e@github.com> <0RmULuYLatKjDyzBQB7Qxep-oSkpCKdh7zBDzuQiPvM=.2eed570e-cc6d-4103-b733-8cca3c4eaf33@github.com> Message-ID: <4SP2a5mkMsrparZMalgkb9BIltgk0dTfropxCzjKgrw=.a62b6d06-fd3c-4497-ad74-98f11e723013@github.com> On Wed, 7 Jun 2023 14:15:10 GMT, Chen Liang wrote: >> Add API to explore Class Hierarchy with a `ClassLoader` or a `Lookup` with proper privileges, with tests. >> >> This addition is useful in case classes at runtime are not loaded from the system class loader, such as Proxy. This is also useful to APIs that generate bytecode with a `Lookup` object, such as a custom single-abstract-method class implementations from a method handle. >> >> See https://mail.openjdk.org/pipermail/classfile-api-dev/2023-March/000249.html as well. >> >> Current questions, which I wish to discuss with @asotona: >> 1. Should the resolver fail fast on `IllegalAccessException` from the lookup? This usually indicates the hierarchy resolver is set up improperly, and proceeding may simply yield verification errors in class loading that are hard to track. For bytecode-generating APIs, throwing access errors for the Lookup eagerly is also more preferable than later silent generation failure. >> 2. Whether the default resolver should be reading from jrt alone, reflection alone, or jrt then reflection. I personally believe reflection alone is more reliable, for classes may redefined with instrumentation or jfr, which may not be reflected in the system resources. >> 3. In addition, I don't think chaining system class loader reflection after system resource retrieval is really meaningful: is there any case where reflection always works while the system resource retrieval always fails? > > Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 14 commits: > > - Review changes, fixed tests > - Merge branch 'master' into hierarchy-resolve > - 1. Moved the default resolver to a static method, in anticipation of future changes > 2. Removed SecurityManager related content > 3. Changed ClassHierarchyInfo into an interface > 4. Moved caching method from static to instance method > - Merge branch 'master' into hierarchy-resolve > - rename to ofClassLoading/ofResourceParsing > convert the default class provider to bypass security manager restrictions > - Merge branch 'master' into hierarchy-resolve > - Merge branch 'master' into hierarchy-resolve > - Test both cached and uncached resolvers > - Update the class hierarchy resolver api as per mailing list last week > - Merge branch 'master' into hierarchy-resolve > - ... and 4 more: https://git.openjdk.org/jdk/compare/a1ab377d...90645b6f Integrating this before #14180. The test failure appears to be unrelated from ScopedValues, which is not related to this patch. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13082#issuecomment-1582042622 From liach at openjdk.org Thu Jun 8 07:32:57 2023 From: liach at openjdk.org (Chen Liang) Date: Thu, 8 Jun 2023 07:32:57 GMT Subject: Integrated: 8304425: ClassHierarchyResolver from Reflection In-Reply-To: <08Hy6pEhV75yr_F4mCP-dkKOKMCSoFxWI2E7OnM4iyQ=.cfa14992-8e94-4d6d-bdf9-e6689549c83e@github.com> References: <08Hy6pEhV75yr_F4mCP-dkKOKMCSoFxWI2E7OnM4iyQ=.cfa14992-8e94-4d6d-bdf9-e6689549c83e@github.com> Message-ID: <7ASxsfkPoKmQwecb-rCSa4tTp6AGCBocwGQHuD9Wb0Q=.5e7e0487-b962-4d8f-8c54-1bc6ab2a6d5c@github.com> On Fri, 17 Mar 2023 18:18:48 GMT, Chen Liang wrote: > Add API to explore Class Hierarchy with a `ClassLoader` or a `Lookup` with proper privileges, with tests. > > This addition is useful in case classes at runtime are not loaded from the system class loader, such as Proxy. This is also useful to APIs that generate bytecode with a `Lookup` object, such as a custom single-abstract-method class implementations from a method handle. > > See https://mail.openjdk.org/pipermail/classfile-api-dev/2023-March/000249.html as well. > > Current questions, which I wish to discuss with @asotona: > 1. Should the resolver fail fast on `IllegalAccessException` from the lookup? This usually indicates the hierarchy resolver is set up improperly, and proceeding may simply yield verification errors in class loading that are hard to track. For bytecode-generating APIs, throwing access errors for the Lookup eagerly is also more preferable than later silent generation failure. > 2. Whether the default resolver should be reading from jrt alone, reflection alone, or jrt then reflection. I personally believe reflection alone is more reliable, for classes may redefined with instrumentation or jfr, which may not be reflected in the system resources. > 3. In addition, I don't think chaining system class loader reflection after system resource retrieval is really meaningful: is there any case where reflection always works while the system resource retrieval always fails? This pull request has now been integrated. Changeset: ac3ce2bf Author: Chen Liang Committer: Adam Sotona URL: https://git.openjdk.org/jdk/commit/ac3ce2bf759735042480b846f3c1cf37a0843b8d Stats: 401 lines in 10 files changed: 304 ins; 29 del; 68 mod 8304425: ClassHierarchyResolver from Reflection Reviewed-by: asotona ------------- PR: https://git.openjdk.org/jdk/pull/13082 From jwaters at openjdk.org Thu Jun 8 07:45:53 2023 From: jwaters at openjdk.org (Julian Waters) Date: Thu, 8 Jun 2023 07:45:53 GMT Subject: RFR: 8305341: Alignment should be enforced by alignas instead of compiler specific attributes [v4] In-Reply-To: References: <2d60fxZxeWZEngMaSE1N4JZz07XkvbXj8jrN_hMbo-0=.51ffb82f-2beb-43f7-9195-062555599d0b@github.com> Message-ID: <6x5TNtFwNDmFEx3WL4_uB-PLyFGgi9T0s4rMKEC-iVI=.120ae51e-3d33-46cd-97ce-6cb6b7bde452@github.com> On Wed, 12 Apr 2023 07:12:10 GMT, Julian Waters wrote: >> C11 has been stable for a long time on all platforms, so native code can use the standard alignas operator for alignment requirements > > Julian Waters has updated the pull request incrementally with four additional commits since the last revision: > > - Restore visCPP > - Restore gcc attribute > - Revert gcc > - Revert Anyone? ------------- PR Comment: https://git.openjdk.org/jdk/pull/13258#issuecomment-1582065715 From jwaters at openjdk.org Thu Jun 8 07:45:53 2023 From: jwaters at openjdk.org (Julian Waters) Date: Thu, 8 Jun 2023 07:45:53 GMT Subject: RFR: 8308780: Fix the Java Integer types on Windows [v4] In-Reply-To: <3VAC9z-WjItzbkXeNreX7PGi18ypbaom-RjBJgHb9L4=.1e90295d-c012-47dd-b5fe-fa7889ce2c84@github.com> References: <-mAb3g-jnRbOa0PFdM8gVP-8zI8CRGwxPvSdXd3uPm8=.2e6ab688-3ca1-4b8a-8674-5245c3f7557f@github.com> <3VAC9z-WjItzbkXeNreX7PGi18ypbaom-RjBJgHb9L4=.1e90295d-c012-47dd-b5fe-fa7889ce2c84@github.com> Message-ID: On Thu, 1 Jun 2023 11:49:24 GMT, Julian Waters wrote: >> On Windows, the basic Java Integer types are defined as long and __int64 respectively. In particular, the former is rather problematic since it breaks compilation as the Visual C++ becomes stricter and more compliant with every release, which means the way Windows code treats long as a typedef for int is no longer correct, especially with -permissive- enabled. Instead of changing every piece of broken code to match the jint = long typedef, which is far too time consuming, we can instead change jint to an int (which is still the same 32 bit number type as long), as there are far fewer problems caused by this definition. It's better to get this over and done with sooner than later when a future version of Visual C++ finally starts to break on existing code > > Julian Waters has updated the pull request incrementally with one additional commit since the last revision: > > Fix the code that is actually warning Anyone? ------------- PR Comment: https://git.openjdk.org/jdk/pull/14125#issuecomment-1582066068 From prappo at openjdk.org Thu Jun 8 08:18:11 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 8 Jun 2023 08:18:11 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v3] In-Reply-To: References: Message-ID: > Please review this long-awaited change to documentation inheritance. > > This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: > > ?{@inheritDoc S} > > Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". Pavel Rappo 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 seven additional commits since the last revision: - Merge branch 'master' into 8285368 - feedback: make warning less scary - Disable problematic check This check is well-intended but problematic for JDK API Documentation build, which errors on warnings. - Counterbalance changes to method comments algorithm The changes are in the JDK API Documentation. - Improve diagnostics - Update method comments algorithm - Implement directed documentation inheritance ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14357/files - new: https://git.openjdk.org/jdk/pull/14357/files/c0fc69c2..011d7982 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14357&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14357&range=01-02 Stats: 17117 lines in 199 files changed: 16677 ins; 145 del; 295 mod Patch: https://git.openjdk.org/jdk/pull/14357.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14357/head:pull/14357 PR: https://git.openjdk.org/jdk/pull/14357 From prappo at openjdk.org Thu Jun 8 08:43:13 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 8 Jun 2023 08:43:13 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v4] In-Reply-To: References: Message-ID: > Please review this long-awaited change to documentation inheritance. > > This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: > > ?{@inheritDoc S} > > Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: feedback: use utils directly ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14357/files - new: https://git.openjdk.org/jdk/pull/14357/files/011d7982..d579a83c Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14357&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14357&range=02-03 Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/14357.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14357/head:pull/14357 PR: https://git.openjdk.org/jdk/pull/14357 From prappo at openjdk.org Thu Jun 8 08:43:13 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 8 Jun 2023 08:43:13 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: <0nAoH6Na1dRqIGEGYd2-DpPBZb7AfdjApu40jdUkmzM=.37205779-ae2f-4577-86a8-8e8d592e7576@github.com> On Wed, 7 Jun 2023 18:55:10 GMT, Jonathan Gibbons wrote: >> Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: >> >> feedback: make warning less scary > > src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/InheritDocTaglet.java line 110: > >> 108: for (Element e : methods) { >> 109: ExecutableElement m = (ExecutableElement) e; >> 110: if (configuration.utils.elementUtils.overrides(method, m, (TypeElement) method.getEnclosingElement())) { > > Note that `configuration.utils` is available as `utils` Done in d579a83cc4a. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222652470 From alanb at openjdk.org Thu Jun 8 08:45:50 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 8 Jun 2023 08:45:50 GMT Subject: RFR: 8305104: Remove the old core reflection implementation [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 22:02:57 GMT, Mandy Chung wrote: >> JEP 416 integrated in JDK 18 and since then, only a couple minor issues has been reported. Those issues were related with exception being thrown with invalid arguments. We propose to remove the old core reflection implementation in JDK 22. The `-Djdk.reflect.useDirectMethodHandle=false` workaround to revert to the old implementation will stop to work. > > Mandy Chung has updated the pull request incrementally with one additional commit since the last revision: > > fix merge issue src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java line 578: > 576: // then switch to the bytecode-based implementations. > 577: > 578: private static final Config DEFAULT_CONFIG = new Config(false, // useNativeAccessorOnly The block comment just before this will need updating. There's another one in Config.config where it uses the default/native implementation in early startup. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14371#discussion_r1222659670 From alanb at openjdk.org Thu Jun 8 08:50:48 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 8 Jun 2023 08:50:48 GMT Subject: RFR: 8305104: Remove the old core reflection implementation [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 22:02:57 GMT, Mandy Chung wrote: >> JEP 416 integrated in JDK 18 and since then, only a couple minor issues has been reported. Those issues were related with exception being thrown with invalid arguments. We propose to remove the old core reflection implementation in JDK 22. The `-Djdk.reflect.useDirectMethodHandle=false` workaround to revert to the old implementation will stop to work. > > Mandy Chung has updated the pull request incrementally with one additional commit since the last revision: > > fix merge issue The old + new implementations have been in four releases, which is good for shaking out any regressions/issues. Removing the old implementation in JDK 22 is good. ------------- Marked as reviewed by alanb (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14371#pullrequestreview-1469340126 From asotona at openjdk.org Thu Jun 8 09:26:10 2023 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 8 Jun 2023 09:26:10 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v8] In-Reply-To: References: Message-ID: > Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html > This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. > > Please review. > > Thanks, > 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 29 commits: - removal of ClassHierarchyImpl.DEFAULT_RESOLVER introduction of ClassHierarchyResolver::ofSystem factory method ClassfileImpl does not pre-initialize ClassHierarchyResolverOption with default - Merge branch 'master' into JDK-8308899-context # Conflicts: # src/java.base/share/classes/jdk/internal/classfile/impl/Options.java # src/java.base/share/classes/jdk/internal/classfile/snippet-files/PackageSnippets.java # test/jdk/jdk/classfile/ClassHierarchyInfoTest.java # test/jdk/jdk/classfile/VerifierSelfTest.java - Merge branch 'master' into JDK-8308899-context # Conflicts: # src/java.base/share/classes/jdk/internal/classfile/Classfile.java # src/java.base/share/classes/jdk/internal/classfile/impl/DirectCodeBuilder.java # test/jdk/jdk/classfile/DiscontinuedInstructionsTest.java # test/jdk/jdk/classfile/FilterDeadLabelsTest.java # test/jdk/jdk/classfile/ShortJumpsFixTest.java # test/jdk/jdk/classfile/StackMapsTest.java - added missing javadoc - simplified options names - fixed copyright header - Merge branch 'master' into JDK-8308899-context - fixed StackMapGenerator::generatorError and removed obsolete SplitConstantPool clone constructor - Merge branch 'master' into JDK-8308899-context - fixed benchmarks - ... and 19 more: https://git.openjdk.org/jdk/compare/ac3ce2bf...aa691842 ------------- Changes: https://git.openjdk.org/jdk/pull/14180/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=07 Stats: 1651 lines in 109 files changed: 501 ins; 244 del; 906 mod Patch: https://git.openjdk.org/jdk/pull/14180.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14180/head:pull/14180 PR: https://git.openjdk.org/jdk/pull/14180 From prappo at openjdk.org Thu Jun 8 09:26:17 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 8 Jun 2023 09:26:17 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 20:23:09 GMT, Jonathan Gibbons wrote: >> Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: >> >> feedback: make warning less scary > > test/langtools/jdk/javadoc/doclet/testDirectedInheritance/TestDirectedInheritance.java line 75: > >> 73: // code is OK, it likely isn't (after all, there's an unknown tag). >> 74: setAutomaticCheckNoStacktrace(true); >> 75: { // DocLint is on > > "on" -> "explicit" Done in 93adde63ed0. > test/langtools/jdk/javadoc/doclet/testDirectedInheritance/TestDirectedInheritance.java line 85: > >> 83: } >> 84: } >> 85: // DocLint is off > > "off" -> "default" Done in 93adde63ed0. > test/langtools/jdk/javadoc/doclet/testDirectedInheritance/TestDirectedInheritance.java line 289: > >> 287: >> 288: /* >> 289: * C1.m inherits documentation from B1.m explicitly and undirect. > > possible typo: do you mean "indirect" I'm neither a grammarian nor a native English speaker, but my hunch is that _indirect_ would be wrong here. But again, I'm open to corrections. I believe "directed inhertiance" came from an analogy with the graph theory, where a graph can be directed and undirected. The former has pointy arrows, the latter does not. By that analogy, documentation inheritance can be directed `{@inheritDoc }` (I choose), or undirected `{@inheritDoc}` (JavaDoc chooses / I'm Feeling Lucky). In addition to that, documentation inheritance can be implicit (i.e. by omission), which works the same way as undirected but without extra keystrokes. While those concepts are lacking better names, can I suggest we use the following almost-made-up adverbs: _directedly_ and _undirectedly_? As a side note, we badly need a JavaDoc vocabulary. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222703693 PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222703773 PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222700845 From prappo at openjdk.org Thu Jun 8 09:26:16 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 8 Jun 2023 09:26:16 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v5] In-Reply-To: References: Message-ID: > Please review this long-awaited change to documentation inheritance. > > This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: > > ?{@inheritDoc S} > > Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: feedback: DocLint terminology ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14357/files - new: https://git.openjdk.org/jdk/pull/14357/files/d579a83c..93adde63 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14357&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14357&range=03-04 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/14357.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14357/head:pull/14357 PR: https://git.openjdk.org/jdk/pull/14357 From alanb at openjdk.org Thu Jun 8 09:27:54 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 8 Jun 2023 09:27:54 GMT Subject: RFR: JDK-8306584: Start of release updates for JDK 22 [v6] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 00:37:07 GMT, Joe Darcy wrote: >> Time to get JDK 22 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 39 commits: > > - Merge branch 'master' into JDK-8306584 > - Merge branch 'master' into JDK-8306584 > - Update wording to be consistent with JDK-8295071. > - Merge branch 'master' into JDK-8306584 > - Update wording of new constant to be consistent with JDK-8309554. > - Merge branch 'master' into JDK-8306584 > - Merge branch 'master' into JDK-8306584 > - Merge branch 'master' into JDK-8306584 > - Merge branch 'master' into JDK-8306584 > - Merge branch 'master' into JDK-8306584 > - ... and 29 more: https://git.openjdk.org/jdk/compare/4ffc8cc2...a03bcd40 Ready to go :-) ------------- PR Review: https://git.openjdk.org/jdk/pull/13567#pullrequestreview-1469406598 From alanb at openjdk.org Thu Jun 8 09:27:56 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 8 Jun 2023 09:27:56 GMT Subject: RFR: 8309545: Thread.interrupted from virtual thread needlessly resets interrupt status Message-ID: <4knBoamdYaN-bauCPfgm-gfat2fZOTtq1KOQxnFAzE4=.39f02244-7b97-4404-9a40-405a2f506251@github.com> Thread.interrupted is used to "get and clear" the current thread's interrupt status. When called from a virtual thread, the current implementation always clears the carrier's interrupt status. There is no need to do this when the interrupt status is not set, it can just read the interrupt status and return false in that case. This was found by Sergey Kuksenko when comparing platform vs. virtual thread performance. Once CODETOOLS-7903476 is in a released version of JMH then we can start to accumulate benchmarks that execute in virtual threads. Testing: tier1-5 ------------- Commit messages: - Merge - Initial commit Changes: https://git.openjdk.org/jdk/pull/14361/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14361&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309545 Stats: 6 lines in 1 file changed: 1 ins; 0 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/14361.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14361/head:pull/14361 PR: https://git.openjdk.org/jdk/pull/14361 From prappo at openjdk.org Thu Jun 8 09:31:08 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 8 Jun 2023 09:31:08 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v6] In-Reply-To: References: Message-ID: > Please review this long-awaited change to documentation inheritance. > > This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: > > ?{@inheritDoc S} > > Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: suggestion: vocabulary ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14357/files - new: https://git.openjdk.org/jdk/pull/14357/files/93adde63..3da4f473 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14357&range=05 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14357&range=04-05 Stats: 11 lines in 1 file changed: 5 ins; 0 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/14357.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14357/head:pull/14357 PR: https://git.openjdk.org/jdk/pull/14357 From prappo at openjdk.org Thu Jun 8 09:31:11 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 8 Jun 2023 09:31:11 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 09:18:04 GMT, Pavel Rappo wrote: >> test/langtools/jdk/javadoc/doclet/testDirectedInheritance/TestDirectedInheritance.java line 289: >> >>> 287: >>> 288: /* >>> 289: * C1.m inherits documentation from B1.m explicitly and undirect. >> >> possible typo: do you mean "indirect" > > I'm neither a grammarian nor a native English speaker, but my hunch is that _indirect_ would be wrong here. But again, I'm open to corrections. > > I believe "directed inhertiance" came from an analogy with the graph theory, where a graph can be directed and undirected. The former has pointy arrows, the latter does not. > > By that analogy, documentation inheritance can be directed `{@inheritDoc }` (I choose), or undirected `{@inheritDoc}` (JavaDoc chooses / I'm Feeling Lucky). In addition to that, documentation inheritance can be implicit (i.e. by omission), which works the same way as undirected but without extra keystrokes. > > While those concepts are lacking better names, can I suggest we use the following almost-made-up adverbs: _directedly_ and _undirectedly_? As a side note, we badly need a JavaDoc vocabulary. Have a look at this commit: 3da4f473a7c ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222709203 From dfuchs at openjdk.org Thu Jun 8 09:36:50 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Thu, 8 Jun 2023 09:36:50 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v5] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 09:26:16 GMT, Pavel Rappo wrote: >> Please review this long-awaited change to documentation inheritance. >> >> This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: >> >> ?{@inheritDoc S} >> >> Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". > > Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: > > feedback: DocLint terminology I will only comment on the changes to the `java.base` classes. I had a look at the changes to these and they looked right to me. Though I?m not an expert on collections it seemed that you picked the right ?semantically closer parent? to inherit from. Probably @stuart-marks could give a more authoritative opinion. ------------- PR Review: https://git.openjdk.org/jdk/pull/14357#pullrequestreview-1469424115 From dholmes at openjdk.org Thu Jun 8 09:41:49 2023 From: dholmes at openjdk.org (David Holmes) Date: Thu, 8 Jun 2023 09:41:49 GMT Subject: RFR: 8309545: Thread.interrupted from virtual thread needlessly resets interrupt status In-Reply-To: <4knBoamdYaN-bauCPfgm-gfat2fZOTtq1KOQxnFAzE4=.39f02244-7b97-4404-9a40-405a2f506251@github.com> References: <4knBoamdYaN-bauCPfgm-gfat2fZOTtq1KOQxnFAzE4=.39f02244-7b97-4404-9a40-405a2f506251@github.com> Message-ID: On Wed, 7 Jun 2023 15:12:40 GMT, Alan Bateman wrote: > Thread.interrupted is used to "get and clear" the current thread's interrupt status. When called from a virtual thread, the current implementation always clears the carrier's interrupt status. There is no need to do this when the interrupt status is not set, it can just read the interrupt status and return false in that case. > > This was found by Sergey Kuksenko when comparing platform vs. virtual thread performance. Once CODETOOLS-7903476 is in a released version of JMH then we can start to accumulate benchmarks that execute in virtual threads. > > Testing: tier1-5 src/java.base/share/classes/java/lang/VirtualThread.java line 879: > 877: boolean oldValue = interrupted; > 878: if (oldValue) { > 879: synchronized (interruptLock) { Don't you still need to read under the lock to synchronize with the interrupt method? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14361#discussion_r1222725444 From prappo at openjdk.org Thu Jun 8 09:55:27 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 8 Jun 2023 09:55:27 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v7] In-Reply-To: References: Message-ID: <2DpBE46Rn1mY3i9T1oOMwpxJ3ye0taYJJm2rh-2ZlAw=.10043f50-5c41-4d09-bc3c-53f0c490c5ba@github.com> > Please review this long-awaited change to documentation inheritance. > > This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: > > ?{@inheritDoc S} > > Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: feedback: remove unduly restrictive warning ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14357/files - new: https://git.openjdk.org/jdk/pull/14357/files/3da4f473..dea776e2 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14357&range=06 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14357&range=05-06 Stats: 126 lines in 5 files changed: 0 ins; 126 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/14357.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14357/head:pull/14357 PR: https://git.openjdk.org/jdk/pull/14357 From prappo at openjdk.org Thu Jun 8 09:55:27 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 8 Jun 2023 09:55:27 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: <5_hHiDRF_JOTG6DcmG_2ONSv9ZMcLJyYafTs5q7VNj4=.5149617c-4015-4f9b-b518-7d316a1e92eb@github.com> On Wed, 7 Jun 2023 21:39:33 GMT, Jonathan Gibbons wrote: >> The general criticism here is whether we should restrict in any way the set of super types from which one can inherit documentation, and/or what should the set of checks be? >> >> For example, if a method in C inherits a method in B that has no comment but which inherits a method with a comment in A, then it seems unduly restrictive to stop the method in C explicitly referencing the method in A, as compared to only allowing a reference to B, which implicitly gets its comment from A. >> >> That being said, there is merit in starting off with restrictions and loosening them in the face of experience, rather than trying to increase the stylistic restrictions later. > >> Sure we can; this relates to an earlier comment of yours on Utils.isDirectSupertype here: [#14357 (comment)](https://github.com/openjdk/jdk/pull/14357#discussion_r1222053011) > > Thanks for tying these together; I had not realized they were related. As agreed out of band, I removed that check and the test for now in dea776e285b. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222737390 From alanb at openjdk.org Thu Jun 8 10:23:51 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 8 Jun 2023 10:23:51 GMT Subject: RFR: 8309545: Thread.interrupted from virtual thread needlessly resets interrupt status In-Reply-To: References: <4knBoamdYaN-bauCPfgm-gfat2fZOTtq1KOQxnFAzE4=.39f02244-7b97-4404-9a40-405a2f506251@github.com> Message-ID: On Thu, 8 Jun 2023 09:38:52 GMT, David Holmes wrote: >> Thread.interrupted is used to "get and clear" the current thread's interrupt status. When called from a virtual thread, the current implementation always clears the carrier's interrupt status. There is no need to do this when the interrupt status is not set, it can just read the interrupt status and return false in that case. >> >> This was found by Sergey Kuksenko when comparing platform vs. virtual thread performance. Once CODETOOLS-7903476 is in a released version of JMH then we can start to accumulate benchmarks that execute in virtual threads. >> >> Testing: tier1-5 > > src/java.base/share/classes/java/lang/VirtualThread.java line 879: > >> 877: boolean oldValue = interrupted; >> 878: if (oldValue) { >> 879: synchronized (interruptLock) { > > Don't you still need to read under the lock to synchronize with the interrupt method? The override of interrupt for virtual threads always sets the interrupt status as the first step. So if Thread.interrupted reads the interrupt status as true then it will synchronize. It's not too different to platform threads, I think you added a comment to Thread.interrupted about this when move the interrupted flag into Java. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14361#discussion_r1222820022 From alanb at openjdk.org Thu Jun 8 10:36:53 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 8 Jun 2023 10:36:53 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v7] In-Reply-To: <2DpBE46Rn1mY3i9T1oOMwpxJ3ye0taYJJm2rh-2ZlAw=.10043f50-5c41-4d09-bc3c-53f0c490c5ba@github.com> References: <2DpBE46Rn1mY3i9T1oOMwpxJ3ye0taYJJm2rh-2ZlAw=.10043f50-5c41-4d09-bc3c-53f0c490c5ba@github.com> Message-ID: On Thu, 8 Jun 2023 09:55:27 GMT, Pavel Rappo wrote: >> Please review this long-awaited change to documentation inheritance. >> >> This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: >> >> ?{@inheritDoc S} >> >> Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". > > Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: > > feedback: remove unduly restrictive warning src/java.base/share/classes/java/util/TreeMap.java line 1199: > 1197: * {@code add} or {@code addAll} operations. > 1198: * > 1199: * @return {@inheritDoc SortedMap} An alternative here might be add `{@return ...}` to the first sentence of the method description so that the return description exactly matches. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222847956 From alanb at openjdk.org Thu Jun 8 10:50:53 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 8 Jun 2023 10:50:53 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v7] In-Reply-To: <2DpBE46Rn1mY3i9T1oOMwpxJ3ye0taYJJm2rh-2ZlAw=.10043f50-5c41-4d09-bc3c-53f0c490c5ba@github.com> References: <2DpBE46Rn1mY3i9T1oOMwpxJ3ye0taYJJm2rh-2ZlAw=.10043f50-5c41-4d09-bc3c-53f0c490c5ba@github.com> Message-ID: On Thu, 8 Jun 2023 09:55:27 GMT, Pavel Rappo wrote: >> Please review this long-awaited change to documentation inheritance. >> >> This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: >> >> ?{@inheritDoc S} >> >> Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". > > Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: > > feedback: remove unduly restrictive warning src/java.base/share/classes/java/util/concurrent/LinkedBlockingDeque.java line 635: > 633: * @return {@inheritDoc BlockingDeque} > 634: */ > 635: public boolean offer(E e) { Does this work for @param tags too? Just curious. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222860792 From briangoetz at openjdk.org Thu Jun 8 11:11:52 2023 From: briangoetz at openjdk.org (Brian Goetz) Date: Thu, 8 Jun 2023 11:11:52 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v8] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 09:26:10 GMT, Adam Sotona wrote: >> Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html >> This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. >> >> Please review. >> >> Thanks, >> 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 29 commits: > > - removal of ClassHierarchyImpl.DEFAULT_RESOLVER > introduction of ClassHierarchyResolver::ofSystem factory method > ClassfileImpl does not pre-initialize ClassHierarchyResolverOption with default > - Merge branch 'master' into JDK-8308899-context > > # Conflicts: > # src/java.base/share/classes/jdk/internal/classfile/impl/Options.java > # src/java.base/share/classes/jdk/internal/classfile/snippet-files/PackageSnippets.java > # test/jdk/jdk/classfile/ClassHierarchyInfoTest.java > # test/jdk/jdk/classfile/VerifierSelfTest.java > - Merge branch 'master' into JDK-8308899-context > > # Conflicts: > # src/java.base/share/classes/jdk/internal/classfile/Classfile.java > # src/java.base/share/classes/jdk/internal/classfile/impl/DirectCodeBuilder.java > # test/jdk/jdk/classfile/DiscontinuedInstructionsTest.java > # test/jdk/jdk/classfile/FilterDeadLabelsTest.java > # test/jdk/jdk/classfile/ShortJumpsFixTest.java > # test/jdk/jdk/classfile/StackMapsTest.java > - added missing javadoc > - simplified options names > - fixed copyright header > - Merge branch 'master' into JDK-8308899-context > - fixed StackMapGenerator::generatorError and removed obsolete SplitConstantPool clone constructor > - Merge branch 'master' into JDK-8308899-context > - fixed benchmarks > - ... and 19 more: https://git.openjdk.org/jdk/compare/ac3ce2bf...aa691842 Agreed.? The need for sync came from the shared static cache. On 6/8/2023 7:07 AM, liach wrote: > > ***@***.**** commented on this pull request. > > ------------------------------------------------------------------------ > > In > src/java.base/share/classes/jdk/internal/classfile/ClassHierarchyResolver.java > : > > > */ > - static ClassHierarchyResolver defaultResolver() { > - return ClassHierarchyImpl.DEFAULT_RESOLVER; > + static ClassHierarchyResolver ofSystem() { > + var sysLoader = ClassLoader.getSystemClassLoader(); > + return ClassHierarchyResolver > + .ofResourceParsing(sysLoader) > + .orElse(ClassHierarchyResolver.ofClassLoading(sysLoader)) > + .cached(new Supplier<>() { > + @Override > + public Map get() { > + return new ConcurrentHashMap<>(); > > Don't think we need to synchronize the cache if we have dedicated CHRs. > > ? > 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/14180#issuecomment-1582385327 From liach at openjdk.org Thu Jun 8 11:11:54 2023 From: liach at openjdk.org (Chen Liang) Date: Thu, 8 Jun 2023 11:11:54 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v8] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 09:26:10 GMT, Adam Sotona wrote: >> Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html >> This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. >> >> Please review. >> >> Thanks, >> 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 29 commits: > > - removal of ClassHierarchyImpl.DEFAULT_RESOLVER > introduction of ClassHierarchyResolver::ofSystem factory method > ClassfileImpl does not pre-initialize ClassHierarchyResolverOption with default > - Merge branch 'master' into JDK-8308899-context > > # Conflicts: > # src/java.base/share/classes/jdk/internal/classfile/impl/Options.java > # src/java.base/share/classes/jdk/internal/classfile/snippet-files/PackageSnippets.java > # test/jdk/jdk/classfile/ClassHierarchyInfoTest.java > # test/jdk/jdk/classfile/VerifierSelfTest.java > - Merge branch 'master' into JDK-8308899-context > > # Conflicts: > # src/java.base/share/classes/jdk/internal/classfile/Classfile.java > # src/java.base/share/classes/jdk/internal/classfile/impl/DirectCodeBuilder.java > # test/jdk/jdk/classfile/DiscontinuedInstructionsTest.java > # test/jdk/jdk/classfile/FilterDeadLabelsTest.java > # test/jdk/jdk/classfile/ShortJumpsFixTest.java > # test/jdk/jdk/classfile/StackMapsTest.java > - added missing javadoc > - simplified options names > - fixed copyright header > - Merge branch 'master' into JDK-8308899-context > - fixed StackMapGenerator::generatorError and removed obsolete SplitConstantPool clone constructor > - Merge branch 'master' into JDK-8308899-context > - fixed benchmarks > - ... and 19 more: https://git.openjdk.org/jdk/compare/ac3ce2bf...aa691842 src/java.base/share/classes/jdk/internal/classfile/ClassHierarchyResolver.java line 66: > 64: @Override > 65: public Map get() { > 66: return new ConcurrentHashMap<>(); Don't think we need to synchronize the cache if we have dedicated CHRs. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1222886769 From aivanov at openjdk.org Thu Jun 8 11:22:52 2023 From: aivanov at openjdk.org (Alexey Ivanov) Date: Thu, 8 Jun 2023 11:22:52 GMT Subject: RFR: 8308780: Fix the Java Integer types on Windows [v4] In-Reply-To: <3VAC9z-WjItzbkXeNreX7PGi18ypbaom-RjBJgHb9L4=.1e90295d-c012-47dd-b5fe-fa7889ce2c84@github.com> References: <-mAb3g-jnRbOa0PFdM8gVP-8zI8CRGwxPvSdXd3uPm8=.2e6ab688-3ca1-4b8a-8674-5245c3f7557f@github.com> <3VAC9z-WjItzbkXeNreX7PGi18ypbaom-RjBJgHb9L4=.1e90295d-c012-47dd-b5fe-fa7889ce2c84@github.com> Message-ID: On Thu, 1 Jun 2023 11:49:24 GMT, Julian Waters wrote: >> On Windows, the basic Java Integer types are defined as long and __int64 respectively. In particular, the former is rather problematic since it breaks compilation as the Visual C++ becomes stricter and more compliant with every release, which means the way Windows code treats long as a typedef for int is no longer correct, especially with -permissive- enabled. Instead of changing every piece of broken code to match the jint = long typedef, which is far too time consuming, we can instead change jint to an int (which is still the same 32 bit number type as long), as there are far fewer problems caused by this definition. It's better to get this over and done with sooner than later when a future version of Visual C++ finally starts to break on existing code > > Julian Waters has updated the pull request incrementally with one additional commit since the last revision: > > Fix the code that is actually warning I'll take a look? hopefully next week. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14125#issuecomment-1582402901 From asotona at openjdk.org Thu Jun 8 11:26:39 2023 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 8 Jun 2023 11:26:39 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v9] In-Reply-To: References: Message-ID: > Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html > This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. > > Please review. > > Thanks, > Adam Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: ClassHierarchyResolver::ofSystem is now thread-unsafe ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14180/files - new: https://git.openjdk.org/jdk/pull/14180/files/aa691842..f3099cd5 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=08 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=07-08 Stats: 8 lines in 1 file changed: 0 ins; 6 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/14180.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14180/head:pull/14180 PR: https://git.openjdk.org/jdk/pull/14180 From asotona at openjdk.org Thu Jun 8 11:26:43 2023 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 8 Jun 2023 11:26:43 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v8] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 11:07:21 GMT, Chen Liang wrote: >> Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 29 commits: >> >> - removal of ClassHierarchyImpl.DEFAULT_RESOLVER >> introduction of ClassHierarchyResolver::ofSystem factory method >> ClassfileImpl does not pre-initialize ClassHierarchyResolverOption with default >> - Merge branch 'master' into JDK-8308899-context >> >> # Conflicts: >> # src/java.base/share/classes/jdk/internal/classfile/impl/Options.java >> # src/java.base/share/classes/jdk/internal/classfile/snippet-files/PackageSnippets.java >> # test/jdk/jdk/classfile/ClassHierarchyInfoTest.java >> # test/jdk/jdk/classfile/VerifierSelfTest.java >> - Merge branch 'master' into JDK-8308899-context >> >> # Conflicts: >> # src/java.base/share/classes/jdk/internal/classfile/Classfile.java >> # src/java.base/share/classes/jdk/internal/classfile/impl/DirectCodeBuilder.java >> # test/jdk/jdk/classfile/DiscontinuedInstructionsTest.java >> # test/jdk/jdk/classfile/FilterDeadLabelsTest.java >> # test/jdk/jdk/classfile/ShortJumpsFixTest.java >> # test/jdk/jdk/classfile/StackMapsTest.java >> - added missing javadoc >> - simplified options names >> - fixed copyright header >> - Merge branch 'master' into JDK-8308899-context >> - fixed StackMapGenerator::generatorError and removed obsolete SplitConstantPool clone constructor >> - Merge branch 'master' into JDK-8308899-context >> - fixed benchmarks >> - ... and 19 more: https://git.openjdk.org/jdk/compare/ac3ce2bf...aa691842 > > src/java.base/share/classes/jdk/internal/classfile/ClassHierarchyResolver.java line 66: > >> 64: @Override >> 65: public Map get() { >> 66: return new ConcurrentHashMap<>(); > > Don't think we need to synchronize the cache if we have dedicated CHRs. Fixed, thanks. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1222902932 From prappo at openjdk.org Thu Jun 8 11:34:52 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 8 Jun 2023 11:34:52 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v7] In-Reply-To: References: <2DpBE46Rn1mY3i9T1oOMwpxJ3ye0taYJJm2rh-2ZlAw=.10043f50-5c41-4d09-bc3c-53f0c490c5ba@github.com> Message-ID: On Thu, 8 Jun 2023 10:33:17 GMT, Alan Bateman wrote: >> Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: >> >> feedback: remove unduly restrictive warning > > src/java.base/share/classes/java/util/TreeMap.java line 1199: > >> 1197: * {@code add} or {@code addAll} operations. >> 1198: * >> 1199: * @return {@inheritDoc SortedMap} > > An alternative here might be add `{@return ...}` to the first sentence of the method description so that the return description exactly matches. If we were to (re-)structure doc comments in the way you propose, I'd suggest we do it in a separate, non-jdk.javadoc PR. I was simply trying to keep JDK API documentation unchanged. One thing with the `@return` documentation inherited from SortedMap is that compared to the first sentence of TreeMap, it provides one extra bit of information: a set view of the mappings contained in this map, **sorted in ascending key order**. In order to keep that bit, the suggested inline `{@return ...}` should include more than just the first sentence. > src/java.base/share/classes/java/util/concurrent/LinkedBlockingDeque.java line 635: > >> 633: * @return {@inheritDoc BlockingDeque} >> 634: */ >> 635: public boolean offer(E e) { > > Does this work for @param tags too? Just curious. The directed `{@inheritDoc }` works for the main description, `@throws`, `@param` and `@return` tags. If your question is about why that particular doc comment does not use this: @param e {@inheritDoc BlockingDeque} then the answer is that it's not necessary for keeping the API documentation unchanged. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222908801 PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1222910706 From prappo at openjdk.org Thu Jun 8 11:41:51 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 8 Jun 2023 11:41:51 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v7] In-Reply-To: <2DpBE46Rn1mY3i9T1oOMwpxJ3ye0taYJJm2rh-2ZlAw=.10043f50-5c41-4d09-bc3c-53f0c490c5ba@github.com> References: <2DpBE46Rn1mY3i9T1oOMwpxJ3ye0taYJJm2rh-2ZlAw=.10043f50-5c41-4d09-bc3c-53f0c490c5ba@github.com> Message-ID: On Thu, 8 Jun 2023 09:55:27 GMT, Pavel Rappo wrote: >> Please review this long-awaited change to documentation inheritance. >> >> This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: >> >> ?{@inheritDoc S} >> >> Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". > > Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: > > feedback: remove unduly restrictive warning @Martin-Buchholz, could you please have a look at changes to collections and, in particular, those in java.util.concurrent.*? ------------- PR Comment: https://git.openjdk.org/jdk/pull/14357#issuecomment-1582426421 From dholmes at openjdk.org Thu Jun 8 12:09:49 2023 From: dholmes at openjdk.org (David Holmes) Date: Thu, 8 Jun 2023 12:09:49 GMT Subject: RFR: 8309545: Thread.interrupted from virtual thread needlessly resets interrupt status In-Reply-To: References: <4knBoamdYaN-bauCPfgm-gfat2fZOTtq1KOQxnFAzE4=.39f02244-7b97-4404-9a40-405a2f506251@github.com> Message-ID: On Thu, 8 Jun 2023 10:21:07 GMT, Alan Bateman wrote: >> src/java.base/share/classes/java/lang/VirtualThread.java line 879: >> >>> 877: boolean oldValue = interrupted; >>> 878: if (oldValue) { >>> 879: synchronized (interruptLock) { >> >> Don't you still need to read under the lock to synchronize with the interrupt method? > > The override of interrupt for virtual threads always sets the interrupt status as the first step. So if Thread.interrupted reads the interrupt status as true then it will synchronize. It's not too different to platform threads, I think you added a comment to Thread.interrupted about this when move the interrupted flag into Java. Changing the synchronization means there is a lot more to think about for what was otherwise a fairly trivial change. But I think you are right, if we don't see interrupted==true then we do nothing; if we do see it then we synchronize. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14361#discussion_r1222948182 From prappo at openjdk.org Thu Jun 8 12:17:57 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 8 Jun 2023 12:17:57 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v7] In-Reply-To: <2DpBE46Rn1mY3i9T1oOMwpxJ3ye0taYJJm2rh-2ZlAw=.10043f50-5c41-4d09-bc3c-53f0c490c5ba@github.com> References: <2DpBE46Rn1mY3i9T1oOMwpxJ3ye0taYJJm2rh-2ZlAw=.10043f50-5c41-4d09-bc3c-53f0c490c5ba@github.com> Message-ID: On Thu, 8 Jun 2023 09:55:27 GMT, Pavel Rappo wrote: >> Please review this long-awaited change to documentation inheritance. >> >> This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: >> >> ?{@inheritDoc S} >> >> Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". > > Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: > > feedback: remove unduly restrictive warning Note that the change to "method comments algorithm" uncovers and fixes some bugs to Object- or Object-like- methods. Using the provided [before][] and [after][] outputs, compare documentation for: * toString() in java.time.chrono.{Hijrah,Japanese,Minguo,ThaiBuddhist}Date * hashCode() in Hashtable, ConcurrentHashMap.KeySetView, java.util.jar.Attributes, com.sun.net.httpserver.Headers, com.sun.management.GcInfo * equals() in ConcurrentHashMap.KeySetView, com.sun.net.httpserver.Headers, com.sun.management.GcInfo * clone() in javax.management.ImmutableDescriptor, javax.management.modelmbean.DescriptorSupport, javax.naming.directory.BasicAttribute, javax.naming.directory.BasicAttributes Perhaps some of those could be further refined using directed documentation inheritance. For example, ConcurrentHashMap.KeySetView is first and foremost a set and only then a collection. That suggests that the documentation for Object-like methods could be inherited from (some) set rather than a "generic" collection. Also, the javax.management.ImmutableDescriptor and javax.management.modelmbean.DescriptorSupport clone methods require some attention from area experts. It's likely that those methods' doc comments need to fully inherit documentation from Descriptor.clone(), not just its `@return` tag. [before]: https://cr.openjdk.org/~prappo/8285368/1/api [after]: https://cr.openjdk.org/~prappo/8285368/2/api ------------- PR Comment: https://git.openjdk.org/jdk/pull/14357#issuecomment-1582477351 From alanb at openjdk.org Thu Jun 8 12:21:12 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 8 Jun 2023 12:21:12 GMT Subject: RFR: 8309196: Remove Thread.countStackFrames [v2] In-Reply-To: <7p3wapZUnzfzFKMyOVexaMVGeh00epZs3ipgw-LpvDM=.86006e6e-060a-4d9b-a883-4983381cdba7@github.com> References: <7p3wapZUnzfzFKMyOVexaMVGeh00epZs3ipgw-LpvDM=.86006e6e-060a-4d9b-a883-4983381cdba7@github.com> Message-ID: > Thread.countStackFrames is/was an ill-defined method that dates from JDK 1.0 for counting the stack frames of a suspended Thread. The method was deprecated in JDK 1.2 (1998), deprecated for removal in Java 9, and re-specified/degraded to throw UOE unconditionally in Java 14. Java 22 would be a fine time to finally remove this method. > > Code that wants to count stack frames should be directed to use j.l.StackWalker, or if a tool, then it can use JVM TI and other tool APIs. > > A corpus analysis of 30M classes in 131k artifacts from Maven Central found only 1 usages to this method. The 1 usage appears to be a class that just wraps all methods, it doesn't actually make use of it. Alan Bateman 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 - Initial commit ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14257/files - new: https://git.openjdk.org/jdk/pull/14257/files/36138f34..e44c3c49 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14257&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14257&range=00-01 Stats: 48558 lines in 577 files changed: 40570 ins; 5940 del; 2048 mod Patch: https://git.openjdk.org/jdk/pull/14257.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14257/head:pull/14257 PR: https://git.openjdk.org/jdk/pull/14257 From alanb at openjdk.org Thu Jun 8 12:28:55 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 8 Jun 2023 12:28:55 GMT Subject: RFR: JDK-8306584: Start of release updates for JDK 22 [v6] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 00:37:07 GMT, Joe Darcy wrote: >> Time to get JDK 22 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 39 commits: > > - Merge branch 'master' into JDK-8306584 > - Merge branch 'master' into JDK-8306584 > - Update wording to be consistent with JDK-8295071. > - Merge branch 'master' into JDK-8306584 > - Update wording of new constant to be consistent with JDK-8309554. > - Merge branch 'master' into JDK-8306584 > - Merge branch 'master' into JDK-8306584 > - Merge branch 'master' into JDK-8306584 > - Merge branch 'master' into JDK-8306584 > - Merge branch 'master' into JDK-8306584 > - ... and 29 more: https://git.openjdk.org/jdk/compare/4ffc8cc2...a03bcd40 Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/13567#pullrequestreview-1469794796 From asotona at openjdk.org Thu Jun 8 13:26:55 2023 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 8 Jun 2023 13:26:55 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v9] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 11:26:39 GMT, Adam Sotona wrote: >> Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html >> This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. >> >> Please review. >> >> Thanks, >> Adam > > Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: > > ClassHierarchyResolver::ofSystem is now thread-unsafe Unfortunately thread-unsafe context makes sharing of it in tests executed in parallel a nightmare. I can fix our Corpus tests and hope the race condition won't raise also somewhere else later. However how to explain this limitation to users? I suggest to make it always thread-safe (as the context is primary expected to be shared in multi-threaded environment) and users may make it faster in specific cases by providing non-synchronized map. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14180#issuecomment-1582576426 From asotona at openjdk.org Thu Jun 8 13:37:33 2023 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 8 Jun 2023 13:37:33 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v10] In-Reply-To: References: Message-ID: <8LzoOpItGA_LBdMX5sJxyPJNV2ZCavz2mIs8t1qrWhw=.908dd1f2-6250-4a43-844e-3dcd100be19e@github.com> > Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html > This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. > > Please review. > > Thanks, > Adam Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: Revert "ClassHierarchyResolver::ofSystem is now thread-unsafe" This reverts commit f3099cd5b252924392995bf65edc710c27822d2b. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14180/files - new: https://git.openjdk.org/jdk/pull/14180/files/f3099cd5..41fdb2fc Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=09 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=08-09 Stats: 8 lines in 1 file changed: 6 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/14180.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14180/head:pull/14180 PR: https://git.openjdk.org/jdk/pull/14180 From alanb at openjdk.org Thu Jun 8 13:37:51 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 8 Jun 2023 13:37:51 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v7] In-Reply-To: References: <2DpBE46Rn1mY3i9T1oOMwpxJ3ye0taYJJm2rh-2ZlAw=.10043f50-5c41-4d09-bc3c-53f0c490c5ba@github.com> Message-ID: On Thu, 8 Jun 2023 11:27:37 GMT, Pavel Rappo wrote: > If we were to (re-)structure doc comments in the way you propose, I'd suggest we do it in a separate, non-jdk.javadoc PR. I was simply trying to keep JDK API documentation unchanged. Understood, it was just a passing comment that TreeMap::entrySet overrides the description so it's specifying what it returns and using inherited text for the @return description. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1223053378 From rpressler at openjdk.org Thu Jun 8 13:44:48 2023 From: rpressler at openjdk.org (Ron Pressler) Date: Thu, 8 Jun 2023 13:44:48 GMT Subject: RFR: 8309545: Thread.interrupted from virtual thread needlessly resets interrupt status In-Reply-To: <4knBoamdYaN-bauCPfgm-gfat2fZOTtq1KOQxnFAzE4=.39f02244-7b97-4404-9a40-405a2f506251@github.com> References: <4knBoamdYaN-bauCPfgm-gfat2fZOTtq1KOQxnFAzE4=.39f02244-7b97-4404-9a40-405a2f506251@github.com> Message-ID: <7xcDy6aT6D41OiGzaX7I9tSynAV1-dKUzQlxmgfBoE4=.34770cea-e8da-4f9c-a708-8c14b4bc1964@github.com> On Wed, 7 Jun 2023 15:12:40 GMT, Alan Bateman wrote: > Thread.interrupted is used to "get and clear" the current thread's interrupt status. When called from a virtual thread, the current implementation always clears the carrier's interrupt status. There is no need to do this when the interrupt status is not set, it can just read the interrupt status and return false in that case. > > This was found by Sergey Kuksenko when comparing platform vs. virtual thread performance. Once CODETOOLS-7903476 is in a released version of JMH then we can start to accumulate benchmarks that execute in virtual threads. > > Testing: tier1-5 Marked as reviewed by rpressler (Committer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14361#pullrequestreview-1469948813 From briangoetz at openjdk.org Thu Jun 8 14:09:58 2023 From: briangoetz at openjdk.org (Brian Goetz) Date: Thu, 8 Jun 2023 14:09:58 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v10] In-Reply-To: <8LzoOpItGA_LBdMX5sJxyPJNV2ZCavz2mIs8t1qrWhw=.908dd1f2-6250-4a43-844e-3dcd100be19e@github.com> References: <8LzoOpItGA_LBdMX5sJxyPJNV2ZCavz2mIs8t1qrWhw=.908dd1f2-6250-4a43-844e-3dcd100be19e@github.com> Message-ID: On Thu, 8 Jun 2023 13:37:33 GMT, Adam Sotona wrote: >> Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html >> This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. >> >> Please review. >> >> Thanks, >> Adam > > Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: > > Revert "ClassHierarchyResolver::ofSystem is now thread-unsafe" > > This reverts commit f3099cd5b252924392995bf65edc710c27822d2b. Most entities in the system are immutable and therefore freely sharable without additional coordination.? Some have lazily-inflated single-field caches that conform to the "benign race" (there is only one possible non-default value) criteria. The main hole is the CHA resolution cache.? There are two ways to address this: protect the cache, or don't share the context. Unfortunately now that ClassModel refers back to the context, there's a risk of unexpected context sharing.? Here are a few options: ?- Make the CHA cache thread-safe using, say, CHM; ?- Make the CHA cache unshared, by using a ThreadLocal (this brings the context back to being immutable) ?- Detect when implicit use of a context happens on a thread other than the creating thread (currently the only vector for this is Classfile::transform), and inflate a new context with empty cache in that case; ?- Always create a fresh context with an empty cache in Classfile::transform On 6/8/2023 9:24 AM, Adam Sotona wrote: > > Unfortunately thread-unsafe context makes sharing of it in tests > executed in parallel a nightmare. > I can fix our Corpus tests and hope the race condition won't raise > also somewhere else later. > However how to explain this limitation to users? > > I suggest to make it always thread-safe (as the context is primary > expected to be shared in multi-threaded environment) and users may > make it faster in specific cases by providing non-synchronized map. > > ? > 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/14180#issuecomment-1582643016 From tholenstein at openjdk.org Thu Jun 8 14:29:56 2023 From: tholenstein at openjdk.org (Tobias Holenstein) Date: Thu, 8 Jun 2023 14:29:56 GMT Subject: RFR: JDK-8027711: Unify wildcarding syntax for CompileCommand and CompileOnly [v3] In-Reply-To: References: Message-ID: > At the moment `CompileCommand` and `CompileOnly` use different syntax for matching methods. > > ### Old CompileOnly format > - matching a **method name** with **class name** and **package name**: > `-XX:CompileOnly=package/path/Class.method` > `-XX:CompileOnly=package/path/Class::method` > `-XX:CompileOnly=package.path.Class::method` > BUT NOT `-XX:CompileOnly=package.path.Class.method` > > - just matching a **single method name**: > `-XX:CompileOnly=.hashCode` > `-XX:CompileOnly=::hashCode` > BUT NOT `-XX:CompileOnly=hashCode` > > - Matching **all method names** in a **class name** with **package name** > `-XX:CompileOnly=java/lang/String` > BUT NOT `-XX:CompileOnly=java/lang/String.` > BUT NOT `-XX:CompileOnly=java.lang.String` > BUT NOT `-XX:CompileOnly=java.lang.String::` (This is actually a bug) > BUT NOT `-XX:CompileOnly=String` > BUT NOT `-XX:CompileOnly=String.` > BUT NOT `-XX:CompileOnly=String::` > > - Matching **all method names** in a **class name** with **NO package name** > `-XX:CompileOnly=String` > BUT NOT `-XX:CompileOnly=String.` > BUT NOT `-XX:CompileOnly=String::` > > - There is a bug when `CompileOnly` ends with `::` where the `CompileOnly` is just ignored > e.g. `-XX:CompileOnly=String::` compiles as many methods as when omitting the `-XX:CompileOnly=` command > > ### CompileCommand=compileonly format > `CompileCommand` allows two different forms for paths: > - `package/path/Class.method` > - `package.path.Class::method` > > In contrary to `CompileOnly` `CompileCommand` supports wildcard matching using `*`. `*` can appear at the beginning and/or end of a `package.path.Class` and `method` name. > > Valid forms: > `-XX:CompileCommand=compileonly,*.lang.*::*shCo*` > `-XX:CompileCommand=compileonly,*/lang/*.*shCo*` > `-XX:CompileCommand=compileonly,java.lang.String::*` > `-XX:CompileCommand=compileonly,*::hashCode` > `-XX:CompileCommand=compileonly,*ng.String::hashC*` > `-XX:CompileCommand=compileonly,*String::hash*` > > Invalid forms (Error: Embedded * not allowed): > `-XX:CompileCommand=compileonly,java.*.String::has*Code` > > ### Use CompileCommand syntax for CompileOnly > At the moment, in some cases it is not possible to just take pattern used with `CompileOnly` and plug it into compile command file. Syntax used by CompileOnly is also not very intuitive. > > `CompileOnly` is convenient because it's shorter to write and takes lists of patterns, whereas `CompileCommand` only takes one pattern per command. > > With this PR `CompileOnly` becomes an alias for `CompileCommand=compileonly` with possibility to take lists as ... Tobias Holenstein has updated the pull request incrementally with 11 additional commits since the last revision: - Update TestStableUShort.java - Update TestStableUByte.java - Update TestStableShort.java - Update TestStableObject.java - Update TestStableLong.java - Update TestStableInt.java - Update TestStableFloat.java - Update TestStableDouble.java - Update TestStableChar.java - Update TestStableByte.java - ... and 1 more: https://git.openjdk.org/jdk/compare/40b17296...e320a9de ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13802/files - new: https://git.openjdk.org/jdk/pull/13802/files/40b17296..e320a9de Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13802&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13802&range=01-02 Stats: 44 lines in 11 files changed: 0 ins; 0 del; 44 mod Patch: https://git.openjdk.org/jdk/pull/13802.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13802/head:pull/13802 PR: https://git.openjdk.org/jdk/pull/13802 From iris at openjdk.org Thu Jun 8 14:41:53 2023 From: iris at openjdk.org (Iris Clark) Date: Thu, 8 Jun 2023 14:41:53 GMT Subject: RFR: JDK-8306584: Start of release updates for JDK 22 [v6] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 00:37:07 GMT, Joe Darcy wrote: >> Time to get JDK 22 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 39 commits: > > - Merge branch 'master' into JDK-8306584 > - Merge branch 'master' into JDK-8306584 > - Update wording to be consistent with JDK-8295071. > - Merge branch 'master' into JDK-8306584 > - Update wording of new constant to be consistent with JDK-8309554. > - Merge branch 'master' into JDK-8306584 > - Merge branch 'master' into JDK-8306584 > - Merge branch 'master' into JDK-8306584 > - Merge branch 'master' into JDK-8306584 > - Merge branch 'master' into JDK-8306584 > - ... and 29 more: https://git.openjdk.org/jdk/compare/4ffc8cc2...a03bcd40 Marked as reviewed by iris (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/13567#pullrequestreview-1470093232 From prappo at openjdk.org Thu Jun 8 14:47:13 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 8 Jun 2023 14:47:13 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v8] In-Reply-To: References: Message-ID: > Please review this long-awaited change to documentation inheritance. > > This change improves "methods comment algorithm" and introduces directed documentation inheritance. While "methods comment algorithm" -- automatic search for inheritable documentation -- has been improved, it still cannot read an author's mind so as to always find the documentation they intended. From now on, an author can state their intention, by providing an FQN of the superclass or superinterface from which to inherit documentation: > > ?{@inheritDoc S} > > Which is exactly what I did to counterbalance some of the JDK API Documentation changes caused by the change to "methods comment algorithm". Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: feedback: use JavadocTester.out Also, trivially fixes grammar (word order) in a comment. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14357/files - new: https://git.openjdk.org/jdk/pull/14357/files/dea776e2..cccffa66 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14357&range=07 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14357&range=06-07 Stats: 6 lines in 1 file changed: 0 ins; 0 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/14357.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14357/head:pull/14357 PR: https://git.openjdk.org/jdk/pull/14357 From prappo at openjdk.org Thu Jun 8 14:47:16 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 8 Jun 2023 14:47:16 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v2] In-Reply-To: References: Message-ID: <82i8za9caZsJgAkr0hX9cR-ItoN94SJdcsHW0EfTswc=.8477eb23-93a7-4ac5-a558-384f9d956371@github.com> On Wed, 7 Jun 2023 20:33:00 GMT, Jonathan Gibbons wrote: >> Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: >> >> feedback: make warning less scary > > test/langtools/jdk/javadoc/doclet/testMethodCommentAlgorithm/TestMethodCommentsAlgorithm.java line 273: > >> 271: } >> 272: } >> 273: System.err.println("Test suite root: " + p); > > You might want to use `JavadocTester.out` instead of `System.err` Fixed in cccffa660a8. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1223144388 From adam.sotona at oracle.com Thu Jun 8 15:00:00 2023 From: adam.sotona at oracle.com (Adam Sotona) Date: Thu, 8 Jun 2023 15:00:00 +0000 Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v10] In-Reply-To: References: <8LzoOpItGA_LBdMX5sJxyPJNV2ZCavz2mIs8t1qrWhw=.908dd1f2-6250-4a43-844e-3dcd100be19e@github.com> Message-ID: From: core-libs-dev on behalf of Brian Goetz Most entities in the system are immutable and therefore freely sharable without additional coordination. Some have lazily-inflated single-field caches that conform to the "benign race" (there is only one possible non-default value) criteria. The main hole is the CHA resolution cache. There are two ways to address this: protect the cache, or don't share the context. Unfortunately now that ClassModel refers back to the context, there's a risk of unexpected context sharing. Here are a few options: - Make the CHA cache thread-safe using, say, CHM; This is current solution for the default system CH cache. We may also remove ClassHierarchyResolver::cached() method to force user think about it and always call ClassHierarchyResolver::cached(Supplier> cacheFactory) for all non-default cases. Or we may also use a bit less strict custom semi-synchronization (just enough to be thread safe) instead of fully-synchronized CHM::computeIfAbsent, for example CHM:get ? ... CHM::put. - Make the CHA cache unshared, by using a ThreadLocal (this brings the context back to being immutable) This is interesting option for small number of threads, however it makes big footprint for heavy-parallel systems. - Detect when implicit use of a context happens on a thread other than the creating thread (currently the only vector for this is Classfile::transform), and inflate a new context with empty cache in that case; This would degrade the caching completely by triggering a new context for each transformed method in case there are two threads working synchronously. - Always create a fresh context with an empty cache in Classfile::transform This would destroy the caching. Such cache would work only in scope of one method. On 6/8/2023 9:24 AM, Adam Sotona wrote: > > Unfortunately thread-unsafe context makes sharing of it in tests > executed in parallel a nightmare. > I can fix our Corpus tests and hope the race condition won't raise > also somewhere else later. > However how to explain this limitation to users? > > I suggest to make it always thread-safe (as the context is primary > expected to be shared in multi-threaded environment) and users may > make it faster in specific cases by providing non-synchronized map. > > ? > 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/14180#issuecomment-1582643016 -------------- next part -------------- An HTML attachment was scrubbed... URL: From redestad at openjdk.org Thu Jun 8 15:15:19 2023 From: redestad at openjdk.org (Claes Redestad) Date: Thu, 8 Jun 2023 15:15:19 GMT Subject: RFR: 8309665: Simplify Arrays.copyOf/-Range methods Message-ID: https://bugs.openjdk.org/browse/JDK-8301958 and later changes improved Arrays.copyOf/-Range methods to improve peak performance in microbenchmarks when copying the entire array, but it's resulted in a few lurking footprint benchmark issues that come down to incurring slightly more JIT activity. As a partial remedy I propose simplifying the implementation so that no new methods are added compared to the JDK 20 baseline. This patch maintains the microbenchmark speed-up from JDK-8301958 while reducing JIT compilations in startup/footprint benchmarks. ------------- Commit messages: - Merge branch 'master' into 8309665 - 8309665: Simplify Array.copyOf/-Range methods Changes: https://git.openjdk.org/jdk/pull/14380/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14380&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309665 Stats: 105 lines in 1 file changed: 25 ins; 62 del; 18 mod Patch: https://git.openjdk.org/jdk/pull/14380.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14380/head:pull/14380 PR: https://git.openjdk.org/jdk/pull/14380 From aivanov at openjdk.org Thu Jun 8 15:18:54 2023 From: aivanov at openjdk.org (Alexey Ivanov) Date: Thu, 8 Jun 2023 15:18:54 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v7] In-Reply-To: References: <2DpBE46Rn1mY3i9T1oOMwpxJ3ye0taYJJm2rh-2ZlAw=.10043f50-5c41-4d09-bc3c-53f0c490c5ba@github.com> Message-ID: On Thu, 8 Jun 2023 11:29:44 GMT, Pavel Rappo wrote: >> src/java.base/share/classes/java/util/concurrent/LinkedBlockingDeque.java line 635: >> >>> 633: * @return {@inheritDoc BlockingDeque} >>> 634: */ >>> 635: public boolean offer(E e) { >> >> Does this work for @param tags too? Just curious. > > The directed `{@inheritDoc }` works for the main description, `@throws`, `@param` and `@return` tags. If your question is about why that particular doc comment does not use this: > > @param e {@inheritDoc BlockingDeque} > > then the answer is that it's not necessary for keeping the API documentation unchanged. I admit I can't parse this sentence: > then the answer is that it's not necessary for keeping the API documentation unchanged. Do you mean that you didn't add `@param e {@inheritDoc BlockingDeque}` here to keep the documentation unchanged? You added `@inheritDoc` for `@param` tags in [FileCacheImageOutputStream.java](https://github.com/openjdk/jdk/pull/14357/files#diff-bc1e47b4c5c405826e7a062cabea04349ef72d5823b67e8616a680dcfcb5d4be) and others but not here. So, do we need to add `@param` tags if the entire javadoc is inherited with `@inheritDoc`? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1223197961 From jlaskey at openjdk.org Thu Jun 8 15:26:48 2023 From: jlaskey at openjdk.org (Jim Laskey) Date: Thu, 8 Jun 2023 15:26:48 GMT Subject: RFR: 8309665: Simplify Arrays.copyOf/-Range methods In-Reply-To: References: Message-ID: <1IDGcPYYmhADL2TIeC63_NOqma34MBkepFeuZfHrm7U=.ede1ce39-73d2-4f16-8aef-c82f8cce0f53@github.com> On Thu, 8 Jun 2023 15:08:28 GMT, Claes Redestad wrote: > https://bugs.openjdk.org/browse/JDK-8301958 and later changes improved Arrays.copyOf/-Range methods to improve peak performance in microbenchmarks when copying the entire array, but it's resulted in a few lurking footprint benchmark issues that come down to incurring slightly more JIT activity. As a partial remedy I propose simplifying the implementation so that no new methods are added compared to the JDK 20 baseline. This patch maintains the microbenchmark speed-up from JDK-8301958 while reducing JIT compilations in startup/footprint benchmarks. LGTM ------------- Marked as reviewed by jlaskey (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14380#pullrequestreview-1470207769 From rriggs at openjdk.org Thu Jun 8 15:26:49 2023 From: rriggs at openjdk.org (Roger Riggs) Date: Thu, 8 Jun 2023 15:26:49 GMT Subject: RFR: 8309665: Simplify Arrays.copyOf/-Range methods In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 15:08:28 GMT, Claes Redestad wrote: > https://bugs.openjdk.org/browse/JDK-8301958 and later changes improved Arrays.copyOf/-Range methods to improve peak performance in microbenchmarks when copying the entire array, but it's resulted in a few lurking footprint benchmark issues that come down to incurring slightly more JIT activity. As a partial remedy I propose simplifying the implementation so that no new methods are added compared to the JDK 20 baseline. This patch maintains the microbenchmark speed-up from JDK-8301958 while reducing JIT compilations in startup/footprint benchmarks. Looks good. ------------- Marked as reviewed by rriggs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14380#pullrequestreview-1470208761 From redestad at openjdk.org Thu Jun 8 15:29:48 2023 From: redestad at openjdk.org (Claes Redestad) Date: Thu, 8 Jun 2023 15:29:48 GMT Subject: RFR: 8309665: Simplify Arrays.copyOf/-Range methods In-Reply-To: <1IDGcPYYmhADL2TIeC63_NOqma34MBkepFeuZfHrm7U=.ede1ce39-73d2-4f16-8aef-c82f8cce0f53@github.com> References: <1IDGcPYYmhADL2TIeC63_NOqma34MBkepFeuZfHrm7U=.ede1ce39-73d2-4f16-8aef-c82f8cce0f53@github.com> Message-ID: On Thu, 8 Jun 2023 15:24:00 GMT, Jim Laskey wrote: >> https://bugs.openjdk.org/browse/JDK-8301958 and later changes improved Arrays.copyOf/-Range methods to improve peak performance in microbenchmarks when copying the entire array, but it's resulted in a few lurking footprint benchmark issues that come down to incurring slightly more JIT activity. As a partial remedy I propose simplifying the implementation so that no new methods are added compared to the JDK 20 baseline. This patch maintains the microbenchmark speed-up from JDK-8301958 while reducing JIT compilations in startup/footprint benchmarks. > > LGTM @JimLaskey @RogerRiggs thanks for the quick reviews! I'll wait for and double-check test results before pushing. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14380#issuecomment-1582821757 From prappo at openjdk.org Thu Jun 8 15:49:53 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 8 Jun 2023 15:49:53 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v7] In-Reply-To: References: <2DpBE46Rn1mY3i9T1oOMwpxJ3ye0taYJJm2rh-2ZlAw=.10043f50-5c41-4d09-bc3c-53f0c490c5ba@github.com> Message-ID: On Thu, 8 Jun 2023 15:16:09 GMT, Alexey Ivanov wrote: >> The directed `{@inheritDoc }` works for the main description, `@throws`, `@param` and `@return` tags. If your question is about why that particular doc comment does not use this: >> >> @param e {@inheritDoc BlockingDeque} >> >> then the answer is that it's not necessary for keeping the API documentation unchanged. > > I admit I can't parse this sentence: > >> then the answer is that it's not necessary for keeping the API documentation unchanged. > > Do you mean that you didn't add `@param e {@inheritDoc BlockingDeque}` here to keep the documentation unchanged? > > You added `@inheritDoc` for `@param` tags in [FileCacheImageOutputStream.java](https://github.com/openjdk/jdk/pull/14357/files#diff-bc1e47b4c5c405826e7a062cabea04349ef72d5823b67e8616a680dcfcb5d4be) and others but not here. > > So, do we need to add `@param` tags if the entire javadoc is inherited with `@inheritDoc`? Copying an individual doc element using `{@inheritDoc}` never adds meta information on the generated HTML page to indicate where that doc element was copied from. It so happens in this particular case that the doc element's contents are the same in both possible supertypes (BlockingDeque and Queue) and look like this: @param e the element to add If the end result _on the HTML page_ will look identical no mater if I add `@param e {@inheritDoc BlockingDeque}` or not, I will not add it in _this_ PR. This PR's goal is not restructuring the doc comment; in fact, such restructuring would be an anti-goal. It might be a goal for subsequent, area-specific PRs. Above I said that "`{@inheritDoc}` never adds meta information on the generated HTML page". You might have immediately thought about cases where you saw the "Description copied from interface/class" headings. However, those do not come from `{@inheritDoc}`; those come from empty comments (which inherit their content by omission, if you wish). So those headings DO indicate the source of the complete doc comment. Now about FileCacheImageOutputStream.java. If I hand't added directed inheritance there, the updated algorithm would've picked a different comment, which wouldn't have been identical to what was picked before: - javax.imageio.stream.ImageInputStream#flushBefore ``` * @param pos a {@code long} containing the length of the * stream prefix that may be flushed. ``` - javax.imageio.stream.ImageOutputStream#flushBefore: ``` * @param pos a {@code long} containing the length of the * stream prefix that may be flushed to the destination. ``` Hence, the correction. Does it clarify the matter? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1223236596 From prappo at openjdk.org Thu Jun 8 15:53:58 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Thu, 8 Jun 2023 15:53:58 GMT Subject: RFR: 8285368: Overhaul doc-comment inheritance [v7] In-Reply-To: References: <2DpBE46Rn1mY3i9T1oOMwpxJ3ye0taYJJm2rh-2ZlAw=.10043f50-5c41-4d09-bc3c-53f0c490c5ba@github.com> Message-ID: On Thu, 8 Jun 2023 15:47:26 GMT, Pavel Rappo wrote: >> I admit I can't parse this sentence: >> >>> then the answer is that it's not necessary for keeping the API documentation unchanged. >> >> Do you mean that you didn't add `@param e {@inheritDoc BlockingDeque}` here to keep the documentation unchanged? >> >> You added `@inheritDoc` for `@param` tags in [FileCacheImageOutputStream.java](https://github.com/openjdk/jdk/pull/14357/files#diff-bc1e47b4c5c405826e7a062cabea04349ef72d5823b67e8616a680dcfcb5d4be) and others but not here. >> >> So, do we need to add `@param` tags if the entire javadoc is inherited with `@inheritDoc`? > > Copying an individual doc element using `{@inheritDoc}` never adds meta information on the generated HTML page to indicate where that doc element was copied from. It so happens in this particular case that the doc element's contents are the same in both possible supertypes (BlockingDeque and Queue) and look like this: > > @param e the element to add > > If the end result _on the HTML page_ will look identical no mater if I add `@param e {@inheritDoc BlockingDeque}` or not, I will not add it in _this_ PR. This PR's goal is not restructuring the doc comment; in fact, such restructuring would be an anti-goal. It might be a goal for subsequent, area-specific PRs. > > Above I said that "`{@inheritDoc}` never adds meta information on the generated HTML page". You might have immediately thought about cases where you saw the "Description copied from interface/class" headings. However, those do not come from `{@inheritDoc}`; those come from empty comments (which inherit their content by omission, if you wish). So those headings DO indicate the source of the complete doc comment. > > Now about FileCacheImageOutputStream.java. If I hand't added directed inheritance there, the updated algorithm would've picked a different comment, which wouldn't have been identical to what was picked before: > > - javax.imageio.stream.ImageInputStream#flushBefore > ``` > * @param pos a {@code long} containing the length of the > * stream prefix that may be flushed. > ``` > > - javax.imageio.stream.ImageOutputStream#flushBefore: > ``` > * @param pos a {@code long} containing the length of the > * stream prefix that may be flushed to the destination. > ``` > Hence, the correction. Does it clarify the matter? Also, for better or worse, a lone `{@inheritDoc}` never inherits "everything" from a supertype: /** {@inheritDoc} */ It merely inherits the main description of a method. Other elements such as parameter, exception or return information are inherited individually. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14357#discussion_r1223241132 From roger.riggs at oracle.com Thu Jun 8 16:02:45 2023 From: roger.riggs at oracle.com (Roger Riggs) Date: Thu, 8 Jun 2023 12:02:45 -0400 Subject: Leap second handling in Windows timestamps In-Reply-To: <71d99c8c-f188-a09c-fc38-f428cc8ff6c0@oracle.com> References: <1790d01d985ca$e03cf6c0$a0b6e440$@flueckiger.ch> <71d99c8c-f188-a09c-fc38-f428cc8ff6c0@oracle.com> Message-ID: <5fe1ed9e-b914-1ad9-6726-ddd25df3412e@oracle.com> Hi, I looked into this issue and added comments to the issue tracker. 8308302 Leap second handling in Windows timestamps I don't see an issue with the implementation for past leap-seconds and there is significant discussion about whether if or when there will be another one. Until another leap-second is declared, I don't see any immediate followup. Regards, Roger On 5/17/23 1:19 PM, Roger Riggs wrote: > Hi, > > Thanks for the report, I created a Jira issue to track the investigation. > https://bugs.openjdk.org/browse/JDK-8308302 > > Regards, Roger > > On 5/13/23 2:43 PM, andreas at flueckiger.ch wrote: >> Subject: >> Leap second handling in Windows timestamps >> From: >> >> Date: >> 5/13/23, 2:43 PM >> >> To: >> >> >> >> Hello, >> >> This is my first post to this mailing list. I've been exploring a problem concerning leap seconds that emerged with the Windows 10 October 2018 Update. The current implementation of InstantSource and other classes that interact with FILETIME structures seem to be affected. This problem extends beyond just leap second days and will occur on any future day where the UTC-TAI offset deviates from 37 seconds. >> >> The Java code snippet below, which uses JNA to convert a Windows FILETIME to an Instant, represents my initial attempt to address this issue. This approach makes the assumption that no more than one leap second is added or removed in a day, which should hold true until at least 2035, and likely a few years beyond. >> >> I'm not sure how this will impact performance, and I'm not certain about the exact performance requirements. Also, I'm not sure if my current level of experience and permissions allow me to contribute directly to the JDK codebase. Still, I hope this code can provide some direction towards refining the handling of Windows timestamps. >> >> Kind regards, >> Andreas >> >> private static Instant fileTimeToInstant(long fileTime) { >> if (fileTime < 0L) { >> throw new DateTimeException("file time must not be negative"); >> } >> >> // Calculate nano adjustment and round down fileTime to the nearest second >> int nanoAdjustment = (int) (fileTime % 10000000L); >> fileTime -= nanoAdjustment; >> nanoAdjustment *= 100; >> >> // Populate FILETIME structure >> FILETIME fileTimeStruct = new FILETIME(); >> fileTimeStruct.dwHighDateTime = (int) (fileTime >>> 32); >> fileTimeStruct.dwLowDateTime = (int) (fileTime & 0xffffffffL); >> >> // Convert FILETIME structure to a SYSTEMTIME structure >> SYSTEMTIME systemTime = new SYSTEMTIME(); >> if (!Kernel32.INSTANCE.FileTimeToSystemTime(fileTimeStruct, systemTime)) { >> throw new LastErrorException(Native.getLastError()); >> } >> >> // Calculate epoch day and second of day >> long epochDay = LocalDate.of(systemTime.wYear, systemTime.wMonth, systemTime.wDay).toEpochDay(); >> int secondOfDay = systemTime.wHour * 3600 + systemTime.wMinute * 60 + systemTime.wSecond; >> >> // Calculate UTC-SLS slew if necessary and only for dates before December 31, >> // 30827 (epochDay < 10540167). SystemTimeToFileTime does not support dates >> // after the year 30827. >> if (secondOfDay >= 85399 && epochDay < 10540167) { >> // If the actual second of the day is 86400 (leap second) and the process is in >> // "compatible mode", increment the secondOfDay variable. In compatible mode, >> // the clock slows down to half speed for two seconds at the '59' second mark, >> // and systemTime.wMilliseconds reaches 500 at the beginning of the leap second. >> // This ensures that the leap second is properly accounted for without depending >> // on the ProcessLeapSecondInfo option. Rounding down fileTime to the nearest >> // second ensures that this check works as intended. >> if (secondOfDay == 86399 && systemTime.wMilliseconds == 500) { >> secondOfDay++; >> } >> >> // Calculate leap adjustment >> int leapAdjustment; >> if (secondOfDay == 86400) { >> // In case of a leap second, set leap adjustment to 1 >> // to avoid unnecessary further calculations >> leapAdjustment = 1; >> } else { >> // If it's not a leap second, calculate leap adjustment by >> // determining the difference to the beginning of the next day >> LocalDate nextDay = LocalDate.ofEpochDay(epochDay + 1); >> systemTime.wYear = (short) nextDay.getYear(); >> systemTime.wMonth = (short) nextDay.getMonthValue(); >> systemTime.wDay = (short) nextDay.getDayOfMonth(); >> systemTime.wHour = 0; >> systemTime.wMinute = 0; >> systemTime.wSecond = 0; >> systemTime.wMilliseconds = 0; >> if (!Kernel32.INSTANCE.SystemTimeToFileTime(systemTime, fileTimeStruct)) { >> throw new LastErrorException(Native.getLastError()); >> } >> long nextDayFileTime = (((long) fileTimeStruct.dwHighDateTime) << 32) | (fileTimeStruct.dwLowDateTime & 0xffffffffL); >> >> leapAdjustment = (int) ((nextDayFileTime - fileTime) / 10000000L + secondOfDay - 86400L); >> } >> >> // Adjust nanoseconds based on leap adjustment >> if (leapAdjustment != 0 && secondOfDay - leapAdjustment >= 85400) { >> nanoAdjustment -= ((secondOfDay - leapAdjustment - 85400) * 1000000000L + nanoAdjustment) * leapAdjustment / 1000L; >> } >> } >> >> return Instant.ofEpochSecond(epochDay * 86400L + secondOfDay, nanoAdjustment); >> } >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From darcy at openjdk.org Thu Jun 8 16:04:58 2023 From: darcy at openjdk.org (Joe Darcy) Date: Thu, 8 Jun 2023 16:04:58 GMT Subject: Integrated: JDK-8306584: Start of release updates for JDK 22 In-Reply-To: References: Message-ID: On Thu, 20 Apr 2023 20:28:18 GMT, Joe Darcy wrote: > Time to get JDK 22 underway... This pull request has now been integrated. Changeset: 5a706fb4 Author: Joe Darcy Committer: Jesper Wilhelmsson URL: https://git.openjdk.org/jdk/commit/5a706fb403df0768ecef5b0ce14a3ca389a51efd Stats: 5954 lines in 69 files changed: 5902 ins; 0 del; 52 mod 8306584: Start of release updates for JDK 22 8306585: Add SourceVersion.RELEASE_22 8306586: Add source 22 and target 22 to javac Reviewed-by: erikj, iris, dholmes, jlahoda, alanb ------------- PR: https://git.openjdk.org/jdk/pull/13567 From asotona at openjdk.org Thu Jun 8 16:11:49 2023 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 8 Jun 2023 16:11:49 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v10] In-Reply-To: References: <8LzoOpItGA_LBdMX5sJxyPJNV2ZCavz2mIs8t1qrWhw=.908dd1f2-6250-4a43-844e-3dcd100be19e@github.com> Message-ID: On Thu, 8 Jun 2023 14:07:24 GMT, Brian Goetz wrote: > Here are a few options: ?- Make the CHA cache thread-safe using, say, CHM; This is current solution for the default system CH cache. We may also use a bit less strict custom semi-synchronization (just enough to be thread safe) instead of fully-synchronized `CHM::computeIfAbsent`, for example `CHM:get ? (compute if absent without lock) ... CHM::put`. CHM does not lock on get, so the only penalty would be synchronous put call. >?- Make the CHA cache unshared, by using a ThreadLocal (this brings the context back to being immutable) This is interesting option for small number of threads, however it makes big footprint for heavy-parallel systems. >?- Detect when implicit use of a context happens on a thread other than the creating thread (currently the only vector for this is Classfile::transform), and inflate a new context with empty cache in that case; This would degrade the caching completely by triggering a new context for each transformed method in case there are two threads working synchronously. >?- Always create a fresh context with an empty cache in Classfile::transform This would destroy the caching. Such cache would work only in scope of one method. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14180#issuecomment-1582943385 From duke at openjdk.org Thu Jun 8 16:17:49 2023 From: duke at openjdk.org (Brett Okken) Date: Thu, 8 Jun 2023 16:17:49 GMT Subject: RFR: 8309665: Simplify Arrays.copyOf/-Range methods In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 15:08:28 GMT, Claes Redestad wrote: > https://bugs.openjdk.org/browse/JDK-8301958 and later changes improved Arrays.copyOf/-Range methods to improve peak performance in microbenchmarks when copying the entire array, but it's resulted in a few lurking footprint benchmark issues that come down to incurring slightly more JIT activity. As a partial remedy I propose simplifying the implementation so that no new methods are added compared to the JDK 20 baseline. This patch maintains the microbenchmark speed-up from JDK-8301958 while reducing JIT compilations in startup/footprint benchmarks. src/java.base/share/classes/java/util/Arrays.java line 3845: > 3843: */ > 3844: public static byte[] copyOfRange(byte[] original, int from, int to) { > 3845: // Tickle the JIT to fold special cases optimally this comment has been inconsistently left vs removed in the various methods (even though the other changes appear the same). was this intentional? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14380#discussion_r1223276847 From asotona at openjdk.org Thu Jun 8 16:37:22 2023 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 8 Jun 2023 16:37:22 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v11] In-Reply-To: References: Message-ID: > Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html > This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. > > Please review. > > Thanks, > Adam Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: - proposed semi-synchronized caching, where the map is not locked during delegate call - used Factory.INSTANCE for system ClassHierarchyResolver cache ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14180/files - new: https://git.openjdk.org/jdk/pull/14180/files/41fdb2fc..ae287751 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=10 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14180&range=09-10 Stats: 28 lines in 2 files changed: 13 ins; 11 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/14180.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14180/head:pull/14180 PR: https://git.openjdk.org/jdk/pull/14180 From briangoetz at openjdk.org Thu Jun 8 16:37:45 2023 From: briangoetz at openjdk.org (Brian Goetz) Date: Thu, 8 Jun 2023 16:37:45 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v10] In-Reply-To: <8LzoOpItGA_LBdMX5sJxyPJNV2ZCavz2mIs8t1qrWhw=.908dd1f2-6250-4a43-844e-3dcd100be19e@github.com> References: <8LzoOpItGA_LBdMX5sJxyPJNV2ZCavz2mIs8t1qrWhw=.908dd1f2-6250-4a43-844e-3dcd100be19e@github.com> Message-ID: On Thu, 8 Jun 2023 13:37:33 GMT, Adam Sotona wrote: >> Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html >> This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. >> >> Please review. >> >> Thanks, >> Adam > > Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: > > Revert "ClassHierarchyResolver::ofSystem is now thread-unsafe" > > This reverts commit f3099cd5b252924392995bf65edc710c27822d2b. On 6/8/2023 12:09 PM, Adam Sotona wrote: > > Here are a few options: > ?- Make the CHA cache thread-safe using, say, CHM; > > This is current solution for the default system CH cache. > > We may also use a bit less strict custom semi-synchronization (just > enough to be thread safe) instead of fully-synchronized > |CHM::computeIfAbsent|, for example |CHM:get ? (compute if absent > without lock) ... CHM::put|. > CHM does not lock on get, so the only penalty would be synchronous put > call. > > ?- Make the CHA cache unshared, by using a ThreadLocal (this > brings the context back to being immutable) > > This is interesting option for small number of threads, however it > makes big footprint for heavy-parallel systems. > I have a hard time imagining heavy parallel use here; concurrency against the same cache would most likely come from accidental sharing.? So this is not necessarily a problem.? Are you imagining differnet use cases? ------------- PR Comment: https://git.openjdk.org/jdk/pull/14180#issuecomment-1583003584 From alanb at openjdk.org Thu Jun 8 16:46:20 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 8 Jun 2023 16:46:20 GMT Subject: RFR: 8309196: Remove Thread.countStackFrames [v3] In-Reply-To: <7p3wapZUnzfzFKMyOVexaMVGeh00epZs3ipgw-LpvDM=.86006e6e-060a-4d9b-a883-4983381cdba7@github.com> References: <7p3wapZUnzfzFKMyOVexaMVGeh00epZs3ipgw-LpvDM=.86006e6e-060a-4d9b-a883-4983381cdba7@github.com> Message-ID: > Thread.countStackFrames is/was an ill-defined method that dates from JDK 1.0 for counting the stack frames of a suspended Thread. The method was deprecated in JDK 1.2 (1998), deprecated for removal in Java 9, and re-specified/degraded to throw UOE unconditionally in Java 14. Java 22 would be a fine time to finally remove this method. > > Code that wants to count stack frames should be directed to use j.l.StackWalker, or if a tool, then it can use JVM TI and other tool APIs. > > A corpus analysis of 30M classes in 131k artifacts from Maven Central found only 1 usages to this method. The 1 usage appears to be a class that just wraps all methods, it doesn't actually make use of it. Alan Bateman 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: - Merge - Merge - Initial commit ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14257/files - new: https://git.openjdk.org/jdk/pull/14257/files/e44c3c49..b784ff83 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14257&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14257&range=01-02 Stats: 6494 lines in 82 files changed: 6315 ins; 50 del; 129 mod Patch: https://git.openjdk.org/jdk/pull/14257.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14257/head:pull/14257 PR: https://git.openjdk.org/jdk/pull/14257 From mchung at openjdk.org Thu Jun 8 16:46:55 2023 From: mchung at openjdk.org (Mandy Chung) Date: Thu, 8 Jun 2023 16:46:55 GMT Subject: RFR: 8305104: Remove the old core reflection implementation [v3] In-Reply-To: References: Message-ID: > JEP 416 integrated in JDK 18 and since then, only a couple minor issues has been reported. Those issues were related with exception being thrown with invalid arguments. We propose to remove the old core reflection implementation in JDK 22. The `-Djdk.reflect.useDirectMethodHandle=false` workaround to revert to the old implementation will stop to work. Mandy Chung has updated the pull request incrementally with one additional commit since the last revision: review feedback ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14371/files - new: https://git.openjdk.org/jdk/pull/14371/files/d161a384..fc164c71 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14371&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14371&range=01-02 Stats: 49 lines in 4 files changed: 15 ins; 28 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/14371.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14371/head:pull/14371 PR: https://git.openjdk.org/jdk/pull/14371 From mchung at openjdk.org Thu Jun 8 16:46:57 2023 From: mchung at openjdk.org (Mandy Chung) Date: Thu, 8 Jun 2023 16:46:57 GMT Subject: RFR: 8305104: Remove the old core reflection implementation [v2] In-Reply-To: <99mbKbiEdzbFp3PyMA-I8UX3LPWriM6PZFX3itSTObw=.c3238b5d-1552-4455-8ebb-923ccd60480d@github.com> References: <99mbKbiEdzbFp3PyMA-I8UX3LPWriM6PZFX3itSTObw=.c3238b5d-1552-4455-8ebb-923ccd60480d@github.com> Message-ID: On Thu, 8 Jun 2023 01:46:55 GMT, David Holmes wrote: >> Mandy Chung has updated the pull request incrementally with one additional commit since the last revision: >> >> fix merge issue > > src/hotspot/share/classfile/verifier.cpp line 298: > >> 296: // NOTE: this is called too early in the bootstrapping process to be >> 297: // guarded by Universe::is_gte_jdk14x_version(). >> 298: // Also for lambda generated code, gte jdk8 > > While you are here could you delete these version comments please - they are meaningless these days. Thanks. Done. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14371#discussion_r1223305314 From mchung at openjdk.org Thu Jun 8 16:47:00 2023 From: mchung at openjdk.org (Mandy Chung) Date: Thu, 8 Jun 2023 16:47:00 GMT Subject: RFR: 8305104: Remove the old core reflection implementation [v2] In-Reply-To: References: Message-ID: <6kpeFY6P4c-vULMHVmKx1moS_087FvmsMDlsWBeSC6o=.88b3c7a7-803b-466f-8223-dd459a9eb98c@github.com> On Thu, 8 Jun 2023 08:42:41 GMT, Alan Bateman wrote: >> Mandy Chung has updated the pull request incrementally with one additional commit since the last revision: >> >> fix merge issue > > src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java line 578: > >> 576: // then switch to the bytecode-based implementations. >> 577: >> 578: private static final Config DEFAULT_CONFIG = new Config(false, // useNativeAccessorOnly > > The block comment just before this will need updating. There's another one in Config.config where it uses the default/native implementation in early startup. Thanks for pointing this out. Updated. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14371#discussion_r1223305554 From mchung at openjdk.org Thu Jun 8 16:47:03 2023 From: mchung at openjdk.org (Mandy Chung) Date: Thu, 8 Jun 2023 16:47:03 GMT Subject: RFR: 8305104: Remove the old core reflection implementation [v2] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 01:36:40 GMT, Chen Liang wrote: >> Mandy Chung has updated the pull request incrementally with one additional commit since the last revision: >> >> fix merge issue > > test/jdk/java/lang/reflect/Field/NegativeTest.java line 27: > >> 25: * @test >> 26: * @bug 8277451 >> 27: * @run testng/othervm NegativeTest > > Does this still need othervm if it doesn't set system properties? Updated. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14371#discussion_r1223305257 From alanb at openjdk.org Thu Jun 8 17:32:18 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 8 Jun 2023 17:32:18 GMT Subject: RFR: 8305104: Remove the old core reflection implementation [v3] In-Reply-To: References: Message-ID: <1U7a_JyO7dEQz3VP5nxeNyEVXn5zVT4p0CO3iLgAa1w=.bbfda9c7-39d9-4127-8b4a-98bf4a15bc76@github.com> On Thu, 8 Jun 2023 16:46:55 GMT, Mandy Chung wrote: >> JEP 416 integrated in JDK 18 and since then, only a couple minor issues has been reported. Those issues were related with exception being thrown with invalid arguments. We propose to remove the old core reflection implementation in JDK 22. The `-Djdk.reflect.useDirectMethodHandle=false` workaround to revert to the old implementation will stop to work. > > Mandy Chung has updated the pull request incrementally with one additional commit since the last revision: > > review feedback Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14371#pullrequestreview-1470455536 From alanb at openjdk.org Thu Jun 8 17:32:39 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 8 Jun 2023 17:32:39 GMT Subject: Integrated: 8309196: Remove Thread.countStackFrames In-Reply-To: <7p3wapZUnzfzFKMyOVexaMVGeh00epZs3ipgw-LpvDM=.86006e6e-060a-4d9b-a883-4983381cdba7@github.com> References: <7p3wapZUnzfzFKMyOVexaMVGeh00epZs3ipgw-LpvDM=.86006e6e-060a-4d9b-a883-4983381cdba7@github.com> Message-ID: On Thu, 1 Jun 2023 06:40:04 GMT, Alan Bateman wrote: > Thread.countStackFrames is/was an ill-defined method that dates from JDK 1.0 for counting the stack frames of a suspended Thread. The method was deprecated in JDK 1.2 (1998), deprecated for removal in Java 9, and re-specified/degraded to throw UOE unconditionally in Java 14. Java 22 would be a fine time to finally remove this method. > > Code that wants to count stack frames should be directed to use j.l.StackWalker, or if a tool, then it can use JVM TI and other tool APIs. > > A corpus analysis of 30M classes in 131k artifacts from Maven Central found only 1 usages to this method. The 1 usage appears to be a class that just wraps all methods, it doesn't actually make use of it. This pull request has now been integrated. Changeset: b2a5271e Author: Alan Bateman URL: https://git.openjdk.org/jdk/commit/b2a5271e7451a7546a8293fc4bc4ccfaa1ffb0d7 Stats: 20 lines in 2 files changed: 0 ins; 17 del; 3 mod 8309196: Remove Thread.countStackFrames Reviewed-by: rriggs, mchung, dholmes, jpai, iris ------------- PR: https://git.openjdk.org/jdk/pull/14257 From mchung at openjdk.org Thu Jun 8 19:03:15 2023 From: mchung at openjdk.org (Mandy Chung) Date: Thu, 8 Jun 2023 19:03:15 GMT Subject: RFR: 8309303: jdk/internal/misc/VM/RuntimeArguments test ignores jdk/internal/vm/options Message-ID: The `RuntimeArguments` test verifies the VM arguments returned by `jdk.internal.misc.VM::getRuntimeArguments` as expected. This test fails when running with GraalVM as it was created with `jlink --add-options` and the application will always be launched with that additional set of VM options. This PR updates the test to read if 'jdk/internal/vm/options` is present and includle those options in the expected list. ------------- Commit messages: - 8309303: jdk/internal/misc/VM/RuntimeArguments test ignores jdk/internal/vm/options Changes: https://git.openjdk.org/jdk/pull/14383/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14383&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309303 Stats: 37 lines in 1 file changed: 33 ins; 1 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/14383.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14383/head:pull/14383 PR: https://git.openjdk.org/jdk/pull/14383 From dnsimon at openjdk.org Thu Jun 8 19:03:53 2023 From: dnsimon at openjdk.org (Doug Simon) Date: Thu, 8 Jun 2023 19:03:53 GMT Subject: RFR: 8309303: jdk/internal/misc/VM/RuntimeArguments test ignores jdk/internal/vm/options In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 18:56:28 GMT, Mandy Chung wrote: > The `RuntimeArguments` test verifies the VM arguments returned by `jdk.internal.misc.VM::getRuntimeArguments` as expected. This test fails when running with GraalVM as it was created with `jlink --add-options` and the application will always be launched with that additional set of VM options. This PR updates the test to read if 'jdk/internal/vm/options` is present and includle those options in the expected list. I can confirm the change works on GraalVM but it would make sense to also test it directly in the JDK by creating a test JDK image with jlink that includes VM options. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14383#issuecomment-1583176634 From dnsimon at openjdk.org Thu Jun 8 19:23:43 2023 From: dnsimon at openjdk.org (Doug Simon) Date: Thu, 8 Jun 2023 19:23:43 GMT Subject: RFR: 8309303: jdk/internal/misc/VM/RuntimeArguments test ignores jdk/internal/vm/options In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 18:56:28 GMT, Mandy Chung wrote: > The `RuntimeArguments` test verifies the VM arguments returned by `jdk.internal.misc.VM::getRuntimeArguments` as expected. This test fails when running with GraalVM as it was created with `jlink --add-options` and the application will always be launched with that additional set of VM options. This PR updates the test to read if 'jdk/internal/vm/options` is present and includle those options in the expected list. Marked as reviewed by dnsimon (Committer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14383#pullrequestreview-1470614093 From mchung at openjdk.org Thu Jun 8 19:23:45 2023 From: mchung at openjdk.org (Mandy Chung) Date: Thu, 8 Jun 2023 19:23:45 GMT Subject: RFR: 8309303: jdk/internal/misc/VM/RuntimeArguments test ignores jdk/internal/vm/options In-Reply-To: References: Message-ID: <01lUf_vOyLmvJZY6M54GRxYYYYvfAH1ltMKPg_kDyGE=.2a5ecc60-1d03-468d-a48f-705d63a6f87e@github.com> On Thu, 8 Jun 2023 19:01:37 GMT, Doug Simon wrote: > I can confirm the change works on GraalVM but it would make sense to also test it directly in the JDK by creating a test JDK image with jlink that includes VM options. Already exists. `test/jdk/tools/jlink/plugins/AddOptionsPluginTest.java` ------------- PR Comment: https://git.openjdk.org/jdk/pull/14383#issuecomment-1583201049 From duke at openjdk.org Thu Jun 8 19:40:56 2023 From: duke at openjdk.org (iaroslavski) Date: Thu, 8 Jun 2023 19:40:56 GMT Subject: RFR: JDK-8266431: Dual-Pivot Quicksort improvements (Radix sort) [v19] In-Reply-To: References: <8CwTPTO3LHUzkcn1tznXnWv3j7mKevPTrJCEDbBwAA8=.0347ef73-b94d-46a3-a768-b796082c832d@github.com> Message-ID: <7CWEKASGpYF08hhgxhrks2VLffdpZzSnfpqsVUau0io=.9eff371b-0b6d-42e6-be60-658a83268e5f@github.com> On Sun, 12 Mar 2023 21:28:59 GMT, iaroslavski wrote: >> Sorting: >> >> - adopt radix sort for sequential and parallel sorts on int/long/float/double arrays (almost random and length > 6K) >> - fix tryMergeRuns() to better handle case when the last run is a single element >> - minor javadoc and comment changes >> >> Testing: >> - add new data inputs in tests for sorting >> - add min/max/infinity values to float/double testing >> - add tests for radix sort > > iaroslavski has updated the pull request incrementally with one additional commit since the last revision: > > JDK-8266431: Dual-Pivot Quicksort improvements (Radix sort) > > * Use uninitialized array for buffers Keeping alive ------------- PR Comment: https://git.openjdk.org/jdk/pull/3938#issuecomment-1583223092 From duke at openjdk.org Thu Jun 8 19:51:54 2023 From: duke at openjdk.org (ExE Boss) Date: Thu, 8 Jun 2023 19:51:54 GMT Subject: RFR: 8304425: ClassHierarchyResolver from Reflection [v9] In-Reply-To: <0RmULuYLatKjDyzBQB7Qxep-oSkpCKdh7zBDzuQiPvM=.2eed570e-cc6d-4103-b733-8cca3c4eaf33@github.com> References: <08Hy6pEhV75yr_F4mCP-dkKOKMCSoFxWI2E7OnM4iyQ=.cfa14992-8e94-4d6d-bdf9-e6689549c83e@github.com> <0RmULuYLatKjDyzBQB7Qxep-oSkpCKdh7zBDzuQiPvM=.2eed570e-cc6d-4103-b733-8cca3c4eaf33@github.com> Message-ID: On Wed, 7 Jun 2023 14:15:10 GMT, Chen Liang wrote: >> Add API to explore Class Hierarchy with a `ClassLoader` or a `Lookup` with proper privileges, with tests. >> >> This addition is useful in case classes at runtime are not loaded from the system class loader, such as Proxy. This is also useful to APIs that generate bytecode with a `Lookup` object, such as a custom single-abstract-method class implementations from a method handle. >> >> See https://mail.openjdk.org/pipermail/classfile-api-dev/2023-March/000249.html as well. >> >> Current questions, which I wish to discuss with @asotona: >> 1. Should the resolver fail fast on `IllegalAccessException` from the lookup? This usually indicates the hierarchy resolver is set up improperly, and proceeding may simply yield verification errors in class loading that are hard to track. For bytecode-generating APIs, throwing access errors for the Lookup eagerly is also more preferable than later silent generation failure. >> 2. Whether the default resolver should be reading from jrt alone, reflection alone, or jrt then reflection. I personally believe reflection alone is more reliable, for classes may redefined with instrumentation or jfr, which may not be reflected in the system resources. >> 3. In addition, I don't think chaining system class loader reflection after system resource retrieval is really meaningful: is there any case where reflection always works while the system resource retrieval always fails? > > Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 14 commits: > > - Review changes, fixed tests > - Merge branch 'master' into hierarchy-resolve > - 1. Moved the default resolver to a static method, in anticipation of future changes > 2. Removed SecurityManager related content > 3. Changed ClassHierarchyInfo into an interface > 4. Moved caching method from static to instance method > - Merge branch 'master' into hierarchy-resolve > - rename to ofClassLoading/ofResourceParsing > convert the default class provider to bypass security manager restrictions > - Merge branch 'master' into hierarchy-resolve > - Merge branch 'master' into hierarchy-resolve > - Test both cached and uncached resolvers > - Update the class hierarchy resolver api as per mailing list last week > - Merge branch 'master' into hierarchy-resolve > - ... and 4 more: https://git.openjdk.org/jdk/compare/a1ab377d...90645b6f src/java.base/share/classes/jdk/internal/classfile/impl/ClassHierarchyImpl.java line 123: > 121: > 122: public static final class CachedClassHierarchyResolver implements ClassHierarchyResolver { > 123: //this instance should leak out, appears only in cache in order to utilize Map.computeIfAbsent Missing??not?: Suggestion: // this instance should not leak out, appears only in cache in order to utilize Map.computeIfAbsent ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13082#discussion_r1223479164 From brian.goetz at oracle.com Thu Jun 8 19:57:54 2023 From: brian.goetz at oracle.com (Brian Goetz) Date: Thu, 8 Jun 2023 15:57:54 -0400 Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v9] In-Reply-To: References: Message-ID: <2cff101c-d1cb-e557-ff16-cf8240c6f799@oracle.com> I still don't understand this point.? Why are separate tests sharing a context at all? On 6/8/2023 9:26 AM, Adam Sotona wrote: > Unfortunately thread-unsafe context makes sharing of it in tests executed in parallel a nightmare. > I can fix our Corpus tests and hope the race condition won't raise also somewhere else later. > However how to explain this limitation to users? -------------- next part -------------- An HTML attachment was scrubbed... URL: From jvernee at openjdk.org Thu Jun 8 20:24:54 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 8 Jun 2023 20:24:54 GMT Subject: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 20:06:32 GMT, Jorn Vernee wrote: >> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix wrong link in layout well-formedness doc > > test/jdk/java/foreign/TestLayoutPaths.java line 125: > >> 123: } >> 124: >> 125: public void testByteOffsetHandleRange() { > > Missing `@Test`? FWIW, it looks like this needs `@Test(expectedExceptions = IllegalArgumentException.class)` since range elements are not allowed for `byteOffsetHandle` ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1223511154 From jiangli at openjdk.org Thu Jun 8 20:34:15 2023 From: jiangli at openjdk.org (Jiangli Zhou) Date: Thu, 8 Jun 2023 20:34:15 GMT Subject: RFR: 8307858: [REDO] JDK-8307194 Add make target for optionally building a complete set of all JDK and hotspot libjvm static libraries [v7] In-Reply-To: References: Message-ID: <4RwP9DFW7ZseAU9J5qUI_Azy6oqSxY8R3NYShKYS4uQ=.09d65652-2443-4067-ac21-cc0a1f917148@github.com> > Original description for JDK-8307194 change: > ----- > This PR is branched from the makefile changes for https://bugs.openjdk.org/browse/JDK-8303796 and contains the following for handling the JDK/hotspot static libraries: > > - Build hotspot libjvm.a and JDK static libraries for static-libs-image/static-libs-bundles targets; This change does not affect the graal-builder-image target > > - For libjvm.a specifically, exclude operator_new.o > > - Filter out "external" .o files (those are the .o files included from a different JDK library and needed when creating the .so shared library only) from JDK .a libraries; That's to avoid linker failures caused by duplicate symbols > - For libjli.a: Not include inflate.o inftrees.o inffast.o zadler32.o zcrc32.o zutil.o (compiled from zlib sources) if zlib is built as JDK bundled > - For libawt_xawt.a and libawt_head.a: Not include systemScale.o, since it's provided in libawt.a > > - Handle long arguments case for static build in make/common/NativeCompilation.gmk > > - Address @erikj79's comment in https://github.com/openjdk/jdk/pull/13709#discussion_r1180750185 for LIBJLI_STATIC_EXCLUDE_OBJS > ----- > > Updates to address build failures reported on macosx- platforms: > > - For gcc/clang, when building a static library first partially link (using the `-r` linking option) all object files into one object. The output object file from the partial linking is then passed to `ar` to create the static library. > > The original change for JDK-8307194 used @argument_file for all platforms when dealing with long arguments to `ar`, which caused failures on macosx- builds. On darwin (https://www.unix.com/man-page/osx/1/ar/), `ar` does not support @argument_file. The updated change avoids using @argument_file for `ar`. > > The partial linking change is done in make/common/NativeCompilation.gmk. The flag related change is done in make/autoconf/flags-ldflags.m4 mainly. Jiangli Zhou has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 19 commits: - Merge branch 'master' into JDK-8307858 - Need '$(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; )' for AR command if relative path is used. - Merge branch 'master' into JDK-8307858 - Address comments/suggestions from @erikj79: - Only do partial linking step for building static libraries with clang on linux. - On macosx, workaround the long argument issue for 'AR' with relative path. Tested building jdk-image and static-libs-image on linux-x64 (for both gcc and clang) and macosx-x64 (clang) manually. - Update make/common/NativeCompilation.gmk Thanks you! Co-authored-by: Erik Joelsson <37597443+erikj79 at users.noreply.github.com> - - Add $$($1_LD) $$($1_SYSROOT_LDFLAGS) to $1_VARDEPS if $(TOOLCHAIN_TYPE) is gcc or clang, as suggested by @erikj79. - Update make/common/NativeCompilation.gmk Co-authored-by: Erik Joelsson <37597443+erikj79 at users.noreply.github.com> - Merge branch 'master' into JDK-8307858 - Merge branch 'master' into JDK-8307858 - Clean up. - ... and 9 more: https://git.openjdk.org/jdk/compare/c4e65425...c664c601 ------------- Changes: https://git.openjdk.org/jdk/pull/14064/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14064&range=06 Stats: 224 lines in 10 files changed: 173 ins; 34 del; 17 mod Patch: https://git.openjdk.org/jdk/pull/14064.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14064/head:pull/14064 PR: https://git.openjdk.org/jdk/pull/14064 From jjg at openjdk.org Thu Jun 8 21:43:15 2023 From: jjg at openjdk.org (Jonathan Gibbons) Date: Thu, 8 Jun 2023 21:43:15 GMT Subject: RFR: JDK-8309686: inconsistent URL for https://www.unicode.org/reports/tr35 Message-ID: Please review a trivial docs change to fix a URL in a `@spec` tag consistent with equivalent URLs in other tags. (Consistency will be required when the External Specifications page is enabled.) ------------- Commit messages: - JDK-8309686: inconsistent URL for https://www.unicode.org/reports/tr35 Changes: https://git.openjdk.org/jdk/pull/14384/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14384&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309686 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14384.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14384/head:pull/14384 PR: https://git.openjdk.org/jdk/pull/14384 From naoto at openjdk.org Thu Jun 8 21:53:40 2023 From: naoto at openjdk.org (Naoto Sato) Date: Thu, 8 Jun 2023 21:53:40 GMT Subject: RFR: JDK-8309686: inconsistent URL for https://www.unicode.org/reports/tr35 In-Reply-To: References: Message-ID: <00xtVJu6Nrk8wvGr7TzK8xJCp0qc7-QG349WnCXixwI=.0f8b7962-7f68-45e6-91fc-efc18a40ec2d@github.com> On Thu, 8 Jun 2023 21:36:03 GMT, Jonathan Gibbons wrote: > Please review a trivial docs change to fix a URL in a `@spec` tag consistent with equivalent URLs in other tags. > (Consistency will be required when the External Specifications page is enabled.) My bad. Thanks for fixing the URL. ------------- Marked as reviewed by naoto (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14384#pullrequestreview-1470819371 From manc at openjdk.org Thu Jun 8 22:13:12 2023 From: manc at openjdk.org (Man Cao) Date: Thu, 8 Jun 2023 22:13:12 GMT Subject: RFR: 8309688: Data race on java.io.ClassCache$CacheRef.strongReferent Message-ID: Hi all, Could anyone review this small fix for a data race in java.io.ClassCache$CacheRef? This fix makes the code safer by making the code data-race-free. ------------- Commit messages: - 8309688: Data race on java.io.ClassCache.strongReferent Changes: https://git.openjdk.org/jdk/pull/14386/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14386&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309688 Stats: 11 lines in 1 file changed: 1 ins; 5 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/14386.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14386/head:pull/14386 PR: https://git.openjdk.org/jdk/pull/14386 From manc at openjdk.org Thu Jun 8 22:14:40 2023 From: manc at openjdk.org (Man Cao) Date: Thu, 8 Jun 2023 22:14:40 GMT Subject: RFR: 8309688: Data race on java.io.ClassCache$CacheRef.strongReferent In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 22:06:56 GMT, Man Cao wrote: > Hi all, > > Could anyone review this small fix for a data race in java.io.ClassCache$CacheRef? This fix makes the code safer by making the code data-race-free. The pre-submit failures for windows are due to https://bugs.openjdk.org/browse/CODETOOLS-7903482. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14386#issuecomment-1583457081 From jjg at openjdk.org Thu Jun 8 22:19:47 2023 From: jjg at openjdk.org (Jonathan Gibbons) Date: Thu, 8 Jun 2023 22:19:47 GMT Subject: Integrated: JDK-8309686: inconsistent URL for https://www.unicode.org/reports/tr35 In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 21:36:03 GMT, Jonathan Gibbons wrote: > Please review a trivial docs change to fix a URL in a `@spec` tag consistent with equivalent URLs in other tags. > (Consistency will be required when the External Specifications page is enabled.) This pull request has now been integrated. Changeset: 6f492e80 Author: Jonathan Gibbons URL: https://git.openjdk.org/jdk/commit/6f492e800597c9ce332b9d5b54c00f551f145a0d Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod 8309686: inconsistent URL for https://www.unicode.org/reports/tr35 Reviewed-by: naoto ------------- PR: https://git.openjdk.org/jdk/pull/14384 From manc at openjdk.org Fri Jun 9 01:05:56 2023 From: manc at openjdk.org (Man Cao) Date: Fri, 9 Jun 2023 01:05:56 GMT Subject: RFR: 8309688: Data race on java.io.ClassCache$CacheRef.strongReferent In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 22:06:56 GMT, Man Cao wrote: > Hi all, > > Could anyone review this small fix for a data race in java.io.ClassCache$CacheRef? This fix makes the code safer by making the code data-race-free. The presubmit failure on linux-x86 looks unrelated to this PR. It is https://bugs.openjdk.org/browse/JDK-8309592. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14386#issuecomment-1583718746 From dholmes at openjdk.org Fri Jun 9 01:39:54 2023 From: dholmes at openjdk.org (David Holmes) Date: Fri, 9 Jun 2023 01:39:54 GMT Subject: RFR: 8309545: Thread.interrupted from virtual thread needlessly resets interrupt status In-Reply-To: <4knBoamdYaN-bauCPfgm-gfat2fZOTtq1KOQxnFAzE4=.39f02244-7b97-4404-9a40-405a2f506251@github.com> References: <4knBoamdYaN-bauCPfgm-gfat2fZOTtq1KOQxnFAzE4=.39f02244-7b97-4404-9a40-405a2f506251@github.com> Message-ID: On Wed, 7 Jun 2023 15:12:40 GMT, Alan Bateman wrote: > Thread.interrupted is used to "get and clear" the current thread's interrupt status. When called from a virtual thread, the current implementation always clears the carrier's interrupt status. There is no need to do this when the interrupt status is not set, it can just read the interrupt status and return false in that case. > > This was found by Sergey Kuksenko when comparing platform vs. virtual thread performance. Once CODETOOLS-7903476 is in a released version of JMH then we can start to accumulate benchmarks that execute in virtual threads. > > Testing: tier1-5 Changes look fine. Thanks. ------------- Marked as reviewed by dholmes (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14361#pullrequestreview-1471042631 From jpai at openjdk.org Fri Jun 9 04:58:53 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Fri, 9 Jun 2023 04:58:53 GMT Subject: RFR: 8309545: Thread.interrupted from virtual thread needlessly resets interrupt status In-Reply-To: <4knBoamdYaN-bauCPfgm-gfat2fZOTtq1KOQxnFAzE4=.39f02244-7b97-4404-9a40-405a2f506251@github.com> References: <4knBoamdYaN-bauCPfgm-gfat2fZOTtq1KOQxnFAzE4=.39f02244-7b97-4404-9a40-405a2f506251@github.com> Message-ID: On Wed, 7 Jun 2023 15:12:40 GMT, Alan Bateman wrote: > Thread.interrupted is used to "get and clear" the current thread's interrupt status. When called from a virtual thread, the current implementation always clears the carrier's interrupt status. There is no need to do this when the interrupt status is not set, it can just read the interrupt status and return false in that case. > > This was found by Sergey Kuksenko when comparing platform vs. virtual thread performance. Once CODETOOLS-7903476 is in a released version of JMH then we can start to accumulate benchmarks that execute in virtual threads. > > Testing: tier1-5 Marked as reviewed by jpai (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14361#pullrequestreview-1471228293 From asotona at openjdk.org Fri Jun 9 06:19:42 2023 From: asotona at openjdk.org (Adam Sotona) Date: Fri, 9 Jun 2023 06:19:42 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v10] In-Reply-To: References: <8LzoOpItGA_LBdMX5sJxyPJNV2ZCavz2mIs8t1qrWhw=.908dd1f2-6250-4a43-844e-3dcd100be19e@github.com> Message-ID: On Thu, 8 Jun 2023 16:35:28 GMT, Brian Goetz wrote: > I have a hard time imagining heavy parallel use here; concurrency against the same cache would most likely come from accidental sharing.? So this is not necessarily a problem.? Are you imagining differnet use cases? I think it is common practice for example in web services to pre-configure as much of the common parts as possible (and Classfile context logically falls into that category) and then register the service to the server, which use group of thread workers to handle individual requests. With (non-reusable) virtual threads and structured concurrency on the table makes internal use of thread locals even less sense. I can imagine a new virtual thread launched (and finished) for each individual transformation. Our `CorpusTest` relying on Junit parallelization is not so far from that scenario (I'm not sure if Junit already uses virtual threads or just a group of workers). It is technically irrelevant if user will share the context directly or through a `ClassModel` (for example an instrumentor class used to transform all incoming code - this BTW an idea of faster `j.l.r.ProxyGenerator` I'm thinking about). I think we should be sure that `Classfile` context (and also expansion of `ClassModel`) does not fail in parallel environments. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14180#issuecomment-1584034695 From alanb at openjdk.org Fri Jun 9 06:20:41 2023 From: alanb at openjdk.org (Alan Bateman) Date: Fri, 9 Jun 2023 06:20:41 GMT Subject: RFR: 8309665: Simplify Arrays.copyOf/-Range methods In-Reply-To: References: Message-ID: <8VFTGt5LmczcxNXDsT3a0XGQrVVNmUBKIEH48vHR5rU=.b85de065-5ff0-4ee5-890a-5e857398ffc5@github.com> On Thu, 8 Jun 2023 15:08:28 GMT, Claes Redestad wrote: > https://bugs.openjdk.org/browse/JDK-8301958 and later changes improved Arrays.copyOf/-Range methods to improve peak performance in microbenchmarks when copying the entire array, but it's resulted in a few lurking footprint benchmark issues that come down to incurring slightly more JIT activity. As a partial remedy I propose simplifying the implementation so that no new methods are added compared to the JDK 20 baseline. This patch maintains the microbenchmark speed-up from JDK-8301958 while reducing JIT compilations in startup/footprint benchmarks. Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14380#pullrequestreview-1471296218 From asotona at openjdk.org Fri Jun 9 06:38:47 2023 From: asotona at openjdk.org (Adam Sotona) Date: Fri, 9 Jun 2023 06:38:47 GMT Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v11] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 16:37:22 GMT, Adam Sotona wrote: >> Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html >> This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests. >> >> Please review. >> >> Thanks, >> Adam > > Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: > > - proposed semi-synchronized caching, where the map is not locked during delegate call > - used Factory.INSTANCE for system ClassHierarchyResolver cache I'll run our standard benchmarks to compare following scenarios: - static synchronized single instance cache (current master) - context-based non-synchronized caches `HM::computeIfAbsent` - context-based fully synchronized caches `CHM::computeIfAbsent` - context-based thread-safe lazy synchronized caches `CHM::get ... compute ... CHM::put` And let's see the performance impact. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14180#issuecomment-1584050539 From adam.sotona at oracle.com Fri Jun 9 06:54:54 2023 From: adam.sotona at oracle.com (Adam Sotona) Date: Fri, 9 Jun 2023 06:54:54 +0000 Subject: RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v9] In-Reply-To: <2cff101c-d1cb-e557-ff16-cf8240c6f799@oracle.com> References: <2cff101c-d1cb-e557-ff16-cf8240c6f799@oracle.com> Message-ID: The tests use statically specified Transforms and each transformation also held set of options. Now the transformations hold static instance of Classfile context instead. Junit execute them in parallel for each individual class file being transformed, so one context is used in parallel environment. If we fall back to store List