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...@@ -3755,7 +3755,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr
3755 bool prefix_arg_err_ret_stack = get_prefix_arg_err_ret_stack(g, fn_type_id);3755 bool prefix_arg_err_ret_stack = get_prefix_arg_err_ret_stack(g, fn_type_id);
3756 bool is_var_args = fn_type_id->is_var_args;3756 bool is_var_args = fn_type_id->is_var_args;
3757 ZigList<LLVMValueRef> gen_param_values = {};3757 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;
3759 if (first_arg_ret) {3759 if (first_arg_ret) {
3760 gen_param_values.append(result_loc);3760 gen_param_values.append(result_loc);
3761 }3761 }
src/ir.cpp+7-1
...@@ -15252,8 +15252,14 @@ static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCallSrc...@@ -15252,8 +15252,14 @@ static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCallSrc
15252 ZigType *promise_type = get_promise_type(ira->codegen, return_type);15252 ZigType *promise_type = get_promise_type(ira->codegen, return_type);
15253 ZigType *async_return_type = get_error_union_type(ira->codegen, alloc_fn_error_set_type, promise_type);15253 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
15255 return ir_build_call_gen(ira, &call_instruction->base, fn_entry, fn_ref, arg_count,15261 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,
15257 async_return_type);15263 async_return_type);
15258}15264}
1525915265
test/stage1/behavior.zig+3-3
...@@ -39,11 +39,11 @@ comptime {...@@ -39,11 +39,11 @@ comptime {
39 _ = @import("behavior/bugs/828.zig");39 _ = @import("behavior/bugs/828.zig");
40 _ = @import("behavior/bugs/920.zig");40 _ = @import("behavior/bugs/920.zig");
41 _ = @import("behavior/byval_arg_var.zig");41 _ = @import("behavior/byval_arg_var.zig");
42 //_ = @import("behavior/cancel.zig");42 _ = @import("behavior/cancel.zig");
43 _ = @import("behavior/cast.zig");43 _ = @import("behavior/cast.zig");
44 _ = @import("behavior/const_slice_child.zig");44 _ = @import("behavior/const_slice_child.zig");
45 //_ = @import("behavior/coroutine_await_struct.zig");45 _ = @import("behavior/coroutine_await_struct.zig");
46 //_ = @import("behavior/coroutines.zig");46 _ = @import("behavior/coroutines.zig");
47 _ = @import("behavior/defer.zig");47 _ = @import("behavior/defer.zig");
48 _ = @import("behavior/enum.zig");48 _ = @import("behavior/enum.zig");
49 _ = @import("behavior/enum_with_members.zig");49 _ = @import("behavior/enum_with_members.zig");