Skip to content

Commit

Permalink
fix some legacy coroutine stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrk committed Jun 23, 2019
1 parent 7e303fa commit 3856831
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
21 changes: 19 additions & 2 deletions src/ir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15289,6 +15289,21 @@ static IrInstruction *ir_analyze_instruction_resolve_result(IrAnalyze *ira, IrIn
if (result_loc != nullptr)
return result_loc;

ZigFn *fn = exec_fn_entry(ira->new_irb.exec);
if (fn != nullptr && fn->type_entry->data.fn.fn_type_id.cc == CallingConventionAsync &&
instruction->result_loc->id == ResultLocIdReturn)
{
result_loc = ir_resolve_result(ira, &instruction->base, no_result_loc(),
implicit_elem_type, nullptr, false, true);
if (result_loc != nullptr &&
(type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)))
{
return result_loc;
}
result_loc->value.special = ConstValSpecialRuntime;
return result_loc;
}

IrInstruction *result = ir_const(ira, &instruction->base, implicit_elem_type);
result->value.special = ConstValSpecialUndef;
IrInstruction *ptr = ir_get_ref(ira, &instruction->base, result, false, false);
Expand Down Expand Up @@ -16128,7 +16143,9 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c
if (handle_is_ptr(impl_fn_type_id->return_type)) {
result_loc = ir_resolve_result(ira, &call_instruction->base, call_instruction->result_loc,
impl_fn_type_id->return_type, nullptr, true, true);
if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) {
if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) ||
instr_is_unreachable(result_loc)))
{
return result_loc;
}
} else {
Expand Down Expand Up @@ -16248,7 +16265,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c
if (handle_is_ptr(return_type)) {
result_loc = ir_resolve_result(ira, &call_instruction->base, call_instruction->result_loc,
return_type, nullptr, true, true);
if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) {
if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc))) {
return result_loc;
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions std/event/lock.zig
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ pub const Lock = struct {
};

test "std.event.Lock" {
// https://github.com/ziglang/zig/issues/1908
if (builtin.single_threaded) return error.SkipZigTest;
// https://github.com/ziglang/zig/issues/2377

This comment has been minimized.

Copy link
@Mouvedia

Mouvedia Dec 28, 2020

This issue has been fixed last year.
see #2377 (comment)

//if (true) return error.SkipZigTest;

var da = std.heap.DirectAllocator.init();
defer da.deinit();
Expand Down
4 changes: 2 additions & 2 deletions std/event/net.zig
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ pub async fn connect(loop: *Loop, _address: *const std.net.Address) !File {
}

test "listen on a port, send bytes, receive bytes" {
// https://github.com/ziglang/zig/issues/1908
if (builtin.single_threaded) return error.SkipZigTest;
// https://github.com/ziglang/zig/issues/2377
if (true) return error.SkipZigTest;

if (builtin.os != builtin.Os.linux) {
// TODO build abstractions for other operating systems
Expand Down
4 changes: 2 additions & 2 deletions std/event/rwlock.zig
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ pub const RwLock = struct {
};

test "std.event.RwLock" {
// https://github.com/ziglang/zig/issues/1908
if (builtin.single_threaded or builtin.os != builtin.Os.linux) return error.SkipZigTest;
// https://github.com/ziglang/zig/issues/2377
if (true) return error.SkipZigTest;

var da = std.heap.DirectAllocator.init();
defer da.deinit();
Expand Down
2 changes: 1 addition & 1 deletion std/std.zig
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ test "std" {
_ = @import("dwarf.zig");
_ = @import("dynamic_library.zig");
_ = @import("elf.zig");
//_ = @import("event.zig");
_ = @import("event.zig");
_ = @import("fmt.zig");
_ = @import("fs.zig");
_ = @import("hash.zig");
Expand Down

0 comments on commit 3856831

Please sign in to comment.