Implement escape analysis and stack allocation of non-box objects without gc fields.
This change implements a conservative flow-insensitive escape analysis and stack allocation
of non-box objects without gc fields.
Handling of objects with gc fields, box objects, and fixed-size arrays is future work.
Escape analysis is based on the one described here: https://www.cc.gatech.edu/~harrold/6340/cs6340_fall2009/Readings/choi99escape.pdf
Main limitations of this version of the escape analysis:
1. The analysis is flow-insensitive.
2. The analysis is intra-procedural and only sees the current method and the inlined methods.
3. The analysis assumes that references passed to non-pure-helper calls escape.
4. The analysis assumes that any references assigned to fields of objects escape.
Some of these limitations will be removed in future work.
I started with prior prototypes from @echesakovMSFT and @AndyAyersMS and extended and refactored
parts of them.
I also added tests for cases that are currently handled or will be handled soon.
12 files changed: