On Fri, 27 May 2022 14:18:19 GMT, Claes Redestad <redes...@openjdk.org> wrote:

> In preparation of #8855 this PR refactors the conversions from `List` to 
> array and array to `List`, reducing the number of conversions when calling 
> `MethodHandles.dropArguments` in particular. This remove about ~5% of 
> allocations on the `StringConcatFactoryBootstraps` microbenchmark.

It might be a bit too paranoid in this instance (since we don't keep the array 
around for long), but not cloning the result of calling `toArray` on an 
arbitrary and possibly adversary `List` could open up for TOCTOU race bugs / 
attacks. The existing code was being paranoid and copying and I don't want to 
weaken something that could have security implications without double- and 
triple-checking that it's safe to do so.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8923

Reply via email to