Runtime: Optional-like enums with single-refcounted payloads can share the refcounted value witnesses.

swift_retain and objc_retain both handle nil already, so we can bypass the generic Optional value witnesses when instantiating Optional on a class type, which happens kind of a lot.

Swift SVN r23613
This commit is contained in:
Joe Groff
2014-12-02 17:34:36 +00:00
parent b44f7a5d3a
commit 27f49cd19d
4 changed files with 40 additions and 13 deletions

View File

@@ -2190,14 +2190,6 @@ swift_getTupleTypeMetadata3(const Metadata *elt0, const Metadata *elt1,
const Metadata *elt2, const char *labels,
const ValueWitnessTable *proposedWitnesses);
/// Replace entries of a freshly-instantiated value witness table with more
/// efficient common implementations where applicable.
///
/// For instance, if the value witness table represents a POD type, this will
/// insert POD value witnesses into the table. The vwtable's flags must have
/// been initialized before calling this function.
void swift_installCommonValueWitnesses(ValueWitnessTable *vwtable);
/// Initialize the value witness table and struct field offset vector for a
/// struct, using the "Universal" layout strategy.
extern "C" void swift_initStructMetadata_UniversalStrategy(size_t numFields,