modules/stdlib/ · 14,735 LOCType registrations come from auto-generated module_stubs.c (parsed from Swift's .swiftinterface). Runtime ops are hand-written C in runtime/*.c, linked into stdlib.wasm. IR lowering handlers map Swift method calls to IR instructions at compile time.
All 586 stdlib type entries are registered with the semantic analyser so name resolution + protocol conformance checks work. The list below highlights notable types per kind. Full table: modules/stdlib/type_decls/module_stubs.c.
Functions linked into stdlib.wasm and called from compiled user code. Names follow the __<module>_<op> convention.
"\\(value)").Compile-time handlers that map Swift method calls to IR. Each file in modules/stdlib/ir_lowering/ handles one type-family.
Array.append / map / filter / reduce / sorted / contains / first(where:) / lastIndex(of:) → array_rt calls.
String.split / lowercased / uppercased / hasPrefix / replacingOccurrences / interpolation → string_rt calls.
Dictionary subscript / merge / mapValues / filter / removeAll → dict_rt calls.
Set membership, set algebra (∪ ∩ ∖ △), predicates → set_rt calls.
BinaryInteger / BinaryFloatingPoint method calls — distance(to:), advanced(by:), magnitude.
Int(_:), Double(_:), String(_:radix:) — numeric & textual conversions.
Sequence / Collection generic ops — for-in, makeIterator, indices.
Initializer dispatch (9 entries) — handles both default and memberwise inits.
Free-standing math — abs, max, min, swap.
Calendar, Data, Result method dispatch.
Type registry is broad; runtime depth varies. The list below names the gaps that bite most.
Registered but arithmetic ops use 64-bit fallback. Wide-int multiply / divide unimplemented.
No native WASM half precision; all ops widen to Double.
Type slot only — high-precision decimal arithmetic isn't shipped.
Encodable / Decodable conformances aren't auto-synthesised; relies on Foundation JSON bridge for primitive cases.
Mirror struct registered; introspection is shallow (no children walking).
Pointer arithmetic basic; bound-memory rebinding + memcpy primitives not yet wired.
Marker recognised; data-race static checking is best-effort.
Regex literals + string.matches(of:) not yet lowered.
AsyncSequence / AsyncStream protocols registered; iterator runtime stubs only.
Distributed module not in scope.
No macro expansion plugin host — @Observable, #stringify, etc. parse but don't expand.
Type registered for Swift 6 forward-compat; span-based methods limited.