mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: a new library intrinsic to "finalize" array literals
For COW support in SIL it's required to "finalize" array literals. _finalizeUninitializedArray is a compiler known stdlib function which is called after all elements of an array literal are stored. This runtime function marks the array literal as finished. %uninitialized_result_tuple = apply %_allocateUninitializedArray(%count) %mutable_array = tuple_extract %uninitialized_result_tuple, 0 %elem_base_address = tuple_extract %uninitialized_result_tuple, 1 ... store %elem_0 to %elem_addr_0 store %elem_1 to %elem_addr_1 ... %final_array = apply %_finalizeUninitializedArray(%mutable_array) In this commit _finalizeUninitializedArray is still a no-op because the COW support is not used in the Array implementation yet.
This commit is contained in:
@@ -642,7 +642,7 @@ bool COWArrayOpt::hasLoopOnlyDestructorSafeArrayOperations() {
|
||||
|
||||
// Semantic calls are safe.
|
||||
ArraySemanticsCall Sem(Inst);
|
||||
if (Sem) {
|
||||
if (Sem && Sem.hasSelf()) {
|
||||
auto Kind = Sem.getKind();
|
||||
// Safe because they create new arrays.
|
||||
if (Kind == ArrayCallKind::kArrayInit ||
|
||||
|
||||
Reference in New Issue
Block a user