authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-08-08 13:07:05-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-08-08 13:07:05-04:00
log8be95af48011f71f1902dff4ffbf5ea95cf1bcf4
tree699f358122478afdfeabd613dc6734f5dd2ff2ac
parent8d4cb852856631543aa961a6149b9a22021a1573
signaturelock-open Commit is signed but in an unrecognized format.

add compile error for unable to determine async fn frame


2 files changed, 12 insertions(+), 0 deletions(-)

BRANCH_TODO+5
...@@ -31,3 +31,8 @@...@@ -31,3 +31,8 @@
31 * grep for "coroutine" and "coro" and replace all that nomenclature with "async functions"31 * grep for "coroutine" and "coro" and replace all that nomenclature with "async functions"
32 * when there are multiple calls to async functions in a function, reuse the same frame buffer, so that the32 * when there are multiple calls to async functions in a function, reuse the same frame buffer, so that the
33 needed bytes is equal to the largest callee's frame 33 needed bytes is equal to the largest callee's frame
34 * if an async function is never called with async then a few optimizations can be made:
35 - the return does not need to be atomic
36 - it can be assumed that these are always available: the awaiter ptr, return ptr if applicable,
37 error return trace ptr if applicable.
38 - it can be assumed that it is never cancelled
src/analyze.cpp+7
...@@ -5198,6 +5198,13 @@ static Error resolve_coro_frame(CodeGen *g, ZigType *frame_type) {...@@ -5198,6 +5198,13 @@ static Error resolve_coro_frame(CodeGen *g, ZigType *frame_type) {
5198 if (callee->body_node == nullptr) {5198 if (callee->body_node == nullptr) {
5199 continue;5199 continue;
5200 }5200 }
5201 if (callee->anal_state == FnAnalStateProbing) {
5202 ErrorMsg *msg = add_node_error(g, fn->proto_node,
5203 buf_sprintf("unable to determine async function frame of '%s'", buf_ptr(&fn->symbol_name)));
5204 add_error_note(g, msg, call->base.source_node,
5205 buf_sprintf("analysis of function '%s' depends on the frame", buf_ptr(&callee->symbol_name)));
5206 return ErrorSemanticAnalyzeFail;
5207 }
52015208
5202 analyze_fn_body(g, callee);5209 analyze_fn_body(g, callee);
5203 if (callee->anal_state == FnAnalStateInvalid) {5210 if (callee->anal_state == FnAnalStateInvalid) {