277 Commits

Author SHA1 Message Date
mlugg
51595d6b75
lib: correct unnecessary uses of 'var' 2023-11-19 09:55:07 +00:00
Jacob Young
509be7cf1f x86_64: fix std test failures 2023-11-03 23:18:21 -04:00
Andrew Kelley
3fc6fc6812 std.builtin.Endian: make the tags lower case
Let's take this breaking change opportunity to fix the style of this
enum.
2023-10-31 21:37:35 -04:00
Jacob Young
149200aac5 mem: delete readIntSlice and writeIntSlice
After deleting all potentially incorrect usages, there were no more
remaining.
2023-10-31 21:37:35 -04:00
Jacob Young
d890e81761 mem: fix ub in writeInt
Use inline to vastly simplify the exposed API.  This allows a
comptime-known endian parameter to be propogated, making extra functions
for a specific endianness completely unnecessary.
2023-10-31 21:37:35 -04:00
Andrew Kelley
49b9e1e69b std.mem.minMax: make it return a tuple
this is a breaking change
2023-10-28 10:14:15 -07:00
Jacob Young
b0cf620fe3 x86_64: fix cond_br 2023-10-27 03:33:49 -04:00
Jacob Young
98cd378208 x86_64: fix behavior of getValue
Old behavior renamed to `getValueIfFree`.
2023-10-26 21:45:58 -04:00
Jacob Young
b55377a5ab x86_64: pass more tests
* 128-bit integer multiplication with overflow
 * more instruction encodings used by std inline asm
 * implement the `try_ptr` air instruction
 * follow correct stack frame abi
 * enable full panic handler
 * enable stack traces
2023-10-25 04:28:30 -04:00
mlugg
f2814caaf0
Sema: don't allow undef values through resolveDefinedValue in typeof block
This logic is not correct in most cases. If any instruction needs to
operate with different semantics within `@TypeOf`, it should be made to
do so explicitly.

This broke a line in `std.mem`: I have opted to fix this in std for now,
since as far as I know it's not yet been discussed which operations (if
any) should be special-cased like this within `@TypeOf`.
2023-10-24 14:28:34 +01:00
Jacob Young
8f69e977f1 x86_64: implement 128-bit builtins
* `@clz`
 * `@ctz`
 * `@popCount`
 * `@byteSwap`
 * `@bitReverse`
 * various encodings used by std
2023-10-23 22:42:18 -04:00
Jacob Young
fe93332ba2 x86_64: implement enough to pass unicode tests
* implement vector comparison
 * implement reduce for bool vectors
 * fix `@memcpy` bug
 * enable passing std tests
2023-10-23 22:42:18 -04:00
Jacob Young
27fe945a00 Revert "Revert "Merge pull request #17637 from jacobly0/x86_64-test-std""
This reverts commit 6f0198cadbe29294f2bf3153a27beebd64377566.
2023-10-22 15:46:43 -04:00
Andrew Kelley
6f0198cadb Revert "Merge pull request #17637 from jacobly0/x86_64-test-std"
This reverts commit 0c99ba1eab63865592bb084feb271cd4e4b0357e, reversing
changes made to 5f92b070bf284f1493b1b5d433dd3adde2f46727.

This caused a CI failure when it landed in master branch due to a
128-bit `@byteSwap` in std.mem.
2023-10-22 12:16:35 -07:00
Jacob Young
32e85d44eb x86_64: disable failing tests, enable test-std testing 2023-10-21 10:55:41 -04:00
Jacob Young
2e6e39a700 x86_64: fix bugs and disable erroring tests 2023-10-21 10:55:41 -04:00
Andrew Kelley
b171a6f25d Package.Fetch: normalize path separators in symlinks
closes #17549
2023-10-16 16:47:47 -07:00
joadnacer
7b9165b375 std.mem: Improve writeIntSlice performance 2023-10-16 08:49:05 -04:00
Veikka Tuominen
c919e9a280 std.simd: return comptime_int from suggestVectorSize 2023-10-13 16:58:05 +03:00
Karl Seguin
75b48ef503
std.mem: use indexOfScalarPos when indexOf is called where needle.len == 1
When `std.mem.indexOf` is called with a single-item needle, use `indexOfScalarPos` which is significantly faster than the more general `indexOfPosLinear`.  This can be done without introducing overhead to normal cases (where `needle.len > 1`).
2023-10-09 16:50:16 +03:00
Jay Petacat
d8bfbbbf25 std.mem.zeroes: Zero out entire extern union, including padding
Fixes #17258
2023-10-01 02:39:05 -07:00
Marc Tiehuis
08635f08a9 fix indexOfSentinel alignment for types larger than 1 byte 2023-09-30 22:15:47 +13:00
Marc Tiehuis
5b5da0ef8c std.mem: check backend vector support for indexOfSentinel/indexOfScalarPos 2023-09-30 21:22:12 +13:00
Marc Tiehuis
cd766513fe std.mem: add vectorized indexOfScalarPos and indexOfSentinel
These are an order of magnitude quicker than the previous
implementations:

A relative comparison of each, measuring scanning a 1G file.

    Reading 1G (1.0000000009313226GiB)

             std.mem.sliceTo: 281.232ms
          vectorized.sliceTo: 24.769ms
                      strlen: 24.291ms

           std.indexOfScalar: 229.016ms
    vectorized.indexOfScalar: 24.685ms
                      memchr: 24.958ms
2023-09-30 21:19:43 +13:00
Karl Seguin
599641357c
std.mem: use for loop instead of while in indexOf* to reduce bound checking 2023-09-28 15:40:08 +00:00
Jay Petacat
37398ed2a5 std: Reactivate skipped tests w.r.t. llvm/llvm-project#55522 2023-09-27 01:37:25 +03:00
Andrew Kelley
5b8af7a2a9 skip regressed LLVM 17 std lib test on powerpc
Tracked by #16951
2023-09-19 09:37:53 -07:00
Pascal S. de Kloe
4a44b79935 mem: explicit Allocator.Error on concat and join 2023-09-13 13:52:05 +03:00
Jacob Young
151c06cce4 std.mem.sliceAsBytes: support arrays of zero-bit types
This makes `std.ArrayListUnmanaged(void)` usable.
2023-08-09 05:47:13 -04:00
antlilja
b463e429b8 Remove len parameter from splat in standard lib 2023-07-12 15:35:57 -07:00
Meghan
cd0594e4a6
std: add mem.SplitIterator.peek() (#15670) 2023-07-10 14:34:39 -04:00
xdBronch
d7c6cfa7fd std.mem.zeroes work with allowzero pointers 2023-07-10 10:52:27 -07:00
r00ster91
11c32c756f fix u65529 and above overflowing in more places
See also #15537
2023-06-27 19:08:24 -04:00
Jacob Young
b18a72ec35 x86_64: fix crash emitting a packed undefined u128 2023-06-25 19:14:03 -04:00
Eric Joldasov
0a868dacdd std.cstr: deprecate namespace
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-25 14:51:03 -07:00
mlugg
f26dda2117 all: migrate code to new cast builtin syntax
Most of this migration was performed automatically with `zig fmt`. There
were a few exceptions which I had to manually fix:

* `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten
* `@truncate`'s fixup is incorrect for vectors
* Test cases are not formatted, and their error locations change
2023-06-24 16:56:39 -07:00
Eric Joldasov
50339f595a all: zig fmt and rename "@XToY" to "@YFromX"
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19 12:34:42 -07:00
Andrew Kelley
e6e8cacab9 std.mem.order: use for loop syntax
Not only does it look nicer, it's a performance enhancement for debug
builds since the safety checks are eliminated.
2023-06-19 12:07:32 -07:00
Motiejus Jakštys
d41111d7ef mem: rename align*Generic to mem.align*
Anecdote 1: The generic version is way more popular than the non-generic
one in Zig codebase:

     git grep -w alignForward | wc -l
    56
     git grep -w alignForwardGeneric | wc -l
    149

     git grep -w alignBackward | wc -l
    6
     git grep -w alignBackwardGeneric | wc -l
    15

Anecdote 2: In my project (turbonss) that does much arithmetic and
alignment I exclusively use the Generic functions.

Anecdote 3: we used only the Generic versions in the Macho Man's linker
workshop.
2023-06-17 12:49:13 -07:00
Evin Yulo
6f766fbf00 privatize std.mem.writePackedInt{Big, Little}
These are unnecessary since writePackedInt accepts an endian parameter.
2023-06-17 06:35:30 -07:00
r00ster91
2593156068 migration: std.math.{min, min3, max, max3} -> @min & @max 2023-06-16 13:44:09 -07:00
Andrew Kelley
38fc826a5a
Merge pull request #15957 from BratishkaErik/deprecated-
std.*: remove stuff that was deprecated in older versions
2023-06-13 14:53:41 -07:00
dweiller
28eed1f7b3 std.mem.ValidationAllocator: forward free() calls
Failing to forward free calls to the underlying allocator makes
`ValidationAllocator` unusable for testing allocators while checking for
leaks. This change allows allocators that wrap `std.testing.allocator`
to be tested with `std.heap.testAllocator()` in test decls without
reporting erroneous leaks.
2023-06-13 10:57:11 -07:00
Eric Joldasov
d884d7050e
all: replace comptime try with try comptime
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-13 23:46:58 +06:00
Andrew Kelley
75cf06c187 std.mem.alignForwardGeneric: manually inline the assertions
This matches more directly the documentation comments, and makes it more
obvious what went wrong when an assertion fails.
2023-06-10 20:42:28 -07:00
Andrew Kelley
629f0d23b5
Merge pull request #15579 from squeek502/mem-delimiters
Split `std.mem.split` and `tokenize` into `sequence`, `any`, and `scalar` versions
2023-06-03 13:51:02 -07:00
Ali Chraghi
3db3cf7790 std.sort: add pdqsort and heapsort 2023-05-23 17:55:59 -07:00
Cortex
c269e16c3b
std.mem.byteSwapAllFields: add suppport for nested structs (#15696) 2023-05-16 19:10:44 -04:00
Tw
e584dd8062 std.mem.zeroInit: zero hidden padding for extern struct
Signed-off-by: Tw <tw19881113@gmail.com>
2023-05-16 10:33:04 +03:00
Ryan Liptak
104f4053a2 std.mem: Rename splitFull/tokenizeFull to splitSequence/tokenizeSequence
I think this makes the name less ambiguous and more obvious that the suffix applies to the `delimiter`.
2023-05-13 13:45:05 -07:00