Commit Graph

67 Commits (295bca9b5f397ff98e5a0162fcb2a9f5e0a3e35c)

Author SHA1 Message Date
Loris Cro 7e8b859095 fix oneshot flag erroneusly set as filter_flag 2020-05-07 13:41:17 -04:00
Loris Cro a78ac96134 fix crash in single-threaded builds 2020-05-07 13:41:02 -04:00
Andrew Kelley ba43492c0e
Merge pull request #5268 from tadeokondrak/remove-callconv-redundant-syntax
Remove syntax redundant with callconv
2020-05-07 12:42:26 -04:00
Timon Kruiper b336dda076 Standard library: Fix a regression in loop.waitUntilFdWritableOrReadable
This broke async io on linux.
Regressed in 8ebcca6734
2020-05-06 13:14:06 -04:00
Tadeo Kondrak 6745a6f6f6
zig fmt 2020-05-05 09:38:02 -06:00
Tadeo Kondrak fdfdac4939
update comments for nosuspend 2020-05-05 05:55:27 -06:00
Tadeo Kondrak af00afed98
zig fmt 2020-05-05 05:55:25 -06:00
Andrew Kelley 7998e2b0f4 Merge remote-tracking branch 'origin/master' into FireFox317-windows-evented-io 2020-05-02 14:16:59 -04:00
Chris Heyes 8ebcca6734
Get evented io code paths to build on macOS (#5233)
* Get evented io code paths to build on macOS
* Use mode_t instead of usize where appropriate
2020-05-02 14:14:46 -04:00
Andrew Kelley 2272a07ca0 std.event.Loop: promote the fs thread to be available for all OS's 2020-05-02 00:41:19 -04:00
Tadeo Kondrak 07c1be80c2
Fix std.event.Loop.readv 2020-04-29 04:33:29 -06:00
Andrew Kelley b8796be79d disable flaky event loop test
See #4922
2020-04-12 23:02:39 -04:00
Andrew Kelley 9e7ae06249
std lib API deprecations for the upcoming 0.6.0 release
See #3811
2020-03-30 14:23:22 -04:00
Andrew Kelley f51bec321b
Merge pull request #4707 from Vexu/small-atomics
Support atomic operations with bools and non power of two integers
2020-03-12 18:55:16 -04:00
Vexu 71d776c3be
add note to disabled tests, improve comptime cmpxchg 2020-03-12 22:42:01 +02:00
Andrew Kelley 9abee660dc
fix stack trace code not opening files in forced blocking mode 2020-03-10 19:28:05 -04:00
Vexu ee5b00a8b9
use atomic bools in std lib 2020-03-10 22:54:47 +02:00
Andrew Kelley 0720f338d4
add std.event.Loop pread and faccessat
progress towards std lib tests passing with evented I/O mode
2020-03-07 19:13:21 -05:00
Andrew Kelley c81345c8ae
breaking: std.os read/write functions + sendfile
* rework os.sendfile and add macosx support, and a fallback
   implementation for any OS.
 * fix sendto compile error
 * std.os write functions support partial writes. closes #3443.
 * std.os pread / pwrite functions can now return `error.Unseekable`.
 * std.fs.File read/write functions now have readAll/writeAll variants
   which loop to complete operations even when partial reads/writes
   happen.
 * Audit std.os read/write functions with respect to Linux returning
   EINVAL for lengths greater than 0x7fff0000.
 * std.os read/write shim functions do not unnecessarily loop. Since
   partial reads/writes are part of the API, the caller will be forced
   to loop anyway, and so that would just be code bloat.
 * Improve doc comments
 * Add a non-trivial test for std.os.sendfile
 * Fix std.os.pread on 32 bit Linux
 * Add missing SYS_sendfile bit on aarch64
2020-03-03 02:25:26 -05:00
Andrew Kelley 4616af0ca4
introduce operating system version ranges as part of the target
* re-introduce `std.build.Target` which is distinct from `std.Target`.
   `std.build.Target` wraps `std.Target` so that it can be annotated as
   "the native target" or an explicitly specified target.
 * `std.Target.Os` is moved to `std.Target.Os.Tag`. The former is now a
   struct which has the tag as well as version range information.
 * `std.elf` gains some more ELF header constants.
 * `std.Target.parse` gains the ability to parse operating system
   version ranges as well as glibc version.
 * Added `std.Target.isGnuLibC()`.
 * self-hosted dynamic linker detection and glibc version detection.
   This also adds the improved logic using `/usr/bin/env` rather than
   invoking the system C compiler to find the dynamic linker when zig
   is statically linked. Related: #2084
   Note: this `/usr/bin/env` code is work-in-progress.
 * `-target-glibc` CLI option is removed in favor of the new `-target`
   syntax. Example: `-target x86_64-linux-gnu.2.27`

closes #1907
2020-02-28 14:51:53 -05:00
Andrew Kelley 6aecc268fd
remove the allocator from std.event.Loop
closes #3539
2020-02-21 15:20:36 -05:00
Andrew Kelley 8173fbfb66
implement os.faccessat for Windows 2020-02-16 17:10:43 -05:00
Andrew Kelley 4b02a39aa9
self-hosted libc detection
* libc_installation.cpp is deleted.
   src-self-hosted/libc_installation.zig is now used for both stage1 and
   stage2 compilers.
 * (breaking) move `std.fs.File.access` to `std.fs.Dir.access`. The API
   now encourages use with an open directory handle.
 * Add `std.os.faccessat` and related functions.
 * Deprecate the "C" suffix naming convention for null-terminated
   parameters. "C" should be used when it is related to libc. However
   null-terminated parameters often have to do with the native system
   ABI rather than libc. "Z" suffix is the new convention. For example,
   `std.os.openC` is deprecated in favor of `std.os.openZ`.
 * Add `std.mem.dupeZ` for using an allocator to copy memory and add a
   null terminator.
 * Remove dead struct field `std.ChildProcess.llnode`.
 * Introduce `std.event.Batch`. This API allows expressing concurrency
   without forcing code to be async. It requires no Allocator and does
   not introduce any failure conditions. However it is not thread-safe.
 * There is now an ongoing experiment to transition away from
   `std.event.Group` in favor of `std.event.Batch`.
 * `std.os.execvpeC` calls `getenvZ` rather than `getenv`. This is
   slightly more efficient on most systems, and works around a
   limitation of `getenv` lack of integration with libc.
 * (breaking) `std.os.AccessError` gains `FileBusy`, `SymLinkLoop`, and
   `ReadOnlyFileSystem`. Previously these error codes were all reported
   as `PermissionDenied`.
 * Add `std.Target.isDragonFlyBSD`.
 * stage2: access to the windows_sdk functions is done with a manually
   maintained .zig binding file instead of `@cImport`.
 * Update src-self-hosted/libc_installation.zig with all the
   improvements that stage1 has seen to src/libc_installation.cpp until
   now. In addition, it now takes advantage of Batch so that evented I/O
   mode takes advantage of concurrency, but it still works in blocking
   I/O mode, which is how it is used in stage1.
2020-02-16 13:25:30 -05:00
Andrew Kelley 5b10d9f917
std: fix bitrotted evented code 2020-02-08 16:24:26 -05:00
Andrew Kelley c48831512b
std lib typo fixups 2020-02-08 01:38:01 -05:00
Andrew Kelley 0b5bcd2f56
more std lib async I/O integration
* `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.
2020-02-06 18:05:50 -05:00
daurnimator b9f720365c
Turn win32 errors into a non-exhaustive enum 2020-01-31 22:33:55 +11:00
LemonBoy 7fe13f4a86 Pointer alignment fixes for the stdlib 2020-01-08 20:03:03 +01:00
Robin Voetter 4b4fbe3887
Replace @typeOf with @TypeOf in all zig source
This change was mostly made with `zig fmt` and this also modified some whitespace. Note that in some files, `zig fmt` produced incorrect code, so the change was made manually.
2019-12-10 11:09:41 -05:00
Andrew Kelley f205d23e65
implement async function call with `@call`
this removes the last usage of var args in zig std lib
2019-12-09 15:27:26 -05:00
Andrew Kelley 8b2622cdd5
std.fmt.format: tuple parameter instead of var args 2019-12-08 22:53:51 -05:00
Andrew Kelley ad214c7aa0
bring your own OS layer in the std lib
closes #3784
2019-12-02 15:02:17 -05:00
Andrew Kelley 4af5c38674
fixes for self-hosted compiler 2019-12-01 19:22:03 -05:00
Andrew Kelley b36c07a95a
Merge remote-tracking branch 'origin/master' into remove-array-type-coercion 2019-12-01 09:56:01 -05:00
Quetzal Bradley a6c9c5f767 implement correct buffer wrapping logic in std.event.Channel 2019-11-27 23:09:24 -05:00
Andrew Kelley bf3ac66150
remove type coercion from array values to references
* Implements #3768. This is a sweeping breaking change that requires
   many (trivial) edits to Zig source code. Array values no longer
   coerced to slices; however one may use `&` to obtain a reference to
   an array value, which may then be coerced to a slice.

 * Adds `IrInstruction::dump`, for debugging purposes. It's useful to
   call to inspect the instruction when debugging Zig IR.

 * Fixes bugs with result location semantics. See the new behavior test
   cases, and compile error test cases.

 * Fixes bugs with `@typeInfo` not properly resolving const values.

 * Behavior tests are passing but std lib tests are not yet. There
   is more work to do before merging this branch.
2019-11-27 03:37:50 -05:00
Vexu 4d8a8e65df
add more workarounds 2019-11-27 10:17:37 +02:00
Vexu 128034481a
solve recursion in self hosted 2019-11-26 18:25:29 +02:00
Andrew Kelley cb38bd0a14
rename std.heap.direct_allocator to std.heap.page_allocator
std.heap.direct_allocator is still available for now but it is marked
deprecated.
2019-11-25 17:25:06 -05:00
Andrew Kelley bdf3680be1
zig fmt 2019-11-25 13:53:13 -05:00
Andrew Kelley a061ef42c1
Merge pull request #3761 from Vexu/event.fs
Update event.fs to new event loop
2019-11-25 12:31:23 -05:00
Vexu 7dba5ea9cf
update event.fs.watch 2019-11-25 17:57:44 +02:00
Andrew Kelley 29e438fd1f
more sentinel-terminated pointers std lib integration
See #3767
2019-11-25 00:43:36 -05:00
Vexu 20f5f56986
uncomment event.fs.watch 2019-11-24 17:42:20 +02:00
Vexu ab534cc9f1
update event.fs to use global event loop 2019-11-24 17:39:08 +02:00
Vexu 89310dad56
Merge branch 'master' into modernize-stage2 2019-11-23 23:01:28 +02:00
Vexu b9ef36094c
re-enable stage2 tests 2019-11-23 22:57:34 +02:00
Vexu 7fa59565d3 fix small regressions in std.event 2019-11-23 14:01:00 -05:00
Andrew Kelley cd5f4de2a6
std: remove O_LARGEFILE from OS bits when the OS does not define it 2019-11-21 20:34:55 -05:00
Andrew Kelley 8bae70454d
Merge pull request #3675 from Vexu/atomic-store
Add @atomicStore builtin
2019-11-13 03:06:55 +00:00