127 Commits

Author SHA1 Message Date
Alex Rønne Petersen 0738895237 stage1: update zig1.wasm
Signed-off-by: Alex Rønne Petersen <alex@alexrp.com>
2026-04-25 21:58:40 +02:00
Matthew Lugg 793fa93d9f stage1: update zig1.wasm
Generated using a compiler bootstrapped from the merge base of this
branch, and wasm-opt version 118.

Signed-off-by: Matthew Lugg <mlugg@mlugg.co.uk>
2026-03-10 10:38:21 +00:00
Jacob Young a28d57292f IoUring: update to new Io APIs 2026-02-09 10:47:21 -05:00
Jacob Young b5bd494606 std.Threaded: replace more kernel32 functions with ntdll 2026-02-07 00:02:50 -05:00
Andrew Kelley 11476d83c9 stage1: add wasi_snapshot_preview1_clock_res_get to wasi.c 2026-02-02 23:14:06 -08:00
Matthew Lugg 60a1ba0a8f stage1: add more wasi.c stubs
Because `std.Io` forces analysis of unused functions in the vtable,
there are now references to 4 more WASI functions, even though the
compiler does not actually call them at runtime.

Therefore, these new stubs fix the bootstrap process after a zig1.wasm
update (though this branch does *not* update zig1.wasm).
2025-12-27 10:23:46 +00:00
Matthew Lugg ce0df033cf stage1: update zig1.wasm
Signed-off-by: Matthew Lugg <mlugg@mlugg.co.uk>
2025-11-22 22:42:37 +00:00
Alex Rønne Petersen 989e05d93b stage1: update zig1.wasm
Signed-off-by: Alex Rønne Petersen <alex@alexrp.com>
2025-11-19 01:42:45 +01:00
Matthew Lugg 5df5e2ed26 zig.h: drop dependency on deleted compiler_rt functions
It turns out we did use these in the C backend. However, it's really
just as easy, if not easier, to replicate the logic directly in C.

Synchronizes stage1/zig.h to make sure the bootstrap doesn't depend on
these functions either. The actual zig1 tarball is unmodified because
regenerating it is unnecessary in this instance.
2025-11-12 16:00:16 +00:00
mlugg 3f84b6c80e cbe: workaround GCC miscompilation
This was causing a zig2 miscomp, which emitted slightly broken debug
information, which caused extremely slow stack unwinding. We're working
on fixing or reporting this upstream, but we can use this workaround for
now, because GCC guarantees arithmetic signed shift.
2025-09-30 13:44:56 +01:00
Alex Rønne Petersen 4aa35160eb stage1: update zig1.wasm
Needed due to LoongArch CPU model changes.

Signed-off-by: Alex Rønne Petersen <alex@alexrp.com>
2025-09-18 12:42:24 +02:00
Alex Rønne Petersen d2a038c082 stage1: update zig1.wasm
Needed because some std.Target.aarch64 features were renamed in LLVM 21.

Signed-off-by: Alex Rønne Petersen <alex@alexrp.com>
2025-08-30 13:27:25 +02:00
BreadTom d407c4e52b Update wasm2c.c 2025-07-25 02:10:09 -07:00
Jacob Young a023b9b22b stage1: update zig1.wasm
Compiler needs cbe packed union fix.
2025-07-22 19:43:47 -07:00
Andrew Kelley 87ce83d5a5 zig1.wasm update
needed due to syntax update
2025-07-16 10:23:02 -07:00
Andrew Kelley 5bc95a6fa2 wasi.c: fix pread/pwrite
When stream is NULL it means reads should read 0 bytes and writes should
fake success with no side effects.
2025-07-09 10:47:36 -07:00
Andrew Kelley 4ba0e7d424 update zig1.wasm
necessary because to pass `zig fmt --check` we need to use the canonical
identifier syntax, which means changing `.@"async"` to `.async` which
previous zig1 is unable to parse.
2025-07-07 13:39:48 -07:00
Jonathan Marler 0adcfd60f4 Fix warning WasmMut_toC not all control paths return a value (#24267)
* Fix warning WasmMut_toC not all control paths return a value

This is a follow up to https://github.com/ziglang/zig/pull/24206 where
I had previously submitted different mechanisms to fix this warning.
This PR is a suggestion by Alex to return NULL instead and Andrew
confirmed this is his preference.
2025-06-26 05:39:08 +00:00
Jacob Young 13392ad33f stage1: update zig1.wasm
Compiler needs a subset of the legalization features enabled.
2025-06-15 11:55:57 -04:00
mlugg de69d63175 stage1: elaborate on "unimplemented" in wasi.c 2025-06-12 17:51:30 +01:00
Jacob Young cc047fdd95 stage1: update zig1.wasm
Compiler needs cbe reserved identifier change. This also allows us to
delete the old `@intCast` panic handler declarations from the standard
library.
2025-06-01 12:10:57 +01:00
mlugg d8ac37fcc8 stage1: fix wasi_snapshot_preview1_fd_seek on cache files
`wasm2c` uses an interesting mechanism to "fake" the existence of cache
directories. However, `wasi_snapshot_preview1_fd_seek` was not correctly
integrated with this system, so previously crashed when run on a file in
a cache directory due to trying to call `fseek` on a `FILE *` which was
`NULL`.
2025-04-02 05:57:50 +01:00
Alex Rønne Petersen c85534a5c6 stage1: Update zig1.wasm.
Signed-off-by: Alex Rønne Petersen <alex@alexrp.com>
2025-03-27 17:43:05 +01:00
Alex Rønne Petersen f90f8f59a5 stage1: Update zig1.wasm.
Signed-off-by: Alex Rønne Petersen <alex@alexrp.com>
2025-02-17 19:18:20 +01:00
Andrew Kelley 7360be19a4 compiler: use std.heap.smp_allocator
In main, now this allocator is chosen by default when compiling without
libc in ReleaseFast or ReleaseSmall, and not targeting WebAssembly.
2025-02-07 14:41:49 -08:00
mlugg dd334d5ee5 stage1: update zig1.wasm
Oh dear, not again! Sorry, I changed the panic handler...

Signed-off-by: mlugg <mlugg@mlugg.co.uk>
2025-01-24 21:07:14 +00:00
Alex Rønne Petersen d916954bee Merge pull request #22098 from alexrp/wasm-generic-baseline
`std.Target`: Use `lime1` as wasm baseline model and `mvp` as generic model
2025-01-23 18:41:11 +01:00
Alex Rønne Petersen 35e804bfb8 wasm2c: Implement nontrapping_fptoint support. 2025-01-22 20:56:30 +01:00
mlugg 8b5c4baed8 stage1: update zig1.wasm
Necessary because the API of `std.builtin.returnError` changed.

Signed-off-by: mlugg <mlugg@mlugg.co.uk>
2025-01-22 02:22:56 -05:00
mlugg 0cc9d68b77 stage1: update zig1.wasm
Implementing the changes from the prior commit, to prepare for the
following commit.

This also means that zig1 now uses the new value interpret mode, so
that adding and removing fields from `std.builtin` types is easier.

Signed-off-by: mlugg <mlugg@mlugg.co.uk>
2025-01-16 12:49:58 +00:00
mlugg b6abe1dbf7 compiler: make it easier to apply breaking changes to std.builtin
Documentation for this will be on the wiki shortly.

Resolves: #21842
2025-01-16 12:49:48 +00:00
Alex Rønne Petersen 6b2c8fc688 zig.h: Improve portability of zig_*_windows_teb() helpers.
* Make it work for thumb and aarch64.
* Clean up std.os.windows.teb() a bit.

I also updated stage1/zig.h since the changes are backwards-compatible and are
necessary due to the std.os.windows changes that call the newly-added functions.
2024-11-04 11:59:38 +01:00
Alex Rønne Petersen c2e6be97ff wasm2c: Add an optional endianness command line argument.
If not given, endianness is inferred from the target that wasm2c is built for.
2024-10-26 22:00:09 +02:00
Alex Rønne Petersen 5cb45b6855 wasm2c: Add big endian support.
I took a slightly unconventional approach to detecting endianness here. We have
no compiler/platform-specific preprocessor checks in the stage1 C code today,
and I think that's a property worth maintaining.
2024-10-26 22:00:09 +02:00
mlugg 36405b9b43 stage1: update zig1.wasm
As well as being necessary for the `CallingConvention` changes, this
update includes the following notable changes:

* Fix unlabeled `break` targeting the wrong scope in the presence of
  labeled continue, unblocking #21422
* Implement `@FieldType`
* Implement `@splat` on arrays

Signed-off-by: mlugg <mlugg@mlugg.co.uk>
2024-10-19 19:13:41 +01:00
Andrew Kelley 0e84fedbe0 update zig1.wasm
Notably, contains the implementation of labeled switch expressions and
decl literals.
2024-09-10 16:15:25 -07:00
mlugg 22f65c3dd5 stage1: update zig1.wasm
This update implements both `@branchHint` and the new usage of `@export`
into zig1.

Signed-off-by: mlugg <mlugg@mlugg.co.uk>
2024-08-27 00:44:06 +01:00
kcbanner 2a0238e5e3 zig.h: fixup pointer atomic load definitions 2024-07-26 10:42:10 -04:00
Andrew Kelley af7b6713d9 update zig1.wasm 2024-07-22 14:26:17 -07:00
Jacob Young 4f742c4cfc dev: introduce dev environments that enable compiler feature sets 2024-07-19 22:35:33 -07:00
Andrew Kelley d404d8a363 Merge pull request #20593 from jacobly0/more-races
InternPool: fix more races
2024-07-14 17:32:51 -07:00
kcbanner c318710653 zig.h: expand zig_msvc_atomic_load_ into version for relaxed, acquire, and seq_cst 2024-07-13 19:45:45 -04:00
kcbanner bc28454b43 zig.h: replace _InterlockedExchangeAdd with a plain volatile load
This was causing zig2.exe to crash during bootstrap, because there was an atomic
load of read-only memory, and the attempt to write to it as part of the (idempotent)
atomic exchange was invalid.

Aligned reads (of u32 / u64) are atomic on x86 / x64, so this is replaced with an
optimization-proof load (`__iso_volatile_load8*`) and a reordering barrier.
2024-07-13 17:46:24 -04:00
Jacob Young d72a8db2db update zig1.wasm
This allows using atomics on packed structs in the compiler.
2024-07-13 04:47:38 -04:00
kcbanner 0d12caee29 - Fix ypedef -> typedef 2024-06-21 00:12:13 -04:00
Jonathan Marler 1165e13c25 wasm2c: avoid indexing null pointer triggering undefined behavior
Using zig cc to compile and run wasm2c on zig.wasm on Windows triggers
what appears to be a sanitizer crash.  The FuncGen reuse array pointer is
initialized to null and at some point it's resized to a length of zero,
which triggers this code to execute:

    memcpy(&self->reuse[self->reuse_i], &self->reuse[reuse_top], sizeof(uint32_t) * reuse_n);

Given the current values, this equates to:

    memcpy(&(NULL)[0], &(NULL)[0], 0);

Taking the address of the first element of a null pointer doesn't trigger
any actual runtime problem, since the pointer won't be dereferenced because
were passing 0 as the length to memcpy, however, it seems that the C spec
considers indexing a null pointer to be undefined behavior even if you
don't use the resulting value (or are just taking the address of an
indexed pointer).
2024-06-17 14:34:52 -04:00
Andrew Kelley 80f38c0cbb update zig1.wasm
In particular, contains fixes to the C backend that avoid tripping UBSAN
in clang 18.
2024-05-08 19:37:29 -07:00
Jacob Young b66fd87a4c update zig1.wasm
Fixes cbe bugs affecting bootstrap.
2024-04-08 13:24:08 -04:00
Jacob Young e5ba70bb5c update zig1.wasm
Removes the first argument of `@fieldParentPtr`.
2024-03-30 20:54:53 -04:00
Jacob Young c011abc4dd wasm2c: fix allocation failure result 2024-03-23 11:32:37 +01:00