Transient miscompilation problem on 1.8 (invalid AIOOB/NPE thrown from the method body).

Dawid Weiss dawid.weiss at
Tue Aug 11 14:25:48 UTC 2015


We have encountered a transient miscompilation problem (on 1.8u40). We
get an AIOOB exception from a snippet of code which (provably) cannot
throw it. The AIOOB is thrown without a stack trace. What's
interesting is that when we set:


we get an NPE exception (which, again, is provably impossible at Java
code level).

The problem does not reproduce on my machine with i7 3770K (at least
so far), but does reproduce consistently on i7 2600K (and our
customer's machine; exact spec unknown).

I will be looking into isolating this issue as it is in our
proprietary code, but the pattern seems to be as follows:

1) new instance of A is created, with a new instance of B, which is a
single-implementation of interface C.

2) there is a tight loop which calls A (and B) methods.

There is no way for an AIOOB (or NPE) to be present in any of A or B,
but the stack trace indicates A.

I suspect an OSR miscompilation somewhere, but since I can't reproduce
it locally it's a bit of a problem to experiment with JVM versions and
internal flags.

Any hints on what it can be related to (flags to try, etc.) would be


More information about the hotspot-compiler-dev mailing list