Skip to content

Commit 672ea05

Browse files
committed
[+0-all-args] Scope curry thunk emission.
Otherwise when we have to copy an @in_guaranteed argument to pass into a partial_apply, the alloc_stack associated with the copy is never cleaned up. =><=. AFAIKT this can not happen with the +1 runtime. rdar://34222540
1 parent 3ffbc41 commit 672ea05

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/SILGen/SILGenThunk.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ void SILGenFunction::emitCurryThunk(SILDeclRef thunk) {
148148
(void) fd;
149149
}
150150

151+
Scope S(*this, vd);
152+
151153
auto selfTy = vd->getInterfaceType()->castTo<AnyFunctionType>()
152154
->getInput();
153155
selfTy = vd->getInnermostDeclContext()->mapTypeIntoContext(selfTy);
@@ -185,6 +187,7 @@ void SILGenFunction::emitCurryThunk(SILDeclRef thunk) {
185187
emitCanonicalFunctionThunk(vd, toClosure, closureFnTy, resultFnTy);
186188
}
187189
}
190+
toClosure = S.popPreservingValue(toClosure);
188191
B.createReturn(ImplicitReturnLocation::getImplicitReturnLoc(vd), toClosure);
189192
}
190193

0 commit comments

Comments
 (0)