Skip to content

Conversation

pull[bot]
Copy link

@pull pull bot commented Feb 5, 2023

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

gottesmm and others added 8 commits February 4, 2023 10:43
…ime into an API that computes liveness and a second API that rewrites copies/destroys and fix up MoveOnly checkers to use it.

For those who are unaware, CanonicalizeOSSALifetime::canonicalizeValueLifetime()
is really a high level driver routine for the functionality of
CanonicalizeOSSALifetime that computes liveness and then rewrites copies using
boundary information. This change introduces splits the implementation of
canonicalizeValueLifetime into two parts: a first part called computeLiveness
and a second part called rewriteLifetimes. Internally canonicalizeValueLifetime
still just calls these two methods.

The reason why I am doing this is that it lets the move only object checker use
the raw liveness information computed before the rewriting mucks with the
analysis information. This information is used by the checker to compute the raw
liveness boundary of a value and use that information to determine the list of
consuming uses not on the boundary, consuming uses on the boundary, and
non-consuming uses on the boundary. This is then used by later parts of the
checker to emit our errors.

Some additional benefits of doing this are:

1. I was able to eliminate callbacks in the rewriting stage of
CanonicalOSSALifetimes which previously gave the checker this information.

2. Previously the move checker did not have access to the non-consuming boundary
uses causing us to always fail appropriately, but sadly not emit a note showing
the non-consuming use. I am going to wire this up in a subsequent commit.

The other change to the implementation of the move checker that this caused is
that I needed to add an extra diagnostic check for instructions that consume the
value twice or consume the value and use the value. The reason why this must be
done is that liveness does not distinguish in between different operands on the
same instruction meaning such an error would be lost.
…or objects and emit more precise errors for consuming use errors.

Specifically, previously if we emitted an error we just dumped all of the
consuming uses. Now instead for each consuming use that needs a copy, we perform
a search for a specific boundary use (consuming or non-consuming) that is
reachable from the former and emit a specialized error for it. Thus we emit for
the two consuming case the normal consumed twice error, and now for
non-consuming errors we emit the "use after consume" error.
…t fields.

Banning it for now to close a hole in the model. We just want to implement it at
a later point in time.
…a9489ac7050351ea7e317bd

[move-only] Refactor CanonicalizeOSSA so we can emit nicer non-consuming use notes and increase quality of errors.
…lues

The fundamental problem here is that we don't know a priori whether an
accessor macro will convert a stored property into a computed one.
That can only be determined after macro expansion, which depends on
having a determined type for the property.

Implicit initialization of optional-typed values (e.g., "var
birthDate: Date?") adds the initializer when there is storage,
triggering the cycle. Introduce a very narrow fix that assumes that
properties that have an accessor macro on them do not have storage.
We probably want to enforce this, so that the "does this variable have
storage?" query can be made cheaper.
…0457a09002cfa58c29fe7f8

[move-only] Ban move only enums from being indirect or having indirect fields.
@kateinoigakukun kateinoigakukun merged commit dad20d8 into swiftwasm Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants