authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-20 18:15:27-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-20 18:27:04-04:00
log237233b04bdbbb82a5ce881a074fdd4ca55fe58f
treefad7ac5a1a052d1f9b12f94a45ed1a0154dda2c8
parent057b105fadb1b60d0927cb878e795c9e7ac9bdb1
signaturelock-open Commit is signed but in an unrecognized format.

fix coroutines


3 files changed, 11 insertions(+), 5 deletions(-)

src/codegen.cpp+1-1
......@@ -3755,7 +3755,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr
37553755 bool prefix_arg_err_ret_stack = get_prefix_arg_err_ret_stack(g, fn_type_id);
37563756 bool is_var_args = fn_type_id->is_var_args;
37573757 ZigList<LLVMValueRef> gen_param_values = {};
3758 LLVMValueRef result_loc = first_arg_ret ? ir_llvm_value(g, instruction->result_loc) : nullptr;
3758 LLVMValueRef result_loc = (first_arg_ret || instruction->is_async) ? ir_llvm_value(g, instruction->result_loc) : nullptr;
37593759 if (first_arg_ret) {
37603760 gen_param_values.append(result_loc);
37613761 }
src/ir.cpp+7-1
......@@ -15252,8 +15252,14 @@ static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCallSrc
1525215252 ZigType *promise_type = get_promise_type(ira->codegen, return_type);
1525315253 ZigType *async_return_type = get_error_union_type(ira->codegen, alloc_fn_error_set_type, promise_type);
1525415254
15255 IrInstruction *result_loc = ir_resolve_result(ira, &call_instruction->base, no_result_loc(),
15256 async_return_type, nullptr, true, true);
15257 if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) {
15258 return result_loc;
15259 }
15260
1525515261 return ir_build_call_gen(ira, &call_instruction->base, fn_entry, fn_ref, arg_count,
15256 casted_args, FnInlineAuto, true, async_allocator_inst, nullptr, nullptr,
15262 casted_args, FnInlineAuto, true, async_allocator_inst, nullptr, result_loc,
1525715263 async_return_type);
1525815264}
1525915265
test/stage1/behavior.zig+3-3
......@@ -39,11 +39,11 @@ comptime {
3939 _ = @import("behavior/bugs/828.zig");
4040 _ = @import("behavior/bugs/920.zig");
4141 _ = @import("behavior/byval_arg_var.zig");
42 //_ = @import("behavior/cancel.zig");
42 _ = @import("behavior/cancel.zig");
4343 _ = @import("behavior/cast.zig");
4444 _ = @import("behavior/const_slice_child.zig");
45 //_ = @import("behavior/coroutine_await_struct.zig");
46 //_ = @import("behavior/coroutines.zig");
45 _ = @import("behavior/coroutine_await_struct.zig");
46 _ = @import("behavior/coroutines.zig");
4747 _ = @import("behavior/defer.zig");
4848 _ = @import("behavior/enum.zig");
4949 _ = @import("behavior/enum_with_members.zig");