Skip to content

Commit

Permalink
docs: convert Serialization.rst to Markdown (#34279)
Browse files Browse the repository at this point in the history
Converts one more doc file from `.rst` to Markdown for consistency.
  • Loading branch information
MaxDesiatov authored Oct 13, 2020
1 parent 9249186 commit 8b452ac
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 25 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ documentation, please create a thread on the Swift forums under the
lazy type-checking and efficient caching.
- [Literals.md](/docs/Literals.md):
Describes type-checking and inference specifically for literals.
- [Serialization.rst](/docs/Serialization.rst):
- [Serialization.md](/docs/Serialization.md):
Gives an overview of the LLVM bitcode format used for swiftmodules.
- [StableBitcode.md](/docs/StableBitcode.md):
Describes how to maintain compatibility when changing the serialization
Expand Down
34 changes: 11 additions & 23 deletions docs/Serialization.rst → docs/Serialization.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
:orphan:

=================================
Swift Binary Serialization Format
=================================
# Swift Binary Serialization Format

The fundamental unit of distribution for Swift code is a *module.* A module
contains declarations as an interface for clients to write code against. It may
Expand Down Expand Up @@ -33,10 +29,9 @@ tied to the compiler internals to be useful for this purpose, and it is likely
we'll invent a new format instead.


Why LLVM bitcode?
=================
## Why LLVM bitcode?

The `LLVM bitstream <http://llvm.org/docs/BitCodeFormat.html>`_ format was
The [LLVM bitstream](http://llvm.org/docs/BitCodeFormat.html) format was
invented as a container format for LLVM IR. It is a binary format supporting
two basic structures: *blocks,* which define regions of the file, and
*records,* which contain data fields that can be up to 64 bits. It has a few
Expand All @@ -60,10 +55,9 @@ have most of these properties as well. But we're already linking against
LLVM...might as well use it!


Versioning
==========
## Versioning

.. warning::
#### _Warning_

This section is relevant to any forward-compatible format used for a
library's public interface. However, as mentioned above this may not be
Expand Down Expand Up @@ -101,13 +95,11 @@ requires extra work on the compiler's part to detect which features are in use;
a simpler implementation would just use the latest version number supported:
1.9.

*This versioning scheme was inspired by* `Semantic Versioning
<http://semver.org>`_. *However, it is not compatible with Semantic Versioning
*This versioning scheme was inspired by* [Semantic Versioning](http://semver.org). *However, it is not compatible with Semantic Versioning
because it promises* forward-compatibility *rather than* backward-compatibility.


A High-Level Tour of the Current Module Format
==============================================
## A High-Level Tour of the Current Module Format

Every serialized module is represented as a single block called the "module
block". The module block is made up of several other block kinds, largely for
Expand All @@ -132,7 +124,7 @@ organizational purposes.
- The **SIL block** contains SIL-level implementations that can be imported
into a client's SILModule context. In most cases this is just a performance
concern, but sometimes it affects language semantics as well, as in the case
of ``@_transparent``. The SIL block precedes the AST block because it affects
of `@_transparent`. The SIL block precedes the AST block because it affects
which AST nodes get serialized.

- The **SIL index block** contains tables for accessing various SIL entities by
Expand All @@ -145,9 +137,7 @@ organizational purposes.
Nodes are accessed by a file-unique "DeclIDs" (also covering DeclContexts)
and "TypeIDs"; the two sets of IDs use separate numbering schemes.

.. note::

The AST block is currently referred to as the "decls block" in the source.
_note_: The AST block is currently referred to as the "decls block" in the source.

- The **identifier block** contains a single blob of strings. This is intended
for Identifiers---strings uniqued by the ASTContext---but can in theory
Expand All @@ -160,13 +150,11 @@ organizational purposes.
top-level declarations.


SIL
===
## SIL

[to be written]


Cross-reference resilience
==========================
## Cross-reference resilience

[to be written]
2 changes: 1 addition & 1 deletion include/swift/Basic/SupplementaryOutputPaths.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct SupplementaryOutputPaths {
///
/// This binary format is used to describe the interface of a module when
/// imported by client source code. The swiftmodule format is described in
/// docs/Serialization.rst.
/// docs/Serialization.md.
///
/// \sa swift::serialize
std::string ModuleOutputPath;
Expand Down

0 comments on commit 8b452ac

Please sign in to comment.