Skip to content

Commit 06292aa

Browse files
ccasinspiessimon
authored andcommitted
Reorganize docs (oxcaml#3935)
This reorganizes the docs for easy deployment to the oxcaml website
1 parent ae5eb53 commit 06292aa

File tree

27 files changed

+235
-77
lines changed

27 files changed

+235
-77
lines changed

jane/doc/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Documentation of Jane Street OCaml extensions
2+
3+
This directory contains documentation of our extensions.
4+
5+
The `extensions/` subdirectory is the source code for the OxCaml website,
6+
mirrored to the web on compiler release. Internal links there will not work on
7+
Github. Adding new files in the existing directories should just work, but if
8+
you change the structure it is also necessary to change the website's code,
9+
which is kept in an internal Jane Street repository.
10+
11+
CR ccasinghino: Automate the necessary changes.

jane/doc/extensions/stack/intro.md renamed to jane/doc/extensions/_01-stack-allocation/intro.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
---
2+
layout: documentation-page
3+
collectionName: Stack allocation
4+
title: Intro
5+
---
6+
17
# Introduction to Stack Allocations
28

3-
See also the full feature [reference](reference.md) and [common pitfalls](pitfalls.md).
9+
See also the full feature [reference](../reference) and
10+
[common pitfalls](../pitfalls).
411

512
This page describes how OCaml sometimes allocates values on a stack,
613
as opposed to its usual behavior of allocating on the heap.
@@ -162,4 +169,4 @@ over which values are stack-allocated, including:
162169
heap-allocated (and may freely escape regions), even though the record
163170
itself may be stack-allocated.
164171
165-
For more details, read [the reference](./reference.md).
172+
For more details, read [the reference](../reference).

jane/doc/extensions/stack/pitfalls.md renamed to jane/doc/extensions/_01-stack-allocation/pitfalls.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
layout: documentation-page
3+
collectionName: Stack allocation
4+
title: Pitfalls
5+
---
16
# Some Pitfalls of Stack Allocations
27

38
This document outlines some common pitfalls that may come up when
@@ -6,15 +11,16 @@ suggested workarounds. Over time, this list may grow (as experience
611
discovers new things that go wrong) or shrink (as we deploy new
712
compiler versions that ameliorate some issues).
813

9-
If you want an introduction to stack allocations, see the [introduction](intro.md).
14+
If you want an introduction to stack allocations, see the
15+
[introduction](../intro).
1016

1117
## Tail calls
1218

1319
Many OCaml functions just happen to end in a tail call, even those
1420
that are not intentionally tail-recursive. To preserve the
1521
constant-space property of tail calls, the compiler applies special
1622
rules around locality in tail calls (see [the
17-
reference](./reference.md)).
23+
reference](../reference)).
1824

1925
If this causes a problem for calls that just happen to be in tail
2026
position, the easiest workaround is to prevent them from being

jane/doc/extensions/stack/reference.md renamed to jane/doc/extensions/_01-stack-allocation/reference.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
---
2+
layout: documentation-page
3+
collectionName: Stack allocation
4+
title: Reference
5+
---
16
# Stack Allocations Reference
27

38
The goal of this document is to be a reasonably complete reference to stack
49
allocations in OCaml. For a gentler introduction, see [the
5-
introduction](intro.md).
10+
introduction](../intro).
611

712
The stack allocations language extension allows the compiler to
813
stack-allocate some values, placing them on a stack rather than the

jane/doc/extensions/unboxed-types/index.md renamed to jane/doc/extensions/_02-unboxed-types/intro.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Unboxed types (implemented)
1+
---
2+
layout: documentation-page
3+
collectionName: Unboxed types
4+
title: Intro
5+
---
26

3-
[unboxed types proposal]: ../../proposals/unboxed-types/index.md
4-
[kind annotation]: ../../proposals/unboxed-types/syntax.md#kind-annotations
7+
The "unboxed types" extension provides users with additional control over the
8+
way their data is represented in memory and registers. These new types have
9+
different {\em layouts}, which is part of their [kind](../kinds/intro), to
10+
distinguish them from normal OCaml types.
511

6-
This page documents the fragment of the [unboxed types
7-
proposal][] that is implemented. Watch this page
8-
for updates on what's available.
9-
10-
This page is intended to be a brief overview; the details are in the [unboxed types
11-
proposal][].
12-
13-
**Warning:** This is all early days for unboxed types. Expect plenty of papercuts. That
14-
said, we have confidence that these features are safe to use. Annoying, but safe.
12+
This page gives a comprehensive overview of the extension. Unboxed types are
13+
still in active development, with new features being added frequently, and the
14+
documentation here is kept up to date.
1515

1616
# Layouts
1717

@@ -109,10 +109,10 @@ let f5 x = (x : (_ : immediate))
109109
let f6: type (a: bits32). a -> a = fun x -> x
110110
```
111111

112-
Reference [the relevant section of the design proposal][kind annotation] for the full syntax.
113-
The complete annotation design is not yet implemented and the syntax should be read
114-
with `kind ::= layout-name` for now. It also provides reasoning around some design
115-
decisions and contains additional examples.
112+
The full syntax can be found in the [documentation for kinds](../kinds/syntax).
113+
The complete annotation design is not yet implemented and the syntax should be
114+
read with `kind ::= layout-name` for now. It also provides reasoning around some
115+
design decisions and contains additional examples.
116116

117117

118118
## Layouts in module inclusion
@@ -186,7 +186,7 @@ modules in the `janestreet_shims` library.)
186186
## Unboxed options
187187

188188
We now have `type 'a or_null : value_or_null`, the type of unboxed options.
189-
It has constructors `Null` and `This v`. See the [`or_null` document](null.md)
189+
It has constructors `Null` and `This v`. See the [`or_null` document](../or-null)
190190
for more details.
191191

192192
# Unboxed products

jane/doc/extensions/unboxed-types/null.md renamed to jane/doc/extensions/_02-unboxed-types/or-null.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
---
2+
layout: documentation-page
3+
collectionName: Unboxed types
4+
title: Or null
5+
---
6+
17
# Adding null to types
28

39
This document describes the way we can add a null value to types, thus granting a
410
non-allocating version of `option`. This extension builds on the *layouts*
5-
system described in the [main document for unboxed types](index.md). Before
11+
system described in the [main document for unboxed types](../intro). Before
612
reading this document, you may wish to read up through the
7-
[layouts](index.md#layouts) section of the main document.
13+
[layouts](../intro#layouts) section of the main document.
814

915
# Adding null
1016

jane/doc/extensions/parallelism/intro.md renamed to jane/doc/extensions/_03-parallelism/intro.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
---
2+
layout: documentation-page
3+
collectionName: Parallelism
4+
title: Intro
5+
---
6+
17
# Introduction to Parallelism
28

39
OCaml 5 introduces multicore, which allows parallel execution in a single process.
410
Based on that, the OCaml Language team developed a collection of compiler features and libraries:
5-
- Extending the [mode system](../modes/intro.md) to track values' concurrent
11+
- Extending the [mode system](../modes/intro) to track values' concurrent
612
usages, so they can be used concurrently safely.
713
- Higher-level parallelism primitives to allow users to fully expose
814
opportunities of parallelism in their programs, without worrying low-level
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
layout: documentation-page
3+
collectionName: Modes
4+
title: Intro
5+
---
6+
7+
# Introduction to the Mode System
8+
9+
The locality mode used for [Stack allocation](../stack/intro) has been
10+
extended to more axes, each tracking a property of values, in order to support
11+
features such as [Parallelism](../parallelism/intro) and
12+
[Uniqueness](../uniqueness/intro). This documentation gives a general
13+
introduction to the mode system.
14+
15+
*This is a stub. Documentation will come soon.*

jane/doc/extensions/modes/reference.md renamed to jane/doc/extensions/_04-modes/reference.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1+
---
2+
layout: documentation-page
3+
collectionName: Modes
4+
title: Reference
5+
---
6+
17
The goal of this document is to be a reasonably complete reference to the mode system in
28
OCaml.
39

4-
<!-- CR zqian: For a gentler introduction, see [the introduction](intro.md). -->
10+
<!-- CR zqian: For a gentler introduction, see [the introduction](../intro). -->
511

612
The mode system in the compiler tracks various properties of values, so that certain
713
performance-enhancing operations can be performed safely. For example:
8-
- Locality tracks escaping. See [the local allocations reference](../stack/reference.md)
9-
- Uniqueness and linearity tracks aliasing. See [the uniqueness reference](../uniqueness/reference.md)
14+
- Locality tracks escaping. See [the local allocations reference](../stack/reference)
15+
- Uniqueness and linearity tracks aliasing. See [the uniqueness reference](../uniqueness/reference)
1016
- Portability and contention tracks inter-thread sharing.
1117
<!-- CR zqian: reference for portability and contention -->
1218

jane/doc/extensions/modes/syntax.md renamed to jane/doc/extensions/_04-modes/syntax.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
---
2+
layout: documentation-page
3+
collectionName: Modes
4+
title: Syntax
5+
---
6+
17
# Modes and modalities
28
Currently a mode expression is simply a space-delimited list of modes.
39

0 commit comments

Comments
 (0)