Skip to content

Commit 91648b1

Browse files
committed
just assume a memory model is in scope
1 parent 53b899e commit 91648b1

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

wip/memory-interface.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Practically speaking, `Pointer` will be some representation of an "address", plu
2828

2929
The unit of communication between the memory model and the rest of the program is a *byte*.
3030
Again, the question of "what is a byte" is not as trivial as it might seem; beyond `u8` values we have to represent `Pointer`s and [uninitialized memory][uninit].
31-
We define the `Byte` type (in terms of an arbitrary `Pointer` type) as follows:
31+
We define the `Byte` type as follows, where `Pointer` will later be instantiated with the `Memory::Pointer` associated type.
3232

3333
```rust
3434
enum Byte<Pointer> {
@@ -137,6 +137,9 @@ enum OffsetMode {
137137
}
138138
```
139139

140+
We will generally assume we have a particular memory model in scope, and freely refer to its `PTR_SIZE` and `Pointer` items.
141+
We will also write `Byte` for `Byte<Pointer>`.
142+
140143
This is a very basic memory interface that is incomplete in at least the following ways:
141144

142145
* To implement rules like "dereferencing a null, unaligned, or dangling raw pointer is UB" (even if no memory access happens), there needs to be a way to do an "alignment, bounds and null-check".

wip/value-domain.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ However, before we can even start specifying the relation, we have to specify th
1313

1414
## Values
1515

16-
The Rust value domain is described by the following (incomplete) type definition (in terms of an arbitrary `Pointer` type instantiated by [the memory interface][memory-interface]):
16+
The Rust value domain is described by the following (incomplete) type definition (using the `Pointer` type defined by [the memory interface][memory-interface]):
1717

1818
```rust
19-
enum Value<Pointer> {
19+
enum Value {
2020
/// A mathematical integer, used for `i*`/`u*` types.
2121
Int(BigInt),
2222
/// A Boolean value, used for `bool`.
@@ -33,7 +33,7 @@ enum Value<Pointer> {
3333
data: Box<Self>,
3434
},
3535
/// A "bag of raw bytes", used for unions.
36-
RawBag(Vec<Byte<Pointer>>),
36+
RawBag(Vec<Byte>),
3737
/* ... */
3838
}
3939
```

0 commit comments

Comments
 (0)