[14] RFR(S): 8234616: assert(0 <= i && i < _len) failed: illegal index in PhaseMacroExpand::expand_macro_nodes()

Tobias Hartmann tobias.hartmann at oracle.com
Tue Dec 3 15:10:34 UTC 2019


Hi,

please review the following patch:
https://bugs.openjdk.java.net/browse/JDK-8234616
http://cr.openjdk.java.net/~thartmann/8234616/webrev.00/

We assert in PhaseMacroExpand::expand_macro_nodes() when accessing the macro_node array because
'macro_idx' is out of the upper bound:
https://hg.openjdk.java.net/jdk/jdk/file/43c4fb8ba96b/src/hotspot/share/opto/macro.cpp#l2591

The problem is that in the previous iteration, we hit the following code path which removes an
unreachable macro node but does not decrement 'macro_idx':
https://hg.openjdk.java.net/jdk/jdk/file/43c4fb8ba96b/src/hotspot/share/opto/macro.cpp#l2594

The problem was introduced in JDK 14 by the fix for JDK-8227384:
https://hg.openjdk.java.net/jdk/jdk/rev/43c4fb8ba96b#l3.25

I've changed the loop to a for-loop to make sure the index is always decremented and also
strengthened the asserts. I was not able to create a regression test but the issue reproduces
intermittently with Lucene.

Thanks,
Tobias


More information about the hotspot-compiler-dev mailing list