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
- For each
Futureedge where the source node is in :- Change the source node from to
2. Label Lifetime Projections for Pre-State
Label projections in to become in the graph:
- For each :
- 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:
- Let be union of and the lifetime projections in
- For each in :
- Let contain each lifetime projection where outlives the lifetime of
- If is not empty, add the abstraction edge to the PCG