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

2023-03-14 Thread liach
test/jdk/java/lang/instrument/asmlib/Instrumentor.java > > > @asotona Would you mind reviewing? liach has updated the pull request incrementally with one additional commit since the last revision: Shorten lines, move from mask() to ACC_ constants, other misc improvements - Changes

Re: RFR: 8302822: Method/Field/Constructor/RecordComponent::getGenericInfo() is not thread safe [v2]

2023-03-14 Thread liach
On Wed, 15 Mar 2023 02:37:05 GMT, liach wrote: >> 8302822: Method/Field/Constructor/RecordComponent::getGenericInfo() is not >> thread safe > > liach has updated the pull request with a new target base due to a merge or a > rebase. The incremental webrev excludes the unre

Re: RFR: 8302822: Method/Field/Constructor/RecordComponent::getGenericInfo() is not thread safe [v2]

2023-03-14 Thread liach
> 8302822: Method/Field/Constructor/RecordComponent::getGenericInfo() is not > thread safe liach 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 contain

RFR: 8304181: Constant Descriptors for MethodHandles::classData and classDataAt

2023-03-14 Thread liach
Add Constant Descriptors for DirectMethodHandleDesc of MethodHandles::classData and classDataAt in ConstantDescs. This facilitates easier access of class data via condy in Classfile API-generated bytecode. Most other constant bootstrap methods provided in the JDK, notably from `ConstantBootstrap

Re: RFR: 8304031: Classfile API cannot encode Primitive Class as Condy

2023-03-14 Thread liach
On Tue, 14 Mar 2023 17:32:00 GMT, ExE Boss wrote: > I meant that `instanceof DynamicConstantDesc` would go after concrete classes > (`Integer`, `Long`, `Float`, `Double`, and `String`), but before the  > `ConstantDesc` interfaces. Still not feasible to make ReferenceClassDescImpl to go through

RFR: 8304161: Add TypeKind.from to derive from TypeDescriptor.OfField

2023-03-14 Thread liach
Such an API allows creating TypeKind from both Class and ClassDesc than having to call descriptorString() explicitly at every use site. See https://mail.openjdk.org/pipermail/classfile-api-dev/2023-March/000240.html for context. Upgraded usages of `fromDescriptor` to `from` in applicable use si

Re: RFR: 8294972: Convert jdk.jlink internal plugins to use the Classfile API [v6]

2023-03-14 Thread liach
On Tue, 14 Mar 2023 15:27:50 GMT, Adam Sotona wrote: >> jdk.jlink internal plugins are heavily using ASM >> >> This patch converts ASM calls to Classfile API. >> >> Please review. >> Thanks, >> Adam > > Adam Sotona has updated the pull request incrementally with three additional > commits sinc

Re: RFR: 8304148: Remapping a class with Invokedynamic constant loses static bootstrap arguments

2023-03-14 Thread liach
On Tue, 14 Mar 2023 14:51:34 GMT, Thiago Henrique Hüpner wrote: > 8304148: Remapping a class with Invokedynamic constant loses static bootstrap > arguments Created a JBS issue for you at https://bugs.openjdk.org/browse/JDK-8304148 - PR: https://git.openjdk.org/jdk/pull/13021

RFR: 8304139: Add , , and main method constants to ClassDescs

2023-03-14 Thread liach
Add String constants INIT_NAME, CLASS_INIT_NAME, MTD_void for the names and method type of instance and class initializers; add String constant MAIN_NAME and MTD_void_StringArray for the name and method type of main method. Update occurrences of and in core libraries API specification to refe

RFR: 8294977: Convert test/jdk/java tests from ASM library to Classfile API

2023-03-13 Thread liach
Summaries: 1. A few recommendations about updating the constant API is made at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-March/000233.html and I may update this patch shall the API changes be integrated before 2. One ASM library-specific test, `LambdaAsm` is removed. Others have t

Re: RFR: 8304031: Classfile API cannot encode Primitive Class as Condy

2023-03-13 Thread liach
On Mon, 13 Mar 2023 23:46:58 GMT, ExE Boss wrote: > Arguably, the `instanceof DynamicConstantDesc` check should go first, as  > there can be only one superclass, but multiple implemented interfaces. I think this ordering is rather ranked by their relative frequency in bytecode. Having integer c

Re: RFR: 8303910: jdk/classfile/CorpusTest.java failed 1 of 6754 tests [v2]

2023-03-13 Thread liach
On Mon, 13 Mar 2023 21:02:51 GMT, Adam Sotona wrote: >> jdk/classfile/CorpusTest.java rarely fails in 1 of 6754 parametrised >> parallel junit tests >> >> The root cause seems to be thread-unsafe lazy initialisation of >> `TypeKind.newarraycodeToTypeTag` in `TypeKind::fromNewArrayCode`. Provid

Re: RFR: 8303910: jdk/classfile/CorpusTest.java failed 1 of 6754 tests

2023-03-13 Thread liach
On Mon, 13 Mar 2023 18:54:11 GMT, Adam Sotona wrote: > jdk/classfile/CorpusTest.java rarely fails in 1 of 6754 parametrised parallel > junit tests > > The root cause seems to be thread-unsafe lazy initialisation of > `TypeKind.newarraycodeToTypeTag` in `TypeKind::fromNewArrayCode`. Provided >

Re: RFR: 8304031: Classfile API cannot encode Primitive Class as Condy

2023-03-13 Thread liach
On Mon, 13 Mar 2023 08:13:44 GMT, liach wrote: > Without this patch, the Classfile API tries to encode PrimitiveClassDesc as > CONSTANT_Class_info and error in `toInternalName`. @asotona Would you mind review this? - PR: https://git.openjdk.org/jdk/pull/12996

RFR: 8304031: Classfile API cannot encode Primitive Class as Condy

2023-03-13 Thread liach
Without this patch, the Classfile API tries to encode PrimitiveClassDesc as CONSTANT_Class_info and error in `toInternalName`. - Commit messages: - 8304031: Classfile API cannot encode Primitive Class as Condy Changes: https://git.openjdk.org/jdk/pull/12996/files Webrev: https://w

Re: RFR: 8294962: Convert java.base/jdk.internal.module package to use the Classfile API to modify and write module-info.class [v4]

2023-03-11 Thread liach
On Fri, 10 Mar 2023 16:46:35 GMT, Glavo wrote: > The Classfile API looks great. I want to ask if you have any plans to > completely replace all uses of `jdk.internal.org.objectweb.asm` and delete > its source code from OpenJDK in a short time? I guess yes. https://bugs.openjdk.org/browse/JDK-8

Re: RFR: 8294961: Convert java.base/java.lang.reflect.ProxyGenerator to use the Classfile API to generate proxy classes [v6]

2023-03-11 Thread liach
On Fri, 10 Mar 2023 08:48:14 GMT, Adam Sotona wrote: >> java.base java.lang.reflect.ProxyGenerator uses ASM to generate proxy >> classes and this patch converts it to use Classfile API. >> >> Please review. >> >> Thank you, >> Adam > > Adam Sotona has updated the pull request with a new target

RFR: 8284871: Use covariant overrides for the resolveConstantDesc(Lookup) method in sub‑interfaces of java.lang.constant.ConstantDesc

2023-03-10 Thread liach
Also remove redundant casts to avoid javac warnings. - Commit messages: - Move MethodTypeDesc api notes to MethodTypeDesc - Merge branch 'master' of https://git.openjdk.java.net/jdk into constdesc-override - Remove redundant casts - Covariant override of resolveConstantDesc for

RFR: 8288730: Lookup::accessClass(Class) should be generic on the type of `targetClass`

2023-03-10 Thread liach
Parameterizes `Lookup::accessClass` and `Lookup::ensureInitialized`. Updated an applicable use-site within JDK to benefit from this patch. - Commit messages: - update use sites - 8288730: `Lookup::accessClass(Class)` should be generic on the type of `targetClass` Changes: https:/

Re: RFR: 8294962: java.base jdk.internal.module package uses ASM to modify and write module-info.class [v3]

2023-03-10 Thread liach
On Fri, 10 Mar 2023 08:46:16 GMT, Adam Sotona wrote: >> 8294962: java.base jdk.internal.module package uses ASM to modify and write >> module-info.class. >> This patch converts it to use Classfile API. >> >> Please review. >> Thanks, >> Adam > > Adam Sotona has updated the pull request with a n

Re: RFR: 8303930: Fix ConstantUtils.skipOverFieldSignature void case return value [v2]

2023-03-09 Thread liach
BoundsException, and throws > IllegalArgumentException in the Jshell for this patch. liach has updated the pull request incrementally with one additional commit since the last revision: Copyright year - Changes: - all: https://git.openjdk.org/jdk/pull/12964/files - new: https://git.op

RFR: 8303930: Fix ConstantUtils.skipOverFieldSignature void case return value

2023-03-09 Thread liach
This typo doesn't allow creation of malformed ClassDesc or MethodTypeDesc, but it produces an erroneous exception on certain inputs. Running `java.lang.constant.MethodTypeDesc.ofDescriptor("(I[[[V)I")` in Jshell 19.0.2 throws StringIndexOutOfBoundsException, and throws IllegalArgumentExcept

Re: RFR: 8294962: java.base jdk.internal.module package uses ASM to modify and write module-info.class

2023-03-09 Thread liach
On Fri, 25 Nov 2022 14:38:55 GMT, Adam Sotona wrote: > 8294962: java.base jdk.internal.module package uses ASM to modify and write > module-info.class. > This patch converts it to use Classfile API. > > Please review. > Thanks, > Adam src/java.base/share/classes/jdk/internal/module/ModuleInfoW

Re: RFR: 8294961: java.base java.lang.reflect.ProxyGenerator uses ASM to generate proxy classes [v3]

2023-03-09 Thread liach
On Thu, 9 Mar 2023 11:15:44 GMT, Adam Sotona wrote: >> src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java line 661: >> >>> 659: */ >>> 660: private void generateMethod(ClassBuilder clb, ClassDesc >>> className) { >>> 661: MethodTypeDesc desc = MethodT

Re: RFR: 8294961: java.base java.lang.reflect.ProxyGenerator uses ASM to generate proxy classes [v3]

2023-03-09 Thread liach
On Thu, 9 Feb 2023 18:48:19 GMT, Adam Sotona wrote: >> java.base java.lang.reflect.ProxyGenerator uses ASM to generate proxy >> classes and this patch converts it to use Classfile API. >> >> Please review. >> >> Thank you, >> Adam > > Adam Sotona has updated the pull request with a new target

Re: RFR: 8302791: Add specific ClassLoader object to Proxy IllegalArgumentException message

2023-02-21 Thread liach
On Sun, 19 Feb 2023 08:28:37 GMT, Ravali Yatham wrote: > Added specific class loader object to proxy IllegalArgumentException from > which the class was not visible > > The bug report for the same: https://bugs.openjdk.org/browse/JDK-8302791 src/java.base/share/classes/java/lang/reflect/Proxy.

Re: RFR: 8302818: Optimize wrapper sets and immutable sets of Enums [v2]

2023-02-20 Thread liach
On Mon, 20 Feb 2023 13:24:27 GMT, Tingjun Yuan wrote: >> src/java.base/share/classes/java/util/Set.java line 742: >> >>> 740: E e1 = it.next(); >>> 741: if (!it.hasNext()) { >>> 742: return Set.of(e0, e1); >> >> Bad change, doesn't handle e0.equals(e1), and this is g

Re: RFR: 8302818: Optimize wrapper sets and immutable sets of Enums [v2]

2023-02-20 Thread liach
On Mon, 20 Feb 2023 13:15:03 GMT, Tingjun Yuan wrote: >> Currently, the two subclasses of `java.util.EnumSet` optimize bulk >> operations when the argument is also a `EnumSet`, but there is no such >> optimization for wrapper sets (returned by `Collections.unmodifiableSet`, >> `Collections.syn

Re: RFR: 8302822: Method/Field/Constructor/RecordComponent::getGenericInfo() is not thread safe

2023-02-20 Thread liach
On Sun, 19 Feb 2023 18:41:18 GMT, liach wrote: > 8302822: Method/Field/Constructor/RecordComponent::getGenericInfo() is not > thread safe We don't fear calling the factory twice for benign races, as the distinct constructor factory instances are behaviorally the same. The true is

Re: RFR: 8302818: Optimize wrapper sets and immutable sets of Enums

2023-02-20 Thread liach
On Thu, 9 Feb 2023 16:20:31 GMT, Tingjun Yuan wrote: > Currently, the two subclasses of `java.util.EnumSet` optimize bulk operations > when the argument is also a `EnumSet`, but there is no such optimization for > wrapper sets (returned by `Collections.unmodifiableSet`, > `Collections.synchron

RFR: 8302822: Method/Field/Constructor/RecordComponent::getGenericInfo() is not thread safe

2023-02-19 Thread liach
8302822: Method/Field/Constructor/RecordComponent::getGenericInfo() is not thread safe - Commit messages: - 8302822: Method/Field/Constructor/RecordComponent::getGenericInfo() is not thread safe Changes: https://git.openjdk.org/jdk/pull/12643/files Webrev: https://webrevs.openjdk

Re: RFR: 8302154: Hidden classes created by LambdaMetaFactory can't be unloaded [v2]

2023-02-18 Thread liach
On Thu, 9 Feb 2023 18:11:18 GMT, Volker Simonis wrote: >> Prior to >> [JDK-8239384](https://bugs.openjdk.org/browse/JDK-8239384)/[JDK-8238358](https://bugs.openjdk.org/browse/JDK-8238358) >> LambdaMetaFactory has created VM-anonymous classes which could easily be >> unloaded once they were not

Re: RFR: JDK-8296743: Tighten Class.getModifiers spec for array classes [v3]

2022-11-18 Thread liach
On Fri, 18 Nov 2022 18:12:56 GMT, Joe Darcy wrote: >> Update the spec of Class.getModifiers to match long-standing behavior for >> primitive and array classes. Remove unneeded implementation flexibility with >> regard to setting other bit positions. This work was prompted to better >> support

Integrated: 8178355: IdentityHashMap uses identity-based comparison for values everywhere except remove(K,V) and replace(K,V,V)

2022-11-03 Thread liach
On Fri, 15 Apr 2022 05:58:32 GMT, liach wrote: > Explicitly implement `remove` and `replace` in `IdentityHashMap` to compare > values by identity. Updated API documentation of these two methods > ([Preview](https://cr.openjdk.java.net/~liach/8178355/IdentityHashMap.html#remove(java.la

Re: RFR: 8178355: IdentityHashMap uses identity-based comparison for values everywhere except remove(K,V) and replace(K,V,V) [v6]

2022-11-02 Thread liach
On Wed, 5 Oct 2022 03:40:27 GMT, liach wrote: >> Explicitly implement `remove` and `replace` in `IdentityHashMap` to compare >> values by identity. Updated API documentation of these two methods >> ([Preview](https://cr.openjdk.java.net/~liach/8178355/IdentityH

Re: RFR: 8293630: Simplify TreeMap.get() with Comparator.naturalOrder() [v4]

2022-10-17 Thread liach
On Mon, 17 Oct 2022 10:19:26 GMT, Сергей Цыпанов wrote: >> We can use `Comparator.naturalOrder()` for cases when a `TreeMap` instance >> is constructed without comparator. This allows to squash two branches in >> `TreeMap.get()` into one. >> >> P.S. I think the comment of `TreeMap.getEntryUsin

Re: RFR: 8178355: IdentityHashMap uses identity-based comparison for values everywhere except remove(K,V) and replace(K,V,V) [v6]

2022-10-04 Thread liach
On Wed, 5 Oct 2022 03:40:27 GMT, liach wrote: >> Explicitly implement `remove` and `replace` in `IdentityHashMap` to compare >> values by identity. Updated API documentation of these two methods >> ([Preview](https://cr.openjdk.java.net/~liach/8178355/IdentityH

Re: RFR: 8178355: IdentityHashMap uses identity-based comparison for values everywhere except remove(K,V) and replace(K,V,V) [v6]

2022-10-04 Thread liach
> Explicitly implement `remove` and `replace` in `IdentityHashMap` to compare > values by identity. Updated API documentation of these two methods > ([Preview](https://cr.openjdk.java.net/~liach/8178355/IdentityHashMap.html#remove(java.lang.Object,java.lang.Object))) > to mention s

Re: RFR: 8178355: IdentityHashMap uses identity-based comparison for values everywhere except remove(K,V) and replace(K,V,V) [v5]

2022-09-28 Thread liach
> Explicitly implement `remove` and `replace` in `IdentityHashMap` to compare > values by identity. Updated API documentation of these two methods > ([Preview](https://cr.openjdk.java.net/~liach/8178355/IdentityHashMap.html#remove(java.lang.Object,java.lang.Object))) > to mention s

Re: RFR: 8293630: Simplify TreeMap.get() with Comparator.naturalOrder()

2022-09-12 Thread liach
On Wed, 17 Aug 2022 11:23:57 GMT, Сергей Цыпанов wrote: > We can use `Comparator.naturalOrder()` for cases when a `TreeMap` instance is > constructed without comparator. This allows to squash two branches in > `TreeMap.get()` into one. > > P.S. I think the comment of `TreeMap.getEntryUsingComp

Re: RFR: 8178355: IdentityHashMap uses identity-based comparison for values everywhere except remove(K,V) and replace(K,V,V) [v4]

2022-08-30 Thread liach
On Fri, 6 May 2022 22:05:35 GMT, liach wrote: >> Explicitly implement `remove` and `replace` in `IdentityHashMap` to compare >> values by identity. Updated API documentation of these two methods >> ([Preview](https://cr.openjdk.java.net/~liach/8178355/IdentityH

Re: RFR: 8178355: IdentityHashMap uses identity-based comparison for values everywhere except remove(K,V) and replace(K,V,V) [v4]

2022-07-27 Thread liach
On Fri, 6 May 2022 22:05:35 GMT, liach wrote: >> Explicitly implement `remove` and `replace` in `IdentityHashMap` to compare >> values by identity. Updated API documentation of these two methods >> ([Preview](https://cr.openjdk.java.net/~liach/8178355/IdentityH

Re: RFR: 8286849: Use @Stable for generic repositories

2022-07-15 Thread liach
On Tue, 17 May 2022 04:40:50 GMT, liach wrote: > Generic repositories, the implementation detail for generic information in > core reflection, can be updated to use the `@Stable` annotation to replace > their `volatile` access. Their existing accessor code is already safe, > readi

Re: RFR: JDK-8289775: Update java.lang.invoke.MethodHandle[s] to use snippets

2022-07-06 Thread liach
On Tue, 5 Jul 2022 22:22:46 GMT, Joe Darcy wrote: > Update existing examples in java.lang.invoke.{MethodHandle, MethodHandles} > to use snippets rather than the older markup idiom. In addition, I believe we can add link in many examples, but I am not sure if this is part of this issue or if i

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v2]

2022-07-03 Thread liach
On Wed, 22 Jun 2022 21:29:50 GMT, Andrey Turbanov wrote: >> Instead of separate ConcurrentHashMap.get call, we can use result of >> previous putIfAbsent call. > > Andrey Turbanov has updated the pull request incrementally with one > additional commit since the last revision: > > 8288723: Avo

Re: RFR: 8288327: Executable.hasRealParameterData should not be volatile [v7]

2022-07-03 Thread liach
On Fri, 1 Jul 2022 20:39:49 GMT, Сергей Цыпанов wrote: >> @Stable is only effective if the path leading to @Stable value can be >> constant-folded by JIT. In above test, you have an instance field Method >> method. This can not be constant-folded, so neither can @stable fiels in the >> Field o

Re: RFR: 8288327: Executable.hasRealParameterData should not be volatile [v4]

2022-06-29 Thread liach
On Fri, 17 Jun 2022 11:21:49 GMT, Сергей Цыпанов wrote: >> If there are two threads calling `Executable.hasRealParameterData()` under >> race and the first one writes into volatile `Executable.parameters` field >> (doing _releasing store_) and the second thread reads non-null value from >> the

Integrated: 8284942: Proxy building can just iterate superinterfaces once

2022-06-29 Thread liach
On Mon, 18 Apr 2022 06:15:54 GMT, liach wrote: > Currently, in ProxyBuilder::mapToModule and ProxyBuilder::defineProxyClass, > the interfaces are iterated twice. The two passes can be merged into one, > yielding the whole proxy definition context (module, package, whether there

Re: RFR: 8178355: IdentityHashMap uses identity-based comparison for values everywhere except remove(K,V) and replace(K,V,V) [v4]

2022-06-29 Thread liach
On Fri, 6 May 2022 22:05:35 GMT, liach wrote: >> Explicitly implement `remove` and `replace` in `IdentityHashMap` to compare >> values by identity. Updated API documentation of these two methods >> ([Preview](https://cr.openjdk.java.net/~liach/8178355/IdentityH

Re: RFR: 8284942: Proxy building can just iterate superinterfaces once [v6]

2022-06-28 Thread liach
On Thu, 26 May 2022 23:20:27 GMT, liach wrote: >> Currently, in ProxyBuilder::mapToModule and ProxyBuilder::defineProxyClass, >> the interfaces are iterated twice. The two passes can be merged into one, >> yielding the whole proxy definition context (module, package, w

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time

2022-06-21 Thread liach
lem, I would >> prefer szegedi's suggestion. > > @liach advance apologies for nitpicking: `ConcurrentHashMap` doesn't in > general block while the mapping function runs. It can block _some_ concurrent > updates, namely those that [hash to the same > bin](https://u

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time

2022-06-20 Thread liach
On Mon, 20 Jun 2022 09:11:31 GMT, Attila Szegedi wrote: >> Instead of separate ConcurrentHashMap.get call, we can use result of >> previous putIfAbsent call. > > src/java.base/share/classes/java/time/format/DateTimeTextProvider.java line > 319: > >> 317: store = prev; >> 318:

Re: RFR: 8288327: Executable.hasRealParameterData should not be volatile [v4]

2022-06-17 Thread liach
he `ParameterData.parameters` field can probably be marked as [`@Stable`] >> (since the `parameters` array is never modified): >> Suggestion: >> >> record ParameterData(@Stable Parameter[] parameters, boolean real) {} >> >> >> Also the `real` record 

Re: RFR: 8288327: Executable.hasRealParameterData should not be volatile [v2]

2022-06-16 Thread liach
On Fri, 17 Jun 2022 06:14:32 GMT, liach wrote: >> src/java.base/share/classes/java/lang/reflect/Executable.java line 453: >> >>> 451: >>> 452: private transient boolean hasRealParameterData; >>> 453: private transient volatile Parameter[] p

Re: RFR: 8288327: Executable.hasRealParameterData should not be volatile [v2]

2022-06-16 Thread liach
On Fri, 17 Jun 2022 05:34:25 GMT, ExE Boss wrote: >> Сергей Цыпанов has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8288327: Add clarifying comments > > src/java.base/share/classes/java/lang/reflect/Executable.java line 453: > >> 451: