IRGen: Always use Swift reference counting when Obj-C interop is not available

The swift_unknown* entry points are not available on the Linux port.
Previously we would still attempt to use them in a couple of cases:

1) Foreign classes
2) Existentials and archetypes
3) Optionals of boxed existentials

Note that this patch changes IRGen to never emit the
swift_errorRelease/Retain entry points on Linux. We would like to
use them in the future if we ever adopt a tagged-pointer representation
for small errors. In this case, they can be brought back, and the
TypeInfo for optionals will need to be generalized to propagate the
reference counting of the payload type, instead of defaulting to
unknown if the payload type is not natively reference counted.
A similar change will need to be made to support blocks, if we ever
want to use the blocks runtime on Linux.

Fixes <rdar://problem/23335318>, <rdar://problem/23335537>,
<rdar://problem/23335453>.
This commit is contained in:
Slava Pestov
2015-10-30 18:29:54 -07:00
parent 64024118f4
commit 3d19691bab
18 changed files with 480 additions and 246 deletions

View File

@@ -104,16 +104,6 @@ swift::swift_getErrorValue(const SwiftError *errorObject,
out->errorConformance = errorObject->errorConformance;
}
SwiftError *
swift::swift_errorRetain(SwiftError *object) {
swift_retain(object);
return static_cast<SwiftError*>(object);
}
void swift::swift_errorRelease(SwiftError *object) {
swift_release(object);
}
void swift::swift_willThrow(SwiftError *object) { }
#endif