forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[loop-arc] Instead of using a lambda, use a callback data structure t…
…o process ARC results. This is necessary since previously we would: 1. Perform data flow over an entire function. 2. Process all of the gathered data, inserting instructions to be deleted into a list to avoid dangling pointer issues. 3. Delete instructions after processing the data to avoid the dangling pointer issues. 4. If we saw any nested retain/releases and deleted any instructions, run ARC again on the entire function. For loop arc, we want to: 1. Visit the loop nest in post order. 2. For each loop: a. Perform data flow over the loop. b. Process all of the gathered data, inserting instructions to be deleted into a list to avoid dangling pointer issues. c. Delete instructions after loop processing has finished and potentially summarize the loop. d. If we saw any nested retain/releases and deleted any instructions, run ARC again on the loop. This is more efficient in terms of the number of times that we perform dataflow and allows us to summarize as we go. The main disadvantage is that Block ARC steps (3,4) could occur in GlobalARCOpts.cpp. Loop ARC on the other hand needs (2.c.) and (2.d.) to occur while processing. This means I need a real callback context and an extra callback call to say when it is ok for a user of the analysis to remove instructions. rdar://22238658 * The dangling pointer issue is that a retain/release could act as a last use/first decrement for a different retain/release. If process the different retain/release later, we will be touching a dangling pointer. Swift SVN r32867
- Loading branch information
Showing
3 changed files
with
81 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters