RFR(S): 8069191: moving predicate out of loops may cause array accesses to bypass null check

Roland Westrelin roland.westrelin at oracle.com
Fri Apr 17 08:16:13 UTC 2015


Thanks for taking another look at this.

> And, along those lines, I'm having trouble imagining examples of controls that are *not* retained, let along understand why they are less important than Regions (OK, those are always important), and If-projections.  Why not (for example) catch projections?

I noticed this:

1- CastPP nodes don’t always have a control
2- some CastPP nodes depend on a Region because the test was moved to the branch of a dominating If
3- the test for some CastPP’s nodes are removed during escape analysis

In compile.cpp:

n->in(0) != NULL is 1-
n->in(0)->is_Region() is 2-
n->in(0)->in(0) != NULL && n->in(0)->in(0)->is_If() is 3-

What we want to avoid I think is: the test for a CastPP is optimized out but the CastPP is not and it has its control set to something that is no longer a test. If that something is in the middle of a block then during gcm we can’t determine whether a precedence edge’s control dominates a memory operation’s control because they could both be in the same block. This said, gcm has this test:

138         if (m->is_block_proj() || m->is_block_start()) {

which filters out those cases where m would be in the middle of a block. So I guess the test in compile.cpp could simply be n->in(0) != NULL

Roland.


More information about the hotspot-compiler-dev mailing list