[SR-11675] Unexpected CoW when mutating a struct-wrapped value #54084
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
performance
Attachment: Download
Environment
Swift 5.1 release (macOS)
Swift DEVELOPMENT-SNAPSHOT-2019-10-24
Additional Detail from JIRA
md5: 3b7ebb30252bfff9776e6eee5de924f3
Issue Description:
The following code CoWs when modifying
data
via a wrapper struct:Since
data
is not used afterwrapper
"takes ownership" of it, I would expect the compiler to be able to figure out thatwrapper
's reference to {{data}}s backing storage is unique, and therefore should not incur a CoW when modified.Output of running NIO's malloc-aggregation.d script:
The text was updated successfully, but these errors were encountered: