Commit Graph

9651 Commits (2064e84cdd596b5bc63c8d3e7e5aa4130221faee)

Author SHA1 Message Date
xackus 2064e84cdd ci: check langref.html for html errors 2020-07-08 19:34:44 +00:00
Ryan Liptak f77c968cf8 langref: Add test case for "if error union with optional"
This is an edge case that isn't too uncommon but is rather confusing to try to deduce without documentation, since it feels like `else` is being overloaded in this scenario and there's no obvious 'correct' behavior here. This just adds a test demonstrating how Zig currently behaves in this scenario.
2020-07-08 19:32:15 +00:00
Paul Espinosa eeae3a8f9d Rename langref's Index to Contents (TOC)
The language reference's Index is a list of the documentation's contents in
order of appearance. This commit renames "Index" to "Contents" as in table of
contents. It also renames the HTML/CSS identifiers from "index" to "toc".
2020-07-08 19:31:38 +00:00
Andrew Kelley 6fbb5f0a81
Merge pull request #5816 from pixelherodev/cbe
Beginnings of C backend
2020-07-08 10:45:17 +00:00
Noam Preil 9aaffe00d3
CBE: Cleanup unimplementeds 2020-07-07 23:59:55 -04:00
Noam Preil 089c056dbe
CBE: Improve resource cleanup 2020-07-07 23:24:30 -04:00
Noam Preil 7a6104929b
CBE: truncate output file 2020-07-07 23:19:25 -04:00
Noam Preil 173e671241
CBE: Some cleanup 2020-07-07 23:11:17 -04:00
Vexu 5667a21b1e fix missing check on extern variables with no type 2020-07-08 03:09:41 +00:00
Noam Preil b91cf15972
CBE: Move standards determination to generated code 2020-07-07 22:57:34 -04:00
Noam Preil 5461c482d0
CBE: Integrate into stage2 via --c-standard 2020-07-07 21:54:34 -04:00
Noam Preil 64bf130182
CBE: working asm Inputs and Outputs; std{int,def}.h auto-inclusion 2020-07-07 21:35:42 -04:00
Noam Preil cf09b335d8
CBE: Working function call w/ no args or return value 2020-07-07 19:35:33 -04: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
Noam Preil cf86aa8772
Fix a dumb in tests 2020-07-07 18:43:25 -04:00
Jakub Konka 417c928952 Add comment about memory invalidation in Iterator.next on Win 2020-07-08 00:03:45 +02:00
Noam Preil 6ece36a051
Working translation of empty function 2020-07-07 17:51:59 -04:00
Noam Preil 2f28ecf946
CBE: Get test more useful 2020-07-07 17:06:07 -04:00
Noam Preil aaaebfe97f
Detect unexpected compilation errors in tests 2020-07-07 16:47:39 -04:00
Noam Preil a17200dab1
CBE skeleton 2020-07-07 16:40:14 -04:00
Noam Preil b4c571301b
Stage2: Refactor in preparation for C backend 2020-07-07 14:55:44 -04:00
Noam Preil 0db0258fb2
Remove old comment 2020-07-06 17:54:06 -04:00
Vexu 485231deae
fix HashMap.clone() 2020-07-06 16:51:53 +03:00
Andrew Kelley abcd4ea5d8
Merge pull request #5793 from pfgithub/stage-2-testing
stage2 + operator and @as builtin
2020-07-05 22:58:05 +00:00
Alluet a0a93f2091 Rewrite std.fmt.parseInt 2020-07-05 22:56:06 +00:00
Andrew Kelley 682fccaaf0 Merge branch 'emekoi-windowsver-fix'
closes #5011
2020-07-05 22:44:46 +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
xackus 51f8c306d9 stage1: add missing runtime safety for @intCast unsigned -> signed of same bit count 2020-07-05 17:58:21 +02:00
pfg 4a63189bf1 stage2: add and @as tests 2020-07-04 15:30:17 -07:00
pfg d4456d92f5 stage2: builtin @as 2020-07-04 15:16:46 -07:00
pfg 1d52438bd5 stage2: InfixOp add 2020-07-04 15:16:46 -07: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
pfg 65aac13257 don't try to find config_h if it's not needed 2020-07-04 12:50:37 +00:00
Andrew Kelley 70dca0a0c6
Merge pull request #5779 from ziglang/stage1-hash-map
stage1 HashMap: store hash & do robin hood hashing
2020-07-03 17:11:54 +00:00
Andrew Kelley f281b928d9 cmake: add -DZIG_WORKAROUND_POLLY_SO
to work around #4799 until a newer llvm version is released.
2020-07-03 04:48:48 +00:00
Andrew Kelley 72cd11dd60 Merge branch 'timotheecour-pr_fix_4799'
closes #5092
2020-07-03 04:43:21 +00:00
Andrew Kelley 14e07e9a72 clean up readme 2020-07-03 04:43:05 +00:00
Timothee Cour 9a7f05378f fix https://github.com/ziglang/zig/issues/4799 2020-07-03 04:40:25 +00:00
Andrew Kelley 22f0a103c3 stage1 HashMap: linear scan for < 16 entries 2020-07-03 03:50:35 +00:00
Andrew Kelley df2c27eb48 stage1 HashMap: store hash & do robin hood hashing
This adds these two fields to a HashMap Entry:

uint32_t hash
uint32_t distance_from_start_index

Compared to master branch, standard library tests compiled 8.4% faster
and took negligible (0.001%) more memory to complete. The amount of
memory used is still down from before 8b82c40104 which moved indexes
to be stored separately from entries.

So, it turns out, keeping robin hood hashing plus separating indexes
did result in a performance improvement. What happened previously is
that the gains from separating indexes balanced out the losses from
removing robin hood hashing, resulting in a wash.

This also serves as an inspiration for adding a benchmark to
std.AutoHashMap and improving the implementation.
2020-07-02 22:38:55 +00:00