Commit Graph

2001 Commits

Author SHA1 Message Date
Andrew Kelley
7bd0500589 Merge remote-tracking branch 'origin/master' into register-allocation 2020-07-08 20:46:06 -07:00
Andrew Kelley
8e425c0c8d stage2: if AST=>ZIR 2020-07-08 20:33:33 -07:00
Andrew Kelley
ab9df5b04b stage2: machine code for condbr jumps 2020-07-08 05:35:41 +00:00
Andrew Kelley
597a363673
Merge pull request #5755 from kubkon/dir-iter-tests
[libstd]: add Dir.Iterator tests
2020-07-07 23:13:58 +00:00
Jakub Konka
417c928952 Add comment about memory invalidation in Iterator.next on Win 2020-07-08 00:03:45 +02:00
Vexu
485231deae
fix HashMap.clone() 2020-07-06 16:51:53 +03:00
Andrew Kelley
ad2ed457dd std: expose unmanaged hash maps
These are useful when you have many of them in memory, and already have
the allocator stored elsewhere.
2020-07-06 06:10:03 +00:00
Andrew Kelley
a2fd8f72c1 std: add new array list functions 2020-07-06 06:09:47 +00:00
Alluet
a0a93f2091 Rewrite std.fmt.parseInt 2020-07-05 22:56:06 +00:00
Andrew Kelley
86ef3202dd add doc comment for std.Target.Os.WindowsVersion 2020-07-05 22:44:25 +00:00
emekoi
68be229917 added custom format method for WindowsVersion 2020-07-05 22:43:10 +00:00
Jonathan Marler
27c1e0b453 Fix issue 5757: increase branch quota for formatting enums 2020-07-05 22:27:50 +00:00
Andrew Kelley
dcca5cf1a9
Merge pull request #5797 from xackus/intcast-runtime-safety
stage1: `@intcast` runtime safety for unsigned -> signed of same bit count
2020-07-05 22:24:25 +00:00
Andrew Kelley
289eab9177
Merge pull request #5786 from ziglang/std-hash-map
reimplement std.HashMap
2020-07-05 21:12:20 +00:00
Andrew Kelley
3a89f214aa update more HashMap API usage 2020-07-05 21:11:42 +00:00
Andrew Kelley
3c8b13d998 std hash map: do the pow2 improvement again
it's a noticeable speedup
2020-07-05 21:11:42 +00:00
Andrew Kelley
632acffcbd update std lib to new hash map API 2020-07-05 21:11:42 +00:00
Andrew Kelley
b3b6ccba50 reimplement std.HashMap
* breaking changes to the API. Some of the weird decisions from before
   are changed to what would be more expected.
   - `get` returns `?V`, use `getEntry` for the old API.
   - `put` returns `!void`, use `fetchPut` for the old API.
 * HashMap now has a comptime parameter of whether to store hashes with
   entries. AutoHashMap has heuristics on whether to set this parameter.
   For example, for integers, it is false, since equality checking is
   cheap, but for strings, it is true, since equality checking is
   probably expensive.
 * The implementation has a separate array for entry_index /
   distance_from_start_index. Entries no longer has holes; it is an
   ArrayList, and iteration is simpler and more cache coherent.
   This is inspired by Python's new dictionaries.
 * HashMap is separated into an "unmanaged" and a "managed" API. The
   unmanaged API is where the actual implementation is; the managed API
   wraps it and provides a more convenient API, storing the allocator.
 * Memory usage: When there are less than or equal to 8 entries, HashMap
   now incurs only a single pointer-size integer as overhead, opposed to
   using an ArrayList.
 * Since the entries array is separate from the indexes array, the holes
   in the indexes array take up less room than the holes in the entries
   array otherwise would. However the entries array also allocates
   additional capacity for appending into the array.
 * HashMap now maintains insertion order. Deletion performs a "swap
   remove". It's now possible to modify the HashMap while iterating.
2020-07-05 21:11:42 +00:00
xackus
b8553b4813 compiler-rt: fix bugs uncovered by previous commit 2020-07-05 20:44:08 +02:00
joachimschmidt557
0ae1157e45 std.mem.dupe is deprecated, move all references in std
Replaced all occurences of std.mem.dupe in stdlib with
Allocator.dupe/std.mem.dupeZ -> Allocator.dupeZ
2020-07-04 21:40:06 +03:00
heidezomp
672b4d5c24 zig build --help: Consistent capitalization/punctuation 2020-07-04 13:00:53 +00:00
Jakub Konka
e7d02eae4d
Update lib/std/fs/test.zig
Co-authored-by: Joachim Schmidt <joachim.schmidt557@outlook.com>
2020-07-02 20:54:57 +02:00
Jakub Konka
b5badd1122 Fix memory corruption in Dir.Iterator test 2020-07-02 10:35:44 +02:00
Jakub Konka
64bd134818 Add Dir.Iterator tests
This commit adds some `std.fs.Dir.Iterator` tests.
2020-07-02 10:35:44 +02:00
Andrew Kelley
6f98ef09e3
Merge pull request #5717 from squeek502/fs-dir-file-ops
Add tests for using file operations on directories
2020-07-01 23:20:50 +00:00
Andrew Kelley
d2a4e5e226
Merge pull request #5749 from kubkon/wasi-notcapable
[libstd]: handle ENOTCAPABLE in WASI
2020-07-01 23:12:26 +00:00
Alexandros Naskos
30ae7f7573 Corrected default value field initialization in std.zeroInit 2020-07-01 23:09:08 +00:00
Jakub Konka
8306826d53 Map ENOTCAPABLE into error.AccessDenied instead of error.NotCapable
This is direct result of review comments left by andrewrk and
daurnimator. It makes sense to map `ENOTCAPABLE` into a more generic
`error.AccessDenied`.
2020-06-30 18:21:38 +02:00
Jakub Konka
5bc99dd7e8 Fix more compilation errors 2020-06-29 21:42:11 +02:00
Jakub Konka
b96882c57a Fix compilation errors 2020-06-29 18:09:22 +02:00
Jakub Konka
bf8bf528c6 Handle ENOTCAPABLE in WASI
This commit adds `error.NotCapable` enum value and makes sure that
every applicable WASI syscall that can return `ENOTCAPABLE` errno
remaps it to `error.NotCapable.
2020-06-29 17:10:01 +02:00
Jonathan Marler
67e97a1f0f ArenaAllocator: use full capacity 2020-06-29 05:12:30 -04:00
Jonathan Marler
35e8876c23 Revert "arena_allocator: refactor and use full capacity"
This reverts commit e120b07a52.
2020-06-29 05:12:30 -04:00
Jonathan Marler
e120b07a52 arena_allocator: refactor and use full capacity 2020-06-28 18:40:15 -04:00
Jonathan Marler
c2eead9629 Fix issue 5741, use after free 2020-06-28 18:05:18 -04:00
Ryan Liptak
74c245aea9 Disable wasi 'readFileAlloc on a directory' assertion for now 2020-06-28 13:56:00 -07:00
Jonathan Marler
374e3e42e0 WasmPageAllocator: fix bug not aligning allocations 2020-06-28 14:25:39 -04:00
Andrew Kelley
581d16154b
Merge pull request #5696 from alexnask/async_call_tuple
@asyncCall now takes arguments as a tuple instead of varargs
2020-06-28 01:00:58 -04:00
Andrew Kelley
0cfe8e5d6f
Merge pull request #5064 from marler8997/newAllocator
new allocator interface
2020-06-27 18:21:00 -04:00
Jonathan Marler
a728436992 new allocator interface after Andrew Kelley review 2020-06-27 08:57:35 -06:00
Ryan Liptak
626b5eccab Move fs-specific tests from os/test.zig to fs/test.zig
The moved tests do not use `std.os` directly and instead use `std.fs` functions, so it makes more sense for them to be in `fs/test.zig`
2020-06-27 10:17:08 +00:00
Ryan Liptak
12aca758c6 Dir.deleteFile: Fix symlink behavior when translating EPERM to EISDIR 2020-06-26 17:12:02 -07:00
Ryan Liptak
505bc9817a Implement Dir.deleteFile in terms of deleteFileZ/deleteFileW
Reduces duplicate code, consistent with other fn/fnZ/fnW implementations
2020-06-26 16:08:26 -07:00
Ryan Liptak
14c3c47fb7 fs.deleteFile: Translate to error.IsDir when appropriate on POSIX systems
Linux deviates from POSIX and returns EISDIR while other POSIX systems return EPERM. To make all platforms consistent in their errors when calling deleteFile on a directory, we have to do a stat to translate EPERM (AccessDenied) to EISDIR (IsDir).
2020-06-26 16:00:43 -07:00
Jonathan Marler
dc9648f868 new allocator interface 2020-06-26 13:34:48 -06:00
Ryan Liptak
0e3d74df8a Add tests for using file operations on directories 2020-06-26 00:06:23 -07:00
Andrew Kelley
e820678ca1
Merge pull request #5588 from tgschultz/leb128-output
LEB128 overhaul and output
2020-06-25 19:10:31 -04:00
Andrew Kelley
061c8be049
Merge pull request #5684 from squeek502/fs-file-dir-ops
Add tests for using directory operations on files
2020-06-25 19:08:30 -04:00
data-man
77bb2dc094 Use writer in benchmarks 2020-06-25 19:07:25 -04:00
Ryan Liptak
dcdbb7006c Add tests for using directory operations on files 2020-06-25 03:49:58 -07:00