Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Function Calls

Consider a function call at location . Each is an operand of the form move p | copy p | const c. Let be the set of moved operand places.

The function call abstraction is created in the PostMain evalution stage, after all of the operands have been evaluated. Therefore, all places in are labelled, as they have been moved-out by this point.

Algorithm

Let be the set of lifetime projections in (that is, obtained from places in , regardless of whether they are already in the graph). For any place , we define as the place .

We define the set of lifetime projections of the moved-out operands as .

We define the "pre-call states" of as .

We define the "post-call states" of as

The definitions of sets , , , and do not depend on the nodes present in the PCG. In general, we postulate that following invariants should always hold:

  • Only the nodes in are in the graph at the end of stage
  • Only the nodes in are in the graph at the end of the stage
  • Only the nodes in are in the graph at the end of the stage

1. Redirect Future Nodes

This follows the standard process, e.g. similar to borrows and borrow PCG expansions

  1. For each Future edge where the source node is in :
    1. Change the source node from to

2. Label Lifetime Projections for Pre-State

Label projections in to become in the graph:

  1. For each :
    1. Label the with

3. Add Abstraction Edges

At a high level we construct by connecting lifetime projections to the lifetime projections in and the lifetime projections in , where connections are made based on outlives constraints. Concretely:

  1. Let be union of and the lifetime projections in
  2. For each in :
    1. Let contain each lifetime projection where outlives the lifetime of
    2. If is not empty, add the abstraction edge to the PCG