Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v6]

2023-04-07 Thread Jorn Vernee
On Thu, 6 Apr 2023 17:50:58 GMT, Chen Liang wrote: >> It looks like Proxy forcibly adds reads and exports edges from the module of >> the target interface to the module that defines the proxy: >> https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/reflect/Proxy.java

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v10]

2023-04-07 Thread Chen Liang
> As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does not allow future expansion to support SAM[^1] abstrac

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v9]

2023-04-07 Thread Chen Liang
On Fri, 7 Apr 2023 12:54:01 GMT, ExE Boss wrote: > The **JVM** spec doesn’t mention that anywhere though. I don't think JVMS mentions hidden classes at all. You have to refer to the specification of Lookup.defineHiddenClass, as hidden classes were originated from VM anonymous classes added bac

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v9]

2023-04-07 Thread ExE Boss
On Fri, 7 Apr 2023 11:41:52 GMT, Johannes Kuhn wrote: >> src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line >> 317: >> >>> 315: cob.aload(1); >>> 316: cob.invokevirtual(CD_MethodHandles_Lookup, >>> "lookupClass", MTD_Class); >>> 317:

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v9]

2023-04-07 Thread Johannes Kuhn
On Fri, 7 Apr 2023 11:20:12 GMT, ExE Boss wrote: > that can’t refer to hidden classes No, that is exactly the **one and only thing** that can refer to the hidden class: > * On any attempt to resolve the entry in the run-time constant pool indicated > by `this_class`, the symbolic reference is

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v9]

2023-04-07 Thread ExE Boss
On Thu, 6 Apr 2023 20:47:10 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v8]

2023-04-06 Thread Chen Liang
On Thu, 6 Apr 2023 19:33:51 GMT, Johannes Kuhn wrote: >> This is good work.This needs some careful study on the security aspect. >> I see the proxy class is in the same module of the interface, is non-public, >> and it has a no-arg non-public constructor. >> >> Defining the proxy class i

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v9]

2023-04-06 Thread Mandy Chung
On Thu, 6 Apr 2023 20:47:10 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v4]

2023-04-06 Thread Jorn Vernee
On Thu, 6 Apr 2023 17:56:23 GMT, Mandy Chung wrote: >> src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line >> 213: >> >>> 211: .defineClassAsLookup(true, List.of(mhs)); >>> 212: proxy = lookup.findConstructor(lookup.lookupClass(), >>> meth

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v9]

2023-04-06 Thread Mandy Chung
On Thu, 6 Apr 2023 20:47:10 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v9]

2023-04-06 Thread Chen Liang
On Thu, 6 Apr 2023 20:47:10 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v9]

2023-04-06 Thread Chen Liang
> As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does not allow future expansion to support SAM[^1] abstrac

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v7]

2023-04-06 Thread Jorn Vernee
On Thu, 6 Apr 2023 18:27:33 GMT, Chen Liang wrote: > I ran with make test TEST="test/jdk/java/lang/invoke/MethodHandleProxies". > The scratch's subdirectories (corresponding to processors) are all empty. The contents of the scratch directory is only saved if the test fails. Maybe it's not that

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v8]

2023-04-06 Thread Mandy Chung
On Thu, 6 Apr 2023 18:33:29 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v8]

2023-04-06 Thread Johannes Kuhn
On Thu, 6 Apr 2023 19:22:56 GMT, Mandy Chung wrote: > This seems a concern if the target method handle should not have access to > the class in that module. MethodHandle access is checked when the MethodHandle is created. For `@CallerSensitive` methods, the MethodHandle is additionally bound

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v8]

2023-04-06 Thread Mandy Chung
On Thu, 6 Apr 2023 18:33:29 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v8]

2023-04-06 Thread Rémi Forax
On Thu, 6 Apr 2023 18:33:29 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v7]

2023-04-06 Thread Chen Liang
On Thu, 6 Apr 2023 18:09:33 GMT, Mandy Chung wrote: > If you run the test with the system property on, it's dumped in the scratch > directory. Do you run with jtreg command? I ran with `make test TEST="test/jdk/java/lang/invoke/MethodHandleProxies"`. The scratch's subdirectories (corresponding

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v8]

2023-04-06 Thread Chen Liang
> As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does not allow future expansion to support SAM[^1] abstrac

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-04-06 Thread Mandy Chung
On Thu, 6 Apr 2023 18:04:49 GMT, Chen Liang wrote: > It appears the default class hierarchy resolver cannot be used to generates > stack maps with only the FilePermission required by JTReg granted. what permission does it need? - PR Comment: https://git.openjdk.org/jdk/pull/13197#

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v7]

2023-04-06 Thread Mandy Chung
On Thu, 6 Apr 2023 17:18:22 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-04-06 Thread Chen Liang
On Wed, 5 Apr 2023 17:59:24 GMT, Johannes Kuhn wrote: >>> I think it should be possible to spin the class bytes once, stick the >>> result in a ClassValue cache, but then use the bytes to define multiple >>> classes with different class data (MethodHandles). >> >> Great point, I was dumbfounde

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v6]

2023-04-06 Thread Jorn Vernee
On Thu, 6 Apr 2023 18:03:09 GMT, Chen Liang wrote: >> test/micro/org/openjdk/bench/java/lang/invoke/MethodHandleProxiesAsIFInstanceCall.java >> line 176: >> >>> 174: public void constantLambda() { >>> 175: i = constantLambda.doWork(i); >>> 176: } >> >> I think setting the resul

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v6]

2023-04-06 Thread Chen Liang
On Thu, 6 Apr 2023 17:08:33 GMT, Jorn Vernee wrote: >> Chen Liang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Whitespace, cleanup, rename benchmarks to be informative > > test/micro/org/openjdk/bench/java/lang/invoke/MethodHandleProx

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-04-06 Thread Chen Liang
On Thu, 6 Apr 2023 17:51:27 GMT, Mandy Chung wrote: >>> The interface access may be problematic: A non-exported interface Class >>> object can be obtained via Reflection inspection on exported types, such as >>> java packages and jdk.internal packages. >>> >>> * In that case, it might not

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v4]

2023-04-06 Thread Mandy Chung
On Wed, 5 Apr 2023 13:22:30 GMT, Jorn Vernee wrote: >> Chen Liang has updated the pull request with a new target base due to a >> merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains 13 additional >> commits since

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v6]

2023-04-06 Thread Chen Liang
On Thu, 6 Apr 2023 17:27:14 GMT, Jorn Vernee wrote: >> An other possibility to to add some key into the ClassData that can't be >> imitated - such as the `InterfaceInfo` itself. >> An `instanceof` check on the ClassData at a fixed position could then >> determine if is a MHP. > > It looks lik

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-04-06 Thread Mandy Chung
On Wed, 5 Apr 2023 17:59:24 GMT, Johannes Kuhn wrote: >>> I think it should be possible to spin the class bytes once, stick the >>> result in a ClassValue cache, but then use the bytes to define multiple >>> classes with different class data (MethodHandles). >> >> Great point, I was dumbfounde

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v7]

2023-04-06 Thread Jorn Vernee
On Thu, 6 Apr 2023 17:18:22 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v6]

2023-04-06 Thread Jorn Vernee
On Thu, 6 Apr 2023 17:04:02 GMT, Johannes Kuhn wrote: >> I don't think that's good enough. If an instance implements an interface >> that just happens to also have an entry in the INTERFACE_INFOS cache, then >> e.g. `MethodHandleProxies::wrapperInstanceTarget` could be used to retrieve >> the

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v6]

2023-04-06 Thread Jorn Vernee
On Thu, 6 Apr 2023 03:44:07 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v7]

2023-04-06 Thread Jorn Vernee
On Thu, 6 Apr 2023 17:18:22 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v7]

2023-04-06 Thread Chen Liang
> As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does not allow future expansion to support SAM[^1] abstrac

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v6]

2023-04-06 Thread Johannes Kuhn
On Thu, 6 Apr 2023 16:58:43 GMT, Jorn Vernee wrote: >> Guess I will just nuke the annotation and check for its implemented clause >> instead. > > I don't think that's good enough. If an instance implements an interface that > just happens to also have an entry in the INTERFACE_INFOS cache, then

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v6]

2023-04-06 Thread Jorn Vernee
On Thu, 6 Apr 2023 16:24:10 GMT, Chen Liang wrote: >> Sorry, you are supposed to run it with an installed `SecurityManager` of >> course. >> With an installed `SecurityManager` you should not be able to access classes >> in `sun.misc`. > > Guess I will just nuke the annotation and check for i

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v6]

2023-04-06 Thread Chen Liang
On Thu, 6 Apr 2023 16:15:16 GMT, Johannes Kuhn wrote: >> I'm not sure how the example shows that this is a security vulnerability? It >> still works fine without the call to `isWrapperInstance` (even if you switch >> to using jdk.internal.misc.Unsafe.class, although that also requires >> `--ad

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v6]

2023-04-06 Thread Johannes Kuhn
On Thu, 6 Apr 2023 16:13:38 GMT, Jorn Vernee wrote: >> src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line >> 284: >> >>> 282: return >>> type.getDeclaredAnnotation(WrapperInstance.class); >>> 283: } >>> 284: }) : type.getD

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v6]

2023-04-06 Thread Jorn Vernee
On Thu, 6 Apr 2023 15:57:33 GMT, Johannes Kuhn wrote: >> Chen Liang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Whitespace, cleanup, rename benchmarks to be informative > > src/java.base/share/classes/java/lang/invoke/MethodHandlePro

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v6]

2023-04-06 Thread Johannes Kuhn
On Thu, 6 Apr 2023 03:44:07 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v4]

2023-04-05 Thread Chen Liang
On Wed, 5 Apr 2023 16:30:06 GMT, Jorn Vernee wrote: > I think this change needs a CSR as well to document the change in behavior. > If an application currently calls asInterfaceInstance many times for the same > interface, the amount of classes generated will increase (potentially a lot). Crea

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v6]

2023-04-05 Thread Chen Liang
> As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does not allow future expansion to support SAM[^1] abstrac

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v5]

2023-04-05 Thread Chen Liang
> As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does not allow future expansion to support SAM[^1] abstrac

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-04-05 Thread Chen Liang
On Wed, 5 Apr 2023 17:59:24 GMT, Johannes Kuhn wrote: >>> I think it should be possible to spin the class bytes once, stick the >>> result in a ClassValue cache, but then use the bytes to define multiple >>> classes with different class data (MethodHandles). >> >> Great point, I was dumbfounde

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v4]

2023-04-05 Thread Jorn Vernee
On Wed, 5 Apr 2023 18:28:15 GMT, Chen Liang wrote: >> src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line >> 225: >> >>> 223: private record LocalMethodInfo(MethodTypeDesc desc, >>> List thrown) {} >>> 224: >>> 225: private record InterfaceInfo(@Stable MethodTyp

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v4]

2023-04-05 Thread Chen Liang
On Wed, 5 Apr 2023 13:22:30 GMT, Jorn Vernee wrote: >> Chen Liang has updated the pull request with a new target base due to a >> merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains 13 additional >> commits since

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-04-05 Thread Johannes Kuhn
On Tue, 28 Mar 2023 14:34:19 GMT, Chen Liang wrote: > The interface access may be problematic: A non-exported interface Class > object can be obtained via Reflection inspection on exported types, such as > java packages and jdk.internal packages. > > * In that case, it might not be of best

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v4]

2023-04-05 Thread Jorn Vernee
On Wed, 5 Apr 2023 04:50:04 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v4]

2023-04-04 Thread Chen Liang
> As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does not allow future expansion to support SAM[^1] abstrac

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v3]

2023-03-28 Thread Chen Liang
On Tue, 28 Mar 2023 10:57:28 GMT, Rémi Forax wrote: >> Chen Liang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> rethrow error > > src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line > 206: > >> 204: try

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v3]

2023-03-28 Thread Chen Liang
> As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does not allow future expansion to support SAM[^1] abstrac

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Chen Liang
On Mon, 27 Mar 2023 23:34:52 GMT, Chen Liang wrote: > As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v2]

2023-03-28 Thread Chen Liang
> As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does not allow future expansion to support SAM[^1] abstrac

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v2]

2023-03-28 Thread Chen Liang
On Wed, 29 Mar 2023 00:31:46 GMT, Johannes Kuhn wrote: >> Do interfaces still implement these properly without definition if they >> extend interfaces that declare `@Override boolean equals();` etc.? > > Yes. You can use [`Comperator`][1] as test. > > [1]: > https://docs.oracle.com/en/java/ja

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Johannes Kuhn
On Wed, 29 Mar 2023 00:25:09 GMT, Chen Liang wrote: >> src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line >> 338: >> >>> 336: .aload(1) >>> 337: .ifThenElse(Opcode.IF_ACMPEQ, >>> CodeBuilder::iconst_1, CodeBuilder::iconst_0) >>> 3

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Chen Liang
On Wed, 29 Mar 2023 00:13:56 GMT, Johannes Kuhn wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >>

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Johannes Kuhn
On Mon, 27 Mar 2023 23:34:52 GMT, Chen Liang wrote: > As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Chen Liang
On Mon, 27 Mar 2023 23:34:52 GMT, Chen Liang wrote: > As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Chen Liang
On Tue, 28 Mar 2023 14:00:41 GMT, Jorn Vernee wrote: > But this doesn't implement the same ClassValue cache? And spinning byte code > can indeed be slow (I've seen this in other profiles). https://github.com/liachmodded/jdk/commit/821d6b382aeceb70c67c59771deb7438f3b4b7fd I attempted to spin on

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Chen Liang
On Tue, 28 Mar 2023 14:00:41 GMT, Jorn Vernee wrote: > I think it should be possible to spin the class bytes once, stick the result > in a ClassValue cache, but then use the bytes to define multiple classes with > different class data (MethodHandles). Great point, I was dumbfounded there. > L

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Jorn Vernee
On Mon, 27 Mar 2023 23:34:52 GMT, Chen Liang wrote: > As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Jorn Vernee
On Tue, 28 Mar 2023 13:34:05 GMT, Chen Liang wrote: > > > I believe you can have better performance if you pass the method handle as > > the class data of the hidden class and you load it with a constant dynamic > > [https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/inv

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Chen Liang
On Mon, 27 Mar 2023 23:34:52 GMT, Chen Liang wrote: > As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Rémi Forax
On Mon, 27 Mar 2023 23:34:52 GMT, Chen Liang wrote: > As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Rémi Forax
On Mon, 27 Mar 2023 23:34:52 GMT, Chen Liang wrote: > As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Rémi Forax
On Mon, 27 Mar 2023 23:34:52 GMT, Chen Liang wrote: > As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does

RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-27 Thread Chen Liang
As John Rose has pointed out in this issue, the current j.l.r.Proxy based implementation of MethodHandleProxies.asInterface has a few issues: 1. Exposes too much information via Proxy supertype (and WrapperInstance interface) 2. Does not allow future expansion to support SAM[^1] abstract classes