6963 Commits

Author SHA1 Message Date
Andrew Kelley
c83ab7cc6a
Merge pull request #15503 from r00ster91/noinline
Sema: emit error for always_inline call of noinline function
2023-04-29 11:13:51 -07:00
David CARLIER
05f9608115 std.c: add mincore api to darwin. 2023-04-29 14:25:37 +03:00
r00ster91
0c9c9117ba std.builtin.CallModifier: add missing word 2023-04-29 03:35:37 +02:00
Andrew Kelley
e3bb06a984 std.Build.RunStep: show test name on process termination
This is a small change to help when reading failure logs which makes the
"exited with code 1" and similar message include the test name.

Further enhancements could do the following:
 * even if one unit test crashes the process, the parent process
   continues running the other unit tests
 * ability to test for expected panics (#1356)
 * timeouts on individual tests
2023-04-28 13:29:39 -07:00
Andrew Kelley
624c3069b4 std.os.windows: fix overlapping copy 2023-04-28 13:24:43 -07:00
Andrew Kelley
0794e48b91 update a couple more callsites to @memset 2023-04-28 13:24:43 -07:00
Andrew Kelley
125221cce9 std: update to use @memcpy directly 2023-04-28 13:24:43 -07:00
Andrew Kelley
6261c13731 update codebase to use @memset and @memcpy 2023-04-28 13:24:43 -07:00
Andrew Kelley
57ea6207d3 std.ArrayList: mark the appendNTimes methods inline
The previous commit introduced an optimization to the LLVM backend that
makes `@memset` lower more optimally when the element is comptime-known
and has a repeating byte pattern.

By making these functions inline, if the element parameter is
comptime-known at the callsite, it will be comptime-known in the
`@memset` call, causing more use of the LLVM `memset` intrinsic rather
than an inline for loop when using the LLVM backend.

This affects, for example, std.crypto.argon2, which calls
appendNTimesAssumeCapacity with a `[128]u64` as the element. This is now
lowered with a single `memset` call.
2023-04-28 13:24:43 -07:00
Jacob Young
8c52c6ec6c std: prevent the possibility of deadlocks in some threaded tests 2023-04-27 08:24:32 -07:00
朕与将军解战袍
363269a2a9
fix incorrect struct definition 2023-04-27 11:10:38 +03:00
xEgoist
1a455b2dd8 test: Fix windows_spawn tmp directory cleanup
On Windows, a directory that's set as the current working directory is
not allowed to be removed. This can cause error on `deleteTree` if the
CWD is set to the file to be removed and will cause `error.FileBusy`.
However, due to `tmp.cleanup()` ignoring the errors, the folder removal error will
be ignored. The only test violating this is `windows_spawn`. As a
solution, setting the parent directory to be the CWD before deletion
will allow the cleanup to pass.
2023-04-27 11:01:02 +03:00
Andrew Kelley
396bd51c48 enable debugging infrastructure when using C backend
Thanks to @jacobly0's recent enhancements to the C backend, this stuff
works now.
2023-04-26 20:56:21 -07:00
Meghan
66da64d77c
std.http: fix name of Status field to better match RFC name (#15455)
.header_fields_too_large -> .request_header_fields_too_large
2023-04-26 14:02:55 -04:00
Andrew Kelley
3c66850e42
Merge pull request #15278 from ziglang/memcpy-memset
change semantics of `@memcpy` and `@memset`
2023-04-26 10:01:54 -07:00
Nameless
7285eedcd2 std.http: do -> wait, fix redirects 2023-04-26 00:02:55 -07:00
Janne Hellsten
61236c2aa1
std: @Vector support for std.json.parse 2023-04-26 00:52:17 +03:00
Andrew Kelley
401b7f6f53 zig fmt 2023-04-25 11:23:41 -07:00
Andrew Kelley
792bbfa301 Sema: fix memcpy alias safety incorrect math
Previously it was not multiplying by the element ABI size. Now, it uses
ptr_add instructions which do math based on the element type.
2023-04-25 11:23:41 -07:00
Andrew Kelley
1ba72bcf9a update test cases for new memcpy/memset semantics 2023-04-25 11:23:41 -07:00
Andrew Kelley
58fabbc903 x86_64 backend: support @memset with slices 2023-04-25 11:23:41 -07:00
Andrew Kelley
7c56145a76 add behavior test for @memset on slices
and avoid new language feature in std.ArrayList for now, until x86_64
self-hosted backend can implement it.
2023-04-25 11:23:41 -07:00
Andrew Kelley
edb5e493e6 update @memcpy to require equal src and dest lens
* Sema: upgrade operands to array pointers if possible when emitting
   AIR.
 * Implement safety checks for length mismatch and aliasing.
 * AIR: make ptrtoint support slice operands. Implement in LLVM backend.
 * C backend: implement new `@memset` semantics. `@memcpy` is not done
   yet.
2023-04-25 11:23:40 -07:00
Andrew Kelley
a5c910adb6 change semantics of @memcpy and @memset
Now they use slices or array pointers with any element type instead of
requiring byte pointers.

This is a breaking enhancement to the language.

The safety check for overlapping pointers will be implemented in a
future commit.

closes #14040
2023-04-25 11:23:40 -07:00
David CARLIER
8d88dcdc61 std.c: adding mincore for freebsd 2023-04-25 10:43:54 -07:00
xEgoist
f780a6b024 std: further windows resource fix
addition to #15450
createFileW does not account for failure on `LockFile`. This can result
in a file handle not being closed on failure which can be seen on test
such as `fs.test.'open file with exclusive nonblocking lock twice'`.
2023-04-25 10:37:49 -07:00
Jacob Young
d8bdfd8192 std: fix windows resource leaks 2023-04-24 16:50:44 -07:00
Ryo Ota
bba90b8863 fix HTTP server to handle a chunked transfer coding request 2023-04-24 15:36:35 -07:00
Andrew Kelley
1d1255b433
Merge pull request #15416 from squeek502/http-response-headers-undefined
std.http: Always initialize `response.headers` in Client.request
2023-04-24 15:15:17 -07:00
Andrew Kelley
ef0a02081d
Merge pull request #15290 from mlugg/feat/builtin-in-comptime
Add `@inComptime` builtin
2023-04-24 12:54:12 -07:00
David CARLIER
7439eb5e99 std.os: selfExePath implementation for haiku 2023-04-24 22:41:44 +03:00
David Carlier
1084590ec4 std.c: add find_path for haiku 2023-04-24 12:32:46 +03:00
Jon
529064856a
std.net.StreamServer.Options: add reuse_port 2023-04-24 12:23:22 +03:00
David CARLIER
5c70d7bc72 std.process: further totalSystemMemory portage 2023-04-24 05:49:48 +03:00
David Carlier
c66151a226 std.os: sysctl* wrappers, better warning at compile time 2023-04-24 03:59:35 +03:00
Ryan Liptak
0488c3cb52 std.http: Always initialize response.headers in Client.request
Before this change, if a request errored before getting its `response.headers` initialized, then it would attempt to `deinit` `response.headers` which would still be `undefined`. Since all locations that set `response.headers` use the same code, it can just be done upfront in `request` instead.

Closes #15380
2023-04-23 15:33:23 -07:00
Ryan Liptak
1acb3162b7 http.Headers: Add clearAndFree and clearRetainingCapacity 2023-04-23 15:33:05 -07:00
mlugg
35d82d31be Add @inComptime builtin
Resolves: #868
2023-04-23 13:16:42 -07:00
zooster
bc8e1e1de4
Improvements to docs and text
* docs(std.math): elaborate on difference between absCast and absInt

* docs(std.rand.Random.weightedIndex): elaborate on likelihood

I think this makes it easier to understand.

* langref: add small reminder

* docs(std.fs.path.extension): brevity

* docs(std.bit_set.StaticBitSet): mention the specific types

* std.debug.TTY: explain what purpose this struct serves

This should also make it clearer that this struct is not supposed to provide unrelated terminal manipulation functionality such as setting the cursor position or something because terminals are complicated and we should keep this struct simple and focused on debugging.

* langref(package listing): brevity

* langref: explain what exactly `threadlocal` causes to happen

* std.array_list: link between swapRemove and orderedRemove

Maybe this can serve as a TLDR and make it easier to decide.

* PrefetchOptions.locality: clarify docs that this is a range

This confused me previously and I thought I can only use either 0 or 3.

* fix typos and more

* std.builtin.CallingConvention: document some CCs

* langref: explain possibly cryptic names

I think it helps knowing what exactly these acronyms (@clz and @ctz) and
abbreviations (@popCount) mean.

* variadic function error: add missing preposition

* std.fmt.format docs: nicely hyphenate

* help menu: say what to optimize for

I think this is slightly more specific than just calling it
"optimizations". These are speed optimizations. I used the word
"performance" here.
2023-04-23 21:06:21 +03:00
Hubert Jasudowicz
253eb72c14 std.os.linux: Add new CAP constants 2023-04-23 20:58:30 +03:00
Travis Staloch
40029d6875 std.tar: make sub dirs + trim spaces
closes #15222. these changes allow the .tgz from this issue to
decompress and the test code to succeed.
2023-04-23 20:39:28 +03:00
Nicolas Sterchele
284c7b22a8 process: add args definition comment
To improve understandability of its purpose.
2023-04-23 20:26:10 +03:00
xEgoist
ce3fe72d9a fs.Dir.deleteTree: Fix DirNotEmpty condition
`deleteTree` needs to retry once the directory is reported to be not
empty. Otherwise, the retry condition is never reached.
2023-04-23 19:51:51 +03:00
David CARLIER
23c4f55a61 std: adding sigevent to supported platforms. 2023-04-23 19:46:43 +03:00
David CARLIER
9ef615104a std: adding FreeBSD's sched wrappers 2023-04-23 19:46:30 +03:00
David Carlier
9691cded95 std: mcontext layout for x86 and fixing few x86_64 fields types for
FreeBSD
2023-04-23 19:46:18 +03:00
David CARLIER
1d322fe510 std: add accept_filter struct to make use of SO_ACCEPTFILTER socket option 2023-04-23 19:45:59 +03:00
David CARLIER
7b0e015eb4 std: add a subset of the macOs's libproc api. 2023-04-23 19:45:46 +03:00
David CARLIER
9140249d29 std: enriching malloc api on freebsd. 2023-04-23 19:45:34 +03:00
Andrew Kelley
1884be4ecd
Merge pull request #15372 from nwtgck/fix-http-client 2023-04-23 06:29:46 -07:00