5365 Commits

Author SHA1 Message Date
Ryan Liptak
f8d2b87fa1 Update doc comment of ArrayHashMap to include 4th arg in eql fns
4th argument was added in cf88cf2657d721c68055a284e8c498a18639f74c
2022-04-18 03:47:03 -04:00
Yusuf Bham
2aeaa1cfc4
std.os.uefi: fix GUID formatting (#11452) 2022-04-17 06:15:15 -04:00
Cody Tapscott
7b090df668 stdlib std.os: Improve wasi-libc parity for WASI CWD emulation
Two major changes here:
  1. We store the CWD as a simple `[]const u8` and lookup Preopens for
     every absolute or CWD-referenced file operation, based on the
     Preopen with the longest match (i.e. most specific path)
  2. Preorders are normalized to POSIX absolute paths at init time.
     Behavior depends on the "cwd_root" parameter of `initPreopensWasi`:

	`cwd_root` is used for any Preopens that start with "."

	  For example:
            "./foo/bar" - inits to -> "{cwd_root}/foo/bar"
            "foo/bar"   - inits to -> "/foo/bar"
	    "/foo/bar"  - inits to -> "/foo/bar"

        `cwd_root` must be an absolute path.

	Using "/" as `cwd_root` gives behavior similar to wasi-libc.
2022-04-16 18:08:05 +02:00
Jakub Konka
8f75823728
Merge pull request #11446 from ziglang/aarch64-macos-llvm
stage2: fix behavior test failures on aarch64-macos (LLVM+native), and other minor fixes
2022-04-16 18:07:02 +02:00
Andrew Kelley
a315d51c0a
Merge pull request #11437 from koachan/sparc64-mutex
compiler_rt: atomics: Add TAS lock support for SPARC
2022-04-16 06:36:54 -04:00
Andrew Kelley
e428f85cfd
Merge pull request #11445 from viriuwu/f80-freebsd-tests
re-enable f80 tests on freebsd
2022-04-16 06:26:14 -04:00
Jakub Konka
897df18573 stage2: fix @mulAdd on aarch64 Darwin
According to Apple docs, the long double type is a double precision
IEEE754 binary floating-point type, which makes it identical to the
double type. This behavior contrasts to the standard specification,
in which a long double is a quad-precision, IEEE754 binary,
floating-point type.

Thus, we need to take this into account when using the compiler
intrinsics so that we select the correct function version for
FloatMulAdd.
2022-04-16 12:23:47 +02:00
Andrew Kelley
ec8a6544a3
Merge pull request #11444 from kprotty/treap
Introduce std.Treap
2022-04-16 06:23:18 -04:00
Jakub Konka
1b5a43fdf7 start.zig: make sure macos uses full startup code 2022-04-16 12:07:34 +02:00
Andrew Kelley
578a792b33
Merge pull request #11442 from Vexu/stage3
Make self hosted compiler capable of building itself
2022-04-16 05:42:25 -04:00
vi
4ad1480298
std.math.fabs: enable f80 testing 2022-04-15 16:52:02 -06:00
vi
2ef9a0d9ae
std.math: enable f80 tests on freebsd 2022-04-15 16:50:00 -06:00
kprotty
33952dad12 treap: zig fmt 2022-04-15 17:01:01 -05:00
kprotty
4d0303b992 treap: fix + determinstically randomize test cases. 2022-04-15 16:30:45 -05:00
Veikka Tuominen
101aac92c2 stage2: fix bugs preventing stage2 from building stage3 with LLVM 2022-04-15 23:32:26 +03:00
kprotty
7284eb22dc treap: initial implementation 2022-04-15 15:26:51 -05:00
Veikka Tuominen
7be62f695f stage2 llvm: fix optional pointers to zero bit payloads 2022-04-15 19:17:50 +03:00
Andrew Kelley
4c83b11f71
Merge pull request #11438 from Vexu/stage2-fixes
Stage2 fixes
2022-04-15 12:02:55 -04:00
Rekai Musuka
02a43f325b std/math.zig: resolve missed optimization in rotates 2022-04-15 11:51:50 -04:00
Koakuma
33956b8e55 compiler_rt: atomics: clr -> clrb 2022-04-15 19:48:25 +07:00
Koakuma
fac2a2e754 compiler_rt: atomics: Formatting change for flag definition 2022-04-15 19:44:46 +07:00
Koakuma
5b283fba77 compiler_rt: atomics: Add Leon CAS instruction check for SPARC atomics 2022-04-15 19:40:36 +07:00
Koakuma
6aa89115f9 ompiler_rt: atomics: Split long lines and add comment on constants 2022-04-15 19:31:55 +07:00
iddev5
d9f9948b65 std.build: add test for issue 10381 2022-04-15 17:44:34 +05:30
r00ster91
62d717e2ff Add std.unicode.replacement_character 2022-04-15 11:20:11 +03:00
Evan Haas
618398b7d3 std.fs: prevent possible integer overflow in Dir.makePath
The call to `makeDir` for the top-level component of `sub_path`
can return `error.FileNotFound` if the directory represented by
`self` has been deleted.

Fixes #11397
2022-04-15 11:19:23 +03:00
Veikka Tuominen
845a30624f std: add workaround for stage2 bug 2022-04-15 11:17:19 +03:00
Veikka Tuominen
6ad510d832 update self hosted sources to language changes 2022-04-15 11:17:19 +03:00
Koakuma
274e2a1ef1 compiler_rt: atomics: Add TAS lock support for SPARC
Some SPARC CPUs (particularly old and/or embedded ones) only has atomic
TAS instruction available (`ldstub`). This adds support for emitting
that instruction in the spinlock.
2022-04-15 08:09:57 +07:00
Jakub Konka
2635e4ca6e
Merge pull request #11434 from koachan/sparc64-codegen 2022-04-14 21:38:35 +02:00
Andrew Kelley
2587474717 stage2: progress towards stage3
* The `@bitCast` workaround is removed in favor of `@ptrCast` properly
   doing element casting for slice element types. This required an
   enhancement both to stage1 and stage2.
 * stage1 incorrectly accepts `.{}` instead of `{}`. stage2 code that
   abused this is fixed.
 * Make some parameters comptime to support functions in switch
   expressions (as opposed to making them function pointers).
 * Avoid relying on local temporaries being mutable.
 * Workarounds for when stage1 and stage2 disagree on function pointer
   types.
 * Workaround recursive formatting bug with a `@panic("TODO")`.
 * Remove unreachable `else` prongs for some inferred error sets.

All in effort towards #89.
2022-04-14 10:12:45 -07:00
Koakuma
c07213269f stage2: zig fmt 2022-04-14 23:26:03 +07:00
Koakuma
43e69be196 stage2: sparcv9: Add exit2 implementation 2022-04-14 22:18:06 +07:00
Koakuma
1f63afa7c9 stage2: sparcv9: Register the backend in stdlib & driver 2022-04-14 22:18:06 +07:00
Andrew Lee
9b82e7f558 std/bounded_array.zig: Add Writer interface 2022-04-14 02:56:40 -04:00
vi
6ad9ac59e7 std.math.float: fix f80-backed c_longdouble consts 2022-04-14 02:55:46 -04:00
Eric Shrewsberry
497f8a6098 Fix bug in PriorityQueue::removeIndex()
Fix to call siftDown on the removed index instead of always on index 0.
Updated test to a test that fails before and passes now.

PriorityDequeue does not have this issue.
2022-04-14 02:54:41 -04:00
Ryan Liptak
9c509f1526 Enable passing 'Dir.rename directories' fs test on Windows
Looks like d3f87f8ac01039722197a13a12342fc747a90567 fixed the standard cases of dir renaming, but the edge cases (renaming onto an existing empty/non-empty directory) are still behaving differently than on non-Windows.
2022-04-13 19:55:16 +02:00
Cody Tapscott
319555a669 Add floatFractionalBits to replace floatMantissaDigits 2022-04-12 12:33:16 -07:00
Cody Tapscott
04dd43934a Skip some floatXiYf tests on non-x86 platforms
These need to be skipped because of a bug with `@floatToInt`
on stage1:  https://github.com/ziglang/zig/issues/11408
2022-04-12 10:25:29 -07:00
Cody Tapscott
1c1cfe1533 Skip @rem/@mod tests on stage2, due to missing fmodl implementation 2022-04-12 10:25:29 -07:00
Cody Tapscott
b5d5685a4e compiler_rt: Implement floatXiYf/fixXfYi, incl f80
This change:
 - Adds  generic implementation of the float -> integer conversion
   functions floatXiYf, including support for f80
 - Updates the existing implementation of integer -> float conversion
   fixXiYf to support f16 and f80
 - Fixes the handling of the explicit integer bit in `__trunctfxf2`
 - Combines the test cases for fixXfYi/floatXiYf into a single file
 - Renames `fmodl` to `fmodq`, since it operates on 128-bit floats

The new implementation for floatXiYf has been benchmarked, and generally
provides equal or better performance versus the current implementations:

Throughput (MiB/s) - Before
     |    u32   |    i32   |    u64   |    i64   |   u128   |   i128   |
-----|----------|----------|----------|----------|----------|----------|
 f16 |     none |     none |     none |     none |     none |     none |
 f32 |  2231.67 |  2001.19 |  1745.66 |  1405.77 |  2173.99 |  1874.63 |
 f64 |  1407.17 |  1055.83 |  2911.68 |  2437.21 |  1676.05 |  1476.67 |
 f80 |     none |     none |     none |     none |     none |     none |
f128 |   327.56 |   321.25 |   645.92 |   654.52 |  1153.56 |  1096.27 |

Throughput (MiB/s) - After
     |    u32   |    i32   |    u64   |    i64   |   u128   |   i128   |
-----|----------|----------|----------|----------|----------|----------|
 f16 |  1407.61 |  1637.25 |  3555.03 |  2594.56 |  3680.60 |  3063.34 |
 f32 |  2101.36 |  2122.62 |  3225.46 |  3123.86 |  2860.05 |  1985.21 |
 f64 |  1395.57 |  1314.87 |  2409.24 |  2196.30 |  2384.95 |  1908.15 |
 f80 |   475.53 |   457.92 |   884.50 |   812.12 |  1475.27 |  1382.16 |
f128 |   359.60 |   350.91 |   723.08 |   706.80 |  1296.42 |  1198.87 |
2022-04-12 10:25:26 -07:00
Andrew Kelley
17631cb2d3
Merge pull request #11401 from viriuwu/float-category-misc
math: simplify inf (+f80 support), deprecate old constants (followup for #10133)
2022-04-12 06:37:12 -04:00
Ryan Liptak
17daba1806 std/fs/test.zig: Add test for renaming a dir onto an empty dir
Also split the Dir.rename on directories test into 3 tests:
- General rename of a directory
- Rename of a directory onto an existing empty directory
- Rename of a directory onto an existing non-empty directory

The only new case is the rename onto an existing empty directory, but splitting the tests this way made them much more understandable.
2022-04-12 06:28:16 -04:00
Isaac Freund
38d6e1d8a8 std.build: Fix transitive linkSystemLibraryName() dependencies
Currently transitive system library dependencies are always linked using
linkSystemLibrary() and therefore pkg-config even if they were
originally specified with linkSystemLibraryName() instead. This causes
problems in practice for projects needing total control over exactly
what library is linked, such as the mach game engine.

This is fixed by keeping track of whether libraries are to be linked
with pkg-config or not and holding off on actually running pkg-config
until after transitive dependency resolution in LibExeObjStep.make().

This also fixes a separate issue with the pkg-config handling that could
cause partial application of pkg-config flags if the first part of the
pkg-config output parses correctly but there is an error later on. This
error isn't always fatal as we fall back to a plain -lfoo in the case of
linkSystemLibrary().
2022-04-12 06:12:44 -04:00
r00ster
c4aac28a42 Reuse code in Utf8Iterator.nextCodepoint 2022-04-12 05:34:12 -04:00
r00ster
988afd51cd
Add std.fs.File.sync (#11410) 2022-04-12 05:32:45 -04:00
Stephen Gutekanst
d2681d2537 std.event.WaitGroup: fix compilation (acquire->lock, release->unlock)
In 008b0ec5e58fc7e31f3b989868a7d1ea4df3f41d the `std.Thread.Mutex` API was changed
from `acquire` and `release` to `lock` and `unlock`. `std.event.Lock` still uses `acquire`
and `release`. `std.event.WaitGroup` is using `std.Thread.Mutex` and was not updated to use
`lock` and `unlock`, and so compilation failed prior to this commit.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-11 03:02:41 -04:00
viri
9b5c02022f
compiler-rt(divtf3): fix remark, add more tests 2022-04-08 20:43:27 -06:00
viri
f9a9e8ba73
std.math.isInf: add tests for +-NaN 2022-04-08 20:13:30 -06:00