141 Commits
Author SHA1 Message Date
Alex Rønne Petersen cc5976f9b2 stage1: update zig1.wasm
Signed-off-by: Alex Rønne Petersen <alex@alexrp.com>
2026-10-26 11:10:48 +01:00
Jacob Young f08a8f0fc2 main: reimplement compiler debug flags
* Add `.llvmbc`/`.llvmir` to `ObjectFormat` for emitting unoptimized IR
* Replace `--verbose-air`, `--verbose-intern-pool`,
  `--verbose-generic-instances`, `--verbose-llvm-ir`, and
  `--verbose-llvm-bc` with various `--debug-log` scopes
  * `--debug-log illegal-air`: pre-legalized Air
  * `--debug-log legal-air`: post-legalized Air
  * `--debug-log air`: final Air with liveness
  * `--debug-log ip-stats`: InternPool statistics
  * `--debug-log ip-values`: InternPool values
  * `--debug-log ip-generic-instances`: InternPool generic instances
  * `--debug-log llvm-ir`: pre-optimized LLVM IR
  * `--debug-log opt-llvm-ir`: post-optimized LLVM IR
* Delete `--verbose-cimport` which does nothing
* Delete `--verbose-llvm-cpu-features` which is equivalent to looking at
  the outputs of `--show-builtin` and `--debug-log llvm-ir`
2026-10-21 10:04:01 -07:00
Jacob Young 742474fb8c x86_64: llvm 23 changed the windows abi :( 2026-10-07 00:30:52 +02:00
Alex Rønne Petersen b8f1a054e7 zig.h: fix the fallback path in zig_e_zig_x86_get_xcr0() 2026-09-14 23:30:55 +02:00
Alex Rønne Petersen a0a420a51b stage1: remove unused skip_non_native field 2026-09-10 08:53:46 +02:00
Ennui Langeweile d632f2a5b4 Use single-space indentation for wasm2c's generated code
This pretty much halves the file size of the generated C source code. I have decided to not touch the initial code since I don't believe it would be that beneficial.
2026-07-30 19:06:55 +02:00
Jacob Young 47396c903c stage1: update zig1.wasm 2026-07-27 14:47:34 -04:00
Jacob Young 3e26b9e957 codegen: change libc f128 suffix to match llvm 2026-07-27 14:35:12 -04:00
Matthew Lugg b203181a8a stage1: update zig1.wasm
Necessary because of the introduction of `@backingInt`/`@fromBackingInt`.

Generated with wasm-opt version 131.

Signed-off-by: Matthew Lugg <mlugg@mlugg.co.uk>
2026-07-17 10:15:51 +01:00
Andrew Kelley de7fdfecd8 Merge pull request 'compiler: implement @divCeil builtin' (#36043) from pavelverigo/zig:div-ceil into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36043
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-07-08 21:15:24 +02:00
Alex Rønne Petersen 5f2b532be5 zig.h: fix zig_loongarch_cpucfg() not returning its result correctly 2026-07-06 23:27:56 +02:00
Pavel Verigo ca72c56e0c stage1: update zig1.wasm 2026-07-06 20:49:02 +02:00
Matthew Lugg c152fa02b7 stage1: update zig1.wasm
This is necessary after the `@bitCast` changes to prevent zig2 from
being miscompiled on big-endian targets.

Generated with wasm-opt version 118.

Signed-off-by: Matthew Lugg <mlugg@mlugg.co.uk>
2026-06-24 10:20:56 +01:00
Krzysztof Wolicki 964cc8047e stage1: update zig1.wasm
Using wasm-opt version 118.

Signed-off-by: Matthew Lugg <mlugg@mlugg.co.uk>
2026-05-27 10:02:51 +01:00
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