Support passing captures by-value to subgraphs #407
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When preparing the capture environment to pass to an operator with subgraphs, if a captured value is not going to be needed by subsequent operators in the current graph then it can be passed by value rather than by reference. In the subgraph, this allows the value to be (potentially) used as an in-place input.
Pass
CaptureEnv
toGraph::run_subgraph
by value rather than by referenceAdd map of by-value captures to
CaptureEnv
Add
CaptureEnv::child
method which creates a child environment with no captures of its own. This is not currently used but will be needed by loop operators which run a subgraph more than once and need to obtain a fresh capture environment for each iteration.Part of #399.