16206 Commits

Author SHA1 Message Date
Marc Tiehuis
06ae13fe35 stage1: fix bigint_init_bigfloat for single-limb negative floats
Fixes #10592.
2022-02-02 21:09:36 -07:00
Jakub Konka
dafbc6eb25 Merge branch 'Luukdegram-linker-eport-symbols' 2022-01-12 12:01:32 -07:00
Andrew Kelley
6f49233ac6 Merge pull request #10572 from Luukdegram/wasm-linker-stack
Stage2: wasm-linker - Place stack at the beginning of the linear memory
2022-01-12 12:00:03 -07:00
riverbl
bb8eef8d24 translate-c: Fix macro define of float constant using scientific notation
Fixes compiler attempting to use null value when translating macro define of float constant using scientific notation with no decimal point
2022-01-12 11:59:30 -07:00
afranchuk
511990c83b Fix a bug in std.Thread.Condition and add a basic Condition test. (#10538)
* Fix FUTEX usage in std.Thread.Condition - It was using an old name.
2022-01-12 11:59:09 -07:00
Andrew Kelley
9fa55ae777 Merge pull request #10566 from fifty-six/master
std.os.uefi improvements/fixes
2022-01-12 11:59:02 -07:00
Evan Haas
53e41682ba translate-c: Handle typedef'ed void return type for functions.
Fixes #10356
2022-01-12 11:58:42 -07:00
Jakub Konka
3542dcad33 zig cc: integration with sysroot arg (#10568)
Prior to this change, even if the use specified the sysroot on the
compiler line like so

```
zig cc --sysroot=/path/to/sdk
```

it would only be used as a prefix to include paths and not as a prefix
for `zig ld` linker.
2022-01-12 11:58:36 -07:00
djg
9b97edb012 std: hash_map: optimize isFree/isTombstone (#10562)
- Add an `Metadata.isFree` helper method.
- Implement `Metadata.isTombstone` and `Metadata.isFree` with `@bitCast` then comparing to a constant. I assume `@bitCast`-then-compare is faster than the old method because it only involves one comparison, and doesn't require bitmasking.
- Summary of benchmarked changes (`gotta-go-fast`, run locally, compared to master):
  - 3/4 of the hash map benchmarks used ~10% fewer cycles
  - The last one (project Euler) shows 4% fewer cycles.
2022-01-12 11:58:24 -07:00
Jakub Konka
1c61038255 Build fs/filesystem libcxx module when targeting GNU Win 2022-01-12 11:57:40 -07:00
Meghan Denny
73cbc13a97 std: fix zig.Ast being called Tree internally 2022-01-12 11:56:45 -07:00
r00ster
adf7c654d4 Add missing package to the langref that's always available 2022-01-12 11:56:10 -07:00
Ryan Liptak
2304dbaba4 Add CANNOT_DELETE as a possible error in os.windows.DeleteFile
Can happen when e.g. trying to delete a file with the Read Only flag set
2022-01-12 11:54:31 -07:00
Andrew Kelley
675590cd44 Merge pull request #10499 from paulsnar/paulsnar/stage1-packed-structs-cabi
stage1: Fix LLVM C ABI type resolution for small packed structs
2022-01-12 11:54:04 -07:00
Vincent Rischmann
4d38f456ea io_uring: improve IO_Uring.copy_cqe
copy_cqes() is not guaranteed to return as many CQEs as provided in the
`wait_nr` argument, meaning the assert in `copy_cqe` can trigger.

Instead, loop until we do get at least one CQE returned.

This mimics the behaviour of liburing's _io_uring_get_cqe.
2022-01-12 11:53:42 -07:00
Andrew Kelley
8771ef897a readme: dynamic logo light/dark 2022-01-12 11:53:28 -07:00
Jimmi Holst Christensen
1676729c66 fmt: Refactor parsing of placeholders into its own function
This saves on comptime format string parsing, as the compiler caches
comptime calls. The catch here, is that parsePlaceHolder cannot take the
placeholder string as a slice. It must take it as an array by value for
the caching to occure.

There is also some logic in here that ensures that the specifier_arg is
always them same slice when the items they contain are the same. This
makes the compiler stamp out less copies of formatType.
2022-01-12 11:53:07 -07:00
Vincent Rischmann
eee395287f io_uring: fix version check in tests
For renameat, unlinkat, mkdirat, symlinkat and linkat the error code
differs between kernel 5.4 which returns EBADF and kernel 5.10 which returns EINVAL.

Fixes #10466
2022-01-12 11:52:11 -07:00
r00ster
419499b252 std.fmt: improve @compileError message 2022-01-12 11:51:26 -07:00
Marian Beermann
47e3deeeaa stage1: fix @errorName null termination 2022-01-12 11:51:10 -07:00
Frank Denis
c4b4192d20 Y++ 2022-01-12 11:50:57 -07:00
Tom Manner
64a2b14f26 Fixed typo in deprecation error for E format specifier where it would instead complain about a specifier of X. 2021-12-31 14:23:59 -07:00
Veikka Tuominen
9a0010b186 stage1: fix access of slice sentinel at comptime 2021-12-31 14:23:49 -07:00
Ali Chraghi
b86aadfa38 std: Skip comptime struct fields in mem.zeroes() (#10406)
closes #9934
2021-12-31 14:22:38 -07:00
Dante Catalfamo
4d9377923d Add BSD Authentication constants (#10376) 2021-12-31 14:21:22 -07:00
Stephen Lumenta
cfc00e743e fix expectStringEndsWith error output.
before it started outputting the actual starting, not ending characters.
2021-12-31 14:20:09 -07:00
Jonathan S
f5cb3fc688 Only check the file's length once in pdb.Msf.init 2021-12-31 14:20:02 -07:00
ominitay
acdb859644 Fix dead link 2021-12-31 14:19:36 -07:00
John Schmidt
20f073dcdd Langref: replace mentions of c_void with anyopaque 2021-12-31 14:19:11 -07:00
Andrew Kelley
69e2b712bc start the 0.9.1 release cycle 2021-12-31 14:17:52 -07:00
Andrew Kelley
a18bf7a7bf Release 0.9.0 0.9.0 2021-12-20 13:13:19 -07:00
joachimschmidt557
ecf0050a92 stage2 AArch64: Implement saving callee-saved registers 2021-12-19 23:24:44 -08:00
Kenta Iwasaki
5c7f2ab011 stage1: deal with BPF not supporting @returnAddress()
Make `@returnAddress()` return for the BPF target, as the BPF target for
the time being does not support probing for the return address. Stack
traces for the general purpose allocator for the BPF target is also set
to not be captured.
2021-12-19 23:22:05 -08:00
Lee Cannon
16b7535497
Allocator: allocBytes and reallocBytes (#10352)
Closes #10348
2021-12-19 01:58:13 -05:00
Andrew Kelley
80b21cef5a langref: fix tidy html error
regressed in 8468b544e8769b774e2e5988a58c51d991df999a
2021-12-18 23:57:00 -07:00
Andrew Kelley
07c03f85a8 zig test: fix test runner detection of tty
Before, `std.Progress` was printing unwanted stuff to stderr. Now, the
test runner's logic to detect whether we should print each test as a
separate line to stderr is properly activated.
2021-12-18 23:45:32 -07:00
Isaac Freund
9f9f215305
stage1, stage2: rename c_void to anyopaque (#10316)
zig fmt now replaces c_void with anyopaque to make updating
code easy.
2021-12-19 00:24:45 -05:00
bnprks
8468b544e8
Add Vector documentation (#10303)
* Create Vector language documentation

Main changes to docs:
1. Create brief documentation on Zig vector types with code example
2. Get rid of the SIMD sub-heading under the main Vectors heading,
and update links accordingly
3. Add an example to the `@shuffle` docs
2021-12-18 23:40:57 -05:00
Jakub Konka
a08137330c macho: handle -install_name option for dylibs/MachO
The status quo for the `build.zig` build system is preserved in
the sense that, if the user does not explicitly override
`dylib.setInstallName(...);` in their build script, the default
of `@rpath/libname.dylib` applies. However, should they want to
override the default behaviour, they can either:

1) unset it with

```dylib.setIntallName(null);```

2) set it to an explicit string with

```dylib.setInstallName("somename.dylib");```

When it comes to the command line however, the default is not to
use `@rpath` for the install name when creating a dylib. The user
will now be required to explicitly specify the `@rpath` as part
of the desired install name should they choose so like so:

1) with `build-lib`

```
zig build-lib -dynamic foo.zig -install_name @rpath/libfoo.dylib
```

2) with `cc`

```
zig cc -shared foo.c -o libfoo.dylib -Wl,"-install_name=@rpath/libfoo.dylib"
```
2021-12-18 17:55:53 -08:00
Jacob G-W
9a8fdbe0a0 plan9 linker: fix off by 1 error 2021-12-18 17:54:20 -08:00
Andrew Kelley
6adecdc58a init-exe template: build.zig: setTarget on the tests 2021-12-18 17:29:46 -07:00
fubark
88ea2cb757 Make Builder.spawnChildEnvMap public 2021-12-18 15:25:09 -08:00
joachimschmidt557
9892684d35 stage2 ARM: spill insts currently in compare flags if necessary 2021-12-18 15:23:25 -08:00
Jens Goldberg
5b29b4ffa6 Fix MIPS inline assembly clobbers 2021-12-18 14:42:01 -08:00
Andrew Kelley
6d04de706a Revert "std: optimize hash_map probe loop condition"
This reverts commit 11803a3a569205d640c7ec0b0aedba83f47a6e64.

Observations from the performance dashboard:
 * strictly worse in terms of CPU instructions
 * slightly worse wall time (but this can be noisy)
 * sometimes better, sometimes worse for branch predictions

Given that the commit was introducing complexity for optimization's
sake, these performance changes do not seem worth it.
2021-12-17 16:56:43 -07:00
sentientwaffle
11803a3a56 std: optimize hash_map probe loop condition
See https://github.com/ziglang/zig/pull/10337 for context.

In #10337 the `available` tracking fix necessitated an additional condition on the probe loop in both `getOrPut` and `getIndex` to prevent an infinite loop. Previously, this condition was implicit thanks to the guaranteed presence of a free slot.

The new condition hurts the `HashMap` benchmarks (https://github.com/ziglang/zig/pull/10337#issuecomment-996432758).

This commit removes that extra condition on the loop. Instead, when probing, first check whether the "home" slot is the target key — if so, return it. Otherwise, save the home slot's metadata to the stack and temporarily "free" the slot (but don't touch its value). Then continue with the original loop. Once again, the loop will be implicitly broken by the new "free" slot. The original metadata is restored before the function returns.

`getOrPut` has one additional gotcha — if the home slot is a tombstone and `getOrPut` misses, then the home slot is is written with the new key; that is, its original metadata (the tombstone) is not restored.

Other changes:

- Test hash map misses.
- Test using `getOrPutAssumeCapacity` to get keys at the end (along with `get`).
2021-12-17 15:21:41 -08:00
Andrew Kelley
e8b39960bb
Merge pull request #10342 from Arnavion/pq-comparefn-context
std.priority_{de,}queue: allow comparator to take context parameter
2021-12-17 14:34:32 -08:00
Felix "xq" Queißner
c1745b2896 Actually installs the implib for DLLs. 2021-12-17 14:31:59 -08:00
sentientwaffle
ef0566df78 std: count hash_map tombstones as available
When entries are inserted and removed into a hash map at an equivalent rate (maintaining a mostly-consistent total count of entries), it should never need to be resized. But `HashMapUnmanaged.available` does not presently count tombstoned slots as "available", so this put/remove pattern eventually panics (assertion failure) when `available` reaches `0`.

The solution implemented here is to count tombstoned slots as "available". Another approach (which hashbrown (b3eaf32e60/src/raw/mod.rs (L1455-L1542)) takes) would be to rehash all entries in place when there are too many tombstones. This is more complex but avoids an `O(n)` bad case when the hash map is full of many tombstones.
2021-12-16 19:11:53 -08:00
Lee Cannon
d54ba76e40 TracyAllocator: correct order of free and alloc 2021-12-16 19:09:57 -08:00