ace icon indicating copy to clipboard operation
ace copied to clipboard

Escape analysis

Open wbbradley opened this issue 6 years ago • 0 comments

Escape analysis

Goal: Implement escape analysis in order to avoid unnecessary heap allocations.

After translation, before gen phase, add a phase to annotate heap-exprs.

Escape phase

  1. Build a usage graph of exprs.
  2. Find all exprs that have usage links to return statements or towards heap-marked exprs.
  3. For any tuples that link to return statements, mark them as heap.
  4. Goto 2 until no more exprs are marked.

During gen phase, pay attention to heap-marks on tuples.

wbbradley avatar Jun 08 '19 03:06 wbbradley