[embedded] Explain new prefix in docs, fix comments

This commit is contained in:
Kuba Mracek
2024-10-25 12:02:35 -07:00
parent 9c77074cac
commit 23cfca22d0
3 changed files with 8 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ Mangling
mangled-name ::= '@__swiftmacro_' global // Swift mangling for filenames
mangled-name ::= '_T0' global // Swift 4.0
mangled-name ::= '$S' global // Swift 4.2
mangled-name ::= '$e' global // Embedded Swift (unstable)
All Swift-mangled names begin with a common prefix. Since Swift 4.0, the
compiler has used variations of the mangling described in this document, though

View File

@@ -12,6 +12,10 @@ The ABI of code generated by Embedded Swift is not currently stable. For a concr
Similarly, do not mix Embedded Swift code with full Swift code, as the ABIs are different. Details are described in the following sections.
## Symbol mangling under Embedded Swift
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.
## Calling convention of Embedded Swift
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.

View File

@@ -1,8 +1,8 @@
//===--- ManglingUtils.h - Utilities for Swift name mangling ----*- C++ -*-===//
//===--- ManglingFlavor.h - Swift name mangling -----------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2024 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -23,7 +23,7 @@ SWIFT_BEGIN_INLINE_NAMESPACE
/// Which mangling style and prefix to use.
enum class ManglingFlavor: uint8_t {
/// Default manling with the ABI stable $s prefix
/// Default mangling with the ABI stable $s prefix
Default,
/// Embedded Swift's mangling with $e prefix
Embedded,