Skip to content

Commit 25f971d

Browse files
committed
[embedded] Add explaining comment about _swiftEmptyArrayStorage/_swiftEmptySetSingleton
1 parent 943c7c2 commit 25f971d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

stdlib/public/core/ContiguousArrayBuffer.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ internal final class __EmptyArrayStorage
6464
}
6565

6666
#if $Embedded
67+
// In embedded Swift, the stdlib is a .swiftmodule only without any .o/.a files,
68+
// to allow consuming it by clients with different LLVM codegen setting (-mcpu
69+
// flags, etc.), which means we cannot declare the singleton in a C/C++ file.
70+
//
71+
// TODO: We should figure out how to make this a constant so that it's placed in
72+
// non-writable memory (can't be a let, Builtin.addressof below requires a var).
6773
public var _swiftEmptyArrayStorage: (Int, Int, Int, Int) =
6874
(/*isa*/0, /*refcount*/-1, /*count*/0, /*flags*/1)
6975
#endif

stdlib/public/core/SetStorage.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ internal class __EmptySetSingleton: __RawSetStorage {
128128
}
129129

130130
#if $Embedded
131+
// In embedded Swift, the stdlib is a .swiftmodule only without any .o/.a files,
132+
// to allow consuming it by clients with different LLVM codegen setting (-mcpu
133+
// flags, etc.), which means we cannot declare the singleton in a C/C++ file.
134+
//
135+
// TODO: We should figure out how to make this a constant so that it's placed in
136+
// non-writable memory (can't be a let, Builtin.addressof below requires a var).
131137
public var _swiftEmptySetSingleton: (Int, Int, Int, Int, UInt8, UInt8, UInt16, UInt32, Int, Int, Int) =
132138
(
133139
/*isa*/0, /*refcount*/-1, // HeapObject header

0 commit comments

Comments
 (0)