diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-08-06 16:37:25 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-08-06 16:53:22 -0400 |
| commit | 400500a3afafca8178f13a7e4e1cd0ae7808aff2 (patch) | |
| tree | f6ee011721206db3cda4952dd2eccaeb71c7e632 /src/codegen.hpp | |
| parent | 20f63e588e62c4a7250bc96c9e5b54c8106ad1af (diff) | |
| download | zig-400500a3afafca8178f13a7e4e1cd0ae7808aff2.tar.gz zig-400500a3afafca8178f13a7e4e1cd0ae7808aff2.zip | |
improve async function semantics
* add safety panic for resuming a function which is returning, pending
an await
* remove IrInstructionResultPtr
* add IrInstructionReturnBegin. This does the early return in async
functions; does nothing in normal functions.
* `await` gets a result location
* `analyze_fn_async` will call `analyze_fn_body` if necessary.
* async function frames have a result pointer field for themselves
to access and one for the awaiter to supply before the atomic rmw.
when returning, async functions copy the result to the awaiter result
pointer, if it is non-null.
* async function frames have a stack trace pointer which is supplied by
the awaiter before the atomicrmw. Later in the frame is a stack trace
struct and addresses, which is used for its own calls and awaits.
* when awaiting an async function, if an early return occurred, the
awaiter tail resumes the frame.
* when an async function returns, early return does a suspend
(in IrInstructionReturnBegin) before copying
the error return trace data, result, and running the defers.
After the last defer runs, the frame will no longer be accessed.
* proper acquire/release atomic ordering attributes in async functions.
Diffstat (limited to 'src/codegen.hpp')
| -rw-r--r-- | src/codegen.hpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/codegen.hpp b/src/codegen.hpp index c84ef4bc48..794a0fd5a6 100644 --- a/src/codegen.hpp +++ b/src/codegen.hpp @@ -62,6 +62,6 @@ TargetSubsystem detect_subsystem(CodeGen *g); void codegen_release_caches(CodeGen *codegen); bool codegen_fn_has_err_ret_tracing_arg(CodeGen *g, ZigType *return_type); -bool codegen_fn_has_err_ret_tracing_stack(CodeGen *g, ZigFn *fn); +bool codegen_fn_has_err_ret_tracing_stack(CodeGen *g, ZigFn *fn, bool is_async); #endif |
