New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
a big step towards std lib integration with async I/O #4404
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This adds `--test-evented-io` as a CLI parameter. see #3117
* `zig test` gainst `--test-evented-io` parameter and gains the ability to seamlessly run async tests. * `std.ChildProcess` opens its child process pipe with O_NONBLOCK when using evented I/O * `std.io.getStdErr()` gives a File that is blocking even in evented I/O mode. * Delete `std.event.fs`. The functionality is now merged into `std.fs` and async file system access (using a dedicated thread) is automatically handled. * `std.fs.File` can be configured to specify whether its handle is expected to block, and whether that is OK to block even when in async I/O mode. This makes async I/O work correctly for e.g. the file system as well as network. * `std.fs.File` has some deprecated functions removed. * Missing readv,writev,pread,pwrite,preadv,pwritev functions are added to `std.os` and `std.fs.File`. They are all integrated with async I/O. * `std.fs.Watch` is still bit rotted and needs to be audited in light of the new async/await syntax. * `std.io.OutStream` integrates with async I/O * linked list nodes in the std lib have default `null` values for `prev` and `next`. * Windows async I/O integration is enabled for reading/writing file handles. * Added `std.os.mode_t`. Integer sizes need to be audited. * Fixed #4403 which was causing compiler to crash. This is working towards: ./zig test ../test/stage1/behavior.zig --test-evented-io Which does not successfully build yet. I'd like to enable behavioral tests and std lib tests with --test-evented-io in the test matrix in the future, to prevent regressions.
1. behavior tests with --test-evented-io 2. std lib tests with --test-evented-io 3. fuzz test evented I/O a bit, make it robust 4. make sure it works on all platforms (kqueue, Windows IOCP, epoll/other) 5. restart efforts on self-hosted
more correctly solves #4403
and fix "no-op casts" from incorrectly spilling
I used the wrong function here
This reverts commit 80ba21b.
by adding a maximum depth
I'm working on this case; will feel good about merging this after this works: const std = @import("std");
const assert = std.debug.assert;
var global_frame: anyframe = undefined;
export fn entry() void {
_ = async foo();
resume global_frame;
}
const Foo = struct { x: i32 };
fn foo() anyerror!Foo {
defer baz();
return bar() catch |err| return err;
}
fn bar() anyerror!Foo {
global_frame = @frame();
suspend;
return Foo{ .x = 99 };
}
fn baz() void {
global_frame = @frame();
suspend;
}
pub fn panic(msg: []const u8, stack_trace: ?*const std.builtin.StackTrace) noreturn {
@breakpoint();
unreachable;
} |
This was referenced Feb 8, 2020
See #3180 for a more comprehensive plan to catch this problem. More sophisticated control flow analysis is needed to provide compile errors for returning local variable addresses from a function.
This was referenced Feb 10, 2020
andrewrk
added
the
breaking
Implementing this issue could cause existing code to no longer compile or have different behavior.
label
Feb 10, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaking
Implementing this issue could cause existing code to no longer compile or have different behavior.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
zig test
gains--test-evented-io
parameter and gains the abilityto seamlessly run async tests.
std.ChildProcess
opens its child process pipe with O_NONBLOCK whenusing evented I/O
std.io.getStdErr()
gives a File that is blocking even in eventedI/O mode.
std.event.fs
. The functionality is now merged intostd.fs
and async file system access (using a dedicated thread) is
automatically handled.
std.fs.File
can be configured to specify whether its handle isexpected to block, and whether that is OK to block even when in
async I/O mode. This makes async I/O work correctly for e.g. the
file system as well as network.
std.fs.File
has some deprecated functions removed.to
std.os
andstd.fs.File
. They are all integrated with asyncI/O.
std.fs.Watch
is still bit rotted and needs to be audited in lightof the new async/await syntax.
std.io.OutStream
integrates with async I/Onull
values forprev
andnext
.handles.
std.os.mode_t
. Integer sizes need to be audited.This is all working towards:
Which does not successfully build yet. I'd like to enable behavioral
tests and std lib tests with --test-evented-io in the test matrix in the
future, to prevent regressions.