Skip to content

Commit 3856831

Browse files
committed
fix some legacy coroutine stuff
1 parent 7e303fa commit 3856831

File tree

5 files changed

+26
-9
lines changed

5 files changed

+26
-9
lines changed

src/ir.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15289,6 +15289,21 @@ static IrInstruction *ir_analyze_instruction_resolve_result(IrAnalyze *ira, IrIn
1528915289
if (result_loc != nullptr)
1529015290
return result_loc;
1529115291

15292+
ZigFn *fn = exec_fn_entry(ira->new_irb.exec);
15293+
if (fn != nullptr && fn->type_entry->data.fn.fn_type_id.cc == CallingConventionAsync &&
15294+
instruction->result_loc->id == ResultLocIdReturn)
15295+
{
15296+
result_loc = ir_resolve_result(ira, &instruction->base, no_result_loc(),
15297+
implicit_elem_type, nullptr, false, true);
15298+
if (result_loc != nullptr &&
15299+
(type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)))
15300+
{
15301+
return result_loc;
15302+
}
15303+
result_loc->value.special = ConstValSpecialRuntime;
15304+
return result_loc;
15305+
}
15306+
1529215307
IrInstruction *result = ir_const(ira, &instruction->base, implicit_elem_type);
1529315308
result->value.special = ConstValSpecialUndef;
1529415309
IrInstruction *ptr = ir_get_ref(ira, &instruction->base, result, false, false);
@@ -16128,7 +16143,9 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c
1612816143
if (handle_is_ptr(impl_fn_type_id->return_type)) {
1612916144
result_loc = ir_resolve_result(ira, &call_instruction->base, call_instruction->result_loc,
1613016145
impl_fn_type_id->return_type, nullptr, true, true);
16131-
if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) {
16146+
if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) ||
16147+
instr_is_unreachable(result_loc)))
16148+
{
1613216149
return result_loc;
1613316150
}
1613416151
} else {
@@ -16248,7 +16265,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c
1624816265
if (handle_is_ptr(return_type)) {
1624916266
result_loc = ir_resolve_result(ira, &call_instruction->base, call_instruction->result_loc,
1625016267
return_type, nullptr, true, true);
16251-
if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) {
16268+
if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc))) {
1625216269
return result_loc;
1625316270
}
1625416271
} else {

std/event/lock.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ pub const Lock = struct {
123123
};
124124

125125
test "std.event.Lock" {
126-
// https://github.com/ziglang/zig/issues/1908
127-
if (builtin.single_threaded) return error.SkipZigTest;
126+
// https://github.com/ziglang/zig/issues/2377
127+
//if (true) return error.SkipZigTest;
128128

129129
var da = std.heap.DirectAllocator.init();
130130
defer da.deinit();

std/event/net.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ pub async fn connect(loop: *Loop, _address: *const std.net.Address) !File {
263263
}
264264

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

269269
if (builtin.os != builtin.Os.linux) {
270270
// TODO build abstractions for other operating systems

std/event/rwlock.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ pub const RwLock = struct {
212212
};
213213

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

218218
var da = std.heap.DirectAllocator.init();
219219
defer da.deinit();

std/std.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ test "std" {
8484
_ = @import("dwarf.zig");
8585
_ = @import("dynamic_library.zig");
8686
_ = @import("elf.zig");
87-
//_ = @import("event.zig");
87+
_ = @import("event.zig");
8888
_ = @import("fmt.zig");
8989
_ = @import("fs.zig");
9090
_ = @import("hash.zig");

0 commit comments

Comments
 (0)