Skip to content

Commit 23cfca2

Browse files
committed
[embedded] Explain new prefix in docs, fix comments
1 parent 9c77074 commit 23cfca2

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

docs/ABI/Mangling.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Mangling
1212
mangled-name ::= '@__swiftmacro_' global // Swift mangling for filenames
1313
mangled-name ::= '_T0' global // Swift 4.0
1414
mangled-name ::= '$S' global // Swift 4.2
15+
mangled-name ::= '$e' global // Embedded Swift (unstable)
1516

1617
All Swift-mangled names begin with a common prefix. Since Swift 4.0, the
1718
compiler has used variations of the mangling described in this document, though

docs/EmbeddedSwift/ABI.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ The ABI of code generated by Embedded Swift is not currently stable. For a concr
1212

1313
Similarly, do not mix Embedded Swift code with full Swift code, as the ABIs are different. Details are described in the following sections.
1414

15+
## Symbol mangling under Embedded Swift
16+
17+
Since Swift 5.0, the stable ABI mangling schema uses the `$s` prefix on all Swift symbols. Because Embedded Swift's ABI differs from the stable ABI, and furthermore because it's not expected to be stable, Embedded Swift uses a `$e` mangling prefix. The logic and structure of the mangling stays the same, the only difference is the prefix.
18+
1519
## Calling convention of Embedded Swift
1620

1721
As of today, Embedded Swift has identical calling convention to full Swift. However, this does not need to continue in the future, and there should not be expectations that the ABI of Embedded Swift is compatible with full Swift.

include/swift/Demangling/ManglingFlavor.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
//===--- ManglingUtils.h - Utilities for Swift name mangling ----*- C++ -*-===//
1+
//===--- ManglingFlavor.h - Swift name mangling -----------------*- C++ -*-===//
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2024 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -23,7 +23,7 @@ SWIFT_BEGIN_INLINE_NAMESPACE
2323

2424
/// Which mangling style and prefix to use.
2525
enum class ManglingFlavor: uint8_t {
26-
/// Default manling with the ABI stable $s prefix
26+
/// Default mangling with the ABI stable $s prefix
2727
Default,
2828
/// Embedded Swift's mangling with $e prefix
2929
Embedded,

0 commit comments

Comments
 (0)