Re: RFR: 8355652: Parse ClassFileFormatVersion from ClassFileVersion [v2]

2025-07-21 Thread simon
On Mon, 21 Jul 2025 21:24:52 GMT, Chen Liang wrote: >> I mean about the rule the version - similar to isSupportedClassFileVersion >> method > > I still don't think so. I intentionally proposed the original RFE so we have > one place where we can consolidate this handling, and that place should

Re: RFR: 8355652: Parse ClassFileFormatVersion from ClassFileVersion [v2]

2025-07-21 Thread Chen Liang
On Mon, 21 Jul 2025 20:48:12 GMT, simon wrote: >>> Maybe it can be reused in another points? >> >> ClassFileFormatVersion and Optional are more user-oriented classes; internal >> code don't really ever use these two types, so I don't think you need to >> extract this logic specifically. > > I

Re: RFR: 8360163: Replace hard-coded checks with AOTRuntimeSetup and AOTSafeClassInitializer [v11]

2025-07-21 Thread Jiangli Zhou
On Mon, 21 Jul 2025 21:08:13 GMT, Chen Liang wrote: > > heapShared.cpp contains a list of hard coded classes & fields for archiving > > the initialized states in CDS archive. With the support for using > > annotation for pre-init being added to the mainline, the support can be > > applied to t

Re: RFR: 8358880: Performance of parsing with DecimalFormat can be improved [v6]

2025-07-21 Thread Justin Lu
On Mon, 16 Jun 2025 21:19:45 GMT, Johannes Graham wrote: >> This PR replaces construction of intermediate strings to be parsed with more >> direct manipulation of numbers. It also has a more streamlined mechanism of >> handling `Long.MIN_VALUE` when parsing longs by using >> `Long.parseUnsigne

Re: RFR: 8360555: Archive all unnamed modules in CDS full module graph

2025-07-21 Thread Vladimir Ivanov
On Wed, 2 Jul 2025 00:18:28 GMT, Ioi Lam wrote: > The CDS full module graph is supposed to contain a snapshot of the boot > layer, which has 3 unnamed modules for the boot, platform and system class > loaders. Each unnamed module is represented by a `java.lang.Module` Java > object and a `Modu

Re: RFR: 8360163: Replace hard-coded checks with AOTRuntimeSetup and AOTSafeClassInitializer [v11]

2025-07-21 Thread Chen Liang
On Mon, 21 Jul 2025 07:16:30 GMT, Jiangli Zhou wrote: > heapShared.cpp contains a list of hard coded classes & fields for archiving > the initialized states in CDS archive. With the support for using annotation > for pre-init being added to the mainline, the support can be applied to those > c

Re: String.charAt vs StringBuilder.charAt performance

2025-07-21 Thread Brett Okken
Updating to have different test methods for each representation did remove the difference for the non-ascii String case for the jdk 21+ releases. However, the ascii (latin) strings are still slower with String than StringBuilder. How does C2 then handle something like StringCharBuffer wrapping a C

Re: RFR: 8355652: Parse ClassFileFormatVersion from ClassFileVersion [v2]

2025-07-21 Thread simon
On Mon, 21 Jul 2025 09:00:03 GMT, Mikhail Yankelevich wrote: >> simon has updated the pull request incrementally with two additional commits >> since the last revision: >> >> - 8355652: update copyright year to 2025 in ClassFileVersionImpl.java >> - 8355652: update copyright year to 2025 in

Re: RFR: 8355652: Parse ClassFileFormatVersion from ClassFileVersion [v2]

2025-07-21 Thread simon
> 8355652: add new method to return ClassFileFormatVersion from > ClassFileVersion. > - > ### Progress > - [ ] Change must be properly reviewed (1 review required, with at least 1 > [Reviewer](https://openjdk.org/bylaws#reviewer)) > - [x] Change must not contain extraneous whitespace > -

Re: RFR: 8355652: Parse ClassFileFormatVersion from ClassFileVersion [v2]

2025-07-21 Thread simon
On Mon, 21 Jul 2025 20:44:58 GMT, Chen Liang wrote: >> Got it. Could you have this hook in a private class method or a static >> public method? >> Maybe it can be reused in another points? > >> Maybe it can be reused in another points? > > ClassFileFormatVersion and Optional are more user-orie

Re: RFR: 8355652: Parse ClassFileFormatVersion from ClassFileVersion

2025-07-21 Thread Chen Liang
On Mon, 21 Jul 2025 16:05:59 GMT, simon wrote: > Maybe it can be reused in another points? ClassFileFormatVersion and Optional are more user-oriented classes; internal code don't really ever use these two types, so I don't think you need to extract this logic specifically. - PR R

Re: RFR: 8360555: Archive all unnamed modules in CDS full module graph

2025-07-21 Thread Ioi Lam
On Mon, 21 Jul 2025 17:51:34 GMT, Coleen Phillimore wrote: >> The callstack is: >> >> >> jdk.internal.loader.BootLoader.setBootLoaderUnnamedModule0(java.base@26-internal/Native >> Method) >> jdk.internal.loader.BootLoader.(java.base@26-internal/BootLoader.java:71) >> jdk.internal.module.Module

Re: String.charAt vs StringBuilder.charAt performance

2025-07-21 Thread Roger Riggs
Hi Brett, I'd suggest separate initialization and test methods for the two cases to get more reliable numbers. By using @Trial and using a common field for the test data, I think you have handicapped C2. The training runs JMH does to warm up C2 are 'seeing' two different types for the value

Re: RFR: 8077587: BigInteger Roots [v31]

2025-07-21 Thread fabioromano1
> This PR implements nth root computation for BigIntegers using Newton method. fabioromano1 has updated the pull request incrementally with one additional commit since the last revision: Added tests for nth root - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files -

Re: RFR: 8360555: Archive all unnamed modules in CDS full module graph

2025-07-21 Thread Coleen Phillimore
On Thu, 17 Jul 2025 22:41:34 GMT, Ioi Lam wrote: >> If you're storing the unnamed module oop in the archive should this method >> not be called? If it is, what are you saving by archiving the unnamed >> module? > > The callstack is: > > > jdk.internal.loader.BootLoader.setBootLoaderUnnamedMo

Re: RFR: 8360555: Archive all unnamed modules in CDS full module graph

2025-07-21 Thread Coleen Phillimore
On Wed, 2 Jul 2025 00:18:28 GMT, Ioi Lam wrote: > The CDS full module graph is supposed to contain a snapshot of the boot > layer, which has 3 unnamed modules for the boot, platform and system class > loaders. Each unnamed module is represented by a `java.lang.Module` Java > object and a `Modu

Re: String.charAt vs StringBuilder.charAt performance

2025-07-21 Thread Brett Okken
> output labeled as StringBuffer but the jmh creates StringBuilder. Ugh - sorry about that. But yes - this is about StringBuilder vs String. > I would not be surprised that C2 has more optimizations for String than for StringBuilder. If that were true, it would not surprise me. However, these t

Re: String.charAt vs StringBuilder.charAt performance

2025-07-21 Thread Roger Riggs
Hi Brett, The labeling of the output is confusing, the test output labeled as StringBuffer but the jmh creates StringBuilder. (StringBuffer methods are all synchronized and could explain why they are slower). Also, I would not be surprised that C2 has more optimizations for String than for S

Integrated: 8361497: Scoped Values: orElse and orElseThrow do not access the cache

2025-07-21 Thread Andrew Haley
On Mon, 7 Jul 2025 16:13:08 GMT, Andrew Haley wrote: > Neither `ScopedValue.orElse` nor `ScopedValue.orElseThrow` consult the cache > when searching for a binding. Neither do they update the cache when a binding > is found. > While this issue does not affect spec compliance, it is surprising to

Re: RFR: 8355652: Parse ClassFileFormatVersion from ClassFileVersion

2025-07-21 Thread simon
On Mon, 21 Jul 2025 02:50:48 GMT, Chen Liang wrote: >> Do you mean something like this? >> >> >> @Override >> public Optional formatVersion() { >> if (majorVersion < 54 || minorVersion != 0) { >> return Optional.empty(); >> } >> try { >> retu

Re: FFM - Optimizing string reads in MemorySegment

2025-07-21 Thread Liam Miller-Cushon
Thank you! I will follow along in the bug. On Mon, Jul 21, 2025 at 8:02 AM Per-Ake Minborg wrote: > Hi Liam! > > Thank you for your comments on MemorySegment::getString ! > > The intention was that the creation of the intermediate array should be > elided, but as you point out, that is (at least

Re: RFR: 8361842: Move input validation checks to Java for java.lang.StringCoding intrinsics [v11]

2025-07-21 Thread Mikhail Yankelevich
On Mon, 21 Jul 2025 13:28:00 GMT, Volkan Yazici wrote: >> Validate input in `java.lang.StringCoding` intrinsic Java wrappers, improve >> their documentation, enhance the checks in the associated IR or assembly >> code, and adapt them to cause VM crash on invalid input. >> >> ## Implementation

Re: RFR: 8362889: [GCC static analyzer] leak in libstringPlatformChars.c [v2]

2025-07-21 Thread Matthias Baesken
On Mon, 21 Jul 2025 15:27:13 GMT, Roger Riggs wrote: >> Matthias Baesken has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Another early return needs a free too > > test/jdk/java/lang/String/nativeEncoding/libstringPlatformChars.c line 74:

Re: RFR: 8362889: [GCC static analyzer] leak in libstringPlatformChars.c [v2]

2025-07-21 Thread Matthias Baesken
> This is reported by the gcc static analyzer (-fanalyzer); it is just test > coding so not very critical but probably should still be adjusted . > > > /jdk/test/jdk/java/lang/String/nativeEncoding/libstringPlatformChars.c:74:12: > warning: leak of 'str' [CWE-401] [-Wanalyzer-malloc-leak] >

Re: RFR: 8362889: [GCC static analyzer] leak in libstringPlatformChars.c

2025-07-21 Thread Roger Riggs
On Mon, 21 Jul 2025 14:12:55 GMT, Matthias Baesken wrote: > This is reported by the gcc static analyzer (-fanalyzer); it is just test > coding so not very critical but probably should still be adjusted . > > > /jdk/test/jdk/java/lang/String/nativeEncoding/libstringPlatformChars.c:74:12: > war

Re: FFM - Optimizing string reads in MemorySegment

2025-07-21 Thread Per-Ake Minborg
Hi Liam! Thank you for your comments on MemorySegment::getString ! The intention was that the creation of the intermediate array should be elided, but as you point out, that is (at least sometimes) not the case. I've made an experimental patch where I've used JavaLangAccess::uncheckedNewStringN

RFR: 8362889: [GCC static analyzer] leak in libstringPlatformChars.c

2025-07-21 Thread Matthias Baesken
This is reported by the gcc static analyzer (-fanalyzer); it is just test coding so not very critical but probably should still be adjusted . /jdk/test/jdk/java/lang/String/nativeEncoding/libstringPlatformChars.c:74:12: warning: leak of 'str' [CWE-401] [-Wanalyzer-malloc-leak] 74 | return JN

Re: RFR: 8361842: Move input validation checks to Java for java.lang.StringCoding intrinsics [v8]

2025-07-21 Thread Volkan Yazici
On Thu, 17 Jul 2025 15:33:37 GMT, Raffaello Giulietti wrote: >> What is the thinking when an `@IntrinsicCandidate` method invokes another >> `@IntrinsicCandidate` method? >> Which part is responsible for the checks? >> >> For example, the Java code of `StringCoding.encodeISOArray0()` invokes

Re: RFR: 8361842: Move input validation checks to Java for java.lang.StringCoding intrinsics [v11]

2025-07-21 Thread Volkan Yazici
> Validate input in `java.lang.StringCoding` intrinsic Java wrappers, improve > their documentation, enhance the checks in the associated IR or assembly > code, and adapt them to cause VM crash on invalid input. > > ## Implementation notes > > The goal of the associated umbrella issue > [JDK-8

Re: RFR: 8360037: Refactor ImageReader in preparation for Valhalla support [v13]

2025-07-21 Thread Alan Bateman
On Mon, 21 Jul 2025 12:03:11 GMT, David Beaumont wrote: >> Refactoring `ImageReader` to make it easy to add preview mode functionality >> for Valhalla. >> >> This PR is a large change to `ImageReader` (effectively a rewrite) but >> reduces the surface area of the API significantly, reduces cod

Re: RFR: 8361842: Move input validation checks to Java for java.lang.StringCoding intrinsics [v9]

2025-07-21 Thread Volkan Yazici
On Mon, 21 Jul 2025 12:33:30 GMT, Volkan Yazici wrote: >> Validate input in `java.lang.StringCoding` intrinsic Java wrappers, improve >> their documentation, enhance the checks in the associated IR or assembly >> code, and adapt them to cause VM crash on invalid input. >> >> ## Implementation

Re: RFR: 8361842: Move input validation checks to Java for java.lang.StringCoding intrinsics [v10]

2025-07-21 Thread Volkan Yazici
> Validate input in `java.lang.StringCoding` intrinsic Java wrappers, improve > their documentation, enhance the checks in the associated IR or assembly > code, and adapt them to cause VM crash on invalid input. > > ## Implementation notes > > The goal of the associated umbrella issue > [JDK-8

Re: RFR: 8361842: Move input validation checks to Java for java.lang.StringCoding intrinsics [v9]

2025-07-21 Thread Volkan Yazici
On Mon, 21 Jul 2025 12:33:30 GMT, Volkan Yazici wrote: >> Validate input in `java.lang.StringCoding` intrinsic Java wrappers, improve >> their documentation, enhance the checks in the associated IR or assembly >> code, and adapt them to cause VM crash on invalid input. >> >> ## Implementation

Re: RFR: 8361842: Move input validation checks to Java for java.lang.StringCoding intrinsics [v8]

2025-07-21 Thread Volkan Yazici
On Thu, 17 Jul 2025 15:02:21 GMT, Yudi Zheng wrote: >> Volkan Yazici has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Replace casting with `as_Region()` in `generate_string_range_check` > > test/hotspot/jtreg/compiler/intrinsics/TestVerif

Re: RFR: 8361842: Move input validation checks to Java for java.lang.StringCoding intrinsics [v8]

2025-07-21 Thread Volkan Yazici
On Thu, 17 Jul 2025 13:58:32 GMT, Raffaello Giulietti wrote: >> Volkan Yazici has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Replace casting with `as_Region()` in `generate_string_range_check` > > src/java.base/share/classes/java/lang/

Re: RFR: 8361842: Move input validation checks to Java for java.lang.StringCoding intrinsics [v3]

2025-07-21 Thread Volkan Yazici
On Wed, 16 Jul 2025 05:28:55 GMT, Tobias Hartmann wrote: >> Volkan Yazici has updated the pull request with a new target base due to a >> merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains 12 additional >> commi

Re: RFR: 8361842: Move input validation checks to Java for java.lang.StringCoding intrinsics [v9]

2025-07-21 Thread Volkan Yazici
> Validate input in `java.lang.StringCoding` intrinsic Java wrappers, improve > their documentation, enhance the checks in the associated IR or assembly > code, and adapt them to cause VM crash on invalid input. > > ## Implementation notes > > The goal of the associated umbrella issue > [JDK-8

Re: RFR: 8077587: BigInteger Roots [v30]

2025-07-21 Thread fabioromano1
> This PR implements nth root computation for BigIntegers using Newton method. fabioromano1 has updated the pull request incrementally with one additional commit since the last revision: Revert "Make sure to round up" This reverts commit e305c9f68914553421f2fdd8b4389eaf03946fea.

Re: RFR: 8077587: BigInteger Roots [v29]

2025-07-21 Thread fabioromano1
> This PR implements nth root computation for BigIntegers using Newton method. fabioromano1 has updated the pull request incrementally with one additional commit since the last revision: Make sure to round up - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - ne

Re: RFR: 8360037: Refactor ImageReader in preparation for Valhalla support [v12]

2025-07-21 Thread David Beaumont
On Fri, 18 Jul 2025 16:01:32 GMT, Roger Riggs wrote: >> David Beaumont has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains one commit: >> >> Resync after benchmark. > > src/java.base/share/classes/jdk/internal/jimage/ImageReader.jav

Re: RFR: 8360037: Refactor ImageReader in preparation for Valhalla support [v13]

2025-07-21 Thread David Beaumont
> Refactoring `ImageReader` to make it easy to add preview mode functionality > for Valhalla. > > This PR is a large change to `ImageReader` (effectively a rewrite) but > reduces the surface area of the API significantly, reduces code complexity > and increases performance/memory efficiency. Th

Re: RFR: 8077587: BigInteger Roots [v28]

2025-07-21 Thread fabioromano1
> This PR implements nth root computation for BigIntegers using Newton method. fabioromano1 has updated the pull request incrementally with one additional commit since the last revision: Discard wrong bits from the initial estimate - Changes: - all: https://git.openjdk.org/jdk/

Re: RFR: 8360037: Refactor ImageReader in preparation for Valhalla support [v12]

2025-07-21 Thread David Beaumont
On Fri, 18 Jul 2025 16:43:30 GMT, Roger Riggs wrote: >> David Beaumont has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains one commit: >> >> Resync after benchmark. > > src/java.base/share/classes/jdk/internal/jimage/ImageReader.jav

Integrated: 8357913: Add `@Stable` to BigInteger and BigDecimal

2025-07-21 Thread Shaojin Wen
On Sun, 25 May 2025 22:35:56 GMT, Shaojin Wen wrote: > Some static final arrays of BigInteger and BigDecimal are stable and > immutable. We should add `@Stable` to give the optimizer more information This pull request has now been integrated. Changeset: 8f1bb59e Author:Shaojin Wen URL:

Re: RFR: 8357913: Add `@Stable` to BigInteger and BigDecimal [v4]

2025-07-21 Thread Per Minborg
On Mon, 21 Jul 2025 06:54:46 GMT, Shaojin Wen wrote: > I will integrate it in 24 hours, @minberg do you have any other questions? No further comments from me. Please go ahead and integrate. - PR Comment: https://git.openjdk.org/jdk/pull/25437#issuecomment-3095820477

Re: RFR: 8355652: Parse ClassFileFormatVersion from ClassFileVersion

2025-07-21 Thread Mikhail Yankelevich
On Sun, 20 Jul 2025 22:19:07 GMT, simon wrote: > 8355652: add new method to return ClassFileFormatVersion from > ClassFileVersion. > - > ### Progress > - [ ] Change must be properly reviewed (1 review required, with at least 1 > [Reviewer](https://openjdk.org/bylaws#reviewer)) > - [x] C

Re: RFR: 8360163: Replace hard-coded checks with AOTRuntimeSetup and AOTSafeClassInitializer [v11]

2025-07-21 Thread Jiangli Zhou
On Wed, 9 Jul 2025 13:25:22 GMT, Chen Liang wrote: >> I have updated this patch to avoid a redundant `runtimeSetup` annotation - >> we have agreed that the requirement for setup is a side effect of >> initialization, and such methods in AOTCI classes must be automatically >> recognized. This l