scalar replacement of arrays affected by minor changes to surrounding code

Roland Westrelin rwestrel at redhat.com
Tue Sep 24 14:31:49 UTC 2019


> I tried this:
>
>     @Benchmark
>     public void wrappedUnrolledSum2(Blackhole bh) {
>         int[] arr = new int[] { next(), next() };
>         ArrayWrapper wrapper = new ArrayWrapper();
>         wrapper.setArr(arr);
>         bh.consume(wrapper.unrolledSum());
>     }
>
> The field assignment is right after the ArrayWrapper allocation. That's
> not the case with the bytecodes that javac produces for
> wrappedUnrolledSum. That didn't work either. C2 does try to eliminate
> the field zeroing but then it fails too (because
> InitializeNode::detect_init_independence() bails out because the IR is
> too complicated).

I filed JDK-8231412 for that one.

Roland.


More information about the hotspot-compiler-dev mailing list