From plevart at openjdk.org Sun Jan 1 10:31:48 2023 From: plevart at openjdk.org (Peter Levart) Date: Sun, 1 Jan 2023 10:31:48 GMT Subject: RFR: JDK-8299336 - InputStream::DEFAULT_BUFFER_SIZE should be 16384 In-Reply-To: References: Message-ID: On Fri, 23 Dec 2022 22:28:34 GMT, Markus KARG wrote: > I/O had always been much slower than CPU and memory access, and thanks to physical constraints, always will be. > While CPUs can get shrinked more and more, and can hold more and more memory cache on or nearby a CPU core, the distance between CPU core and I/O device cannot get reduced much: It will stay "far" away. > Due to this simple logic (and other factors), the spread between performance of CPU and memory access on one hand, and performance of I/O on the other hand, increases with every new CPU generation. > As a consequence, internal adjustment factors of the JDK need to get revised from time to time to ensure optimum performance and each hardware generation. > > One such factor is the size of the temporary transfer buffer used internally by `InputStream::transferTo`. > Since its introduction with JDK 9 many years (hence hardware generations) have passed, so it's time to check the appropriateness of that buffer's size. > > Using JMH on a typical, modern cloud platform, it was proven that the current 8K buffer is (much) too small on modern hardware: > The small buffer clearly stands in the way of faster transfers. > The ops/s of a simple `FileInputStream.transferTo(ByteArrayOutputStream)` operation on JDK 21 could be doubled (!) by only doubling the buffer size from 8K to 16K, which seems to be a considerable and cheap deal. > Doubling the buffer even more shows only marginal improvements of approx. 1% to 3% per duplication of size, which does not justify additional memory consumption. > > > TransferToPerformance.transferTo 8192 1048576 thrpt 25 1349.929 ? 47.057 ops/s > TransferToPerformance.transferTo 16384 1048576 thrpt 25 2633.560 ? 93.337 ops/s > TransferToPerformance.transferTo 32768 1048576 thrpt 25 2721.025 ? 89.555 ops/s > TransferToPerformance.transferTo 65536 1048576 thrpt 25 2855.949 ? 96.623 ops/s > TransferToPerformance.transferTo 131072 1048576 thrpt 25 2903.062 ? 40.798 ops/s > > > Even on small or limited platforms, an investment of 8K additonal temporary buffer is very cheap and very useful, as it doubles the performance of `InputStream::transferTo`, in particular for legacy (non-NIO) applications still using `FileInputStream` and `ByteArrayOutputStream`. > I dare to say, even if not proven, that is a very considerable (possibly the major) number of existing applications, as NIO was only adopted gradually by programmers. > > Due to the given reasons, it should be approporiate to change `DEFAULT_BUFFER_SIZE` from 8192 to 16384. Hello Markus, Happy 2023! I checked out your JMH code and I'm a little uncomfortable with two things: - at least on Linux, the benchmark does not actually involve any input from the device (HD, SSD) at all. - at least on Linux, the benchmark involves output to the device (HD, SSD) in a way that might interfere with the banchmark. Let me explain. In the per-invocation @Setup method you create new file with random bytes and close it. At least on Linux this actually just writes the content to the write-back buffer cache. The disk is not touched yet. Writing happens asynchronously in the background while the benchmark is running. The benchmark reads from that file but this does not involve reading from the device at all, since the whole content is already present in buffer cache. So what this benchmark does is it measures overhead of JNI invocations from Java to native code and the overhead of system calls from native code to kernel which are served from buffer cache. All this happens while asynchronous writes to disk are taking place which might interfere with benchmark as they compete with benchmark for system resources. While running your unchanged benchmark, I checked the output of `iostat 2` which proves above claims: Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd nvme0n1 22.50 0.00 438.75 0.00 0 877 0 So I modified your benchmark a bit: - I copied the InputStream.transferTo method to the benchmark itself so that buffer size can be passed as argument. I think this should not present any noticable difference since we are not measuring the quality of JIT-ed code but overheads of JNI and system calls which are of entirely different magnitude. - I moved the creation of a temporary file from per-invocation to per-trial @Setup method and added a "sync" command at the end which flushes the data to the actual device and waits for flushing to complete. - I added a "drop_caches" command just before opening the file for reading in the per-invocation @Setup method. This drops cached data of the file so that reads in the benchmark method are made from the actual device. Since the use of buffer cache is an important use case I added a boolean `dropCaches` parameter to measure both cases. Both commands work on Linux and I don't have equivalent commands for Windows. `sync` works on Mac OS too, but `drop_caches` is Linux specific. Mac OS has a `purge` command for droping caches which must be executed as root. Here are the results with dropCaches=true on a Linux PC with SSD: https://jmh.morethan.io/?gist=abcba62638a1fa652fd597fa141a1a10 Here are the results with dropCaches=false: https://jmh.morethan.io/?gist=ac8af4d8232b6f3a758491381d2fae31 And here's the modified benchmark: public class TransferToPerformance { @State(Scope.Benchmark) public static class Config { @Param({"8388608"}) // 8 MiB public int streamSize; @Param({"1024", "2048", "4096", "8192", "16384", "32768", "65536", "131072"}) public int bufferSize; @Param({"false", "true"}) // just before opening file for reading public boolean dropCaches; public InputStream source; public OutputStream target; private Path path; @Setup(Level.Trial) public void setUpTrial() throws IOException, InterruptedException { path = Files.createTempFile("a-", ".bin"); var bytes = createRandomBytes(streamSize); Files.deleteIfExists(this.path); Files.write(this.path, bytes, CREATE, TRUNCATE_EXISTING, WRITE); sync(); } @TearDown(Level.Trial) public void tearDownTrial() throws IOException { Files.deleteIfExists(this.path); } @Setup(Level.Invocation) public void setUpInvocation() throws IOException, InterruptedException { if (dropCaches) { dropCaches(); } source = new FileInputStream(this.path.toFile()); target = new ByteArrayOutputStream(); } @TearDown(Level.Invocation) public void tearDownInvocation() throws IOException { source.close(); target.close(); source = null; target = null; } } private static byte[] createRandomBytes(int size) { var bytes = new byte[size]; ThreadLocalRandom.current().nextBytes(bytes); return bytes; } @Benchmark @Fork(warmups = 0, value = 1) @BenchmarkMode(Mode.AverageTime) @Warmup(iterations = 3, time = 2) @Measurement(iterations = 5, time = 4) @OutputTimeUnit(TimeUnit.MICROSECONDS) public final void transferTo(Config config, Blackhole blackhole) throws IOException { blackhole.consume(transferTo(config.bufferSize, config.source, config.target)); } private static long transferTo(int bufferSize, InputStream in, OutputStream out) throws IOException { long transferred = 0; byte[] buffer = new byte[bufferSize]; int read; while ((read = in.read(buffer, 0, bufferSize)) >= 0) { out.write(buffer, 0, read); transferred += read; } return transferred; } private static void sync() throws IOException, InterruptedException { var proc = new ProcessBuilder("sync").start(); proc.waitFor(); } private static void dropCaches() throws IOException, InterruptedException { var proc = new ProcessBuilder( "sudo", "bash", "-c", "echo 1 > /proc/sys/vm/drop_caches" ).start(); proc.waitFor(); } } When reading involves actual device, at least on my computer, the increase of buffer size from 8k to 16k does not give any benefit. When reading involves cached data only, the benefit is marginal. I wonder what results would you get with this modified benchmark... ------------- PR: https://git.openjdk.org/jdk/pull/11783 From jpai at openjdk.org Mon Jan 2 10:03:29 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Mon, 2 Jan 2023 10:03:29 GMT Subject: RFR: 8299441: Fix typos in some test files under core-libs component Message-ID: Can I please get a review of this change which fixes the final few typos in test files in the core-libs area? This addresses the remaining core-libs related typos from the original PR https://github.com/openjdk/jdk/pull/10029. ------------- Commit messages: - 8299441: Fix typos in some test files under core-libs component Changes: https://git.openjdk.org/jdk/pull/11810/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11810&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299441 Stats: 5 lines in 4 files changed: 0 ins; 0 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/11810.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11810/head:pull/11810 PR: https://git.openjdk.org/jdk/pull/11810 From plevart at openjdk.org Mon Jan 2 10:05:48 2023 From: plevart at openjdk.org (Peter Levart) Date: Mon, 2 Jan 2023 10:05:48 GMT Subject: RFR: JDK-8299336 - InputStream::DEFAULT_BUFFER_SIZE should be 16384 In-Reply-To: References: Message-ID: <1WvnmdM85JB2nM0tWFeVGls1sAzdkKOdhp6L5TSBj84=.64c7b756-5f30-4849-a9a8-af9d135c9b6b@github.com> On Fri, 23 Dec 2022 22:28:34 GMT, Markus KARG wrote: > I/O had always been much slower than CPU and memory access, and thanks to physical constraints, always will be. > While CPUs can get shrinked more and more, and can hold more and more memory cache on or nearby a CPU core, the distance between CPU core and I/O device cannot get reduced much: It will stay "far" away. > Due to this simple logic (and other factors), the spread between performance of CPU and memory access on one hand, and performance of I/O on the other hand, increases with every new CPU generation. > As a consequence, internal adjustment factors of the JDK need to get revised from time to time to ensure optimum performance and each hardware generation. > > One such factor is the size of the temporary transfer buffer used internally by `InputStream::transferTo`. > Since its introduction with JDK 9 many years (hence hardware generations) have passed, so it's time to check the appropriateness of that buffer's size. > > Using JMH on a typical, modern cloud platform, it was proven that the current 8K buffer is (much) too small on modern hardware: > The small buffer clearly stands in the way of faster transfers. > The ops/s of a simple `FileInputStream.transferTo(ByteArrayOutputStream)` operation on JDK 21 could be doubled (!) by only doubling the buffer size from 8K to 16K, which seems to be a considerable and cheap deal. > Doubling the buffer even more shows only marginal improvements of approx. 1% to 3% per duplication of size, which does not justify additional memory consumption. > > > TransferToPerformance.transferTo 8192 1048576 thrpt 25 1349.929 ? 47.057 ops/s > TransferToPerformance.transferTo 16384 1048576 thrpt 25 2633.560 ? 93.337 ops/s > TransferToPerformance.transferTo 32768 1048576 thrpt 25 2721.025 ? 89.555 ops/s > TransferToPerformance.transferTo 65536 1048576 thrpt 25 2855.949 ? 96.623 ops/s > TransferToPerformance.transferTo 131072 1048576 thrpt 25 2903.062 ? 40.798 ops/s > > > Even on small or limited platforms, an investment of 8K additonal temporary buffer is very cheap and very useful, as it doubles the performance of `InputStream::transferTo`, in particular for legacy (non-NIO) applications still using `FileInputStream` and `ByteArrayOutputStream`. > I dare to say, even if not proven, that is a very considerable (possibly the major) number of existing applications, as NIO was only adopted gradually by programmers. > > Due to the given reasons, it should be approporiate to change `DEFAULT_BUFFER_SIZE` from 8192 to 16384. Here's also results for "modern" architecture - I executed the benchmark in a k8s container on an Oracle cloud ARM64 virtual machine. With dropCaches=true: https://jmh.morethan.io/?gist=2db4c3b51073e90c1a84d7eed8e1a988 With dropCaches=false: https://jmh.morethan.io/?gist=d7dfb5def5899af41722b2768a827006 Here, the benefit of increasing buffer from 8k to 16k gets from about 10% (doing IO) up to 20% (reading from cache) increase in performance. ------------- PR: https://git.openjdk.org/jdk/pull/11783 From lancea at openjdk.org Mon Jan 2 11:45:48 2023 From: lancea at openjdk.org (Lance Andersen) Date: Mon, 2 Jan 2023 11:45:48 GMT Subject: RFR: 8299441: Fix typos in some test files under core-libs component In-Reply-To: References: Message-ID: <90_F_xJDx2A8xOkcVIZtA-3BtKWjXfa68CgNkEX2gWQ=.b4140b9f-3143-4b24-b935-7b8092959e5a@github.com> On Mon, 2 Jan 2023 09:52:59 GMT, Jaikiran Pai wrote: > Can I please get a review of this change which fixes the final few typos in test files in the core-libs area? This addresses the remaining core-libs related typos from the original PR https://github.com/openjdk/jdk/pull/10029. Marked as reviewed by lancea (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11810 From jvernee at openjdk.org Mon Jan 2 12:10:55 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Mon, 2 Jan 2023 12:10:55 GMT Subject: Integrated: 8298590: Refactor LambdaForm constructors In-Reply-To: References: Message-ID: On Fri, 9 Dec 2022 18:02:53 GMT, Jorn Vernee wrote: > Refactor LambdaForm constructors into static factories. > > In the new code, there's only 1 constructor, which simply initializes all fields. Multiple factory methods are built on top of this, which add various argument validation/pre-processing and post processing of the constructed lambda forms. > > In the LambdaFrom class itself, it is easier to see which LF creation goes through which checks due to names of factory, or if all checks are bypassed by calling the constructor. > > New factories can easily be added that bypass all the checks in the existing factories and just call the root constructor if they so wish to (we likely want to add several for lazy lambda form resolution https://bugs.openjdk.org/browse/JDK-8288041). > > Additionally: replaced some default values literals with named constants so it's easy to see that it's just the default value for that arg at the call site. This pull request has now been integrated. Changeset: 0532045e Author: Jorn Vernee URL: https://git.openjdk.org/jdk/commit/0532045edb709a995a42c07d95cb1cbabe886bed Stats: 97 lines in 8 files changed: 32 ins; 13 del; 52 mod 8298590: Refactor LambdaForm constructors Reviewed-by: redestad ------------- PR: https://git.openjdk.org/jdk/pull/11612 From duke at openjdk.org Mon Jan 2 21:09:46 2023 From: duke at openjdk.org (Markus KARG) Date: Mon, 2 Jan 2023 21:09:46 GMT Subject: RFR: JDK-8299336 - InputStream::DEFAULT_BUFFER_SIZE should be 16384 In-Reply-To: <1WvnmdM85JB2nM0tWFeVGls1sAzdkKOdhp6L5TSBj84=.64c7b756-5f30-4849-a9a8-af9d135c9b6b@github.com> References: <1WvnmdM85JB2nM0tWFeVGls1sAzdkKOdhp6L5TSBj84=.64c7b756-5f30-4849-a9a8-af9d135c9b6b@github.com> Message-ID: On Mon, 2 Jan 2023 10:03:02 GMT, Peter Levart wrote: > Here, the benefit of increasing buffer from 8k to 16k gets from about 10% (doing IO) up to 20% (reading from cache) increase in performance. I think 10% to 20% is good enough as an argument to go with 16k instead of 8k. ------------- PR: https://git.openjdk.org/jdk/pull/11783 From duke at openjdk.org Mon Jan 2 22:51:14 2023 From: duke at openjdk.org (Oliver Kopp) Date: Mon, 2 Jan 2023 22:51:14 GMT Subject: RFR: 8240567: MethodTooLargeException thrown while creating a jlink image [v9] In-Reply-To: References: Message-ID: > Fix for [JDK-8240567](https://bugs.openjdk.org/browse/JDK-8240567): "MethodTooLargeException thrown while creating a jlink image". > > Java still has a 64kb limit: A method may not be longer than 64kb. The idea of the fix is to split up the generated methods in several smaller methods Oliver Kopp 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: - More recursion Co-authored-by: Christoph - Merge remote-tracking branch 'origin/master' into fix-8240567 - Refine tests Co-authored-by: Christoph Co-authored-by: Carl Christian Snethlage <50491877+calixtus at users.noreply.github.com> - Revert to original SystemModulesPlugin Co-authored-by: Christoph Co-authored-by: Carl Christian Snethlage <50491877+calixtus at users.noreply.github.com> - Merge remote-tracking branch 'origin/master' into fix-8240567 - Refine test Co-authored-by: Christoph - Adapt number to have javac working (and refine test) - Remove obsolete comment - Begin to craft test - Reduce comment text - ... and 3 more: https://git.openjdk.org/jdk/compare/4c9038c4...ede0e87f ------------- Changes: - all: https://git.openjdk.org/jdk/pull/10704/files - new: https://git.openjdk.org/jdk/pull/10704/files/96362d54..ede0e87f Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=10704&range=08 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10704&range=07-08 Stats: 5946 lines in 539 files changed: 3276 ins; 1260 del; 1410 mod Patch: https://git.openjdk.org/jdk/pull/10704.diff Fetch: git fetch https://git.openjdk.org/jdk pull/10704/head:pull/10704 PR: https://git.openjdk.org/jdk/pull/10704 From jpai at openjdk.org Tue Jan 3 02:01:52 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Tue, 3 Jan 2023 02:01:52 GMT Subject: RFR: 8299441: Fix typos in some test files under core-libs component In-Reply-To: References: Message-ID: <8TPl4uQllbD7mYMnv_p1hONsNthH4iMKLDEMrAH5888=.e32a0c02-6e4e-4e67-8b4b-97ba2ef3e6a0@github.com> On Mon, 2 Jan 2023 09:52:59 GMT, Jaikiran Pai wrote: > Can I please get a review of this change which fixes the final few typos in test files in the core-libs area? This addresses the remaining core-libs related typos from the original PR https://github.com/openjdk/jdk/pull/10029. Thank you Lance for the review. ------------- PR: https://git.openjdk.org/jdk/pull/11810 From jpai at openjdk.org Tue Jan 3 02:01:53 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Tue, 3 Jan 2023 02:01:53 GMT Subject: Integrated: 8299441: Fix typos in some test files under core-libs component In-Reply-To: References: Message-ID: On Mon, 2 Jan 2023 09:52:59 GMT, Jaikiran Pai wrote: > Can I please get a review of this change which fixes the final few typos in test files in the core-libs area? This addresses the remaining core-libs related typos from the original PR https://github.com/openjdk/jdk/pull/10029. This pull request has now been integrated. Changeset: 417d01ea Author: Jaikiran Pai URL: https://git.openjdk.org/jdk/commit/417d01ea63261afb4fb29b4d11de799f2c0846d7 Stats: 5 lines in 4 files changed: 0 ins; 0 del; 5 mod 8299441: Fix typos in some test files under core-libs component Co-authored-by: Michael Ernst Reviewed-by: lancea ------------- PR: https://git.openjdk.org/jdk/pull/11810 From djelinski at openjdk.org Tue Jan 3 14:05:33 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Tue, 3 Jan 2023 14:05:33 GMT Subject: RFR: 8189338: JMX RMI Remote Mbean server connection hangs if the server stops responding during a SSL Handshake Message-ID: This patch introduces a time limit for establishing a secure connection to a RMI server. The existing implementation uses the configured `sun.rmi.transport.tcp.handshakeTimeout` during RMI handshake only; there's no time limit for SSL handshake. With this patch, the configuration option `sun.rmi.transport.tcp.handshakeTimeout` is also used as a socket read timeout during the SSL handshake. I modified the existing `HandshakeTimeout` test to verify both non-SSL and SSL connections; the test passes with my changes, fails without them. Existing tier1-3 tests continue to pass. While working on the patch I noticed that `conn.isReusable()` always returns true. I can remove all references to `isReusable` here or in another PR; it would simplify the code a bit. ------------- Commit messages: - Copyright - RMI SSL timeout Changes: https://git.openjdk.org/jdk/pull/11829/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11829&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8189338 Stats: 41 lines in 2 files changed: 23 ins; 13 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/11829.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11829/head:pull/11829 PR: https://git.openjdk.org/jdk/pull/11829 From alanb at openjdk.org Tue Jan 3 16:18:49 2023 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 3 Jan 2023 16:18:49 GMT Subject: RFR: JDK-8299336 - InputStream::DEFAULT_BUFFER_SIZE should be 16384 In-Reply-To: References: Message-ID: On Fri, 23 Dec 2022 22:28:34 GMT, Markus KARG wrote: > I/O had always been much slower than CPU and memory access, and thanks to physical constraints, always will be. > While CPUs can get shrinked more and more, and can hold more and more memory cache on or nearby a CPU core, the distance between CPU core and I/O device cannot get reduced much: It will stay "far" away. > Due to this simple logic (and other factors), the spread between performance of CPU and memory access on one hand, and performance of I/O on the other hand, increases with every new CPU generation. > As a consequence, internal adjustment factors of the JDK need to get revised from time to time to ensure optimum performance and each hardware generation. > > One such factor is the size of the temporary transfer buffer used internally by `InputStream::transferTo`. > Since its introduction with JDK 9 many years (hence hardware generations) have passed, so it's time to check the appropriateness of that buffer's size. > > Using JMH on a typical, modern cloud platform, it was proven that the current 8K buffer is (much) too small on modern hardware: > The small buffer clearly stands in the way of faster transfers. > The ops/s of a simple `FileInputStream.transferTo(ByteArrayOutputStream)` operation on JDK 21 could be doubled (!) by only doubling the buffer size from 8K to 16K, which seems to be a considerable and cheap deal. > Doubling the buffer even more shows only marginal improvements of approx. 1% to 3% per duplication of size, which does not justify additional memory consumption. > > > TransferToPerformance.transferTo 8192 1048576 thrpt 25 1349.929 ? 47.057 ops/s > TransferToPerformance.transferTo 16384 1048576 thrpt 25 2633.560 ? 93.337 ops/s > TransferToPerformance.transferTo 32768 1048576 thrpt 25 2721.025 ? 89.555 ops/s > TransferToPerformance.transferTo 65536 1048576 thrpt 25 2855.949 ? 96.623 ops/s > TransferToPerformance.transferTo 131072 1048576 thrpt 25 2903.062 ? 40.798 ops/s > > > Even on small or limited platforms, an investment of 8K additonal temporary buffer is very cheap and very useful, as it doubles the performance of `InputStream::transferTo`, in particular for legacy (non-NIO) applications still using `FileInputStream` and `ByteArrayOutputStream`. > I dare to say, even if not proven, that is a very considerable (possibly the major) number of existing applications, as NIO was only adopted gradually by programmers. > > Due to the given reasons, it should be approporiate to change `DEFAULT_BUFFER_SIZE` from 8192 to 16384. The source input stream and target output stream can be connected to anything and reading/writing may involve compressed or encrypted streams. 8k has always been a default that is expected to be a good compromise for a wide range of sources and targets. It's good to have data for the file -> BAOS case for both cold and cached cases. No objection to bumping it to 16k as it's a temporary buffer so can be GC'ed when there isn't a thread blocked in transferTo (or readNBytes). ------------- PR: https://git.openjdk.org/jdk/pull/11783 From alanb at openjdk.org Tue Jan 3 16:20:51 2023 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 3 Jan 2023 16:20:51 GMT Subject: RFR: 8240567: MethodTooLargeException thrown while creating a jlink image [v6] In-Reply-To: References: Message-ID: On Thu, 8 Dec 2022 07:41:22 GMT, Oliver Kopp wrote: >> Would it be possible to paste in a summary on the VerifyError with the previous iteration? If I read the latest update then the limit per helper method has been bump to avoid it, is that right? > >> Would it be possible to paste in a summary on the VerifyError with the previous iteration? > > Isn't this https://github.com/openjdk/jdk/pull/10704#issuecomment-1286106503? > > Type top (current frame, locals[15]) is not assignable to reference type > >> If I read the latest update then the limit per helper method has been bump to avoid it, is that right? > > Yes. Then, the compiler still works - and we can try to debug using the test case (yet to be finalized). @koppor Should we continue to just ignore this PR for now? The current patch is test only, I don't know if that is deliberate or not. ------------- PR: https://git.openjdk.org/jdk/pull/10704 From duke at openjdk.org Tue Jan 3 16:30:48 2023 From: duke at openjdk.org (Christoph) Date: Tue, 3 Jan 2023 16:30:48 GMT Subject: RFR: 8240567: MethodTooLargeException thrown while creating a jlink image [v6] In-Reply-To: References: Message-ID: On Thu, 8 Dec 2022 07:41:22 GMT, Oliver Kopp wrote: >> Would it be possible to paste in a summary on the VerifyError with the previous iteration? If I read the latest update then the limit per helper method has been bump to avoid it, is that right? > >> Would it be possible to paste in a summary on the VerifyError with the previous iteration? > > Isn't this https://github.com/openjdk/jdk/pull/10704#issuecomment-1286106503? > > Type top (current frame, locals[15]) is not assignable to reference type > >> If I read the latest update then the limit per helper method has been bump to avoid it, is that right? > > Yes. Then, the compiler still works - and we can try to debug using the test case (yet to be finalized). Yes, we are currently trying to set up the test, so it results in the original method too large error. Then we will re add the module splitting. (Working on this together with @koppor ) ------------- PR: https://git.openjdk.org/jdk/pull/10704 From duke at openjdk.org Tue Jan 3 17:48:35 2023 From: duke at openjdk.org (Justin Lu) Date: Tue, 3 Jan 2023 17:48:35 GMT Subject: RFR: 8299439: java/text/Format/NumberFormat/CurrencyFormat.java fails for hr_HR Message-ID: Regression caused by the fix to [JDK-8296239](https://bugs.openjdk.org/browse/JDK-8296239). The ISO 4217 Amendment 174 Update changes went into effect starting in 2023. _java/text/Format/NumberFormat/CurrencyFormat.java_ fails as _java/text/Format/NumberFormat/CurrencySymbols.properties_ did not have the proper change from the Amendment 174 update as well. Swapping the outdated to **Kn** to **EUR** matches the Amendment 174 update, and fixes the failing test. ------------- Commit messages: - Switch symbol to EUR for hr_HR Changes: https://git.openjdk.org/jdk/pull/11833/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11833&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299439 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/11833.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11833/head:pull/11833 PR: https://git.openjdk.org/jdk/pull/11833 From zjx001202 at gmail.com Tue Jan 3 17:50:11 2023 From: zjx001202 at gmail.com (Glavo) Date: Wed, 4 Jan 2023 01:50:11 +0800 Subject: The javadocs of some methods in NIO Buffer are missing @since In-Reply-To: <46d254cd-4f0d-f81c-8e2b-20579e4379ac@oracle.com> References: <7aa9059c-7e0e-6c61-a87c-b9a537f2a8df@oracle.com> <46d254cd-4f0d-f81c-8e2b-20579e4379ac@oracle.com> Message-ID: You are talking about an idealistic situation that is divorced from reality. When using the -target option, I need to set the bootclasspath at the same time -- at least in theory. But in the real world, I have never seen this option set in the build script of any project. If I open an issue in a project for this problem, the most likely thing is that the project maintainer will ask me what is the significance of doing this. All the project maintainers I met are happy to let the project compile on more JDKs. Even if this may cause some problems at some time, they always regard the incompatibility of some JDK versions as a problem, rather than requiring that compatible JDK must be used for building. So far, there are no exceptions. The same is true for the --add-exports option. Of course, I know that the internal classes may be modified at any time, but is it meaningful to require that a certain version of JDK must be used for construction? This is not only meaningless, but also covers up problems that should have been found during compilation. As for multi-release jar...Don't you know its problems in the real world? Build tools, IDEs, static analysis tools... We solved a problem with multi-release jars, and then we had a lot of problems with multi-release jars. Let's stop discussing the conflict between the ideal situation and the workarounds in the real world, OK? Let's go back to the issue -- Java 9 has added some new API methods. The javadoc of these methods does not have @ since tags. Is this an oversight? On Sat, Dec 31, 2022 at 4:38 PM Alan Bateman wrote: > On 30/12/2022 19:11, Glavo wrote: > > I agree that it is a good choice to use -release or set bootclasspath. > > However, this is not always realistic. > > > > Using -release means that we will encounter many JPMS problems. > > For example, using --add-exports for system modules is not allowed > > when using -release. > > This combination of options doesn't make sense. If you are going off > piste and compiling against JDK internal classes then you'll need to > have that JDK present on your file system. A release number maps to the > language and APIs in that release, it can't be expected to know about > JDK internal classes that happen to be a JDK build as they can vary and > shimmer by vendor or update. Maybe if you could expand a bit on what you > are doing so it can help you avoid the configuration issue in your build. > > > > > > In addition, sometimes we may want to deliberately bypass the > > restriction of -release: > > We may use some new APIs of higher Java versions in our code. > > As long as we check the Java version at runtime and ensure that the > > code path is not executed > > when running on a lower version of Java, this is also reasonable. > > > This reads like you want to compile to --release 8 but have static > references in version 52 class files to APIs that were added in Java 9+, > is that right? This may be a setup for a world of hurt and maybe you > should explore Multi-Release JAR files for this. > > -Alan > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alanb at openjdk.org Tue Jan 3 17:53:54 2023 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 3 Jan 2023 17:53:54 GMT Subject: RFR: 8299439: java/text/Format/NumberFormat/CurrencyFormat.java fails for hr_HR In-Reply-To: References: Message-ID: On Tue, 3 Jan 2023 17:40:42 GMT, Justin Lu wrote: > Regression caused by the fix to [JDK-8296239](https://bugs.openjdk.org/browse/JDK-8296239). The ISO 4217 Amendment 174 Update changes went into effect starting in 2023. > > _java/text/Format/NumberFormat/CurrencyFormat.java_ fails as _java/text/Format/NumberFormat/CurrencySymbols.properties_ did not have the proper change from the Amendment 174 update as well. > > Swapping the outdated to **Kn** to **EUR** matches the Amendment 174 update, and fixes the failing test. You will need to remove the test from test/jdk/ProblemList.txt to get it to run again. ------------- PR: https://git.openjdk.org/jdk/pull/11833 From naoto at openjdk.org Tue Jan 3 17:56:53 2023 From: naoto at openjdk.org (Naoto Sato) Date: Tue, 3 Jan 2023 17:56:53 GMT Subject: RFR: 8299439: java/text/Format/NumberFormat/CurrencyFormat.java fails for hr_HR In-Reply-To: References: Message-ID: On Tue, 3 Jan 2023 17:40:42 GMT, Justin Lu wrote: > Regression caused by the fix to [JDK-8296239](https://bugs.openjdk.org/browse/JDK-8296239). The ISO 4217 Amendment 174 Update changes went into effect starting in 2023. > > _java/text/Format/NumberFormat/CurrencyFormat.java_ fails as _java/text/Format/NumberFormat/CurrencySymbols.properties_ did not have the proper change from the Amendment 174 update as well. > > Swapping the outdated to **Kn** to **EUR** matches the Amendment 174 update, and fixes the failing test. You could also clean-up older entries that use transition format, i.e., `lt_LT` and `lv_LV`. test/jdk/java/text/Format/NumberFormat/CurrencySymbols.properties line 82: > 80: hi_IN=\u0930\u0942 > 81: hr=\u00A4 > 82: hr_HR=EUR Since this is a table for currency symbols, it has to be EURO SIGN ('\u20AC') ------------- Changes requested by naoto (Reviewer). PR: https://git.openjdk.org/jdk/pull/11833 From erikj at openjdk.org Tue Jan 3 18:21:48 2023 From: erikj at openjdk.org (Erik Joelsson) Date: Tue, 3 Jan 2023 18:21:48 GMT Subject: RFR: 8294403: [REDO] make test should report only on executed tests In-Reply-To: References: Message-ID: On Tue, 3 Jan 2023 09:39:59 GMT, Aleksey Shipilev wrote: > This should help to speed up tests significantly. Currently, if we run "make test" with a subset of tests, JTReg would still read the entirety of test root to report on tests that were not run. Even with current suite of tests it gets expensive. If you add more tests to suite -- for example, mounting a large test archive like pre-generated fuzzer tests -- it starts to take a lot of time. > > The reasonable default for older jtreg is `-report:executed`. My own CI -- that has millions of tests mounted in `test/` -- was running with `JTREG="OPTIONS=-report:executed"` for years now. [CODETOOLS-7903323](https://bugs.openjdk.org/browse/CODETOOLS-7903323) provides a new reporting option, `-report:files`, which makes this whole business easier. This requires new jtreg. > > Motivational improvements: > > > $ time CONF=linux-x86_64-server-release make run-test TEST=gc/epsilon/TestHelloWorld.java > > # Default JDK tree > > # Baseline > real 0m9.086s > user 0m22.857s > sys 0m4.202s > > # Patched > real 0m6.406s ; +40% faster > user 0m17.156s > sys 0m3.193s > > # +100K fuzzer tests in tree > > # Baseline > real 3m1.997s > user 3m16.643s > sys 0m10.490s > > # Patched > real 0m8.919s ; 20x faster > user 0m17.904s > sys 0m4.860s > > > Additional testing: > - [x] Ad-hoc timing tests (see above) > - [x] Reproducer from [CODETOOLS-7903331](https://bugs.openjdk.org/browse/CODETOOLS-7903331) > - [x] Eyeballing the test results on passing tests with REPEAT_COUNT > 1 > - [x] Eyeballing the test results on intermittently failing tests with RETRY_COUNT > 1 Looks good from a build point of view. ------------- Marked as reviewed by erikj (Reviewer). PR: https://git.openjdk.org/jdk/pull/11824 From sspitsyn at openjdk.org Tue Jan 3 18:51:08 2023 From: sspitsyn at openjdk.org (Serguei Spitsyn) Date: Tue, 3 Jan 2023 18:51:08 GMT Subject: RFR: 8294321: Fix typos in files under test/jdk/java, test/jdk/jdk, test/jdk/jni [v3] In-Reply-To: References: Message-ID: On Tue, 27 Dec 2022 14:26:39 GMT, Michael Ernst wrote: >> 8294321: Fix typos in files under test/jdk/java, test/jdk/jdk, test/jdk/jni > > Michael Ernst has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains seven commits: > > - Merge ../jdk-openjdk into typos-typos > - Reinstate typos in Apache code that is copied into the JDK > - Merge ../jdk-openjdk into typos-typos > - Remove file that was removed upstream > - Fix inconsistency in capitalization > - Undo change in zlip > - Fix typos Marked as reviewed by sspitsyn (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/10029 From sspitsyn at openjdk.org Tue Jan 3 19:12:01 2023 From: sspitsyn at openjdk.org (Serguei Spitsyn) Date: Tue, 3 Jan 2023 19:12:01 GMT Subject: RFR: 8294321: Fix typos in files under test/jdk/java, test/jdk/jdk, test/jdk/jni [v3] In-Reply-To: References: Message-ID: On Tue, 27 Dec 2022 14:26:39 GMT, Michael Ernst wrote: >> 8294321: Fix typos in files under test/jdk/java, test/jdk/jdk, test/jdk/jni > > Michael Ernst has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains seven commits: > > - Merge ../jdk-openjdk into typos-typos > - Reinstate typos in Apache code that is copied into the JDK > - Merge ../jdk-openjdk into typos-typos > - Remove file that was removed upstream > - Fix inconsistency in capitalization > - Undo change in zlip > - Fix typos Michael, I've reviewed the changes but the [JDK-8294321](https://bugs.openjdk.org/browse/JDK-8294321) seems to be already resolved. So, what JBS issue are you actually trying to fix? ------------- PR: https://git.openjdk.org/jdk/pull/10029 From smarks at openjdk.org Tue Jan 3 19:35:50 2023 From: smarks at openjdk.org (Stuart Marks) Date: Tue, 3 Jan 2023 19:35:50 GMT Subject: RFR: 8189338: JMX RMI Remote Mbean server connection hangs if the server stops responding during a SSL Handshake In-Reply-To: References: Message-ID: On Tue, 3 Jan 2023 13:35:32 GMT, Daniel Jeli?ski wrote: > This patch introduces a time limit for establishing a secure connection to a RMI server. > > The existing implementation uses the configured `sun.rmi.transport.tcp.handshakeTimeout` during RMI handshake only; there's no time limit for SSL handshake. > With this patch, the configuration option `sun.rmi.transport.tcp.handshakeTimeout` is also used as a socket read timeout during the SSL handshake. > > I modified the existing `HandshakeTimeout` test to verify both non-SSL and SSL connections; the test passes with my changes, fails without them. > > Existing tier1-3 tests continue to pass. > > While working on the patch I noticed that `conn.isReusable()` always returns true. I can remove all references to `isReusable` here or in another PR; it would simplify the code a bit. Thanks for taking this long-standing bug. Changes look good. ------------- Marked as reviewed by smarks (Reviewer). PR: https://git.openjdk.org/jdk/pull/11829 From duke at openjdk.org Tue Jan 3 20:14:30 2023 From: duke at openjdk.org (Justin Lu) Date: Tue, 3 Jan 2023 20:14:30 GMT Subject: RFR: 8299439: java/text/Format/NumberFormat/CurrencyFormat.java fails for hr_HR [v2] In-Reply-To: References: Message-ID: > Regression caused by the fix to [JDK-8296239](https://bugs.openjdk.org/browse/JDK-8296239). The ISO 4217 Amendment 174 Update changes went into effect starting in 2023. > > _java/text/Format/NumberFormat/CurrencyFormat.java_ fails as _java/text/Format/NumberFormat/CurrencySymbols.properties_ did not have the proper change from the Amendment 174 update as well. > > Swapping the outdated to **Kn** to **EUR** matches the Amendment 174 update, and fixes the failing test. Justin Lu has updated the pull request incrementally with one additional commit since the last revision: Remove from list, fix symbol ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11833/files - new: https://git.openjdk.org/jdk/pull/11833/files/0ada2060..0934f837 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11833&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11833&range=00-01 Stats: 6 lines in 3 files changed: 1 ins; 2 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/11833.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11833/head:pull/11833 PR: https://git.openjdk.org/jdk/pull/11833 From duke at openjdk.org Tue Jan 3 20:14:30 2023 From: duke at openjdk.org (Justin Lu) Date: Tue, 3 Jan 2023 20:14:30 GMT Subject: RFR: 8299439: java/text/Format/NumberFormat/CurrencyFormat.java fails for hr_HR [v2] In-Reply-To: References: Message-ID: On Tue, 3 Jan 2023 17:51:26 GMT, Naoto Sato wrote: >> Justin Lu has updated the pull request incrementally with one additional commit since the last revision: >> >> Remove from list, fix symbol > > test/jdk/java/text/Format/NumberFormat/CurrencySymbols.properties line 82: > >> 80: hi_IN=\u0930\u0942 >> 81: hr=\u00A4 >> 82: hr_HR=EUR > > Since this is a table for currency symbols, it has to be EURO SIGN ('\u20AC') Made those changes, thank you ------------- PR: https://git.openjdk.org/jdk/pull/11833 From lancea at openjdk.org Tue Jan 3 20:25:52 2023 From: lancea at openjdk.org (Lance Andersen) Date: Tue, 3 Jan 2023 20:25:52 GMT Subject: RFR: 8299439: java/text/Format/NumberFormat/CurrencyFormat.java fails for hr_HR [v2] In-Reply-To: References: Message-ID: <8rqhJZeH3p7loHqz4C1XZEo1luuxPgdm0AIa4fuMljE=.a4ad6253-091b-4c5e-b1fa-d5df52398229@github.com> On Tue, 3 Jan 2023 20:14:30 GMT, Justin Lu wrote: >> Regression caused by the fix to [JDK-8296239](https://bugs.openjdk.org/browse/JDK-8296239). The ISO 4217 Amendment 174 Update changes went into effect starting in 2023. >> >> _java/text/Format/NumberFormat/CurrencyFormat.java_ fails as _java/text/Format/NumberFormat/CurrencySymbols.properties_ did not have the proper change from the Amendment 174 update as well. >> >> Swapping the outdated **Kn** to **EUR** matches the Amendment 174 update, and fixes the failing test. > > Justin Lu has updated the pull request incrementally with one additional commit since the last revision: > > Remove from list, fix symbol Looks OK to me ------------- Marked as reviewed by lancea (Reviewer). PR: https://git.openjdk.org/jdk/pull/11833 From naoto at openjdk.org Tue Jan 3 20:47:50 2023 From: naoto at openjdk.org (Naoto Sato) Date: Tue, 3 Jan 2023 20:47:50 GMT Subject: RFR: 8299439: java/text/Format/NumberFormat/CurrencyFormat.java fails for hr_HR [v2] In-Reply-To: References: Message-ID: On Tue, 3 Jan 2023 20:14:30 GMT, Justin Lu wrote: >> Regression caused by the fix to [JDK-8296239](https://bugs.openjdk.org/browse/JDK-8296239). The ISO 4217 Amendment 174 Update changes went into effect starting in 2023. >> >> _java/text/Format/NumberFormat/CurrencyFormat.java_ fails as _java/text/Format/NumberFormat/CurrencySymbols.properties_ did not have the proper change from the Amendment 174 update as well. >> >> Swapping the outdated **Kn** to **EUR** matches the Amendment 174 update, and fixes the failing test. > > Justin Lu has updated the pull request incrementally with one additional commit since the last revision: > > Remove from list, fix symbol Marked as reviewed by naoto (Reviewer). src/jdk.localedata/share/classes/sun/util/resources/ext/CurrencyNames_hr_HR.properties line 38: > 36: # Taligent is a registered trademark of Taligent, Inc. > 37: > 38: EUR=\u20AC Good catch! ------------- PR: https://git.openjdk.org/jdk/pull/11833 From dholmes at openjdk.org Tue Jan 3 21:25:28 2023 From: dholmes at openjdk.org (David Holmes) Date: Tue, 3 Jan 2023 21:25:28 GMT Subject: [jdk20] Integrated: 8299483: ProblemList java/text/Format/NumberFormat/CurrencyFormat.java Message-ID: Hi all, This pull request contains a backport of commit [5b5552ff](https://github.com/openjdk/jdk/commit/5b5552ff2a5fccaa9a34886d9df4c0075fc8f5e8) from the [openjdk/jdk](https://git.openjdk.org/jdk) repository. The commit being backported was authored by David Holmes on 2 Jan 2023 and was reviewed by Lance Andersen. Thanks! ------------- Commit messages: - Backport 5b5552ff2a5fccaa9a34886d9df4c0075fc8f5e8 Changes: https://git.openjdk.org/jdk20/pull/81/files Webrev: https://webrevs.openjdk.org/?repo=jdk20&pr=81&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299483 Stats: 3 lines in 1 file changed: 2 ins; 1 del; 0 mod Patch: https://git.openjdk.org/jdk20/pull/81.diff Fetch: git fetch https://git.openjdk.org/jdk20 pull/81/head:pull/81 PR: https://git.openjdk.org/jdk20/pull/81 From dholmes at openjdk.org Tue Jan 3 21:25:28 2023 From: dholmes at openjdk.org (David Holmes) Date: Tue, 3 Jan 2023 21:25:28 GMT Subject: [jdk20] Integrated: 8299483: ProblemList java/text/Format/NumberFormat/CurrencyFormat.java In-Reply-To: References: Message-ID: <_xcVrmnnEueItdda0AEIbHlflXZVwvqcnvo4bDa6uUY=.bb7994ef-1920-4d63-84f0-0ce51d58f7e5@github.com> On Tue, 3 Jan 2023 21:12:08 GMT, David Holmes wrote: > Hi all, > > This pull request contains a backport of commit [5b5552ff](https://github.com/openjdk/jdk/commit/5b5552ff2a5fccaa9a34886d9df4c0075fc8f5e8) from the [openjdk/jdk](https://git.openjdk.org/jdk) repository. > > The commit being backported was authored by David Holmes on 2 Jan 2023 and was reviewed by Lance Andersen. > > Thanks! This pull request has now been integrated. Changeset: 8254cbb2 Author: David Holmes URL: https://git.openjdk.org/jdk20/commit/8254cbb21d164f39aa12020bfbd555d7535a428e Stats: 3 lines in 1 file changed: 2 ins; 1 del; 0 mod 8299483: ProblemList java/text/Format/NumberFormat/CurrencyFormat.java Backport-of: 5b5552ff2a5fccaa9a34886d9df4c0075fc8f5e8 ------------- PR: https://git.openjdk.org/jdk20/pull/81 From cjplummer at openjdk.org Tue Jan 3 21:58:49 2023 From: cjplummer at openjdk.org (Chris Plummer) Date: Tue, 3 Jan 2023 21:58:49 GMT Subject: RFR: 8294321: Fix typos in files under test/jdk/java, test/jdk/jdk, test/jdk/jni [v3] In-Reply-To: References: Message-ID: On Tue, 3 Jan 2023 19:08:59 GMT, Serguei Spitsyn wrote: > Michael, I've reviewed the changes but the [JDK-8294321](https://bugs.openjdk.org/browse/JDK-8294321) seems to be already resolved. So, what JBS issue are you actually trying to fix? It's closed because #11385 used it to fix some of the typos. #11385 should have used a new issue, but now instead a new issue is needed for the remaining typos. ------------- PR: https://git.openjdk.org/jdk/pull/10029 From duke at openjdk.org Tue Jan 3 23:11:28 2023 From: duke at openjdk.org (Justin Lu) Date: Tue, 3 Jan 2023 23:11:28 GMT Subject: RFR: 8299439: java/text/Format/NumberFormat/CurrencyFormat.java fails for hr_HR [v3] In-Reply-To: References: Message-ID: <__H0WPRhVNyv3FKRre4T07IDvun3W9tMCPsr9lCobSU=.7811ee8f-393f-43ee-9ef4-456456a6b26f@github.com> > Regression caused by the fix to [JDK-8296239](https://bugs.openjdk.org/browse/JDK-8296239). The ISO 4217 Amendment 174 Update changes went into effect starting in 2023. > > _java/text/Format/NumberFormat/CurrencyFormat.java_ fails as _java/text/Format/NumberFormat/CurrencySymbols.properties_ did not have the proper change from the Amendment 174 update as well. > > Swapping the outdated **Kn** to **EUR** matches the Amendment 174 update, and fixes the failing test. Justin Lu has updated the pull request incrementally with one additional commit since the last revision: Update copyright ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11833/files - new: https://git.openjdk.org/jdk/pull/11833/files/0934f837..d0d075c1 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11833&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11833&range=01-02 Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/11833.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11833/head:pull/11833 PR: https://git.openjdk.org/jdk/pull/11833 From naoto at openjdk.org Tue Jan 3 23:11:29 2023 From: naoto at openjdk.org (Naoto Sato) Date: Tue, 3 Jan 2023 23:11:29 GMT Subject: RFR: 8299439: java/text/Format/NumberFormat/CurrencyFormat.java fails for hr_HR [v3] In-Reply-To: <__H0WPRhVNyv3FKRre4T07IDvun3W9tMCPsr9lCobSU=.7811ee8f-393f-43ee-9ef4-456456a6b26f@github.com> References: <__H0WPRhVNyv3FKRre4T07IDvun3W9tMCPsr9lCobSU=.7811ee8f-393f-43ee-9ef4-456456a6b26f@github.com> Message-ID: On Tue, 3 Jan 2023 23:06:35 GMT, Justin Lu wrote: >> Regression caused by the fix to [JDK-8296239](https://bugs.openjdk.org/browse/JDK-8296239). The ISO 4217 Amendment 174 Update changes went into effect starting in 2023. >> >> _java/text/Format/NumberFormat/CurrencyFormat.java_ fails as _java/text/Format/NumberFormat/CurrencySymbols.properties_ did not have the proper change from the Amendment 174 update as well. >> >> Swapping the outdated **Kn** to **EUR** matches the Amendment 174 update, and fixes the failing test. > > Justin Lu has updated the pull request incrementally with one additional commit since the last revision: > > Update copyright Marked as reviewed by naoto (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11833 From jpai at openjdk.org Wed Jan 4 01:22:57 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 4 Jan 2023 01:22:57 GMT Subject: RFR: 8294321: Fix typos in files under test/jdk/java, test/jdk/jdk, test/jdk/jni [v3] In-Reply-To: References: Message-ID: On Tue, 27 Dec 2022 14:26:39 GMT, Michael Ernst wrote: >> 8294321: Fix typos in files under test/jdk/java, test/jdk/jdk, test/jdk/jni > > Michael Ernst has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains seven commits: > > - Merge ../jdk-openjdk into typos-typos > - Reinstate typos in Apache code that is copied into the JDK > - Merge ../jdk-openjdk into typos-typos > - Remove file that was removed upstream > - Fix inconsistency in capitalization > - Undo change in zlip > - Fix typos Hell Michael, I've created https://bugs.openjdk.org/browse/JDK-8299563 to track this final few typos. Could you please update the title of this PR to `8299563: Fix typos`? That should then allow you to proceed using this PR. Please also merge with latest master branch once more since some typo fixes from this PR have been merged recently. Thank you for your patience. ------------- PR: https://git.openjdk.org/jdk/pull/10029 From jpai at openjdk.org Wed Jan 4 01:23:01 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 4 Jan 2023 01:23:01 GMT Subject: RFR: 8294321: Fix typos in files under test/jdk/java, test/jdk/jdk, test/jdk/jni [v2] In-Reply-To: References: Message-ID: On Wed, 5 Oct 2022 13:22:14 GMT, Alexey Ivanov wrote: >> Michael Ernst has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains six commits: >> >> - Reinstate typos in Apache code that is copied into the JDK >> - Merge ../jdk-openjdk into typos-typos >> - Remove file that was removed upstream >> - Fix inconsistency in capitalization >> - Undo change in zlip >> - Fix typos > > test/jdk/sun/jvmstat/testlibrary/utils.sh line 181: > >> 179: if [ $? -eq 0 ] >> 180: then >> 181: # it's still lingering, now it is hard > > Suggestion: > > # it's still lingering, now hit it hard @mernst, this suggestion appears relevant. Could you update the PR to address this? ------------- PR: https://git.openjdk.org/jdk/pull/10029 From jpai at openjdk.org Wed Jan 4 01:26:57 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 4 Jan 2023 01:26:57 GMT Subject: RFR: 8294321: Fix typos in files under test/jdk/java, test/jdk/jdk, test/jdk/jni [v2] In-Reply-To: References: Message-ID: On Wed, 5 Oct 2022 13:06:25 GMT, Alexey Ivanov wrote: >> Michael Ernst has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains six commits: >> >> - Reinstate typos in Apache code that is copied into the JDK >> - Merge ../jdk-openjdk into typos-typos >> - Remove file that was removed upstream >> - Fix inconsistency in capitalization >> - Undo change in zlip >> - Fix typos > > src/java.xml/share/classes/org/w3c/dom/Document.java line 293: > >> 291: * systemId, and notationName attributes are >> 292: * copied. If a deep import is requested, the descendants >> 293: * of the source Entity are recursively imported and > > This class may come from a 3rd party library. Anyone from `java.xml` can confirm it? @mernst, could you undo this change to this file from this PR? It does indeed seem to come from a 3rd party source. @JoeWang-Java can correct us if that's not the case. ------------- PR: https://git.openjdk.org/jdk/pull/10029 From dholmes at openjdk.org Wed Jan 4 01:27:49 2023 From: dholmes at openjdk.org (David Holmes) Date: Wed, 4 Jan 2023 01:27:49 GMT Subject: RFR: 8294403: [REDO] make test should report only on executed tests In-Reply-To: References: Message-ID: On Tue, 3 Jan 2023 09:39:59 GMT, Aleksey Shipilev wrote: > This should help to speed up tests significantly. Currently, if we run "make test" with a subset of tests, JTReg would still read the entirety of test root to report on tests that were not run. Even with current suite of tests it gets expensive. If you add more tests to suite -- for example, mounting a large test archive like pre-generated fuzzer tests -- it starts to take a lot of time. > > The reasonable default for older jtreg is `-report:executed`. My own CI -- that has millions of tests mounted in `test/` -- was running with `JTREG="OPTIONS=-report:executed"` for years now. [CODETOOLS-7903323](https://bugs.openjdk.org/browse/CODETOOLS-7903323) provides a new reporting option, `-report:files`, which makes this whole business easier. This requires new jtreg. > > Motivational improvements: > > > $ time CONF=linux-x86_64-server-release make run-test TEST=gc/epsilon/TestHelloWorld.java > > # Default JDK tree > > # Baseline > real 0m9.086s > user 0m22.857s > sys 0m4.202s > > # Patched > real 0m6.406s ; +40% faster > user 0m17.156s > sys 0m3.193s > > # +100K fuzzer tests in tree > > # Baseline > real 3m1.997s > user 3m16.643s > sys 0m10.490s > > # Patched > real 0m8.919s ; 20x faster > user 0m17.904s > sys 0m4.860s > > > Additional testing: > - [x] Ad-hoc timing tests (see above) > - [x] Reproducer from [CODETOOLS-7903331](https://bugs.openjdk.org/browse/CODETOOLS-7903331) > - [x] Eyeballing the test results on passing tests with REPEAT_COUNT > 1 > - [x] Eyeballing the test results on intermittently failing tests with RETRY_COUNT > 1 This seems fine to me. Thanks. I personally always run with `-noreport`. :) ------------- Marked as reviewed by dholmes (Reviewer). PR: https://git.openjdk.org/jdk/pull/11824 From jpai at openjdk.org Wed Jan 4 01:31:49 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 4 Jan 2023 01:31:49 GMT Subject: RFR: 8299439: java/text/Format/NumberFormat/CurrencyFormat.java fails for hr_HR [v3] In-Reply-To: <__H0WPRhVNyv3FKRre4T07IDvun3W9tMCPsr9lCobSU=.7811ee8f-393f-43ee-9ef4-456456a6b26f@github.com> References: <__H0WPRhVNyv3FKRre4T07IDvun3W9tMCPsr9lCobSU=.7811ee8f-393f-43ee-9ef4-456456a6b26f@github.com> Message-ID: On Tue, 3 Jan 2023 23:11:28 GMT, Justin Lu wrote: >> Regression caused by the fix to [JDK-8296239](https://bugs.openjdk.org/browse/JDK-8296239). The ISO 4217 Amendment 174 Update changes went into effect starting in 2023. >> >> _java/text/Format/NumberFormat/CurrencyFormat.java_ fails as _java/text/Format/NumberFormat/CurrencySymbols.properties_ did not have the proper change from the Amendment 174 update as well. >> >> Swapping the outdated **Kn** to **EUR** matches the Amendment 174 update, and fixes the failing test. > > Justin Lu has updated the pull request incrementally with one additional commit since the last revision: > > Update copyright Marked as reviewed by jpai (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11833 From jpai at openjdk.org Wed Jan 4 01:43:48 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 4 Jan 2023 01:43:48 GMT Subject: RFR: 8294403: [REDO] make test should report only on executed tests In-Reply-To: References: Message-ID: On Tue, 3 Jan 2023 09:39:59 GMT, Aleksey Shipilev wrote: > This should help to speed up tests significantly. Currently, if we run "make test" with a subset of tests, JTReg would still read the entirety of test root to report on tests that were not run. Even with current suite of tests it gets expensive. If you add more tests to suite -- for example, mounting a large test archive like pre-generated fuzzer tests -- it starts to take a lot of time. > > The reasonable default for older jtreg is `-report:executed`. My own CI -- that has millions of tests mounted in `test/` -- was running with `JTREG="OPTIONS=-report:executed"` for years now. [CODETOOLS-7903323](https://bugs.openjdk.org/browse/CODETOOLS-7903323) provides a new reporting option, `-report:files`, which makes this whole business easier. This requires new jtreg. > > Motivational improvements: > > > $ time CONF=linux-x86_64-server-release make run-test TEST=gc/epsilon/TestHelloWorld.java > > # Default JDK tree > > # Baseline > real 0m9.086s > user 0m22.857s > sys 0m4.202s > > # Patched > real 0m6.406s ; +40% faster > user 0m17.156s > sys 0m3.193s > > # +100K fuzzer tests in tree > > # Baseline > real 3m1.997s > user 3m16.643s > sys 0m10.490s > > # Patched > real 0m8.919s ; 20x faster > user 0m17.904s > sys 0m4.860s > > > Additional testing: > - [x] Ad-hoc timing tests (see above) > - [x] Reproducer from [CODETOOLS-7903331](https://bugs.openjdk.org/browse/CODETOOLS-7903331) > - [x] Eyeballing the test results on passing tests with REPEAT_COUNT > 1 > - [x] Eyeballing the test results on intermittently failing tests with RETRY_COUNT > 1 Hello Aleksey, this looks good to me. Good to see the timing improvements on `make test`. Please update the copyright years on the files before integrating. I see that in the additional testing section you note, running tests with RETRY_COUNT. Is that intentional? Does retry count play a role in the report generation? ------------- Marked as reviewed by jpai (Reviewer). PR: https://git.openjdk.org/jdk/pull/11824 From pminborg at openjdk.org Wed Jan 4 08:56:40 2023 From: pminborg at openjdk.org (Per Minborg) Date: Wed, 4 Jan 2023 08:56:40 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access Message-ID: Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 ------------- Commit messages: - Update copyright year to 2023 - Update copyright year - Reimplement java.io.Bits using VarHandle access Changes: https://git.openjdk.org/jdk/pull/11840/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11840&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299576 Stats: 463 lines in 2 files changed: 424 ins; 24 del; 15 mod Patch: https://git.openjdk.org/jdk/pull/11840.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11840/head:pull/11840 PR: https://git.openjdk.org/jdk/pull/11840 From pminborg at openjdk.org Wed Jan 4 09:01:06 2023 From: pminborg at openjdk.org (Per Minborg) Date: Wed, 4 Jan 2023 09:01:06 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v2] In-Reply-To: References: Message-ID: <8sAs67UpxNzQMAVJdjcF9rl_yc-cwTzW5FvkiywbcKs=.f08bbd9c-2497-4b86-a23e-f400a4d42417@github.com> > Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. > > Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. > > Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. > > Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 Per Minborg has updated the pull request incrementally with one additional commit since the last revision: Update copyright year in test class ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11840/files - new: https://git.openjdk.org/jdk/pull/11840/files/9b5af054..13af8b6c Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11840&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11840&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/11840.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11840/head:pull/11840 PR: https://git.openjdk.org/jdk/pull/11840 From pminborg at openjdk.org Wed Jan 4 09:01:08 2023 From: pminborg at openjdk.org (Per Minborg) Date: Wed, 4 Jan 2023 09:01:08 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 08:48:56 GMT, Per Minborg wrote: > Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. > > Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. > > Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. > > Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 Is there a better way to test packet-private methods in Bits without resorting to reflection? ------------- PR: https://git.openjdk.org/jdk/pull/11840 From alanb at openjdk.org Wed Jan 4 09:10:50 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 4 Jan 2023 09:10:50 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 08:57:25 GMT, Per Minborg wrote: > Is there a better way to test packet-private methods in Bits without resorting to reflection? Yes, looking for directories named java.base in the test tree and you'll see test classes that are compiled into java.base/java.net, java.base/java.lang.invoke and other packages so they can be used to test package private methods. When you look at the tests you'll see there are a couple of approaches used. Some tests are in the same runtime package, others add a public class with public methods into the runtime package that the test can use. ------------- PR: https://git.openjdk.org/jdk/pull/11840 From shade at openjdk.org Wed Jan 4 09:15:18 2023 From: shade at openjdk.org (Aleksey Shipilev) Date: Wed, 4 Jan 2023 09:15:18 GMT Subject: RFR: 8294403: [REDO] make test should report only on executed tests [v2] In-Reply-To: References: Message-ID: > This should help to speed up tests significantly. Currently, if we run "make test" with a subset of tests, JTReg would still read the entirety of test root to report on tests that were not run. Even with current suite of tests it gets expensive. If you add more tests to suite -- for example, mounting a large test archive like pre-generated fuzzer tests -- it starts to take a lot of time. > > The reasonable default for older jtreg is `-report:executed`. My own CI -- that has millions of tests mounted in `test/` -- was running with `JTREG="OPTIONS=-report:executed"` for years now. [CODETOOLS-7903323](https://bugs.openjdk.org/browse/CODETOOLS-7903323) provides a new reporting option, `-report:files`, which makes this whole business easier. This requires new jtreg. > > Motivational improvements: > > > $ time CONF=linux-x86_64-server-release make run-test TEST=gc/epsilon/TestHelloWorld.java > > # Default JDK tree > > # Baseline > real 0m9.086s > user 0m22.857s > sys 0m4.202s > > # Patched > real 0m6.406s ; +40% faster > user 0m17.156s > sys 0m3.193s > > # +100K fuzzer tests in tree > > # Baseline > real 3m1.997s > user 3m16.643s > sys 0m10.490s > > # Patched > real 0m8.919s ; 20x faster > user 0m17.904s > sys 0m4.860s > > > Additional testing: > - [x] Ad-hoc timing tests (see above) > - [x] Reproducer from [CODETOOLS-7903331](https://bugs.openjdk.org/browse/CODETOOLS-7903331) > - [x] Eyeballing the test results on passing tests with REPEAT_COUNT > 1 > - [x] Eyeballing the test results on intermittently failing tests with RETRY_COUNT > 1 Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision: Copyright years ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11824/files - new: https://git.openjdk.org/jdk/pull/11824/files/a803958f..a82ac6cc Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11824&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11824&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/11824.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11824/head:pull/11824 PR: https://git.openjdk.org/jdk/pull/11824 From shade at openjdk.org Wed Jan 4 09:15:18 2023 From: shade at openjdk.org (Aleksey Shipilev) Date: Wed, 4 Jan 2023 09:15:18 GMT Subject: RFR: 8294403: [REDO] make test should report only on executed tests [v2] In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 01:40:36 GMT, Jaikiran Pai wrote: > Please update the copyright years on the files before integrating. Updated. > I see that in the additional testing section you note, running tests with RETRY_COUNT. Is that intentional? Does retry count play a role in the report generation? The logic for REPEAT/RETRY_COUNT merges the jtreg reports from "different" repeated runs. We have to check new reporting mode still produces sane results in that mode. ------------- PR: https://git.openjdk.org/jdk/pull/11824 From jpai at openjdk.org Wed Jan 4 09:25:55 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 4 Jan 2023 09:25:55 GMT Subject: RFR: 8294403: [REDO] make test should report only on executed tests [v2] In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 09:15:18 GMT, Aleksey Shipilev wrote: >> This should help to speed up tests significantly. Currently, if we run "make test" with a subset of tests, JTReg would still read the entirety of test root to report on tests that were not run. Even with current suite of tests it gets expensive. If you add more tests to suite -- for example, mounting a large test archive like pre-generated fuzzer tests -- it starts to take a lot of time. >> >> The reasonable default for older jtreg is `-report:executed`. My own CI -- that has millions of tests mounted in `test/` -- was running with `JTREG="OPTIONS=-report:executed"` for years now. [CODETOOLS-7903323](https://bugs.openjdk.org/browse/CODETOOLS-7903323) provides a new reporting option, `-report:files`, which makes this whole business easier. This requires new jtreg. >> >> Motivational improvements: >> >> >> $ time CONF=linux-x86_64-server-release make run-test TEST=gc/epsilon/TestHelloWorld.java >> >> # Default JDK tree >> >> # Baseline >> real 0m9.086s >> user 0m22.857s >> sys 0m4.202s >> >> # Patched >> real 0m6.406s ; +40% faster >> user 0m17.156s >> sys 0m3.193s >> >> # +100K fuzzer tests in tree >> >> # Baseline >> real 3m1.997s >> user 3m16.643s >> sys 0m10.490s >> >> # Patched >> real 0m8.919s ; 20x faster >> user 0m17.904s >> sys 0m4.860s >> >> >> Additional testing: >> - [x] Ad-hoc timing tests (see above) >> - [x] Reproducer from [CODETOOLS-7903331](https://bugs.openjdk.org/browse/CODETOOLS-7903331) >> - [x] Eyeballing the test results on passing tests with REPEAT_COUNT > 1 >> - [x] Eyeballing the test results on intermittently failing tests with RETRY_COUNT > 1 > > Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision: > > Copyright years Marked as reviewed by jpai (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11824 From jpai at openjdk.org Wed Jan 4 09:25:56 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 4 Jan 2023 09:25:56 GMT Subject: RFR: 8294403: [REDO] make test should report only on executed tests [v2] In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 09:10:01 GMT, Aleksey Shipilev wrote: > > I see that in the additional testing section you note, running tests with RETRY_COUNT. Is that intentional? Does retry count play a role in the report generation? > > The logic for REPEAT/RETRY_COUNT merges the jtreg reports from "different" repeated runs. We have to check new reporting mode still produces sane results in that mode. Thank you for that detail, I wasn't aware of that. ------------- PR: https://git.openjdk.org/jdk/pull/11824 From uschindler at openjdk.org Wed Jan 4 09:28:48 2023 From: uschindler at openjdk.org (Uwe Schindler) Date: Wed, 4 Jan 2023 09:28:48 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v2] In-Reply-To: <8sAs67UpxNzQMAVJdjcF9rl_yc-cwTzW5FvkiywbcKs=.f08bbd9c-2497-4b86-a23e-f400a4d42417@github.com> References: <8sAs67UpxNzQMAVJdjcF9rl_yc-cwTzW5FvkiywbcKs=.f08bbd9c-2497-4b86-a23e-f400a4d42417@github.com> Message-ID: On Wed, 4 Jan 2023 09:01:06 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. >> >> Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. >> >> Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. >> >> Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Update copyright year in test class Do we need this test at all, because this code is tested to extense through RandomAccessFile? We had no test before, so why add a new one here? Otherwise: PR looks good. ------------- PR: https://git.openjdk.org/jdk/pull/11840 From pminborg at openjdk.org Wed Jan 4 09:31:51 2023 From: pminborg at openjdk.org (Per Minborg) Date: Wed, 4 Jan 2023 09:31:51 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v2] In-Reply-To: <8sAs67UpxNzQMAVJdjcF9rl_yc-cwTzW5FvkiywbcKs=.f08bbd9c-2497-4b86-a23e-f400a4d42417@github.com> References: <8sAs67UpxNzQMAVJdjcF9rl_yc-cwTzW5FvkiywbcKs=.f08bbd9c-2497-4b86-a23e-f400a4d42417@github.com> Message-ID: On Wed, 4 Jan 2023 09:01:06 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. >> >> Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. >> >> Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. >> >> Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Update copyright year in test class Here is an update performance comparison for Linux x64: ![image](https://user-images.githubusercontent.com/7457876/210524557-cf9dbb6e-8885-484d-ae52-347b8388ef40.png) ------------- PR: https://git.openjdk.org/jdk/pull/11840 From pminborg at openjdk.org Wed Jan 4 10:51:50 2023 From: pminborg at openjdk.org (Per Minborg) Date: Wed, 4 Jan 2023 10:51:50 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v2] In-Reply-To: References: <8sAs67UpxNzQMAVJdjcF9rl_yc-cwTzW5FvkiywbcKs=.f08bbd9c-2497-4b86-a23e-f400a4d42417@github.com> Message-ID: On Wed, 4 Jan 2023 09:25:40 GMT, Uwe Schindler wrote: > Do we need this test at all, because this code is tested to extense through RandomAccessFile? We had no test before, so why add a new one here? > > Otherwise: PR looks good. There are overlaps of the RAF and Bits tests but the latter tests additional aspects such as unaligned access and edge cases with exceptions. So, I think we should keep the proposed tests. ------------- PR: https://git.openjdk.org/jdk/pull/11840 From pminborg at openjdk.org Wed Jan 4 10:49:24 2023 From: pminborg at openjdk.org (Per Minborg) Date: Wed, 4 Jan 2023 10:49:24 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v3] In-Reply-To: References: Message-ID: > Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. > > Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. > > Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. > > Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 Per Minborg has updated the pull request incrementally with two additional commits since the last revision: - Improve test - Improve test ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11840/files - new: https://git.openjdk.org/jdk/pull/11840/files/13af8b6c..3a91f3e2 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11840&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11840&range=01-02 Stats: 285 lines in 2 files changed: 113 ins; 127 del; 45 mod Patch: https://git.openjdk.org/jdk/pull/11840.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11840/head:pull/11840 PR: https://git.openjdk.org/jdk/pull/11840 From mcimadamore at openjdk.org Wed Jan 4 10:57:43 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Wed, 4 Jan 2023 10:57:43 GMT Subject: [jdk20] RFR: 8299561: VaList.empty() doesn't return a list associated with the global scope Message-ID: This patch fixes a long-standing conformance issue: `VaList.empty` is specified to return a `VaList` associated with the global scope, but in some platforms (Aarch64/Linux and x64/Linux) the empty list is associated with an implicit scope instead. This doesn't make a lot of difference, given that the empty list is always stored in a static final in the underlying implementation - that said, it would be a good thing to rectify this conformance issue. ------------- Commit messages: - Initial push Changes: https://git.openjdk.org/jdk20/pull/82/files Webrev: https://webrevs.openjdk.org/?repo=jdk20&pr=82&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299561 Stats: 6 lines in 3 files changed: 4 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk20/pull/82.diff Fetch: git fetch https://git.openjdk.org/jdk20 pull/82/head:pull/82 PR: https://git.openjdk.org/jdk20/pull/82 From mcimadamore at openjdk.org Wed Jan 4 10:57:44 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Wed, 4 Jan 2023 10:57:44 GMT Subject: [jdk20] RFR: 8299561: VaList.empty() doesn't return a list associated with the global scope In-Reply-To: References: Message-ID: <13fnBOcypryKZfqAY1eJbtZRyph87K9Ai5gBNY0uPsU=.31ca2a6a-0511-491f-af60-a0939b765652@github.com> On Wed, 4 Jan 2023 10:49:09 GMT, Maurizio Cimadamore wrote: > This patch fixes a long-standing conformance issue: `VaList.empty` is specified to return a `VaList` associated with the global scope, but in some platforms (Aarch64/Linux and x64/Linux) the empty list is associated with an implicit scope instead. > > This doesn't make a lot of difference, given that the empty list is always stored in a static final in the underlying implementation - that said, it would be a good thing to rectify this conformance issue. Note: on Windows/x64 and MacOS/Aarch64 the empty VaList is just a wrapper around MemorySegment.NULL which is already associated with the global scope - so nothing to fix there. ------------- PR: https://git.openjdk.org/jdk20/pull/82 From fjiang at openjdk.org Wed Jan 4 11:17:51 2023 From: fjiang at openjdk.org (Feilong Jiang) Date: Wed, 4 Jan 2023 11:17:51 GMT Subject: RFR: 8293841: RISC-V: Implementation of Foreign Function & Memory API (Preview) Message-ID: Add experimental Foreign Function & Memory API support for RISC-V. Details of FFM API RISC-V port please refer to [JBS issue](https://bugs.openjdk.org/browse/JDK-8293841) ------------- Commit messages: - sync with JDK-8296477 - sync with JDK-8295044 - JDK-8293841: RISC-V: Implementation of Foreign Function & Memory API (Preview) Changes: https://git.openjdk.org/jdk/pull/11004/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11004&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8293841 Stats: 2861 lines in 64 files changed: 2736 ins; 2 del; 123 mod Patch: https://git.openjdk.org/jdk/pull/11004.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11004/head:pull/11004 PR: https://git.openjdk.org/jdk/pull/11004 From jdk at fiolino.de Wed Jan 4 11:19:15 2023 From: jdk at fiolino.de (Michael Kuhlmann) Date: Wed, 4 Jan 2023 12:19:15 +0100 Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access In-Reply-To: References: Message-ID: <2e29a269-ac13-240e-6fe9-b344ede6fa49@fiolino.de> On 1/4/23 09:56, Per Minborg wrote: > Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. Hmh, Javadoc for MethodHandels::byteArrayViewVarHandle says the following: * read write access modes for all T, with the exception of access modes get and set for long and double on 32-bit platforms. Are you sure that your change will work correctly on a 32-bit platform? From what I read, it could throw an IllegalStateException when a long value is read/written. -Michael > > Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. > > Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. > > Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > ------------- > > Commit messages: > - Update copyright year to 2023 > - Update copyright year > - Reimplement java.io.Bits using VarHandle access > > Changes: https://git.openjdk.org/jdk/pull/11840/files > Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11840&range=00 > Issue: https://bugs.openjdk.org/browse/JDK-8299576 > Stats: 463 lines in 2 files changed: 424 ins; 24 del; 15 mod > Patch: https://git.openjdk.org/jdk/pull/11840.diff > Fetch: git fetch https://git.openjdk.org/jdk pull/11840/head:pull/11840 > > PR: https://git.openjdk.org/jdk/pull/11840 From duke at openjdk.org Wed Jan 4 11:21:49 2023 From: duke at openjdk.org (Andriy Plokhotnyuk) Date: Wed, 4 Jan 2023 11:21:49 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v2] In-Reply-To: References: <8sAs67UpxNzQMAVJdjcF9rl_yc-cwTzW5FvkiywbcKs=.f08bbd9c-2497-4b86-a23e-f400a4d42417@github.com> Message-ID: On Wed, 4 Jan 2023 10:49:18 GMT, Per Minborg wrote: >> Do we need this test at all, because this code is tested to extense through RandomAccessFile? We had no test before, so why add a new one here? >> >> Otherwise: PR looks good. > >> Do we need this test at all, because this code is tested to extense through RandomAccessFile? We had no test before, so why add a new one here? >> >> Otherwise: PR looks good. > > There are overlaps of the RAF and Bits tests but the latter tests additional aspects such as unaligned access and edge cases with exceptions. So, I think we should keep the proposed tests. @minborg Amazing piece! Will `java.lang.invoke.VarHandle` instances be shared in JDK to reuse in other places? The [jsoniter-scala-coreJVM](https://github.com/plokhotnyuk/jsoniter-scala/tree/master/jsoniter-scala-core/jvm/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/core) module of the [jsoniter-scala](https://github.com/plokhotnyuk/jsoniter-scala) project has a lot of SWAR tricks that use `java.lang.invoke.VarHandle` to speed up parsing/serialization of primitives, `java.math.BigDecimal`, and `java.time.*` classes from/to textual representation. Are you interested to port some of them to JDK as it was done for `java.util.UUID` parsing [here](https://github.com/openjdk/jdk/commit/ebadfaeb2e1cc7b5ce5f101cd8a539bc5478cf5b)? ------------- PR: https://git.openjdk.org/jdk/pull/11840 From uschindler at openjdk.org Wed Jan 4 11:32:52 2023 From: uschindler at openjdk.org (Uwe Schindler) Date: Wed, 4 Jan 2023 11:32:52 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v3] In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 10:49:24 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. >> >> Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. >> >> Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. >> >> Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > Per Minborg has updated the pull request incrementally with two additional commits since the last revision: > > - Improve test > - Improve test There *may* be one problem: For float and double the original code uses `Double#doubleToLongBits()` (same for float), which normalized NaN. I am not sure how the Varhandle behaves with that. Reading float/double is not a problem. ------------- PR: https://git.openjdk.org/jdk/pull/11840 From uschindler at openjdk.org Wed Jan 4 11:38:49 2023 From: uschindler at openjdk.org (Uwe Schindler) Date: Wed, 4 Jan 2023 11:38:49 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v3] In-Reply-To: References: Message-ID: <32ByhPnRMBFDG6zDS0rAt1-Jxd-VZUe-mRl2Dq1B5so=.3bd6e1ae-9752-48c4-a46d-e11e400f64df@github.com> On Wed, 4 Jan 2023 10:49:24 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. >> >> Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. >> >> Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. >> >> Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > Per Minborg has updated the pull request incrementally with two additional commits since the last revision: > > - Improve test > - Improve test To be safe, we could go first with the int/long varhandles and convert as before. ------------- PR: https://git.openjdk.org/jdk/pull/11840 From duke at openjdk.org Wed Jan 4 12:02:49 2023 From: duke at openjdk.org (Markus KARG) Date: Wed, 4 Jan 2023 12:02:49 GMT Subject: RFR: JDK-8299336 - InputStream::DEFAULT_BUFFER_SIZE should be 16384 In-Reply-To: References: Message-ID: <9CAPsBZe7mzrbtDkk8hlZBvEp9F4QjKYjZv0w19N7v8=.71a6174a-e9e5-4380-8455-ce9652fbb75f@github.com> On Fri, 23 Dec 2022 22:28:34 GMT, Markus KARG wrote: > I/O had always been much slower than CPU and memory access, and thanks to physical constraints, always will be. > While CPUs can get shrinked more and more, and can hold more and more memory cache on or nearby a CPU core, the distance between CPU core and I/O device cannot get reduced much: It will stay "far" away. > Due to this simple logic (and other factors), the spread between performance of CPU and memory access on one hand, and performance of I/O on the other hand, increases with every new CPU generation. > As a consequence, internal adjustment factors of the JDK need to get revised from time to time to ensure optimum performance and each hardware generation. > > One such factor is the size of the temporary transfer buffer used internally by `InputStream::transferTo`. > Since its introduction with JDK 9 many years (hence hardware generations) have passed, so it's time to check the appropriateness of that buffer's size. > > Using JMH on a typical, modern cloud platform, it was proven that the current 8K buffer is (much) too small on modern hardware: > The small buffer clearly stands in the way of faster transfers. > The ops/s of a simple `FileInputStream.transferTo(ByteArrayOutputStream)` operation on JDK 21 could be doubled (!) by only doubling the buffer size from 8K to 16K, which seems to be a considerable and cheap deal. > Doubling the buffer even more shows only marginal improvements of approx. 1% to 3% per duplication of size, which does not justify additional memory consumption. > > > TransferToPerformance.transferTo 8192 1048576 thrpt 25 1349.929 ? 47.057 ops/s > TransferToPerformance.transferTo 16384 1048576 thrpt 25 2633.560 ? 93.337 ops/s > TransferToPerformance.transferTo 32768 1048576 thrpt 25 2721.025 ? 89.555 ops/s > TransferToPerformance.transferTo 65536 1048576 thrpt 25 2855.949 ? 96.623 ops/s > TransferToPerformance.transferTo 131072 1048576 thrpt 25 2903.062 ? 40.798 ops/s > > > Even on small or limited platforms, an investment of 8K additonal temporary buffer is very cheap and very useful, as it doubles the performance of `InputStream::transferTo`, in particular for legacy (non-NIO) applications still using `FileInputStream` and `ByteArrayOutputStream`. > I dare to say, even if not proven, that is a very considerable (possibly the major) number of existing applications, as NIO was only adopted gradually by programmers. > > Due to the given reasons, it should be approporiate to change `DEFAULT_BUFFER_SIZE` from 8192 to 16384. Thank you for not rejecting my proposal. Indeed the starting point for this PR was the surprising experience with several existing applications that were using custom transfer loops with larger buffers being to be considerably faster than `transferTo` (Maven being one of them just to name some). Can I convince you to mark this PR as reviewed? Thanks! :-) ------------- PR: https://git.openjdk.org/jdk/pull/11783 From pminborg at openjdk.org Wed Jan 4 12:20:28 2023 From: pminborg at openjdk.org (Per Minborg) Date: Wed, 4 Jan 2023 12:20:28 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v4] In-Reply-To: References: Message-ID: > Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. > > Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. > > Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. > > Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 Per Minborg has updated the pull request incrementally with one additional commit since the last revision: Add special test values for double and float ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11840/files - new: https://git.openjdk.org/jdk/pull/11840/files/3a91f3e2..e1f95d83 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11840&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11840&range=02-03 Stats: 27 lines in 1 file changed: 22 ins; 2 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/11840.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11840/head:pull/11840 PR: https://git.openjdk.org/jdk/pull/11840 From pminborg at openjdk.org Wed Jan 4 12:43:48 2023 From: pminborg at openjdk.org (Per Minborg) Date: Wed, 4 Jan 2023 12:43:48 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v2] In-Reply-To: References: <8sAs67UpxNzQMAVJdjcF9rl_yc-cwTzW5FvkiywbcKs=.f08bbd9c-2497-4b86-a23e-f400a4d42417@github.com> Message-ID: On Wed, 4 Jan 2023 10:49:18 GMT, Per Minborg wrote: >> Do we need this test at all, because this code is tested to extense through RandomAccessFile? We had no test before, so why add a new one here? >> >> Otherwise: PR looks good. > >> Do we need this test at all, because this code is tested to extense through RandomAccessFile? We had no test before, so why add a new one here? >> >> Otherwise: PR looks good. > > There are overlaps of the RAF and Bits tests but the latter tests additional aspects such as unaligned access and edge cases with exceptions. So, I think we should keep the proposed tests. > @minborg Amazing piece! > > Will `java.lang.invoke.VarHandle` instances be shared in JDK to reuse in other places? > > The [jsoniter-scala-coreJVM](https://github.com/plokhotnyuk/jsoniter-scala/tree/master/jsoniter-scala-core/jvm/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/core) module of the [jsoniter-scala](https://github.com/plokhotnyuk/jsoniter-scala) project has a lot of SWAR tricks that use `java.lang.invoke.VarHandle` to speed up parsing/serialization of primitives, `java.math.BigDecimal`, and `java.time.*` classes from/to textual representation. > > Are you interested to port some of them to JDK as it was done for `java.util.UUID` parsing [here](https://github.com/openjdk/jdk/commit/ebadfaeb2e1cc7b5ce5f101cd8a539bc5478cf5b)? Thanks. I think instances will be private to this class and other have to be created elsewhere if needed. Do you see any concrete examples of classes in the JDK that could benefit from a "VarHandlization"? ------------- PR: https://git.openjdk.org/jdk/pull/11840 From uschindler at openjdk.org Wed Jan 4 12:55:52 2023 From: uschindler at openjdk.org (Uwe Schindler) Date: Wed, 4 Jan 2023 12:55:52 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v4] In-Reply-To: References: Message-ID: <0OsmU1qnzX2pd5GGAZtNzEuawV_74ocKzbWuMHTYvFE=.81834f2e-5515-4bee-965e-024f8aa2c0a7@github.com> On Wed, 4 Jan 2023 12:20:28 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. >> >> Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. >> >> Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. >> >> Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Add special test values for double and float Hi, i checked you new test, but this one does not help with the problem of `Double#doubleToLongBits()` (as defined in the spec of `RandomAccessFile`!) vs the VarHandle, which just puts the raw bits without normalization (see javadocs). Your test only checks with the canonic NaN, which should already be "normalized" so it round trips. Basically it has to be made sure, that `Bits` save any variant of double NaN as `0x7ff8000000000000L` (similar for float). My suggestion is the following. It is unsymmetric, but "correct" accoring to spec: - the read methods are perfectly fine, so they directly read the double/float through its corres?ponding varhandle. - the write method should be reverted to the original version before the patch (they used floatBitsToInt/doubleBitsToLong and delegated to the putLong/putInt - which now uses varhandle). This makes sure that we convert the double/float to its normalized form and then write it as a long. We may add a test to check if the NaN produced by several division operations produce the normalized value in the byte array. Iam not sure what the best way to get de-normalized NaNs. Maybe theres a test around. ------------- PR: https://git.openjdk.org/jdk/pull/11840 From uschindler at openjdk.org Wed Jan 4 12:58:51 2023 From: uschindler at openjdk.org (Uwe Schindler) Date: Wed, 4 Jan 2023 12:58:51 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v4] In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 12:20:28 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. >> >> Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. >> >> Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. >> >> Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Add special test values for double and float Mybe ask somebody from the "double/float/IEEE specialists" around here! ------------- PR: https://git.openjdk.org/jdk/pull/11840 From duke at openjdk.org Wed Jan 4 13:18:49 2023 From: duke at openjdk.org (Andriy Plokhotnyuk) Date: Wed, 4 Jan 2023 13:18:49 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v2] In-Reply-To: References: <8sAs67UpxNzQMAVJdjcF9rl_yc-cwTzW5FvkiywbcKs=.f08bbd9c-2497-4b86-a23e-f400a4d42417@github.com> Message-ID: <6wXWYPWHVU-A9WkczvoDwVm-Ezo0-eBsR9RVLv_2N4M=.d53478ed-d7b9-41df-980f-1f26c67a78bf@github.com> On Wed, 4 Jan 2023 12:40:43 GMT, Per Minborg wrote: > > @minborg Amazing piece! > > Will `java.lang.invoke.VarHandle` instances be shared in JDK to reuse in other places? > > The [jsoniter-scala-coreJVM](https://github.com/plokhotnyuk/jsoniter-scala/tree/master/jsoniter-scala-core/jvm/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/core) module of the [jsoniter-scala](https://github.com/plokhotnyuk/jsoniter-scala) project has a lot of SWAR tricks that use `java.lang.invoke.VarHandle` to speed up parsing/serialization of primitives, `java.math.BigDecimal`, and `java.time.*` classes from/to textual representation. > > Are you interested to port some of them to JDK as it was done for `java.util.UUID` parsing [here](https://github.com/openjdk/jdk/commit/ebadfaeb2e1cc7b5ce5f101cd8a539bc5478cf5b)? > > Thanks. I think instances will be private to this class and other have to be created elsewhere if needed. > > Do you see any concrete examples of classes in the JDK that could benefit from a "VarHandlization"? Basically, places for improvements are `parse(String s)` and `toString` methods of classes mentioned above. When parsing from `String` we can access the internal array of bytes, and for serialization we can create `String` instances from byte arrays without copying using some a kind of `Unsafe` access for both. Please open [`JsonReader`](https://github.com/plokhotnyuk/jsoniter-scala/blob/master/jsoniter-scala-core/jvm/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/core/JsonReader.scala) and [`JsonWriter`](https://github.com/plokhotnyuk/jsoniter-scala/blob/master/jsoniter-scala-core/jvm/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/core/JsonWriter.scala) sources and skim through `ByteArrayAccess` usages there. ------------- PR: https://git.openjdk.org/jdk/pull/11840 From djelinski at openjdk.org Wed Jan 4 13:20:55 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Wed, 4 Jan 2023 13:20:55 GMT Subject: Integrated: 8189338: JMX RMI Remote Mbean server connection hangs if the server stops responding during a SSL Handshake In-Reply-To: References: Message-ID: On Tue, 3 Jan 2023 13:35:32 GMT, Daniel Jeli?ski wrote: > This patch introduces a time limit for establishing a secure connection to a RMI server. > > The existing implementation uses the configured `sun.rmi.transport.tcp.handshakeTimeout` during RMI handshake only; there's no time limit for SSL handshake. > With this patch, the configuration option `sun.rmi.transport.tcp.handshakeTimeout` is also used as a socket read timeout during the SSL handshake. > > I modified the existing `HandshakeTimeout` test to verify both non-SSL and SSL connections; the test passes with my changes, fails without them. > > Existing tier1-3 tests continue to pass. > > While working on the patch I noticed that `conn.isReusable()` always returns true. I can remove all references to `isReusable` here or in another PR; it would simplify the code a bit. This pull request has now been integrated. Changeset: 41900b57 Author: Daniel Jeli?ski URL: https://git.openjdk.org/jdk/commit/41900b57af084e0cfc1453681b24fe5606e11ab2 Stats: 41 lines in 2 files changed: 23 ins; 13 del; 5 mod 8189338: JMX RMI Remote Mbean server connection hangs if the server stops responding during a SSL Handshake Reviewed-by: smarks ------------- PR: https://git.openjdk.org/jdk/pull/11829 From goetz at openjdk.org Wed Jan 4 14:29:30 2023 From: goetz at openjdk.org (Goetz Lindenmaier) Date: Wed, 4 Jan 2023 14:29:30 GMT Subject: RFR: 8299439: [testbug] java/text/Format/NumberFormat/CurrencyFormat.java fails for hr_HR after 1.1.2023 and 8296239 Message-ID: ?fails for hr_HR after 1.1.2023 and 8296239 Hi, this fixes the issue with the currency test. ------------- Commit messages: - 8299439: [testbug] java/text/Format/NumberFormat/CurrencyFormat.java fails for hr_HR after 1.1.2023 and 8296239 Changes: https://git.openjdk.org/jdk/pull/11844/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11844&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299439 Stats: 3 lines in 2 files changed: 0 ins; 2 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/11844.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11844/head:pull/11844 PR: https://git.openjdk.org/jdk/pull/11844 From pminborg at openjdk.org Wed Jan 4 14:37:34 2023 From: pminborg at openjdk.org (Per Minborg) Date: Wed, 4 Jan 2023 14:37:34 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v5] In-Reply-To: References: Message-ID: > Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. > > Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. > > Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. > > Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 Per Minborg has updated the pull request incrementally with one additional commit since the last revision: Use canonical NaN values ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11840/files - new: https://git.openjdk.org/jdk/pull/11840/files/e1f95d83..ec2e7c99 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11840&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11840&range=03-04 Stats: 6 lines in 1 file changed: 4 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/11840.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11840/head:pull/11840 PR: https://git.openjdk.org/jdk/pull/11840 From alanb at openjdk.org Wed Jan 4 14:41:49 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 4 Jan 2023 14:41:49 GMT Subject: RFR: 8299439: [testbug] java/text/Format/NumberFormat/CurrencyFormat.java fails for hr_HR after 1.1.2023 and 8296239 In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 14:21:53 GMT, Goetz Lindenmaier wrote: > ?fails for hr_HR after 1.1.2023 and 8296239 > > Hi, > > this fixes the issue with the currency test. Should this be closed as dup of JDK-8299439 ? ------------- PR: https://git.openjdk.org/jdk/pull/11844 From jpai at openjdk.org Wed Jan 4 14:46:54 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 4 Jan 2023 14:46:54 GMT Subject: RFR: 8258776: ThreadLocal#initialValue() Javadoc is unaware of ThreadLocal#withInitial() Message-ID: Can I please get a review of this doc only change which addresses the javadoc issue noted in https://bugs.openjdk.org/browse/JDK-8258776? As noted in that issue, the `ThreadLocal.initialValue()` API javadoc suggests subclassing `ThreadLocal` and overriding the `initialValue()` method instead of recommending the `withInitial` method that was added in Java 8. The commit here updates the javadoc of `initialValue()` method to note that `withInitial` method is available for use if the programmer wants to provide an initial value. The updated javadoc continues to note that the `ThreadLocal` can be subclassed and the method overriden as the other way of providing an initial value. This change now uses the `@implSpec` construct to state this default behaviour of the `initialValue()` method. Additionally, the `get()` method's javadoc has also been updated to account for the semantics of `initialValue()`. In fact, in its current form, before the changes in this PR, the `get()` method states: > If the current thread does not support thread locals then > this method returns its {@link #initialValue} (or {@code null} > if the {@code initialValue} method is not overridden). which isn't accurate, since the `get()` will return a non-null value if the ThreadLocal was constructed through `ThreadLocal.withInitial`. Here's a trivial code which contradicts this current javadoc: public class Test { public static void main(final String[] args) throws Exception { Thread.ofPlatform().name("hello").allowSetThreadLocals(false).start(() -> { var t = ThreadLocal.withInitial(() -> 2); System.out.println("Thread local value is " + t.get()); }); } } Running this with `java --enable-preview --source 21 Test.java` returns: Thread local value is 2 The updated javadoc of `get()` in this PR now matches the behaviour of this method. I believe this will need a CSR, which I'll open once we have an agreement on these changes. Furthermore, the class level javadoc of `ThreadLocal` has an example of providing an initial value which uses the subclassing strategy. I haven't updated that part. Should we update that to show the `withInitialValue` usage instead (and maybe convert it to a snippet)? ------------- Commit messages: - 8258776: ThreadLocal#initialValue() Javadoc is unaware of ThreadLocal#withInitial() Changes: https://git.openjdk.org/jdk/pull/11846/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11846&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8258776 Stats: 9 lines in 1 file changed: 2 ins; 1 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/11846.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11846/head:pull/11846 PR: https://git.openjdk.org/jdk/pull/11846 From duke at openjdk.org Wed Jan 4 14:49:29 2023 From: duke at openjdk.org (Viktor Klang) Date: Wed, 4 Jan 2023 14:49:29 GMT Subject: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections Message-ID: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> Currently Set.copyOf allocates both a HashSet and a new empty array when the input collection is empty. This patch avoids allocating anything for the case where the parameter collection's isEmpty returns true. ------------- Commit messages: - 8299444: java.util.Set.copyOf allocates needlessly for empty input collections Changes: https://git.openjdk.org/jdk/pull/11847/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11847&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299444 Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/11847.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11847/head:pull/11847 PR: https://git.openjdk.org/jdk/pull/11847 From rriggs at openjdk.org Wed Jan 4 15:00:51 2023 From: rriggs at openjdk.org (Roger Riggs) Date: Wed, 4 Jan 2023 15:00:51 GMT Subject: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections In-Reply-To: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> References: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> Message-ID: <_0EkHdLEYDUuweG8t8yQqZYOhMr002nhkN6hLjduEAE=.7a907322-2a07-45f1-b8d0-a0f22ede7832@github.com> On Wed, 4 Jan 2023 14:41:20 GMT, Viktor Klang wrote: > Currently Set.copyOf allocates both a HashSet and a new empty array when the input collection is empty. > > This patch avoids allocating anything for the case where the parameter collection's isEmpty returns true. LGTM ------------- Marked as reviewed by rriggs (Reviewer). PR: https://git.openjdk.org/jdk/pull/11847 From uschindler at openjdk.org Wed Jan 4 15:03:51 2023 From: uschindler at openjdk.org (Uwe Schindler) Date: Wed, 4 Jan 2023 15:03:51 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v5] In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 14:37:34 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. >> >> Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. >> >> Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. >> >> Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Use canonical NaN values to me latest change looks fine. I would simplify the test setup as Alan said, but this is out of scope of my review. I thought for testing you would use `--patch-module` and inject the test classes into the same package as Bits class? ------------- Marked as reviewed by uschindler (Author). PR: https://git.openjdk.org/jdk/pull/11840 From prappo at openjdk.org Wed Jan 4 15:22:53 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Wed, 4 Jan 2023 15:22:53 GMT Subject: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections In-Reply-To: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> References: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> Message-ID: On Wed, 4 Jan 2023 14:41:20 GMT, Viktor Klang wrote: > Currently Set.copyOf allocates both a HashSet and a new empty array when the input collection is empty. > > This patch avoids allocating anything for the case where the parameter collection's isEmpty returns true. Curious: how bad was that "needless allocation" that it was required to be optimized away? ------------- PR: https://git.openjdk.org/jdk/pull/11847 From pminborg at openjdk.org Wed Jan 4 15:43:46 2023 From: pminborg at openjdk.org (Per Minborg) Date: Wed, 4 Jan 2023 15:43:46 GMT Subject: RFR: 8299513: Cleanup java.io Message-ID: Code in java.io contains many legacy constructs and semantics not recommended including: * C-style array declaration * Unnecessary visibility * Redundant keywords in interfaces (e.g. public, static) * Non-standard naming for constants * Javadoc typos * Missing final declaration These should be fixed as a sanity effort. ------------- Commit messages: - Cleanup ExpiringCache - Cleanup java.io Changes: https://git.openjdk.org/jdk/pull/11848/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11848&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299513 Stats: 236 lines in 25 files changed: 8 ins; 7 del; 221 mod Patch: https://git.openjdk.org/jdk/pull/11848.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11848/head:pull/11848 PR: https://git.openjdk.org/jdk/pull/11848 From duke at openjdk.org Wed Jan 4 15:51:49 2023 From: duke at openjdk.org (Viktor Klang) Date: Wed, 4 Jan 2023 15:51:49 GMT Subject: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections In-Reply-To: References: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> Message-ID: On Wed, 4 Jan 2023 15:20:10 GMT, Pavel Rappo wrote: >> Currently Set.copyOf allocates both a HashSet and a new empty array when the input collection is empty. >> >> This patch avoids allocating anything for the case where the parameter collection's isEmpty returns true. > > Curious: how bad was that "needless allocation" that it was required to be optimized away? @pavelrappo Fair question! I guess it depends on what dominates the benchmark: given that the copyOf methods goes to some length to try to avoid allocating new instances of the immutable sets the proposed patch seemed like rather low-hanging fruit. I found this as I was running some (to be fair, rather specific) benches which drew my attention to it. ------------- PR: https://git.openjdk.org/jdk/pull/11847 From stsypanov at openjdk.org Wed Jan 4 15:56:52 2023 From: stsypanov at openjdk.org (Sergey Tsypanov) Date: Wed, 4 Jan 2023 15:56:52 GMT Subject: RFR: 8299513: Cleanup java.io In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 15:37:23 GMT, Per Minborg wrote: > Code in java.io contains many legacy constructs and semantics not recommended including: > > * C-style array declaration > * Unnecessary visibility > * Redundant keywords in interfaces (e.g. public, static) > * Non-standard naming for constants > * Javadoc typos > * Missing final declaration > > These should be fixed as a sanity effort. src/java.base/share/classes/java/io/StringWriter.java line 244: > 242: > 243: private static int checkSize(int initialSize) { > 244: if (initialSize < 0) { Similar checks exist e.g. in `ByteArrayOutputStream` and `CharWrite`, so could we reuse it somehow across java.io? ------------- PR: https://git.openjdk.org/jdk/pull/11848 From stsypanov at openjdk.org Wed Jan 4 15:57:25 2023 From: stsypanov at openjdk.org (Sergey Tsypanov) Date: Wed, 4 Jan 2023 15:57:25 GMT Subject: RFR: 8299600: Use Objects.check*() where appropriate in java.io Message-ID: Use the following methods instead of hand-written code: - Objects.checkFromIndexSize() - Objects.checkFromToIndex() ------------- Commit messages: - 8299600: Use Objects.check*() where appropriate in java.io - Merge branch 'master' into index-io - Fix - Check from-to in java.io Changes: https://git.openjdk.org/jdk/pull/11849/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11849&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299600 Stats: 37 lines in 6 files changed: 10 ins; 9 del; 18 mod Patch: https://git.openjdk.org/jdk/pull/11849.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11849/head:pull/11849 PR: https://git.openjdk.org/jdk/pull/11849 From djelinski at openjdk.org Wed Jan 4 16:13:53 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Wed, 4 Jan 2023 16:13:53 GMT Subject: RFR: 8294403: [REDO] make test should report only on executed tests [v2] In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 09:15:18 GMT, Aleksey Shipilev wrote: >> This should help to speed up tests significantly. Currently, if we run "make test" with a subset of tests, JTReg would still read the entirety of test root to report on tests that were not run. Even with current suite of tests it gets expensive. If you add more tests to suite -- for example, mounting a large test archive like pre-generated fuzzer tests -- it starts to take a lot of time. >> >> The reasonable default for older jtreg is `-report:executed`. My own CI -- that has millions of tests mounted in `test/` -- was running with `JTREG="OPTIONS=-report:executed"` for years now. [CODETOOLS-7903323](https://bugs.openjdk.org/browse/CODETOOLS-7903323) provides a new reporting option, `-report:files`, which makes this whole business easier. This requires new jtreg. >> >> Motivational improvements: >> >> >> $ time CONF=linux-x86_64-server-release make run-test TEST=gc/epsilon/TestHelloWorld.java >> >> # Default JDK tree >> >> # Baseline >> real 0m9.086s >> user 0m22.857s >> sys 0m4.202s >> >> # Patched >> real 0m6.406s ; +40% faster >> user 0m17.156s >> sys 0m3.193s >> >> # +100K fuzzer tests in tree >> >> # Baseline >> real 3m1.997s >> user 3m16.643s >> sys 0m10.490s >> >> # Patched >> real 0m8.919s ; 20x faster >> user 0m17.904s >> sys 0m4.860s >> >> >> Additional testing: >> - [x] Ad-hoc timing tests (see above) >> - [x] Reproducer from [CODETOOLS-7903331](https://bugs.openjdk.org/browse/CODETOOLS-7903331) >> - [x] Eyeballing the test results on passing tests with REPEAT_COUNT > 1 >> - [x] Eyeballing the test results on intermittently failing tests with RETRY_COUNT > 1 > > Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision: > > Copyright years I like this! $ time make run-test TEST=jdk/java/net/BindException/Test.java: # baseline: real 0m43.176s user 0m12.453s sys 1m13.797s # patched: real 0m22.558s user 0m10.797s sys 1m1.734s ------------- Marked as reviewed by djelinski (Committer). PR: https://git.openjdk.org/jdk/pull/11824 From shade at openjdk.org Wed Jan 4 16:25:50 2023 From: shade at openjdk.org (Aleksey Shipilev) Date: Wed, 4 Jan 2023 16:25:50 GMT Subject: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections In-Reply-To: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> References: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> Message-ID: On Wed, 4 Jan 2023 14:41:20 GMT, Viktor Klang wrote: > Currently Set.copyOf allocates both a HashSet and a new empty array when the input collection is empty. > > This patch avoids allocating anything for the case where the parameter collection's isEmpty returns true. Looks okay. This relies a bit on `isEmpty()` to be actually fast, but it seems unlikely it would be worse than doing the `toArray()`. `Map.copyOf` has the same opportunity. ------------- Marked as reviewed by shade (Reviewer). PR: https://git.openjdk.org/jdk/pull/11847 From goetz at openjdk.org Wed Jan 4 16:29:59 2023 From: goetz at openjdk.org (Goetz Lindenmaier) Date: Wed, 4 Jan 2023 16:29:59 GMT Subject: Withdrawn: 8299439: [testbug] java/text/Format/NumberFormat/CurrencyFormat.java fails for hr_HR after 1.1.2023 and 8296239 In-Reply-To: References: Message-ID: <2N0XGWndgxMA6VZ1Yk1wJIoQ4Vu1aRC4kYJunrN6iH8=.d5c3afd3-3e38-436b-9f1e-c3c48e7c94bf@github.com> On Wed, 4 Jan 2023 14:21:53 GMT, Goetz Lindenmaier wrote: > ?fails for hr_HR after 1.1.2023 and 8296239 > > Hi, > > this fixes the issue with the currency test. This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/jdk/pull/11844 From goetz at openjdk.org Wed Jan 4 16:29:58 2023 From: goetz at openjdk.org (Goetz Lindenmaier) Date: Wed, 4 Jan 2023 16:29:58 GMT Subject: RFR: 8299439: [testbug] java/text/Format/NumberFormat/CurrencyFormat.java fails for hr_HR after 1.1.2023 and 8296239 In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 14:38:34 GMT, Alan Bateman wrote: >> ?fails for hr_HR after 1.1.2023 and 8296239 >> >> Hi, >> >> this fixes the issue with the currency test. > > Should this be closed as dup of pull/11833 ? @AlanBateman, sorry, I missed that other PR. ------------- PR: https://git.openjdk.org/jdk/pull/11844 From mernst at openjdk.org Wed Jan 4 16:35:41 2023 From: mernst at openjdk.org (Michael Ernst) Date: Wed, 4 Jan 2023 16:35:41 GMT Subject: RFR: 8299563: Fix typos [v4] In-Reply-To: References: Message-ID: > 8299563: Fix typos Michael Ernst has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains ten commits: - Address review feedback - Merge ../jdk-openjdk into typos-typos - Merge ../jdk-openjdk into typos-typos - Reinstate typos in Apache code that is copied into the JDK - Merge ../jdk-openjdk into typos-typos - Remove file that was removed upstream - Fix inconsistency in capitalization - Undo change in zlip - Fix typos ------------- Changes: https://git.openjdk.org/jdk/pull/10029/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10029&range=03 Stats: 5 lines in 5 files changed: 0 ins; 0 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/10029.diff Fetch: git fetch https://git.openjdk.org/jdk pull/10029/head:pull/10029 PR: https://git.openjdk.org/jdk/pull/10029 From alanb at openjdk.org Wed Jan 4 16:38:50 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 4 Jan 2023 16:38:50 GMT Subject: RFR: 8299513: Cleanup java.io In-Reply-To: References: Message-ID: <2NZo3Ve-SeyOMN_R9Un9l8HBEkKi8yOIfNPVqWfsHto=.2f6f5766-3078-43ad-89e5-e97fcebf9e04@github.com> On Wed, 4 Jan 2023 15:54:29 GMT, Sergey Tsypanov wrote: >> Code in java.io contains many legacy constructs and semantics not recommended including: >> >> * C-style array declaration >> * Unnecessary visibility >> * Redundant keywords in interfaces (e.g. public, static) >> * Non-standard naming for constants >> * Javadoc typos >> * Missing final declaration >> >> These should be fixed as a sanity effort. > > src/java.base/share/classes/java/io/StringWriter.java line 244: > >> 242: >> 243: private static int checkSize(int initialSize) { >> 244: if (initialSize < 0) { > > Similar checks exist e.g. in `ByteArrayOutputStream` and `CharWrite`, so could we reuse it somehow across java.io? I assume this is done so that "lock" is only set once during construction (StringWriter is a bit unusual in that it uses the SB as the lock object). A downside of the change is that it introduces casts. Another is that the expression to super is a bi complicated and forces the reader to locate checkSize at the end of the file to find the code specified by the constructor. So two minds on this part, maybe it should be left unchanged. ------------- PR: https://git.openjdk.org/jdk/pull/11848 From lancea at openjdk.org Wed Jan 4 16:41:55 2023 From: lancea at openjdk.org (Lance Andersen) Date: Wed, 4 Jan 2023 16:41:55 GMT Subject: RFR: 8299563: Fix typos [v4] In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 16:35:41 GMT, Michael Ernst wrote: >> 8299563: Fix typos > > Michael Ernst has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains ten commits: > > - Address review feedback > - Merge ../jdk-openjdk into typos-typos > - Merge ../jdk-openjdk into typos-typos > - Reinstate typos in Apache code that is copied into the JDK > - Merge ../jdk-openjdk into typos-typos > - Remove file that was removed upstream > - Fix inconsistency in capitalization > - Undo change in zlip > - Fix typos Marked as reviewed by lancea (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/10029 From mandy.chung at oracle.com Wed Jan 4 19:27:11 2023 From: mandy.chung at oracle.com (mandy.chung at oracle.com) Date: Wed, 4 Jan 2023 11:27:11 -0800 Subject: jdeps - option to to analyze package-private API In-Reply-To: <68ef4409-114d-b2d2-9f9f-fc3121c2f7ff@oracle.com> References: <2dd880da-6ddc-302e-2e03-504b4171f484@oracle.com> <68ef4409-114d-b2d2-9f9f-fc3121c2f7ff@oracle.com> Message-ID: <6d952ac5-41a6-4e4e-66df-9c8a564eaf10@oracle.com> On 12/12/22 7:26 AM, Alan Bateman wrote: > On 03/12/2022 18:15, Matej Turcel wrote: >> : >> >> So far, jdeps with the --api-only flag seems like the perfect tool, >> except >> there is a little problem -- we have packages (dozens of them) which >> exist in multiple modules. For example, package `com.foo` exists in >> three separate modules (meaning each of these modules has a class in >> that >> package). That means package-private "stuff" (members + >> constructor/method >> signatures) is a part of module's API. So to infer correct types of >> gradle >> module dependencies using jdeps, we need jdeps to consider >> package-private >> stuff a part of the API. > > The scenario seems a bit unusual in that API elements with package > access aren't usually considered to be part of the API. Does the > javadoc published for users of these components include the API > elements with package access?? I realize Gradle may define "module" to > mean something else but for the Java platform, a module is a set of > packages. > > I haven't seen any opinions from others but my initial reaction is > that it wouldn't be a good idea to change --api-only to consider API > elements with package access to be part of the API. If jdeps were > changed then it would need a new option. I also agree that it's not a good idea to change --api-only as this option is meant to find dependencies from exported packages and the module's API. I considered in the past to provide options similar to javadoc -package, -private, -protected, -public that specify if private/package/protected/public types and members are shown. --api-only is like javadoc -protected and it analyzes protected/public types and members.?? I'm open to add jdeps options similar to javadoc -package, -private, -protected, -public but a different name since jdeps -package is used already.?? More consideration would be needed if this should restrict to exported packages and how to select other packages. Mandy From smarks at openjdk.org Wed Jan 4 19:41:48 2023 From: smarks at openjdk.org (Stuart Marks) Date: Wed, 4 Jan 2023 19:41:48 GMT Subject: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections In-Reply-To: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> References: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> Message-ID: On Wed, 4 Jan 2023 14:41:20 GMT, Viktor Klang wrote: > Currently Set.copyOf allocates both a HashSet and a new empty array when the input collection is empty. > > This patch avoids allocating anything for the case where the parameter collection's isEmpty returns true. There's no regression test. However, with the current code (prior to this change) a call to `Set.of(zeroLengthArray)` returns the same instance as `Set.of()`, so it's difficult to write a simple functional test for this change. The test would have to assert that "no HashSet is allocated along this code path" which is much harder to test and frankly probably isn't worth it. So, please add one of the `noreg-*` labels to the bug to indicate the rationale for omitting a regression test. https://openjdk.org/guide/#jbs-label-dictionary I'd probably add the `Map.copyOf` change to this PR to avoid some bug/PR/review overhead. Thanks for mentioning this @shipilev. ------------- PR: https://git.openjdk.org/jdk/pull/11847 From swpalmer at openjdk.org Wed Jan 4 19:55:48 2023 From: swpalmer at openjdk.org (Scott Palmer) Date: Wed, 4 Jan 2023 19:55:48 GMT Subject: RFR: 8299600: Use Objects.check*() where appropriate in java.io In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 15:50:35 GMT, Sergey Tsypanov wrote: > Use the following methods instead of hand-written code: > - Objects.checkFromIndexSize() > - Objects.checkFromToIndex() src/java.base/share/classes/java/io/CharArrayWriter.java line 101: > 99: */ > 100: public void write(char[] c, int off, int len) { > 101: Objects.checkFromToIndex(off, len, c.length); shouldn't that be Objects.checkFromIndexSize(off, len, c.length); ------------- PR: https://git.openjdk.org/jdk/pull/11849 From aivanov at openjdk.org Wed Jan 4 19:56:59 2023 From: aivanov at openjdk.org (Alexey Ivanov) Date: Wed, 4 Jan 2023 19:56:59 GMT Subject: RFR: 8299563: Fix typos [v4] In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 16:35:41 GMT, Michael Ernst wrote: >> 8299563: Fix typos > > Michael Ernst has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains ten commits: > > - Address review feedback > - Merge ../jdk-openjdk into typos-typos > - Merge ../jdk-openjdk into typos-typos > - Reinstate typos in Apache code that is copied into the JDK > - Merge ../jdk-openjdk into typos-typos > - Remove file that was removed upstream > - Fix inconsistency in capitalization > - Undo change in zlip > - Fix typos Marked as reviewed by aivanov (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/10029 From mernst at openjdk.org Wed Jan 4 20:02:57 2023 From: mernst at openjdk.org (Michael Ernst) Date: Wed, 4 Jan 2023 20:02:57 GMT Subject: Integrated: 8299563: Fix typos In-Reply-To: References: Message-ID: On Thu, 25 Aug 2022 15:35:53 GMT, Michael Ernst wrote: > 8299563: Fix typos This pull request has now been integrated. Changeset: 7dcc6899 Author: Michael Ernst Committer: Alexey Ivanov URL: https://git.openjdk.org/jdk/commit/7dcc689932ea276586282e0917f2efc10a598eb7 Stats: 5 lines in 5 files changed: 0 ins; 0 del; 5 mod 8299563: Fix typos Reviewed-by: lancea, aivanov, sspitsyn ------------- PR: https://git.openjdk.org/jdk/pull/10029 From naoto at openjdk.org Wed Jan 4 20:09:35 2023 From: naoto at openjdk.org (Naoto Sato) Date: Wed, 4 Jan 2023 20:09:35 GMT Subject: RFR: 8299292: Missing elements in aliased String array Message-ID: This is a pre-requisite fix for upgrading CLDR to v43. The upcoming CLDR changed the inheritance mechanism a bit with this change: https://unicode-org.atlassian.net/browse/CLDR-15054 where they removed the duplication of data. This revealed an issue in CLDRConverter buildtool that it was not capable of inheriting the partially populated, aliased elements in an array object. This changeset also removed the unused logging code. ------------- Commit messages: - copyright year - 8299292: Missing elements in aliased String array Changes: https://git.openjdk.org/jdk/pull/11851/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11851&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299292 Stats: 16 lines in 1 file changed: 6 ins; 4 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/11851.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11851/head:pull/11851 PR: https://git.openjdk.org/jdk/pull/11851 From alanb at openjdk.org Wed Jan 4 20:16:50 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 4 Jan 2023 20:16:50 GMT Subject: RFR: 8258776: ThreadLocal#initialValue() Javadoc is unaware of ThreadLocal#withInitial() In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 14:37:13 GMT, Jaikiran Pai wrote: > Can I please get a review of this doc only change which addresses the javadoc issue noted in https://bugs.openjdk.org/browse/JDK-8258776? > > As noted in that issue, the `ThreadLocal.initialValue()` API javadoc suggests subclassing `ThreadLocal` and overriding the `initialValue()` method instead of recommending the `withInitial` method that was added in Java 8. > > The commit here updates the javadoc of `initialValue()` method to note that `withInitial` method is available for use if the programmer wants to provide an initial value. The updated javadoc continues to note that the `ThreadLocal` can be subclassed and the method overriden as the other way of providing an initial value. This change now uses the `@implSpec` construct to state this default behaviour of the `initialValue()` method. > > Additionally, the `get()` method's javadoc has also been updated to account for the semantics of `initialValue()`. In fact, in its current form, before the changes in this PR, the `get()` method states: > >> If the current thread does not support thread locals then >> this method returns its {@link #initialValue} (or {@code null} >> if the {@code initialValue} method is not overridden). > > which isn't accurate, since the `get()` will return a non-null value if the ThreadLocal was constructed through `ThreadLocal.withInitial`. Here's a trivial code which contradicts this current javadoc: > > > public class Test { > public static void main(final String[] args) throws Exception { > Thread.ofPlatform().name("hello").allowSetThreadLocals(false).start(() -> { > var t = ThreadLocal.withInitial(() -> 2); > System.out.println("Thread local value is " + t.get()); > }); > } > } > > Running this with `java --enable-preview --source 21 Test.java` returns: > > Thread local value is 2 > > > The updated javadoc of `get()` in this PR now matches the behaviour of this method. I believe this will need a CSR, which I'll open once we have an agreement on these changes. > > Furthermore, the class level javadoc of `ThreadLocal` has an example of providing an initial value which uses the subclassing strategy. I haven't updated that part. Should we update that to show the `withInitialValue` usage instead (and maybe convert it to a snippet)? src/java.base/share/classes/java/lang/ThreadLocal.java line 128: > 126: * value other than {@code null}, then either {@code ThreadLocal} can be > 127: * subclassed and this method overridden or {@link ThreadLocal#withInitial(Supplier)} method > 128: * can be used to construct a {@code ThreadLocal}. This looks okay but maybe slightly better to say "or the method withInitial(Supplier) can be used ...". I think you can probably reflow this paragraph to avoid having a mix of short and long lines. ------------- PR: https://git.openjdk.org/jdk/pull/11846 From iris at openjdk.org Wed Jan 4 20:34:50 2023 From: iris at openjdk.org (Iris Clark) Date: Wed, 4 Jan 2023 20:34:50 GMT Subject: RFR: 8299292: Missing elements in aliased String array In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 19:57:56 GMT, Naoto Sato wrote: > This is a pre-requisite fix for upgrading CLDR to v43. The upcoming CLDR changed the inheritance mechanism a bit with this change: https://unicode-org.atlassian.net/browse/CLDR-15054 where they removed the duplication of data. This revealed an issue in CLDRConverter buildtool that it was not capable of inheriting the partially populated, aliased elements in an array object. This changeset also removed the unused logging code. Marked as reviewed by iris (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11851 From naoto at openjdk.org Wed Jan 4 21:04:08 2023 From: naoto at openjdk.org (Naoto Sato) Date: Wed, 4 Jan 2023 21:04:08 GMT Subject: RFR: 8299292: Missing elements in aliased String array [v2] In-Reply-To: References: Message-ID: > This is a pre-requisite fix for upgrading CLDR to v43. The upcoming CLDR changed the inheritance mechanism a bit with this change: https://unicode-org.atlassian.net/browse/CLDR-15054 where they removed the duplication of data. This revealed an issue in CLDRConverter buildtool that it was not capable of inheriting the partially populated, aliased elements in an array object. This changeset also removed the unused logging code. Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: Removed unnecessary variable ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11851/files - new: https://git.openjdk.org/jdk/pull/11851/files/92dff5df..e6ce0791 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11851&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11851&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 1 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/11851.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11851/head:pull/11851 PR: https://git.openjdk.org/jdk/pull/11851 From smarks at openjdk.org Wed Jan 4 21:06:50 2023 From: smarks at openjdk.org (Stuart Marks) Date: Wed, 4 Jan 2023 21:06:50 GMT Subject: RFR: 8294693: Add Collections.shuffle overload that accepts RandomGenerator interface [v3] In-Reply-To: References: Message-ID: <8MneENxi9GalyMU7i_5nxNO5KwYe3XysjrxWC3CBYnU=.b8ff4d8c-11f0-4c50-aa29-fd7a96c17309@github.com> On Wed, 12 Oct 2022 13:26:29 GMT, Tagir F. Valeev wrote: >> Java 17 added RandomGenerator interface. However, existing method Collections.shuffle accepts old java.util.Random class. While since Java 19, it's possible to use Random.from(RandomGenerator) wrapper, it would be more convenient to provide direct overload shuffle(List list, RandomGenerator rnd). > > Tagir F. Valeev has updated the pull request incrementally with one additional commit since the last revision: > > Fixes according to review > > 1. Reduce duplication in tests > 2. Use JumpableGenerator#copy() instead of create(1) in tests, as according to the spec, seed can be ignored > 3. Simplify documentation for shuffle(List, Random) to avoid duplication. Sorry, this got derailed by the discussion of `SequencedCollection::replaceAll`. I think we should just set that issue aside. I don't think `SequencedCollection::replaceAll` makes sense, thus this PR shouldn't be held up on its account. The change is fine in concept. A couple adjustments needs to be made: javadoc since-tags need to be updated to 21, and copyrights updated to 2023. (Well, maybe an argument could be made that they should stay at 2022. I don't particularly care.) Also, the CSR should be updated to reflect the changes to the specifications. Other than those items, this should be fine to move forward. ------------- PR: https://git.openjdk.org/jdk/pull/10520 From jcking at openjdk.org Wed Jan 4 21:26:53 2023 From: jcking at openjdk.org (Justin King) Date: Wed, 4 Jan 2023 21:26:53 GMT Subject: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v10] In-Reply-To: References: Message-ID: On Sat, 17 Dec 2022 06:39:48 GMT, Justin King wrote: >> Allow building OpenJDK with UBSan. Currently the build fails when optimizing the image due to lots of undefined behavior (it invokes the built JVM). Follow up PRs will either replace the undefined behavior with well defined behavior or suppress errors which are intentional. The goal is to make OpenJDK more well defined and thus more portable across compilers and architectures. > > Justin King has updated the pull request incrementally with one additional commit since the last revision: > > Delete unintended addition of files from previous commit > > Signed-off-by: Justin King Friendly poke. ------------- PR: https://git.openjdk.org/jdk/pull/11604 From jvernee at openjdk.org Wed Jan 4 21:33:56 2023 From: jvernee at openjdk.org (Jorn Vernee) Date: Wed, 4 Jan 2023 21:33:56 GMT Subject: [jdk20] RFR: 8299561: VaList.empty() doesn't return a list associated with the global scope In-Reply-To: References: Message-ID: <0DoOfsNpZAGVRuNkDkug0SebF9A93C7jj6pesYUBO_0=.eb29e9e2-6e06-490b-8009-567e1a5a6f99@github.com> On Wed, 4 Jan 2023 10:49:09 GMT, Maurizio Cimadamore wrote: > This patch fixes a long-standing conformance issue: `VaList.empty` is specified to return a `VaList` associated with the global scope, but in some platforms (Aarch64/Linux and x64/Linux) the empty list is associated with an implicit scope instead. > > This doesn't make a lot of difference, given that the empty list is always stored in a static final in the underlying implementation - that said, it would be a good thing to rectify this conformance issue. Marked as reviewed by jvernee (Reviewer). ------------- PR: https://git.openjdk.org/jdk20/pull/82 From smarks at openjdk.org Wed Jan 4 21:34:53 2023 From: smarks at openjdk.org (Stuart Marks) Date: Wed, 4 Jan 2023 21:34:53 GMT Subject: RFR: 8294693: Add Collections.shuffle overload that accepts RandomGenerator interface [v3] In-Reply-To: References: Message-ID: On Sat, 3 Dec 2022 08:23:34 GMT, Tagir F. Valeev wrote: >> Tagir F. Valeev has updated the pull request incrementally with one additional commit since the last revision: >> >> Fixes according to review >> >> 1. Reduce duplication in tests >> 2. Use JumpableGenerator#copy() instead of create(1) in tests, as according to the spec, seed can be ignored >> 3. Simplify documentation for shuffle(List, Random) to avoid duplication. > > A gentle ping: please review the change and the CSR. Thanks. @amaembo a couple comments on the test. The test should probably have `@key randomness` added to it. On 2022-10-28, @bplb wrote: > jdk.test.lib.RandomFactory can be used to generate a reproducible sequence of random numbers. An example of its use may be seen for example in java/nio/file/Files/CopyAndMove.java This bit of the test library is useful if the test is testing a random subset of the state space. It prints out the random seed on each run so that if one of the test cases fails, it's possible to reproduce it by supplying the same seed. However, it's restricted to Random and SplittableRandom, and we want to test something like Xoshiro256PlusPlus that is a RandomGenerator but not a Random. So maybe this test library can't be applied. However, take a look and see if you think it might be useful to use it. ------------- PR: https://git.openjdk.org/jdk/pull/10520 From duke at openjdk.org Wed Jan 4 22:01:55 2023 From: duke at openjdk.org (Justin Lu) Date: Wed, 4 Jan 2023 22:01:55 GMT Subject: Integrated: 8299439: java/text/Format/NumberFormat/CurrencyFormat.java fails for hr_HR In-Reply-To: References: Message-ID: On Tue, 3 Jan 2023 17:40:42 GMT, Justin Lu wrote: > Regression caused by the fix to [JDK-8296239](https://bugs.openjdk.org/browse/JDK-8296239). The ISO 4217 Amendment 174 Update changes went into effect starting in 2023. > > _java/text/Format/NumberFormat/CurrencyFormat.java_ fails as _java/text/Format/NumberFormat/CurrencySymbols.properties_ did not have the proper change from the Amendment 174 update as well. > > Swapping the outdated **Kn** to **EUR** matches the Amendment 174 update, and fixes the failing test. This pull request has now been integrated. Changeset: 3b374c01 Author: Justin Lu Committer: Naoto Sato URL: https://git.openjdk.org/jdk/commit/3b374c0153950ab193f3a188b57d3404b4ce2fe2 Stats: 8 lines in 3 files changed: 1 ins; 2 del; 5 mod 8299439: java/text/Format/NumberFormat/CurrencyFormat.java fails for hr_HR Reviewed-by: naoto, lancea, jpai ------------- PR: https://git.openjdk.org/jdk/pull/11833 From bpb at openjdk.org Wed Jan 4 22:19:49 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Wed, 4 Jan 2023 22:19:49 GMT Subject: RFR: 8299600: Use Objects.check*() where appropriate in java.io In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 19:52:07 GMT, Scott Palmer wrote: >> Use the following methods instead of hand-written code: >> - Objects.checkFromIndexSize() >> - Objects.checkFromToIndex() > > src/java.base/share/classes/java/io/CharArrayWriter.java line 101: > >> 99: */ >> 100: public void write(char[] c, int off, int len) { >> 101: Objects.checkFromToIndex(off, len, c.length); > > shouldn't that be Objects.checkFromIndexSize(off, len, c.length); It looks like all the occurrences of `checkFromToIndex()` should instead be `checkFromIndexSize()`. ------------- PR: https://git.openjdk.org/jdk/pull/11849 From mernst at openjdk.org Wed Jan 4 22:38:03 2023 From: mernst at openjdk.org (Michael Ernst) Date: Wed, 4 Jan 2023 22:38:03 GMT Subject: RFR: 8299563: Fix typos [v3] In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 01:19:52 GMT, Jaikiran Pai wrote: >> Michael Ernst has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains seven commits: >> >> - Merge ../jdk-openjdk into typos-typos >> - Reinstate typos in Apache code that is copied into the JDK >> - Merge ../jdk-openjdk into typos-typos >> - Remove file that was removed upstream >> - Fix inconsistency in capitalization >> - Undo change in zlip >> - Fix typos > > Hello Michael, I've created https://bugs.openjdk.org/browse/JDK-8299563 to track this final few typos. Could you please update the title of this PR to `8299563: Fix typos`? That should then allow you to proceed using this PR. Please also merge with latest master branch once more since some typo fixes from this PR have been merged recently. Thank you for your patience. Thank you @jaikiran @LanceAndersen @aivanov-jdk ! ------------- PR: https://git.openjdk.org/jdk/pull/10029 From joehw at openjdk.org Wed Jan 4 23:25:48 2023 From: joehw at openjdk.org (Joe Wang) Date: Wed, 4 Jan 2023 23:25:48 GMT Subject: RFR: 8299292: Missing elements in aliased String array [v2] In-Reply-To: References: Message-ID: <6DJRZtp42WHncOzRjdVf74PFqgZr3K3mF3OpcjNoAqA=.386862b7-cac6-46db-a8ac-595da10a947b@github.com> On Wed, 4 Jan 2023 21:04:08 GMT, Naoto Sato wrote: >> This is a pre-requisite fix for upgrading CLDR to v43. The upcoming CLDR changed the inheritance mechanism a bit with this change: https://unicode-org.atlassian.net/browse/CLDR-15054 where they removed the duplication of data. This revealed an issue in CLDRConverter buildtool that it was not capable of inheriting the partially populated, aliased elements in an array object. This changeset also removed the unused logging code. > > Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: > > Removed unnecessary variable Marked as reviewed by joehw (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11851 From serb at openjdk.org Thu Jan 5 01:04:48 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Thu, 5 Jan 2023 01:04:48 GMT Subject: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections In-Reply-To: References: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> Message-ID: On Wed, 4 Jan 2023 19:39:23 GMT, Stuart Marks wrote: > so it's difficult to write a simple functional test for this change. It is possible to track that for some "custom" and empty collection the only method will be called is `isEmpty` and nothing else. Not sure how it is useful or not. ------------- PR: https://git.openjdk.org/jdk/pull/11847 From iris at openjdk.org Thu Jan 5 01:26:49 2023 From: iris at openjdk.org (Iris Clark) Date: Thu, 5 Jan 2023 01:26:49 GMT Subject: RFR: 8299292: Missing elements in aliased String array [v2] In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 21:04:08 GMT, Naoto Sato wrote: >> This is a pre-requisite fix for upgrading CLDR to v43. The upcoming CLDR changed the inheritance mechanism a bit with this change: https://unicode-org.atlassian.net/browse/CLDR-15054 where they removed the duplication of data. This revealed an issue in CLDRConverter buildtool that it was not capable of inheriting the partially populated, aliased elements in an array object. This changeset also removed the unused logging code. > > Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: > > Removed unnecessary variable Marked as reviewed by iris (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11851 From bpb at openjdk.org Thu Jan 5 01:39:52 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Thu, 5 Jan 2023 01:39:52 GMT Subject: RFR: 8299600: Use Objects.check*() where appropriate in java.io In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 22:16:37 GMT, Brian Burkhalter wrote: >> src/java.base/share/classes/java/io/CharArrayWriter.java line 101: >> >>> 99: */ >>> 100: public void write(char[] c, int off, int len) { >>> 101: Objects.checkFromToIndex(off, len, c.length); >> >> shouldn't that be Objects.checkFromIndexSize(off, len, c.length); > > It looks like all the occurrences of `checkFromToIndex()` should instead be `checkFromIndexSize()`. Indeed there are at least four regression test failures with this as-is: - java/io/InputStream/ReadParams.java - java/io/OutputStream/WriteParams.java - java/io/Writer/WriteParams.java - java/nio/channels/FileChannel/Transfer2GPlus.java ------------- PR: https://git.openjdk.org/jdk/pull/11849 From bpb at openjdk.org Thu Jan 5 01:44:49 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Thu, 5 Jan 2023 01:44:49 GMT Subject: RFR: 8299513: Cleanup java.io In-Reply-To: <2NZo3Ve-SeyOMN_R9Un9l8HBEkKi8yOIfNPVqWfsHto=.2f6f5766-3078-43ad-89e5-e97fcebf9e04@github.com> References: <2NZo3Ve-SeyOMN_R9Un9l8HBEkKi8yOIfNPVqWfsHto=.2f6f5766-3078-43ad-89e5-e97fcebf9e04@github.com> Message-ID: On Wed, 4 Jan 2023 16:35:57 GMT, Alan Bateman wrote: >> src/java.base/share/classes/java/io/StringWriter.java line 244: >> >>> 242: >>> 243: private static int checkSize(int initialSize) { >>> 244: if (initialSize < 0) { >> >> Similar checks exist e.g. in `ByteArrayOutputStream` and `CharWrite`, so could we reuse it somehow across java.io? > > I assume this is done so that "lock" is only set once during construction (StringWriter is a bit unusual in that it uses the SB as the lock object). A downside of the change is that it introduces casts. Another is that the expression to super is a bit complicated and forces the reader to locate checkSize at the end of the file to find the check/exception specified by the constructor. So two minds on this part, maybe it should be left unchanged. I think the casts are worth it to set `lock` only once during construction, but would be inclined to leave out the addition of `checkSize`. ------------- PR: https://git.openjdk.org/jdk/pull/11848 From alanb at openjdk.org Thu Jan 5 07:14:48 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 5 Jan 2023 07:14:48 GMT Subject: RFR: 8299600: Use Objects.check*() where appropriate in java.io In-Reply-To: References: Message-ID: On Thu, 5 Jan 2023 01:36:51 GMT, Brian Burkhalter wrote: > Indeed there are at least four regression test failures with this as-is: > > * java/io/InputStream/ReadParams.java > * java/io/OutputStream/WriteParams.java > * java/io/Writer/WriteParams.java > * java/nio/channels/FileChannel/Transfer2GPlus.java The java/io tests run in tier2 and I think the GHA only run tier1. ------------- PR: https://git.openjdk.org/jdk/pull/11849 From rehn at openjdk.org Thu Jan 5 07:28:51 2023 From: rehn at openjdk.org (Robbin Ehn) Date: Thu, 5 Jan 2023 07:28:51 GMT Subject: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v8] In-Reply-To: References: Message-ID: On Fri, 16 Dec 2022 16:10:10 GMT, Magnus Ihse Bursie wrote: >> Justin King has updated the pull request incrementally with one additional commit since the last revision: >> >> Simplify logic for including __ubsan_default_options >> >> Signed-off-by: Justin King > > I much also check: is this really needed for *all* executables we make? I would have guessed that it would suffice with the "launchers", i.e. like `java`, `javac`, `jar` etc. These are all compiled from a single source file, `src/java.base/share/native/launcher/main.c`, with different defines depending on what Java classes it should actually launch, and with different output names. > > Doing things this way will also affect non-launcher executables, like `jabswitch`, `msiwrapper` and all executable test binaries. > > That might be correct, but I could not be certain of that from trying to read the backlog of discussion in this bug. I think @magicus is back next week. Since this is mainly build stuff I'll sit this one out. ------------- PR: https://git.openjdk.org/jdk/pull/11604 From mbaesken at openjdk.org Thu Jan 5 09:02:31 2023 From: mbaesken at openjdk.org (Matthias Baesken) Date: Thu, 5 Jan 2023 09:02:31 GMT Subject: RFR: JDK-8299657: sun/tools/jhsdb/SAGetoptTest.java fails after 8299470 Message-ID: <3I_VXTEXKOXBIBw9LFmd_qYEm3eA4_xRx-RzcoDqg44=.408773f2-6e46-4948-ba68-10256fcfe633@github.com> Some exception/error message changed with 8299470 so we have to adjust the test. Current error is Unexpected error 'Successor argument without leading - is expected for 'd' but we got '-c'' java.lang.RuntimeException: Bad option test 4 failed at SAGetoptTest.badOptionsTest(SAGetoptTest.java:124) at SAGetoptTest.main(SAGetoptTest.java:149) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:578) at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:125) at java.base/java.lang.Thread.run(Thread.java:1623) ------------- Commit messages: - JDK-8299657 Changes: https://git.openjdk.org/jdk/pull/11860/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11860&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299657 Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/11860.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11860/head:pull/11860 PR: https://git.openjdk.org/jdk/pull/11860 From mcimadamore at openjdk.org Thu Jan 5 09:48:01 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Thu, 5 Jan 2023 09:48:01 GMT Subject: [jdk20] Integrated: 8299561: VaList.empty() doesn't return a list associated with the global scope In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 10:49:09 GMT, Maurizio Cimadamore wrote: > This patch fixes a long-standing conformance issue: `VaList.empty` is specified to return a `VaList` associated with the global scope, but in some platforms (Aarch64/Linux and x64/Linux) the empty list is associated with an implicit scope instead. > > This doesn't make a lot of difference, given that the empty list is always stored in a static final in the underlying implementation - that said, it would be a good thing to rectify this conformance issue. This pull request has now been integrated. Changeset: 9c4ed16b Author: Maurizio Cimadamore URL: https://git.openjdk.org/jdk20/commit/9c4ed16be2fdb20f2917a6e8efacfbb30d3118b1 Stats: 6 lines in 3 files changed: 4 ins; 0 del; 2 mod 8299561: VaList.empty() doesn't return a list associated with the global scope Reviewed-by: jvernee ------------- PR: https://git.openjdk.org/jdk20/pull/82 From rgiulietti at openjdk.org Thu Jan 5 11:08:52 2023 From: rgiulietti at openjdk.org (Raffaello Giulietti) Date: Thu, 5 Jan 2023 11:08:52 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v5] In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 14:37:34 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. >> >> Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. >> >> Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. >> >> Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Use canonical NaN values AFAIU from the doc, for `get()` and `set()` access modes as used here, a misalignment is not a problem and will not throw `IllegalStateException`. ------------- PR: https://git.openjdk.org/jdk/pull/11840 From uschindler at openjdk.org Thu Jan 5 11:40:52 2023 From: uschindler at openjdk.org (Uwe Schindler) Date: Thu, 5 Jan 2023 11:40:52 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v5] In-Reply-To: References: Message-ID: <98nL72fsyJ98-yaqfBRcnzM1fAfNq2wiCpOqTb8oFgI=.16e6c04d-e171-43d4-a566-48d1894b29b1@github.com> On Wed, 4 Jan 2023 14:37:34 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. >> >> Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. >> >> Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. >> >> Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Use canonical NaN values The copypasted snippet above is misleading, you need to read the whole statement, so an IllegalStateException can only happen for unaligned access on access modes other than get/set (so volatile or opaque reads): "If access is misaligned then access for anything **other than the get and set access modes** will result in an IllegalStateException.", the sentence you posted is about if it is atomic or not. It just says that on 32 bits, long/double are not atomic for normal set/get. P.S.: We definitely know that it works on 32 bit, the whole code of Lucene is full of those VarHandles :-) ------------- PR: https://git.openjdk.org/jdk/pull/11840 From duke at openjdk.org Thu Jan 5 11:44:56 2023 From: duke at openjdk.org (Viktor Klang) Date: Thu, 5 Jan 2023 11:44:56 GMT Subject: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections In-Reply-To: References: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> Message-ID: On Thu, 5 Jan 2023 01:02:11 GMT, Sergey Bylokhov wrote: >> There's no regression test. However, with the current code (prior to this change) a call to `Set.of(zeroLengthArray)` returns the same instance as `Set.of()`, so it's difficult to write a simple functional test for this change. The test would have to assert that "no HashSet is allocated along this code path" which is much harder to test and frankly probably isn't worth it. So, please add one of the `noreg-*` labels to the bug to indicate the rationale for omitting a regression test. >> >> https://openjdk.org/guide/#jbs-label-dictionary >> >> I'd probably add the `Map.copyOf` change to this PR to avoid some bug/PR/review overhead. Thanks for mentioning this @shipilev. > >> so it's difficult to write a simple functional test for this change. > > It is possible to track that for some "custom" and empty collection the only method will be called is `isEmpty` and nothing else. Not sure how it is useful or not. @mrserb @stuart-marks Indeed, the reason for no regression test is because I didn't see any good way of testing "this operation will not allocate any memory" (which is the externally observable difference, besides having isEmpty being called, which of course could allocate memory (which I sincerely hope no implementations do)). I can add the same logic to Map.copyOf, and possibly even List.copyOf (ImmutableCollections.listCopy). But will do so in additional commits in this PR. ------------- PR: https://git.openjdk.org/jdk/pull/11847 From jdk at fiolino.de Thu Jan 5 11:59:36 2023 From: jdk at fiolino.de (Michael Kuhlmann) Date: Thu, 5 Jan 2023 12:59:36 +0100 Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v5] In-Reply-To: <98nL72fsyJ98-yaqfBRcnzM1fAfNq2wiCpOqTb8oFgI=.16e6c04d-e171-43d4-a566-48d1894b29b1@github.com> References: <98nL72fsyJ98-yaqfBRcnzM1fAfNq2wiCpOqTb8oFgI=.16e6c04d-e171-43d4-a566-48d1894b29b1@github.com> Message-ID: <1fd57f3c-7803-62b9-cece-9efe6980147f@fiolino.de> On 1/5/23 12:40, Uwe Schindler wrote: > The copypasted snippet above is misleading, you need to read the whole statement, so an IllegalStateException can only happen for unaligned access on access modes other than get/set (so volatile or opaque reads): "If access is misaligned then access for anything **other than the get and set access modes** will result in an IllegalStateException.", the sentence you posted is about if it is atomic or not. It just says that on 32 bits, long/double are not atomic for normal set/get. > > P.S.: We definitely know that it works on 32 bit, the whole code of Lucene is full of those VarHandles :-) I think you are replying to my question. ;) There are two cases here. One is the misaligned index, which is not relevant here because we're only using get/set. The other is access to long/double values on 32-bit platforms. This is mentioned explicitly, and since you are talking about atomic access, it's also mentioned: * read write access modes for all T, with the exception of access modes get and set for long and double on 32-bit platforms. * atomic update access modes for int, long, float or double. (Future major platform releases of the JDK may support additional types for certain currently unsupported access modes.) It says "access modes get and set", so no explicit atomic access mode. I would read it as {code}Varhandle.AccessMode.GET{/code} and SET respectively. If it's for sure working on 32-bit platforms, then probably the Javadoc comment should be fixed. -Michael From shade at openjdk.org Thu Jan 5 12:12:51 2023 From: shade at openjdk.org (Aleksey Shipilev) Date: Thu, 5 Jan 2023 12:12:51 GMT Subject: RFR: 8294403: [REDO] make test should report only on executed tests [v2] In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 09:15:18 GMT, Aleksey Shipilev wrote: >> This should help to speed up tests significantly. Currently, if we run "make test" with a subset of tests, JTReg would still read the entirety of test root to report on tests that were not run. Even with current suite of tests it gets expensive. If you add more tests to suite -- for example, mounting a large test archive like pre-generated fuzzer tests -- it starts to take a lot of time. >> >> The reasonable default for older jtreg is `-report:executed`. My own CI -- that has millions of tests mounted in `test/` -- was running with `JTREG="OPTIONS=-report:executed"` for years now. [CODETOOLS-7903323](https://bugs.openjdk.org/browse/CODETOOLS-7903323) provides a new reporting option, `-report:files`, which makes this whole business easier. This requires new jtreg. >> >> Motivational improvements: >> >> >> $ time CONF=linux-x86_64-server-release make run-test TEST=gc/epsilon/TestHelloWorld.java >> >> # Default JDK tree >> >> # Baseline >> real 0m9.086s >> user 0m22.857s >> sys 0m4.202s >> >> # Patched >> real 0m6.406s ; +40% faster >> user 0m17.156s >> sys 0m3.193s >> >> # +100K fuzzer tests in tree >> >> # Baseline >> real 3m1.997s >> user 3m16.643s >> sys 0m10.490s >> >> # Patched >> real 0m8.919s ; 20x faster >> user 0m17.904s >> sys 0m4.860s >> >> >> Additional testing: >> - [x] Ad-hoc timing tests (see above) >> - [x] Reproducer from [CODETOOLS-7903331](https://bugs.openjdk.org/browse/CODETOOLS-7903331) >> - [x] Eyeballing the test results on passing tests with REPEAT_COUNT > 1 >> - [x] Eyeballing the test results on intermittently failing tests with RETRY_COUNT > 1 > > Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision: > > Copyright years My longer testing passes well. I would like to integrate it soon, if there are no objections. ------------- PR: https://git.openjdk.org/jdk/pull/11824 From stsypanov at openjdk.org Thu Jan 5 12:14:05 2023 From: stsypanov at openjdk.org (Sergey Tsypanov) Date: Thu, 5 Jan 2023 12:14:05 GMT Subject: RFR: 8299600: Use Objects.check*() where appropriate in java.io [v2] In-Reply-To: References: Message-ID: <6FULiwBHG9hpGGwhBct1_MgR4OmdNRwA9zXexZIXUBs=.f66dc334-606f-4040-acdb-db6ce11429db@github.com> > Use the following methods instead of hand-written code: > - Objects.checkFromIndexSize() > - Objects.checkFromToIndex() Sergey Tsypanov has updated the pull request incrementally with two additional commits since the last revision: - 8299600: Use checkFromIndexSize in PipedWriter.java - 8299600: Use checkFromIndexSize ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11849/files - new: https://git.openjdk.org/jdk/pull/11849/files/facabce0..8af035f5 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11849&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11849&range=00-01 Stats: 5 lines in 5 files changed: 0 ins; 0 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/11849.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11849/head:pull/11849 PR: https://git.openjdk.org/jdk/pull/11849 From stsypanov at openjdk.org Thu Jan 5 12:14:06 2023 From: stsypanov at openjdk.org (Sergey Tsypanov) Date: Thu, 5 Jan 2023 12:14:06 GMT Subject: RFR: 8299600: Use Objects.check*() where appropriate in java.io [v2] In-Reply-To: References: Message-ID: On Thu, 5 Jan 2023 07:11:57 GMT, Alan Bateman wrote: >> Indeed there are at least four regression test failures with this as-is: >> >> - java/io/InputStream/ReadParams.java >> - java/io/OutputStream/WriteParams.java >> - java/io/Writer/WriteParams.java >> - java/nio/channels/FileChannel/Transfer2GPlus.java > >> Indeed there are at least four regression test failures with this as-is: >> >> * java/io/InputStream/ReadParams.java >> * java/io/OutputStream/WriteParams.java >> * java/io/Writer/WriteParams.java >> * java/nio/channels/FileChannel/Transfer2GPlus.java > > The java/io tests run in tier2 and I think the GHA only run tier1. Fixed along with copyright year ------------- PR: https://git.openjdk.org/jdk/pull/11849 From pminborg at openjdk.org Thu Jan 5 12:18:58 2023 From: pminborg at openjdk.org (Per Minborg) Date: Thu, 5 Jan 2023 12:18:58 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v6] In-Reply-To: References: Message-ID: > Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. > > Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. > > Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. > > Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 Per Minborg has updated the pull request incrementally with one additional commit since the last revision: Use canonical NaN values also for read ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11840/files - new: https://git.openjdk.org/jdk/pull/11840/files/ec2e7c99..00a132c0 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11840&range=05 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11840&range=04-05 Stats: 8 lines in 1 file changed: 4 ins; 2 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/11840.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11840/head:pull/11840 PR: https://git.openjdk.org/jdk/pull/11840 From jdk at fiolino.de Thu Jan 5 12:31:15 2023 From: jdk at fiolino.de (Michael Kuhlmann) Date: Thu, 5 Jan 2023 13:31:15 +0100 Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v5] In-Reply-To: <1fd57f3c-7803-62b9-cece-9efe6980147f@fiolino.de> References: <98nL72fsyJ98-yaqfBRcnzM1fAfNq2wiCpOqTb8oFgI=.16e6c04d-e171-43d4-a566-48d1894b29b1@github.com> <1fd57f3c-7803-62b9-cece-9efe6980147f@fiolino.de> Message-ID: <8c58d801-1423-2e68-5577-c11bf0485d78@fiolino.de> The more I think about it, the clearer is that the first line of the Javadoc is contrary to the other lines: On 1/5/23 12:59, Michael Kuhlmann wrote: > * read write access modes for all T, with the exception of access modes > get and set for long and double on 32-bit platforms. So all read write modes will work, just if it's long or double then it won't work for get and for set access mode. (Or is getAndSet meant? But it's not called so, it's "get and set", so two access modes, or what?) Then the following lines state that even harder access modes will work also for long and double. So I think this should be labeled as "getAndSet" or at least "get-and-set" access mode. Currently it's very confusing. From pminborg at openjdk.org Thu Jan 5 12:34:12 2023 From: pminborg at openjdk.org (Per Minborg) Date: Thu, 5 Jan 2023 12:34:12 GMT Subject: RFR: 8299513: Cleanup java.io [v2] In-Reply-To: References: Message-ID: <_WD-EQq5LaItD3HwNjjZxii8pk_AJbiadmVJJ0I1Xlc=.acda7a44-e1f2-42bc-935b-869250fb1581@github.com> > Code in java.io contains many legacy constructs and semantics not recommended including: > > * C-style array declaration > * Unnecessary visibility > * Redundant keywords in interfaces (e.g. public, static) > * Non-standard naming for constants > * Javadoc typos > * Missing final declaration > > These should be fixed as a sanity effort. Per Minborg has updated the pull request incrementally with one additional commit since the last revision: Rework StringWriter constructor ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11848/files - new: https://git.openjdk.org/jdk/pull/11848/files/e028b62a..e3c107db Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11848&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11848&range=00-01 Stats: 5 lines in 1 file changed: 0 ins; 0 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/11848.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11848/head:pull/11848 PR: https://git.openjdk.org/jdk/pull/11848 From pminborg at openjdk.org Thu Jan 5 12:34:12 2023 From: pminborg at openjdk.org (Per Minborg) Date: Thu, 5 Jan 2023 12:34:12 GMT Subject: RFR: 8299513: Cleanup java.io [v2] In-Reply-To: References: <2NZo3Ve-SeyOMN_R9Un9l8HBEkKi8yOIfNPVqWfsHto=.2f6f5766-3078-43ad-89e5-e97fcebf9e04@github.com> Message-ID: <2kBTHcbilR3nHqVvWEsKRjo3SsXtMgVpwnbQ0GTBE2M=.48c51d8c-0a33-4f7b-a07b-1c83a4d918e2@github.com> On Thu, 5 Jan 2023 01:42:15 GMT, Brian Burkhalter wrote: >> I assume this is done so that "lock" is only set once during construction (StringWriter is a bit unusual in that it uses the SB as the lock object). A downside of the change is that it introduces casts. Another is that the expression to super is a bit complicated and forces the reader to locate checkSize at the end of the file to find the check/exception specified by the constructor. So two minds on this part, maybe it should be left unchanged. > > I think the casts are worth it to set `lock` only once during construction, but would be inclined to leave out the addition of `checkSize`. I have added a new proposal in the hope that the `requireNonNegative` method name and parameters should be trivial enough for users to directly understand without scrolling down. Let me know your thought on this. ------------- PR: https://git.openjdk.org/jdk/pull/11848 From uschindler at openjdk.org Thu Jan 5 12:35:53 2023 From: uschindler at openjdk.org (Uwe Schindler) Date: Thu, 5 Jan 2023 12:35:53 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v6] In-Reply-To: References: Message-ID: On Thu, 5 Jan 2023 12:18:58 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. >> >> Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. >> >> Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. >> >> Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Use canonical NaN values also for read As said before, for reads, the native varhandles can be used. There is also no separate "longBitsToRawDouble". What was the reason to add the latest commit? ------------- PR: https://git.openjdk.org/jdk/pull/11840 From uschindler at apache.org Thu Jan 5 12:37:33 2023 From: uschindler at apache.org (Uwe Schindler) Date: Thu, 5 Jan 2023 13:37:33 +0100 Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v5] In-Reply-To: <8c58d801-1423-2e68-5577-c11bf0485d78@fiolino.de> References: <98nL72fsyJ98-yaqfBRcnzM1fAfNq2wiCpOqTb8oFgI=.16e6c04d-e171-43d4-a566-48d1894b29b1@github.com> <1fd57f3c-7803-62b9-cece-9efe6980147f@fiolino.de> <8c58d801-1423-2e68-5577-c11bf0485d78@fiolino.de> Message-ID: Hi, I answered on the PR on github. The documentation is misleading: The copypasted snippet above is misleading, you need to read the whole statement, so an IllegalStateException can only happen for unaligned access on access modes other than get/set (so volatile or opaque reads): "If access is misaligned then access for anything*other than the get and set access modes*will result in an IllegalStateException.", the sentence you posted is about if it is atomic or not. It just says that on 32 bits, long/double are not atomic for normal set/get. P.S.: We definitely know that it works on 32 bit, the whole code of Lucene is full of those VarHandles :-) And no, it doe snot mean "get-and-set". Read the whole text, it is definitely correct, but if you don't read everything it may mislead you. So it can be improved. Uwe Am 05.01.2023 um 13:31 schrieb Michael Kuhlmann: > The more I think about it, the clearer is that the first line of the > Javadoc is contrary to the other lines: > > On 1/5/23 12:59, Michael Kuhlmann wrote: >> * read write access modes for all T, with the exception of access >> modes get and set for long and double on 32-bit platforms. > > So all read write modes will work, just if it's long or double then it > won't work for get and for set access mode. (Or is getAndSet meant? > But it's not called so, it's "get and set", so two access modes, or > what?) > > Then the following lines state that even harder access modes will work > also for long and double. > > So I think this should be labeled as "getAndSet" or at least > "get-and-set" access mode. Currently it's very confusing. -- Uwe Schindler uschindler at apache.org ASF Member, Member of PMC and Committer of Apache Lucene and Apache Solr Bremen, Germany https://lucene.apache.org/ https://solr.apache.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From rgiulietti at openjdk.org Thu Jan 5 12:52:49 2023 From: rgiulietti at openjdk.org (Raffaello Giulietti) Date: Thu, 5 Jan 2023 12:52:49 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v6] In-Reply-To: References: Message-ID: <0wDRFeGAKxL76s6R0b3-R8Hi5jrupSD8nvrTMvDRt_o=.9d4574e7-deca-4663-a254-2664dcf052c4@github.com> On Thu, 5 Jan 2023 12:18:58 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. >> >> Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. >> >> Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. >> >> Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Use canonical NaN values also for read One reason is that if the `byte[]` contains a non-canonical NaN then `get()` would return it. The original code first reads an integer value and then converts it to a floating-point value, so for backward compatibility the same should happen in the new code. ------------- PR: https://git.openjdk.org/jdk/pull/11840 From uschindler at openjdk.org Thu Jan 5 13:09:50 2023 From: uschindler at openjdk.org (Uwe Schindler) Date: Thu, 5 Jan 2023 13:09:50 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v6] In-Reply-To: References: Message-ID: On Thu, 5 Jan 2023 12:18:58 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. >> >> Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. >> >> Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. >> >> Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Use canonical NaN values also for read src/java.base/share/classes/java/io/Bits.java line 65: > 63: > 64: static float getFloat(byte[] b, int off) { > 65: // Using Float.floatToIntBits collapses NaN values to a single comment is referring to wrong method src/java.base/share/classes/java/io/Bits.java line 75: > 73: > 74: static double getDouble(byte[] b, int off) { > 75: // Using Double.doubleToLongBits collapses NaN values to a single same here ------------- PR: https://git.openjdk.org/jdk/pull/11840 From uschindler at openjdk.org Thu Jan 5 13:14:50 2023 From: uschindler at openjdk.org (Uwe Schindler) Date: Thu, 5 Jan 2023 13:14:50 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v6] In-Reply-To: <0wDRFeGAKxL76s6R0b3-R8Hi5jrupSD8nvrTMvDRt_o=.9d4574e7-deca-4663-a254-2664dcf052c4@github.com> References: <0wDRFeGAKxL76s6R0b3-R8Hi5jrupSD8nvrTMvDRt_o=.9d4574e7-deca-4663-a254-2664dcf052c4@github.com> Message-ID: On Thu, 5 Jan 2023 12:50:25 GMT, Raffaello Giulietti wrote: > One reason is that if the `byte[]` contains a non-canonical NaN then `get()` would return it. The original code first reads an integer value and then converts it to a floating-point value, so for backward compatibility the same should happen in the new code. The method does not normalize, it does just this: https://github.com/openjdk/jdk/blob/739769c8fc4b496f08a92225a12d07414537b6c0/src/java.base/share/native/libjava/Float.c#L34-L43 Theres also no `rawIntBitsToFloat`. You only need to take care of writing a float to outside the JDK, when it reads it in the normalization does not matter. ------------- PR: https://git.openjdk.org/jdk/pull/11840 From jdk at fiolino.de Thu Jan 5 13:16:57 2023 From: jdk at fiolino.de (Michael Kuhlmann) Date: Thu, 5 Jan 2023 14:16:57 +0100 Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v5] In-Reply-To: References: <98nL72fsyJ98-yaqfBRcnzM1fAfNq2wiCpOqTb8oFgI=.16e6c04d-e171-43d4-a566-48d1894b29b1@github.com> <1fd57f3c-7803-62b9-cece-9efe6980147f@fiolino.de> <8c58d801-1423-2e68-5577-c11bf0485d78@fiolino.de> Message-ID: <8c485841-eb45-e38a-4dbb-16868b496e0c@fiolino.de> Hi Uwe, you are right! It's confusing because for cases 2-4, *atomic* access is explicitly mentioned but not for case 1. I overlooked the *atomic access* in the sentence before and got confused. Thanks for the clarification! On 1/5/23 13:37, Uwe Schindler wrote: > Hi, > > I answered on the PR on github. The documentation is misleading: > > The copypasted snippet above is misleading, you need to read the > whole statement, so an IllegalStateException can only happen for > unaligned access on access modes other than get/set (so volatile or > opaque reads): "If access is misaligned then access for > anything*other than the get and set access modes*will result in an > IllegalStateException.", the sentence you posted is about if it is > atomic or not. It just says that on 32 bits, long/double are not > atomic for normal set/get. > > P.S.: We definitely know that it works on 32 bit, the whole code of > Lucene is full of those VarHandles :-) > > And no, it doe snot mean "get-and-set". Read the whole text, it is > definitely correct, but if you don't read everything it may mislead you. > So it can be improved. > > Uwe > From uschindler at openjdk.org Thu Jan 5 13:19:53 2023 From: uschindler at openjdk.org (Uwe Schindler) Date: Thu, 5 Jan 2023 13:19:53 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v6] In-Reply-To: References: Message-ID: On Thu, 5 Jan 2023 12:18:58 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. >> >> Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. >> >> Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. >> >> Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Use canonical NaN values also for read Anyways, I am fine with both variants. The new one is looking "more symmetric". ------------- PR: https://git.openjdk.org/jdk/pull/11840 From jpai at openjdk.org Thu Jan 5 13:24:08 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Thu, 5 Jan 2023 13:24:08 GMT Subject: RFR: 8258776: ThreadLocal#initialValue() Javadoc is unaware of ThreadLocal#withInitial() [v2] In-Reply-To: References: Message-ID: > Can I please get a review of this doc only change which addresses the javadoc issue noted in https://bugs.openjdk.org/browse/JDK-8258776? > > As noted in that issue, the `ThreadLocal.initialValue()` API javadoc suggests subclassing `ThreadLocal` and overriding the `initialValue()` method instead of recommending the `withInitial` method that was added in Java 8. > > The commit here updates the javadoc of `initialValue()` method to note that `withInitial` method is available for use if the programmer wants to provide an initial value. The updated javadoc continues to note that the `ThreadLocal` can be subclassed and the method overriden as the other way of providing an initial value. This change now uses the `@implSpec` construct to state this default behaviour of the `initialValue()` method. > > Additionally, the `get()` method's javadoc has also been updated to account for the semantics of `initialValue()`. In fact, in its current form, before the changes in this PR, the `get()` method states: > >> If the current thread does not support thread locals then >> this method returns its {@link #initialValue} (or {@code null} >> if the {@code initialValue} method is not overridden). > > which isn't accurate, since the `get()` will return a non-null value if the ThreadLocal was constructed through `ThreadLocal.withInitial`. Here's a trivial code which contradicts this current javadoc: > > > public class Test { > public static void main(final String[] args) throws Exception { > Thread.ofPlatform().name("hello").allowSetThreadLocals(false).start(() -> { > var t = ThreadLocal.withInitial(() -> 2); > System.out.println("Thread local value is " + t.get()); > }); > } > } > > Running this with `java --enable-preview --source 21 Test.java` returns: > > Thread local value is 2 > > > The updated javadoc of `get()` in this PR now matches the behaviour of this method. I believe this will need a CSR, which I'll open once we have an agreement on these changes. > > Furthermore, the class level javadoc of `ThreadLocal` has an example of providing an initial value which uses the subclassing strategy. I haven't updated that part. Should we update that to show the `withInitialValue` usage instead (and maybe convert it to a snippet)? Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: Review suggestion ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11846/files - new: https://git.openjdk.org/jdk/pull/11846/files/9ac54a1e..110ad4ff Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11846&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11846&range=00-01 Stats: 4 lines in 1 file changed: 1 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/11846.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11846/head:pull/11846 PR: https://git.openjdk.org/jdk/pull/11846 From jpai at openjdk.org Thu Jan 5 13:24:10 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Thu, 5 Jan 2023 13:24:10 GMT Subject: RFR: 8258776: ThreadLocal#initialValue() Javadoc is unaware of ThreadLocal#withInitial() [v2] In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 20:14:14 GMT, Alan Bateman wrote: >> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: >> >> Review suggestion > > src/java.base/share/classes/java/lang/ThreadLocal.java line 128: > >> 126: * value other than {@code null}, then either {@code ThreadLocal} can be >> 127: * subclassed and this method overridden or {@link ThreadLocal#withInitial(Supplier)} method >> 128: * can be used to construct a {@code ThreadLocal}. > > This looks okay but maybe slightly better to say "or the method withInitial(Supplier) can be used ...". > > I think you can probably reflow this paragraph to avoid having a mix of short and long lines. Hello Alan, I've updated this PR with this suggested change and also formatted this new text to avoid having a mix of long and short lines. ------------- PR: https://git.openjdk.org/jdk/pull/11846 From rgiulietti at openjdk.org Thu Jan 5 13:24:51 2023 From: rgiulietti at openjdk.org (Raffaello Giulietti) Date: Thu, 5 Jan 2023 13:24:51 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v6] In-Reply-To: References: Message-ID: On Thu, 5 Jan 2023 12:18:58 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. >> >> Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. >> >> Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. >> >> Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Use canonical NaN values also for read The point, I think, is not whether the result is normalized (this is not specified in detail in the Javadoc of `Double::longBitsToDouble` and `Float::intBitsToFloat`, so it's open to the implementation) but to use the same basic conversions as the original code, just to avoid any ever so slight difference. ------------- PR: https://git.openjdk.org/jdk/pull/11840 From jcking at openjdk.org Thu Jan 5 14:22:54 2023 From: jcking at openjdk.org (Justin King) Date: Thu, 5 Jan 2023 14:22:54 GMT Subject: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v10] In-Reply-To: References: Message-ID: On Sat, 17 Dec 2022 06:39:48 GMT, Justin King wrote: >> Allow building OpenJDK with UBSan. Currently the build fails when optimizing the image due to lots of undefined behavior (it invokes the built JVM). Follow up PRs will either replace the undefined behavior with well defined behavior or suppress errors which are intentional. The goal is to make OpenJDK more well defined and thus more portable across compilers and architectures. > > Justin King has updated the pull request incrementally with one additional commit since the last revision: > > Delete unintended addition of files from previous commit > > Signed-off-by: Justin King Ah okay, no problem. Thanks for the update. ------------- PR: https://git.openjdk.org/jdk/pull/11604 From bpb at openjdk.org Thu Jan 5 17:35:50 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Thu, 5 Jan 2023 17:35:50 GMT Subject: RFR: 8299513: Cleanup java.io [v2] In-Reply-To: <2kBTHcbilR3nHqVvWEsKRjo3SsXtMgVpwnbQ0GTBE2M=.48c51d8c-0a33-4f7b-a07b-1c83a4d918e2@github.com> References: <2NZo3Ve-SeyOMN_R9Un9l8HBEkKi8yOIfNPVqWfsHto=.2f6f5766-3078-43ad-89e5-e97fcebf9e04@github.com> <2kBTHcbilR3nHqVvWEsKRjo3SsXtMgVpwnbQ0GTBE2M=.48c51d8c-0a33-4f7b-a07b-1c83a4d918e2@github.com> Message-ID: On Thu, 5 Jan 2023 12:29:20 GMT, Per Minborg wrote: >> I think the casts are worth it to set `lock` only once during construction, but would be inclined to leave out the addition of `checkSize`. > > I have added a new proposal in the hope that the `requireNonNegative` method name and parameters should be trivial enough for users to directly understand without scrolling down. Let me know your thought on this. That is definitely better but I would be inclined to place `requireNonNegative()` between the constructors and the instance methods. ------------- PR: https://git.openjdk.org/jdk/pull/11848 From naoto at openjdk.org Thu Jan 5 17:52:56 2023 From: naoto at openjdk.org (Naoto Sato) Date: Thu, 5 Jan 2023 17:52:56 GMT Subject: Integrated: 8299292: Missing elements in aliased String array In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 19:57:56 GMT, Naoto Sato wrote: > This is a pre-requisite fix for upgrading CLDR to v43. The upcoming CLDR changed the inheritance mechanism a bit with this change: https://unicode-org.atlassian.net/browse/CLDR-15054 where they removed the duplication of data. This revealed an issue in CLDRConverter buildtool that it was not capable of inheriting the partially populated, aliased elements in an array object. This changeset also removed the unused logging code. This pull request has now been integrated. Changeset: a49ccb95 Author: Naoto Sato URL: https://git.openjdk.org/jdk/commit/a49ccb959b7e50ee67b1ab4feca47c34bdbc14fe Stats: 16 lines in 1 file changed: 5 ins; 4 del; 7 mod 8299292: Missing elements in aliased String array Reviewed-by: iris, joehw ------------- PR: https://git.openjdk.org/jdk/pull/11851 From bpb at openjdk.org Thu Jan 5 18:00:50 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Thu, 5 Jan 2023 18:00:50 GMT Subject: RFR: 8299600: Use Objects.check*() where appropriate in java.io [v2] In-Reply-To: References: Message-ID: On Thu, 5 Jan 2023 12:09:46 GMT, Sergey Tsypanov wrote: >>> Indeed there are at least four regression test failures with this as-is: >>> >>> * java/io/InputStream/ReadParams.java >>> * java/io/OutputStream/WriteParams.java >>> * java/io/Writer/WriteParams.java >>> * java/nio/channels/FileChannel/Transfer2GPlus.java >> >> The java/io tests run in tier2 and I think the GHA only run tier1. > > Fixed along with copyright year The regression tests now pass. ------------- PR: https://git.openjdk.org/jdk/pull/11849 From alanb at openjdk.org Thu Jan 5 18:08:51 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 5 Jan 2023 18:08:51 GMT Subject: RFR: 8299600: Use Objects.check*() where appropriate in java.io [v2] In-Reply-To: <6FULiwBHG9hpGGwhBct1_MgR4OmdNRwA9zXexZIXUBs=.f66dc334-606f-4040-acdb-db6ce11429db@github.com> References: <6FULiwBHG9hpGGwhBct1_MgR4OmdNRwA9zXexZIXUBs=.f66dc334-606f-4040-acdb-db6ce11429db@github.com> Message-ID: On Thu, 5 Jan 2023 12:14:05 GMT, Sergey Tsypanov wrote: >> Use the following methods instead of hand-written code: >> - Objects.checkFromIndexSize() >> - Objects.checkFromToIndex() > > Sergey Tsypanov has updated the pull request incrementally with two additional commits since the last revision: > > - 8299600: Use checkFromIndexSize in PipedWriter.java > - 8299600: Use checkFromIndexSize Version 8af035f5 looks right and I see that @bplb has run the tests. ------------- Marked as reviewed by alanb (Reviewer). PR: https://git.openjdk.org/jdk/pull/11849 From bpb at openjdk.org Thu Jan 5 18:08:51 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Thu, 5 Jan 2023 18:08:51 GMT Subject: RFR: 8299600: Use Objects.check*() where appropriate in java.io [v2] In-Reply-To: <6FULiwBHG9hpGGwhBct1_MgR4OmdNRwA9zXexZIXUBs=.f66dc334-606f-4040-acdb-db6ce11429db@github.com> References: <6FULiwBHG9hpGGwhBct1_MgR4OmdNRwA9zXexZIXUBs=.f66dc334-606f-4040-acdb-db6ce11429db@github.com> Message-ID: On Thu, 5 Jan 2023 12:14:05 GMT, Sergey Tsypanov wrote: >> Use the following methods instead of hand-written code: >> - Objects.checkFromIndexSize() >> - Objects.checkFromToIndex() > > Sergey Tsypanov has updated the pull request incrementally with two additional commits since the last revision: > > - 8299600: Use checkFromIndexSize in PipedWriter.java > - 8299600: Use checkFromIndexSize Marked as reviewed by bpb (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11849 From asemenyuk at openjdk.org Thu Jan 5 20:21:42 2023 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Thu, 5 Jan 2023 20:21:42 GMT Subject: RFR: 8299278: tools/jpackage/share/AddLauncherTest.java#id1 failed AddLauncherTest.bug8230933 Message-ID: 8299278: tools/jpackage/share/AddLauncherTest.java#id1 failed AddLauncherTest.bug8230933 ------------- Commit messages: - Comment fixed - 8299278: tools/jpackage/share/AddLauncherTest.java#id1 failed AddLauncherTest.bug8230933 Changes: https://git.openjdk.org/jdk/pull/11868/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11868&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299278 Stats: 47 lines in 2 files changed: 41 ins; 0 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/11868.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11868/head:pull/11868 PR: https://git.openjdk.org/jdk/pull/11868 From mchung at openjdk.org Thu Jan 5 20:53:50 2023 From: mchung at openjdk.org (Mandy Chung) Date: Thu, 5 Jan 2023 20:53:50 GMT Subject: RFR: 8299183: Invokers.checkExactType passes parameters to create WMTE in opposite order Message-ID: <68ERvONXzd-5lr4Au21sLFN-etSesjFy8tHzLSTsil0=.ea75bf5c-9dc8-4fbe-83b0-b55bc30da2c6@github.com> Trivial fix. Fix `Invokers.checkExactType` to call `newWrongMethodTypeException(actual, expected)` with parameters in right order. ------------- Commit messages: - 8299183: Invokers.checkExactType passes parameters to create WMTE in opposite order Changes: https://git.openjdk.org/jdk/pull/11870/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11870&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299183 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/11870.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11870/head:pull/11870 PR: https://git.openjdk.org/jdk/pull/11870 From duke at openjdk.org Thu Jan 5 22:20:32 2023 From: duke at openjdk.org (Justin Lu) Date: Thu, 5 Jan 2023 22:20:32 GMT Subject: RFR: 8299617: CurrencySymbols.properties is missing the copyright notice Message-ID: <3P2LV_PvCy1tn3ALX_uNgNGUvtNM2Xs672NJJpW66cQ=.9f817221-c95a-49ed-b360-3861f6a7950d@github.com> Added the missing copyright header ------------- Commit messages: - Fix date, remove classpath - Add copyright header Changes: https://git.openjdk.org/jdk/pull/11854/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11854&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299617 Stats: 23 lines in 1 file changed: 23 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/11854.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11854/head:pull/11854 PR: https://git.openjdk.org/jdk/pull/11854 From naoto at openjdk.org Thu Jan 5 22:20:36 2023 From: naoto at openjdk.org (Naoto Sato) Date: Thu, 5 Jan 2023 22:20:36 GMT Subject: RFR: 8299617: CurrencySymbols.properties is missing the copyright notice In-Reply-To: <3P2LV_PvCy1tn3ALX_uNgNGUvtNM2Xs672NJJpW66cQ=.9f817221-c95a-49ed-b360-3861f6a7950d@github.com> References: <3P2LV_PvCy1tn3ALX_uNgNGUvtNM2Xs672NJJpW66cQ=.9f817221-c95a-49ed-b360-3861f6a7950d@github.com> Message-ID: On Wed, 4 Jan 2023 21:48:26 GMT, Justin Lu wrote: > Added the missing copyright header Changes requested by naoto (Reviewer). test/jdk/java/text/Format/NumberFormat/CurrencySymbols.properties line 2: > 1: # > 2: # Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. This file is not new, so I'd use `2001` as the year created, which is borrowed from the test body `CurrencyFormat.java`. test/jdk/java/text/Format/NumberFormat/CurrencySymbols.properties line 9: > 7: # published by the Free Software Foundation. Oracle designates this > 8: # particular file as subject to the "Classpath" exception as provided > 9: # by Oracle in the LICENSE file that accompanied this code. Classpath exception is not applicable to tests. ------------- PR: https://git.openjdk.org/jdk/pull/11854 From duke at openjdk.org Thu Jan 5 22:20:37 2023 From: duke at openjdk.org (Justin Lu) Date: Thu, 5 Jan 2023 22:20:37 GMT Subject: RFR: 8299617: CurrencySymbols.properties is missing the copyright notice In-Reply-To: References: <3P2LV_PvCy1tn3ALX_uNgNGUvtNM2Xs672NJJpW66cQ=.9f817221-c95a-49ed-b360-3861f6a7950d@github.com> Message-ID: On Wed, 4 Jan 2023 23:02:40 GMT, Naoto Sato wrote: >> Added the missing copyright header > > test/jdk/java/text/Format/NumberFormat/CurrencySymbols.properties line 9: > >> 7: # published by the Free Software Foundation. Oracle designates this >> 8: # particular file as subject to the "Classpath" exception as provided >> 9: # by Oracle in the LICENSE file that accompanied this code. > > Classpath exception is not applicable to tests. Did not know that, thank you. Made the fixes for this and your previous comment. ------------- PR: https://git.openjdk.org/jdk/pull/11854 From iris at openjdk.org Thu Jan 5 22:52:57 2023 From: iris at openjdk.org (Iris Clark) Date: Thu, 5 Jan 2023 22:52:57 GMT Subject: RFR: 8299617: CurrencySymbols.properties is missing the copyright notice In-Reply-To: <3P2LV_PvCy1tn3ALX_uNgNGUvtNM2Xs672NJJpW66cQ=.9f817221-c95a-49ed-b360-3861f6a7950d@github.com> References: <3P2LV_PvCy1tn3ALX_uNgNGUvtNM2Xs672NJJpW66cQ=.9f817221-c95a-49ed-b360-3861f6a7950d@github.com> Message-ID: On Wed, 4 Jan 2023 21:48:26 GMT, Justin Lu wrote: > Added the missing copyright header Provided GPL license appear to match the standard template available here: https://github.com/openjdk/jdk/blob/master/make/data/license-templates/gpl-header ------------- Marked as reviewed by iris (Reviewer). PR: https://git.openjdk.org/jdk/pull/11854 From iris at openjdk.org Thu Jan 5 22:59:50 2023 From: iris at openjdk.org (Iris Clark) Date: Thu, 5 Jan 2023 22:59:50 GMT Subject: RFR: 8299183: Invokers.checkExactType passes parameters to create WMTE in opposite order In-Reply-To: <68ERvONXzd-5lr4Au21sLFN-etSesjFy8tHzLSTsil0=.ea75bf5c-9dc8-4fbe-83b0-b55bc30da2c6@github.com> References: <68ERvONXzd-5lr4Au21sLFN-etSesjFy8tHzLSTsil0=.ea75bf5c-9dc8-4fbe-83b0-b55bc30da2c6@github.com> Message-ID: On Thu, 5 Jan 2023 20:45:20 GMT, Mandy Chung wrote: > Trivial fix. Fix `Invokers.checkExactType` to call `newWrongMethodTypeException(actual, expected)` with parameters in right order. Parameter order for method invocation now matches method declaration on line 521. ------------- Marked as reviewed by iris (Reviewer). PR: https://git.openjdk.org/jdk/pull/11870 From bpb at openjdk.org Thu Jan 5 23:13:49 2023 From: bpb at openjdk.org (Brian Burkhalter) Date: Thu, 5 Jan 2023 23:13:49 GMT Subject: RFR: JDK-8299336 - InputStream::DEFAULT_BUFFER_SIZE should be 16384 In-Reply-To: References: Message-ID: On Fri, 23 Dec 2022 22:28:34 GMT, Markus KARG wrote: > I/O had always been much slower than CPU and memory access, and thanks to physical constraints, always will be. > While CPUs can get shrinked more and more, and can hold more and more memory cache on or nearby a CPU core, the distance between CPU core and I/O device cannot get reduced much: It will stay "far" away. > Due to this simple logic (and other factors), the spread between performance of CPU and memory access on one hand, and performance of I/O on the other hand, increases with every new CPU generation. > As a consequence, internal adjustment factors of the JDK need to get revised from time to time to ensure optimum performance and each hardware generation. > > One such factor is the size of the temporary transfer buffer used internally by `InputStream::transferTo`. > Since its introduction with JDK 9 many years (hence hardware generations) have passed, so it's time to check the appropriateness of that buffer's size. > > Using JMH on a typical, modern cloud platform, it was proven that the current 8K buffer is (much) too small on modern hardware: > The small buffer clearly stands in the way of faster transfers. > The ops/s of a simple `FileInputStream.transferTo(ByteArrayOutputStream)` operation on JDK 21 could be doubled (!) by only doubling the buffer size from 8K to 16K, which seems to be a considerable and cheap deal. > Doubling the buffer even more shows only marginal improvements of approx. 1% to 3% per duplication of size, which does not justify additional memory consumption. > > > TransferToPerformance.transferTo 8192 1048576 thrpt 25 1349.929 ? 47.057 ops/s > TransferToPerformance.transferTo 16384 1048576 thrpt 25 2633.560 ? 93.337 ops/s > TransferToPerformance.transferTo 32768 1048576 thrpt 25 2721.025 ? 89.555 ops/s > TransferToPerformance.transferTo 65536 1048576 thrpt 25 2855.949 ? 96.623 ops/s > TransferToPerformance.transferTo 131072 1048576 thrpt 25 2903.062 ? 40.798 ops/s > > > Even on small or limited platforms, an investment of 8K additonal temporary buffer is very cheap and very useful, as it doubles the performance of `InputStream::transferTo`, in particular for legacy (non-NIO) applications still using `FileInputStream` and `ByteArrayOutputStream`. > I dare to say, even if not proven, that is a very considerable (possibly the major) number of existing applications, as NIO was only adopted gradually by programmers. > > Due to the given reasons, it should be approporiate to change `DEFAULT_BUFFER_SIZE` from 8192 to 16384. Marked as reviewed by bpb (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11783 From naoto at openjdk.org Fri Jan 6 00:13:50 2023 From: naoto at openjdk.org (Naoto Sato) Date: Fri, 6 Jan 2023 00:13:50 GMT Subject: RFR: 8299617: CurrencySymbols.properties is missing the copyright notice In-Reply-To: <3P2LV_PvCy1tn3ALX_uNgNGUvtNM2Xs672NJJpW66cQ=.9f817221-c95a-49ed-b360-3861f6a7950d@github.com> References: <3P2LV_PvCy1tn3ALX_uNgNGUvtNM2Xs672NJJpW66cQ=.9f817221-c95a-49ed-b360-3861f6a7950d@github.com> Message-ID: On Wed, 4 Jan 2023 21:48:26 GMT, Justin Lu wrote: > Added the missing copyright header Marked as reviewed by naoto (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11854 From jpai at openjdk.org Fri Jan 6 00:47:48 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Fri, 6 Jan 2023 00:47:48 GMT Subject: RFR: 8299617: CurrencySymbols.properties is missing the copyright notice In-Reply-To: <3P2LV_PvCy1tn3ALX_uNgNGUvtNM2Xs672NJJpW66cQ=.9f817221-c95a-49ed-b360-3861f6a7950d@github.com> References: <3P2LV_PvCy1tn3ALX_uNgNGUvtNM2Xs672NJJpW66cQ=.9f817221-c95a-49ed-b360-3861f6a7950d@github.com> Message-ID: On Wed, 4 Jan 2023 21:48:26 GMT, Justin Lu wrote: > Added the missing copyright header Marked as reviewed by jpai (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11854 From jpai at openjdk.org Fri Jan 6 01:08:48 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Fri, 6 Jan 2023 01:08:48 GMT Subject: RFR: 8299183: Invokers.checkExactType passes parameters to create WMTE in opposite order In-Reply-To: <68ERvONXzd-5lr4Au21sLFN-etSesjFy8tHzLSTsil0=.ea75bf5c-9dc8-4fbe-83b0-b55bc30da2c6@github.com> References: <68ERvONXzd-5lr4Au21sLFN-etSesjFy8tHzLSTsil0=.ea75bf5c-9dc8-4fbe-83b0-b55bc30da2c6@github.com> Message-ID: On Thu, 5 Jan 2023 20:45:20 GMT, Mandy Chung wrote: > Trivial fix. Fix `Invokers.checkExactType` to call `newWrongMethodTypeException(actual, expected)` with parameters in right order. Hello Mandy, this looks good to me. The copyright year on the file will need an update. There's another call to this `newWrongMethodTypeException` method on line 515 and I am guessing that one is already passing the params in the correct order. If I go by that same logic, then there appears to be a direct construction of `WrongMethodTypeException` on line 497 and I suspect the `String` passed to it is perhaps using the wrong order? It currently says: if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " + ad.symbolicMethodTypeExact); } Should it instead say: if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { throw new WrongMethodTypeException("expected " + ad.symbolicMethodTypeExact + " but found " + handle.accessModeType(ad.type)); } ------------- PR: https://git.openjdk.org/jdk/pull/11870 From duke at openjdk.org Fri Jan 6 02:45:18 2023 From: duke at openjdk.org (Archie L. Cobbs) Date: Fri, 6 Jan 2023 02:45:18 GMT Subject: RFR: 8015831: Add lint check for calling overridable methods from a constructor Message-ID: This PR adds a new lint warning category `this-escape`. It also adds `@SuppressWarnings` annotations as needed to the JDK itself to allow the JDK to continue to compile with `-Xlint:all`. A 'this' escape warning is generated for a constructor `A()` in a class `A` when the compiler detects that the following situation is _in theory possible:_ * Some subclass `B extends A` exists, and `B` is defined in a separate source file (i.e., compilation unit) * Some constructor `B()` of `B` invokes `A()` as its superclass constructor * During the execution of `A()`, some non-static method of `B.foo()` could get invoked, perhaps indirectly In the above scenario, `B.foo()` would execute before `A()` has returned and before `B()` has performed any initialization. To the extent `B.foo()` accesses any fields of `B` - all of which are still uninitialized - it is likely to function incorrectly. Note, when determining if a 'this' escape is possible, the compiler makes no assumptions about code outside of the current compilation unit. It doesn't look outside of the current source file to see what might actually happen when a method is invoked. It does follow method and constructors within the current compilation unit, and applies a simplified union-of-all-possible-branches data flow analysis to see where 'this' could end up. >From my review, virtually all of the warnings generated in the various JDK modules are valid warnings in the sense that a 'this' escape, as defined above, is really and truly possible. However, that doesn't imply that any bugs were found within the JDK - only that the possibility of a certain type of bug exists if certain superclass constructors are used by someone, somewhere, someday. For several "popular" classes, this PR also adds `@implNote`'s to the offending constructors so that subclass implementors are made aware of the threat. For one example, `TreeMap(Map)` invokes `putAll()` and `put()`. More details and a couple of motivating examples are given in an included [doc file](https://github.com/archiecobbs/jdk/blob/ThisEscape/src/java.base/share/classes/java/lang/doc-files/ThisEscape.html) that these `@implNote`'s link to. See also the recent thread on `amber-dev` for some background. Ideally, over time the owners of the various modules would review their `@SuppressWarnings("this-escape")` annotations and determine which other constructors also warranted such an `@implNote`. Because of all the`@SuppressWarnings` annotations, this PR touches a bunch of different JDK modules. My apologies for that. Adding these annotations was determined to be the more conservative approach, as compared to just excepting `this-escape` from various module builds globally. **Patch Navigation Guide** * Non-trivial compiler changes: * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java` * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java` * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java` * `src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java` * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java` * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties` * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties` * Javadoc additions of `@implNote`: * `src/java.base/share/classes/java/io/PipedReader.java` * `src/java.base/share/classes/java/io/PipedWriter.java` * `src/java.base/share/classes/java/lang/Throwable.java` * `src/java.base/share/classes/java/util/ArrayDeque.java` * `src/java.base/share/classes/java/util/EnumMap.java` * `src/java.base/share/classes/java/util/HashSet.java` * `src/java.base/share/classes/java/util/Hashtable.java` * `src/java.base/share/classes/java/util/LinkedList.java` * `src/java.base/share/classes/java/util/TreeMap.java` * `src/java.base/share/classes/java/util/TreeSet.java` * New unit tests * `test/langtools/tools/javac/warnings/ThisEscape/*.java` * **Everything else** is just adding `@SuppressWarnings("this-escape")` ------------- Commit messages: - Remove trailing whitespace. - Some documentation tweaks. - Treat method references like the equivalent lambda. - Fix bug where initializers could generate duplicate warnings. - Javadoc fix. - Add ThisEscape.html doc note and link the new @implNote's to it. - Add more @SuppressWarnings("this-escape") annotations. - Add more @SuppressWarnings("this-escape") annotations. - Add more @SuppressWarnings("this-escape") annotations. - Add more @SuppressWarnings("this-escape") annotations. - ... and 38 more: https://git.openjdk.org/jdk/compare/c6588d5b...9c162283 Changes: https://git.openjdk.org/jdk/pull/11874/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11874&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8015831 Stats: 4326 lines in 1285 files changed: 4259 ins; 3 del; 64 mod Patch: https://git.openjdk.org/jdk/pull/11874.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11874/head:pull/11874 PR: https://git.openjdk.org/jdk/pull/11874 From dholmes at openjdk.org Fri Jan 6 04:51:00 2023 From: dholmes at openjdk.org (David Holmes) Date: Fri, 6 Jan 2023 04:51:00 GMT Subject: RFR: 8015831: Add lint check for calling overridable methods from a constructor In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 02:20:53 GMT, Archie L. Cobbs wrote: > This PR adds a new lint warning category `this-escape`. > > It also adds `@SuppressWarnings` annotations as needed to the JDK itself to allow the JDK to continue to compile with `-Xlint:all`. > > A 'this' escape warning is generated for a constructor `A()` in a class `A` when the compiler detects that the following situation is _in theory possible:_ > * Some subclass `B extends A` exists, and `B` is defined in a separate source file (i.e., compilation unit) > * Some constructor `B()` of `B` invokes `A()` as its superclass constructor > * During the execution of `A()`, some non-static method of `B.foo()` could get invoked, perhaps indirectly > > In the above scenario, `B.foo()` would execute before `A()` has returned and before `B()` has performed any initialization. To the extent `B.foo()` accesses any fields of `B` - all of which are still uninitialized - it is likely to function incorrectly. > > Note, when determining if a 'this' escape is possible, the compiler makes no assumptions about code outside of the current compilation unit. It doesn't look outside of the current source file to see what might actually happen when a method is invoked. It does follow method and constructors within the current compilation unit, and applies a simplified union-of-all-possible-branches data flow analysis to see where 'this' could end up. > > From my review, virtually all of the warnings generated in the various JDK modules are valid warnings in the sense that a 'this' escape, as defined above, is really and truly possible. However, that doesn't imply that any bugs were found within the JDK - only that the possibility of a certain type of bug exists if certain superclass constructors are used by someone, somewhere, someday. > > For several "popular" classes, this PR also adds `@implNote`'s to the offending constructors so that subclass implementors are made aware of the threat. For one example, `TreeMap(Map)` invokes `putAll()` and `put()`. > > More details and a couple of motivating examples are given in an included [doc file](https://github.com/archiecobbs/jdk/blob/ThisEscape/src/java.base/share/classes/java/lang/doc-files/ThisEscape.html) that these `@implNote`'s link to. See also the recent thread on `amber-dev` for some background. > > Ideally, over time the owners of the various modules would review their `@SuppressWarnings("this-escape")` annotations and determine which other constructors also warranted such an `@implNote`. > > Because of all the`@SuppressWarnings` annotations, this PR touches a bunch of different JDK modules. My apologies for that. Adding these annotations was determined to be the more conservative approach, as compared to just excepting `this-escape` from various module builds globally. > > **Patch Navigation Guide** > > * Non-trivial compiler changes: > * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties` > > * Javadoc additions of `@implNote`: > > * `src/java.base/share/classes/java/io/PipedReader.java` > * `src/java.base/share/classes/java/io/PipedWriter.java` > * `src/java.base/share/classes/java/lang/Throwable.java` > * `src/java.base/share/classes/java/util/ArrayDeque.java` > * `src/java.base/share/classes/java/util/EnumMap.java` > * `src/java.base/share/classes/java/util/HashSet.java` > * `src/java.base/share/classes/java/util/Hashtable.java` > * `src/java.base/share/classes/java/util/LinkedList.java` > * `src/java.base/share/classes/java/util/TreeMap.java` > * `src/java.base/share/classes/java/util/TreeSet.java` > > * New unit tests > * `test/langtools/tools/javac/warnings/ThisEscape/*.java` > > * **Everything else** is just adding `@SuppressWarnings("this-escape")` Hi Archie, The associated JBS issue has been dormant for 6+ years and this is a very intrusive change affecting many, many files. Has the resurrection of this project previously been discussed somewhere? ------------- PR: https://git.openjdk.org/jdk/pull/11874 From jpai at openjdk.org Fri Jan 6 06:04:52 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Fri, 6 Jan 2023 06:04:52 GMT Subject: RFR: 8258776: ThreadLocal#initialValue() Javadoc is unaware of ThreadLocal#withInitial() [v2] In-Reply-To: References: Message-ID: On Thu, 5 Jan 2023 13:24:08 GMT, Jaikiran Pai wrote: >> Can I please get a review of this doc only change which addresses the javadoc issue noted in https://bugs.openjdk.org/browse/JDK-8258776? >> >> As noted in that issue, the `ThreadLocal.initialValue()` API javadoc suggests subclassing `ThreadLocal` and overriding the `initialValue()` method instead of recommending the `withInitial` method that was added in Java 8. >> >> The commit here updates the javadoc of `initialValue()` method to note that `withInitial` method is available for use if the programmer wants to provide an initial value. The updated javadoc continues to note that the `ThreadLocal` can be subclassed and the method overriden as the other way of providing an initial value. This change now uses the `@implSpec` construct to state this default behaviour of the `initialValue()` method. >> >> Additionally, the `get()` method's javadoc has also been updated to account for the semantics of `initialValue()`. In fact, in its current form, before the changes in this PR, the `get()` method states: >> >>> If the current thread does not support thread locals then >>> this method returns its {@link #initialValue} (or {@code null} >>> if the {@code initialValue} method is not overridden). >> >> which isn't accurate, since the `get()` will return a non-null value if the ThreadLocal was constructed through `ThreadLocal.withInitial`. Here's a trivial code which contradicts this current javadoc: >> >> >> public class Test { >> public static void main(final String[] args) throws Exception { >> Thread.ofPlatform().name("hello").allowSetThreadLocals(false).start(() -> { >> var t = ThreadLocal.withInitial(() -> 2); >> System.out.println("Thread local value is " + t.get()); >> }); >> } >> } >> >> Running this with `java --enable-preview --source 21 Test.java` returns: >> >> Thread local value is 2 >> >> >> The updated javadoc of `get()` in this PR now matches the behaviour of this method. I believe this will need a CSR, which I'll open once we have an agreement on these changes. >> >> Furthermore, the class level javadoc of `ThreadLocal` has an example of providing an initial value which uses the subclassing strategy. I haven't updated that part. Should we update that to show the `withInitialValue` usage instead (and maybe convert it to a snippet)? > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > Review suggestion I've created a CSR for this change https://bugs.openjdk.org/browse/JDK-8299714 ------------- PR: https://git.openjdk.org/jdk/pull/11846 From jpai at openjdk.org Fri Jan 6 06:42:58 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Fri, 6 Jan 2023 06:42:58 GMT Subject: RFR: 8297306: Incorrect brackets in Javadoc for a constructor of IteratorSpliterator Message-ID: Can I please get a review of this change which fixes an issue in the javadoc text of the internal class IteratorSpliterator? This addresses the issue reported at https://bugs.openjdk.org/browse/JDK-8297306. ------------- Commit messages: - 8297306: Incorrect brackets in Javadoc for a constructor of IteratorSpliterator Changes: https://git.openjdk.org/jdk/pull/11876/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11876&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8297306 Stats: 4 lines in 1 file changed: 0 ins; 0 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/11876.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11876/head:pull/11876 PR: https://git.openjdk.org/jdk/pull/11876 From alanb at openjdk.org Fri Jan 6 07:53:54 2023 From: alanb at openjdk.org (Alan Bateman) Date: Fri, 6 Jan 2023 07:53:54 GMT Subject: RFR: 8015831: Add lint check for calling overridable methods from a constructor In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 02:20:53 GMT, Archie L. Cobbs wrote: > This PR adds a new lint warning category `this-escape`. > > It also adds `@SuppressWarnings` annotations as needed to the JDK itself to allow the JDK to continue to compile with `-Xlint:all`. > > A 'this' escape warning is generated for a constructor `A()` in a class `A` when the compiler detects that the following situation is _in theory possible:_ > * Some subclass `B extends A` exists, and `B` is defined in a separate source file (i.e., compilation unit) > * Some constructor `B()` of `B` invokes `A()` as its superclass constructor > * During the execution of `A()`, some non-static method of `B.foo()` could get invoked, perhaps indirectly > > In the above scenario, `B.foo()` would execute before `A()` has returned and before `B()` has performed any initialization. To the extent `B.foo()` accesses any fields of `B` - all of which are still uninitialized - it is likely to function incorrectly. > > Note, when determining if a 'this' escape is possible, the compiler makes no assumptions about code outside of the current compilation unit. It doesn't look outside of the current source file to see what might actually happen when a method is invoked. It does follow method and constructors within the current compilation unit, and applies a simplified union-of-all-possible-branches data flow analysis to see where 'this' could end up. > > From my review, virtually all of the warnings generated in the various JDK modules are valid warnings in the sense that a 'this' escape, as defined above, is really and truly possible. However, that doesn't imply that any bugs were found within the JDK - only that the possibility of a certain type of bug exists if certain superclass constructors are used by someone, somewhere, someday. > > For several "popular" classes, this PR also adds `@implNote`'s to the offending constructors so that subclass implementors are made aware of the threat. For one example, `TreeMap(Map)` invokes `putAll()` and `put()`. > > More details and a couple of motivating examples are given in an included [doc file](https://github.com/archiecobbs/jdk/blob/ThisEscape/src/java.base/share/classes/java/lang/doc-files/ThisEscape.html) that these `@implNote`'s link to. See also the recent thread on `amber-dev` for some background. > > Ideally, over time the owners of the various modules would review their `@SuppressWarnings("this-escape")` annotations and determine which other constructors also warranted such an `@implNote`. > > Because of all the`@SuppressWarnings` annotations, this PR touches a bunch of different JDK modules. My apologies for that. Adding these annotations was determined to be the more conservative approach, as compared to just excepting `this-escape` from various module builds globally. > > **Patch Navigation Guide** > > * Non-trivial compiler changes: > * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties` > > * Javadoc additions of `@implNote`: > > * `src/java.base/share/classes/java/io/PipedReader.java` > * `src/java.base/share/classes/java/io/PipedWriter.java` > * `src/java.base/share/classes/java/lang/Throwable.java` > * `src/java.base/share/classes/java/util/ArrayDeque.java` > * `src/java.base/share/classes/java/util/EnumMap.java` > * `src/java.base/share/classes/java/util/HashSet.java` > * `src/java.base/share/classes/java/util/Hashtable.java` > * `src/java.base/share/classes/java/util/LinkedList.java` > * `src/java.base/share/classes/java/util/TreeMap.java` > * `src/java.base/share/classes/java/util/TreeSet.java` > > * New unit tests > * `test/langtools/tools/javac/warnings/ThisEscape/*.java` > > * **Everything else** is just adding `@SuppressWarnings("this-escape")` This looks like a very useful lint warning to have but this PR is unwieldy. If you haven't done so already then you probably should socialize on compiler-dev and get agreement on the semantics and other details. I think you will also need to separate the addition of the lint warning from the changes to the wider JDK. It might be okay to add the feature but have it disabled for the JDK build initially. ------------- PR: https://git.openjdk.org/jdk/pull/11874 From alanb at openjdk.org Fri Jan 6 09:16:48 2023 From: alanb at openjdk.org (Alan Bateman) Date: Fri, 6 Jan 2023 09:16:48 GMT Subject: RFR: 8297306: Incorrect brackets in Javadoc for a constructor of IteratorSpliterator In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 06:35:31 GMT, Jaikiran Pai wrote: > Can I please get a review of this change which fixes an issue in the javadoc text of the internal class IteratorSpliterator? This addresses the issue reported at https://bugs.openjdk.org/browse/JDK-8297306. This looks okay although this is not a public class so it doesn't appear in the generated javadoc. ------------- Marked as reviewed by alanb (Reviewer). PR: https://git.openjdk.org/jdk/pull/11876 From alanb at openjdk.org Fri Jan 6 10:13:49 2023 From: alanb at openjdk.org (Alan Bateman) Date: Fri, 6 Jan 2023 10:13:49 GMT Subject: RFR: 8258776: ThreadLocal#initialValue() Javadoc is unaware of ThreadLocal#withInitial() [v2] In-Reply-To: References: Message-ID: On Thu, 5 Jan 2023 13:24:08 GMT, Jaikiran Pai wrote: >> Can I please get a review of this doc only change which addresses the javadoc issue noted in https://bugs.openjdk.org/browse/JDK-8258776? >> >> As noted in that issue, the `ThreadLocal.initialValue()` API javadoc suggests subclassing `ThreadLocal` and overriding the `initialValue()` method instead of recommending the `withInitial` method that was added in Java 8. >> >> The commit here updates the javadoc of `initialValue()` method to note that `withInitial` method is available for use if the programmer wants to provide an initial value. The updated javadoc continues to note that the `ThreadLocal` can be subclassed and the method overriden as the other way of providing an initial value. This change now uses the `@implSpec` construct to state this default behaviour of the `initialValue()` method. >> >> Additionally, the `get()` method's javadoc has also been updated to account for the semantics of `initialValue()`. In fact, in its current form, before the changes in this PR, the `get()` method states: >> >>> If the current thread does not support thread locals then >>> this method returns its {@link #initialValue} (or {@code null} >>> if the {@code initialValue} method is not overridden). >> >> which isn't accurate, since the `get()` will return a non-null value if the ThreadLocal was constructed through `ThreadLocal.withInitial`. Here's a trivial code which contradicts this current javadoc: >> >> >> public class Test { >> public static void main(final String[] args) throws Exception { >> Thread.ofPlatform().name("hello").allowSetThreadLocals(false).start(() -> { >> var t = ThreadLocal.withInitial(() -> 2); >> System.out.println("Thread local value is " + t.get()); >> }); >> } >> } >> >> Running this with `java --enable-preview --source 21 Test.java` returns: >> >> Thread local value is 2 >> >> >> The updated javadoc of `get()` in this PR now matches the behaviour of this method. I believe this will need a CSR, which I'll open once we have an agreement on these changes. >> >> Furthermore, the class level javadoc of `ThreadLocal` has an example of providing an initial value which uses the subclassing strategy. I haven't updated that part. Should we update that to show the `withInitialValue` usage instead (and maybe convert it to a snippet)? > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > Review suggestion Marked as reviewed by alanb (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11846 From shade at openjdk.org Fri Jan 6 11:31:57 2023 From: shade at openjdk.org (Aleksey Shipilev) Date: Fri, 6 Jan 2023 11:31:57 GMT Subject: Integrated: 8294403: [REDO] make test should report only on executed tests In-Reply-To: References: Message-ID: <6JKgG4vzz9qYTvO9IuyiD3Zav0nQxyGZTq1hua9NYLg=.86c99571-21b4-4e32-bacf-0c83cee96495@github.com> On Tue, 3 Jan 2023 09:39:59 GMT, Aleksey Shipilev wrote: > This should help to speed up tests significantly. Currently, if we run "make test" with a subset of tests, JTReg would still read the entirety of test root to report on tests that were not run. Even with current suite of tests it gets expensive. If you add more tests to suite -- for example, mounting a large test archive like pre-generated fuzzer tests -- it starts to take a lot of time. > > The reasonable default for older jtreg is `-report:executed`. My own CI -- that has millions of tests mounted in `test/` -- was running with `JTREG="OPTIONS=-report:executed"` for years now. [CODETOOLS-7903323](https://bugs.openjdk.org/browse/CODETOOLS-7903323) provides a new reporting option, `-report:files`, which makes this whole business easier. This requires new jtreg. > > Motivational improvements: > > > $ time CONF=linux-x86_64-server-release make run-test TEST=gc/epsilon/TestHelloWorld.java > > # Default JDK tree > > # Baseline > real 0m9.086s > user 0m22.857s > sys 0m4.202s > > # Patched > real 0m6.406s ; +40% faster > user 0m17.156s > sys 0m3.193s > > # +100K fuzzer tests in tree > > # Baseline > real 3m1.997s > user 3m16.643s > sys 0m10.490s > > # Patched > real 0m8.919s ; 20x faster > user 0m17.904s > sys 0m4.860s > > > Additional testing: > - [x] Ad-hoc timing tests (see above) > - [x] Reproducer from [CODETOOLS-7903331](https://bugs.openjdk.org/browse/CODETOOLS-7903331) > - [x] Eyeballing the test results on passing tests with REPEAT_COUNT > 1 > - [x] Eyeballing the test results on intermittently failing tests with RETRY_COUNT > 1 This pull request has now been integrated. Changeset: 5598acc3 Author: Aleksey Shipilev URL: https://git.openjdk.org/jdk/commit/5598acc345dbd6f806145157ae6f7c591340a1d1 Stats: 13 lines in 3 files changed: 11 ins; 0 del; 2 mod 8294403: [REDO] make test should report only on executed tests Reviewed-by: erikj, dholmes, jpai, djelinski ------------- PR: https://git.openjdk.org/jdk/pull/11824 From alanb at openjdk.org Fri Jan 6 14:00:52 2023 From: alanb at openjdk.org (Alan Bateman) Date: Fri, 6 Jan 2023 14:00:52 GMT Subject: RFR: 8299513: Cleanup java.io [v2] In-Reply-To: References: <2NZo3Ve-SeyOMN_R9Un9l8HBEkKi8yOIfNPVqWfsHto=.2f6f5766-3078-43ad-89e5-e97fcebf9e04@github.com> <2kBTHcbilR3nHqVvWEsKRjo3SsXtMgVpwnbQ0GTBE2M=.48c51d8c-0a33-4f7b-a07b-1c83a4d918e2@github.com> Message-ID: On Thu, 5 Jan 2023 17:33:05 GMT, Brian Burkhalter wrote: >> I have added a new proposal in the hope that the `requireNonNegative` method name and parameters should be trivial enough for users to directly understand without scrolling down. Let me know your thought on this. > > That is definitely better but I would be inclined to place `requireNonNegative()` between the constructors and the instance methods. It's a bit better but I think the original code is clearer/simpler, in particular it makes it clear that buf is used as the lock object. I realise this is very subjective but I think my preference would be to prefer that part and just make `buf` final. ------------- PR: https://git.openjdk.org/jdk/pull/11848 From alanb at openjdk.org Fri Jan 6 14:06:49 2023 From: alanb at openjdk.org (Alan Bateman) Date: Fri, 6 Jan 2023 14:06:49 GMT Subject: RFR: 8299513: Cleanup java.io [v2] In-Reply-To: <_WD-EQq5LaItD3HwNjjZxii8pk_AJbiadmVJJ0I1Xlc=.acda7a44-e1f2-42bc-935b-869250fb1581@github.com> References: <_WD-EQq5LaItD3HwNjjZxii8pk_AJbiadmVJJ0I1Xlc=.acda7a44-e1f2-42bc-935b-869250fb1581@github.com> Message-ID: On Thu, 5 Jan 2023 12:34:12 GMT, Per Minborg wrote: >> Code in java.io contains many legacy constructs and semantics not recommended including: >> >> * C-style array declaration >> * Unnecessary visibility >> * Redundant keywords in interfaces (e.g. public, static) >> * Non-standard naming for constants >> * Javadoc typos >> * Missing final declaration >> >> These should be fixed as a sanity effort. > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Rework StringWriter constructor I see "nonnegative" has been changed to "non-negative" in several places. I believe both are correct and there are examples of both in javadoc and exception messages. This is probably the first change to these files in 2023 so you'll need to bump the copyright year on most of them ------------- PR: https://git.openjdk.org/jdk/pull/11848 From mcimadamore at openjdk.org Fri Jan 6 14:18:42 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Fri, 6 Jan 2023 14:18:42 GMT Subject: [jdk20] RFR: 8299740: CaptureCallState is missing @Preview annotation Message-ID: This patch adds `@Preview` to the CaptureCallState interface. ------------- Commit messages: - Add @Preview annotation to CaptureCallState Changes: https://git.openjdk.org/jdk20/pull/86/files Webrev: https://webrevs.openjdk.org/?repo=jdk20&pr=86&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299740 Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk20/pull/86.diff Fetch: git fetch https://git.openjdk.org/jdk20 pull/86/head:pull/86 PR: https://git.openjdk.org/jdk20/pull/86 From alanb at openjdk.org Fri Jan 6 14:30:51 2023 From: alanb at openjdk.org (Alan Bateman) Date: Fri, 6 Jan 2023 14:30:51 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v6] In-Reply-To: References: Message-ID: On Thu, 5 Jan 2023 12:18:58 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. >> >> Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. >> >> Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. >> >> Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Use canonical NaN values also for read test/jdk/java/io/Bits/ReadWriteValues.java line 29: > 27: * @compile/module=java.base java/io/BitsProxy.java > 28: * @run junit/othervm --add-opens java.base/java.io=ALL-UNNAMED ReadWriteValues > 29: */ I see you've figured out to test with a helper classes in java.io, good! Did you mean to add a test tag to BitsProxy? That will cause jtreg to treat it as a test in its own right and it will fail. For ReadWriteValues, the --add-opens isn't needed as the test no longer does any deep reflection on APIs in that package. You can add a bug tag too, which should give you: /* * @test * @bug 8299576 * @summary Verify that reads and writes of primitives are correct * @compile/module=java.base java/io/BitsProxy.java * @run junit ReadWriteValues */ ------------- PR: https://git.openjdk.org/jdk/pull/11840 From alanb at openjdk.org Fri Jan 6 14:32:51 2023 From: alanb at openjdk.org (Alan Bateman) Date: Fri, 6 Jan 2023 14:32:51 GMT Subject: [jdk20] RFR: 8299740: CaptureCallState is missing @Preview annotation In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 14:10:52 GMT, Maurizio Cimadamore wrote: > This patch adds `@Preview` to the CaptureCallState interface. Marked as reviewed by alanb (Reviewer). ------------- PR: https://git.openjdk.org/jdk20/pull/86 From duke at openjdk.org Fri Jan 6 14:51:54 2023 From: duke at openjdk.org (Archie L. Cobbs) Date: Fri, 6 Jan 2023 14:51:54 GMT Subject: RFR: 8015831: Add lint check for calling overridable methods from a constructor In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 04:48:27 GMT, David Holmes wrote: > The associated JBS issue has been dormant for 6+ years and this is a very intrusive change affecting many, many files. Has the resurrection of this project previously been discussed somewhere? Hi @dholmes-ora, The work to add this warning has been guided by @briangoetz in discussions on the amber-dev mailing list. See that thread for how we came up with the current design, underlying motivation, etc. Regarding intrusiveness (assuming you're referring simply to the number of files touched), as mentioned this was one of two options. The other option would be to patch to about ~30 `Java.gmk` files in `make/modules` to exclude `this-escape` from `-Xlint` during the various module builds. Going this route is fine with me, but it has the downside that any new code being developed would not benefit from the new warning. This was in fact my original approach (and it was a lot easier :) but Brian rightly pointed out that adding `@SuppressWarnings` annotations was the the safer (i.e, more conservative) approach. > If you haven't done so already then you probably should socialize on compiler-dev and get agreement on the semantics and other details. Hi @AlanBateman, As mentioned this has been under discussion on amber-dev for a while. Happy to continue that discussion here as well. > I think you will also need to separate the addition of the lint warning from the changes to the wider JDK. It might be okay to add the feature but have it disabled for the JDK build initially. Sounds reasonable... so I take it you would also be in favor of patching `make/modules` instead of adding `@SuppressWarnings` annotations everywhere... is that correct? If this is generally agreed as a better route then let me know and I'll update the patch. Thanks for both of your comments. ------------- PR: https://git.openjdk.org/jdk/pull/11874 From mcimadamore at openjdk.org Fri Jan 6 14:56:03 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Fri, 6 Jan 2023 14:56:03 GMT Subject: [jdk20] Integrated: 8299740: CaptureCallState is missing @Preview annotation In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 14:10:52 GMT, Maurizio Cimadamore wrote: > This patch adds `@Preview` to the CaptureCallState interface. This pull request has now been integrated. Changeset: 5eee2a07 Author: Maurizio Cimadamore URL: https://git.openjdk.org/jdk20/commit/5eee2a07f5db5979149cc3e96d4f608ed135a7b3 Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod 8299740: CaptureCallState is missing @Preview annotation Reviewed-by: alanb ------------- PR: https://git.openjdk.org/jdk20/pull/86 From alanb at openjdk.org Fri Jan 6 15:41:16 2023 From: alanb at openjdk.org (Alan Bateman) Date: Fri, 6 Jan 2023 15:41:16 GMT Subject: RFR: 8015831: Add lint check for calling overridable methods from a constructor In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 14:49:16 GMT, Archie L. Cobbs wrote: > Sounds reasonable... so I take it you would also be in favor of patching `make/modules` instead of adding `@SuppressWarnings` annotations everywhere... is that correct? > > If this is generally agreed as a better route then let me know and I'll update the patch. Yes, I think that would be better. It would remove most of the noise, 1200+ files, and 10+ mailing lists from this PR. I assume there will be at least some iteration on compiler-dev about the details and changes to javac. Once you get to the JDK changes then I suspect that some areas may want to fix issues rather than adding SW. Sadly, I see a few examples in your list where there have been attempts to avoid leaking "this" but where we backed away out of concern that 3rd party code was extending some class and overriding a method known to be invoked by the constructor. Also we have places that register themselves to cleaners. I suspect some of the suggestions to document leaking this in implNotes will need discussion too because they amount to documenting "hooks" that people will rely on, e.g. documenting in ArrayDeque that its constructor invokes addList could be read as an invite to override it. ------------- PR: https://git.openjdk.org/jdk/pull/11874 From mcimadamore at openjdk.org Fri Jan 6 15:57:50 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Fri, 6 Jan 2023 15:57:50 GMT Subject: RFR: 8015831: Add lint check for calling overridable methods from a constructor In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 15:38:31 GMT, Alan Bateman wrote: >>> The associated JBS issue has been dormant for 6+ years and this is a very intrusive change affecting many, many files. Has the resurrection of this project previously been discussed somewhere? >> >> Hi @dholmes-ora, >> >> The work to add this warning has been guided by @briangoetz in discussions on the amber-dev mailing list. See that thread for how we came up with the current design, underlying motivation, etc. >> >> Regarding intrusiveness (assuming you're referring simply to the number of files touched), as mentioned this was one of two options. The other option would be to patch to about ~30 `Java.gmk` files in `make/modules` to exclude `this-escape` from `-Xlint` during the various module builds. >> >> Going this route is fine with me, but it has the downside that any new code being developed would not benefit from the new warning. This was in fact my original approach (and it was a lot easier :) but Brian rightly pointed out that adding `@SuppressWarnings` annotations was the the safer (i.e, more conservative) approach. >> >>> If you haven't done so already then you probably should socialize on compiler-dev and get agreement on the semantics and other details. >> >> Hi @AlanBateman, >> >> As mentioned this has been under discussion on amber-dev for a while. Happy to continue that discussion here as well. >> >>> I think you will also need to separate the addition of the lint warning from the changes to the wider JDK. It might be okay to add the feature but have it disabled for the JDK build initially. >> >> Sounds reasonable... so I take it you would also be in favor of patching `make/modules` instead of adding `@SuppressWarnings` annotations everywhere... is that correct? >> >> If this is generally agreed as a better route then let me know and I'll update the patch. >> >> Thanks for both of your comments. > >> Sounds reasonable... so I take it you would also be in favor of patching `make/modules` instead of adding `@SuppressWarnings` annotations everywhere... is that correct? >> >> If this is generally agreed as a better route then let me know and I'll update the patch. > > Yes, I think that would be better. It would remove most of the noise, 1200+ files, and 10+ mailing lists from this PR. I assume there will be at least some iteration on compiler-dev about the details and changes to javac. Once you get to the JDK changes then I suspect that some areas may want to fix issues rather than adding SW. Sadly, I see a few examples in your list where there have been attempts to avoid leaking "this" but where we backed away out of concern that 3rd party code was extending some class and overriding a method known to be invoked by the constructor. Also we have places that register themselves to cleaners. I suspect some of the suggestions to document leaking this in implNotes will need discussion too because they amount to documenting "hooks" that people will rely on, e.g. documenting in ArrayDeque that its constructor invokes addList could be read as an invite to override it. I agree with @AlanBateman. When we introduced similar warnings in the past, we have enabled support in javac (with some test) in a separate PR, and then followed up with small dedicated PR for each of the various areas (enabling new warnings one by one). See this great umbrella JBS issue (created by @asotona) which has details on all the issues that were filed when we added an extra Lint warning for lossy conversions: https://bugs.openjdk.org/browse/JDK-8286374 They all refer to this: https://bugs.openjdk.org/browse/JDK-8244681 Which was submitted as a separate javac-only PR: https://github.com/openjdk/jdk/pull/8599 ------------- PR: https://git.openjdk.org/jdk/pull/11874 From iris at openjdk.org Fri Jan 6 17:07:49 2023 From: iris at openjdk.org (Iris Clark) Date: Fri, 6 Jan 2023 17:07:49 GMT Subject: RFR: 8297306: Incorrect brackets in Javadoc for a constructor of IteratorSpliterator In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 06:35:31 GMT, Jaikiran Pai wrote: > Can I please get a review of this change which fixes an issue in the javadoc text of the internal class IteratorSpliterator? This addresses the issue reported at https://bugs.openjdk.org/browse/JDK-8297306. Marked as reviewed by iris (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11876 From duke at openjdk.org Fri Jan 6 17:38:54 2023 From: duke at openjdk.org (Markus KARG) Date: Fri, 6 Jan 2023 17:38:54 GMT Subject: Integrated: JDK-8299336 - InputStream::DEFAULT_BUFFER_SIZE should be 16384 In-Reply-To: References: Message-ID: On Fri, 23 Dec 2022 22:28:34 GMT, Markus KARG wrote: > I/O had always been much slower than CPU and memory access, and thanks to physical constraints, always will be. > While CPUs can get shrinked more and more, and can hold more and more memory cache on or nearby a CPU core, the distance between CPU core and I/O device cannot get reduced much: It will stay "far" away. > Due to this simple logic (and other factors), the spread between performance of CPU and memory access on one hand, and performance of I/O on the other hand, increases with every new CPU generation. > As a consequence, internal adjustment factors of the JDK need to get revised from time to time to ensure optimum performance and each hardware generation. > > One such factor is the size of the temporary transfer buffer used internally by `InputStream::transferTo`. > Since its introduction with JDK 9 many years (hence hardware generations) have passed, so it's time to check the appropriateness of that buffer's size. > > Using JMH on a typical, modern cloud platform, it was proven that the current 8K buffer is (much) too small on modern hardware: > The small buffer clearly stands in the way of faster transfers. > The ops/s of a simple `FileInputStream.transferTo(ByteArrayOutputStream)` operation on JDK 21 could be doubled (!) by only doubling the buffer size from 8K to 16K, which seems to be a considerable and cheap deal. > Doubling the buffer even more shows only marginal improvements of approx. 1% to 3% per duplication of size, which does not justify additional memory consumption. > > > TransferToPerformance.transferTo 8192 1048576 thrpt 25 1349.929 ? 47.057 ops/s > TransferToPerformance.transferTo 16384 1048576 thrpt 25 2633.560 ? 93.337 ops/s > TransferToPerformance.transferTo 32768 1048576 thrpt 25 2721.025 ? 89.555 ops/s > TransferToPerformance.transferTo 65536 1048576 thrpt 25 2855.949 ? 96.623 ops/s > TransferToPerformance.transferTo 131072 1048576 thrpt 25 2903.062 ? 40.798 ops/s > > > Even on small or limited platforms, an investment of 8K additonal temporary buffer is very cheap and very useful, as it doubles the performance of `InputStream::transferTo`, in particular for legacy (non-NIO) applications still using `FileInputStream` and `ByteArrayOutputStream`. > I dare to say, even if not proven, that is a very considerable (possibly the major) number of existing applications, as NIO was only adopted gradually by programmers. > > Due to the given reasons, it should be approporiate to change `DEFAULT_BUFFER_SIZE` from 8192 to 16384. This pull request has now been integrated. Changeset: 3dcf7001 Author: Markus KARG Committer: Brian Burkhalter URL: https://git.openjdk.org/jdk/commit/3dcf7001611aa66a7a1b4a01dfa6dfb296e70da1 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod 8299336: InputStream::DEFAULT_BUFFER_SIZE should be 16384 Reviewed-by: bpb ------------- PR: https://git.openjdk.org/jdk/pull/11783 From naoto at openjdk.org Fri Jan 6 17:46:50 2023 From: naoto at openjdk.org (Naoto Sato) Date: Fri, 6 Jan 2023 17:46:50 GMT Subject: RFR: 8297306: Incorrect brackets in Javadoc for a constructor of IteratorSpliterator In-Reply-To: References: Message-ID: <5iVJLueXpY5UZOaNrD8HccBhHCn7mxfg8veqjQybqYU=.67d71ee7-2247-435c-be32-31201db64d34@github.com> On Fri, 6 Jan 2023 06:35:31 GMT, Jaikiran Pai wrote: > Can I please get a review of this change which fixes an issue in the javadoc text of the internal class IteratorSpliterator? This addresses the issue reported at https://bugs.openjdk.org/browse/JDK-8297306. Hi Jai, the fix looks good as it stands. I found another location that has the same issue, i.e., `Spliterators.spliterator(Collection c, int characteristics)`. This is a public method so more relevant to the users IMO. I'd apply the same changes to it as well. ------------- PR: https://git.openjdk.org/jdk/pull/11876 From duke at openjdk.org Fri Jan 6 17:51:09 2023 From: duke at openjdk.org (Justin Lu) Date: Fri, 6 Jan 2023 17:51:09 GMT Subject: RFR: 8299500: Usage of constructors of primitive wrapper classes should be avoided in java.text API docs Message-ID: <5beb38afAjMVpmWkhEizo6dwAqadjESW5pYiwCg5JxU=.4296244c-e0d6-4c83-9c28-7641a988f07b@github.com> Removed constructors of primitive wrapper classes (deprecated for removal) for the following - _java.text.ChoiceFormat_ - _java.text.MessageFormat_ Replaced with .valueOf() method ------------- Commit messages: - Fix ChoiceFormat - Fix MessageFormat Changes: https://git.openjdk.org/jdk/pull/11884/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11884&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299500 Stats: 7 lines in 2 files changed: 0 ins; 0 del; 7 mod Patch: https://git.openjdk.org/jdk/pull/11884.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11884/head:pull/11884 PR: https://git.openjdk.org/jdk/pull/11884 From naoto at openjdk.org Fri Jan 6 18:39:59 2023 From: naoto at openjdk.org (Naoto Sato) Date: Fri, 6 Jan 2023 18:39:59 GMT Subject: RFR: 8299500: Usage of constructors of primitive wrapper classes should be avoided in java.text API docs In-Reply-To: <5beb38afAjMVpmWkhEizo6dwAqadjESW5pYiwCg5JxU=.4296244c-e0d6-4c83-9c28-7641a988f07b@github.com> References: <5beb38afAjMVpmWkhEizo6dwAqadjESW5pYiwCg5JxU=.4296244c-e0d6-4c83-9c28-7641a988f07b@github.com> Message-ID: On Fri, 6 Jan 2023 17:42:53 GMT, Justin Lu wrote: > Removed constructors of primitive wrapper classes (deprecated for removal) for the following > - _java.text.ChoiceFormat_ > - _java.text.MessageFormat_ > > Replaced with .valueOf() method LGTM src/java.base/share/classes/java/text/MessageFormat.java line 313: > 311: * String result = mf.format( objs ); > 312: * // result now equals "3.14, 3.1" > 313: * objs = null; Although this is not related to this fix, this line `objs = null` is not needed (and is confusing as an example snippet). I'd remove this. ------------- Marked as reviewed by naoto (Reviewer). PR: https://git.openjdk.org/jdk/pull/11884 From naoto at openjdk.org Fri Jan 6 18:45:54 2023 From: naoto at openjdk.org (Naoto Sato) Date: Fri, 6 Jan 2023 18:45:54 GMT Subject: [jdk20] RFR: 8299689: Make use of JLine for Console as "opt-in" Message-ID: <1Y0pELaN2mrGhHLgXtfgdO65EUNI__6wNf6oy2KKzFE=.bdd50824-05b4-4a49-ad52-d56796915261@github.com> Due to the fact that JLine spawns native processes to obtain terminal information on macOS/Linux, we decided to disable the JLine by default for performance degradation reasons. It is still possible to enable it by specifying it on the command line with `jdk.console` system property (not a public one though). Once we have a solution to avoid spawning processes, JLine may be back for use in the future. ------------- Commit messages: - JIRA issue number fix - Fixing another test - Fixed the default in test - Disable JLine Changes: https://git.openjdk.org/jdk20/pull/88/files Webrev: https://webrevs.openjdk.org/?repo=jdk20&pr=88&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299689 Stats: 34 lines in 3 files changed: 18 ins; 1 del; 15 mod Patch: https://git.openjdk.org/jdk20/pull/88.diff Fetch: git fetch https://git.openjdk.org/jdk20 pull/88/head:pull/88 PR: https://git.openjdk.org/jdk20/pull/88 From duke at openjdk.org Fri Jan 6 18:51:12 2023 From: duke at openjdk.org (Justin Lu) Date: Fri, 6 Jan 2023 18:51:12 GMT Subject: RFR: 8299500: Usage of constructors of primitive wrapper classes should be avoided in java.text API docs [v2] In-Reply-To: <5beb38afAjMVpmWkhEizo6dwAqadjESW5pYiwCg5JxU=.4296244c-e0d6-4c83-9c28-7641a988f07b@github.com> References: <5beb38afAjMVpmWkhEizo6dwAqadjESW5pYiwCg5JxU=.4296244c-e0d6-4c83-9c28-7641a988f07b@github.com> Message-ID: > Removed constructors of primitive wrapper classes (deprecated for removal) for the following > - _java.text.ChoiceFormat_ > - _java.text.MessageFormat_ > > Replaced with .valueOf() method Justin Lu has updated the pull request incrementally with one additional commit since the last revision: Remove objs=null ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11884/files - new: https://git.openjdk.org/jdk/pull/11884/files/d6332659..cf833aee Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11884&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11884&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 1 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/11884.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11884/head:pull/11884 PR: https://git.openjdk.org/jdk/pull/11884 From duke at openjdk.org Fri Jan 6 18:51:13 2023 From: duke at openjdk.org (Justin Lu) Date: Fri, 6 Jan 2023 18:51:13 GMT Subject: RFR: 8299500: Usage of constructors of primitive wrapper classes should be avoided in java.text API docs [v2] In-Reply-To: References: <5beb38afAjMVpmWkhEizo6dwAqadjESW5pYiwCg5JxU=.4296244c-e0d6-4c83-9c28-7641a988f07b@github.com> Message-ID: <_mekbW1uR6F5k3_CrWFZiIpp_hN-rHW6t39mAQ1A4fA=.0e09cd1c-402e-479c-b292-559c66798069@github.com> On Fri, 6 Jan 2023 18:36:08 GMT, Naoto Sato wrote: >> Justin Lu has updated the pull request incrementally with one additional commit since the last revision: >> >> Remove objs=null > > src/java.base/share/classes/java/text/MessageFormat.java line 313: > >> 311: * String result = mf.format( objs ); >> 312: * // result now equals "3.14, 3.1" >> 313: * objs = null; > > Although this is not related to this fix, this line `objs = null` is not needed (and is confusing as an example snippet). I'd remove this. Makes sense, just got rid of it ------------- PR: https://git.openjdk.org/jdk/pull/11884 From duke at openjdk.org Fri Jan 6 19:03:00 2023 From: duke at openjdk.org (Justin Lu) Date: Fri, 6 Jan 2023 19:03:00 GMT Subject: RFR: 8299501: Usage of constructors of primitive wrapper classes should be avoided in java.util API docs Message-ID: Removed constructors of primitive wrapper classes (deprecated for removal) in _java.util.Arrays_ Replaced with .valueOf() method ------------- Commit messages: - Fix java.util.Arrays Changes: https://git.openjdk.org/jdk/pull/11885/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11885&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299501 Stats: 5 lines in 1 file changed: 0 ins; 0 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/11885.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11885/head:pull/11885 PR: https://git.openjdk.org/jdk/pull/11885 From lancea at openjdk.org Fri Jan 6 19:13:55 2023 From: lancea at openjdk.org (Lance Andersen) Date: Fri, 6 Jan 2023 19:13:55 GMT Subject: RFR: 8299500: Usage of constructors of primitive wrapper classes should be avoided in java.text API docs [v2] In-Reply-To: References: <5beb38afAjMVpmWkhEizo6dwAqadjESW5pYiwCg5JxU=.4296244c-e0d6-4c83-9c28-7641a988f07b@github.com> Message-ID: On Fri, 6 Jan 2023 18:51:12 GMT, Justin Lu wrote: >> Removed constructors of primitive wrapper classes (deprecated for removal) for the following >> - _java.text.ChoiceFormat_ >> - _java.text.MessageFormat_ >> >> Replaced with .valueOf() method > > Justin Lu has updated the pull request incrementally with one additional commit since the last revision: > > Remove objs=null Looks fine Justin, thanks for doing this. At some point we should convert the examples to be a snippet which we can do at a later time ------------- Marked as reviewed by lancea (Reviewer). PR: https://git.openjdk.org/jdk/pull/11884 From duke at openjdk.org Fri Jan 6 19:22:51 2023 From: duke at openjdk.org (Justin Lu) Date: Fri, 6 Jan 2023 19:22:51 GMT Subject: RFR: 8299500: Usage of constructors of primitive wrapper classes should be avoided in java.text API docs [v2] In-Reply-To: References: <5beb38afAjMVpmWkhEizo6dwAqadjESW5pYiwCg5JxU=.4296244c-e0d6-4c83-9c28-7641a988f07b@github.com> Message-ID: On Fri, 6 Jan 2023 19:10:57 GMT, Lance Andersen wrote: > Looks fine Justin, thanks for doing this. > > At some point we should convert the examples to be a snippet which we can do at a later time Sounds good ? ------------- PR: https://git.openjdk.org/jdk/pull/11884 From naoto at openjdk.org Fri Jan 6 19:27:52 2023 From: naoto at openjdk.org (Naoto Sato) Date: Fri, 6 Jan 2023 19:27:52 GMT Subject: RFR: 8299501: Usage of constructors of primitive wrapper classes should be avoided in java.util API docs In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 18:54:07 GMT, Justin Lu wrote: > Removed constructors of primitive wrapper classes (deprecated for removal) in _java.util.Arrays_ > > Replaced with .valueOf() method LGTM ------------- Marked as reviewed by naoto (Reviewer). PR: https://git.openjdk.org/jdk/pull/11885 From lancea at openjdk.org Fri Jan 6 19:32:54 2023 From: lancea at openjdk.org (Lance Andersen) Date: Fri, 6 Jan 2023 19:32:54 GMT Subject: RFR: 8299501: Usage of constructors of primitive wrapper classes should be avoided in java.util API docs In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 18:54:07 GMT, Justin Lu wrote: > Removed constructors of primitive wrapper classes (deprecated for removal) in _java.util.Arrays_ > > Replaced with .valueOf() method Marked as reviewed by lancea (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11885 From sviswanathan at openjdk.org Fri Jan 6 19:48:56 2023 From: sviswanathan at openjdk.org (Sandhya Viswanathan) Date: Fri, 6 Jan 2023 19:48:56 GMT Subject: RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v13] In-Reply-To: References: <6lAQI6kDDTGbskylHcWReX8ExaB6qkwgqoai7E6ikZY=.8a69a63c-453d-4bbd-8c76-4d477bfb77fe@github.com> Message-ID: On Thu, 22 Dec 2022 13:10:02 GMT, Claes Redestad wrote: >> @cl4es Thanks for passing the constant node through, the code looks much cleaner now. The attached patch should handle the signed bytes/shorts as well. Please take a look. >> [signed.patch](https://github.com/openjdk/jdk/files/10273480/signed.patch) > > I ran tests and some quick microbenchmarking to validate @sviswa7's patch to activate vectorization for `short` and `byte` arrays and it looks good: > > Before: > > Benchmark (size) Mode Cnt Score Error Units > ArraysHashCode.bytes 10000 avgt 5 7845.586 ? 23.440 ns/op > ArraysHashCode.chars 10000 avgt 5 1203.163 ? 11.995 ns/op > ArraysHashCode.ints 10000 avgt 5 1131.915 ? 7.843 ns/op > ArraysHashCode.multibytes 10000 avgt 5 4136.487 ? 5.790 ns/op > ArraysHashCode.multichars 10000 avgt 5 671.328 ? 17.629 ns/op > ArraysHashCode.multiints 10000 avgt 5 699.051 ? 8.135 ns/op > ArraysHashCode.multishorts 10000 avgt 5 4139.300 ? 10.633 ns/op > ArraysHashCode.shorts 10000 avgt 5 7844.019 ? 26.071 ns/op > > > After: > > Benchmark (size) Mode Cnt Score Error Units > ArraysHashCode.bytes 10000 avgt 5 1193.208 ? 1.965 ns/op > ArraysHashCode.chars 10000 avgt 5 1193.311 ? 5.941 ns/op > ArraysHashCode.ints 10000 avgt 5 1132.592 ? 10.410 ns/op > ArraysHashCode.multibytes 10000 avgt 5 657.343 ? 25.343 ns/op > ArraysHashCode.multichars 10000 avgt 5 672.668 ? 5.229 ns/op > ArraysHashCode.multiints 10000 avgt 5 697.143 ? 3.929 ns/op > ArraysHashCode.multishorts 10000 avgt 5 666.738 ? 12.236 ns/op > ArraysHashCode.shorts 10000 avgt 5 1193.563 ? 5.449 ns/op @cl4es There seem to be failure on windows-x64 platform pre submit tests. Could you please take a look? ------------- PR: https://git.openjdk.org/jdk/pull/10847 From duke at openjdk.org Fri Jan 6 20:09:47 2023 From: duke at openjdk.org (Justin Lu) Date: Fri, 6 Jan 2023 20:09:47 GMT Subject: RFR: 8299502: Usage of constructors of primitive wrapper classes should be avoided in javax.xml API docs Message-ID: Removed constructors of primitive wrapper classes (deprecated for removal) in _javax.xml.stream.XMLOutputFactory_ Replaced with Boolean static fields: Boolean.TRUE and Boolean.FALSE ------------- Commit messages: - Copyright year - Replace constructor with static field Changes: https://git.openjdk.org/jdk/pull/11872/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11872&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299502 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/11872.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11872/head:pull/11872 PR: https://git.openjdk.org/jdk/pull/11872 From duke at openjdk.org Fri Jan 6 20:09:49 2023 From: duke at openjdk.org (Justin Lu) Date: Fri, 6 Jan 2023 20:09:49 GMT Subject: RFR: 8299502: Usage of constructors of primitive wrapper classes should be avoided in javax.xml API docs In-Reply-To: References: Message-ID: On Thu, 5 Jan 2023 21:59:30 GMT, Justin Lu wrote: > Removed constructors of primitive wrapper classes (deprecated for removal) in _javax.xml.stream.XMLOutputFactory_ > > Replaced with Boolean static fields: Boolean.TRUE and Boolean.FALSE src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java line 59: > 57: * > 58: *

The property can be set with the following code line: > 59: * {@code setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE|Boolean.FALSE);} >From a code standpoint I don't see why the OR operation is needed (Also, shouldn't a Conditional OR be used over a Bitwise OR). Is it to emphasize that true _or_ false can be passed as a parameter? ------------- PR: https://git.openjdk.org/jdk/pull/11872 From stsypanov at openjdk.org Fri Jan 6 21:04:57 2023 From: stsypanov at openjdk.org (Sergey Tsypanov) Date: Fri, 6 Jan 2023 21:04:57 GMT Subject: Integrated: 8299600: Use Objects.check*() where appropriate in java.io In-Reply-To: References: Message-ID: <6LKSV9xS19x1LOTWhmmbxlQu_9-R6AwjFzvUo9CPZdI=.2b6afbd0-f361-45c2-84c2-e5f052fabe8f@github.com> On Wed, 4 Jan 2023 15:50:35 GMT, Sergey Tsypanov wrote: > Use the following methods instead of hand-written code: > - Objects.checkFromIndexSize() > - Objects.checkFromToIndex() This pull request has now been integrated. Changeset: d086e82b Author: Sergey Tsypanov Committer: Brian Burkhalter URL: https://git.openjdk.org/jdk/commit/d086e82b3c554362a8fc7095025f8f2910d6e4bc Stats: 37 lines in 6 files changed: 10 ins; 9 del; 18 mod 8299600: Use Objects.check*() where appropriate in java.io Reviewed-by: alanb, bpb ------------- PR: https://git.openjdk.org/jdk/pull/11849 From mchung at openjdk.org Fri Jan 6 21:15:38 2023 From: mchung at openjdk.org (Mandy Chung) Date: Fri, 6 Jan 2023 21:15:38 GMT Subject: RFR: 8299183: Invokers.checkExactType passes parameters to create WMTE in opposite order [v2] In-Reply-To: <68ERvONXzd-5lr4Au21sLFN-etSesjFy8tHzLSTsil0=.ea75bf5c-9dc8-4fbe-83b0-b55bc30da2c6@github.com> References: <68ERvONXzd-5lr4Au21sLFN-etSesjFy8tHzLSTsil0=.ea75bf5c-9dc8-4fbe-83b0-b55bc30da2c6@github.com> Message-ID: > Trivial fix. Fix `Invokers.checkExactType` to call `newWrongMethodTypeException(actual, expected)` with parameters in right order. Mandy Chung has updated the pull request incrementally with two additional commits since the last revision: - Add a regression test - further cleanup newWrongMethodTypeException for clarity ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11870/files - new: https://git.openjdk.org/jdk/pull/11870/files/3d074593..35968a32 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11870&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11870&range=00-01 Stats: 98 lines in 3 files changed: 87 ins; 1 del; 10 mod Patch: https://git.openjdk.org/jdk/pull/11870.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11870/head:pull/11870 PR: https://git.openjdk.org/jdk/pull/11870 From mchung at openjdk.org Fri Jan 6 21:17:52 2023 From: mchung at openjdk.org (Mandy Chung) Date: Fri, 6 Jan 2023 21:17:52 GMT Subject: RFR: 8299183: Invokers.checkExactType passes parameters to create WMTE in opposite order In-Reply-To: References: <68ERvONXzd-5lr4Au21sLFN-etSesjFy8tHzLSTsil0=.ea75bf5c-9dc8-4fbe-83b0-b55bc30da2c6@github.com> Message-ID: On Fri, 6 Jan 2023 01:05:40 GMT, Jaikiran Pai wrote: >> Trivial fix. Fix `Invokers.checkExactType` to call `newWrongMethodTypeException(actual, expected)` with parameters in right order. > > Hello Mandy, this looks good to me. The copyright year on the file will need an update. > > There's another call to this `newWrongMethodTypeException` method on line 515 and I am guessing that one is already passing the params in the correct order. If I go by that same logic, then there appears to be a direct construction of `WrongMethodTypeException` on line 497 and I suspect the `String` passed to it is perhaps using the wrong order? It currently says: > > > if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { > throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " > + ad.symbolicMethodTypeExact); > } > > Should it instead say: > > if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { > throw new WrongMethodTypeException("expected " + ad.symbolicMethodTypeExact + " but found " > + handle.accessModeType(ad.type)); > } @jaikiran good observation. "expected" and "actual" parameters are confusing. "expected" is ambiguous and it could refer to handle's method type or symbolic type descriptor. I decide to rename the parameters and the exception message for clarity. ------------- PR: https://git.openjdk.org/jdk/pull/11870 From joehw at openjdk.org Fri Jan 6 21:23:55 2023 From: joehw at openjdk.org (Joe Wang) Date: Fri, 6 Jan 2023 21:23:55 GMT Subject: RFR: 8299502: Usage of constructors of primitive wrapper classes should be avoided in javax.xml API docs In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 19:56:20 GMT, Justin Lu wrote: >> Removed constructors of primitive wrapper classes (deprecated for removal) in _javax.xml.stream.XMLOutputFactory_ >> >> Replaced with Boolean static fields: Boolean.TRUE and Boolean.FALSE > > src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java line 59: > >> 57: * >> 58: *

The property can be set with the following code line: >> 59: * {@code setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE|Boolean.FALSE);} > > From a code standpoint I don't see why the OR operation is needed (Also, shouldn't a Conditional OR be used over a Bitwise OR). Is it to emphasize that true _or_ false can be passed as a parameter? I think the later, that the value can be true or false. As an example, one value is fine, e.g. {@code setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);} or {@code setProperty("javax.xml.stream.isRepairingNamespaces", true);} let autoboxing handle it. ------------- PR: https://git.openjdk.org/jdk/pull/11872 From lancea at openjdk.org Fri Jan 6 21:36:51 2023 From: lancea at openjdk.org (Lance Andersen) Date: Fri, 6 Jan 2023 21:36:51 GMT Subject: RFR: 8299502: Usage of constructors of primitive wrapper classes should be avoided in javax.xml API docs In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 21:20:45 GMT, Joe Wang wrote: >> src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java line 59: >> >>> 57: * >>> 58: *

The property can be set with the following code line: >>> 59: * {@code setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE|Boolean.FALSE);} >> >> From a code standpoint I don't see why the OR operation is needed (Also, shouldn't a Conditional OR be used over a Bitwise OR). Is it to emphasize that true _or_ false can be passed as a parameter? > > I think the later, that the value can be true or false. As an example, one value is fine, e.g. > {@code setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);} > or > {@code setProperty("javax.xml.stream.isRepairingNamespaces", true);} > let autoboxing handle it. The` true|false` should just be changed to just set the value to _true_ or _false_. I think `Boolean.TRUE` is fine. If the consensus is to use autoboxing in the example that is fine also. ------------- PR: https://git.openjdk.org/jdk/pull/11872 From duke at openjdk.org Fri Jan 6 21:54:51 2023 From: duke at openjdk.org (Justin Lu) Date: Fri, 6 Jan 2023 21:54:51 GMT Subject: RFR: 8299502: Usage of constructors of primitive wrapper classes should be avoided in javax.xml API docs In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 21:34:00 GMT, Lance Andersen wrote: >> I think the later, that the value can be true or false. As an example, one value is fine, e.g. >> {@code setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);} >> or >> {@code setProperty("javax.xml.stream.isRepairingNamespaces", true);} >> let autoboxing handle it. > > The` true|false` should just be changed to just set the value to _true_ or _false_. > > I think `Boolean.TRUE` is fine. If the consensus is to use autoboxing in the example that is fine also. Thank you Joe and Lance, will replace it with a single value ------------- PR: https://git.openjdk.org/jdk/pull/11872 From duke at openjdk.org Fri Jan 6 21:59:13 2023 From: duke at openjdk.org (Justin Lu) Date: Fri, 6 Jan 2023 21:59:13 GMT Subject: RFR: 8299502: Usage of constructors of primitive wrapper classes should be avoided in javax.xml API docs [v2] In-Reply-To: References: Message-ID: > Removed constructors of primitive wrapper classes (deprecated for removal) in _javax.xml.stream.XMLOutputFactory_ > > Replaced with Boolean static fields: Boolean.TRUE and Boolean.FALSE Justin Lu has updated the pull request incrementally with one additional commit since the last revision: Replace | with single value in example ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11872/files - new: https://git.openjdk.org/jdk/pull/11872/files/44c37d9f..91d20422 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11872&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11872&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/11872.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11872/head:pull/11872 PR: https://git.openjdk.org/jdk/pull/11872 From duke at openjdk.org Fri Jan 6 22:44:29 2023 From: duke at openjdk.org (Justin Lu) Date: Fri, 6 Jan 2023 22:44:29 GMT Subject: RFR: 8177418: TimeZone.getTimeZone(String id) throws NullPointerException when id is null Message-ID: When ID is null, TimeZone.getTimeZone(String ID) throws a NullPointerException. For example, String someID = null; TimeZone tz1 = TimeZone.getTimeZone(someID); ``` throws a `NullPointerException` This change updates the documentation to make this apparent. ------------- Commit messages: - Add missing @throws Changes: https://git.openjdk.org/jdk/pull/11888/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11888&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8177418 Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/11888.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11888/head:pull/11888 PR: https://git.openjdk.org/jdk/pull/11888 From duke at openjdk.org Fri Jan 6 23:13:09 2023 From: duke at openjdk.org (Archie L. Cobbs) Date: Fri, 6 Jan 2023 23:13:09 GMT Subject: RFR: 8015831: Add lint check for calling overridable methods from a constructor [v2] In-Reply-To: References: Message-ID: > This PR adds a new lint warning category `this-escape`. > > It also adds `@SuppressWarnings` annotations as needed to the JDK itself to allow the JDK to continue to compile with `-Xlint:all`. > > A 'this' escape warning is generated for a constructor `A()` in a class `A` when the compiler detects that the following situation is _in theory possible:_ > * Some subclass `B extends A` exists, and `B` is defined in a separate source file (i.e., compilation unit) > * Some constructor `B()` of `B` invokes `A()` as its superclass constructor > * During the execution of `A()`, some non-static method of `B.foo()` could get invoked, perhaps indirectly > > In the above scenario, `B.foo()` would execute before `A()` has returned and before `B()` has performed any initialization. To the extent `B.foo()` accesses any fields of `B` - all of which are still uninitialized - it is likely to function incorrectly. > > Note, when determining if a 'this' escape is possible, the compiler makes no assumptions about code outside of the current compilation unit. It doesn't look outside of the current source file to see what might actually happen when a method is invoked. It does follow method and constructors within the current compilation unit, and applies a simplified union-of-all-possible-branches data flow analysis to see where 'this' could end up. > > From my review, virtually all of the warnings generated in the various JDK modules are valid warnings in the sense that a 'this' escape, as defined above, is really and truly possible. However, that doesn't imply that any bugs were found within the JDK - only that the possibility of a certain type of bug exists if certain superclass constructors are used by someone, somewhere, someday. > > For several "popular" classes, this PR also adds `@implNote`'s to the offending constructors so that subclass implementors are made aware of the threat. For one example, `TreeMap(Map)` invokes `putAll()` and `put()`. > > More details and a couple of motivating examples are given in an included [doc file](https://github.com/archiecobbs/jdk/blob/ThisEscape/src/java.base/share/classes/java/lang/doc-files/ThisEscape.html) that these `@implNote`'s link to. See also the recent thread on `amber-dev` for some background. > > Ideally, over time the owners of the various modules would review their `@SuppressWarnings("this-escape")` annotations and determine which other constructors also warranted such an `@implNote`. > > Because of all the`@SuppressWarnings` annotations, this PR touches a bunch of different JDK modules. My apologies for that. Adding these annotations was determined to be the more conservative approach, as compared to just excepting `this-escape` from various module builds globally. > > **Patch Navigation Guide** > > * Non-trivial compiler changes: > * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties` > > * Javadoc additions of `@implNote`: > > * `src/java.base/share/classes/java/io/PipedReader.java` > * `src/java.base/share/classes/java/io/PipedWriter.java` > * `src/java.base/share/classes/java/lang/Throwable.java` > * `src/java.base/share/classes/java/util/ArrayDeque.java` > * `src/java.base/share/classes/java/util/EnumMap.java` > * `src/java.base/share/classes/java/util/HashSet.java` > * `src/java.base/share/classes/java/util/Hashtable.java` > * `src/java.base/share/classes/java/util/LinkedList.java` > * `src/java.base/share/classes/java/util/TreeMap.java` > * `src/java.base/share/classes/java/util/TreeSet.java` > > * New unit tests > * `test/langtools/tools/javac/warnings/ThisEscape/*.java` > > * **Everything else** is just adding `@SuppressWarnings("this-escape")` Archie L. Cobbs has updated the pull request incrementally with two additional commits since the last revision: - Update copyright year for newly added files to 2023. - Suppress "this-escape" warnings using build flags instead of @SuppressAnnotations annotations. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11874/files - new: https://git.openjdk.org/jdk/pull/11874/files/9c162283..f667cd56 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11874&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11874&range=00-01 Stats: 1935 lines in 1303 files changed: 60 ins; 1770 del; 105 mod Patch: https://git.openjdk.org/jdk/pull/11874.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11874/head:pull/11874 PR: https://git.openjdk.org/jdk/pull/11874 From duke at openjdk.org Fri Jan 6 23:13:09 2023 From: duke at openjdk.org (Archie L. Cobbs) Date: Fri, 6 Jan 2023 23:13:09 GMT Subject: RFR: 8015831: Add lint check for calling overridable methods from a constructor In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 15:38:31 GMT, Alan Bateman wrote: >>> The associated JBS issue has been dormant for 6+ years and this is a very intrusive change affecting many, many files. Has the resurrection of this project previously been discussed somewhere? >> >> Hi @dholmes-ora, >> >> The work to add this warning has been guided by @briangoetz in discussions on the amber-dev mailing list. See that thread for how we came up with the current design, underlying motivation, etc. >> >> Regarding intrusiveness (assuming you're referring simply to the number of files touched), as mentioned this was one of two options. The other option would be to patch to about ~30 `Java.gmk` files in `make/modules` to exclude `this-escape` from `-Xlint` during the various module builds. >> >> Going this route is fine with me, but it has the downside that any new code being developed would not benefit from the new warning. This was in fact my original approach (and it was a lot easier :) but Brian rightly pointed out that adding `@SuppressWarnings` annotations was the the safer (i.e, more conservative) approach. >> >>> If you haven't done so already then you probably should socialize on compiler-dev and get agreement on the semantics and other details. >> >> Hi @AlanBateman, >> >> As mentioned this has been under discussion on amber-dev for a while. Happy to continue that discussion here as well. >> >>> I think you will also need to separate the addition of the lint warning from the changes to the wider JDK. It might be okay to add the feature but have it disabled for the JDK build initially. >> >> Sounds reasonable... so I take it you would also be in favor of patching `make/modules` instead of adding `@SuppressWarnings` annotations everywhere... is that correct? >> >> If this is generally agreed as a better route then let me know and I'll update the patch. >> >> Thanks for both of your comments. > >> Sounds reasonable... so I take it you would also be in favor of patching `make/modules` instead of adding `@SuppressWarnings` annotations everywhere... is that correct? >> >> If this is generally agreed as a better route then let me know and I'll update the patch. > > Yes, I think that would be better. It would remove most of the noise, 1200+ files, and 10+ mailing lists from this PR. I assume there will be at least some iteration on compiler-dev about the details and changes to javac. Once you get to the JDK changes then I suspect that some areas may want to fix issues rather than adding SW. Sadly, I see a few examples in your list where there have been attempts to avoid leaking "this" but where we backed away out of concern that 3rd party code was extending some class and overriding a method known to be invoked by the constructor. Also we have places that register themselves to cleaners. I suspect some of the suggestions to document leaking this in implNotes will need discussion too because they amount to documenting "hooks" that people will rely on, e.g. documenting in ArrayDeque that its constructor invokes addList could be read as an invite to override it. Hi @AlanBateman, OK that sounds like a plan. I've pushed a new commit to the `ThisEscape` branch that removes all the`@SuppressWarnings` annotations and replaces them with adjustments to build flags. I've moved the `@SuppressWarnings` annotations onto a new branch `ThisEscapeAnnotations`. This is just for future reference in case somebody wants to add them back someday and doesn't want to start from scratch. > I suspect some of the suggestions to document leaking this in implNotes will need discussion too because they amount to documenting "hooks" that people will rely on, e.g. documenting in ArrayDeque that its constructor invokes addList could be read as an invite to override it. Hmm. Hasn't that horse already left the barn? You kind of implied that when you said: > I see a few examples in your list where there have been attempts to avoid leaking "this" but where we backed away out of concern that 3rd party code was extending some class and overriding a method known to be invoked by the constructor. In other words, it doesn't sound like changing the behavior of these constructors is viable option at this point. And if that's the case, we might as well document and warn about the current behavior. Of course I'd love to be wrong... in which case, we can fix these constructors. Or, the third option - just do nothing yet. That would mean removing the warnings, which is fine. But then the `ThisEscape.html` document is orphaned. What should we do with it? I can remove it, just leave it there, or put it somewhere else (where?). It seems like having some documentation of the meaning of "this escape" would be helpful, because it's a subtle concept and there are multiple ways to define "escape". Thanks. @mcimadamore thanks for the bugs suggestion, I'll put that on the to-do list. ------------- PR: https://git.openjdk.org/jdk/pull/11874 From joehw at openjdk.org Fri Jan 6 23:19:52 2023 From: joehw at openjdk.org (Joe Wang) Date: Fri, 6 Jan 2023 23:19:52 GMT Subject: RFR: 8299502: Usage of constructors of primitive wrapper classes should be avoided in javax.xml API docs [v2] In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 21:59:13 GMT, Justin Lu wrote: >> Removed constructors of primitive wrapper classes (deprecated for removal) in _javax.xml.stream.XMLOutputFactory_ >> >> Replaced with Boolean static fields: Boolean.TRUE and Boolean.FALSE > > Justin Lu has updated the pull request incrementally with one additional commit since the last revision: > > Replace | with single value in example Marked as reviewed by joehw (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11872 From naoto at openjdk.org Sat Jan 7 00:15:53 2023 From: naoto at openjdk.org (Naoto Sato) Date: Sat, 7 Jan 2023 00:15:53 GMT Subject: RFR: 8299502: Usage of constructors of primitive wrapper classes should be avoided in javax.xml API docs [v2] In-Reply-To: References: Message-ID: <5V-EK-V8hN2br_pnqoHE5UAbl5U_DVe56E34yL_MFyE=.2cb31f1c-663e-4a36-8b47-22405db55591@github.com> On Fri, 6 Jan 2023 21:59:13 GMT, Justin Lu wrote: >> Removed constructors of primitive wrapper classes (deprecated for removal) in _javax.xml.stream.XMLOutputFactory_ >> >> Replaced with Boolean static fields: Boolean.TRUE and Boolean.FALSE > > Justin Lu has updated the pull request incrementally with one additional commit since the last revision: > > Replace | with single value in example Marked as reviewed by naoto (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11872 From jwilhelm at openjdk.org Sat Jan 7 01:16:10 2023 From: jwilhelm at openjdk.org (Jesper Wilhelmsson) Date: Sat, 7 Jan 2023 01:16:10 GMT Subject: RFR: Merge jdk20 Message-ID: Forwardport JDK 20 -> JDK 21 ------------- Commit messages: - Merge remote-tracking branch 'jdk20/master' into Merge_jdk20 - 8299705: JCov coverage runs depend on jdk_symbols - 8299740: CaptureCallState is missing @Preview annotation - 8299528: IR test: TestEor3AArch64.java fails on aarch64 - 8298525: javadoc crashes with "UnsupportedOperationException: Not yet implemented" in SeeTaglet.inherit - 8299561: VaList.empty() doesn't return a list associated with the global scope The webrevs contain the adjustments done while merging with regards to each parent branch: - master: https://webrevs.openjdk.org/?repo=jdk&pr=11889&range=00.0 - jdk20: https://webrevs.openjdk.org/?repo=jdk&pr=11889&range=00.1 Changes: https://git.openjdk.org/jdk/pull/11889/files Stats: 54 lines in 10 files changed: 39 ins; 0 del; 15 mod Patch: https://git.openjdk.org/jdk/pull/11889.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11889/head:pull/11889 PR: https://git.openjdk.org/jdk/pull/11889 From duke at openjdk.org Sat Jan 7 01:33:49 2023 From: duke at openjdk.org (Justin Lu) Date: Sat, 7 Jan 2023 01:33:49 GMT Subject: RFR: 6381945: (cal) Japanese calendar unit test system should avoid multiple static imports Message-ID: Within _test/jdk/java/util/Calendar/CalendarTestScripts/Symbol.java_ GregorianCalendar alone handles all the necessary imports, Calendar is not needed ------------- Commit messages: - Update copyright - Remove redundant import Changes: https://git.openjdk.org/jdk/pull/11855/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11855&range=00 Issue: https://bugs.openjdk.org/browse/JDK-6381945 Stats: 2 lines in 1 file changed: 0 ins; 1 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/11855.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11855/head:pull/11855 PR: https://git.openjdk.org/jdk/pull/11855 From jwilhelm at openjdk.org Sat Jan 7 02:08:56 2023 From: jwilhelm at openjdk.org (Jesper Wilhelmsson) Date: Sat, 7 Jan 2023 02:08:56 GMT Subject: Integrated: Merge jdk20 In-Reply-To: References: Message-ID: <-2H4IjL6XCZs0Br_s864ZDRUi2knCTWanFxFiVkx5Fs=.ee6eface-2519-401e-bd51-88c8dd211aab@github.com> On Sat, 7 Jan 2023 01:08:48 GMT, Jesper Wilhelmsson wrote: > Forwardport JDK 20 -> JDK 21 This pull request has now been integrated. Changeset: 5393dc9a Author: Jesper Wilhelmsson URL: https://git.openjdk.org/jdk/commit/5393dc9a48064505f0b79b7059f87bec33c1c8fe Stats: 54 lines in 10 files changed: 39 ins; 0 del; 15 mod Merge ------------- PR: https://git.openjdk.org/jdk/pull/11889 From duke at openjdk.org Sat Jan 7 02:22:58 2023 From: duke at openjdk.org (Justin Lu) Date: Sat, 7 Jan 2023 02:22:58 GMT Subject: Integrated: 8299617: CurrencySymbols.properties is missing the copyright notice In-Reply-To: <3P2LV_PvCy1tn3ALX_uNgNGUvtNM2Xs672NJJpW66cQ=.9f817221-c95a-49ed-b360-3861f6a7950d@github.com> References: <3P2LV_PvCy1tn3ALX_uNgNGUvtNM2Xs672NJJpW66cQ=.9f817221-c95a-49ed-b360-3861f6a7950d@github.com> Message-ID: <86dv7_OPtewpfAouqsztfIezb0l0Uga2NSY8yz72vmg=.5dde40e6-35ff-412a-9ab4-c8224a462490@github.com> On Wed, 4 Jan 2023 21:48:26 GMT, Justin Lu wrote: > Added the missing copyright header This pull request has now been integrated. Changeset: d5b80abc Author: Justin Lu Committer: Jaikiran Pai URL: https://git.openjdk.org/jdk/commit/d5b80abcbfff57c7728d3e42a696a762f08bc7ad Stats: 23 lines in 1 file changed: 23 ins; 0 del; 0 mod 8299617: CurrencySymbols.properties is missing the copyright notice Reviewed-by: naoto, iris, jpai ------------- PR: https://git.openjdk.org/jdk/pull/11854 From jpai at openjdk.org Sat Jan 7 02:36:57 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Sat, 7 Jan 2023 02:36:57 GMT Subject: RFR: 8258776: ThreadLocal#initialValue() Javadoc is unaware of ThreadLocal#withInitial() [v2] In-Reply-To: References: Message-ID: On Thu, 5 Jan 2023 13:24:08 GMT, Jaikiran Pai wrote: >> Can I please get a review of this doc only change which addresses the javadoc issue noted in https://bugs.openjdk.org/browse/JDK-8258776? >> >> As noted in that issue, the `ThreadLocal.initialValue()` API javadoc suggests subclassing `ThreadLocal` and overriding the `initialValue()` method instead of recommending the `withInitial` method that was added in Java 8. >> >> The commit here updates the javadoc of `initialValue()` method to note that `withInitial` method is available for use if the programmer wants to provide an initial value. The updated javadoc continues to note that the `ThreadLocal` can be subclassed and the method overriden as the other way of providing an initial value. This change now uses the `@implSpec` construct to state this default behaviour of the `initialValue()` method. >> >> Additionally, the `get()` method's javadoc has also been updated to account for the semantics of `initialValue()`. In fact, in its current form, before the changes in this PR, the `get()` method states: >> >>> If the current thread does not support thread locals then >>> this method returns its {@link #initialValue} (or {@code null} >>> if the {@code initialValue} method is not overridden). >> >> which isn't accurate, since the `get()` will return a non-null value if the ThreadLocal was constructed through `ThreadLocal.withInitial`. Here's a trivial code which contradicts this current javadoc: >> >> >> public class Test { >> public static void main(final String[] args) throws Exception { >> Thread.ofPlatform().name("hello").allowSetThreadLocals(false).start(() -> { >> var t = ThreadLocal.withInitial(() -> 2); >> System.out.println("Thread local value is " + t.get()); >> }); >> } >> } >> >> Running this with `java --enable-preview --source 21 Test.java` returns: >> >> Thread local value is 2 >> >> >> The updated javadoc of `get()` in this PR now matches the behaviour of this method. I believe this will need a CSR, which I'll open once we have an agreement on these changes. >> >> Furthermore, the class level javadoc of `ThreadLocal` has an example of providing an initial value which uses the subclassing strategy. I haven't updated that part. Should we update that to show the `withInitialValue` usage instead (and maybe convert it to a snippet)? > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > Review suggestion The CSR has been approved. Thank you Alan for the review. ------------- PR: https://git.openjdk.org/jdk/pull/11846 From jpai at openjdk.org Sat Jan 7 02:36:59 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Sat, 7 Jan 2023 02:36:59 GMT Subject: Integrated: 8258776: ThreadLocal#initialValue() Javadoc is unaware of ThreadLocal#withInitial() In-Reply-To: References: Message-ID: <_QqkZmzmDt4VBNS8b8-Q11Q0XwENG8-gEopCzVHexEE=.d4f217e1-3cfa-4e4a-a031-d7c1b34654e7@github.com> On Wed, 4 Jan 2023 14:37:13 GMT, Jaikiran Pai wrote: > Can I please get a review of this doc only change which addresses the javadoc issue noted in https://bugs.openjdk.org/browse/JDK-8258776? > > As noted in that issue, the `ThreadLocal.initialValue()` API javadoc suggests subclassing `ThreadLocal` and overriding the `initialValue()` method instead of recommending the `withInitial` method that was added in Java 8. > > The commit here updates the javadoc of `initialValue()` method to note that `withInitial` method is available for use if the programmer wants to provide an initial value. The updated javadoc continues to note that the `ThreadLocal` can be subclassed and the method overriden as the other way of providing an initial value. This change now uses the `@implSpec` construct to state this default behaviour of the `initialValue()` method. > > Additionally, the `get()` method's javadoc has also been updated to account for the semantics of `initialValue()`. In fact, in its current form, before the changes in this PR, the `get()` method states: > >> If the current thread does not support thread locals then >> this method returns its {@link #initialValue} (or {@code null} >> if the {@code initialValue} method is not overridden). > > which isn't accurate, since the `get()` will return a non-null value if the ThreadLocal was constructed through `ThreadLocal.withInitial`. Here's a trivial code which contradicts this current javadoc: > > > public class Test { > public static void main(final String[] args) throws Exception { > Thread.ofPlatform().name("hello").allowSetThreadLocals(false).start(() -> { > var t = ThreadLocal.withInitial(() -> 2); > System.out.println("Thread local value is " + t.get()); > }); > } > } > > Running this with `java --enable-preview --source 21 Test.java` returns: > > Thread local value is 2 > > > The updated javadoc of `get()` in this PR now matches the behaviour of this method. I believe this will need a CSR, which I'll open once we have an agreement on these changes. > > Furthermore, the class level javadoc of `ThreadLocal` has an example of providing an initial value which uses the subclassing strategy. I haven't updated that part. Should we update that to show the `withInitialValue` usage instead (and maybe convert it to a snippet)? This pull request has now been integrated. Changeset: e209693a Author: Jaikiran Pai URL: https://git.openjdk.org/jdk/commit/e209693a37e49ba5fd5b1ad3404e9dd807c545f3 Stats: 10 lines in 1 file changed: 3 ins; 1 del; 6 mod 8258776: ThreadLocal#initialValue() Javadoc is unaware of ThreadLocal#withInitial() Reviewed-by: alanb ------------- PR: https://git.openjdk.org/jdk/pull/11846 From alanb at openjdk.org Sat Jan 7 10:38:59 2023 From: alanb at openjdk.org (Alan Bateman) Date: Sat, 7 Jan 2023 10:38:59 GMT Subject: [jdk20] RFR: 8299689: Make use of JLine for Console as "opt-in" In-Reply-To: <1Y0pELaN2mrGhHLgXtfgdO65EUNI__6wNf6oy2KKzFE=.bdd50824-05b4-4a49-ad52-d56796915261@github.com> References: <1Y0pELaN2mrGhHLgXtfgdO65EUNI__6wNf6oy2KKzFE=.bdd50824-05b4-4a49-ad52-d56796915261@github.com> Message-ID: On Fri, 6 Jan 2023 17:57:47 GMT, Naoto Sato wrote: > Due to the fact that JLine spawns native processes to obtain terminal information on macOS/Linux, we decided to disable the JLine by default for performance degradation reasons. It is still possible to enable it by specifying it on the command line with `jdk.console` system property (not a public one though). Once we have a solution to avoid spawning processes, JLine may be back for use in the future. src/java.base/share/classes/jdk/internal/io/JdkConsoleProvider.java line 35: > 33: * designates the module name of the implementation, and which defaults > 34: * to "java.base". If no providers is available, > 35: * or instantiation failed, java.base built-in Console implementation The overall change looks fine but I think for the next edit that we should move most of this comment to Console as it's Console that selects the behavior and that skips errors. Also once the SM execution mode goes away then we can re-visit that behavior. ------------- PR: https://git.openjdk.org/jdk20/pull/88 From jpai at openjdk.org Sat Jan 7 10:49:51 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Sat, 7 Jan 2023 10:49:51 GMT Subject: RFR: 8299183: Invokers.checkExactType passes parameters to create WMTE in opposite order [v2] In-Reply-To: References: <68ERvONXzd-5lr4Au21sLFN-etSesjFy8tHzLSTsil0=.ea75bf5c-9dc8-4fbe-83b0-b55bc30da2c6@github.com> Message-ID: On Fri, 6 Jan 2023 21:15:38 GMT, Mandy Chung wrote: >> Trivial fix. Fix `Invokers.checkExactType` to call `newWrongMethodTypeException(actual, expected)` with parameters in right order. > > Mandy Chung has updated the pull request incrementally with two additional commits since the last revision: > > - Add a regression test > - further cleanup newWrongMethodTypeException for clarity Thank you for the changes Mandy. Overall the error message looks more clear now. There's a failing test in GitHub actions job which appears to be an existing test case which was expecting the older error message in the exception. That would need an update: test VarHandleTestExact.testExactArraySet(class [Ljava.lang.Object;, "abcd", VarHandleTestExact$$Lambda$87/0x000000010015b1c0 at 2a9fbca4): failure java.lang.AssertionError: 'handle's method type (Object[],int,Object)void but found (Object[],int,String)void' did not match the pattern '.*\\Qexpected (Object[],int,Object)void \\E.*'. at VarHandleTestExact.assertMatches(VarHandleTestExact.java:214) at VarHandleTestExact.doTest(VarHandleTestExact.java:199) at VarHandleTestExact.testExactArraySet(VarHandleTestExact.java:153) test/jdk/java/lang/invoke/WrongMethodTypeTest.java line 8: > 6: * under the terms of the GNU General Public License version 2 only, as > 7: * published by the Free Software Foundation. Oracle designates this > 8: * particular file as subject to the "Classpath" exception as provided >From what I understand, the copyright notice on test files don't use the "Classpath" exception and instead use a different copyright notice. ------------- PR: https://git.openjdk.org/jdk/pull/11870 From lancea at openjdk.org Sat Jan 7 11:24:52 2023 From: lancea at openjdk.org (Lance Andersen) Date: Sat, 7 Jan 2023 11:24:52 GMT Subject: RFR: 8299502: Usage of constructors of primitive wrapper classes should be avoided in javax.xml API docs [v2] In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 21:59:13 GMT, Justin Lu wrote: >> Removed constructors of primitive wrapper classes (deprecated for removal) in _javax.xml.stream.XMLOutputFactory_ >> >> Replaced with Boolean static fields: Boolean.TRUE and Boolean.FALSE > > Justin Lu has updated the pull request incrementally with one additional commit since the last revision: > > Replace | with single value in example Marked as reviewed by lancea (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11872 From lancea at openjdk.org Sat Jan 7 11:27:50 2023 From: lancea at openjdk.org (Lance Andersen) Date: Sat, 7 Jan 2023 11:27:50 GMT Subject: RFR: 6381945: (cal) Japanese calendar unit test system should avoid multiple static imports In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 21:49:18 GMT, Justin Lu wrote: > Within _test/jdk/java/util/Calendar/CalendarTestScripts/Symbol.java_ > > GregorianCalendar alone handles all the necessary imports, Calendar is not needed Marked as reviewed by lancea (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11855 From lancea at openjdk.org Sat Jan 7 11:34:50 2023 From: lancea at openjdk.org (Lance Andersen) Date: Sat, 7 Jan 2023 11:34:50 GMT Subject: RFR: 8177418: TimeZone.getTimeZone(String id) throws NullPointerException when id is null In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 22:38:13 GMT, Justin Lu wrote: > When ID is null, TimeZone.getTimeZone(String ID) throws a NullPointerException. > > For example, > > > String someID = null; > TimeZone tz1 = TimeZone.getTimeZone(someID); > ``` > > throws a `NullPointerException` > > This change updates the documentation to make this apparent. Hi Justin, This will require a CSR due to the change in the javadoc. Otherwise looks fine. Once you have your draft ready, lets us know and we can review it for you so you can get it finalized ------------- PR: https://git.openjdk.org/jdk/pull/11888 From tjmnkrajyej at gmail.com Sat Jan 7 11:47:04 2023 From: tjmnkrajyej at gmail.com (Mohamed Maaliki) Date: Sat, 7 Jan 2023 11:47:04 +0000 Subject: 8140283: add Stream::transform method to facilitate fluent chaining of other methods Message-ID: <09e3ff32-1d75-92a5-45b9-feb57027820b@gmail.com> I?ve started working on the RFE mentioned in the title. At the moment I?ve implemented the method in |BaseStream| in order to cover every stream type: is that alright or should I restrict it to |Stream|? And if there?s anything else that I should know, then please let me know. Thanks. ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From duke at openjdk.org Sat Jan 7 16:24:56 2023 From: duke at openjdk.org (ExE Boss) Date: Sat, 7 Jan 2023 16:24:56 GMT Subject: RFR: 8015831: Add lint check for calling overridable methods from a constructor [v2] In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 23:13:09 GMT, Archie L. Cobbs wrote: >> This PR adds a new lint warning category `this-escape`. >> >> It also adds `@SuppressWarnings` annotations as needed to the JDK itself to allow the JDK to continue to compile with `-Xlint:all`. >> >> A 'this' escape warning is generated for a constructor `A()` in a class `A` when the compiler detects that the following situation is _in theory possible:_ >> * Some subclass `B extends A` exists, and `B` is defined in a separate source file (i.e., compilation unit) >> * Some constructor `B()` of `B` invokes `A()` as its superclass constructor >> * During the execution of `A()`, some non-static method of `B.foo()` could get invoked, perhaps indirectly >> >> In the above scenario, `B.foo()` would execute before `A()` has returned and before `B()` has performed any initialization. To the extent `B.foo()` accesses any fields of `B` - all of which are still uninitialized - it is likely to function incorrectly. >> >> Note, when determining if a 'this' escape is possible, the compiler makes no assumptions about code outside of the current compilation unit. It doesn't look outside of the current source file to see what might actually happen when a method is invoked. It does follow method and constructors within the current compilation unit, and applies a simplified union-of-all-possible-branches data flow analysis to see where 'this' could end up. >> >> From my review, virtually all of the warnings generated in the various JDK modules are valid warnings in the sense that a 'this' escape, as defined above, is really and truly possible. However, that doesn't imply that any bugs were found within the JDK - only that the possibility of a certain type of bug exists if certain superclass constructors are used by someone, somewhere, someday. >> >> For several "popular" classes, this PR also adds `@implNote`'s to the offending constructors so that subclass implementors are made aware of the threat. For one example, `TreeMap(Map)` invokes `putAll()` and `put()`. >> >> More details and a couple of motivating examples are given in an included [doc file](https://github.com/archiecobbs/jdk/blob/ThisEscape/src/java.base/share/classes/java/lang/doc-files/ThisEscape.html) that these `@implNote`'s link to. See also the recent thread on `amber-dev` for some background. >> >> Ideally, over time the owners of the various modules would review their `@SuppressWarnings("this-escape")` annotations and determine which other constructors also warranted such an `@implNote`. >> >> Because of all the`@SuppressWarnings` annotations, this PR touches a bunch of different JDK modules. My apologies for that. Adding these annotations was determined to be the more conservative approach, as compared to just excepting `this-escape` from various module builds globally. >> >> **Patch Navigation Guide** >> >> * Non-trivial compiler changes: >> * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java` >> * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java` >> * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java` >> * `src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java` >> * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java` >> * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties` >> * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties` >> >> * Javadoc additions of `@implNote`: >> >> * `src/java.base/share/classes/java/io/PipedReader.java` >> * `src/java.base/share/classes/java/io/PipedWriter.java` >> * `src/java.base/share/classes/java/lang/Throwable.java` >> * `src/java.base/share/classes/java/util/ArrayDeque.java` >> * `src/java.base/share/classes/java/util/EnumMap.java` >> * `src/java.base/share/classes/java/util/HashSet.java` >> * `src/java.base/share/classes/java/util/Hashtable.java` >> * `src/java.base/share/classes/java/util/LinkedList.java` >> * `src/java.base/share/classes/java/util/TreeMap.java` >> * `src/java.base/share/classes/java/util/TreeSet.java` >> >> * New unit tests >> * `test/langtools/tools/javac/warnings/ThisEscape/*.java` >> >> * **Everything else** is just adding `@SuppressWarnings("this-escape")` > > Archie L. Cobbs has updated the pull request incrementally with two additional commits since the last revision: > > - Update copyright year for newly added files to 2023. > - Suppress "this-escape" warnings using build flags instead of @SuppressAnnotations annotations. src/java.base/share/classes/java/lang/AssertionError.java line 75: > 73: */ > 74: @SuppressWarnings("this-escape") > 75: public AssertionError(Object detailMessage) { The?Javadoc of?this?constructor should?probably?mention that?it?calls `initCause(?)` when?`detailMessage` is?a?`Throwable`. src/java.base/share/classes/java/lang/BootstrapMethodError.java line 77: > 75: * Constructs a {@code BootstrapMethodError} with the specified > 76: * cause. > 77: * Suggestion: * * @implNote This constructor invokes {@link #initCause initCause()}; see * This Escape. * src/java.base/share/classes/java/lang/ExceptionInInitializerError.java line 54: > 52: * throwable object. > 53: * A detail message is a String that describes this particular exception. > 54: */ Suggestion: * * @implNote This constructor invokes {@link #initCause initCause()}; see * This Escape. */ ------------- PR: https://git.openjdk.org/jdk/pull/11874 From duke at openjdk.org Sat Jan 7 16:58:58 2023 From: duke at openjdk.org (Archie L. Cobbs) Date: Sat, 7 Jan 2023 16:58:58 GMT Subject: RFR: 8015831: Add lint check for calling overridable methods from a constructor [v3] In-Reply-To: References: Message-ID: > This PR adds a new lint warning category `this-escape`. > > It also adds `@SuppressWarnings` annotations as needed to the JDK itself to allow the JDK to continue to compile with `-Xlint:all`. > > A 'this' escape warning is generated for a constructor `A()` in a class `A` when the compiler detects that the following situation is _in theory possible:_ > * Some subclass `B extends A` exists, and `B` is defined in a separate source file (i.e., compilation unit) > * Some constructor `B()` of `B` invokes `A()` as its superclass constructor > * During the execution of `A()`, some non-static method of `B.foo()` could get invoked, perhaps indirectly > > In the above scenario, `B.foo()` would execute before `A()` has returned and before `B()` has performed any initialization. To the extent `B.foo()` accesses any fields of `B` - all of which are still uninitialized - it is likely to function incorrectly. > > Note, when determining if a 'this' escape is possible, the compiler makes no assumptions about code outside of the current compilation unit. It doesn't look outside of the current source file to see what might actually happen when a method is invoked. It does follow method and constructors within the current compilation unit, and applies a simplified union-of-all-possible-branches data flow analysis to see where 'this' could end up. > > From my review, virtually all of the warnings generated in the various JDK modules are valid warnings in the sense that a 'this' escape, as defined above, is really and truly possible. However, that doesn't imply that any bugs were found within the JDK - only that the possibility of a certain type of bug exists if certain superclass constructors are used by someone, somewhere, someday. > > For several "popular" classes, this PR also adds `@implNote`'s to the offending constructors so that subclass implementors are made aware of the threat. For one example, `TreeMap(Map)` invokes `putAll()` and `put()`. > > More details and a couple of motivating examples are given in an included [doc file](https://github.com/archiecobbs/jdk/blob/ThisEscape/src/java.base/share/classes/java/lang/doc-files/ThisEscape.html) that these `@implNote`'s link to. See also the recent thread on `amber-dev` for some background. > > Ideally, over time the owners of the various modules would review their `@SuppressWarnings("this-escape")` annotations and determine which other constructors also warranted such an `@implNote`. > > Because of all the`@SuppressWarnings` annotations, this PR touches a bunch of different JDK modules. My apologies for that. Adding these annotations was determined to be the more conservative approach, as compared to just excepting `this-escape` from various module builds globally. > > **Patch Navigation Guide** > > * Non-trivial compiler changes: > * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties` > > * Javadoc additions of `@implNote`: > > * `src/java.base/share/classes/java/io/PipedReader.java` > * `src/java.base/share/classes/java/io/PipedWriter.java` > * `src/java.base/share/classes/java/lang/Throwable.java` > * `src/java.base/share/classes/java/util/ArrayDeque.java` > * `src/java.base/share/classes/java/util/EnumMap.java` > * `src/java.base/share/classes/java/util/HashSet.java` > * `src/java.base/share/classes/java/util/Hashtable.java` > * `src/java.base/share/classes/java/util/LinkedList.java` > * `src/java.base/share/classes/java/util/TreeMap.java` > * `src/java.base/share/classes/java/util/TreeSet.java` > > * New unit tests > * `test/langtools/tools/javac/warnings/ThisEscape/*.java` > > * **Everything else** is just adding `@SuppressWarnings("this-escape")` Archie L. Cobbs has updated the pull request incrementally with one additional commit since the last revision: Add a few more Javadoc warnings for 'this' escape via initCause(). ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11874/files - new: https://git.openjdk.org/jdk/pull/11874/files/f667cd56..398737fa Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11874&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11874&range=01-02 Stats: 9 lines in 3 files changed: 9 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/11874.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11874/head:pull/11874 PR: https://git.openjdk.org/jdk/pull/11874 From alanb at openjdk.org Sat Jan 7 18:05:50 2023 From: alanb at openjdk.org (Alan Bateman) Date: Sat, 7 Jan 2023 18:05:50 GMT Subject: RFR: 8015831: Add lint check for calling overridable methods from a constructor In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 23:08:27 GMT, Archie L. Cobbs wrote: > I've moved the `@SuppressWarnings` annotations onto a new branch `ThisEscapeAnnotations`. This is just for future reference in case somebody wants to add them back someday and doesn't want to start from scratch. > > > I suspect some of the suggestions to document leaking this in implNotes will need discussion too because they amount to documenting "hooks" that people will rely on, e.g. documenting in ArrayDeque that its constructor invokes addList could be read as an invite to override it. > > Hmm. Hasn't that horse already left the barn? You kind of implied that when you said: > > > I see a few examples in your list where there have been attempts to avoid leaking "this" but where we backed away out of concern that 3rd party code was extending some class and overriding a method known to be invoked by the constructor. > > In other words, it doesn't sound like changing the behavior of these constructors is viable option at this point. And if that's the case, we might as well document and warn about the current behavior. > > Of course I'd love to be wrong... in which case, we can fix these constructors. I hope at least some of these can be fixed as leaking a part initialized object to an untrusted subclass or some other code is problematic in many ways. Skimming through the original list, then some of these may be accidental and some may be fixable without any compatibility concerns, esp. in the JDK internal classes. Yes, some horses have left the barn. A horse that got out a long time ago is j.net.ServerSocket where 3 of its constructors call an overridable bind method. Recent re-implementation would have fixed this but there were concerns that subclasses may be relying on this long standing undocumented behavior. There are other cases in the list where the leaking may be necessary part of the contract for subclasses. So it will probably require working through them on a case by case basis. I don't think the implementation notes should be included as part of the adding the lint warning as I think it creates an attractive nuisance. Developers reading these implementation notes may c reate code that depends on these "hooks" and it will make it very hard for the JDK to ever change the behavior. Where the leaking is a necessary part of the contract for subclassing then it may be that it has to be documented as normative text rather than an implementation note. ------------- PR: https://git.openjdk.org/jdk/pull/11874 From duke at openjdk.org Sat Jan 7 19:52:49 2023 From: duke at openjdk.org (Archie L. Cobbs) Date: Sat, 7 Jan 2023 19:52:49 GMT Subject: RFR: 8015831: Add lint check for calling overridable methods from a constructor In-Reply-To: References: Message-ID: On Sat, 7 Jan 2023 18:03:04 GMT, Alan Bateman wrote: > I don't think the implementation notes should be included as part of the adding the lint warning as I think it creates an attractive nuisance. I agree with you - not only for that reason, but also because as others have pointed out the addition of the warning is really a separate task from the evaluation and triage of any existing leaks. Moreover, this latter task is really multiple separate tasks that belong to the various module/functional groups. I'll remove all the Javadoc `@implNote`'s from the patch, and `src/java.base/share/classes/java/lang/doc-files/ThisEscape.html` as well - it will still be available in the git history if someone comes up with a better home for it. This will also further reduce the number of labels and therefore required reviewers. Thanks. ------------- PR: https://git.openjdk.org/jdk/pull/11874 From duke at openjdk.org Sat Jan 7 19:59:59 2023 From: duke at openjdk.org (Archie L. Cobbs) Date: Sat, 7 Jan 2023 19:59:59 GMT Subject: RFR: 8015831: Add lint check for calling overridable methods from a constructor [v4] In-Reply-To: References: Message-ID: > This PR adds a new lint warning category `this-escape`. > > It also adds `@SuppressWarnings` annotations as needed to the JDK itself to allow the JDK to continue to compile with `-Xlint:all`. > > A 'this' escape warning is generated for a constructor `A()` in a class `A` when the compiler detects that the following situation is _in theory possible:_ > * Some subclass `B extends A` exists, and `B` is defined in a separate source file (i.e., compilation unit) > * Some constructor `B()` of `B` invokes `A()` as its superclass constructor > * During the execution of `A()`, some non-static method of `B.foo()` could get invoked, perhaps indirectly > > In the above scenario, `B.foo()` would execute before `A()` has returned and before `B()` has performed any initialization. To the extent `B.foo()` accesses any fields of `B` - all of which are still uninitialized - it is likely to function incorrectly. > > Note, when determining if a 'this' escape is possible, the compiler makes no assumptions about code outside of the current compilation unit. It doesn't look outside of the current source file to see what might actually happen when a method is invoked. It does follow method and constructors within the current compilation unit, and applies a simplified union-of-all-possible-branches data flow analysis to see where 'this' could end up. > > From my review, virtually all of the warnings generated in the various JDK modules are valid warnings in the sense that a 'this' escape, as defined above, is really and truly possible. However, that doesn't imply that any bugs were found within the JDK - only that the possibility of a certain type of bug exists if certain superclass constructors are used by someone, somewhere, someday. > > For several "popular" classes, this PR also adds `@implNote`'s to the offending constructors so that subclass implementors are made aware of the threat. For one example, `TreeMap(Map)` invokes `putAll()` and `put()`. > > More details and a couple of motivating examples are given in an included [doc file](https://github.com/archiecobbs/jdk/blob/ThisEscape/src/java.base/share/classes/java/lang/doc-files/ThisEscape.html) that these `@implNote`'s link to. See also the recent thread on `amber-dev` for some background. > > Ideally, over time the owners of the various modules would review their `@SuppressWarnings("this-escape")` annotations and determine which other constructors also warranted such an `@implNote`. > > Because of all the`@SuppressWarnings` annotations, this PR touches a bunch of different JDK modules. My apologies for that. Adding these annotations was determined to be the more conservative approach, as compared to just excepting `this-escape` from various module builds globally. > > **Patch Navigation Guide** > > * Non-trivial compiler changes: > * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties` > > * Javadoc additions of `@implNote`: > > * `src/java.base/share/classes/java/io/PipedReader.java` > * `src/java.base/share/classes/java/io/PipedWriter.java` > * `src/java.base/share/classes/java/lang/Throwable.java` > * `src/java.base/share/classes/java/util/ArrayDeque.java` > * `src/java.base/share/classes/java/util/EnumMap.java` > * `src/java.base/share/classes/java/util/HashSet.java` > * `src/java.base/share/classes/java/util/Hashtable.java` > * `src/java.base/share/classes/java/util/LinkedList.java` > * `src/java.base/share/classes/java/util/TreeMap.java` > * `src/java.base/share/classes/java/util/TreeSet.java` > > * New unit tests > * `test/langtools/tools/javac/warnings/ThisEscape/*.java` > > * **Everything else** is just adding `@SuppressWarnings("this-escape")` Archie L. Cobbs has updated the pull request incrementally with one additional commit since the last revision: Remove Javadoc @implNotes; plan to triage the various existing leaks separately. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11874/files - new: https://git.openjdk.org/jdk/pull/11874/files/398737fa..537b3e3c Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11874&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11874&range=02-03 Stats: 255 lines in 29 files changed: 0 ins; 251 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/11874.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11874/head:pull/11874 PR: https://git.openjdk.org/jdk/pull/11874 From duke at openjdk.org Sat Jan 7 21:08:07 2023 From: duke at openjdk.org (Archie L. Cobbs) Date: Sat, 7 Jan 2023 21:08:07 GMT Subject: RFR: 8015831: Add lint check for calling overridable methods from a constructor [v5] In-Reply-To: References: Message-ID: <_GkLRl5VTNh8ToJ3cjF-_v9j6eWWQzbUCCKStOXKh4g=.5e9505f1-8182-47e6-a8ed-78982db36c94@github.com> > This PR adds a new lint warning category `this-escape`. > > It also adds `@SuppressWarnings` annotations as needed to the JDK itself to allow the JDK to continue to compile with `-Xlint:all`. > > A 'this' escape warning is generated for a constructor `A()` in a class `A` when the compiler detects that the following situation is _in theory possible:_ > * Some subclass `B extends A` exists, and `B` is defined in a separate source file (i.e., compilation unit) > * Some constructor `B()` of `B` invokes `A()` as its superclass constructor > * During the execution of `A()`, some non-static method of `B.foo()` could get invoked, perhaps indirectly > > In the above scenario, `B.foo()` would execute before `A()` has returned and before `B()` has performed any initialization. To the extent `B.foo()` accesses any fields of `B` - all of which are still uninitialized - it is likely to function incorrectly. > > Note, when determining if a 'this' escape is possible, the compiler makes no assumptions about code outside of the current compilation unit. It doesn't look outside of the current source file to see what might actually happen when a method is invoked. It does follow method and constructors within the current compilation unit, and applies a simplified union-of-all-possible-branches data flow analysis to see where 'this' could end up. > > From my review, virtually all of the warnings generated in the various JDK modules are valid warnings in the sense that a 'this' escape, as defined above, is really and truly possible. However, that doesn't imply that any bugs were found within the JDK - only that the possibility of a certain type of bug exists if certain superclass constructors are used by someone, somewhere, someday. > > For several "popular" classes, this PR also adds `@implNote`'s to the offending constructors so that subclass implementors are made aware of the threat. For one example, `TreeMap(Map)` invokes `putAll()` and `put()`. > > More details and a couple of motivating examples are given in an included [doc file](https://github.com/archiecobbs/jdk/blob/ThisEscape/src/java.base/share/classes/java/lang/doc-files/ThisEscape.html) that these `@implNote`'s link to. See also the recent thread on `amber-dev` for some background. > > Ideally, over time the owners of the various modules would review their `@SuppressWarnings("this-escape")` annotations and determine which other constructors also warranted such an `@implNote`. > > Because of all the`@SuppressWarnings` annotations, this PR touches a bunch of different JDK modules. My apologies for that. Adding these annotations was determined to be the more conservative approach, as compared to just excepting `this-escape` from various module builds globally. > > **Patch Navigation Guide** > > * Non-trivial compiler changes: > * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties` > * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties` > > * Javadoc additions of `@implNote`: > > * `src/java.base/share/classes/java/io/PipedReader.java` > * `src/java.base/share/classes/java/io/PipedWriter.java` > * `src/java.base/share/classes/java/lang/Throwable.java` > * `src/java.base/share/classes/java/util/ArrayDeque.java` > * `src/java.base/share/classes/java/util/EnumMap.java` > * `src/java.base/share/classes/java/util/HashSet.java` > * `src/java.base/share/classes/java/util/Hashtable.java` > * `src/java.base/share/classes/java/util/LinkedList.java` > * `src/java.base/share/classes/java/util/TreeMap.java` > * `src/java.base/share/classes/java/util/TreeSet.java` > > * New unit tests > * `test/langtools/tools/javac/warnings/ThisEscape/*.java` > > * **Everything else** is just adding `@SuppressWarnings("this-escape")` Archie L. Cobbs has updated the pull request incrementally with one additional commit since the last revision: Fix incorrect @bug numbers in unit tests. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11874/files - new: https://git.openjdk.org/jdk/pull/11874/files/537b3e3c..7e2fdb07 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11874&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11874&range=03-04 Stats: 15 lines in 15 files changed: 0 ins; 0 del; 15 mod Patch: https://git.openjdk.org/jdk/pull/11874.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11874/head:pull/11874 PR: https://git.openjdk.org/jdk/pull/11874 From dholmes at openjdk.org Sun Jan 8 23:28:59 2023 From: dholmes at openjdk.org (David Holmes) Date: Sun, 8 Jan 2023 23:28:59 GMT Subject: RFR: 8292443: Weak CAS VarHandle/Unsafe tests should test always-failing cases In-Reply-To: References: Message-ID: On Tue, 16 Aug 2022 15:06:50 GMT, Aleksey Shipilev wrote: > I noticed that current VarHandle/Unsafe test cases do not test the always-failing cases. Strong CASes do test both always-success and always-failing scenarios, while weak CASes only test spurious-failure tests. We should be also testing always-failing cases for these. Weak CAS can spuriously fail, but it cannot spuriously succeed. > > The PR looks large, but the actual changes are in `*.template` files, and the rest is generated from them. > > Additional testing: > - [x] Linux x86_64 fastdebug `java/lang/invoke/VarHandles` and `compiler/unsafe` tests > - [x] Linux x86_32 fastdebug `java/lang/invoke/VarHandles` and `compiler/unsafe` tests > - [x] Linux AArch64 fastdebug `java/lang/invoke/VarHandles` and `compiler/unsafe` tests Committing unchanged files, other than a copyright year change, looks very odd here. Why was the SunMisUnsafe template updated but none of the tests actually changed? ------------- PR: https://git.openjdk.org/jdk/pull/9892 From jpai at openjdk.org Mon Jan 9 01:09:04 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Mon, 9 Jan 2023 01:09:04 GMT Subject: RFR: 8297306: Incorrect brackets in Javadoc for a constructor of IteratorSpliterator [v2] In-Reply-To: References: Message-ID: > Can I please get a review of this change which fixes an issue in the javadoc text of the internal class IteratorSpliterator? This addresses the issue reported at https://bugs.openjdk.org/browse/JDK-8297306. Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: update another javadoc ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11876/files - new: https://git.openjdk.org/jdk/pull/11876/files/b887f417..d9abcaa6 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11876&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11876&range=00-01 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/11876.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11876/head:pull/11876 PR: https://git.openjdk.org/jdk/pull/11876 From jpai at openjdk.org Mon Jan 9 01:13:51 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Mon, 9 Jan 2023 01:13:51 GMT Subject: RFR: 8297306: Incorrect brackets in Javadoc for a constructor of IteratorSpliterator [v2] In-Reply-To: References: Message-ID: On Mon, 9 Jan 2023 01:09:04 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which fixes an issue in the javadoc text of the internal class IteratorSpliterator? This addresses the issue reported at https://bugs.openjdk.org/browse/JDK-8297306. > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > update another javadoc Hello Naoto, the brackets usage on that other method looks fine to me: * Creates a {@code Spliterator} using the given collection's * {@link java.util.Collection#iterator()} as the source of elements, and * reporting its {@link java.util.Collection#size()} as its initial size. I've now however updated that part just to use the same style of `{@link ...` as in the proposed change. ------------- PR: https://git.openjdk.org/jdk/pull/11876 From jpai at openjdk.org Mon Jan 9 01:23:58 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Mon, 9 Jan 2023 01:23:58 GMT Subject: [jdk20] RFR: 8299689: Make use of JLine for Console as "opt-in" In-Reply-To: <1Y0pELaN2mrGhHLgXtfgdO65EUNI__6wNf6oy2KKzFE=.bdd50824-05b4-4a49-ad52-d56796915261@github.com> References: <1Y0pELaN2mrGhHLgXtfgdO65EUNI__6wNf6oy2KKzFE=.bdd50824-05b4-4a49-ad52-d56796915261@github.com> Message-ID: On Fri, 6 Jan 2023 17:57:47 GMT, Naoto Sato wrote: > Due to the fact that JLine spawns native processes to obtain terminal information on macOS/Linux, we decided to disable the JLine by default for performance degradation reasons. It is still possible to enable it by specifying it on the command line with `jdk.console` system property (not a public one though). Once we have a solution to avoid spawning processes, JLine may be back for use in the future. Marked as reviewed by jpai (Reviewer). Hello Naoto, this looks fine to me. The `RedirectTest.java` will need an update on the copyright year. ------------- PR: https://git.openjdk.org/jdk20/pull/88 From david.holmes at oracle.com Mon Jan 9 06:21:55 2023 From: david.holmes at oracle.com (David Holmes) Date: Mon, 9 Jan 2023 16:21:55 +1000 Subject: jpackageapplauncher linker arguments for osx In-Reply-To: References: Message-ID: <7ab61fe5-9073-84db-d2d3-e9e4682b366f@oracle.com> On 8/01/2023 8:39 pm, David Schumann wrote: > Hello, > > I'm not 100% sure if this list is the correct one for this topic, feel > free to redirect me. core-libs-dev - cc'd Cheers, David > Currently the?jpackageapplauncher binary gets linked without the > "-headerpad_max_install_names" argument on osx. This prevents a user > from using the install_name_tool with the launcher binary. > This means that it's currently not possible to include dylibs in the > application bundle. > > To provide a bit more context: > I'm using jpackage to build an app bundle. The java application itself > uses external native libraries, which internally use dlopen to reference > other libs. Normaly one would include the other libs in the app bundle, > and use the install_name_tool to tell the dynamic linker which paths to > load the libraries from. However since the launcher binary doesn't get > linked with the correct arguments, this isn't possible. > > I wanted to discuss this change, and it it makes sense for me to open a > pull request for it. > The change would be in > https://github.com/openjdk/jdk/blob/master/make/modules/jdk.jpackage/Lib.gmk#L76 > > Best Regards, > David Schumann > From dholmes at openjdk.org Mon Jan 9 06:39:52 2023 From: dholmes at openjdk.org (David Holmes) Date: Mon, 9 Jan 2023 06:39:52 GMT Subject: RFR: 8015831: Add lint check for calling overridable methods from a constructor [v5] In-Reply-To: <_GkLRl5VTNh8ToJ3cjF-_v9j6eWWQzbUCCKStOXKh4g=.5e9505f1-8182-47e6-a8ed-78982db36c94@github.com> References: <_GkLRl5VTNh8ToJ3cjF-_v9j6eWWQzbUCCKStOXKh4g=.5e9505f1-8182-47e6-a8ed-78982db36c94@github.com> Message-ID: On Sat, 7 Jan 2023 21:08:07 GMT, Archie L. Cobbs wrote: >> This PR adds a new lint warning category `this-escape`. >> >> It also adds `@SuppressWarnings` annotations as needed to the JDK itself to allow the JDK to continue to compile with `-Xlint:all`. >> >> A 'this' escape warning is generated for a constructor `A()` in a class `A` when the compiler detects that the following situation is _in theory possible:_ >> * Some subclass `B extends A` exists, and `B` is defined in a separate source file (i.e., compilation unit) >> * Some constructor `B()` of `B` invokes `A()` as its superclass constructor >> * During the execution of `A()`, some non-static method of `B.foo()` could get invoked, perhaps indirectly >> >> In the above scenario, `B.foo()` would execute before `A()` has returned and before `B()` has performed any initialization. To the extent `B.foo()` accesses any fields of `B` - all of which are still uninitialized - it is likely to function incorrectly. >> >> Note, when determining if a 'this' escape is possible, the compiler makes no assumptions about code outside of the current compilation unit. It doesn't look outside of the current source file to see what might actually happen when a method is invoked. It does follow method and constructors within the current compilation unit, and applies a simplified union-of-all-possible-branches data flow analysis to see where 'this' could end up. >> >> From my review, virtually all of the warnings generated in the various JDK modules are valid warnings in the sense that a 'this' escape, as defined above, is really and truly possible. However, that doesn't imply that any bugs were found within the JDK - only that the possibility of a certain type of bug exists if certain superclass constructors are used by someone, somewhere, someday. >> >> For several "popular" classes, this PR also adds `@implNote`'s to the offending constructors so that subclass implementors are made aware of the threat. For one example, `TreeMap(Map)` invokes `putAll()` and `put()`. >> >> More details and a couple of motivating examples are given in an included [doc file](https://github.com/archiecobbs/jdk/blob/ThisEscape/src/java.base/share/classes/java/lang/doc-files/ThisEscape.html) that these `@implNote`'s link to. See also the recent thread on `amber-dev` for some background. >> >> Ideally, over time the owners of the various modules would review their `@SuppressWarnings("this-escape")` annotations and determine which other constructors also warranted such an `@implNote`. >> >> Because of all the`@SuppressWarnings` annotations, this PR touches a bunch of different JDK modules. My apologies for that. Adding these annotations was determined to be the more conservative approach, as compared to just excepting `this-escape` from various module builds globally. >> >> **Patch Navigation Guide** >> >> * Non-trivial compiler changes: >> * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java` >> * `src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java` >> * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java` >> * `src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java` >> * `src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java` >> * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties` >> * `src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties` >> >> * Javadoc additions of `@implNote`: >> >> * `src/java.base/share/classes/java/io/PipedReader.java` >> * `src/java.base/share/classes/java/io/PipedWriter.java` >> * `src/java.base/share/classes/java/lang/Throwable.java` >> * `src/java.base/share/classes/java/util/ArrayDeque.java` >> * `src/java.base/share/classes/java/util/EnumMap.java` >> * `src/java.base/share/classes/java/util/HashSet.java` >> * `src/java.base/share/classes/java/util/Hashtable.java` >> * `src/java.base/share/classes/java/util/LinkedList.java` >> * `src/java.base/share/classes/java/util/TreeMap.java` >> * `src/java.base/share/classes/java/util/TreeSet.java` >> >> * New unit tests >> * `test/langtools/tools/javac/warnings/ThisEscape/*.java` >> >> * **Everything else** is just adding `@SuppressWarnings("this-escape")` > > Archie L. Cobbs has updated the pull request incrementally with one additional commit since the last revision: > > Fix incorrect @bug numbers in unit tests. All your new files need a copyright and GPL header. ------------- PR: https://git.openjdk.org/jdk/pull/11874 From shade at openjdk.org Mon Jan 9 07:06:00 2023 From: shade at openjdk.org (Aleksey Shipilev) Date: Mon, 9 Jan 2023 07:06:00 GMT Subject: RFR: 8292443: Weak CAS VarHandle/Unsafe tests should test always-failing cases In-Reply-To: References: Message-ID: On Sun, 8 Jan 2023 23:25:36 GMT, David Holmes wrote: > Committing unchanged files, other than a copyright year change, looks very odd here. Why was the SunMisUnsafe template updated but none of the tests actually changed? `X-UnsafeAccessTest.java.template` generates both `SunMisc*` and `JdkInternalMisc*` files, using `JdkInternalMisc` condition to disambiguate the two. So, if we need to change `JdkInternalMisc*`, like this PR does, we need to change `X-UnsafeAccessTest.java.template`, which regenerates `SunMisc*` too. Since `SunMisc*` tests do not have `weakCAS` operations, only the copyright updates hit them. You could, in principle, selectively commit only the "substantially affected" files, but I believe the rule for auto-generated files after template updates is to commit everything that was changed after the template change. This guarantees that regenerating files from the unchanged template yields no changes. ------------- PR: https://git.openjdk.org/jdk/pull/9892 From iris at openjdk.org Mon Jan 9 07:14:51 2023 From: iris at openjdk.org (Iris Clark) Date: Mon, 9 Jan 2023 07:14:51 GMT Subject: RFR: 6381945: (cal) Japanese calendar unit test system should avoid multiple static imports In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 21:49:18 GMT, Justin Lu wrote: > Within _test/jdk/java/util/Calendar/CalendarTestScripts/Symbol.java_ > > GregorianCalendar alone handles all the necessary imports, Calendar is not needed Marked as reviewed by iris (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11855 From dholmes at openjdk.org Mon Jan 9 07:11:57 2023 From: dholmes at openjdk.org (David Holmes) Date: Mon, 9 Jan 2023 07:11:57 GMT Subject: RFR: 8292443: Weak CAS VarHandle/Unsafe tests should test always-failing cases In-Reply-To: References: Message-ID: On Tue, 16 Aug 2022 15:06:50 GMT, Aleksey Shipilev wrote: > I noticed that current VarHandle/Unsafe test cases do not test the always-failing cases. Strong CASes do test both always-success and always-failing scenarios, while weak CASes only test spurious-failure tests. We should be also testing always-failing cases for these. Weak CAS can spuriously fail, but it cannot spuriously succeed. > > The PR looks large, but the actual changes are in `*.template` files, and the rest is generated from them. > > Additional testing: > - [x] Linux x86_64 fastdebug `java/lang/invoke/VarHandles` and `compiler/unsafe` tests > - [x] Linux x86_32 fastdebug `java/lang/invoke/VarHandles` and `compiler/unsafe` tests > - [x] Linux AArch64 fastdebug `java/lang/invoke/VarHandles` and `compiler/unsafe` tests Ah! Sorry I thought there were two distinct template file here. ------------- PR: https://git.openjdk.org/jdk/pull/9892 From duke at openjdk.org Mon Jan 9 08:33:09 2023 From: duke at openjdk.org (Viktor Klang) Date: Mon, 9 Jan 2023 08:33:09 GMT Subject: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections [v2] In-Reply-To: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> References: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> Message-ID: > Currently Set.copyOf allocates both a HashSet and a new empty array when the input collection is empty. > > This patch avoids allocating anything for the case where the parameter collection's isEmpty returns true. Viktor Klang has updated the pull request incrementally with two additional commits since the last revision: - 8299444: java.util.Set.copyOf allocates needlessly for empty input collections Modifies ImmutableCollections.listCopy: Introduces a check for isEmpty to avoid allocation in the case of an empty input collection. - 8299444: java.util.Set.copyOf allocates needlessly for empty input collections Modifies Map.copyOf: Introduces a check for isEmpty to avoid allocation in the case of an empty input Map. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11847/files - new: https://git.openjdk.org/jdk/pull/11847/files/52a87a2b..8e67eb86 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11847&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11847&range=00-01 Stats: 6 lines in 2 files changed: 4 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/11847.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11847/head:pull/11847 PR: https://git.openjdk.org/jdk/pull/11847 From duke at openjdk.org Mon Jan 9 08:33:11 2023 From: duke at openjdk.org (Viktor Klang) Date: Mon, 9 Jan 2023 08:33:11 GMT Subject: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections In-Reply-To: References: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> Message-ID: On Thu, 5 Jan 2023 01:02:11 GMT, Sergey Bylokhov wrote: >> There's no regression test. However, with the current code (prior to this change) a call to `Set.of(zeroLengthArray)` returns the same instance as `Set.of()`, so it's difficult to write a simple functional test for this change. The test would have to assert that "no HashSet is allocated along this code path" which is much harder to test and frankly probably isn't worth it. So, please add one of the `noreg-*` labels to the bug to indicate the rationale for omitting a regression test. >> >> https://openjdk.org/guide/#jbs-label-dictionary >> >> I'd probably add the `Map.copyOf` change to this PR to avoid some bug/PR/review overhead. Thanks for mentioning this @shipilev. > >> so it's difficult to write a simple functional test for this change. > > It is possible to track that for some "custom" and empty collection the only method will be called is `isEmpty` and nothing else. Not sure how it is useful or not. @mrserb @stuart-marks I've pushed two additional commits which adds the isEmpty-check for Map and List as well, although the improvement there should be smaller, especially for Lists. ------------- PR: https://git.openjdk.org/jdk/pull/11847 From pminborg at openjdk.org Mon Jan 9 08:53:22 2023 From: pminborg at openjdk.org (Per Minborg) Date: Mon, 9 Jan 2023 08:53:22 GMT Subject: RFR: 8299513: Cleanup java.io [v3] In-Reply-To: References: Message-ID: > Code in java.io contains many legacy constructs and semantics not recommended including: > > * C-style array declaration > * Unnecessary visibility > * Redundant keywords in interfaces (e.g. public, static) > * Non-standard naming for constants > * Javadoc typos > * Missing final declaration > > These should be fixed as a sanity effort. Per Minborg has updated the pull request incrementally with one additional commit since the last revision: Revert constructor, add (c) year and revert some doc ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11848/files - new: https://git.openjdk.org/jdk/pull/11848/files/e3c107db..9331562b Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11848&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11848&range=01-02 Stats: 39 lines in 23 files changed: 3 ins; 7 del; 29 mod Patch: https://git.openjdk.org/jdk/pull/11848.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11848/head:pull/11848 PR: https://git.openjdk.org/jdk/pull/11848 From pminborg at openjdk.org Mon Jan 9 08:57:11 2023 From: pminborg at openjdk.org (Per Minborg) Date: Mon, 9 Jan 2023 08:57:11 GMT Subject: RFR: 8299513: Cleanup java.io [v4] In-Reply-To: References: Message-ID: > Code in java.io contains many legacy constructs and semantics not recommended including: > > * C-style array declaration > * Unnecessary visibility > * Redundant keywords in interfaces (e.g. public, static) > * Non-standard naming for constants > * Javadoc typos > * Missing final declaration > > These should be fixed as a sanity effort. Per Minborg has updated the pull request incrementally with one additional commit since the last revision: Add additional (c) years ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11848/files - new: https://git.openjdk.org/jdk/pull/11848/files/9331562b..a0e80355 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11848&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11848&range=02-03 Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/11848.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11848/head:pull/11848 PR: https://git.openjdk.org/jdk/pull/11848 From pminborg at openjdk.org Mon Jan 9 09:22:25 2023 From: pminborg at openjdk.org (Per Minborg) Date: Mon, 9 Jan 2023 09:22:25 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v7] In-Reply-To: References: Message-ID: > Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. > > Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. > > Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. > > Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 Per Minborg has updated the pull request incrementally with one additional commit since the last revision: Remove faulty test tag, improve other test tag, fix comments ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11840/files - new: https://git.openjdk.org/jdk/pull/11840/files/00a132c0..5d2341f4 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11840&range=06 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11840&range=05-06 Stats: 13 lines in 3 files changed: 1 ins; 9 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/11840.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11840/head:pull/11840 PR: https://git.openjdk.org/jdk/pull/11840 From alanb at openjdk.org Mon Jan 9 09:30:52 2023 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 9 Jan 2023 09:30:52 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v7] In-Reply-To: References: Message-ID: On Mon, 9 Jan 2023 09:22:25 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. >> >> Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. >> >> Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. >> >> Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Remove faulty test tag, improve other test tag, fix comments Marked as reviewed by alanb (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11840 From alanb at openjdk.org Mon Jan 9 09:43:56 2023 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 9 Jan 2023 09:43:56 GMT Subject: RFR: 8299513: Cleanup java.io [v4] In-Reply-To: References: Message-ID: On Mon, 9 Jan 2023 08:57:11 GMT, Per Minborg wrote: >> Code in java.io contains many legacy constructs and semantics not recommended including: >> >> * C-style array declaration >> * Unnecessary visibility >> * Redundant keywords in interfaces (e.g. public, static) >> * Non-standard naming for constants >> * Javadoc typos >> * Missing final declaration >> >> These should be fixed as a sanity effort. > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Add additional (c) years Marked as reviewed by alanb (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11848 From duke at openjdk.org Mon Jan 9 10:33:55 2023 From: duke at openjdk.org (Strahinja Stanojevic) Date: Mon, 9 Jan 2023 10:33:55 GMT Subject: RFR: 8292914: Introduce a system property that enables stable names for lambda proxy classes [v7] In-Reply-To: References: Message-ID: On Mon, 21 Nov 2022 16:46:43 GMT, Strahinja Stanojevic wrote: >> This PR introduces an option to output stable names for the lambda classes in the JDK. A stable name consists of two parts: The first part is the predefined value `$$Lambda$` appended to the lambda capturing class, and the second is a 64-bit hash part of the name. Thus, it looks like `lambdaCapturingClass$$Lambda$hashValue`. >> Parameters used to create a stable hash are a superset of the parameters used for lambda class archiving when the CDS dumping option is enabled. During this process, all the mutual parameters are in the same form as they are in the low-level implementation (`SystemDictionaryShared::add_lambda_proxy_class`) of the archiving process. >> We decided to use a well-specified `CRC32` algorithm from the standard Java library. We created two 32-bit hashes from the parameters used to create stable names. Then, we combined those two 32-bit hashes into one 64-bit hash value. >> We chose `CRC32` because it is a well-specified hash function, and we don't need to write additional code in the JDK. `SHA-256, MD5`, and all other hash functions that rely on `MessageDigest` use lambdas in the implementation, so they are unsuitable for our purpose. We also considered a few different hash functions with a low collision rate. All these functions would require at least 100 lines of additional code in the JDK. The best alternative we found is 64-bit` MurmurHash2`: https://commons.apache.org/proper/commons-codec/jacoco/org.apache.commons.codec.digest/MurmurHash2.java.html. In case adding a new hash implementation (e.g., Murmur2) to the JDK is preferred, this PR can be easily modified. >> We found the post (https://softwareengineering.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed/145633#145633) that compares different hash functions. >> We also tested the `CRC32` hash function against half a billion generated strings, and there were no collisions. Note that the capturing-class name is also part of the lambda class name, so the potential collisions can only appear in a single class. Thus, we do not expect to have name collisions due to a relatively low number of lambdas per class. Every tool that uses this feature should handle potential collisions on its own. >> We found an overall approximation of the collision rate too. You can find it here: https://preshing.com/20110504/hash-collision-probabilities/. >> >> JDK currently adds an atomic integer after `$$Lambda$`, and the names of the lambdas depend on the creation order. In the `TestStableLambdaNames`, we generate all the lambdas two times. In the first run, the method createPlainLambdas generate the following lambdas: >> >> - TestStableLambdaNames$$Lambda$1/0x0000000800c00400 >> - TestStableLambdaNames$$Lambda$2/0x0000000800c01800 >> - TestStableLambdaNames$$Lambda$3/0x0000000800c01a38 >> The same method in the second run generates lambdas with different names: >> - TestStableLambdaNames$$Lambda$1471/0x0000000800d10000 >> - TestStableLambdaNames$$Lambda$1472/0x0000000800d10238 >> - TestStableLambdaNames$$Lambda$1473/0x0000000800d10470 >> >> If we use the introduced flag, generated lambdas are: >> - TestStableLambdaNames$$Lambda$65ba26bbc6c7500d/0x0000000800c00400 >> - TestStableLambdaNames$$Lambda$1569c8c4abe3ab18/0x0000000800c01800 >> - TestStableLambdaNames$$Lambda$493c0ecaaf682428/0x0000000800c01a38 >> In the second run of the method, generated lambdas are: >> - TestStableLambdaNames$$Lambda$65ba26bbc6c7500d/0x0000000800d10000 >> - TestStableLambdaNames$$Lambda$1569c8c4abe3ab18/0x0000000800d10238 >> - TestStableLambdaNames$$Lambda$493c0ecaaf682428/0x0000000800d10470 >> >> We can see that the introduced hash value does not change between two calls of the method `createPlainLambdas`. That was not the case in the JDK run without this change. Those lambdas are extracted directly from the test. > > Strahinja Stanojevic has updated the pull request incrementally with one additional commit since the last revision: > > Remove address from lambda class names in test on the 32-bit architecture too Dummy comment to keep the PR alive. ------------- PR: https://git.openjdk.org/jdk/pull/10024 From mcimadamore at openjdk.org Mon Jan 9 10:36:53 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Mon, 9 Jan 2023 10:36:53 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v7] In-Reply-To: References: Message-ID: <8aowsJzamy0T0FooFgDPVVu_9m_OYVQgQdpAKTXFAbI=.87f52413-31fb-4c55-a0bc-70e3678d48e4@github.com> On Mon, 9 Jan 2023 09:22:25 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various primitive types to/from byte arrays. Switching to the use of `VarHandle` access would provide better performance and less code. >> >> Also, using a standard API for these conversions means future `VarHandle` improvements will benefit `Bits` too. >> >> Improvements in `Bits` will propagate to `ObjectInputStream`, `ObjectOutputStream` and `RandomAccessFile`. >> >> Initial benchmarks and performance discussions can be found here: https://github.com/openjdk/panama-foreign/pull/762 > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Remove faulty test tag, improve other test tag, fix comments src/java.base/share/classes/java/io/Bits.java line 77: > 75: // Using Double.longBitsToDouble collapses NaN values to a single > 76: // "canonical" NaN value > 77: return Double.longBitsToDouble((long) LONG.get(b, off)); For the records, I believe the template classes for byte array var handle already perform this conversion - e.g. @ForceInline static $type$ get(VarHandle ob, Object oba, int index) { ArrayHandle handle = (ArrayHandle)ob; byte[] ba = (byte[]) oba; #if[floatingPoint] $rawType$ rawValue = UNSAFE.get$RawType$Unaligned( ba, ((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET, handle.be); return $Type$.$rawType$BitsTo$Type$(rawValue); // <----------------------------- #else[floatingPoint] return UNSAFE.get$Type$Unaligned( ba, ((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET, handle.be); #end[floatingPoint] } ```` ------------- PR: https://git.openjdk.org/jdk/pull/11840 From lancea at openjdk.org Mon Jan 9 10:59:52 2023 From: lancea at openjdk.org (Lance Andersen) Date: Mon, 9 Jan 2023 10:59:52 GMT Subject: RFR: 8299513: Cleanup java.io [v4] In-Reply-To: References: Message-ID: On Mon, 9 Jan 2023 08:57:11 GMT, Per Minborg wrote: >> Code in java.io contains many legacy constructs and semantics not recommended including: >> >> * C-style array declaration >> * Unnecessary visibility >> * Redundant keywords in interfaces (e.g. public, static) >> * Non-standard naming for constants >> * Javadoc typos >> * Missing final declaration >> >> These should be fixed as a sanity effort. > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Add additional (c) years Marked as reviewed by lancea (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11848 From uschindler at openjdk.org Mon Jan 9 11:10:52 2023 From: uschindler at openjdk.org (Uwe Schindler) Date: Mon, 9 Jan 2023 11:10:52 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v7] In-Reply-To: <8aowsJzamy0T0FooFgDPVVu_9m_OYVQgQdpAKTXFAbI=.87f52413-31fb-4c55-a0bc-70e3678d48e4@github.com> References: <8aowsJzamy0T0FooFgDPVVu_9m_OYVQgQdpAKTXFAbI=.87f52413-31fb-4c55-a0bc-70e3678d48e4@github.com> Message-ID: On Mon, 9 Jan 2023 10:33:44 GMT, Maurizio Cimadamore wrote: >> Per Minborg has updated the pull request incrementally with one additional commit since the last revision: >> >> Remove faulty test tag, improve other test tag, fix comments > > src/java.base/share/classes/java/io/Bits.java line 77: > >> 75: // Using Double.longBitsToDouble collapses NaN values to a single >> 76: // "canonical" NaN value >> 77: return Double.longBitsToDouble((long) LONG.get(b, off)); > > For the records, I believe the template classes for byte array var handle already perform this conversion - e.g. > > > @ForceInline > static $type$ get(VarHandle ob, Object oba, int index) { > ArrayHandle handle = (ArrayHandle)ob; > byte[] ba = (byte[]) oba; > #if[floatingPoint] > $rawType$ rawValue = UNSAFE.get$RawType$Unaligned( > ba, > ((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET, > handle.be); > return $Type$.$rawType$BitsTo$Type$(rawValue); // <----------------------------- > #else[floatingPoint] > return UNSAFE.get$Type$Unaligned( > ba, > ((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET, > handle.be); > #end[floatingPoint] > } > ```` For the other direction it uses the `floatToRawIntBits`: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template#L148-L153 I think for symmatry we should keep it as is. ------------- PR: https://git.openjdk.org/jdk/pull/11840 From mcimadamore at openjdk.org Mon Jan 9 12:14:52 2023 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Mon, 9 Jan 2023 12:14:52 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v7] In-Reply-To: References: <8aowsJzamy0T0FooFgDPVVu_9m_OYVQgQdpAKTXFAbI=.87f52413-31fb-4c55-a0bc-70e3678d48e4@github.com> Message-ID: On Mon, 9 Jan 2023 11:07:51 GMT, Uwe Schindler wrote: >> src/java.base/share/classes/java/io/Bits.java line 77: >> >>> 75: // Using Double.longBitsToDouble collapses NaN values to a single >>> 76: // "canonical" NaN value >>> 77: return Double.longBitsToDouble((long) LONG.get(b, off)); >> >> For the records, I believe the template classes for byte array var handle already perform this conversion - e.g. >> >> >> @ForceInline >> static $type$ get(VarHandle ob, Object oba, int index) { >> ArrayHandle handle = (ArrayHandle)ob; >> byte[] ba = (byte[]) oba; >> #if[floatingPoint] >> $rawType$ rawValue = UNSAFE.get$RawType$Unaligned( >> ba, >> ((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET, >> handle.be); >> return $Type$.$rawType$BitsTo$Type$(rawValue); // <----------------------------- >> #else[floatingPoint] >> return UNSAFE.get$Type$Unaligned( >> ba, >> ((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET, >> handle.be); >> #end[floatingPoint] >> } >> ```` > > For the other direction it uses the `floatToRawIntBits`: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template#L148-L153 > > I think for symmatry we should keep it as is. I see - thanks for the explanation - the problem is with `floatToIntBits` vs `floatToRawIntBits` in the "put" operation. The get operation is ok, but then having asymmetry where we use a float VH in one case (get) but not in the other (put) is not desirable. ------------- PR: https://git.openjdk.org/jdk/pull/11840 From rgiulietti at openjdk.org Mon Jan 9 13:20:53 2023 From: rgiulietti at openjdk.org (Raffaello Giulietti) Date: Mon, 9 Jan 2023 13:20:53 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v7] In-Reply-To: References: <8aowsJzamy0T0FooFgDPVVu_9m_OYVQgQdpAKTXFAbI=.87f52413-31fb-4c55-a0bc-70e3678d48e4@github.com> Message-ID: On Mon, 9 Jan 2023 12:12:08 GMT, Maurizio Cimadamore wrote: >> For the other direction it uses the `floatToRawIntBits`: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template#L148-L153 >> >> I think for symmatry we should keep it as is. > > I see - thanks for the explanation - the problem is with `floatToIntBits` vs `floatToRawIntBits` in the "put" operation. The get operation is ok, but then having asymmetry where we use a float VH in one case (get) but not in the other (put) is not desirable. @mcimadamore According to the spec, `floatToRawIntBits` and `doubleToRawLongBits` ensure that the original input bits are all preserved, even for NaN values. On the other hand, the spec says that `intBitsToFloat` and `longBitsToDouble` only ensure a best effort in preserving the output bits of NaN values. So I think `VarHandle` `get` and `put` do their best to preserve the bits, but no more than the underlying platform can possibly offer. This behavior for floating-point values is not fully specified in `VarHandle`, so there's room for improvement in the doc. ------------- PR: https://git.openjdk.org/jdk/pull/11840 From duke at openjdk.org Mon Jan 9 14:03:54 2023 From: duke at openjdk.org (Archie L. Cobbs) Date: Mon, 9 Jan 2023 14:03:54 GMT Subject: RFR: 8015831: Add lint check for calling overridable methods from a constructor [v5] In-Reply-To: References: <_GkLRl5VTNh8ToJ3cjF-_v9j6eWWQzbUCCKStOXKh4g=.5e9505f1-8182-47e6-a8ed-78982db36c94@github.com> Message-ID: On Mon, 9 Jan 2023 06:37:22 GMT, David Holmes wrote: > All your new files need a copyright and GPL header. Sorry if I'm being blind but I'm not seeing it. Which file(s) are you referring to? The `@test /nodynamiccopyright/` files don't get one per [this](https://openjdk.org/groups/compiler/tests.html#gold). ------------- PR: https://git.openjdk.org/jdk/pull/11874 From fjiang at openjdk.org Mon Jan 9 14:20:29 2023 From: fjiang at openjdk.org (Feilong Jiang) Date: Mon, 9 Jan 2023 14:20:29 GMT Subject: RFR: 8293841: RISC-V: Implementation of Foreign Function & Memory API (Preview) [v2] In-Reply-To: References: Message-ID: > Add experimental Foreign Function & Memory API support for RISC-V. > > For details of the FFM API RISC-V port please refer to [JBS issue](https://bugs.openjdk.org/browse/JDK-8293841) > > Testing: > > - [x] jdk_foreign with release/fastdebug build > - [x] run TestMatrix.java manually with release/fastdebug build Feilong Jiang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision: - Merge branch 'master' of https://github.com/openjdk/jdk into JDK-8293841-foreign-api-riscv - code adjustment and remove unnecessary static - sync with JDK-8296477 - sync with JDK-8295044 - JDK-8293841: RISC-V: Implementation of Foreign Function & Memory API (Preview) ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11004/files - new: https://git.openjdk.org/jdk/pull/11004/files/c155840c..efe8238e Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11004&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11004&range=00-01 Stats: 6771 lines in 356 files changed: 3498 ins; 2172 del; 1101 mod Patch: https://git.openjdk.org/jdk/pull/11004.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11004/head:pull/11004 PR: https://git.openjdk.org/jdk/pull/11004 From duke at openjdk.org Mon Jan 9 14:52:38 2023 From: duke at openjdk.org (Glavo) Date: Mon, 9 Jan 2023 14:52:38 GMT Subject: RFR: 8299807: newStringUTF8NoRepl and getBytesUTF8NoRepl always copy arrays In-Reply-To: References: Message-ID: On Mon, 9 Jan 2023 03:34:55 GMT, Glavo wrote: > `JavaLangAccess::newStringUTF8NoRepl` and `JavaLangAccess::getBytesUTF8NoRepl` are not implemented correctly. They always copy arrays, rather than avoiding copying as much as possible as javadoc says. > > I ran the tier1 test without any new errors. Can someone open a issue for me on JBS? ------------- PR: https://git.openjdk.org/jdk/pull/11897 From duke at openjdk.org Mon Jan 9 14:52:37 2023 From: duke at openjdk.org (Glavo) Date: Mon, 9 Jan 2023 14:52:37 GMT Subject: RFR: 8299807: newStringUTF8NoRepl and getBytesUTF8NoRepl always copy arrays Message-ID: `JavaLangAccess::newStringUTF8NoRepl` and `JavaLangAccess::getBytesUTF8NoRepl` are not implemented correctly. They always copy arrays, rather than avoiding copying as much as possible as javadoc says. I ran the tier1 test without any new errors. ------------- Commit messages: - fix: newStringUTF8NoRepl and getBytesUTF8NoRepl always copy arrays Changes: https://git.openjdk.org/jdk/pull/11897/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11897&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299807 Stats: 9 lines in 1 file changed: 7 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/11897.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11897/head:pull/11897 PR: https://git.openjdk.org/jdk/pull/11897 From fjiang at openjdk.org Mon Jan 9 15:09:12 2023 From: fjiang at openjdk.org (Feilong Jiang) Date: Mon, 9 Jan 2023 15:09:12 GMT Subject: RFR: 8293841: RISC-V: Implementation of Foreign Function & Memory API (Preview) [v3] In-Reply-To: References: Message-ID: > Add experimental Foreign Function & Memory API support for RISC-V. > > For details of the FFM API RISC-V port please refer to [JBS issue](https://bugs.openjdk.org/browse/JDK-8293841) > > Testing: > > - [x] jdk_foreign with release/fastdebug build > - [x] run TestMatrix.java manually with release/fastdebug build Feilong Jiang has updated the pull request incrementally with one additional commit since the last revision: fix build ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11004/files - new: https://git.openjdk.org/jdk/pull/11004/files/efe8238e..289b8697 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11004&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11004&range=01-02 Stats: 4 lines in 2 files changed: 2 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/11004.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11004/head:pull/11004 PR: https://git.openjdk.org/jdk/pull/11004 From redestad at openjdk.org Mon Jan 9 15:00:48 2023 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 9 Jan 2023 15:00:48 GMT Subject: RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v17] In-Reply-To: References: Message-ID: > Continuing the work initiated by @luhenry to unroll and then intrinsify polynomial hash loops. > > I've rewired the library changes to route via a single `@IntrinsicCandidate` method. To make this work I've harmonized how they are invoked so that there's less special handling and checks in the intrinsic. Mainly do the null-check outside of the intrinsic for `Arrays.hashCode` cases. > > Having a centralized entry point means it'll be easier to parameterize the factor and start values which are now hard-coded (always 31, and a start value of either one for `Arrays` or zero for `String`). It seems somewhat premature to parameterize this up front. > > The current implementation is performance neutral on microbenchmarks on all tested platforms (x64, aarch64) when not enabling the intrinsic. We do add a few trivial method calls which increase the call stack depth, so surprises cannot be ruled out on complex workloads. > > With the most recent fixes the x64 intrinsic results on my workstation look like this: > > Benchmark (size) Mode Cnt Score Error Units > StringHashCode.Algorithm.defaultLatin1 1 avgt 5 2.199 ? 0.017 ns/op > StringHashCode.Algorithm.defaultLatin1 10 avgt 5 6.933 ? 0.049 ns/op > StringHashCode.Algorithm.defaultLatin1 100 avgt 5 29.935 ? 0.221 ns/op > StringHashCode.Algorithm.defaultLatin1 10000 avgt 5 1596.982 ? 7.020 ns/op > > Baseline: > > Benchmark (size) Mode Cnt Score Error Units > StringHashCode.Algorithm.defaultLatin1 1 avgt 5 2.200 ? 0.013 ns/op > StringHashCode.Algorithm.defaultLatin1 10 avgt 5 9.424 ? 0.122 ns/op > StringHashCode.Algorithm.defaultLatin1 100 avgt 5 90.541 ? 0.512 ns/op > StringHashCode.Algorithm.defaultLatin1 10000 avgt 5 9425.321 ? 67.630 ns/op > > I.e. no measurable overhead compared to baseline even for `size == 1`. > > The vectorized code now nominally works for all unsigned cases as well as ints, though more testing would be good. > > Benchmark for `Arrays.hashCode`: > > Benchmark (size) Mode Cnt Score Error Units > ArraysHashCode.bytes 1 avgt 5 1.884 ? 0.013 ns/op > ArraysHashCode.bytes 10 avgt 5 6.955 ? 0.040 ns/op > ArraysHashCode.bytes 100 avgt 5 87.218 ? 0.595 ns/op > ArraysHashCode.bytes 10000 avgt 5 9419.591 ? 38.308 ns/op > ArraysHashCode.chars 1 avgt 5 2.200 ? 0.010 ns/op > ArraysHashCode.chars 10 avgt 5 6.935 ? 0.034 ns/op > ArraysHashCode.chars 100 avgt 5 30.216 ? 0.134 ns/op > ArraysHashCode.chars 10000 avgt 5 1601.629 ? 6.418 ns/op > ArraysHashCode.ints 1 avgt 5 2.200 ? 0.007 ns/op > ArraysHashCode.ints 10 avgt 5 6.936 ? 0.034 ns/op > ArraysHashCode.ints 100 avgt 5 29.412 ? 0.268 ns/op > ArraysHashCode.ints 10000 avgt 5 1610.578 ? 7.785 ns/op > ArraysHashCode.shorts 1 avgt 5 1.885 ? 0.012 ns/op > ArraysHashCode.shorts 10 avgt 5 6.961 ? 0.034 ns/op > ArraysHashCode.shorts 100 avgt 5 87.095 ? 0.417 ns/op > ArraysHashCode.shorts 10000 avgt 5 9420.617 ? 50.089 ns/op > > Baseline: > > Benchmark (size) Mode Cnt Score Error Units > ArraysHashCode.bytes 1 avgt 5 3.213 ? 0.207 ns/op > ArraysHashCode.bytes 10 avgt 5 8.483 ? 0.040 ns/op > ArraysHashCode.bytes 100 avgt 5 90.315 ? 0.655 ns/op > ArraysHashCode.bytes 10000 avgt 5 9422.094 ? 62.402 ns/op > ArraysHashCode.chars 1 avgt 5 3.040 ? 0.066 ns/op > ArraysHashCode.chars 10 avgt 5 8.497 ? 0.074 ns/op > ArraysHashCode.chars 100 avgt 5 90.074 ? 0.387 ns/op > ArraysHashCode.chars 10000 avgt 5 9420.474 ? 41.619 ns/op > ArraysHashCode.ints 1 avgt 5 2.827 ? 0.019 ns/op > ArraysHashCode.ints 10 avgt 5 7.727 ? 0.043 ns/op > ArraysHashCode.ints 100 avgt 5 89.405 ? 0.593 ns/op > ArraysHashCode.ints 10000 avgt 5 9426.539 ? 51.308 ns/op > ArraysHashCode.shorts 1 avgt 5 3.071 ? 0.062 ns/op > ArraysHashCode.shorts 10 avgt 5 8.168 ? 0.049 ns/op > ArraysHashCode.shorts 100 avgt 5 90.399 ? 0.292 ns/op > ArraysHashCode.shorts 10000 avgt 5 9420.171 ? 44.474 ns/op > > > As we can see the `Arrays` intrinsics are faster for small inputs, and faster on large inputs for `char` and `int` (the ones currently vectorized). I aim to fix `byte` and `short` cases before integrating, though it might be acceptable to hand that off as follow-up enhancements to not further delay integration of this enhancement. Claes Redestad has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 68 commits: - Merge branch 'master' into 8282664-polyhash - Treat Op_VectorizedHashCode as other similar Ops in split_unique_types - Handle signed subword arrays, contributed by @sviswa7 - @sviswa7 comments - Pass the constant mode node through, removing need for all but one instruct declarations - FLAG_SET_DEFAULT - Merge branch 'master' into 8282664-polyhash - Merge branch 'master' into 8282664-polyhash - Missing & 0xff in StringLatin1::hashCode - Qualified guess on shenandoahSupport fix-up - ... and 58 more: https://git.openjdk.org/jdk/compare/66db0bb6...71297615 ------------- Changes: https://git.openjdk.org/jdk/pull/10847/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10847&range=16 Stats: 1052 lines in 33 files changed: 992 ins; 8 del; 52 mod Patch: https://git.openjdk.org/jdk/pull/10847.diff Fetch: git fetch https://git.openjdk.org/jdk pull/10847/head:pull/10847 PR: https://git.openjdk.org/jdk/pull/10847 From redestad at openjdk.org Mon Jan 9 15:23:58 2023 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 9 Jan 2023 15:23:58 GMT Subject: RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v13] In-Reply-To: References: <6lAQI6kDDTGbskylHcWReX8ExaB6qkwgqoai7E6ikZY=.8a69a63c-453d-4bbd-8c76-4d477bfb77fe@github.com> Message-ID: On Thu, 22 Dec 2022 13:10:02 GMT, Claes Redestad wrote: >> @cl4es Thanks for passing the constant node through, the code looks much cleaner now. The attached patch should handle the signed bytes/shorts as well. Please take a look. >> [signed.patch](https://github.com/openjdk/jdk/files/10273480/signed.patch) > > I ran tests and some quick microbenchmarking to validate @sviswa7's patch to activate vectorization for `short` and `byte` arrays and it looks good: > > Before: > > Benchmark (size) Mode Cnt Score Error Units > ArraysHashCode.bytes 10000 avgt 5 7845.586 ? 23.440 ns/op > ArraysHashCode.chars 10000 avgt 5 1203.163 ? 11.995 ns/op > ArraysHashCode.ints 10000 avgt 5 1131.915 ? 7.843 ns/op > ArraysHashCode.multibytes 10000 avgt 5 4136.487 ? 5.790 ns/op > ArraysHashCode.multichars 10000 avgt 5 671.328 ? 17.629 ns/op > ArraysHashCode.multiints 10000 avgt 5 699.051 ? 8.135 ns/op > ArraysHashCode.multishorts 10000 avgt 5 4139.300 ? 10.633 ns/op > ArraysHashCode.shorts 10000 avgt 5 7844.019 ? 26.071 ns/op > > > After: > > Benchmark (size) Mode Cnt Score Error Units > ArraysHashCode.bytes 10000 avgt 5 1193.208 ? 1.965 ns/op > ArraysHashCode.chars 10000 avgt 5 1193.311 ? 5.941 ns/op > ArraysHashCode.ints 10000 avgt 5 1132.592 ? 10.410 ns/op > ArraysHashCode.multibytes 10000 avgt 5 657.343 ? 25.343 ns/op > ArraysHashCode.multichars 10000 avgt 5 672.668 ? 5.229 ns/op > ArraysHashCode.multiints 10000 avgt 5 697.143 ? 3.929 ns/op > ArraysHashCode.multishorts 10000 avgt 5 666.738 ? 12.236 ns/op > ArraysHashCode.shorts 10000 avgt 5 1193.563 ? 5.449 ns/op > @cl4es There seem to be failure on windows-x64 platform pre submit tests. Could you please take a look? It looks like the `as_Address(ExternalAddress(StubRoutines::x86::arrays_hashcode_powers_of_31() + ...)` trick is running into some reachability issue on Windows, hitting the `assert(reachable(adr), "must be");` in `macroAssembler_x86.cpp`. Might be related to ASLR or some quirk of the VS compiler. I'll investigate. ------------- PR: https://git.openjdk.org/jdk/pull/10847 From naoto at openjdk.org Mon Jan 9 16:14:02 2023 From: naoto at openjdk.org (Naoto Sato) Date: Mon, 9 Jan 2023 16:14:02 GMT Subject: RFR: 6381945: (cal) Japanese calendar unit test system should avoid multiple static imports In-Reply-To: References: Message-ID: On Wed, 4 Jan 2023 21:49:18 GMT, Justin Lu wrote: > Within _test/jdk/java/util/Calendar/CalendarTestScripts/Symbol.java_ > > GregorianCalendar alone handles all the necessary imports, Calendar is not needed Marked as reviewed by naoto (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11855 From naoto at openjdk.org Mon Jan 9 16:12:55 2023 From: naoto at openjdk.org (Naoto Sato) Date: Mon, 9 Jan 2023 16:12:55 GMT Subject: RFR: 8297306: Incorrect brackets in Javadoc for a constructor of IteratorSpliterator [v2] In-Reply-To: References: Message-ID: On Mon, 9 Jan 2023 01:09:04 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which fixes an issue in the javadoc text of the internal class IteratorSpliterator? This addresses the issue reported at https://bugs.openjdk.org/browse/JDK-8297306. > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > update another javadoc Looks fine to me. Thanks for the update, Jai. ------------- Marked as reviewed by naoto (Reviewer). PR: https://git.openjdk.org/jdk/pull/11876 From naoto at openjdk.org Mon Jan 9 16:03:52 2023 From: naoto at openjdk.org (Naoto Sato) Date: Mon, 9 Jan 2023 16:03:52 GMT Subject: RFR: 8177418: TimeZone.getTimeZone(String id) throws NullPointerException when id is null In-Reply-To: References: Message-ID: <9j8n1816UXLXcX9VN74MHGuRyXHhTJ4FCk-baS8qUQA=.f3849302-07dd-4dda-b447-73b0ecd3656c@github.com> On Fri, 6 Jan 2023 22:38:13 GMT, Justin Lu wrote: > When ID is null, TimeZone.getTimeZone(String ID) throws a NullPointerException. > > For example, > > > String someID = null; > TimeZone tz1 = TimeZone.getTimeZone(someID); > ``` > > throws a `NullPointerException` > > This change updates the documentation to make this apparent. LGTM. Please file a CSR as Lance suggested. ------------- Marked as reviewed by naoto (Reviewer). PR: https://git.openjdk.org/jdk/pull/11888 From redestad at openjdk.org Mon Jan 9 16:49:25 2023 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 9 Jan 2023 16:49:25 GMT Subject: RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v18] In-Reply-To: References: Message-ID: > Continuing the work initiated by @luhenry to unroll and then intrinsify polynomial hash loops. > > I've rewired the library changes to route via a single `@IntrinsicCandidate` method. To make this work I've harmonized how they are invoked so that there's less special handling and checks in the intrinsic. Mainly do the null-check outside of the intrinsic for `Arrays.hashCode` cases. > > Having a centralized entry point means it'll be easier to parameterize the factor and start values which are now hard-coded (always 31, and a start value of either one for `Arrays` or zero for `String`). It seems somewhat premature to parameterize this up front. > > The current implementation is performance neutral on microbenchmarks on all tested platforms (x64, aarch64) when not enabling the intrinsic. We do add a few trivial method calls which increase the call stack depth, so surprises cannot be ruled out on complex workloads. > > With the most recent fixes the x64 intrinsic results on my workstation look like this: > > Benchmark (size) Mode Cnt Score Error Units > StringHashCode.Algorithm.defaultLatin1 1 avgt 5 2.199 ? 0.017 ns/op > StringHashCode.Algorithm.defaultLatin1 10 avgt 5 6.933 ? 0.049 ns/op > StringHashCode.Algorithm.defaultLatin1 100 avgt 5 29.935 ? 0.221 ns/op > StringHashCode.Algorithm.defaultLatin1 10000 avgt 5 1596.982 ? 7.020 ns/op > > Baseline: > > Benchmark (size) Mode Cnt Score Error Units > StringHashCode.Algorithm.defaultLatin1 1 avgt 5 2.200 ? 0.013 ns/op > StringHashCode.Algorithm.defaultLatin1 10 avgt 5 9.424 ? 0.122 ns/op > StringHashCode.Algorithm.defaultLatin1 100 avgt 5 90.541 ? 0.512 ns/op > StringHashCode.Algorithm.defaultLatin1 10000 avgt 5 9425.321 ? 67.630 ns/op > > I.e. no measurable overhead compared to baseline even for `size == 1`. > > The vectorized code now nominally works for all unsigned cases as well as ints, though more testing would be good. > > Benchmark for `Arrays.hashCode`: > > Benchmark (size) Mode Cnt Score Error Units > ArraysHashCode.bytes 1 avgt 5 1.884 ? 0.013 ns/op > ArraysHashCode.bytes 10 avgt 5 6.955 ? 0.040 ns/op > ArraysHashCode.bytes 100 avgt 5 87.218 ? 0.595 ns/op > ArraysHashCode.bytes 10000 avgt 5 9419.591 ? 38.308 ns/op > ArraysHashCode.chars 1 avgt 5 2.200 ? 0.010 ns/op > ArraysHashCode.chars 10 avgt 5 6.935 ? 0.034 ns/op > ArraysHashCode.chars 100 avgt 5 30.216 ? 0.134 ns/op > ArraysHashCode.chars 10000 avgt 5 1601.629 ? 6.418 ns/op > ArraysHashCode.ints 1 avgt 5 2.200 ? 0.007 ns/op > ArraysHashCode.ints 10 avgt 5 6.936 ? 0.034 ns/op > ArraysHashCode.ints 100 avgt 5 29.412 ? 0.268 ns/op > ArraysHashCode.ints 10000 avgt 5 1610.578 ? 7.785 ns/op > ArraysHashCode.shorts 1 avgt 5 1.885 ? 0.012 ns/op > ArraysHashCode.shorts 10 avgt 5 6.961 ? 0.034 ns/op > ArraysHashCode.shorts 100 avgt 5 87.095 ? 0.417 ns/op > ArraysHashCode.shorts 10000 avgt 5 9420.617 ? 50.089 ns/op > > Baseline: > > Benchmark (size) Mode Cnt Score Error Units > ArraysHashCode.bytes 1 avgt 5 3.213 ? 0.207 ns/op > ArraysHashCode.bytes 10 avgt 5 8.483 ? 0.040 ns/op > ArraysHashCode.bytes 100 avgt 5 90.315 ? 0.655 ns/op > ArraysHashCode.bytes 10000 avgt 5 9422.094 ? 62.402 ns/op > ArraysHashCode.chars 1 avgt 5 3.040 ? 0.066 ns/op > ArraysHashCode.chars 10 avgt 5 8.497 ? 0.074 ns/op > ArraysHashCode.chars 100 avgt 5 90.074 ? 0.387 ns/op > ArraysHashCode.chars 10000 avgt 5 9420.474 ? 41.619 ns/op > ArraysHashCode.ints 1 avgt 5 2.827 ? 0.019 ns/op > ArraysHashCode.ints 10 avgt 5 7.727 ? 0.043 ns/op > ArraysHashCode.ints 100 avgt 5 89.405 ? 0.593 ns/op > ArraysHashCode.ints 10000 avgt 5 9426.539 ? 51.308 ns/op > ArraysHashCode.shorts 1 avgt 5 3.071 ? 0.062 ns/op > ArraysHashCode.shorts 10 avgt 5 8.168 ? 0.049 ns/op > ArraysHashCode.shorts 100 avgt 5 90.399 ? 0.292 ns/op > ArraysHashCode.shorts 10000 avgt 5 9420.171 ? 44.474 ns/op > > > As we can see the `Arrays` intrinsics are faster for small inputs, and faster on large inputs for `char` and `int` (the ones currently vectorized). I aim to fix `byte` and `short` cases before integrating, though it might be acceptable to hand that off as follow-up enhancements to not further delay integration of this enhancement. Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: Explicitly lea external address ------------- Changes: - all: https://git.openjdk.org/jdk/pull/10847/files - new: https://git.openjdk.org/jdk/pull/10847/files/71297615..c8c58f4a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=10847&range=17 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10847&range=16-17 Stats: 11 lines in 1 file changed: 6 ins; 3 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/10847.diff Fetch: git fetch https://git.openjdk.org/jdk pull/10847/head:pull/10847 PR: https://git.openjdk.org/jdk/pull/10847 From naoto at openjdk.org Mon Jan 9 17:09:29 2023 From: naoto at openjdk.org (Naoto Sato) Date: Mon, 9 Jan 2023 17:09:29 GMT Subject: [jdk20] RFR: 8299689: Make use of JLine for Console as "opt-in" [v2] In-Reply-To: <1Y0pELaN2mrGhHLgXtfgdO65EUNI__6wNf6oy2KKzFE=.bdd50824-05b4-4a49-ad52-d56796915261@github.com> References: <1Y0pELaN2mrGhHLgXtfgdO65EUNI__6wNf6oy2KKzFE=.bdd50824-05b4-4a49-ad52-d56796915261@github.com> Message-ID: > Due to the fact that JLine spawns native processes to obtain terminal information on macOS/Linux, we decided to disable the JLine by default for performance degradation reasons. It is still possible to enable it by specifying it on the command line with `jdk.console` system property (not a public one though). Once we have a solution to avoid spawning processes, JLine may be back for use in the future. Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: Addressing review suggestions ------------- Changes: - all: https://git.openjdk.org/jdk20/pull/88/files - new: https://git.openjdk.org/jdk20/pull/88/files/b15a8bda..9a948725 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk20&pr=88&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk20&pr=88&range=00-01 Stats: 15 lines in 3 files changed: 6 ins; 6 del; 3 mod Patch: https://git.openjdk.org/jdk20/pull/88.diff Fetch: git fetch https://git.openjdk.org/jdk20 pull/88/head:pull/88 PR: https://git.openjdk.org/jdk20/pull/88 From naoto at openjdk.org Mon Jan 9 17:09:30 2023 From: naoto at openjdk.org (Naoto Sato) Date: Mon, 9 Jan 2023 17:09:30 GMT Subject: [jdk20] RFR: 8299689: Make use of JLine for Console as "opt-in" [v2] In-Reply-To: References: <1Y0pELaN2mrGhHLgXtfgdO65EUNI__6wNf6oy2KKzFE=.bdd50824-05b4-4a49-ad52-d56796915261@github.com> Message-ID: On Sat, 7 Jan 2023 10:35:50 GMT, Alan Bateman wrote: >> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: >> >> Addressing review suggestions > > src/java.base/share/classes/jdk/internal/io/JdkConsoleProvider.java line 35: > >> 33: * designates the module name of the implementation, and which defaults >> 34: * to "java.base". If no providers is available, >> 35: * or instantiation failed, java.base built-in Console implementation > > The overall change looks fine but I think for the next edit that we should move most of this comment to Console as it's Console that selects the behavior and that skips errors. Also once the SM execution mode goes away then we can re-visit that behavior. Makes sense. The comment has been moved to `Console`. ------------- PR: https://git.openjdk.org/jdk20/pull/88 From stsypanov at openjdk.org Mon Jan 9 17:10:54 2023 From: stsypanov at openjdk.org (Sergey Tsypanov) Date: Mon, 9 Jan 2023 17:10:54 GMT Subject: RFR: 8299807: newStringUTF8NoRepl and getBytesUTF8NoRepl always copy arrays In-Reply-To: References: Message-ID: On Mon, 9 Jan 2023 03:34:55 GMT, Glavo wrote: > `JavaLangAccess::newStringUTF8NoRepl` and `JavaLangAccess::getBytesUTF8NoRepl` are not implemented correctly. They always copy arrays, rather than avoiding copying as much as possible as javadoc says. > > I ran the tier1 test without any new errors. src/java.base/share/classes/java/lang/String.java line 927: > 925: byte[] val = s.value(); > 926: byte coder = s.coder(); > 927: if (coder == LATIN1 && isASCII(val)) { Why don't we just call `s.isLatin1()` instead of `coder == LATIN1 && isASCII(val)`? ------------- PR: https://git.openjdk.org/jdk/pull/11897 From serb at openjdk.org Mon Jan 9 17:11:55 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Mon, 9 Jan 2023 17:11:55 GMT Subject: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections [v2] In-Reply-To: References: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> Message-ID: On Mon, 9 Jan 2023 08:33:09 GMT, Viktor Klang wrote: >> Currently Set.copyOf allocates both a HashSet and a new empty array when the input collection is empty. >> >> This patch avoids allocating anything for the case where the parameter collection's isEmpty returns true. > > Viktor Klang has updated the pull request incrementally with two additional commits since the last revision: > > - 8299444: java.util.Set.copyOf allocates needlessly for empty input collections > > Modifies ImmutableCollections.listCopy: > Introduces a check for isEmpty to avoid allocation in the case of an empty input collection. > - 8299444: java.util.Set.copyOf allocates needlessly for empty input collections > > Modifies Map.copyOf: > Introduces a check for isEmpty to avoid allocation in the case of an empty input Map. I wonder how it will affect (if any) the performance of the common path, for example if non-empty but small ConcurrentHashMap is passed to the List.copyOf(). ------------- PR: https://git.openjdk.org/jdk/pull/11847 From alanb at openjdk.org Mon Jan 9 17:21:56 2023 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 9 Jan 2023 17:21:56 GMT Subject: [jdk20] RFR: 8299689: Make use of JLine for Console as "opt-in" [v2] In-Reply-To: References: <1Y0pELaN2mrGhHLgXtfgdO65EUNI__6wNf6oy2KKzFE=.bdd50824-05b4-4a49-ad52-d56796915261@github.com> Message-ID: On Mon, 9 Jan 2023 17:09:29 GMT, Naoto Sato wrote: >> Due to the fact that JLine spawns native processes to obtain terminal information on macOS/Linux, we decided to disable the JLine by default for performance degradation reasons. It is still possible to enable it by specifying it on the command line with `jdk.console` system property (not a public one though). Once we have a solution to avoid spawning processes, JLine may be back for use in the future. > > Naoto Sato has updated the pull request incrementally with one additional commit since the last revision: > > Addressing review suggestions Marked as reviewed by alanb (Reviewer). ------------- PR: https://git.openjdk.org/jdk20/pull/88 From duke at openjdk.org Mon Jan 9 17:34:55 2023 From: duke at openjdk.org (Viktor Klang) Date: Mon, 9 Jan 2023 17:34:55 GMT Subject: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections [v2] In-Reply-To: References: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> Message-ID: On Mon, 9 Jan 2023 17:09:02 GMT, Sergey Bylokhov wrote: >> Viktor Klang has updated the pull request incrementally with two additional commits since the last revision: >> >> - 8299444: java.util.Set.copyOf allocates needlessly for empty input collections >> >> Modifies ImmutableCollections.listCopy: >> Introduces a check for isEmpty to avoid allocation in the case of an empty input collection. >> - 8299444: java.util.Set.copyOf allocates needlessly for empty input collections >> >> Modifies Map.copyOf: >> Introduces a check for isEmpty to avoid allocation in the case of an empty input Map. > > I wonder how it will affect (if any) the performance of the common path, for example if non-empty but small ConcurrentHashMap is passed to the List.copyOf(). @mrserb The "hit" is directly proportional to the cost of `isEmpty()`?but specifically for collections like ConcurrentHashMap, the very notion of "current size" is challenging at best. ------------- PR: https://git.openjdk.org/jdk/pull/11847 From mchung at openjdk.org Mon Jan 9 17:36:58 2023 From: mchung at openjdk.org (Mandy Chung) Date: Mon, 9 Jan 2023 17:36:58 GMT Subject: RFR: 8299183: Invokers.checkExactType passes parameters to create WMTE in opposite order [v2] In-Reply-To: References: <68ERvONXzd-5lr4Au21sLFN-etSesjFy8tHzLSTsil0=.ea75bf5c-9dc8-4fbe-83b0-b55bc30da2c6@github.com> Message-ID: <5m-TlvgEBySPfrHXgLFaPq1TzlMMFP1qaNkaesIO3uU=.db3884fd-ec50-43a3-b3ce-e77edb6550db@github.com> On Sat, 7 Jan 2023 10:46:40 GMT, Jaikiran Pai wrote: >> Mandy Chung has updated the pull request incrementally with two additional commits since the last revision: >> >> - Add a regression test >> - further cleanup newWrongMethodTypeException for clarity > > test/jdk/java/lang/invoke/WrongMethodTypeTest.java line 8: > >> 6: * under the terms of the GNU General Public License version 2 only, as >> 7: * published by the Free Software Foundation. Oracle designates this >> 8: * particular file as subject to the "Classpath" exception as provided > > From what I understand, the copyright notice on test files don't use the "Classpath" exception and instead use a different copyright notice. That's correct. Thanks for catching it. This reveals that the copyright header of several `test/jdk/java/lang/invoke` tests will need clean up (as this new test was copied from an existing test). ------------- PR: https://git.openjdk.org/jdk/pull/11870 From duke at openjdk.org Mon Jan 9 17:46:59 2023 From: duke at openjdk.org (Justin Lu) Date: Mon, 9 Jan 2023 17:46:59 GMT Subject: Integrated: 8299500: Usage of constructors of primitive wrapper classes should be avoided in java.text API docs In-Reply-To: <5beb38afAjMVpmWkhEizo6dwAqadjESW5pYiwCg5JxU=.4296244c-e0d6-4c83-9c28-7641a988f07b@github.com> References: <5beb38afAjMVpmWkhEizo6dwAqadjESW5pYiwCg5JxU=.4296244c-e0d6-4c83-9c28-7641a988f07b@github.com> Message-ID: On Fri, 6 Jan 2023 17:42:53 GMT, Justin Lu wrote: > Removed constructors of primitive wrapper classes (deprecated for removal) for the following > - _java.text.ChoiceFormat_ > - _java.text.MessageFormat_ > > Replaced with .valueOf() method This pull request has now been integrated. Changeset: cd10c727 Author: Justin Lu Committer: Naoto Sato URL: https://git.openjdk.org/jdk/commit/cd10c7278d8fcf7ce6713a3ee688bb1e10c024f6 Stats: 8 lines in 2 files changed: 0 ins; 1 del; 7 mod 8299500: Usage of constructors of primitive wrapper classes should be avoided in java.text API docs Reviewed-by: naoto, lancea ------------- PR: https://git.openjdk.org/jdk/pull/11884 From mchung at openjdk.org Mon Jan 9 18:15:42 2023 From: mchung at openjdk.org (Mandy Chung) Date: Mon, 9 Jan 2023 18:15:42 GMT Subject: RFR: 8299183: Invokers.checkExactType passes parameters to create WMTE in opposite order [v3] In-Reply-To: <68ERvONXzd-5lr4Au21sLFN-etSesjFy8tHzLSTsil0=.ea75bf5c-9dc8-4fbe-83b0-b55bc30da2c6@github.com> References: <68ERvONXzd-5lr4Au21sLFN-etSesjFy8tHzLSTsil0=.ea75bf5c-9dc8-4fbe-83b0-b55bc30da2c6@github.com> Message-ID: > Trivial fix. Fix `Invokers.checkExactType` to call `newWrongMethodTypeException(actual, expected)` with parameters in right order. Mandy Chung has updated the pull request incrementally with one additional commit since the last revision: Update VarHandleTestExact test and new test's copyright header ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11870/files - new: https://git.openjdk.org/jdk/pull/11870/files/35968a32..7c963020 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11870&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11870&range=01-02 Stats: 10 lines in 2 files changed: 0 ins; 2 del; 8 mod Patch: https://git.openjdk.org/jdk/pull/11870.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11870/head:pull/11870 PR: https://git.openjdk.org/jdk/pull/11870 From smarks at openjdk.org Mon Jan 9 18:24:51 2023 From: smarks at openjdk.org (Stuart Marks) Date: Mon, 9 Jan 2023 18:24:51 GMT Subject: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections [v2] In-Reply-To: References: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> Message-ID: On Mon, 9 Jan 2023 08:33:09 GMT, Viktor Klang wrote: >> Currently Set.copyOf allocates both a HashSet and a new empty array when the input collection is empty. >> >> This patch avoids allocating anything for the case where the parameter collection's isEmpty returns true. > > Viktor Klang has updated the pull request incrementally with two additional commits since the last revision: > > - 8299444: java.util.Set.copyOf allocates needlessly for empty input collections > > Modifies ImmutableCollections.listCopy: > Introduces a check for isEmpty to avoid allocation in the case of an empty input collection. > - 8299444: java.util.Set.copyOf allocates needlessly for empty input collections > > Modifies Map.copyOf: > Introduces a check for isEmpty to avoid allocation in the case of an empty input Map. Overall I think the cost of isEmpty() is likely to be relatively inexpensive, even on CHM. The CHM.isEmpty() implementation is O(n) where n is the number of counter cells, which is NOT proportional to the number of mappings contained in the map. Instead, the number of counter cells is proportional to the amount of contention there is over the map. It's hard to say what this is likely to be, but it doesn't seem obvious that this would be a pessimization. Of course it's also possible for isEmpty() to return an out-of-date value. If it returns true and the CHM later changes size, this is a race condition, and at some point in the past we believe the CHM actually was empty; so copyOf() returning an empty collection is not an error. If isEmpty() returns false and the CHM is cleared afterward, toArray() will return an empty array. We'll end up with an empty collection, and the only penalty is that we had to go through the slow path to do that. And yes, calling copyOf() on a collection that's being modified concurrently is a bit questionable. It'll return a snapshot of the contents at some time in the past, but if the application is aware of this, then we should be ok. ------------- PR: https://git.openjdk.org/jdk/pull/11847 From naoto at openjdk.org Mon Jan 9 18:26:59 2023 From: naoto at openjdk.org (Naoto Sato) Date: Mon, 9 Jan 2023 18:26:59 GMT Subject: [jdk20] Integrated: 8299689: Make use of JLine for Console as "opt-in" In-Reply-To: <1Y0pELaN2mrGhHLgXtfgdO65EUNI__6wNf6oy2KKzFE=.bdd50824-05b4-4a49-ad52-d56796915261@github.com> References: <1Y0pELaN2mrGhHLgXtfgdO65EUNI__6wNf6oy2KKzFE=.bdd50824-05b4-4a49-ad52-d56796915261@github.com> Message-ID: <34ZXVdltDiZjqj_KVHLzqhwRsnOw-JfQ_ZunNMfGtL0=.0a55844c-2ee8-44ed-a09c-155a6e8114a7@github.com> On Fri, 6 Jan 2023 17:57:47 GMT, Naoto Sato wrote: > Due to the fact that JLine spawns native processes to obtain terminal information on macOS/Linux, we decided to disable the JLine by default for performance degradation reasons. It is still possible to enable it by specifying it on the command line with `jdk.console` system property (not a public one though). Once we have a solution to avoid spawning processes, JLine may be back for use in the future. This pull request has now been integrated. Changeset: d49851a8 Author: Naoto Sato URL: https://git.openjdk.org/jdk20/commit/d49851a8b8e80b6ffa53c2bb4f5b2897735d471f Stats: 48 lines in 4 files changed: 24 ins; 7 del; 17 mod 8299689: Make use of JLine for Console as "opt-in" Reviewed-by: jpai, alanb ------------- PR: https://git.openjdk.org/jdk20/pull/88 From duke at openjdk.org Mon Jan 9 18:29:55 2023 From: duke at openjdk.org (Glavo) Date: Mon, 9 Jan 2023 18:29:55 GMT Subject: RFR: 8299807: newStringUTF8NoRepl and getBytesUTF8NoRepl always copy arrays In-Reply-To: References: Message-ID: On Mon, 9 Jan 2023 17:07:53 GMT, Sergey Tsypanov wrote: > Why don't we just call `s.isLatin1()` instead of `coder == LATIN1 && isASCII(val)`? The `isLatin1()` can only replace `coder == LATIN1`, and it is necessary to check whether it is ASCII. In the following, we also need to pass the `coder` when calling `encodeUTF8`. Therefore, I think it is clearer to judge the `coder` directly than to call `isLatin1()`. ------------- PR: https://git.openjdk.org/jdk/pull/11897 From smarks at openjdk.org Mon Jan 9 18:29:57 2023 From: smarks at openjdk.org (Stuart Marks) Date: Mon, 9 Jan 2023 18:29:57 GMT Subject: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections [v2] In-Reply-To: References: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> Message-ID: On Mon, 9 Jan 2023 08:33:09 GMT, Viktor Klang wrote: >> Currently Set.copyOf allocates both a HashSet and a new empty array when the input collection is empty. >> >> This patch avoids allocating anything for the case where the parameter collection's isEmpty returns true. > > Viktor Klang has updated the pull request incrementally with two additional commits since the last revision: > > - 8299444: java.util.Set.copyOf allocates needlessly for empty input collections > > Modifies ImmutableCollections.listCopy: > Introduces a check for isEmpty to avoid allocation in the case of an empty input collection. > - 8299444: java.util.Set.copyOf allocates needlessly for empty input collections > > Modifies Map.copyOf: > Introduces a check for isEmpty to avoid allocation in the case of an empty input Map. src/java.base/share/classes/java/util/ImmutableCollections.java line 169: > 167: @SuppressWarnings("unchecked") > 168: static List listCopy(Collection coll) { > 169: if (coll instanceof List12 || (coll instanceof ListN && ! ((ListN)coll).allowNulls)) { Maybe replace the cast with an instanceof pattern here? ------------- PR: https://git.openjdk.org/jdk/pull/11847 From pminborg at openjdk.org Mon Jan 9 18:37:56 2023 From: pminborg at openjdk.org (Per Minborg) Date: Mon, 9 Jan 2023 18:37:56 GMT Subject: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections [v2] In-Reply-To: References: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> Message-ID: On Mon, 9 Jan 2023 08:33:09 GMT, Viktor Klang wrote: >> Currently Set.copyOf allocates both a HashSet and a new empty array when the input collection is empty. >> >> This patch avoids allocating anything for the case where the parameter collection's isEmpty returns true. > > Viktor Klang has updated the pull request incrementally with two additional commits since the last revision: > > - 8299444: java.util.Set.copyOf allocates needlessly for empty input collections > > Modifies ImmutableCollections.listCopy: > Introduces a check for isEmpty to avoid allocation in the case of an empty input collection. > - 8299444: java.util.Set.copyOf allocates needlessly for empty input collections > > Modifies Map.copyOf: > Introduces a check for isEmpty to avoid allocation in the case of an empty input Map. On the note of `CHM::isEmpty`: It would be better to rewrite this method as a short-circuitable reduction of the many CounterCells' values. As soon as at least one of them are >0 then the map is not empty. In contrast, today we sum all of the values, in many cases, unnecessary. ------------- PR: https://git.openjdk.org/jdk/pull/11847 From duke at openjdk.org Mon Jan 9 20:02:59 2023 From: duke at openjdk.org (Matthew Donovan) Date: Mon, 9 Jan 2023 20:02:59 GMT Subject: RFR: 8298939: Refactor open/test/jdk/javax/rmi/ssl/SSLSocketParametersTestsh to jtreg java test Message-ID: Removed SSLSocketParametersTest.sh script (which just called a Java file) and configured the java code to run directly with jtreg ------------- Commit messages: - 8298939: Refactor open/test/jdk/javax/rmi/ssl/SSLSocketParametersTest.sh to jtreg java test Changes: https://git.openjdk.org/jdk/pull/11910/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11910&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8298939 Stats: 240 lines in 2 files changed: 47 ins; 146 del; 47 mod Patch: https://git.openjdk.org/jdk/pull/11910.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11910/head:pull/11910 PR: https://git.openjdk.org/jdk/pull/11910 From cwimmer at openjdk.org Mon Jan 9 20:04:34 2023 From: cwimmer at openjdk.org (Christian Wimmer) Date: Mon, 9 Jan 2023 20:04:34 GMT Subject: RFR: JDK-8262994: Refactor String.split to help method inlining [v2] In-Reply-To: References: Message-ID: > The method `String.split` contains a fast-path when the regular expression parameter is not really a regular expression, but just a single split character. > This fast path vs. slow path check can be constant folded when the regular expression parameter is a literal constant - a quite frequent pattern (for example, all JDK usages of `String.split` have a constant expression parameter). But method inlining in JIT and AOT compilers can usually not inline `String.split` because the method body is too large. Factoring out the actual fast-path splitting logic into a separate method solves this problem: the JIT or AOT compiler can inline `String.split`, constant-fold the fast/slow path check, and then only the invoke of either the fast path or the slow path remains. Christian Wimmer has updated the pull request incrementally with one additional commit since the last revision: Add comment about method inlining ------------- Changes: - all: https://git.openjdk.org/jdk/pull/11791/files - new: https://git.openjdk.org/jdk/pull/11791/files/f06be05b..72667c4e Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=11791&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11791&range=00-01 Stats: 3 lines in 1 file changed: 3 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/11791.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11791/head:pull/11791 PR: https://git.openjdk.org/jdk/pull/11791 From cwimmer at openjdk.org Mon Jan 9 20:04:36 2023 From: cwimmer at openjdk.org (Christian Wimmer) Date: Mon, 9 Jan 2023 20:04:36 GMT Subject: RFR: JDK-8262994: Refactor String.split to help method inlining [v2] In-Reply-To: References: Message-ID: On Tue, 27 Dec 2022 23:36:52 GMT, Ismael Juma wrote: >> Christian Wimmer has updated the pull request incrementally with one additional commit since the last revision: >> >> Add comment about method inlining > > src/java.base/share/classes/java/lang/String.java line 3133: > >> 3131: { >> 3132: // All the checks above can potentially be constant folded by >> 3133: // a JIT/AOT compiler when the regex is a constant string. > > Probably worth mentioning explicitly that the private `split` was extracted to help with inlining (to reduce the probability of future regressions). I extended the comment ------------- PR: https://git.openjdk.org/jdk/pull/11791 From cwimmer at openjdk.org Mon Jan 9 20:06:53 2023 From: cwimmer at openjdk.org (Christian Wimmer) Date: Mon, 9 Jan 2023 20:06:53 GMT Subject: RFR: JDK-8262994: Refactor String.split to help method inlining In-Reply-To: References: Message-ID: On Wed, 28 Dec 2022 20:42:15 GMT, Sergey Tsypanov wrote: > Is there any benchmark proving the benefit? The Graal compiler can do the inlining and constant folding. That is especially important when doing AOT compilation as part of GraalVM Native Image builds, in which case the regular expression engine of the JDK remains unreachable in many cases, leading to smaller binaries. Currently, GraalVM uses a substitution to patch the JDK, but that is not a good long-term solution: https://github.com/oracle/graal/pull/5732/files#diff-422e3fa386126a69506423650c878a251e18cc6e6cfdb39d87923a88a97628a3R209 ------------- PR: https://git.openjdk.org/jdk/pull/11791 From igraves at openjdk.org Mon Jan 9 20:41:56 2023 From: igraves at openjdk.org (Ian Graves) Date: Mon, 9 Jan 2023 20:41:56 GMT Subject: RFR: 8293667: Align jlink's --compress option with jmod's --compress option [v2] In-Reply-To: References: Message-ID: On Thu, 15 Dec 2022 06:43:40 GMT, Jaikiran Pai wrote: >> Ian Graves has updated the pull request incrementally with one additional commit since the last revision: >> >> Swapping deprecations in properties > > src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultCompressPlugin.java line 27: > >> 25: package jdk.tools.jlink.internal.plugins; >> 26: >> 27: import java.text.NumberFormat; > > I suspect this is an unused import? Yes thank you. > src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultCompressPlugin.java line 111: > >> 109: zip = new ZipPlugin(resFilter, zipLevel); >> 110: break; >> 111: } catch (NumberFormatException ignored) {} > > Hello Ian, previously before this change (and even now for non `zip-` values) we throw an `IllegalArgumentException` if the value for compression level is incorrect. Should we do the same for wrong values of `zip-` and throw `IllegalArgumentException` when we catch a `NumberFormatException`? Yes, though in this case when we catch a NumberFormatException, the result falls through to the IllegalArgumentException and prints the offending level ("zip-*") value. ------------- PR: https://git.openjdk.org/jdk/pull/11617 From darcy at openjdk.org Mon Jan 9 20:44:52 2023 From: darcy at openjdk.org (Joe Darcy) Date: Mon, 9 Jan 2023 20:44:52 GMT Subject: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v7] In-Reply-To: References: <8aowsJzamy0T0FooFgDPVVu_9m_OYVQgQdpAKTXFAbI=.87f52413-31fb-4c55-a0bc-70e3678d48e4@github.com> Message-ID: <9fD7mNCizlQdJTy5H_hyICCq-U10VW5X_fNfpidAP7Y=.9aedce75-6a64-4bcd-9890-181331d14a10@github.com> On Mon, 9 Jan 2023 13:17:42 GMT, Raffaello Giulietti wrote: >> I see - thanks for the explanation - the problem is with `floatToIntBits` vs `floatToRawIntBits` in the "put" operation. The get operation is ok, but then having asymmetry where we use a float VH in one case (get) but not in the other (put) is not desirable. > > @mcimadamore According to the spec, `floatToRawIntBits` and `doubleToRawLongBits` ensure that the original input bits are all preserved, even for NaN values. > On the other hand, the spec says that `intBitsToFloat` and `longBitsToDouble` only ensure a best effort in preserving the output bits of NaN values. > So I think `VarHandle` `get` and `put` do their best to preserve the bits, but no more than the underlying platform can possibly offer. > This behavior for floating-point values is not fully specified in `VarHandle`, so there's room for improvement in the doc. At least for the purposes of this PR, I think leaving the calls to the bitwise conversion methods in place is fine. ------------- PR: https://git.openjdk.org/jdk/pull/11840 From igraves at openjdk.org Mon Jan 9 20:48:55 2023 From: igraves at openjdk.org (Ian Graves) Date: Mon, 9 Jan 2023 20:48:55 GMT Subject: RFR: 8293667: Align jlink's --compress option with jmod's --compress option [v2] In-Reply-To: References: Message-ID: On Thu, 15 Dec 2022 06:45:22 GMT, Jaikiran Pai wrote: >> Ian Graves has updated the pull request incrementally with one additional commit since the last revision: >> >> Swapping deprecations in properties > > src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ZipPlugin.java line 49: > >> 47: >> 48: private static final int DEFAULT_COMPRESSION = 6; >> 49: private int compressionLevel; > > Perhaps we could mark this as `final`? Agreed ------------- PR: https://git.openjdk.org/jdk/pull/11617 From duke at openjdk.org Mon Jan 9 21:05:43 2023 From: duke at openjdk.org (Victor Toni) Date: Mon, 9 Jan 2023 21:05:43 GMT Subject: RFR: 8203035: Implement equals() and hashCode() for Throwable Message-ID: Being able to compare instances of Throwable allows simple detection of exceptions raised by the same circumstances. Comparison allows for reduction of excessive logging e.g. in hotspots without requiring custom code to compare Throwables. ------------- Commit messages: - 8203035: Implement equals() and hashCode() for Throwable Changes: https://git.openjdk.org/jdk/pull/11624/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11624&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8203035 Stats: 329 lines in 2 files changed: 329 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/11624.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11624/head:pull/11624 PR: https://git.openjdk.org/jdk/pull/11624 From aturbanov at openjdk.org Mon Jan 9 21:23:37 2023 From: aturbanov at openjdk.org (Andrey Turbanov) Date: Mon, 9 Jan 2023 21:23:37 GMT Subject: RFR: 8299835: (jrtfs) Unnecessary null check in JrtPath.getAttributes Message-ID: `jdk.internal.jrtfs.JrtFileSystem#getFileAttributes` never return `null` https://github.com/openjdk/jdk/blob/679e485838881c1364845072af305fb60d95e60a/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java#L206-L213 So, no need to check for `null` its result. Seems it was copied from ZipPath (name of variable suggests that) - https://github.com/openjdk/jdk/blob/master/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java#L769. But for ZipFileSystem `null` is expected. ------------- Commit messages: - [PATCH] Unnecessary null check in JrtPath.getAttributes Changes: https://git.openjdk.org/jdk/pull/11911/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11911&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299835 Stats: 5 lines in 1 file changed: 0 ins; 4 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/11911.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11911/head:pull/11911 PR: https://git.openjdk.org/jdk/pull/11911 From duke at openjdk.org Mon Jan 9 21:28:02 2023 From: duke at openjdk.org (Justin Lu) Date: Mon, 9 Jan 2023 21:28:02 GMT Subject: Integrated: 8299502: Usage of constructors of primitive wrapper classes should be avoided in javax.xml API docs In-Reply-To: References: Message-ID: On Thu, 5 Jan 2023 21:59:30 GMT, Justin Lu wrote: > Removed constructors of primitive wrapper classes (deprecated for removal) in _javax.xml.stream.XMLOutputFactory_ > > Replaced with Boolean static fields: Boolean.TRUE and Boolean.FALSE This pull request has now been integrated. Changeset: b8852f65 Author: Justin Lu Committer: Naoto Sato URL: https://git.openjdk.org/jdk/commit/b8852f65a0adcb9ee5693bb6727a0668aa9808bf Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod 8299502: Usage of constructors of primitive wrapper classes should be avoided in javax.xml API docs Reviewed-by: joehw, naoto, lancea ------------- PR: https://git.openjdk.org/jdk/pull/11872 From duke at openjdk.org Mon Jan 9 21:29:00 2023 From: duke at openjdk.org (Justin Lu) Date: Mon, 9 Jan 2023 21:29:00 GMT Subject: Integrated: 8299501: Usage of constructors of primitive wrapper classes should be avoided in java.util API docs In-Reply-To: References: Message-ID: On Fri, 6 Jan 2023 18:54:07 GMT, Justin Lu wrote: > Removed constructors of primitive wrapper classes (deprecated for removal) in _java.util.Arrays_ > > Replaced with .valueOf() method This pull request has now been integrated. Changeset: f36f1354 Author: Justin Lu Committer: Naoto Sato URL: https://git.openjdk.org/jdk/commit/f36f1354c63a500c70ae51a9c2b2d21ad55cfa77 Stats: 5 lines in 1 file changed: 0 ins; 0 del; 5 mod 8299501: Usage of constructors of primitive wrapper classes should be avoided in java.util API docs Reviewed-by: naoto, lancea ------------- PR: https://git.openjdk.org/jdk/pull/11885 From duke at openjdk.org Mon Jan 9 21:35:52 2023 From: duke at openjdk.org (Viktor Klang) Date: Mon, 9 Jan 2023 21:35:52 GMT Subject: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections [v2] In-Reply-To: References: <8im4N7c3JAMB-2bHYH5N77o6Ju83dn119s5rUhtTr3k=.1603d4aa-e343-4094-85e7-5309c03fdbf7@github.com> Message-ID: On Mon, 9 Jan 2023 18:34:57 GMT, Per Minborg wrote: >> Viktor Klang has updated the pull request incrementally with two additional commits since the last revision: >> >> - 8299444: java.util.Set.copyOf allocates needlessly for empty input collections >> >> Modifies ImmutableCollections.listCopy: >> Introduces a check for isEmpty to avoid allocation in the case of an empty input collection. >> - 8299444: java.util.Set.copyOf allocates needlessly for empty input collections >> >> Modifies Map.copyOf: >> Introduces a check for isEmpty to avoid allocation in the case of an empty input Map. > > On the note of `CHM::isEmpty`: It would be better to rewrite this method as a short-circuitable reduction of the many CounterCells' values. As soon as at least one of them are >0 then the map is not empty. In contrast, today we sum all of the values, in many cases, unnecessary. @minborg Yes, I noted that when I looked into the current impl of CHM.isEmpty() as well. Seems like either a bespoke isEmpty implementation, or having isEmpty() rely on a more generalized "isLargerThan(0)" would be appropriate. With that said, I'm hesitant to make any modifications to CHM as a part of this PR :) ------------- PR: https://git.openjdk.org/jdk/pull/11847 From mchung at openjdk.org Mon Jan 9 21:41:58 2023 From: mchung at openjdk.org (Mandy Chung) Date: Mon, 9 Jan 2023 21:41:58 GMT Subject: RFR: 8293667: Align jlink's --compress option with jmod's --compress option In-Reply-To: <3qBQbDWN99tyr32fbrT86WixwxSPzA235ISVqt70f5I=.b6202387-ed59-4124-809e-58771ed5bffa@github.com> References: <3qBQbDWN99tyr32fbrT86WixwxSPzA235ISVqt70f5I=.b6202387-ed59-4124-809e-58771ed5bffa@github.com> Message-ID: <7azCDfhh8pLeQtPfhvwoiUrNF0QlnjP7NuVkoKJurYs=.0e7d23a0-554c-49d0-99c1-adc71f9046f7@github.com> On Mon, 12 Dec 2022 14:17:43 GMT, Alan Bateman wrote: > I skimmed through this (not a detailed review) and I think it's mostly okay. It's --compress 0 and 2 that should be listed as deprecated as --compress 1 is string sharing rather than zip compression. I also think it's good to deprecate the old values. I think we can separate the StringSharingPlugin as a separate plugin option and deprecate --compress 1 as well. Something like this: --compress Compression to use in compressing resources: Accepted values are: zip-[0-9], where zip-0 provides no compression, and zip-9 provides the best compression. Default is zip-6. Deprecated values: 0: No compression. Equivalent to zip-0. 1: Equivalent to --compact-constant-pools 2: Equivalent to zip-6. ------------- PR: https://git.openjdk.org/jdk/pull/11617 From duke at openjdk.org Mon Jan 9 21:53:56 2023 From: duke at openjdk.org (Justin Lu) Date: Mon, 9 Jan 2023 21:53:56 GMT Subject: RFR: 8299498: Usage of constructors of primitive wrapper classes should be avoided in java.lang API docs Message-ID: The javadocs of the following methods used deprecated constructors of the primitive wrapper classes: java.lang.ArrayStoreException java.lang.ClassCastException java.lang.Double.compare(double, double) java.lang.Float.compare(float, float) java.lang.Integer.getInteger(String, int) java.lang.Integer.valueOf(String) java.lang.Integer.valueOf(String, int) java.lang.Long.getLong(String, long) java.lang.Long.valueOf(String) java.lang.Long.valueOf(String, int) java.lang.Short.valueOf(String) java.lang.Short.valueOf(String, int) This change replaces the constructors with .valueOf() methods except java.lang.ClassCastException which was already fixed in JDK-8289730 ------------- Commit messages: - Fix Integer - Fix Long - Fix Short - Fix ASE, Double, Float Changes: https://git.openjdk.org/jdk/pull/11912/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11912&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299498 Stats: 19 lines in 6 files changed: 0 ins; 0 del; 19 mod Patch: https://git.openjdk.org/jdk/pull/11912.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11912/head:pull/11912 PR: https://git.openjdk.org/jdk/pull/11912 From duke at openjdk.org Mon Jan 9 22:13:57 2023 From: duke at openjdk.org (Justin Lu) Date: Mon, 9 Jan 2023 22:13:57 GMT Subject: Integrated: 6381945: (cal) Japanese calendar unit test system should avoid multiple static imports In-Reply-To: References: Message-ID: <8ApzF3tkVBLvB79FhBYPCKuD2bwxns6ofVnI9yVCRWE=.34c386ef-0b74-48c4-bf78-1a7d73c63178@github.com> On Wed, 4 Jan 2023 21:49:18 GMT, Justin Lu wrote: > Within _test/jdk/java/util/Calendar/CalendarTestScripts/Symbol.java_ > > GregorianCalendar alone handles all the necessary imports, Calendar is not needed This pull request has now been integrated. Changeset: f79b3d42 Author: Justin Lu Committer: Naoto Sato URL: https://git.openjdk.org/jdk/commit/f79b3d42f07b703f0e3b9fc67c92dee260b0e602 Stats: 2 lines in 1 file changed: 0 ins; 1 del; 1 mod 6381945: (cal) Japanese calendar unit test system should avoid multiple static imports Reviewed-by: lancea, iris, naoto ------------- PR: https://git.openjdk.org/jdk/pull/11855 From jwilhelm at openjdk.org Mon Jan 9 22:30:21 2023 From: jwilhelm at openjdk.org (Jesper Wilhelmsson) Date: Mon, 9 Jan 2023 22:30:21 GMT Subject: RFR: Merge jdk20 Message-ID: <0F0t-iGx4y1JbU5e0XOucZ6bPa7jeDXZ8rdeXu3KmuQ=.6ef59616-bfd8-4574-9f7d-38b51ef522e4@github.com> Forwardport JDK 20 -> JDK 21 ------------- Commit messages: - Merge remote-tracking branch 'jdk20/master' into Merge_jdk20 - 8299689: Make use of JLine for Console as "opt-in" The webrevs contain the adjustments done while merging with regards to each parent branch: - master: https://webrevs.openjdk.org/?repo=jdk&pr=11913&range=00.0 - jdk20: https://webrevs.openjdk.org/?repo=jdk&pr=11913&range=00.1 Changes: https://git.openjdk.org/jdk/pull/11913/files Stats: 48 lines in 4 files changed: 24 ins; 7 del; 17 mod Patch: https://git.openjdk.org/jdk/pull/11913.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11913/head:pull/11913 PR: https://git.openjdk.org/jdk/pull/11913 From alexey.semenyuk at oracle.com Mon Jan 9 22:57:00 2023 From: alexey.semenyuk at oracle.com (Alexey Semenyuk) Date: Mon, 9 Jan 2023 17:57:00 -0500 Subject: jpackageapplauncher linker arguments for osx In-Reply-To: <7ab61fe5-9073-84db-d2d3-e9e4682b366f@oracle.com> References: <7ab61fe5-9073-84db-d2d3-e9e4682b366f@oracle.com> Message-ID: <70f0b82a-ff2c-9e18-e447-0df51becc110@oracle.com> Hi David, The request to adjust osx linker command lines looks reasonable. Please go ahead with a pull request. - Alexey On 1/9/2023 1:21 AM, David Holmes wrote: > On 8/01/2023 8:39 pm, David Schumann wrote: >> Hello, >> >> I'm not 100% sure if this list is the correct one for this topic, >> feel free to redirect me. > > core-libs-dev - cc'd > > Cheers, > David > >> Currently the?jpackageapplauncher binary gets linked without the >> "-headerpad_max_install_names" argument on osx. This prevents a user >> from using the install_name_tool with the launcher binary. >> This means that it's currently not possible to include dylibs in the >> application bundle. >> >> To provide a bit more context: >> I'm using jpackage to build an app bundle. The java application >> itself uses external native libraries, which internally use dlopen to >> reference other libs. Normaly one would include the other libs in the >> app bundle, and use the install_name_tool to tell the dynamic linker >> which paths to load the libraries from. However since the launcher >> binary doesn't get linked with the correct arguments, this isn't >> possible. >> >> I wanted to discuss this change, and it it makes sense for me to open >> a pull request for it. >> The change would be in >> https://github.com/openjdk/jdk/blob/master/make/modules/jdk.jpackage/Lib.gmk#L76 >> >> >> >> Best Regards, >> David Schumann >> From asemenyuk at openjdk.org Mon Jan 9 23:02:04 2023 From: asemenyuk at openjdk.org (Alexey Semenyuk) Date: Mon, 9 Jan 2023 23:02:04 GMT Subject: RFR: 8298735: Some tools/jpackage/windows/* tests fails with jtreg test timeout Message-ID: Increase failed test timeouts. Simple tests got an x1.5 increase and parametrized tests got an x2 increase ------------- Commit messages: - 8298735: Some tools/jpackage/windows/* tests fails with jtreg test timeout Changes: https://git.openjdk.org/jdk/pull/11914/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11914&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8298735 Stats: 10 lines in 10 files changed: 0 ins; 0 del; 10 mod Patch: https://git.openjdk.org/jdk/pull/11914.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11914/head:pull/11914 PR: https://git.openjdk.org/jdk/pull/11914 From redestad at openjdk.org Mon Jan 9 23:17:00 2023 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 9 Jan 2023 23:17:00 GMT Subject: RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v18] In-Reply-To: References: Message-ID: On Mon, 9 Jan 2023 16:49:25 GMT, Claes Redestad wrote: >> Continuing the work initiated by @luhenry to unroll and then intrinsify polynomial hash loops. >> >> I've rewired the library changes to route via a single `@IntrinsicCandidate` method. To make this work I've harmonized how they are invoked so that there's less special handling and checks in the intrinsic. Mainly do the null-check outside of the intrinsic for `Arrays.hashCode` cases. >> >> Having a centralized entry point means it'll be easier to parameterize the factor and start values which are now hard-coded (always 31, and a start value of either one for `Arrays` or zero for `String`). It seems somewhat premature to parameterize this up front. >> >> The current implementation is performance neutral on microbenchmarks on all tested platforms (x64, aarch64) when not enabling the intrinsic. We do add a few trivial method calls which increase the call stack depth, so surprises cannot be ruled out on complex workloads. >> >> With the most recent fixes the x64 intrinsic results on my workstation look like this: >> >> Benchmark (size) Mode Cnt Score Error Units >> StringHashCode.Algorithm.defaultLatin1 1 avgt 5 2.199 ? 0.017 ns/op >> StringHashCode.Algorithm.defaultLatin1 10 avgt 5 6.933 ? 0.049 ns/op >> StringHashCode.Algorithm.defaultLatin1 100 avgt 5 29.935 ? 0.221 ns/op >> StringHashCode.Algorithm.defaultLatin1 10000 avgt 5 1596.982 ? 7.020 ns/op >> >> Baseline: >> >> Benchmark (size) Mode Cnt Score Error Units >> StringHashCode.Algorithm.defaultLatin1 1 avgt 5 2.200 ? 0.013 ns/op >> StringHashCode.Algorithm.defaultLatin1 10 avgt 5 9.424 ? 0.122 ns/op >> StringHashCode.Algorithm.defaultLatin1 100 avgt 5 90.541 ? 0.512 ns/op >> StringHashCode.Algorithm.defaultLatin1 10000 avgt 5 9425.321 ? 67.630 ns/op >> >> I.e. no measurable overhead compared to baseline even for `size == 1`. >> >> The vectorized code now nominally works for all unsigned cases as well as ints, though more testing would be good. >> >> Benchmark for `Arrays.hashCode`: >> >> Benchmark (size) Mode Cnt Score Error Units >> ArraysHashCode.bytes 1 avgt 5 1.884 ? 0.013 ns/op >> ArraysHashCode.bytes 10 avgt 5 6.955 ? 0.040 ns/op >> ArraysHashCode.bytes 100 avgt 5 87.218 ? 0.595 ns/op >> ArraysHashCode.bytes 10000 avgt 5 9419.591 ? 38.308 ns/op >> ArraysHashCode.chars 1 avgt 5 2.200 ? 0.010 ns/op >> ArraysHashCode.chars 10 avgt 5 6.935 ? 0.034 ns/op >> ArraysHashCode.chars 100 avgt 5 30.216 ? 0.134 ns/op >> ArraysHashCode.chars 10000 avgt 5 1601.629 ? 6.418 ns/op >> ArraysHashCode.ints 1 avgt 5 2.200 ? 0.007 ns/op >> ArraysHashCode.ints 10 avgt 5 6.936 ? 0.034 ns/op >> ArraysHashCode.ints 100 avgt 5 29.412 ? 0.268 ns/op >> ArraysHashCode.ints 10000 avgt 5 1610.578 ? 7.785 ns/op >> ArraysHashCode.shorts 1 avgt 5 1.885 ? 0.012 ns/op >> ArraysHashCode.shorts 10 avgt 5 6.961 ? 0.034 ns/op >> ArraysHashCode.shorts 100 avgt 5 87.095 ? 0.417 ns/op >> ArraysHashCode.shorts 10000 avgt 5 9420.617 ? 50.089 ns/op >> >> Baseline: >> >> Benchmark (size) Mode Cnt Score Error Units >> ArraysHashCode.bytes 1 avgt 5 3.213 ? 0.207 ns/op >> ArraysHashCode.bytes 10 avgt 5 8.483 ? 0.040 ns/op >> ArraysHashCode.bytes 100 avgt 5 90.315 ? 0.655 ns/op >> ArraysHashCode.bytes 10000 avgt 5 9422.094 ? 62.402 ns/op >> ArraysHashCode.chars 1 avgt 5 3.040 ? 0.066 ns/op >> ArraysHashCode.chars 10 avgt 5 8.497 ? 0.074 ns/op >> ArraysHashCode.chars 100 avgt 5 90.074 ? 0.387 ns/op >> ArraysHashCode.chars 10000 avgt 5 9420.474 ? 41.619 ns/op >> ArraysHashCode.ints 1 avgt 5 2.827 ? 0.019 ns/op >> ArraysHashCode.ints 10 avgt 5 7.727 ? 0.043 ns/op >> ArraysHashCode.ints 100 avgt 5 89.405 ? 0.593 ns/op >> ArraysHashCode.ints 10000 avgt 5 9426.539 ? 51.308 ns/op >> ArraysHashCode.shorts 1 avgt 5 3.071 ? 0.062 ns/op >> ArraysHashCode.shorts 10 avgt 5 8.168 ? 0.049 ns/op >> ArraysHashCode.shorts 100 avgt 5 90.399 ? 0.292 ns/op >> ArraysHashCode.shorts 10000 avgt 5 9420.171 ? 44.474 ns/op >> >> >> As we can see the `Arrays` intrinsics are faster for small inputs, and faster on large inputs for `char` and `int` (the ones currently vectorized). I aim to fix `byte` and `short` cases before integrating, though it might be acceptable to hand that off as follow-up enhancements to not further delay integration of this enhancement. > > Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: > > Explicitly lea external address Explicitly loading the address to a register seems to do the trick, avoiding the pitfalls of `as_Address(AddressLiteral)` - which apparently only works (portably) when we know for certain the address is in some allowed range. There's no measurable difference on microbenchmarks (there might be a couple of extra lea instructions on the vectorized paths, but that disappears in the noise). Thanks @fisk for the suggestion! ------------- PR: https://git.openjdk.org/jdk/pull/10847 From sspitsyn at openjdk.org Mon Jan 9 23:17:55 2023 From: sspitsyn at openjdk.org (Serguei Spitsyn) Date: Mon, 9 Jan 2023 23:17:55 GMT Subject: RFR: 8297286: runtime/vthread tests crashing after JDK-8296324 [v2] In-Reply-To: References: Message-ID: <55O_xJx412kcO8MhN5FF7iKHxHsh-aDVyNicIi7oeHM=.9d261cd0-7d22-4931-8c7f-e1fee9d4a4a4@github.com> On Wed, 23 Nov 2022 10:14:23 GMT, Serguei Spitsyn wrote: >> This problem has two sides. >> One is that the `VirtualThread::run() `cashes the field `notifyJvmtiEvents` value. >> It caused the native method `notifyJvmtiUnmountBegin()` not called after the field `notifyJvmtiEvents` >> value has been set to `true` when an agent library is loaded into running VM. >> The fix is to get rid of this cashing. >> Another is that enabling `notifyJvmtiEvents` notifications needs a synchronization. >> Otherwise, a VTMS transition start can be missed which will cause some asserts to fire. >> The fix is to use a JvmtiVTMSTransitionDisabler helper for sync. >> >> Testing: >> The originally failed tests are passed now: >> >> runtime/vthread/RedefineClass.java >> runtime/vthread/TestObjectAllocationSampleEvent.java >> >> In progress: >> Run the tiers 1-6 to make sure there are no regression. > > Serguei Spitsyn has updated the pull request incrementally with one additional commit since the last revision: > > remove caching if notifyJvmtiEvents in yieldContinuation One more artificial comment to keep the PR alive. ------------- PR: https://git.openjdk.org/jdk/pull/11304 From jwilhelm at openjdk.org Mon Jan 9 23:34:58 2023 From: jwilhelm at openjdk.org (Jesper Wilhelmsson) Date: Mon, 9 Jan 2023 23:34:58 GMT Subject: Integrated: Merge jdk20 In-Reply-To: <0F0t-iGx4y1JbU5e0XOucZ6bPa7jeDXZ8rdeXu3KmuQ=.6ef59616-bfd8-4574-9f7d-38b51ef522e4@github.com> References: <0F0t-iGx4y1JbU5e0XOucZ6bPa7jeDXZ8rdeXu3KmuQ=.6ef59616-bfd8-4574-9f7d-38b51ef522e4@github.com> Message-ID: <1qsnUFtQVBBDL3EybpslbMMTquL-6rOWpql11B66Fl0=.b86784a6-3a4c-4727-b0a3-6511202652b7@github.com> On Mon, 9 Jan 2023 22:22:11 GMT, Jesper Wilhelmsson wrote: > Forwardport JDK 20 -> JDK 21 This pull request has now been integrated. Changeset: 4395578b Author: Jesper Wilhelmsson URL: https://git.openjdk.org/jdk/commit/4395578b6f0432d158c4b6c0c0a9d0838f74baa8 Stats: 48 lines in 4 files changed: 24 ins; 7 del; 17 mod Merge ------------- PR: https://git.openjdk.org/jdk/pull/11913 From naoto at openjdk.org Mon Jan 9 23:51:51 2023 From: naoto at openjdk.org (Naoto Sato) Date: Mon, 9 Jan 2023 23:51:51 GMT Subject: RFR: 8299498: Usage of constructors of primitive wrapper classes should be avoided in java.lang API docs In-Reply-To: References: Message-ID: On Mon, 9 Jan 2023 21:46:49 GMT, Justin Lu wrote: > The javadocs of the following methods used deprecated constructors of the primitive wrapper classes: > > java.lang.ArrayStoreException > java.lang.ClassCastException > java.lang.Double.compare(double, double) > java.lang.Float.compare(float, float) > java.lang.Integer.getInteger(String, int) > java.lang.Integer.valueOf(String) > java.lang.Integer.valueOf(String, int) > java.lang.Long.getLong(String, long) > java.lang.Long.valueOf(String) > java.lang.Long.valueOf(String, int) > java.lang.Short.valueOf(String) > java.lang.Short.valueOf(String, int) > > This change replaces the constructors with .valueOf() methods except java.lang.ClassCastException which was already fixed in JDK-8289730 Marked as reviewed by naoto (Reviewer). ------------- PR: https://git.openjdk.org/jdk/pull/11912 From duke at openjdk.org Tue Jan 10 00:07:02 2023 From: duke at openjdk.org (Justin Lu) Date: Tue, 10 Jan 2023 00:07:02 GMT Subject: RFR: 8299836: Make `user.timezone` system property searchable Message-ID: <3_RcmdN7PYIEWAdsBYPkvKF_cAHT6yaTSXjrhadUoyA=.adda2062-b37f-4731-bae7-02f1d40f3e24@github.com> The system property _user.timezone_ is specified in the _TimeZone.getDefault()_ and _TimeZone.setDefault()_ methods. The javadoc search box should be able to match on the system property name. This change replaces the **@code** tag with the **@systemProperty** tag for instances of _user.timezone_ when appropriate. ------------- Commit messages: - Fix setDefault() - second user.timezone fix - Switch tag Changes: https://git.openjdk.org/jdk/pull/11915/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11915&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299836 Stats: 4 lines in 1 file changed: 0 ins; 0 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/11915.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11915/head:pull/11915 PR: https://git.openjdk.org/jdk/pull/11915 From serb at openjdk.org Tue Jan 10 00:28:55 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Tue, 10 Jan 2023 00:28:55 GMT Subject: RFR: 8299513: Cleanup java.io [v4] In-Reply-To: References: Message-ID: On Mon, 9 Jan 2023 08:57:11 GMT, Per Minborg wrote: >> Code in java.io contains many legacy constructs and semantics not recommended including: >> >> * C-style array declaration >> * Unnecessary visibility >> * Redundant keywords in interfaces (e.g. public, static) >> * Non-standard naming for constants >> * Javadoc typos >> * Missing final declaration >> >> These should be fixed as a sanity effort. > > Per Minborg has updated the pull request incrementally with one additional commit since the last revision: > > Add additional (c) years src/java.base/share/classes/java/io/DataInputStream.java line 582: > 580: * @see java.io.DataInputStream#readUnsignedShort() > 581: */ > 582: public static String readUTF(DataInput in) throws IOException { I remember a few years ago asked to create a CCC to remove the final keyword in the final class. This change seems broader, probably the rules are changed since then, but this one actually may affect the method signature. And subclasses will allow hiding this method. ------------- PR: https://git.openjdk.org/jdk/pull/11848 From sviswanathan at openjdk.org Tue Jan 10 00:28:58 2023 From: sviswanathan at openjdk.org (Sandhya Viswanathan) Date: Tue, 10 Jan 2023 00:28:58 GMT Subject: RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v18] In-Reply-To: References: Message-ID: On Mon, 9 Jan 2023 23:13:29 GMT, Claes Redestad wrote: >> Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: >> >> Explicitly lea external address > > Explicitly loading the address to a register seems to do the trick, avoiding the pitfalls of `as_Address(AddressLiteral)` - which apparently only works (portably) when we know for certain the address is in some allowed range. There's no measurable difference on microbenchmarks (there might be a couple of extra lea instructions on the vectorized paths, but that disappears in the noise). Thanks @fisk for the suggestion! Thanks @cl4es for fixing this issue. Changes look good to me. ------------- PR: https://git.openjdk.org/jdk/pull/10847 From naoto at openjdk.org Tue Jan 10 00:34:52 2023 From: naoto at openjdk.org (Naoto Sato) Date: Tue, 10 Jan 2023 00:34:52 GMT Subject: RFR: 8299836: Make `user.timezone` system property searchable In-Reply-To: <3_RcmdN7PYIEWAdsBYPkvKF_cAHT6yaTSXjrhadUoyA=.adda2062-b37f-4731-bae7-02f1d40f3e24@github.com> References: <3_RcmdN7PYIEWAdsBYPkvKF_cAHT6yaTSXjrhadUoyA=.adda2062-b37f-4731-bae7-02f1d40f3e24@github.com> Message-ID: On Mon, 9 Jan 2023 23:59:19 GMT, Justin Lu wrote: > The system property _user.timezone_ is specified in the _TimeZone.getDefault()_ and _TimeZone.setDefault()_ methods. The javadoc search box should be able to match on the system property name. > > This change replaces the **@code** tag with the **@systemProperty** tag for instances of _user.timezone_ when appropriate. src/java.base/share/classes/java/util/TimeZone.java line 634: > 632: * > 633: *