You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When emitting no-escape closures, make sure that we copy the closure before we pass it into the partial apply to eliminate an ownership violation.
The problem here is that without this patch we emit code like this:
bb0(%0 : @owned $T):
%1 = partial_apply %foo(%0)
%2 = mark_dependence %1 on %0
Since a partial_apply consumes the object, the mark_dependence is a use after
free (especially if one has any further uses of %0 after the mark_dependence).
So what I did was I copied the value before creating the partial_apply. So
now we get this:
bb0(%0 : @owned $T):
%1 = copy_value %0
%2 = partial_apply %foo(%1)
%3 = mark_dependence %2 on %0
...
destroy_value %0
This ensures that one can actually have uses after the mark_dependence of both
operands.
This enables ownership verification to be enabled on
Interpreter/enforce_exclusive_access.
rdar://48521061
0 commit comments