Skip to content

Commit 9201031

Browse files
committed
Runtime.md: Finish bucketing entry points.
1 parent 1743ec1 commit 9201031

File tree

1 file changed

+169
-76
lines changed

1 file changed

+169
-76
lines changed

docs/Runtime.md

Lines changed: 169 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -28,39 +28,67 @@ ABI stabilization.
2828
**ABI TODO**: Any exported C++ symbols are implementation details that are not
2929
intended to be part of the stable runtime interface.
3030

31-
### `_swift_ClassMirror_count`
32-
### `_swift_ClassMirror_quickLookObject`
33-
### `_swift_ClassMirror_subscript`
34-
### `_swift_EnumMirror_caseName`
35-
### `_swift_EnumMirror_count`
36-
### `_swift_EnumMirror_subscript`
37-
### `_swift_MagicMirrorData_objcValue`
38-
### `_swift_MagicMirrorData_objcValueType`
39-
### `_swift_MagicMirrorData_summary`
40-
### `_swift_MagicMirrorData_value`
41-
### `_swift_MagicMirrorData_valueType`
42-
### `_swift_ObjCMirror_count`
43-
### `_swift_ObjCMirror_subscript`
44-
### `_swift_StructMirror_count`
45-
### `_swift_StructMirror_subscript`
46-
### `_swift_TupleMirror_count`
47-
### `_swift_TupleMirror_subscript`
48-
### `_swift_reflectAny`
31+
### swift\_ClassMirror\_count
32+
### swift\_ClassMirror\_quickLookObject
33+
### swift\_ClassMirror\_subscript
34+
### swift\_EnumMirror\_caseName
35+
### swift\_EnumMirror\_count
36+
### swift\_EnumMirror\_subscript
37+
### swift\_MagicMirrorData\_objcValue
38+
### swift\_MagicMirrorData\_objcValueType
39+
### swift\_MagicMirrorData\_summary
40+
### swift\_MagicMirrorData\_value
41+
### swift\_MagicMirrorData\_valueType
42+
### swift\_ObjCMirror\_count
43+
### swift\_ObjCMirror\_subscript
44+
### swift\_StructMirror\_count
45+
### swift\_StructMirror\_subscript
46+
### swift\_TupleMirror\_count
47+
### swift\_TupleMirror\_subscript
48+
### swift\_reflectAny
4949

5050
**ABI TODO**: These functions are implementation details of the standard
5151
library `reflect` interface. They will be superseded by a low-level
5252
runtime reflection API.
5353

54+
### swift\_stdlib\_demangleName
55+
56+
```
57+
@convention(thin) (string: UnsafePointer<UInt8>,
58+
length: UInt,
59+
@out String) -> ()
60+
```
61+
62+
Given a pointer to a Swift mangled symbol name as a byte string of `length`
63+
characters, returns the demangled name as a `Swift.String`.
64+
65+
**ABI TODO**: Decouple from the standard library `Swift.String` implementation.
66+
Rename with a non-`stdlib` naming scheme.
67+
5468
## Memory allocation
5569

5670
### TODO
5771

5872
```
73+
000000000001cb30 T _swift_allocBox
74+
000000000001c990 T _swift_allocObject
75+
000000000001ca60 T _swift_bufferAllocate
76+
000000000001ca70 T _swift_bufferAllocateOnStack
77+
000000000001ca80 T _swift_bufferDeallocateFromStack
78+
000000000001ca90 T _swift_bufferHeaderSize
79+
000000000001cd30 T _swift_deallocBox
80+
000000000001d490 T _swift_deallocClassInstance
81+
000000000001cd60 T _swift_deallocObject
82+
000000000001d4c0 T _swift_deallocPartialClassInstance
83+
000000000001d400 T _swift_rootObjCDealloc
84+
000000000001c960 T _swift_slowAlloc
85+
000000000001c980 T _swift_slowDealloc
86+
000000000001ce10 T _swift_projectBox
87+
000000000001ca00 T _swift_initStackObject
5988
```
6089

6190
## Reference counting
6291

63-
6492
### swift\_retainCount
6593

6694
```
@@ -126,6 +154,16 @@ internalized.
126154
000000000001d8b0 T _swift_weakTakeAssign
127155
000000000001d800 T _swift_weakTakeInit
128156
000000000001d710 T _swift_weakTakeStrong
157+
000000000002afe0 T _swift_isUniquelyReferencedNonObjC
158+
000000000002af50 T _swift_isUniquelyReferencedNonObjC_nonNull
159+
000000000002b060 T _swift_isUniquelyReferencedNonObjC_nonNull_bridgeObject
160+
000000000002b200 T _swift_isUniquelyReferencedOrPinnedNonObjC_nonNull
161+
000000000002b130 T _swift_isUniquelyReferencedOrPinnedNonObjC_nonNull_bridgeObject
162+
000000000002b2f0 T _swift_isUniquelyReferencedOrPinned_native
163+
000000000002b290 T _swift_isUniquelyReferencedOrPinned_nonNull_native
164+
000000000002af00 T _swift_isUniquelyReferenced_native
165+
000000000002aea0 T _swift_isUniquelyReferenced_nonNull_native
166+
000000000001d280 T _swift_isDeallocating
129167
```
130168

131169
**ABI TODO**: `_unsynchronized` r/r entry points
@@ -167,35 +205,25 @@ between `ErrorType` and `NSError`.
167205
**ABI TODO**: These should be implemented as shims or in Swift code, not
168206
in the runtime.
169207

170-
## TODO
208+
## Initialization
209+
210+
### swift_once
211+
212+
```
213+
@convention(thin) (Builtin.RawPointer, @convention(thin) () -> ()) -> ()
214+
```
215+
216+
Used to lazily initialize global variables. The first parameter must
217+
point to a word-sized memory location that was initialized to zero at
218+
process start. It is undefined behavior to reference memory that has
219+
been initialized to something other than zero or written to by anything other
220+
than `swift_once` in the current process's lifetime. The function referenced by
221+
the second parameter will have been run exactly once in the time between
222+
process start and the function returns.
223+
224+
## Dynamic casting
171225

172226
```
173-
000000000002b340 T __swift_class_getInstancePositiveExtentSize
174-
000000000002b350 T __swift_class_getInstancePositiveExtentSize_native
175-
0000000000024040 T __swift_debug_verifyTypeLayoutAttribute
176-
0000000000004080 T __swift_getSuperclass_nonNull
177-
0000000000003ff0 T __swift_isClass
178-
00000000000279f0 T __swift_usesNativeSwiftReferenceCounting_class
179-
000000000002ae40 T __swift_usesNativeSwiftReferenceCounting_nonNull
180-
000000000001cb30 T _swift_allocBox
181-
000000000001c990 T _swift_allocObject
182-
000000000001e3e0 T _swift_allocateGenericClassMetadata
183-
000000000001e620 T _swift_allocateGenericValueMetadata
184-
0000000000023a40 T _swift_assignExistentialWithCopy
185-
0000000000003b60 T _swift_bridgeNonVerbatimFromObjectiveC
186-
0000000000003c80 T _swift_bridgeNonVerbatimFromObjectiveCConditional
187-
00000000000037e0 T _swift_bridgeNonVerbatimToObjectiveC
188-
000000000001ca60 T _swift_bufferAllocate
189-
000000000001ca70 T _swift_bufferAllocateOnStack
190-
000000000001ca80 T _swift_bufferDeallocateFromStack
191-
000000000001ca90 T _swift_bufferHeaderSize
192-
0000000000003060 T _swift_conformsToProtocol
193-
000000000001dbf0 T _swift_copyPOD
194-
000000000001cd30 T _swift_deallocBox
195-
000000000001d490 T _swift_deallocClassInstance
196-
000000000001cd60 T _swift_deallocObject
197-
000000000001d4c0 T _swift_deallocPartialClassInstance
198-
0000000000023e60 T _swift_demangleSimpleClass
199227
0000000000001470 T _swift_dynamicCast
200228
0000000000000a60 T _swift_dynamicCastClass
201229
0000000000000ae0 T _swift_dynamicCastClassUnconditional
@@ -217,69 +245,134 @@ in the runtime.
217245
00000000000287d0 T _swift_dynamicCastTypeToObjCProtocolUnconditional
218246
0000000000000de0 T _swift_dynamicCastUnknownClass
219247
0000000000000fd0 T _swift_dynamicCastUnknownClassUnconditional
248+
0000000000003f50 T _swift_isClassOrObjCExistential
249+
00000000000040c0 T _swift_isClassType
250+
0000000000004130 T _swift_isOptionalType
251+
0000000000004080 T __swift_getSuperclass_nonNull
252+
0000000000003ff0 T __swift_isClass
253+
00000000000279f0 T __swift_usesNativeSwiftReferenceCounting_class
254+
000000000002ae40 T __swift_usesNativeSwiftReferenceCounting_nonNull
255+
```
256+
257+
## Debugging
258+
259+
```
260+
000000000002b340 T __swift_class_getInstancePositiveExtentSize
261+
000000000002b350 T __swift_class_getInstancePositiveExtentSize_native
262+
0000000000024040 T __swift_debug_verifyTypeLayoutAttribute
263+
0000000000027140 T _swift_willThrow
264+
```
265+
266+
## Objective-C Bridging
267+
268+
**ObjC-only**.
269+
270+
**ABI TODO**: Decouple from the runtime as much as possible. Much of this
271+
should be implementable in the standard library now.
272+
273+
```
274+
0000000000003b60 T _swift_bridgeNonVerbatimFromObjectiveC
275+
0000000000003c80 T _swift_bridgeNonVerbatimFromObjectiveCConditional
276+
00000000000037e0 T _swift_bridgeNonVerbatimToObjectiveC
220277
00000000000039c0 T _swift_getBridgedNonVerbatimObjectiveCType
221-
0000000000000b60 T _swift_getDynamicType
278+
0000000000003d90 T _swift_isBridgedNonVerbatimToObjectiveC
279+
```
280+
281+
## Code generation
282+
283+
Certain common code paths are implemented in the runtime as a code size
284+
optimization.
285+
286+
```
287+
0000000000023a40 T _swift_assignExistentialWithCopy
288+
000000000001dbf0 T _swift_copyPOD
222289
000000000001c560 T _swift_getEnumCaseMultiPayload
223290
000000000001be60 T _swift_getEnumCaseSinglePayload
291+
000000000001c400 T _swift_storeEnumTagMultiPayload
292+
000000000001bf90 T _swift_storeEnumTagSinglePayload
293+
```
294+
## Type metadata lookup
295+
296+
These functions look up metadata for types that potentially require runtime
297+
instantiation or initialization, including structural types, generics, classes,
298+
and metadata for imported C and Objective-C types.
299+
300+
**ABI TODO**: Instantiation APIs under flux as part of resilience work. For
301+
nominal types, `getGenericMetadata` is likely to become an implementation
302+
detail used to implement resilient per-type metadata accessor functions.
303+
304+
```
224305
0000000000023230 T _swift_getExistentialMetatypeMetadata
225306
0000000000023630 T _swift_getExistentialTypeMetadata
226307
0000000000023b90 T _swift_getForeignTypeMetadata
227308
000000000001ef30 T _swift_getFunctionTypeMetadata
228309
000000000001eed0 T _swift_getFunctionTypeMetadata1
229310
000000000001f1f0 T _swift_getFunctionTypeMetadata2
230311
000000000001f250 T _swift_getFunctionTypeMetadata3
231-
0000000000028c40 T _swift_getGenericClassObjCName
232312
000000000001e940 T _swift_getGenericMetadata
233313
000000000001e9c0 T _swift_getGenericMetadata1
234314
000000000001ea60 T _swift_getGenericMetadata2
235315
000000000001eb00 T _swift_getGenericMetadata3
236316
000000000001eba0 T _swift_getGenericMetadata4
237-
0000000000028bc0 T _swift_getInitializedObjCClass
238317
0000000000022fd0 T _swift_getMetatypeMetadata
239318
000000000001ec50 T _swift_getObjCClassMetadata
240-
0000000000022fb0 T _swift_getObjectType
241319
000000000001e6b0 T _swift_getResilientMetadata
242320
0000000000022260 T _swift_getTupleTypeMetadata
243321
00000000000225a0 T _swift_getTupleTypeMetadata2
244322
00000000000225d0 T _swift_getTupleTypeMetadata3
245-
00000000000006f0 T _swift_getTypeName
323+
0000000000028bc0 T _swift_getInitializedObjCClass
324+
```
325+
326+
## Type metadata initialization
327+
328+
Calls to these entry points are emitted when instantiating type metadata at
329+
runtime.
330+
331+
**ABI TODO**: Initialization APIs under flux as part of resilience work.
332+
333+
```
334+
000000000001e3e0 T _swift_allocateGenericClassMetadata
335+
000000000001e620 T _swift_allocateGenericValueMetadata
246336
0000000000022be0 T _swift_initClassMetadata_UniversalStrategy
247337
000000000001c100 T _swift_initEnumMetadataMultiPayload
248338
000000000001bd60 T _swift_initEnumValueWitnessTableSinglePayload
249-
000000000001ca00 T _swift_initStackObject
250339
0000000000022a20 T _swift_initStructMetadata_UniversalStrategy
251340
0000000000024230 T _swift_initializeSuperclass
252341
0000000000028b60 T _swift_instantiateObjCClass
253-
0000000000003d90 T _swift_isBridgedNonVerbatimToObjectiveC
254-
0000000000003f50 T _swift_isClassOrObjCExistential
255-
00000000000040c0 T _swift_isClassType
256-
000000000001d280 T _swift_isDeallocating
257-
0000000000004130 T _swift_isOptionalType
258-
000000000002afe0 T _swift_isUniquelyReferencedNonObjC
259-
000000000002af50 T _swift_isUniquelyReferencedNonObjC_nonNull
260-
000000000002b060 T _swift_isUniquelyReferencedNonObjC_nonNull_bridgeObject
261-
000000000002b200 T _swift_isUniquelyReferencedOrPinnedNonObjC_nonNull
262-
000000000002b130 T _swift_isUniquelyReferencedOrPinnedNonObjC_nonNull_bridgeObject
263-
000000000002b2f0 T _swift_isUniquelyReferencedOrPinned_native
264-
000000000002b290 T _swift_isUniquelyReferencedOrPinned_nonNull_native
265-
000000000002af00 T _swift_isUniquelyReferenced_native
266-
000000000002aea0 T _swift_isUniquelyReferenced_nonNull_native
342+
```
343+
344+
## Objective-C Runtime Interop
345+
346+
```
347+
0000000000023e60 T _swift_demangleSimpleClass
267348
0000000000028770 T _swift_objcRespondsToSelector
268-
0000000000026550 T _swift_once
269-
000000000001ce10 T _swift_projectBox
349+
```
350+
351+
## Metatypes
352+
353+
```
354+
0000000000000b60 T _swift_getDynamicType
355+
0000000000022fb0 T _swift_getObjectType
356+
00000000000006f0 T _swift_getTypeName
357+
```
358+
359+
**ABI TODO**: getTypeByName entry point.
360+
361+
## Protocol conformance lookup
362+
363+
```
270364
0000000000002ef0 T _swift_registerProtocolConformances
365+
0000000000003060 T _swift_conformsToProtocol
366+
```
367+
368+
## Error reporting
369+
370+
```
271371
000000000001c7d0 T _swift_reportFatalError
272372
000000000001c730 T _swift_reportFatalErrorInFile
273373
000000000001c940 T _swift_reportMissingMethod
274374
000000000001c8d0 T _swift_reportUnimplementedInitializer
275375
000000000001c840 T _swift_reportUnimplementedInitializerInFile
276-
000000000001d400 T _swift_rootObjCDealloc
277-
000000000001c960 T _swift_slowAlloc
278-
000000000001c980 T _swift_slowDealloc
279-
0000000000033930 T _swift_stdlib_demangleName
280-
000000000001c400 T _swift_storeEnumTagMultiPayload
281-
000000000001bf90 T _swift_storeEnumTagSinglePayload
282-
0000000000027140 T _swift_willThrow
283376
```
284377

285378
## Tasks
@@ -293,4 +386,4 @@ in the runtime.
293386

294387
- Unsynchronized retain/release
295388

296-
389+
- Decouple dynamic casting and reflection from the standard library

0 commit comments

Comments
 (0)