From 84e952c230ddb9c2bd232958010d2045384532eb Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 10 Mar 2018 01:12:22 -0500 Subject: fix await multithreaded data race coro return was reading from a value that coro await was writing to. that wasn't how it was designed to work, it was an implementation mistake. this commit also has some work-in-progress code for fixing error return traces across suspend points. --- src/codegen.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/codegen.cpp') diff --git a/src/codegen.cpp b/src/codegen.cpp index f4275243c3..384322dac1 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -4251,6 +4251,7 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable, case IrInstructionIdExport: case IrInstructionIdErrorUnion: case IrInstructionIdPromiseResultType: + case IrInstructionIdAwaitBookkeeping: zig_unreachable(); case IrInstructionIdReturn: @@ -5279,7 +5280,7 @@ static void do_code_gen(CodeGen *g) { uint32_t err_ret_trace_arg_index = get_err_ret_trace_arg_index(g, fn_table_entry); if (err_ret_trace_arg_index != UINT32_MAX) { g->cur_err_ret_trace_val = LLVMGetParam(fn, err_ret_trace_arg_index); - } else if (g->have_err_ret_tracing && fn_table_entry->calls_errorable_function) { + } else if (g->have_err_ret_tracing && fn_table_entry->calls_or_awaits_errorable_fn) { // TODO call graph analysis to find out what this number needs to be for every function static const size_t stack_trace_ptr_count = 30; -- cgit v1.2.3