Skip to content

Commit da651a0

Browse files
authored
Tweak wording for consistency (#5)
- Avoid implying that RTT information must be inlined into descriptor objects. - Replace a couple uses of "RTT" with "descriptor" - Make sure "null" is consistently before "exact" in "(ref null exact ht)".
1 parent 5a9774c commit da651a0

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

proposals/custom-rtts/Overview.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This proposal primarily provides mechanisms to:
44

55
1. Save memory in WasmGC structs by allowing data associated with source types
66
(e.g. static fields, vtables, itables, etc.)
7-
to be stored alongside the engine-managed runtime type information (RTT)
7+
to be accessed alongside the engine-managed runtime type information (RTT)
88
in a custom descriptor object for their corresponding WebAssembly types.
99
Rather than using a user-controlled reference field
1010
to point to this type-associated information,
@@ -34,7 +34,7 @@ not the custom descriptor itself.
3434
## Custom Descriptor Definitions
3535

3636
Custom descriptor types are defined struct types with a `describes` clause saying
37-
what other defined struct type they contain runtime type information for.
37+
what other defined struct type they provide runtime type information for.
3838
Similarly, struct types that use custom descriptors have a `descriptor` clause saying
3939
what type their custom descriptors have.
4040

@@ -152,8 +152,9 @@ The latter two rules,
152152
governing types with or without `describes` clauses,
153153
are necessary to ensure subtypes have layouts compatible with their supertypes.
154154
Custom descriptor types (i.e. those with `describes` clauses)
155-
have different layouts than other structs because their user-controlled fields
156-
are laid out after the engine-managed RTT for the type they describe.
155+
may have different layouts than other structs because their user-controlled fields
156+
might be laid out after the engine-managed RTT for the type they describe.
157+
(But this is just one possible implementation that we specifically want to allow.)
157158

158159
```wasm
159160
(rec
@@ -267,16 +268,16 @@ To facilitate that we introduce exact reference types,
267268
which are inhabited by references to a particular heap type (and possibly the null value),
268269
but not any of the heap type's strict subtypes.
269270

270-
Exact reference types can be nullable with the form `(ref exact null ht)`
271+
Exact reference types can be nullable with the form `(ref null exact ht)`
271272
or non-nullable with the form `(ref exact ht)`.
272273

273274
For any heap type `ht`:
274275

275276
```
276277
(ref ht) <: (ref null ht)
277-
(ref exact null ht) <: (ref null ht)
278+
(ref null exact ht) <: (ref null ht)
278279
(ref exact ht) <: (ref ht)
279-
(ref exact ht) <: (ref exact null ht)
280+
(ref exact ht) <: (ref null exact ht)
280281
```
281282

282283
Furthermore, to ensure that each type hierarchy remains a lattice,
@@ -300,8 +301,8 @@ as having "hidden" subtypes of `any` and `extern`,
300301
respectively.
301302
This preserves our ability to assign them more specific types in the future.
302303

303-
When allocating types with custom RTTs,
304-
`struct.new` and `struct.new_default` take exact references to the RTTs
304+
When allocating types with custom descriptors,
305+
`struct.new` and `struct.new_default` take exact references to the descriptors
305306
as their first operands.
306307
This makes the unsound program above invalid.
307308

0 commit comments

Comments
 (0)