Commit graph

2305 commits

Author SHA1 Message Date
Andrew Kelley
e8a9caa3dd
add suggestion to AutoHash compile error message 2019-08-28 14:38:55 -04:00
Andrew Kelley
d5b3d97c23
Merge pull request #2760 from Vexu/fmt-comment-fix
Fix non-empty comments getting removed with empty comments
2019-08-28 12:01:08 -04:00
yvt
c98f792ff8 Improve the handling of zig fmt: off/on
This commit reworks the handling of `zig fmt: off/on`. A motivating
example is shown below:

    const c = d;
    // zig fmt: off
    // comment
    const a = b;
    // zig fmt: on

Before processing the decl `const a = b;`, `renderRoot` looks for
`zig fmt: off` that appears between this decl and the previous one. If
it finds one, it searches for the next `zig fmt: on` that re-enables
reformatting (or EOF if none was found), and copies the input code
between `zig fmt: off` and `zig fmt: on` to the output stream. After
that, it proceeds to the next decl.

The important thing to notice here is that `renderTopLevelDecl` emits
line comment tokens that follow the decl. Therefore, when copying code,
we must be careful not to copy the line comment tokens that already have
been written to the output stream. The original code failed to take this
fact into consideration. It did skip `// zig fmt: off`, but not the
remaining ones. As a result, when the above example is fed as input, it
duplicated the line `// comment`.
2019-08-28 11:57:01 -04:00
Robin Voetter
50c37c75d1 add arm32 syscall conventions 2019-08-28 17:41:49 +02:00
Robin Voetter
32f4606cec add arm32 linux bits definitions 2019-08-28 16:35:23 +02:00
Marc Tiehuis
ac477f3c9a
Merge pull request #3060 from Sahnvour/hashing
auto_hash with deep/shallow hashing
2019-08-28 21:25:50 +12:00
Marc Tiehuis
fbcdf78cbd Simplify wyhash and improve speed
This removes the exposed stateless variant since the standard variant
has similar speed now.

Using `./benchmark --filter wyhash --count 1024`, the speed change has
changed from:

    wyhash
       iterative: 4093 MiB/s [6f76b0d5db7db34c]
      small keys: 3132 MiB/s [28c2f43c70000000]

to

    wyhash
       iterative: 6515 MiB/s [673e9bb86da93ea4]
      small keys: 10487 MiB/s [28c2f43c70000000]
2019-08-27 19:42:37 +02:00
Andrew Kelley
35a374efe0
Merge pull request #3115 from ziglang/fix-field-alignment-kludge
fix field alignment kludge by implementing lazy values
2019-08-27 13:02:31 -04:00
Marc Tiehuis
326b7b794b
Improve siphash performance for small keys by up to 30% (#3124)
This removes the partial buffer handling from the full slice api.

`./benchmark --filter siphash --count 1024`

old

    siphash(1,3)
       iterative: 3388 MiB/s [67532e53a0d210bf]
      small keys: 1258 MiB/s [948c91176a000000]
    siphash(2,4)
       iterative: 2061 MiB/s [f792d39bff42f819]
      small keys:  902 MiB/s [e1ecba6614000000]

new

    siphash(1,3)
       iterative: 3410 MiB/s [67532e53a0d210bf]
      small keys: 1639 MiB/s [948c91176a000000]
    siphash(2,4)
       iterative: 2053 MiB/s [f792d39bff42f819]
      small keys: 1074 MiB/s [e1ecba6614000000]
2019-08-27 20:13:57 +12:00
Andrew Kelley
6569bfc85e
fix some std lib dependency loops 2019-08-26 11:23:25 -04:00
Sahnvour
90e921f7a7 wyhash: readd the stateful streaming version so that both are available
and rename the stateless one so that's it is not the default option
2019-08-24 15:37:47 +02:00
Sahnvour
4c882e731f hash_map: adding a StringHashMap for convenience 2019-08-24 15:30:23 +02:00
Sahnvour
1498ccac2a auto_hash: better generic hashing implementation
autoHash forbids slices as input
hash was added to handle all types from autoHash plus slices, with a specified strategy
2019-08-24 15:30:23 +02:00
Marc Tiehuis
a610352271 std/hash: Revert crc32 api change
This is user specified and the user doesn't necessarily have to use one
of the provided polynomials declared hence we can't use an enum.

Thanks @daurnimator for catching this.
2019-08-24 19:05:05 +12:00
Andrew Kelley
ec2f9ef4e8
Merge pull request #3114 from Tetralux/align-on-struct-fields
parsing and rendering of align(N) on struct fields
2019-08-23 11:19:27 -04:00
Tetralux
43587af01a
rendering of align(N) on struct fields 2019-08-22 22:58:38 +00:00
Tetralux
3ec10ea174
parsing of align(N) on struct fields 2019-08-22 22:58:02 +00:00
Marc Tiehuis
0e75fef1de
Merge pull request #3106 from ziglang/hash-tooling-changes
Hash tooling changes
2019-08-21 21:54:12 -10:00
Andrew Kelley
ec7d7a5b14
Merge pull request #2991 from emekoi/mingw-ci
mingw improvements
2019-08-21 12:29:42 -04:00
Marc Tiehuis
16fa255f48 Inline full slice hashing
This gives moderate speed improvements when hashing small keys.
The crc/adler/fnv inlining did not provide enough speed up to warrant
the change.

OLD:

wyhash
  small keys: 2277 MiB/s [c14617a1e3800000]
siphash(1,3)
  small keys:  937 MiB/s [b2919222ed400000]
siphash(2,4)
  small keys:  722 MiB/s [3c3d974cc2800000]
fnv1a
  small keys: 1580 MiB/s [70155e1cb7000000]
adler32
  small keys: 1898 MiB/s [00013883ef800000]
crc32-slicing-by-8
  small keys: 2323 MiB/s [0035bf3dcac00000]
crc32-half-byte-lookup
  small keys:  218 MiB/s [0035bf3dcac00000]

NEW:

wyhash
  small keys: 2775 MiB/s [c14617a1e3800000]
siphash(1,3)
  small keys: 1086 MiB/s [b2919222ed400000]
siphash(2,4)
  small keys:  789 MiB/s [3c3d974cc2800000]
fnv1a
  small keys: 1604 MiB/s [70155e1cb7000000]
adler32
  small keys: 1856 MiB/s [00013883ef800000]
crc32-slicing-by-8
  small keys: 2336 MiB/s [0035bf3dcac00000]
crc32-half-byte-lookup
  small keys:  218 MiB/s [0035bf3dcac00000]
2019-08-21 21:38:02 +12:00
Marc Tiehuis
7854a52a6b Add iterative-only filter to hash benchmark 2019-08-21 21:02:24 +12:00
Marc Tiehuis
48410943cb Add more hash functions to benchmark scripts
Changed CRC api so the polynomial is specified as an enum for simpler
construction.
2019-08-21 20:46:15 +12:00
Marc Tiehuis
c050ec4e57 Update hash/crypto benchmark scripts 2019-08-21 20:34:12 +12:00
Andrew Kelley
9bf283c085
fixups
* getrandom libc prototypes had the wrong return type
 * `total_read` local variable was unnecessary since the sub-slice
   buffer has a length
 * I was able to get rid of all the integer casts
 * the err == 0 check can be a switch case
 * add missing `return` statement
2019-08-20 15:25:30 -04:00
Euan Torano
79354243e3
fix os.getrandom logic to fill the entire buffer 2019-08-20 14:52:38 -04:00
Euan Torano
8c32c09807
Fix InStream.readNoEof 2019-08-20 14:52:10 -04:00
Andrew Kelley
c175e53564
add std.c.printf 2019-08-20 14:42:39 -04:00
Marc Tiehuis
e0447c6ddd std/fmt: Make FormatOptions arguments non-comptime
No need and should help avoid exessive function monomorphizaton.
2019-08-19 22:28:13 +12:00
Marc Tiehuis
98859c885e std/fmt.zig: Pass full options struct to all internal functions
The fill specifier is now handled in some cases. The default fill of '0'
is now ' ' for integers and non-byte sequences.
2019-08-19 22:15:15 +12:00
Marc Tiehuis
6844dafeca std/fmt: Move pointer parsing out of main state machine
This allows us to format a pointer with alignment/padding as we would
with any other format specifier.

e.g. {*:5}
2019-08-18 11:06:54 +12:00
Andrew Kelley
456a244d62 fix event loop regression on macos 2019-08-17 11:40:48 -04:00
Andrew Kelley
e24cc2e77b
std.event.Loop: fix not waking up after file system I/O
for single threaded event loops
2019-08-16 23:19:13 -04:00
Andrew Kelley
3dce41b61a
improvements to std lib for event-based I/O 2019-08-16 21:29:29 -04:00
Vexu
c3407ed097
Merge branch 'master' into comment-in-array 2019-08-16 20:02:47 +03:00
Andrew Kelley
13c584d325
add compile error for casting const frame to anyframe
See #3063
2019-08-16 11:38:41 -04:00
Vexu
92a81252cb
Merge branch 'master' into fmt-comment-fix 2019-08-16 17:40:20 +03:00
Andrew Kelley
7874d5a40b
zig fmt: add more test cases 2019-08-16 10:11:53 -04:00
Vexu
2151f84d59 implement new async syntax in self-hosted compiler 2019-08-16 06:17:28 -07:00
Andrew Kelley
7e75e1075e
zig fmt 2019-08-15 18:19:04 -04:00
Andrew Kelley
13b5a4bf8c
remove cancel 2019-08-15 14:05:12 -04:00
Andrew Kelley
5092634103
avoid the word "coroutine", they're "async functions" 2019-08-13 14:14:19 -04:00
Andrew Kelley
12ff91c1c9
alignment of structs no longer depends on LLVM
fixes async function tests in optimized builds
2019-08-13 12:44:30 -04:00
Andrew Kelley
8a9289996a
Merge remote-tracking branch 'origin/master' into rewrite-coroutines 2019-08-13 11:39:32 -04:00
Andrew Kelley
24d5ec0783
fix async function frames not aligned enough 2019-08-11 22:35:12 -04:00
Andrew Kelley
4d8d513e16
all tests passing 2019-08-11 19:53:10 -04:00
Andrew Kelley
1b83ee78a4
allow comptime_int to implicit cast to comptime_float 2019-08-11 12:01:02 -04:00
data-man
4bd4c5e06d Fixed tiny typo in the math module (shr's description) 2019-08-11 08:15:42 -07:00
Nick Erdmann
70e62b8612
std/os/uefi: some more events 2019-08-11 15:50:03 +02:00
Nick Erdmann
47ce736abe
std/os/uefi: add basic Event support 2019-08-10 19:14:47 +02:00
Nick Erdmann
9445b3f057
std/os/uefi: change type of Handle from @OpaqueType to *@OpaqueType 2019-08-10 19:14:31 +02:00