On Fri, 1 Jul 2022 10:38:53 GMT, Peter Levart <plev...@openjdk.org> wrote:

>> Right, in that case, it should remain.
>
> But, ... is any code path accessing the elements of the @Stable array by 
> constant indexes? Only in that case would the annotation have any effect on 
> the JIT-ed code. Otherwise it's just a waste of space.

... I can only see the array being cloned and not accessed directly. I don't 
belive cloning a @stable array is any different in JIT-ed code as cloning 
normal "mutable" array unless JIT "sees" through it and scalarizes the values 
of the cloned array. For example, if you have the following:


static final Method method = ....;

@Benchmark
public Object getParameter0() {
  return method.getParameters()[0];
}


...would it run faster when the parameters field was marked as @stable as 
opposed to not?

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

PR: https://git.openjdk.org/jdk/pull/9143

Reply via email to