@@ -4,7 +4,7 @@ This proposal primarily provides mechanisms to:
4
4
5
5
1 . Save memory in WasmGC structs by allowing data associated with source types
6
6
(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)
8
8
in a custom descriptor object for their corresponding WebAssembly types.
9
9
Rather than using a user-controlled reference field
10
10
to point to this type-associated information,
@@ -34,7 +34,7 @@ not the custom descriptor itself.
34
34
## Custom Descriptor Definitions
35
35
36
36
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.
38
38
Similarly, struct types that use custom descriptors have a ` descriptor ` clause saying
39
39
what type their custom descriptors have.
40
40
@@ -152,8 +152,9 @@ The latter two rules,
152
152
governing types with or without ` describes ` clauses,
153
153
are necessary to ensure subtypes have layouts compatible with their supertypes.
154
154
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.)
157
158
158
159
``` wasm
159
160
(rec
@@ -267,16 +268,16 @@ To facilitate that we introduce exact reference types,
267
268
which are inhabited by references to a particular heap type (and possibly the null value),
268
269
but not any of the heap type's strict subtypes.
269
270
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) `
271
272
or non-nullable with the form ` (ref exact ht) ` .
272
273
273
274
For any heap type ` ht ` :
274
275
275
276
```
276
277
(ref ht) <: (ref null ht)
277
- (ref exact null ht) <: (ref null ht)
278
+ (ref null exact ht) <: (ref null ht)
278
279
(ref exact ht) <: (ref ht)
279
- (ref exact ht) <: (ref exact null ht)
280
+ (ref exact ht) <: (ref null exact ht)
280
281
```
281
282
282
283
Furthermore, to ensure that each type hierarchy remains a lattice,
@@ -300,8 +301,8 @@ as having "hidden" subtypes of `any` and `extern`,
300
301
respectively.
301
302
This preserves our ability to assign them more specific types in the future.
302
303
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
305
306
as their first operands.
306
307
This makes the unsound program above invalid.
307
308
0 commit comments