Plan to change the convention of passed "Normal Parameters" from +1 to +0

I am currently preparing to implement Proposal to change the default ownership for passing parameters - #28 by Chris_Lattner3 and enable the convention change on master. I have been thinking about the least disruptive way to do this transition since
it is a big one. The main minimization points I thought about were build
breakage and impact on other developers. With that in mind my goals are:

  1. To other developers, there should be minimal impact on their workflow. That
    means making the disruption time as small as possible.
  2. The build should be repairable without having to churn the tests. There needs
    to be a simple, small commit that can undo this in case of crazy breakage.

With that in mind here is the plan:

  1. I am going to commit all of the changed tests with a prefix of some
    sort. These will not run when normal people are developing since they will be
    protected by the plus_zero_runtime lit feature. In addition, I will update
    the non-prefixed tests to be guarded by the plus_one_runtime lit
    feature. This is important since otherwise, I can not make a small revert
    without touching those 200 tests.

  2. On my branch (#14953), I am going to keep the updated tests in both positions
    (with and without the prefix). This will let me as people change tests to be
    able to still detect conflicts. I have written some scripting that takes the
    current tests in that branch, copies them into their PREFIX form on
    master. So I can continue to update these tests without any impacts on other
    people.

  3. Once everything is ready, I should be able to do a small commit that flips
    the switch everywhere. At this point, other developers will have an impact
    namely that they need to update the ~200 plus zero tests instead of the
    normal tests. I imagine that this will only be so that we can do a quick
    revert if there are problems and will not last more than a couple of days if
    not less.

  4. Once this is done and all the dust has settled, then we just move over the
    plus zero tests to their new home.

Time Table

The time table for this work is:

  1. 3/9-3/11. I would like to get to stage 3 by this weekend.
  2. 3/12-3/15. I am going to fix any issues that come up over the week.
  3. 3/16-3/18. Sometime over next weekend, I would like to do stage 4.

I will post to this thread when I perform each one of these individual tasks.

1 Like

Please post any questions/concerns here as well.

Sounds good to me

Is there a place where I can track the performance effects of this change?

Not externally. There are some things internally, I would ask Erik about it offline. He maintains the stuff.

I just updated all of the tests in tree that need updates for +0 to have a REQUIRES: plus_one_runtime feature.

The next step is to land the plus_zero versions of these tests.

PR for the initial plus_zero tests: [+0-all-args] Update plus zero tests. by gottesmm · Pull Request #15146 · apple/swift · GitHub

Just an FYI. Turns out accomplishing this plan took more non-trivial work than expected. I was spending a bunch of time to create the tooling. I am switching back to the traditional change the world way of doing things. Another time I will finish off this tooling, but that is its own "feature" so to speak.

Just an FYI. I did the "change the world merge" in 54b38d4c8b422cebf0f72be6ca42ecf26e0cd0f1.

1 Like