Andrew Kelley
10541c8fc8
Merge branch 'lazy-sizeof'
2019-08-29 22:44:21 -04:00
Andrew Kelley
e9a4bcbcc6
fix regressions
2019-08-29 22:44:07 -04:00
Andrew Kelley
03910925f0
await does not force async if callee is blocking
...
closes #3067
2019-08-29 21:51:37 -04:00
Andrew Kelley
8e93991634
avoid unnecessarily requiring alignment for array elem pointers
2019-08-29 16:25:58 -04:00
Andrew Kelley
0512beca9d
comparing against zero participates in lazy values
2019-08-29 14:46:22 -04:00
Andrew Kelley
d9f0446b1f
make @sizeOf lazy
2019-08-29 12:43:56 -04:00
Andrew Kelley
94bbb46ca6
fix not fully resolving debug info for structs causing llvm error
2019-08-29 10:29:48 -04:00
Shritesh
834a789bb9
Use LLVM path provided by homebrew
2019-08-29 10:19:35 -04:00
Andrew Kelley
e8a9caa3dd
add suggestion to AutoHash compile error message
2019-08-28 14:38:55 -04:00
Andrew Kelley
af90da1531
fix implicit cast from zero sized array ptr to slice
...
closes #1850
2019-08-28 12:16:52 -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
Andrew Kelley
7139eef4cf
implement lazy values for error union types
...
closes #3129
2019-08-28 11:17:20 -04: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
Andrew Kelley
47fcbfdc51
add regression test for already fixed bug
...
closes #3112
2019-08-27 17:39:06 -04:00
Andrew Kelley
f4519c520a
support self-referential struct through a slice of optional
...
by making optionals even more lazy
closes #1805
2019-08-27 16:55:58 -04:00
Andrew Kelley
c1fd7ed6e2
add regression test for struct with optional list of self
...
closes #1735
2019-08-27 14:06:17 -04:00
Andrew Kelley
428a2fdedd
better handle struct depends on itself via optional field
...
closes #1995
2019-08-27 13:59:18 -04:00
Andrew Kelley
e1b258f39f
add regression test for bug fixed by lazy values
...
closes #624
2019-08-27 13:44:04 -04: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
8fef23a525
add regression test for bug fixed by lazy values
...
closes #1310
2019-08-27 13:36:42 -04: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
Andrew Kelley
d9ed55f017
fix not properly casting align values
...
and add check for alignment specified on enum fields
2019-08-27 12:54:50 -04:00
Andrew Kelley
7d34e55a71
add a TODO compile error for union field alignment syntax
...
See #3125
2019-08-27 10:45:28 -04:00
Andrew Kelley
ffac0b02e7
implement and test struct field explicit alignment
2019-08-27 10:14:11 -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
a2e8ef77e2
fix regression in one of the doc examples
2019-08-26 22:50:12 -04:00
Andrew Kelley
db50cf7049
fix more compile error regressions
2019-08-26 22:38:45 -04:00
Andrew Kelley
1df75da918
remove no longer needed gcc8 workaround. add gcc9 workaround
...
Occasionally LLVM headers generate warnings with newer gcc versions and
since we use -Werror this has to be worked around.
2019-08-26 21:40:44 -04:00
Andrew Kelley
bad4b040cc
miscellaneous fixes regarding compile errors
2019-08-26 18:35:36 -04:00
Andrew Kelley
ca145a6d5a
fix regression in ir_get_ref
2019-08-26 15:43:39 -04:00
Andrew Kelley
ae65c236c5
fix regression with global variable assignment...
...
...with optional unwrapping with var initialized to undefined
2019-08-26 15:24:24 -04:00
Andrew Kelley
d316f70450
fix regression on struct field with undefined type
2019-08-26 14:01:59 -04:00
Andrew Kelley
73a7747a9c
fix some compile error regressions
2019-08-26 12:43:36 -04:00
Andrew Kelley
6569bfc85e
fix some std lib dependency loops
2019-08-26 11:23:25 -04:00
Andrew Kelley
e1a4bcbdfd
fix dependency loop errors with zig build
2019-08-26 10:43:07 -04:00
Andrew Kelley
ede0c22a67
make @alignOf lazily evaluate the target type
...
this case works now:
```zig
const Foo = struct {
field: Bar(@alignOf(*Foo)),
};
fn Bar(comptime alignment: u29) type {
return struct {
field: *align(alignment) Foo,
};
}
```
2019-08-26 10:03:30 -04:00
Andrew Kelley
b13af0750f
fix assertion tripped instead of reporting compile error
2019-08-25 21:45:11 -04:00
Andrew Kelley
720302a640
fix resolution detection of pointer types
2019-08-25 21:28:16 -04:00
Andrew Kelley
a7f3158185
behavior tests passing
2019-08-25 21:16:03 -04:00
Andrew Kelley
64e9b0ee46
make the zero-bit-ness of pointers lazy
...
this case works now:
```zig
const Foo = struct {
field: @typeOf(func).ReturnType,
};
fn func(self: *Foo) void {}
```
2019-08-25 20:27:56 -04:00
Andrew Kelley
8f41da2216
fix behavior test regressions with unions
2019-08-25 11:42:19 -04:00
Andrew Kelley
fa6c20a02d
hook up unions with lazy values
...
this case works now:
```zig
const Expr = union(enum) {
Literal: u8,
Question: *Expr,
};
```
2019-08-25 11:34:07 -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
50a80261dc
Merge pull request #3118 from ziglang/revert-crc-poly-api
...
std/hash: Revert crc32 api change
2019-08-24 20:47:45 +12: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
d277a1196b
tracking these issues on github now
2019-08-23 17:54:01 -04:00
Andrew Kelley
e8bad1e12a
fix regression on @ptrCast
...
this case regressed and now fixed:
```zig
const a: ?*i32 = undefined;
const b: ?*f32 = @ptrCast(?*f32, a);
```
2019-08-23 17:39:56 -04:00