Escape Analysis on Trace Trees Revisited (Again)

We did more work on the escape analysis algorithm today. We realized that PHI updates in trace tails are essentially just another form of store, and thus we simply treat context slots as just another form of object. As such, it can be either captured or escaping. Context “objects” escape when we see a load of a reference from them. Since we can’t figure out where the reference the load instruction loads originated from, we flag the entire context as escaping, and during the next data flow analysis iteration any store to this context will let the stored reference escape.

At the same time we have eliminated the loop containment check from the algorithm. It turns out that for the purpose of our load elimination pass its sufficient to know that objects don’t escape into memory. For the allocation site hoisting, on the other hand, we will need confirmation that any object allocation in the loop doesn’t overlap with its own copies created during previous loop iterations. This can happen when references are passed around along the loop edges. We will integrate this check directly into the allocation site hoisting algorithm.