[SR-9236] the tail reallocation support through tryReallocateUniquelyReferenced should work on Darwin #51724
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Additional Detail from JIRA
md5: 210af6735fe3dea175afef9063bb72ff
Issue Description:
the tail reallocation support through tryReallocateUniquelyReferenced should work on Darwin.
For reallocation to work it's important that an object isn't 'pinned' in memory or in other words can be moved around. The current support (in #19421 does make sure the object is bit-wise movable and also doesn't have a Swift side-table. Only Linux that's good enough but on Darwin (where we have the ObjC runtime) we additionally need to make sure the object doesn't have an ObjC associated object or any ObjC weak references. Unfortunately, today, there's no efficient way for the Swift runtime to check if a given instance has ObjC associated objects or weak references.
Therefore, we must conservatively assume an object is 'pinned' and hence tail reallocation doesn't work at all on Darwin (
tryReallocateUniquelyReferenced
will always return false).The text was updated successfully, but these errors were encountered: