Re: RFR: 8315444: Convert test/jdk/tools to Classfile API [v2]

2023-09-05 Thread Chen Liang
On Tue, 5 Sep 2023 16:05:14 GMT, Qing Xiao wrote: >> `/test/jdk/tools/lib/tests/JImageValidator.java`, tests in >> `/test/jdk/tools/jlink`, and `/test/jdk/tools/jimage`, >> `/test/jdk/java/time/nontestng/java/time/chrono/HijrahConfigTest.java` use >> on com.sun.tools.classfile and should be

Re: RFR: 8311207: Cleanup for Optimization for UUID.toString [v9]

2023-09-04 Thread Chen Liang
On Tue, 5 Sep 2023 02:46:21 GMT, 温绍锦 wrote: >> [PR 14578 ](https://github.com/openjdk/jdk/pull/14578) still has unresolved >> discussions, continue to make improvements. >> >> # Benchmark Result >> >> >> sh make/devkit/createJMHBundle.sh >> bash configure --with-jmh=build/jmh/jars >> make

Re: RFR: 8315585: Optimization for decimal to string

2023-09-05 Thread Chen Liang
On Mon, 4 Sep 2023 04:58:08 GMT, 温绍锦 wrote: > BigDecimal is a commonly used class in business development, It is often > necessary to perform toString or toPlainString operations on BigDecimal. > > The current version uses StringBuilder resulting in multiple memory > allocations, I made a

Re: RFR: 8315810: Reimplement sun.reflect.ReflectionFactory::newConstructorForSerialization with method handles

2023-09-06 Thread Chen Liang
On Wed, 6 Sep 2023 18:34:29 GMT, Mandy Chung wrote: > This reimplements > `sun.reflect.ReflectionFactory::newConstructorForSerialization` with method > handles. > > This API currently generates the bytecode which fails the verification > because `new C; invokespecial A()` where the given

Re: RFR: 8311207: Cleanup for Optimization for UUID.toString [v14]

2023-09-11 Thread Chen Liang
On Mon, 11 Sep 2023 13:32:07 GMT, Martin Doerr wrote: >> 温绍锦 has updated the pull request incrementally with one additional commit >> since the last revision: >> >> lo | hi => hi | lo > > I have run a couple of tests on linux Big Endian. They have passed. So, it's > probably correct.

Re: RFR: 8315999: Improve Date toString performance

2023-09-11 Thread Chen Liang
On Mon, 11 Sep 2023 12:12:17 GMT, 温绍锦 wrote: > improve date toString performance, includes: > > java.util.Date.toString > java.util.Date.toGMTString > java.time.Instant.toString > java.time.LocalDate.toString > java.time.LocalDateTime.toString > java.time.LocalTime.toString I think you should

Re: RFR: 8315968: Consolidate java.util.Digits and StringLatin1::PACKED_DIGITS [v7]

2023-09-11 Thread Chen Liang
On Mon, 11 Sep 2023 12:23:36 GMT, 温绍锦 wrote: >> Some codes in core libs are duplicated, including: >> java.util.DecimalDigits::DIGITS -> java.lang.StringLatin1.PACKED_DIGITS >> java.util.DecimalDigits::size -> java.lang.Long.stringSize >> >> We can reduce duplication through JavaLangAccess,

Re: RFR: 8315999: Improve Date toString performance

2023-09-11 Thread Chen Liang
On Mon, 11 Sep 2023 13:45:43 GMT, 温绍锦 wrote: > After PR #15651 is merged, changes will be made based on the new API. Until > then, you can help review other changes. I mean, OpenJDK's GitHub bots has a special handling system that allows you to include code from #15651 in this PR: 1. Merge

Re: RFR: 8315968: Consolidate java.util.Digits and StringLatin1::PACKED_DIGITS [v17]

2023-09-11 Thread Chen Liang
On Tue, 12 Sep 2023 00:06:41 GMT, 温绍锦 wrote: >> Some codes in core libs are duplicated, including: >> java.util.DecimalDigits::DIGITS -> java.lang.StringLatin1.PACKED_DIGITS >> java.util.DecimalDigits::size -> java.lang.Long.stringSize >> >> We can reduce duplication through JavaLangAccess,

Re: RFR: 8268829: Provide an optimized way to walk the stack with Class object only [v12]

2023-09-17 Thread Chen Liang
On Sun, 17 Sep 2023 06:57:46 GMT, ExE Boss wrote: >> Mandy Chung has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Fix @Param due to the rename from default to class+method > > src/java.base/share/classes/java/lang/StackFrameInfo.java

Re: RFR: 8315454: Add an immutable BitSet

2023-09-01 Thread Chen Liang
On Fri, 1 Sep 2023 08:21:13 GMT, Per Minborg wrote: > This PR proposes adding a new method to BitSet that provides an immutable > snapshot of the set in the form of an `IntPredicate`. > > The predicate is eligible for constant folding. > > Here are some classes in the JDK that would benefit

Re: RFR: 8315968: Move java.util.Digits to jdk.internal.util and refactor to reduce duplication [v19]

2023-09-12 Thread Chen Liang
On Tue, 12 Sep 2023 13:27:29 GMT, 温绍锦 wrote: >> Some codes in core libs are duplicated, including: >> java.util.DecimalDigits::DIGITS -> java.lang.StringLatin1.PACKED_DIGITS >> java.util.DecimalDigits::size -> java.lang.Long.stringSize >> >> We can reduce duplication through JavaLangAccess,

Re: RFR: 8301991: Convert l10n properties resource bundles to UTF-8 native

2023-09-12 Thread Chen Liang
On Tue, 12 Sep 2023 21:57:31 GMT, Justin Lu wrote: > JDK .properties files still use ISO-8859-1 encoding with escape sequences. It > would improve readability to see the native characters instead of escape > sequences (especially for the L10n process). The majority of files changed > are

Re: RFR: 8267509: Improve IllegalAccessException message to include the cause of the exception

2023-09-12 Thread Chen Liang
On Wed, 13 Sep 2023 01:12:52 GMT, Mandy Chung wrote: > This PR improves IllegalAccessException message thrown by `Lookup::findXXX` > APIs if the method's variable arity modifier bit is set and > `asVarargsCollector` fails. It will increase the exception message thrown by >

Re: RFR: 8316150: Refactor get chars and string size [v3]

2023-09-12 Thread Chen Liang
On Wed, 13 Sep 2023 02:17:00 GMT, 温绍锦 wrote: >> 1. Reduce duplicate stringSize code >> 2. Move java.lang.StringLatin1.getChars to >> jdk.internal.util.DecimalDigits::getCharLatin1,not only java.lang, other >> packages also need to use this method > > 温绍锦 has updated the pull request

Re: RFR: 8315585: Optimization for decimal to string [v7]

2023-09-08 Thread Chen Liang
On Fri, 8 Sep 2023 15:34:16 GMT, 温绍锦 wrote: >> src/java.base/share/classes/java/lang/String.java line 699: >> >>> 697: } >>> 698: >>> 699: static String newStringLatin1NoRepl(byte[] bytes) { >> >> How much does this help compared to calling `jla.newStringNoRepl(bytes, >>

Re: RFR: 8311207: Cleanup for Optimization for UUID.toString [v14]

2023-09-08 Thread Chen Liang
On Fri, 8 Sep 2023 21:06:25 GMT, ExE Boss wrote: >> 温绍锦 has updated the pull request incrementally with one additional commit >> since the last revision: >> >> lo | hi => hi | lo > > src/java.base/share/classes/java/util/HexDigits.java line 66: > >> 64: */ >> 65: @Stable >> 66:

Re: RFR: 8313258: RuntimeInvisibleTypeAnnotationsAttribute.annotations() API Index out of Bound error

2023-08-31 Thread Chen Liang
On Thu, 31 Aug 2023 11:09:05 GMT, Adam Sotona wrote: > Classfile API suppose to throw IllegalArgumentException in situations where > bytecode offset is out of allowed range. Such situation includes invalid > offset parsed from a TypeAnnotation as well as from other CodeAttribute > attributes.

Re: RFR: 8309622: Re-examine the cache mechanism in BaseLocale [v5]

2023-08-30 Thread Chen Liang
On Tue, 1 Aug 2023 20:21:11 GMT, Naoto Sato wrote: >> This is stemming from the PR: https://github.com/openjdk/jdk/pull/14211 >> where aggressive GC can cause NPE in `BaseLocale$Key` class. I refactored >> the in-house cache with WeakHashMap, and removed the Key class as it is no >> longer

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-16 Thread Chen Liang
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 before, and there were too many changes. I split it >> into multiple PRs with small changes. This one is one of them. >> >> this PR removed the duplicate code for getChars in >> BigDecimal#StringBuilderHelper, i

Re: RFR: 8316150: Refactor get chars and string size

2023-10-16 Thread Chen Liang
On Wed, 13 Sep 2023 01:24:05 GMT, Shaojin Wen wrote: > 1. Reduce duplicate stringSize code > 2. Move java.lang.StringLatin1.getChars to > jdk.internal.util.DecimalDigits::getCharLatin1,not only java.lang, other > packages also need to use this method Changes requested by liach (Author).

Re: RFR: 8316641: VarHandle template classes can share code in the base class [v7]

2023-10-13 Thread Chen Liang
> VarHandle implementations have many static fields and methods that can be > pulled to the common superclass to avoid repeated initialization and code > duplication. > > In addition, the Unsafe-based Buffer field access are replaced by usage of > public methods or JavaNioA

Re: RFR: 8318200: String::newStringNoRepl and String::getBytesNoRepl does not throw CharacterCodingException

2023-10-16 Thread Chen Liang
On Mon, 16 Oct 2023 22:27:34 GMT, Shaojin Wen wrote: > When calling String::newStringNoRepl and String::getBytesNoRepl, we need to > use try...catch to handle CharacterCodingException and throw > IllegalArgumentException instead of CharacterCodingException to make the > calling code cleaner.

Re: RFR: 8318200: String::newStringNoRepl and String::getBytesNoRepl does not throw CharacterCodingException [v4]

2023-10-17 Thread Chen Liang
On Tue, 17 Oct 2023 14:30:26 GMT, Shaojin Wen wrote: > @wenshao The proposal changes the exception types for seemingly no reason. > What concrete problem does this enhancement PR address? @rgiulietti The API was exposed to create a String without duplicating an array in compatible encoding.

Re: RFR: 8294980: test/jdk/java/lang/invoke 15 test classes use experimental bytecode library [v2]

2023-11-03 Thread Chen Liang
On Wed, 25 Oct 2023 12:36:40 GMT, Mourad Abbay wrote: >> test/jdk/java/lang/invoke/common/test/java/lang/invoke/lib/InstructionHelper.java >> line 71: >> >>> 69: for (int i = 0; i < >>> type.parameterCount(); i++) { >>> 70:

Re: RFR: 8318144: Match on enum constants with body compiles but fails with MatchException

2023-11-03 Thread Chen Liang
On Fri, 3 Nov 2023 16:26:49 GMT, Jan Lahoda wrote: > For code like: > > enum E {A {}, B {} } > Object o = E.A; > switch (o) { > case E.A -> System.err.println(o); > default -> System.err.println("default"); > } > > > The result is `default`, not `A`, due to incorrect classes being

Withdrawn: 8311906: Race condition in String constructor

2023-11-03 Thread Chen Liang
On Mon, 25 Sep 2023 12:28:40 GMT, Chen Liang wrote: > In the constructor of String, many locations the user-supplied byte or char > arrays are read multiple times with a plain memory access; if a user > previously wrote to one of such locations out of happens-before order, > di

Re: RFR: 8311906: Race condition in String constructor

2023-11-03 Thread Chen Liang
On Mon, 25 Sep 2023 12:28:40 GMT, Chen Liang wrote: > In the constructor of String, many locations the user-supplied byte or char > arrays are read multiple times with a plain memory access; if a user > previously wrote to one of such locations out of happens-before order, > di

Re: RFR: 8294980: test/jdk/java/lang/invoke 15 test classes use experimental bytecode library

2023-11-03 Thread Chen Liang
On Thu, 19 Oct 2023 14:37:06 GMT, Mourad Abbay wrote: > early experimental version of the bytecode library is bundled under: > test/jdk/lib/testlibrary/bytecode > > following tests reference it: > test/jdk/java/lang/invoke/common/test/java/lang/invoke/lib/InstructionHelper.java >

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow

2023-11-03 Thread Chen Liang
On Fri, 3 Nov 2023 08:41:12 GMT, Jan Lahoda wrote: > Consider code like: > > void test(Object o) { > switch (o) { > case X1 -> {} > case X2 -> {} > ...(about 100 cases) > ``` > > javac will compile the switch into a switch whose selector is an indy > invocation to

RFR: 8319386: Migrate Class::getEnclosingMethod/Constructor away from old generic utilities

2023-11-03 Thread Chen Liang
Please review a patch that migrates `Class::getEnclosingMethod` and `Class::getEnclosingConstructor`'s descriptor parsing from old generic utilities to more simple utilities from java.lang.invoke implementation. This will help migrate away from the old generic repositories in the future. The

Re: RFR: 8187655: jdk.lambda.vm.InterfaceAccessFlagsTest.testPrivateMethodCall needs update after nestmates support

2023-11-06 Thread Chen Liang
On Mon, 6 Nov 2023 19:26:26 GMT, Mandy Chung wrote: > `jdk.lambda.vm.InterfaceAccessFlagsTest` uses `ClassToInterfaceConverter` to > mechanically convert a classfile for a Class into an in-memory class > representation of an equivalent Interface. `testPrivateMethodCall` tests to > invoke a

Integrated: 8319462: Signature.ClassTypeSig::classDesc() incorrect for inner class types

2023-11-07 Thread Chen Liang
On Mon, 6 Nov 2023 06:00:20 GMT, Chen Liang wrote: > Observed this erroneous implementation while browsing, and included a quick > test against javac output class file to confirm the correct implementation. > @asotona Please take a look. This pull request has now been integrated.

Re: RFR: 8187655: jdk.lambda.vm.InterfaceAccessFlagsTest.testPrivateMethodCall needs update after nestmates support [v2]

2023-11-07 Thread Chen Liang
On Tue, 7 Nov 2023 19:10:18 GMT, ExE Boss wrote: >> Mandy Chung has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Simplify the transformation code and easier to read > > test/jdk/jdk/lambda/separate/ClassToInterfaceConverter.java line 53:

Re: RFR: 8187655: jdk.lambda.vm.InterfaceAccessFlagsTest.testPrivateMethodCall needs update after nestmates support [v2]

2023-11-07 Thread Chen Liang
On Tue, 7 Nov 2023 18:34:42 GMT, Mandy Chung wrote: >> `jdk.lambda.vm.InterfaceAccessFlagsTest` uses `ClassToInterfaceConverter` to >> mechanically convert a classfile for a Class into an in-memory class >> representation of an equivalent Interface. `testPrivateMethodCall` tests >> to

Re: RFR: 8187655: jdk.lambda.vm.InterfaceAccessFlagsTest.testPrivateMethodCall needs update after nestmates support [v2]

2023-11-07 Thread Chen Liang
On Tue, 7 Nov 2023 18:34:42 GMT, Mandy Chung wrote: >> `jdk.lambda.vm.InterfaceAccessFlagsTest` uses `ClassToInterfaceConverter` to >> mechanically convert a classfile for a Class into an in-memory class >> representation of an equivalent Interface. `testPrivateMethodCall` tests >> to

Re: RFR: 8316641: VarHandle template classes can share code in the base class [v8]

2023-11-06 Thread Chen Liang
> VarHandle implementations have many static fields and methods that can be > pulled to the common superclass to avoid repeated initialization and code > duplication. > > In addition, the Unsafe-based Buffer field access are replaced by usage of > public methods or JavaNioA

RFR: 8319462: Signature.ClassTypeSig::classDesc() incorrect for inner class types

2023-11-05 Thread Chen Liang
Observed this erroneous implementation while browsing, and included a quick test against javac output class file to confirm the correct implementation. @asotona Please take a look. - Commit messages: - 8319462: Signature.ClassTypeSig::classDesc() incorrect for inner class types

RFR: 8319463: ClassSignature should have superclass and superinterfaces as ClassTypeSig

2023-11-05 Thread Chen Liang
Discovered while writing a test for #16513 that `ClassSignature.superclassSignature()` does not return a `ClassTypeSig`, yet [JVM Spec](https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-4.html#jvms-4.7.9.1-4100) requires it to be one. This patch adds such a requirement to the accessors,

Re: RFR: 8180892: Correct handling of annotations on parameters [v2]

2023-11-05 Thread Chen Liang
On Sun, 8 Oct 2023 17:01:37 GMT, Joe Darcy wrote: >> @liach , thank you for working on this fix. I've given the changes an >> initial skim, but will need to do a more thorough review before approving or >> offering suggestions for changes. My top priority for the next few weeks >> will be JDK

Re: RFR: 8311906: Improve robustness of String constructors with mutable array inputs

2023-11-06 Thread Chen Liang
On Mon, 30 Oct 2023 18:34:44 GMT, Roger Riggs wrote: > Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might

Re: RFR: 8318457: Use prefix-less prepend methods directly to reduce branches in String concat expressions

2023-10-18 Thread Chen Liang
On Wed, 18 Oct 2023 11:56:14 GMT, Claes Redestad wrote: > In #16006 using `StringConcatFactory` seem to induce a run-to-run variance. > One idea to reduce this is to generate expression trees with fewer branches > by looking up and using the prefix-less `prepend` methods directly for cases >

Re: RFR: 8315585: Optimization for decimal to string [v7]

2023-10-17 Thread Chen Liang
On Mon, 16 Oct 2023 15:00:42 GMT, Shaojin Wen wrote: >> I submitted PR #1 before, and there were too many changes. I split it >> into multiple PRs with small changes. This one is one of them. >> >> this PR removed the duplicate code for getChars in >> BigDecimal#StringBuilderHelper, i

RFR: 8318486: Rename JavaLangAccess.newString/getBytesUTF8NoRepl to FailFast

2023-10-19 Thread Chen Liang
Please review a patch that renames `JavaLangAccess::newStringUTF8NoRepl` and `getBytesUTF8NoRepl` to `newStringUTF8FailFast` and `getBytesUTF8FailFast` to accurately describe these APIs. This also renames other associated methods. NoRepl means "no replication", which is not what these APIs are

Re: RFR: 8311220: Optimization for StringLatin UpperLower [v10]

2023-09-18 Thread Chen Liang
On Mon, 18 Sep 2023 04:11:25 GMT, 温绍锦 wrote: >> # Benchmark Result >> >> >> sh make/devkit/createJMHBundle.sh >> bash configure --with-jmh=build/jmh/jars >> make test TEST="micro:java.lang.StringUpperLower.*" >> >> >> >> ## 1. >>

Re: RFR: 8316493: Make immutable maps @ValueBased

2023-09-19 Thread Chen Liang
On Thu, 7 Sep 2023 11:13:44 GMT, Per Minborg wrote: > This PR outlines a solution for making immutable maps `@ValueBased` by > removing cacheing of certain values in `AbstractMap`. > > By removing these caching fields in `AbstractMap`, we can make the immutable > maps `@ValueBased` and at the

Re: RFR: 8316426: Optimization for HexFormat.formatHex [v4]

2023-09-19 Thread Chen Liang
On Tue, 19 Sep 2023 09:03:35 GMT, 温绍锦 wrote: >> In the improvement of @cl4es PR #15591, the advantages of non-lookup-table >> were discussed. >> >> But if the input is byte[], using lookup table can improve performance. >> >> For HexFormat#formatHex(Appendable, byte[]) and

Re: RFR: 8313612: Use JUnit in lib-test/jdk tests [v3]

2023-09-19 Thread Chen Liang
On Thu, 7 Sep 2023 07:15:06 GMT, Qing Xiao wrote: >> Modified all tests under lib-test/jdk to use JUnit > > Qing Xiao has updated the pull request incrementally with one additional > commit since the last revision: > > Change test static method to instance method

Re: RFR: 8311220: Optimization for StringLatin UpperLower [v8]

2023-09-17 Thread Chen Liang
On Mon, 18 Sep 2023 02:53:18 GMT, 温绍锦 wrote: >> # Benchmark Result >> >> >> sh make/devkit/createJMHBundle.sh >> bash configure --with-jmh=build/jmh/jars >> make test TEST="micro:java.lang.StringUpperLower.*" >> >> >> >> ## 1. >>

Re: RFR: 8316557: Make fields final in 'sun.util' package

2023-09-19 Thread Chen Liang
On Thu, 14 Sep 2023 08:58:56 GMT, Andrey Turbanov wrote: > A few classes in `sun.util` package have non-final fields which could easily > be marked `final`. src/java.base/share/classes/sun/util/PropertyResourceBundleCharset.java line 71: > 69: private final class PropertiesFileDecoder

Re: RFR: 8310837: Use ByteArrayLittleEndian in java.util.zip

2023-09-19 Thread Chen Liang
On Mon, 26 Jun 2023 14:14:54 GMT, Lance Andersen wrote: > @LanceAndersen This one is going to require checking that startup isn't > impacted. Now that `ByteArrayLittleEndian` is used in Integer toString, don't think this patch will affect the startup class loading sequence. - PR

Re: RFR: 8316493: Make immutable maps @ValueBased

2023-09-19 Thread Chen Liang
On Tue, 19 Sep 2023 18:38:06 GMT, ExE Boss wrote: >> This PR outlines a solution for making immutable maps `@ValueBased` by >> removing cacheing of certain values in `AbstractMap`. >> >> By removing these caching fields in `AbstractMap`, we can make the immutable >> maps `@ValueBased` and at

Re: RFR: 8316493: Make immutable maps @ValueBased

2023-09-19 Thread Chen Liang
On Thu, 7 Sep 2023 11:13:44 GMT, Per Minborg wrote: > This PR outlines a solution for making immutable maps `@ValueBased` by > removing cacheing of certain values in `AbstractMap`. > > By removing these caching fields in `AbstractMap`, we can make the immutable > maps `@ValueBased` and at the

Re: Integrated: 8316582: Minor startup regression in 22-b15 due JDK-8310929

2023-09-21 Thread Chen Liang
On Wed, 20 Sep 2023 09:12:48 GMT, Claes Redestad wrote: > This patch reverts the use of `ByteArrayLittleEndian` in `StringLatin1`. > > This use is the cause of a small (~1.5ms) startup regression in 22-b15. While > a manageable startup regression in and of itself, the use of `VarHandles` in

Integrated: 8311084: Add typeSymbol() API for applicable constant pool entries

2023-09-21 Thread Chen Liang
On Thu, 29 Jun 2023 09:59:30 GMT, Chen Liang wrote: > 5 Constant Pool entries, namely ConstantDynamicEntry, InvokeDynamicEntry, > FieldRefEntry, MethodRefEntry, and InterfaceMethodRefEntry should have a > typeSymbol() API to return the nominal/symbolic descriptor (

Re: RFR: 8316641: VarHandle template classes can share code in the base class [v2]

2023-09-21 Thread Chen Liang
> VarHandle implementations have many static fields and methods that can be > pulled to the common superclass to avoid repeated initialization and code > duplication. > > In addition, the Unsafe-based Buffer field access are replaced by usage of > public methods or JavaNioA

Re: RFR: 8316587: Use ArraysSupport.vectorizedHashCode in Utf8EntryImpl [v2]

2023-09-21 Thread Chen Liang
On Thu, 21 Sep 2023 02:38:08 GMT, Chen Liang wrote: >> Like #12077, this uses JDK's internal utilities to speed up ASCII reading in >> Class files, where most identifiers, from conventions to attribute names, >> are ASCII. See the JBS issue for more in-depth explanati

Re: RFR: 8316641: VarHandle template classes can share code in the base class [v5]

2023-09-23 Thread Chen Liang
> VarHandle implementations have many static fields and methods that can be > pulled to the common superclass to avoid repeated initialization and code > duplication. > > In addition, the Unsafe-based Buffer field access are replaced by usage of > public methods or JavaNioA

Re: RFR: 8316150: Refactor get chars and string size [v8]

2023-09-23 Thread Chen Liang
On Sat, 23 Sep 2023 07:39:59 GMT, 温绍锦 wrote: >> 1. Reduce duplicate stringSize code >> 2. Move java.lang.StringLatin1.getChars to >> jdk.internal.util.DecimalDigits::getCharLatin1,not only java.lang, other >> packages also need to use this method > > 温绍锦 has updated the pull request

Re: RFR: 8316641: VarHandle template classes can share code in the base class [v4]

2023-09-23 Thread Chen Liang
> VarHandle implementations have many static fields and methods that can be > pulled to the common superclass to avoid repeated initialization and code > duplication. > > In addition, the Unsafe-based Buffer field access are replaced by usage of > public methods or JavaNioA

Re: RFR: 8315999: Improve Date toString performance [v13]

2023-09-24 Thread Chen Liang
On Wed, 13 Sep 2023 14:22:35 GMT, 温绍锦 wrote: >> improve date toString performance, includes: >> >> java.util.Date.toString >> java.util.Date.toGMTString >> java.time.Instant.toString >> java.time.LocalDate.toString >> java.time.LocalDateTime.toString >> java.time.LocalTime.toString > > 温绍锦 has

Re: RFR: 8316641: VarHandle template classes can share code in the base class [v6]

2023-09-24 Thread Chen Liang
> VarHandle implementations have many static fields and methods that can be > pulled to the common superclass to avoid repeated initialization and code > duplication. > > In addition, the Unsafe-based Buffer field access are replaced by usage of > public methods or JavaNioA

Re: RFR: 8316641: VarHandle template classes can share code in the base class [v5]

2023-09-24 Thread Chen Liang
On Sun, 24 Sep 2023 02:11:50 GMT, Chen Liang wrote: >> VarHandle implementations have many static fields and methods that can be >> pulled to the common superclass to avoid repeated initialization and code >> duplication. >> >> In addition, the Unsafe-based Bu

Re: RFR: 8271268: Fix Javadoc links for Stream.mapMulti

2023-09-22 Thread Chen Liang
On Mon, 18 Sep 2023 18:09:57 GMT, Mourad Abbay wrote: > Fix Javadoc links for Stream.mapMulti, Stream.MapMultiInt, > Stream.mapMultiToInt, Stream.mapMultiToLong and Stream.mapMultiToDouble. Then it's a bug with Intellij IDEA not able to parse these links correctly. It should be fixed in their

Re: RFR: 8316493: Make immutable maps @ValueBased [v3]

2023-09-22 Thread Chen Liang
On Thu, 21 Sep 2023 16:40:59 GMT, Per Minborg wrote: >> This PR outlines a solution for making immutable maps `@ValueBased` by >> removing cacheing of certain values in `AbstractMap`. >> >> By removing these caching fields in `AbstractMap`, we can make the immutable >> maps `@ValueBased` and

Re: RFR: 8316150: Refactor get chars and string size [v7]

2023-09-22 Thread Chen Liang
On Fri, 22 Sep 2023 09:22:04 GMT, 温绍锦 wrote: >> 1. Reduce duplicate stringSize code >> 2. Move java.lang.StringLatin1.getChars to >> jdk.internal.util.DecimalDigits::getCharLatin1,not only java.lang, other >> packages also need to use this method > > 温绍锦 has updated the pull request

RFR: 8316587: Use ArraysSupport.vectorizedHashCode in Utf8EntryImpl

2023-09-20 Thread Chen Liang
Like #12077, this uses JDK's internal utilities to speed up ASCII reading in Class files, where most identifiers, from conventions to attribute names, are ASCII. See the JBS issue for more in-depth explanations. Before: (Master) Benchmark Mode CntScore Error

Re: RFR: 8311084: Add typeSymbol() API for applicable constant pool entries [v3]

2023-09-20 Thread Chen Liang
o NameAndTypeEntry itself, for a NameAndTypeEntry only > knows if its type should be a field or method type from the other entries > that refer to it. > > This is one of the issues discussed in this mailing list thread: > https://mail.openjdk.org/pipermail/classfile-api-dev/2023

Re: RFR: 8316493: Make immutable maps @ValueBased [v2]

2023-09-20 Thread Chen Liang
On Wed, 20 Sep 2023 06:04:26 GMT, Per Minborg wrote: >> This PR outlines a solution for making immutable maps `@ValueBased` by >> removing cacheing of certain values in `AbstractMap`. >> >> By removing these caching fields in `AbstractMap`, we can make the immutable >> maps `@ValueBased` and

Re: RFR: 8311084: Add typeSymbol() API for applicable constant pool entries [v2]

2023-09-20 Thread Chen Liang
On Fri, 30 Jun 2023 02:42:08 GMT, Chen Liang wrote: >> 5 Constant Pool entries, namely ConstantDynamicEntry, InvokeDynamicEntry, >> FieldRefEntry, MethodRefEntry, and InterfaceMethodRefEntry should have a >> typeSymbol() API to return the nominal/symbolic des

Re: RFR: 8311085: Remove implementation detail writeTo from LocalVariable(Type) [v4]

2023-09-19 Thread Chen Liang
eBuilder`'s original use > sites; the old `b.canWriteDirect` branch is redundant, as `writeIndex`'s > implementation already performs such an optimization. Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains four commit

Re: RFR: 8316426: Optimization for HexFormat.formatHex

2023-09-18 Thread Chen Liang
On Fri, 15 Sep 2023 18:04:29 GMT, 温绍锦 wrote: > In the improvement of @cl4es PR #15591, the advantages of non-lookup-table > were discussed. > > But if the input is byte[], using lookup table can improve performance. > > For HexFormat#formatHex(Appendable, byte[]) and

Re: RFR: 8316587: Use ArraysSupport.vectorizedHashCode in Utf8EntryImpl [v2]

2023-09-21 Thread Chen Liang
On Thu, 21 Sep 2023 13:43:30 GMT, Adam Sotona wrote: >> Chen Liang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Fix logical bug with char array filling > > src/java.base/share/class

Re: RFR: 8316641: VarHandle template classes can share code in the base class [v2]

2023-09-21 Thread Chen Liang
On Thu, 21 Sep 2023 08:50:00 GMT, Chen Liang wrote: >> VarHandle implementations have many static fields and methods that can be >> pulled to the common superclass to avoid repeated initialization and code >> duplication. >> >> In addition, the Unsafe-based Bu

Re: RFR: 8316641: VarHandle template classes can share code in the base class [v3]

2023-09-21 Thread Chen Liang
> VarHandle implementations have many static fields and methods that can be > pulled to the common superclass to avoid repeated initialization and code > duplication. > > In addition, the Unsafe-based Buffer field access are replaced by usage of > public methods or JavaNioA

Re: RFR: 8316150: Refactor get chars and string size [v5]

2023-09-21 Thread Chen Liang
On Fri, 22 Sep 2023 04:10:26 GMT, 温绍锦 wrote: >> 1. Reduce duplicate stringSize code >> 2. Move java.lang.StringLatin1.getChars to >> jdk.internal.util.DecimalDigits::getCharLatin1,not only java.lang, other >> packages also need to use this method > > 温绍锦 has updated the pull request with a new

Re: RFR: 8316150: Refactor get chars and string size [v5]

2023-09-21 Thread Chen Liang
On Fri, 22 Sep 2023 04:10:26 GMT, 温绍锦 wrote: >> 1. Reduce duplicate stringSize code >> 2. Move java.lang.StringLatin1.getChars to >> jdk.internal.util.DecimalDigits::getCharLatin1,not only java.lang, other >> packages also need to use this method > > 温绍锦 has updated the pull request with a new

Re: RFR: 8271268: Fix Javadoc links for Stream.mapMulti

2023-09-22 Thread Chen Liang
On Mon, 18 Sep 2023 18:09:57 GMT, Mourad Abbay wrote: > Fix Javadoc links for Stream.mapMulti, Stream.MapMultiInt, > Stream.mapMultiToInt, Stream.mapMultiToLong and Stream.mapMultiToDouble. What is this patch looking to fix? The link is not broken in the first place. This `#mapMulti mapMulti`

Re: RFR: 8311906: Race condition in String constructor

2023-09-25 Thread Chen Liang
On Mon, 25 Sep 2023 12:28:40 GMT, Chen Liang wrote: > In the constructor of String, many locations the user-supplied byte or char > arrays are read multiple times with a plain memory access; if a user > previously wrote to one of such locations out of happens-before order, > di

Re: RFR: 8311906: Race condition in String constructor

2023-09-25 Thread Chen Liang
On Mon, 25 Sep 2023 12:28:40 GMT, Chen Liang wrote: > In the constructor of String, many locations the user-supplied byte or char > arrays are read multiple times with a plain memory access; if a user > previously wrote to one of such locations out of happens-before order, > di

Re: RFR: 8314986: Module readability resolution is slow with large numbers of automatic modules

2023-09-26 Thread Chen Liang
On Tue, 26 Sep 2023 14:19:55 GMT, Technici4n wrote: > Fixes the issue (hopefully) by resolving automatic modules and automatic > module dependencies after propagation of non-automatic transitive > dependencies. The module tests run. > > I also added a few asserts to validate that the

Re: RFR: 8308753: Class-File API transition to Preview [v2]

2023-09-26 Thread Chen Liang
On Tue, 26 Sep 2023 12:32:37 GMT, Adam Sotona wrote: >> Classfile API is an internal library under package `jdk.internal.classfile`  >> in JDK 21. >> This pull request turns the Classfile API into a preview feature and moves >> it into `java.lang.classfile`. >> It repackages all uses across JDK

Re: RFR: 8180892: Correct handling of annotations on parameters [v2]

2023-10-03 Thread Chen Liang
On Thu, 27 Apr 2023 23:42:54 GMT, Joe Darcy wrote: >> Chen Liang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Fix assuming match without MethodParameters for type annotations, move &

Re: RFR: 8316587: Use ArraysSupport.vectorizedHashCode in Utf8EntryImpl [v2]

2023-09-20 Thread Chen Liang
Mode CntScore Error Units > ReadMetadata.jdkReadMemberNames thrpt4 167.623 ± 8.522 ops/s > > > After: (This patch, first revision) > > Benchmark Mode CntScore Error Units > ReadMetadata.jdkReadMemberNames thrpt4 175.

Re: RFR: 8315850: Improve AbstractMap anonymous Iterator classes [v3]

2023-09-19 Thread Chen Liang
On Fri, 8 Sep 2023 16:13:16 GMT, Per Minborg wrote: >> This PR proposes to slightly improve some iterators of `AbstractMap`: >> >> * Declare two fields `final` >> * Use distinct classes rather than anonymous classes > > Per Minborg has updated the pull request incrementally with two additional

RFR: 8316641: VarHandle template classes can share code in the base class

2023-09-20 Thread Chen Liang
VarHandle implementations have many static fields and methods that can be pulled to the common superclass to avoid repeated initialization and code duplication. In addition, the Unsafe-based Buffer field access are replaced by usage of public methods or JavaNioAccess. - Commit

Re: RFR: 8271268: Fix Javadoc links for Stream.mapMulti

2023-09-22 Thread Chen Liang
On Mon, 18 Sep 2023 18:09:57 GMT, Mourad Abbay wrote: > Fix Javadoc links for Stream.mapMulti, Stream.MapMultiInt, > Stream.mapMultiToInt, Stream.mapMultiToLong and Stream.mapMultiToDouble. I recommend just work in the same PR and change all `@see #mapMulti` to `@see #mapMulti mapMulti` and

Re: RFR: 8267509: Improve IllegalAccessException message to include the cause of the exception [v3]

2023-09-21 Thread Chen Liang
On Wed, 13 Sep 2023 17:52:22 GMT, Mandy Chung wrote: >> This PR improves IllegalAccessException message thrown by `Lookup::findXXX` >> APIs if the method's variable arity modifier bit is set and >> `asVarargsCollector` fails. It will increase the exception message thrown >> by

Re: RFR: 8294977: Convert test/jdk/java tests from ASM library to Classfile API [v9]

2023-09-21 Thread Chen Liang
On Wed, 28 Jun 2023 07:02:17 GMT, Chen Liang wrote: >> Summaries: >> 1. A few recommendations about updating the constant API is made at >> https://mail.openjdk.org/pipermail/classfile-api-dev/2023-March/000233.html >> and I may update this patch shall the API changes b

Re: RFR: 8316557: Make fields final in 'sun.util' package

2023-09-25 Thread Chen Liang
On Mon, 25 Sep 2023 09:53:47 GMT, Glavo wrote: >> UTF8 decoder does not perform any internal state mutation during decoding; >> in addition, if this field is static final, the decoder's error actions are >> published when the class is initialized, while publishing in a final field >> does not

Re: RFR: 8316557: Make fields final in 'sun.util' package

2023-09-25 Thread Chen Liang
On Mon, 25 Sep 2023 09:40:00 GMT, Andrey Turbanov wrote: >> src/java.base/share/classes/sun/util/PropertyResourceBundleCharset.java line >> 71: >> >>> 69: private final class PropertiesFileDecoder extends CharsetDecoder { >>> 70: >>> 71: private final CharsetDecoder cdUTF_8 = >>>

Re: RFR: 8312522: Implementation of Foreign Function & Memory API [v23]

2023-09-22 Thread Chen Liang
On Fri, 22 Sep 2023 15:20:05 GMT, Jorn Vernee wrote: >> This patch contains the implementation of the foreign linker & memory API >> JEP for Java 22. The initial patch is composed of commits brought over >> directly from the [panama-foreign >> repo](https://github.com/openjdk/panama-foreign).

Re: RFR: 8316493: Make immutable maps @ValueBased [v3]

2023-09-22 Thread Chen Liang
On Fri, 22 Sep 2023 14:44:11 GMT, Glavo wrote: >> Per Minborg 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

Re: RFR: 8271268: Fix Javadoc links for Stream.mapMulti [v2]

2023-09-22 Thread Chen Liang
On Fri, 22 Sep 2023 16:02:49 GMT, Mourad Abbay wrote: >> Fix Javadoc links for Stream.mapMulti, Stream.MapMultiInt, >> Stream.mapMultiToInt, Stream.mapMultiToLong and Stream.mapMultiToDouble. > > Mourad Abbay has updated the pull request incrementally with one additional > commit since the

RFR: 8311906: Race condition in String constructor

2023-09-25 Thread Chen Liang
In the constructor of String, many locations the user-supplied byte or char arrays are read multiple times with a plain memory access; if a user previously wrote to one of such locations out of happens-before order, distinct plain memory reads may result in different unanticipated values. The

Re: RFR: 8317678: Fix up hashCode() for ZipFile.Source.Key

2023-10-10 Thread Chen Liang
On Tue, 10 Oct 2023 08:32:28 GMT, Sean Coffey wrote: > Fix up java.util.zip.ZipFile$Source hashCode() impl so that duplicate Source > objects aren't created for the same zip file. src/java.base/share/classes/java/util/zip/ZipFile.java line 1418: > 1416: > 1417:

Re: RFR: 8317795: Add an ImmutableBitSetPredicate variant for bitsets <= 128 elements

2023-10-10 Thread Chen Liang
On Sun, 8 Oct 2023 21:02:25 GMT, Claes Redestad wrote: > Alternative to #16082 > > Name (unchanged) Cnt Base Error Test Error > Unit Change > URLEncodeDecode.testEncodeLatin1 0 15 2,066 ± 0,104 1,899 ± 0,007 > ms/op 1,09x (p = 0,000*) >

Re: RFR: 8317980: Optimization for Integer.parseInt and Long.parseLong

2023-10-11 Thread Chen Liang
On Tue, 10 Oct 2023 10:03:52 GMT, Shaojin Wen wrote: >> src/java.base/share/classes/java/lang/Integer.java line 682: >> >>> 680: */ >>> 681: public static int parseInt(String s) throws NumberFormatException { >>> 682: if (s != null && s.coder() == String.LATIN1) { >> >> Does

Re: RFR: 8317980: Optimization for Integer.parseInt and Long.parseLong

2023-10-11 Thread Chen Liang
On Thu, 12 Oct 2023 00:06:30 GMT, Shaojin Wen wrote: >> src/java.base/share/classes/java/lang/Integer.java line 560: >> >>> 558: if (radix > Character.MAX_RADIX) { >>> 559: throw NumberFormatException.forMaxRadix(radix); >>> 560: } >> >> It sounds like these methods

Re: RFR: 8317980: Optimization for Integer.parseInt and Long.parseLong

2023-10-11 Thread Chen Liang
On Tue, 10 Oct 2023 02:54:05 GMT, Shaojin Wen wrote: > By extracting the code that creates the exception, the CodeSize of these > methods is less than the default FreqInlineSize 325. and for the scenario > where the most commonly used radix is not specified and the String coder is > LATIN1,

  1   2   3   4   5   6   7   8   9   10   >