Skip to content

Commit

Permalink
docs/: forwarding pointers, lgc, todos, ...
Browse files Browse the repository at this point in the history
  • Loading branch information
shwestrick committed Sep 27, 2024
1 parent 9423cca commit e8afb5e
Show file tree
Hide file tree
Showing 14 changed files with 1,262 additions and 9 deletions.
6 changes: 6 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ callouts:
note:
title: Note
color: blue
remark:
title: Remark
color: green
todo:
title: TODO
color: red
aux_links:
MaPLe on GitHub:
- https://github.com/MPLLang/mpl
Expand Down
Binary file added docs/assets/forward.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,189 changes: 1,189 additions & 0 deletions docs/assets/forward.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion docs/compiler/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ layout: page
title: Compiler
---

TODO...
{: .todo}
...
3 changes: 2 additions & 1 deletion docs/rts/em/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ parent: Runtime System

# Entanglement Detection and Management

TODO...
{: .todo}
...
3 changes: 2 additions & 1 deletion docs/rts/mm/cgc.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ parent: Memory Management

# Concurrent Garbage Collection (CGC)

TODO...
{: .todo}
...
26 changes: 25 additions & 1 deletion docs/rts/mm/fwd-ptr.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,28 @@ parent: Memory Management

# Forwarding Pointers

TODO...
A **forwarding pointer** redirects from an old version of an object to a new
version. Forwarding pointers are created temporarily by
[Local Garbage Collection (LGC)](lgc.html) when copying live objects into fresh
heaps.

{: .note}
Assuming nothing has gone terribly wrong, forwarding pointers should
be "invisible" to the source program. In particular, during an LGC, the thread
that owns the heaps in-scope of the collection is paused. Any other thread
which attempts to access an object in-scope of the collection is protected
against witnessing a forwarding pointer by the
[Read Barrier](read-barrier.html).


To **forward** an object, we:
1. copy the object to a new location, and
2. overwrite the (old) object's [Header](header.html) with a pointer to the new location.

Note that forwarding pointers are stored in place of the [Header](header.html).
We can distinguish between a header and a forwarding
pointer by checking the least-significant bit. Every header will have a 1 in
the least-significant position; forwarding pointers will always have a 0
in this position, due to alignment constraints.

![Forwarding an object]({{site.baseurl}}/assets/forward.png){:width="80%"}
3 changes: 2 additions & 1 deletion docs/rts/mm/heap.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ in `runtime/gc/hierarchical-heap.h`. A companion type,
and also keep track of old `HM_HierarchicalHeap` structs that can be
reclaimed.

TODO...
{: .todo}
...
3 changes: 2 additions & 1 deletion docs/rts/mm/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ parent: Runtime System

# Memory Management

TODO...
{: .todo}
...

Main source location: [`runtime/gc/`](https://github.com/MPLLang/mpl/tree/main/runtime/gc)
18 changes: 18 additions & 0 deletions docs/rts/mm/lgc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
layout: page
title: Local Garbage Collection
parent: Memory Management
---

# Local Garbage Collection (LGC)

In the [Heap Hierarchy](heap.html), leaf heaps (and nearby ancestors, generally
deep in the hierarchy) are subjected to a hybrid copying/in-place collection
algorithm called **Local Garbage Collection**, or **LGC** for short.
The algorithm is hybrid in the sense that certain "pinned" objects are kept
in-place but all other live objects are forwarded (copied) into fresh heaps.
The forwarding component of the algorithm is an adaptation of
[Cheney's classic algorithm](https://en.wikipedia.org/wiki/Cheney%27s_algorithm).

{: .todo}
...
3 changes: 2 additions & 1 deletion docs/rts/mm/obj-type-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ parent: Memory Management

# The Object Type Table

TODO...
{: .todo}
...
8 changes: 8 additions & 0 deletions docs/rts/mm/read-barrier.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
layout: page
title: Read Barrier
parent: Memory Management
---

{: .todo}
...
3 changes: 2 additions & 1 deletion docs/rts/mm/stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ parent: Memory Management

# Call-Stacks

TODO...
{: .todo}
...
3 changes: 2 additions & 1 deletion docs/rts/sched/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ parent: Runtime System

MPL features a work-stealing scheduler which assigns tasks to processors.

TODO...
{: .todo}
...

Main source location: [`basis-library/schedulers/par-pcall/`](https://github.com/MPLLang/mpl/tree/main/basis-library/schedulers/par-pcall/)

0 comments on commit e8afb5e

Please sign in to comment.