RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]
John R Rose
jrose at openjdk.org
Mon May 1 22:15:22 UTC 2023
On Mon, 1 May 2023 21:37:07 GMT, Johannes Kuhn <jkuhn at openjdk.org> 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 method I’m thinking of would not be a security problem; it just checks inputs, and cannot be overridden by an attacker to capture those inputs.
> But for the JIT to constant fold, it has to inline the invokeinterface target.
That happens due to type profiling and type inference. It’s reasonably common. That is one reason to make as few classes as possible, since profiling and inferencing overflows quickly when there are many implementation classes. Having just one HC means that, if the user is passing only “that sort” of interface impl (a MH proxy) then it will inline, as long as there is only one HC (with many instances).
I haven’t looked at the proxy code lately but I imagine that it minimizes the number of spun classes for similar reasons.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13197#issuecomment-1530415350
More information about the core-libs-dev
mailing list