Intrinsic support for pinning.

Using the intrinsics is obnoxious because I needed them
to return Builtin.NativeObject?, but there's no reasonable
way to safely generate optional types from Builtins.cpp.
Ugh.

Dave and I also decided that there's no need for
swift_tryPin to allow a null object.

Swift SVN r23824
This commit is contained in:
John McCall
2014-12-10 00:52:48 +00:00
parent d513803d84
commit 3b4e0d307e
24 changed files with 322 additions and 10 deletions

View File

@@ -75,9 +75,11 @@ static bool isTransitiveEscapeInst(SILInstruction *Inst) {
case ValueKind::StringLiteralInst:
case ValueKind::CopyBlockInst:
case ValueKind::StrongReleaseInst:
case ValueKind::StrongPinInst: // Pin handle is independently managed
case ValueKind::StrongRetainAutoreleasedInst:
case ValueKind::StrongRetainInst:
case ValueKind::StrongRetainUnownedInst:
case ValueKind::StrongUnpinInst:
case ValueKind::UnownedReleaseInst:
case ValueKind::UnownedRetainInst:
case ValueKind::InjectEnumAddrInst:
@@ -264,7 +266,7 @@ static bool valueMayBeCaptured(SILValue V, CaptureException Exception) {
// RefCountOperations don't capture.
//
// The release case is true since Swift does not allow destructors to
// resurrent objects. This is enforced via a runtime failure.
// resurrect objects. This is enforced via a runtime failure.
if (isa<RefCountingInst>(Inst))
continue;