Intermediate writes to array slot not eliminated by optimizer
Vitaly Davidovich
vitalyd at gmail.com
Tue May 12 17:05:08 UTC 2015
Anyone? :)
Thanks
On Mon, May 11, 2015 at 8:25 PM, Vitaly Davidovich <vitalyd at gmail.com>
wrote:
> Hi guys,
>
> Suppose we have the following code:
>
> private static final long[] ARR = new long[10];
> private static final int ITERATIONS = 500 * 1000 * 1000;
>
>
> static void loop() {
> int i = ITERATIONS;
> while(--i >= 0) {
> ARR[4] = i;
> }
> }
>
> My expectation would be that loop() effectively compiles to:
> ARR[4] = 0;
> ret;
>
> However, an actual loop is compiled. This example is a reduction of a
> slightly more involved case that I had in mind, but I'm curious if I'm
> missing something here.
>
> I tested this with 8u40 and tiered compilation disabled, for what it's
> worth.
>
> Thanks
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20150512/08765c3e/attachment.html>
More information about the hotspot-compiler-dev
mailing list