6957 Commits

Author SHA1 Message Date
Andrew Kelley
d51aa9748f change default WASI stack size
to match the other operating systems. 16 MiB

closes #18885
2024-02-26 10:33:17 -08:00
mlugg
59447e5305
compiler: decide dbg_var scoping based on AIR blocks
This commit eliminates the `dbg_block_{begin,end}` instructions from
both ZIR and AIR. Instead, lexical scoping of `dbg_var_{ptr,val}`
instructions is decided based on the AIR block they exist within. This
is a much more robust system, and also results in a huge drop in ZIR
bytes - around 7% for Sema.zig.

This required some enhancements to Sema to prevent elision of blocks
when they are required for debug variable scoping. This can be observed
by looking at the AIR for the following simple test program with and
without `-fstrip`:

```zig
export fn f() void {
    {
        var a: u32 = 0;
        _ = &a;
    }
    {
        var a: u32 = 0;
        _ = &a;
    }
}
```

When `-fstrip` is passed, no AIR blocks are generated. When `-fno-strip`
is passed, the ZIR blocks are lowered to true AIR blocks to give correct
lexical scoping to the debug vars.

The changes here incidentally reolve #19060. A corresponding behavior
test has been added.

Resolves: #19060
2024-02-26 13:20:45 +00:00
Andrew Kelley
91fb211faa
Merge pull request #18906 from jacobly0/x86_64-tests
x86_64: pass more tests
2024-02-25 21:43:20 -08:00
Jacob Young
d656c2a7ab test: rework how filtering works
* make test names contain the fully qualified name
 * make test filters match the fully qualified name
 * allow multiple test filters, where a test is skipped if it does not
   match any of the specified filters
2024-02-25 19:12:08 -08:00
Jacob Young
e5c439a16d x86_64: implement optional comparisons
Closes #18959
2024-02-25 11:22:10 +01:00
Jacob Young
2fcb2f5975 Sema: implement vector coercions
These used to be lowered elementwise in air, and now are a single air
instruction that can be lowered elementwise in the backend if necessary.
2024-02-25 11:22:10 +01:00
Jacob Young
2fdc9e6ae8 x86_64: implement @shuffle 2024-02-25 11:22:10 +01:00
Jacob Young
88d0fef92d x86_64: implement @select 2024-02-25 11:22:10 +01:00
Andrew Kelley
6c2eb0f131
Merge pull request #19005 from squeek502/wtf
Fix handling of Windows (WTF-16) and WASI (UTF-8) paths, etc
2024-02-25 01:00:25 -08:00
Jacob Young
31763d28c4 Revert "tests: add -Dskip-cross-glibc option"
This reverts commit bc0f246911a35324473f72b770cc5715902cc912.

This was added as a workaround for a bug that has since been fixed.
2024-02-24 23:23:15 +01:00
Ryan Liptak
80508b98c2 Update deprecated std.unicode function usages 2024-02-24 14:04:59 -08:00
Andrew Kelley
cfce81f7d5
Merge pull request #18955 from ziglang/std.http.Server
take std.http in a different direction
2024-02-23 17:41:38 -08:00
Jakub Konka
7230b68b35
Merge pull request #19034 from ziglang/elf-riscv
elf: add basic aarch64 and riscv64 support
2024-02-23 21:41:14 +01:00
Andrew Kelley
483b63d301 std.http: migrate remaining test/standalone/http.zig to std lib
These tests were not being actually run. Now they are run along with
testing the standard library.
2024-02-23 02:37:11 -07:00
Andrew Kelley
abde76a808 std.http.Server: handle expect: 100-continue requests
The API automatically handles these requests as expected. After
receiveHead(), the server has a chance to notice the expectation and do
something about it. If it does not, then the Server implementation will
handle it by sending the continuation header when the read stream is
created.

Both respond() and respondStreaming() send the continuation header as
part of discarding the request body, only if the read stream has not
already been created.
2024-02-23 02:37:11 -07:00
Andrew Kelley
380916c0f8 std.http.Server.Request.Respond: support all transfer encodings
Before I mistakenly thought that missing content-length meant zero when
it actually means to stream until the connection is closed.

Now the respond() function accepts transfer_encoding which can be left
as default (use content.len for content-length), set to none which makes
it omit the content-length, or chunked, which makes it format the
response as a chunked transfer even though the server has the entire
contents already buffered.

The echo-content tests are moved from test/standalone/http.zig to the
standard library where they are actually run.
2024-02-23 02:37:11 -07:00
Andrew Kelley
51451341bf update standalone http test file to new API 2024-02-23 02:37:11 -07:00
Andrew Kelley
6129ecd4fe std.net, std.http: simplify 2024-02-23 02:37:11 -07:00
Andrew Kelley
743a0c966d std.http.Client: remove bad decisions from fetch()
* "storage" is a better name than "strategy".
* The most flexible memory-based storage API is appending to an
  ArrayList.
* HTTP method should default to POST if there is a payload.
* Avoid storing unnecessary data in the FetchResult
* Avoid the need for a deinit() method in the FetchResult

The decisions that this logic made about how to handle files is beyond
repair:
- fail to use sendfile() on a plain connection
- redundant stat
- does not handle arbitrary streams
So, file-based response storage is no longer supported. Users should use
the lower-level open() API which allows avoiding these pitfalls.
2024-02-23 02:37:11 -07:00
Andrew Kelley
d574875f00 Revert "std.http: remove 'done' flag"
This reverts commit 42be972a72c86b32ad8403d082ab42763c6facec.

Using a bit to distinguish between headers and trailers is fine. It was
just named and documented poorly.
2024-02-23 02:37:11 -07:00
Andrew Kelley
3d61890d24 std: convert http trailers test to unit test
making it no longer dead code. it is currently failing.
2024-02-23 02:37:11 -07:00
Andrew Kelley
4d401e6159 std.http: remove Headers API
I originally removed these in 402f967ed5339fa3d828b7fe1d57cdb5bf38dbf2.
I allowed them to be added back in #15299 because they were smuggled in
alongside a bug fix, however, I wasn't kidding when I said that I wanted
to take the design of std.http in a different direction than using this
data structure.

Instead, some headers are provided via explicit field names populated
while parsing the HTTP request/response, and some are provided via
new fields that support passing extra, arbitrary headers.

This resulted in simplification of logic in many places, as well as
elimination of the possibility of failure in many places. There is
less deinitialization code happening now.

Furthermore, it made it no longer necessary to clone the headers data
structure in order to handle redirects.

http_proxy and https_proxy fields are now pointers since it is common
for them to be unpopulated.

loadDefaultProxies is changed into initDefaultProxies to communicate
that it does not actually load anything from disk or from the network.
The function now is leaky; the API user must pass an already
instantiated arena allocator. Removes the need to deinitialize proxies.

Before, proxies stored arbitrary sets of headers. Now they only store
the authorization value.

Removed the duplicated code between https_proxy and http_proxy. Finally,
parsing failures of the environment variables result in errors being
emitted rather than silently ignoring the proxy.

error.CompressionNotSupported is renamed to
error.CompressionUnsupported, matching the naming convention from all
the other errors in the same set.

Removed documentation comments that were redundant with field and type
names.

Disabling zstd decompression in the server for now; see #18937.

I found some apparently dead code in src/Package/Fetch/git.zig. I want
to check with Ian about this.

I discovered that test/standalone/http.zig is dead code, it is only
being compiled but not being run. Furthermore it hangs at the end if you
run it manually. The previous commits in this branch were written under
the assumption that this test was being run with
`zig build test-standalone`.
2024-02-23 02:37:11 -07:00
Andrew Kelley
50e2a5f673 std.http: remove 'done' flag
This is a state machine that already has a `state` field. No need to
additionally store "done" - it just makes things unnecessarily
complicated and buggy.
2024-02-23 02:37:11 -07:00
Jacob Young
e60d667111 Module: fix @embedFile of files containing zero bytes
If an adapted string key with embedded nulls was put in a hash map with
`std.hash_map.StringIndexAdapter`, then an incorrect hash would be
entered for that entry such that it is possible that when looking for
the exact key that matches the prefix of the original key up to the
first null would sometimes match this entry due to hash collisions and
sometimes not if performed later after a grow + rehash, causing the same
key to exist with two different indices breaking every string equality
comparison ever, for example claiming that a container type doesn't
contain a field because the field name string in the struct and the
string representing the identifier to lookup might be equal strings but
have different string indices.  This could maybe be fixed by changing
`std.hash_map.StringIndexAdapter.hash` to only hash up to the first
null, therefore ensuring that the entry's hash is correct and that all
future lookups will be consistent, but I don't trust anything so instead
I assert that there are no embedded nulls.
2024-02-22 12:33:53 -08:00
Jakub Konka
ddb33baa11 test/link/elf: test static linking C riscv64-musl 2024-02-21 23:08:29 +01:00
Jakub Konka
55dadc3d85 test/link/elf: test static linking C aarch64-musl 2024-02-21 22:40:03 +01:00
garrison hinson-hasty
955fd65cb1
Sema: fix peer type resolution for arrays of coercible elements 2024-02-21 00:55:29 +00:00
Jacob Young
ec7293422d llvm: fix c abi for structs not passed in registers
Closes #18916
2024-02-20 23:36:47 +01:00
Jacob Young
2291560424 c_import: extract behavior tests that use @cImport
This introduces the new test step `test-c-import`, and removes the
ability of the behavior tests to `@cImport` paths relative to `test`.
This allows the behavior tests to be run without translate c.
2024-02-20 18:44:43 +01:00
mlugg
65a87ff299 Liveness: do not elide safety-checked instructions
Resolves: #19012
2024-02-20 12:10:29 +00:00
mlugg
7461309b73 Sema: validate that runtime-known inferred alloc does not have comptime-only type
Resolves: #18997
2024-02-19 21:48:50 +00:00
Robin Voetter
dd4d320eb9
Merge pull request #18948 from alichraghi/vector
spirv: use extended instructions whenever possible
2024-02-17 14:01:07 +01:00
mlugg
b2f28a104d
cases: account for changed compile errors 2024-02-16 12:15:39 +00:00
Jacob Young
6f08e17229 InternPool: make more use of NullTerminatedString.Slice
This should avoid the random pointer invalidation crashes.

Closes #18954
2024-02-16 00:27:25 -08:00
Andrew Kelley
2176a73d66 disable flaky C backend test
See tracking issue #18954
2024-02-15 18:32:36 -07:00
Ali Chraghi
66e6d0d314 test: skip new failing tests for spirv 2024-02-15 18:44:24 +03:30
Paul Berg
885f40520e c_abi: add vector tests for floats 2024-02-15 13:17:46 +01:00
Paul Berg
42446e6bf9 wasm: enable bool vectors tests for stage2_llvm 2024-02-15 13:17:37 +01:00
Jacob Young
6fe90a913a llvm: fix lowering of recursive debug info
This change allows recursing over types that are currently being
resolved fully with a second pass of forward resolution.

Closes #16414
2024-02-15 02:46:18 -08:00
Veikka Tuominen
51d67c7c8f Sema: add declared here notes in fail
This ensures that the note is added in more places and that `errMsg` needs to be used in fewer places.
2024-02-12 12:54:32 -08:00
Jacob Young
a9f738e56b x86_64: implement c abi for bool vectors 2024-02-12 05:25:07 +01:00
Jacob Young
5a62f26579 x86_64: fix packed load 2024-02-12 05:25:07 +01:00
Jacob Young
f2a62d25fc x86_64: implement ret_safe 2024-02-12 05:25:07 +01:00
Jacob Young
6235762c09 x86_64: implement mul, div, and mod of large integers
This enables the last compiler-rt test disabled for the x86_64 backend.
2024-02-12 05:25:07 +01:00
Andrew Kelley
616f74ba20 add behavior test for recently fixed wasm backend bug
Adds the corresponding behavior test for the fix in
320c4d68f5f40794ae31d5535de9c3a8ff5cb471.
2024-02-11 14:14:59 -07:00
Jakub Konka
d12c8db642
Merge pull request #18875 from ziglang/macho-zo-dwarf
macho: emit DWARF for ZigObject relocatable
2024-02-09 23:12:04 +01:00
Veikka Tuominen
731ff120d0 Sema: catch runtime stores to comptime variables through calls 2024-02-09 13:51:51 -08:00
Andrew Kelley
54bbc73f85
Merge pull request #18712 from Vexu/std.options
std: make options a struct instance instead of a namespace
2024-02-09 13:38:42 -08:00
Tristan Ross
2a3e601f77 test.link.macho: fix for non-x86 and arm architectures
This fix is requires to make the build runner even compile when building
Zig on architectures like RISC-V.
2024-02-09 17:49:53 +02:00
Ali Chraghi
37b0aa600a spirv: make rusticl the primary testing implementation 2024-02-09 09:27:08 +03:30