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

@@ -1071,8 +1071,14 @@ MarkFunctionEscapeInst::MarkFunctionEscapeInst(SILLocation Loc,
Operands(this, Elems) {
}
static SILType getPinResultType(SILType operandType) {
return SILType::getPrimitiveObjectType(
OptionalType::get(operandType.getSwiftRValueType())->getCanonicalType());
}
StrongPinInst::StrongPinInst(SILLocation loc, SILValue operand)
: UnaryInstructionBase(loc, operand, getPinResultType(operand.getType())) {
}
StoreWeakInst::StoreWeakInst(SILLocation loc, SILValue value, SILValue dest,
IsInitialization_t isInit)