@@ -1735,10 +1735,10 @@ propagated once received.
17351735If ` waitable-set.wait ` is called from a synchronous- or ` async callback ` -lifted
17361736export, no other threads that were implicitly created by a separate
17371737synchronous- or ` async callback ` -lifted export call can start or progress in
1738- the current component instance until ` waitable-set.wait ` returns (thereby
1739- ensuring non-reentrance of the core wasm code ). However, explicitly-created
1740- threads and threads implicitly created by non-` callback ` ` async ` -lifted
1741- ("stackful async") exports may start or progress at any time.
1738+ the current component instance until ` waitable-set.wait ` returns (preserving
1739+ [ component invariant ] # 2 ). However, explicitly-created threads and threads
1740+ implicitly created by non-` callback ` ` async ` -lifted ("stackful async") exports
1741+ may start or progress at any time.
17421742
17431743A ` subtask ` event notifies the supertask that its subtask is now in the given
17441744state (the meanings of which are described by the [ concurrency explainer] ).
@@ -2201,12 +2201,12 @@ thread to be resumed (as with `thread.yield-to`). If `cancellable` is set,
22012201` thread.yield ` returns whether the current task was [ cancelled] by the caller;
22022202otherwise, ` thread.yield ` always returns ` false ` .
22032203
2204- If ` thread.yield ` is called from a synchronous- or ` async callback ` -lifted
2205- export , it returns immediately without blocking (instead of trapping, as with
2206- other possibly-blocking operations like ` waitable-set.wait ` ). This is because,
2207- unlike other built-ins, ` thread.yield ` may be scattered liberally throughout
2208- code that might show up in the transitive call tree of a synchronous function
2209- call.
2204+ If ` thread.yield ` is called from a non- ` async ` -typed function that has not yet
2205+ returned a value , it returns immediately without blocking (instead of trapping,
2206+ as with other possibly-blocking operations like ` waitable-set.wait ` ). This is
2207+ because, unlike other built-ins, ` thread.yield ` may be scattered liberally
2208+ throughout code that might show up in the transitive call tree of a synchronous
2209+ function call.
22102210
22112211For details, see [ Thread Built-ins] in the concurrency explainer and
22122212[ ` canon_thread_yield ` ] in the Canonical ABI explainer.
@@ -2908,8 +2908,8 @@ definition. Thus, component functions form a "membrane" around the collection
29082908of core module instances contained by a component instance, allowing the
29092909Component Model to establish invariants that increase optimizability and
29102910composability in ways not otherwise possible in the shared-everything setting
2911- of Core WebAssembly. The Component Model proposes establishing the following
2912- two runtime invariants:
2911+ of Core WebAssembly. The Component Model establishes the following runtime
2912+ invariants:
291329131 . Components define a "lockdown" state that prevents continued execution
29142914 after a trap. This both prevents continued execution with corrupt state and
29152915 also allows more-aggressive compiler optimizations (e.g., store reordering).
@@ -2919,13 +2919,16 @@ two runtime invariants:
29192919 implicitly checked at every execution step by component functions. Thus,
29202920 after a trap, it's no longer possible to observe the internal state of a
29212921 component instance.
2922- 2 . The Component Model disallows reentrance by trapping if a callee's
2923- component-instance is already on the stack when the call starts.
2924- (For details, see [ ` call_might_be_recursive ` ] ( CanonicalABI.md#component-instance-state )
2925- in the Canonical ABI explainer.) This default prevents obscure
2926- composition-time bugs and also enables more-efficient non-reentrant
2927- runtime glue code. This rule will be relaxed by an opt-in
2928- function type attribute in the [ future] ( Concurrency.md#todo ) .
2922+ 2 . The Component Model's [ reentrance] rules allow a producer toolchain to
2923+ implement both synchronous and ` async ` (🔀) exported functions using a
2924+ single, fixed-size shadow stack in linear memory that is pushed and popped in
2925+ LIFO order. (Internal use of cooperative threads (🧵) or the "stackful" ABI
2926+ option (🚟) may however require the use of multiple shadow stacks.)
2927+ 3 . Until the Component Model provides a mechanism for guest code to reliably
2928+ avoid recursive deadlocks (in particular, due to async backpressure),
2929+ recursive [ reentrance] rules trap in cases which might otherwise lead to
2930+ recursive deadlock. (This limitation is intended to be relaxed in the
2931+ [ future] ( Concurrency.md#todo ) .)
29292932
29302933
29312934## JavaScript Embedding
@@ -3327,6 +3330,7 @@ For some use-case-focused, worked examples, see:
33273330[ Resolved ] : Concurrency.md#cancellation
33283331[ Cancellation ] : Concurrency.md#cancellation
33293332[ Cancelled ] : Concurrency.md#cancellation
3333+ [ Reentrance ] : Concurrency.md#reentrance
33303334
33313335[ Component Model Documentation ] : https://component-model.bytecodealliance.org
33323336[ `wizer` ] : https://github.com/bytecodealliance/wizer
0 commit comments