Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-02 Thread Chen Liang
On Mon, 1 May 2023 14:56:27 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: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-02 Thread John R Rose
On Mon, 1 May 2023 22:23:11 GMT, Chen Liang wrote: > It had an invocation performance of 2ns/op as opposed to Proxy's 6ns/op, but > the condy implementation has 0.41ns/op. Good, so let’s take the win relative to 6ns/op metric. The condy implementation devotes a whole class to a single MH, so i

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-02 Thread Chen Liang
On Tue, 2 May 2023 13:19:55 GMT, ExE Boss 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 24 additional >> commits since th

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-02 Thread ExE Boss
On Mon, 1 May 2023 14:56:27 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: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-02 Thread Rémi Forax
On Mon, 1 May 2023 14:56:27 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: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-01 Thread Jorn Vernee
On Mon, 1 May 2023 22:25:31 GMT, Jorn Vernee wrote: > Type profiling works for the HC type we define, we inline `HC::foo`, and find > that: hey, in HC::foo's implementation, the target MH is constant, so we can > inline through that as well. Giving us once again, optimal performance. My fear i

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-01 Thread Jorn Vernee
On Mon, 1 May 2023 21:00:40 GMT, John R Rose wrote: > HC fields are supposed to fold up; if they don’t we can help them in this > case. (That is, constant folding of the MH pointer should not be a roadblock; > that’s on the JIT to fix by adjusting the TrustFinalFields logic.) The issue with th

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-01 Thread Johannes Kuhn
On Mon, 1 May 2023 22:11:58 GMT, John R Rose wrote: > JDK platform code Yes. This works if the class is in a non-user module. Otherwise exporting an internal package would expose that to user-code as well. `java.lang.reflect.Proxy` does need to inject the proxy class into user-packages if on

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-01 Thread Chen Liang
On Mon, 1 May 2023 21:00:40 GMT, John R Rose wrote: > I think you could do this by having the HC have a final non-static field for > each required MH (one per overload point); each os an asType adaptation of > the original MH. The actual code of each HC implementation method would be a > singl

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-01 Thread John R Rose
On Mon, 1 May 2023 21:37:07 GMT, Johannes Kuhn wrote: > `assertOriginalLookupOf` Yes, that’s the sort of thing I’d expect. It could go into a `jdk.internal.reflect` class. Now that we have modules, JDK platform code can use public APIs not accessible to normal users. Also, the static helper

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-01 Thread Johannes Kuhn
On Mon, 1 May 2023 21:00:40 GMT, John R Rose 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 24 additional >> commits since

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-01 Thread John R Rose
On Mon, 1 May 2023 14:56:27 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: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-01 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