[swift-dev] State of Semantic ARC?
bob.wilson at apple.com
Sun Jul 9 20:44:46 CDT 2017
> On Jul 8, 2017, at 10:36 AM, Johannes Weiß via swift-dev <swift-dev at swift.org> wrote:
> Hi swift-dev,
> I haven't heard anything about semantic ARC and couldn't really find much documentation besides https://gottesmm.github.io/proposals/high-level-arc-memory-operations.html . So I wanted to ask how much of it is implemented and what the plan for Swift 4/5 regarding Semantic ARC is.
> — Johannes
During the course of Swift 4 development, we realized that there were other changes that we wanted to make for SIL to preserve semantic information, besides the changes initially proposed for improving ARC optimizations. In particular, there were some important changes for memory ownership and the handling of opaque “address-only” values. Thus, we renamed the project to “Semantic SIL” instead of “Semantic ARC”. But that’s just the project name….
Michael may want to chime in here with more details, but the basic status is that the planned changes for high-level memory operations and ownership are done and included in Swift 4. There is a verifier that detects violations of the model and has already caught a number of serious bugs. However, the new form of SIL is transformed back to the old form early in the SIL optimizer pipeline (see the sil-ownership-model-eliminator pass). We will be gradually updating more of the optimizer to work with the new form of SIL, and moving the sil-ownership-model-eliminator pass later in the pipeline. Michael is currently working to get all the mandatory passes updated. These changes will not be in Swift 4. Revising the ARC optimizer to take advantage of the new information will be one of the later steps and it is unclear when that work will be done — it may end up being split into some incremental steps.
The other big part of Semantic SIL is changing to represent opaque “address-only” values as SSA values in SIL. Much of the groundwork for that is done (e.g., the address-lowering SIL pass) but it is disabled for Swift 4. We’re hoping to resume work on this soon.
More information about the swift-dev