State of Semantic ARC?


(Johannes Weiss) #1

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


(Michael Gottesman) #2

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.

Many of Semantic ARC's changes were in Swift 4, but we did not turn on the ownership verifier for Swift 4. This is because getting the stdlib to pass the verifier (a constraint for turning it on for non-stdlib code) would have been too disruptive at that time to land. The overall plan is to continue working on Semantic ARC (If you look at the commits list, I have been landing code for it recently). In fact, I just got stdlibCore (*note*, not the entire stdlib) to pass the ownership verifier, so progress is being made.

Did I answer your question?

Michael

···

On Jul 8, 2017, at 10:36 AM, Johannes Weiß via swift-dev <swift-dev@swift.org> wrote:

-- Johannes
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev


(Bob Wilson) #3

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.

···

On Jul 8, 2017, at 10:36 AM, Johannes Weiß via swift-dev <swift-dev@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


(Johannes Weiss) #4

Hi Michael and Bob,

Thanks very much, that's really cool.

Will a future version of Swift gain new annotations to control ownership directly within the Swift source? Oh and, is it possible (just to play around with) to enable the ownership verifier for more modules?

Really excited about this :slight_smile:

Thanks,
  Johannes

···

On 10 Jul 2017, at 2:22 am, Michael Gottesman <mgottesman@apple.com> wrote:

On Jul 8, 2017, at 10:36 AM, Johannes Weiß via swift-dev <swift-dev@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.

Many of Semantic ARC's changes were in Swift 4, but we did not turn on the ownership verifier for Swift 4. This is because getting the stdlib to pass the verifier (a constraint for turning it on for non-stdlib code) would have been too disruptive at that time to land. The overall plan is to continue working on Semantic ARC (If you look at the commits list, I have been landing code for it recently). In fact, I just got stdlibCore (*note*, not the entire stdlib) to pass the ownership verifier, so progress is being made.

Did I answer your question?

Michael

-- Johannes
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev