Skip to content

Commit e030ac7

Browse files
committed
Add 'async' canonopt and 'task.*' built-ins
1 parent ef29236 commit e030ac7

7 files changed

Lines changed: 2063 additions & 292 deletions

File tree

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
This repository is where the component model is being standardized. For a more user-focused explanation, take a look at the **[Component Model Documentation]**.
44

5-
This repository describes the high-level [goals], [use cases], [design choices]
6-
and [FAQ] of the component model as well as a more-detailed [assembly-level explainer], [IDL],
7-
[binary format] and [ABI] covering the initial Minimum Viable Product (MVP)
8-
release.
5+
This repository contains the high-level [goals], [use cases], [design choices]
6+
and [FAQ] of the component model as well as a more-detailed, low-level
7+
[AST explainer], [async explainer], [IDL], [binary format] and [ABI] covering
8+
the initial Minimum Viable Product (MVP) release.
99

1010
In the future, this repository will additionally contain a [formal spec],
1111
reference interpreter and test suite.
@@ -27,7 +27,8 @@ To contribute to any of these repositories, see the Community Group's
2727
[use cases]: design/high-level/UseCases.md
2828
[design choices]: design/high-level/Choices.md
2929
[FAQ]: design/high-level/FAQ.md
30-
[assembly-level explainer]: design/mvp/Explainer.md
30+
[AST explainer]: design/mvp/Explainer.md
31+
[async explainer]: design/mvp/Async.md
3132
[IDL]: design/mvp/WIT.md
3233
[binary format]: design/mvp/Binary.md
3334
[ABI]: design/mvp/CanonicalABI.md

design/mvp/Async.md

Lines changed: 476 additions & 0 deletions
Large diffs are not rendered by default.

design/mvp/Binary.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ label' ::= len:<u32> l:<label> => l (if len = |l|)
200200
valtype ::= i:<typeidx> => i
201201
| pvt:<primvaltype> => pvt
202202
resourcetype ::= 0x3f 0x7f f?:<funcidx>? => (resource (rep i32) (dtor f)?)
203+
| 0x3e 0x7f f:<funcidx> cb?:<funcidx>? => (resource (rep i32) (dtor async f (callback cb)?))
203204
functype ::= 0x40 ps:<paramlist> rs:<resultlist> => (func ps rs)
204205
paramlist ::= lt*:vec(<labelvaltype>) => (param lt)*
205206
resultlist ::= 0x00 t:<valtype> => (result t)
@@ -270,16 +271,24 @@ canon ::= 0x00 0x00 f:<core:funcidx> opts:<opts> ft:<typeidx> => (canon lift
270271
| 0x01 0x00 f:<funcidx> opts:<opts> => (canon lower f opts (core func))
271272
| 0x02 rt:<typeidx> => (canon resource.new rt (core func))
272273
| 0x03 rt:<typeidx> => (canon resource.drop rt (core func))
274+
| 0x07 rt:<typdidx> => (canon resource.drop rt async (core func))
273275
| 0x04 rt:<typeidx> => (canon resource.rep rt (core func))
274276
| 0x05 ft:<typeidx> => (canon thread.spawn ft (core func))
275277
| 0x06 => (canon thread.hw_concurrency (core func))
278+
| 0x08 => (canon task.start (core func))
279+
| 0x09 => (canon task.return (core func))
280+
| 0x0a => (canon task.wait (core func))
281+
| 0x0b => (canon task.poll (core func))
282+
| 0x0c => (canon task.yield (core func))
276283
opts ::= opt*:vec(<canonopt>) => opt*
277284
canonopt ::= 0x00 => string-encoding=utf8
278285
| 0x01 => string-encoding=utf16
279286
| 0x02 => string-encoding=latin1+utf16
280287
| 0x03 m:<core:memidx> => (memory m)
281288
| 0x04 f:<core:funcidx> => (realloc f)
282289
| 0x05 f:<core:funcidx> => (post-return f)
290+
| 0x06 => async
291+
| 0x07 f:<core:funcidx> => (callback f)
283292
```
284293
Notes:
285294
* The second `0x00` byte in `canon` stands for the `func` sort and thus the

0 commit comments

Comments
 (0)