-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nuke the C++ implementation of Zig from orbit using WASI #13560
Commits on Dec 6, 2022
-
After this commit, the self-hosted compiler does not offer the option to use stage1 as a backend anymore.
Configuration menu - View commit details
-
Copy full SHA for 2851447 - Browse repository at this point
Copy the full SHA 2851447View commit details -
build: introduce -Dwasi-bootstrap option
Also, make -Donly-c prevent Autodoc from being included in the binary. This produces a 2.6 MiB zig.wasm file. 781 KB if piped through zstd.
Configuration menu - View commit details
-
Copy full SHA for db023b9 - Browse repository at this point
Copy the full SHA db023b9View commit details -
These functions had a compile error since the introduction of IterableDir.
Configuration menu - View commit details
-
Copy full SHA for 4e2a960 - Browse repository at this point
Copy the full SHA 4e2a960View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3ba9165 - Browse repository at this point
Copy the full SHA 3ba9165View commit details -
build.zig: add bulk_memory to -Dwasi-bootstrap
In theory this will enhance the performance of interpreting a WASI build of Zig.
Configuration menu - View commit details
-
Copy full SHA for 0a2fdfb - Browse repository at this point
Copy the full SHA 0a2fdfbView commit details -
WASI: remove absolute path emulation from std lib
Instead of checking for absolute paths and current working directories in various file system operations, there is one simple solution: allow overriding `std.fs.cwd` on WASI. os.realpath is back to causing a compile error when used on WASI. This caused a compile error in the Sema handling of `@src()`. The compiler should never call realpath, so the commit that made this change is reverted (95ab942). If this breaks debug info, a different strategy is needed to solve it other than using realpath. I also removed the preopens code and replaced it with something much simpler. There is no longer any global state in the standard library. Additionally- * os.openat no longer does an unnecessary fstat on WASI when O.WRONLY is not provided. * os.chdir is back to causing a compile error on WASI.
Configuration menu - View commit details
-
Copy full SHA for d5312d5 - Browse repository at this point
Copy the full SHA d5312d5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3a81174 - Browse repository at this point
Copy the full SHA 3a81174View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6b0d773 - Browse repository at this point
Copy the full SHA 6b0d773View commit details -
Configuration menu - View commit details
-
Copy full SHA for 55ca43a - Browse repository at this point
Copy the full SHA 55ca43aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3dcdd55 - Browse repository at this point
Copy the full SHA 3dcdd55View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8c1c67b - Browse repository at this point
Copy the full SHA 8c1c67bView commit details -
redo CMakeLists.txt to use WASI interpreter
current status is that it hits error: OutOfMemory for unknown reasons, probably due to bugs in the C WASI interpreter port.
Configuration menu - View commit details
-
Copy full SHA for ef447c3 - Browse repository at this point
Copy the full SHA ef447c3View commit details -
interpret the WASI blob to produce zig2.c and compiler_rt.c
* synchronize zig1.c from zig-wasi external project * change the way argv works to avoid absolute paths * autodetect isatty * compiler_rt: disable some functions when object format is C * add missing flag from config.zig.in The next problem is that compiling compiler_rt.c with gcc gives "conflicting types" errors for `__eqhf2` and friends.
Configuration menu - View commit details
-
Copy full SHA for 39fd77b - Browse repository at this point
Copy the full SHA 39fd77bView commit details -
Configuration menu - View commit details
-
Copy full SHA for d1b3409 - Browse repository at this point
Copy the full SHA d1b3409View commit details -
Configuration menu - View commit details
-
Copy full SHA for fb9a608 - Browse repository at this point
Copy the full SHA fb9a608View commit details -
enable the LLVM backend in stage2
This takes a bit longer since the interpreted part has to do more work but it saves a round trip through the compiler by allowing `zig2 build` to be the final step. 1-2-3, done. For me this is currently failing due to compilation errors generated by GCC when compiling zig2.c but in theory if those are fixed, it should work!
Configuration menu - View commit details
-
Copy full SHA for 34e9bbb - Browse repository at this point
Copy the full SHA 34e9bbbView commit details -
zig1.c: autodetect host target triple
instead of assuming x8_64-linux in CMake
Configuration menu - View commit details
-
Copy full SHA for 33e3db1 - Browse repository at this point
Copy the full SHA 33e3db1View commit details -
CMake: use -O1 instead of -O2 for building generated .c code
Idea here is that this is a sweet spot of not wasting time waiting for optimizations but also getting decent runime performance.
Configuration menu - View commit details
-
Copy full SHA for eef780e - Browse repository at this point
Copy the full SHA eef780eView commit details -
Some fixes for the wasi interpreter for macOS (#13587)
* Remove usage of O_PATH, ifdef for macos stat struct, and integer formatting
Configuration menu - View commit details
-
Copy full SHA for e9d9be2 - Browse repository at this point
Copy the full SHA e9d9be2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6337808 - Browse repository at this point
Copy the full SHA 6337808View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9cb06f3 - Browse repository at this point
Copy the full SHA 9cb06f3View commit details -
std.fmt: more descriptive names for impl functions
This is a workaround for a limitation of the C backend.
Configuration menu - View commit details
-
Copy full SHA for 906120b - Browse repository at this point
Copy the full SHA 906120bView commit details -
Configuration menu - View commit details
-
Copy full SHA for ba8d5fc - Browse repository at this point
Copy the full SHA ba8d5fcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7ef745d - Browse repository at this point
Copy the full SHA 7ef745dView commit details -
CI: make Windows build from source like everybody else
Now that OOM is no longer a problem, the Windows CI can do the same process every other system does instead of building from a recent Zig binary.
Configuration menu - View commit details
-
Copy full SHA for 02456a3 - Browse repository at this point
Copy the full SHA 02456a3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9b8cf13 - Browse repository at this point
Copy the full SHA 9b8cf13View commit details -
Configuration menu - View commit details
-
Copy full SHA for fd54a01 - Browse repository at this point
Copy the full SHA fd54a01View commit details -
build: remove -Dwasi-bootstrap; add update-zig1 step
Now it is a single command tdo update zig1.wasm.zst.
Configuration menu - View commit details
-
Copy full SHA for 7e151cb - Browse repository at this point
Copy the full SHA 7e151cbView commit details -
CMake: use ReleaseSmall instead of ReleaseFast
When producing C source code. This enables strip, which should avoid bloat and save compilation time.
Configuration menu - View commit details
-
Copy full SHA for a63305b - Browse repository at this point
Copy the full SHA a63305bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1263346 - Browse repository at this point
Copy the full SHA 1263346View commit details -
wasi: implement file truncation
The way this is implemented destroys the contents of the file, so revisit if this causes issues in the future.
Configuration menu - View commit details
-
Copy full SHA for e000db2 - Browse repository at this point
Copy the full SHA e000db2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1e638cb - Browse repository at this point
Copy the full SHA 1e638cbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 54b960a - Browse repository at this point
Copy the full SHA 54b960aView commit details -
Configuration menu - View commit details
-
Copy full SHA for ce4e5fe - Browse repository at this point
Copy the full SHA ce4e5feView commit details -
Configuration menu - View commit details
-
Copy full SHA for f421efb - Browse repository at this point
Copy the full SHA f421efbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 687ea31 - Browse repository at this point
Copy the full SHA 687ea31View commit details -
Configuration menu - View commit details
-
Copy full SHA for 47a2a52 - Browse repository at this point
Copy the full SHA 47a2a52View commit details -
Configuration menu - View commit details
-
Copy full SHA for fdb98c5 - Browse repository at this point
Copy the full SHA fdb98c5View commit details -
wasm2c: remove unnecessary brackets to reduce max bracket depth
This avoids the need to pass `-fbracket-depth=512` to clang.
Configuration menu - View commit details
-
Copy full SHA for 9f4ef4d - Browse repository at this point
Copy the full SHA 9f4ef4dView commit details -
Configuration menu - View commit details
-
Copy full SHA for fad2142 - Browse repository at this point
Copy the full SHA fad2142View commit details -
Configuration menu - View commit details
-
Copy full SHA for c8541f0 - Browse repository at this point
Copy the full SHA c8541f0View commit details -
Configuration menu - View commit details
-
Copy full SHA for bd4a1f3 - Browse repository at this point
Copy the full SHA bd4a1f3View commit details -
This flag makes CI servers print garbage to the terminal. I started implementing detection in wasi.c, but it would have destroyed the beautiful code that only touches the C stdlib, does not do any conditional compilation based on the operating system, or rely on any POSIX functions. So instead, let's just do without this flag to retain simplicity in this step of the build process.
Configuration menu - View commit details
-
Copy full SHA for ec1334d - Browse repository at this point
Copy the full SHA ec1334dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 57995c2 - Browse repository at this point
Copy the full SHA 57995c2View commit details -
translate-c: fix wrong logic adjustment
In ea9ad1e, I incorrectly applied boolean logic to one of the pieces of logic, resulting in a regression in translate-c.
Configuration menu - View commit details
-
Copy full SHA for cb01249 - Browse repository at this point
Copy the full SHA cb01249View commit details -
This branch largely reverts 58f961f. I would like to revisit the proposal to modify the standard library in this way and think more carefully about it before adding isAbsolute() checks everywhere.
Configuration menu - View commit details
-
Copy full SHA for e73170f - Browse repository at this point
Copy the full SHA e73170fView commit details -
CMake: adjust apple clang compiler check
Before it was checking if the compiler was AppleClang, however, this did not handle the case when using a compiled-from-source Clang on a macOS computer, in which case the linker is still Apple ld64, and it is in fact the linker that needs to have the different flag to communicate stack size.
Configuration menu - View commit details
-
Copy full SHA for aaf95ce - Browse repository at this point
Copy the full SHA aaf95ceView commit details -
stage2: revert change to handling of --color on
This change has been extracted to #13786 and can be solved separately than this branch.
Configuration menu - View commit details
-
Copy full SHA for a3fadd2 - Browse repository at this point
Copy the full SHA a3fadd2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5dbd28f - Browse repository at this point
Copy the full SHA 5dbd28fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4a70149 - Browse repository at this point
Copy the full SHA 4a70149View commit details -
Configuration menu - View commit details
-
Copy full SHA for 823d1e7 - Browse repository at this point
Copy the full SHA 823d1e7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4451786 - Browse repository at this point
Copy the full SHA 4451786View commit details -
Configuration menu - View commit details
-
Copy full SHA for ee2fb5b - Browse repository at this point
Copy the full SHA ee2fb5bView commit details -
CMake: remove --color on for compiler_rt too
Missing change from bcd4ea9
Configuration menu - View commit details
-
Copy full SHA for eef4348 - Browse repository at this point
Copy the full SHA eef4348View commit details -
In the CI system, I copied the old tarball and then applied 05c21a2 to its compiler_rt implementation. After this is verified we can drop this commit and regenerate the tarballs from a master branch commit.
Configuration menu - View commit details
-
Copy full SHA for 3fb1b2c - Browse repository at this point
Copy the full SHA 3fb1b2cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9833835 - Browse repository at this point
Copy the full SHA 9833835View commit details -
Configuration menu - View commit details
-
Copy full SHA for 793db27 - Browse repository at this point
Copy the full SHA 793db27View commit details -
In particular, these two changes are relevant: * zig cc: support -stack in addition to --stack for linker arg - Fixes stack overflow when running zig2 on aarch64-macos. * compiler_rt: avoid using weak aliases - Fixes duplicate symbol when linking zig2 on aarch64-linux.
Configuration menu - View commit details
-
Copy full SHA for f46567e - Browse repository at this point
Copy the full SHA f46567eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0f2a7d3 - Browse repository at this point
Copy the full SHA 0f2a7d3View commit details -
CI: aarch64-macos tarball patch
I messed up the spelling of '-stack_size' making it '-stack' instead. Will need to fix on master branch. But let's test this here before making another master branch commit.
Configuration menu - View commit details
-
Copy full SHA for c58ebfb - Browse repository at this point
Copy the full SHA c58ebfbView commit details -
Configuration menu - View commit details
-
Copy full SHA for c4dc851 - Browse repository at this point
Copy the full SHA c4dc851View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3686787 - Browse repository at this point
Copy the full SHA 3686787View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3683602 - Browse repository at this point
Copy the full SHA 3683602View commit details -
Configuration menu - View commit details
-
Copy full SHA for 91e4891 - Browse repository at this point
Copy the full SHA 91e4891View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2a3d9c3 - Browse repository at this point
Copy the full SHA 2a3d9c3View commit details -
cmake: disable stack protector for zig2 to avoid link errors on windows
On windows we get: lld-link: error: undefined symbol: __stack_chk_fail >>> referenced by CMakeFiles/zig2.dir/zig2.c.obj:(main) >>> referenced by CMakeFiles/zig2.dir/zig2.c.obj:(main_main) >>> referenced by CMakeFiles/zig2.dir/zig2.c.obj:(log_scoped_28_default_29_err__anon_2764) >>> referenced 36192 more times lld-link: error: undefined symbol: __stack_chk_guard >>> referenced by CMakeFiles/zig2.dir/zig2.c.obj:(.refptr.__stack_chk_guard) >>> referenced by CMakeFiles/zig2.dir/compiler_rt.c.obj
Configuration menu - View commit details
-
Copy full SHA for a0a2e75 - Browse repository at this point
Copy the full SHA a0a2e75View commit details -
CI: revert windows script to master branch version
This commit chickens out and reverts 02456a3, leaving it for a future enhancement.
Configuration menu - View commit details
-
Copy full SHA for 106e967 - Browse repository at this point
Copy the full SHA 106e967View commit details -
This commit adds a 637 KB binary file to the source repository. This commit does nothing else, so it should be replaced with a different commit before this branch is merged to avoid bloating the git repository.
Configuration menu - View commit details
-
Copy full SHA for 20d86d9 - Browse repository at this point
Copy the full SHA 20d86d9View commit details