From aff7e7ee741d3c2d2b04e68d95337651a78e4650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Sun, 3 Nov 2024 22:20:46 +0200 Subject: [PATCH] run: BoundFn hack --- 0.10.0-675-g9d93b2ccf1-TypeOf-hack.patch | 48 +++++++ run | 170 ++++++++++++++--------- 2 files changed, 149 insertions(+), 69 deletions(-) create mode 100644 0.10.0-675-g9d93b2ccf1-TypeOf-hack.patch diff --git a/0.10.0-675-g9d93b2ccf1-TypeOf-hack.patch b/0.10.0-675-g9d93b2ccf1-TypeOf-hack.patch new file mode 100644 index 0000000..3019645 --- /dev/null +++ b/0.10.0-675-g9d93b2ccf1-TypeOf-hack.patch @@ -0,0 +1,48 @@ +From f4392c034ca6fe003e828b8255c635003d4f6c36 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= +Date: Sun, 3 Nov 2024 22:20:13 +0200 +Subject: [PATCH] 0.10.0-675-g9d93b2ccf1 @TypeOf hack + +--- + lib/std/log.zig | 4 ++-- + src/link/strtab.zig | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/lib/std/log.zig b/lib/std/log.zig +index 9ebe85c004..f174946565 100644 +--- a/lib/std/log.zig ++++ b/lib/std/log.zig +@@ -121,7 +121,7 @@ else + + fn log( + comptime message_level: Level, +- comptime scope: @Type(.EnumLiteral), ++ comptime scope: @TypeOf(.EnumLiteral), + comptime format: []const u8, + args: anytype, + ) void { +@@ -167,7 +167,7 @@ pub fn defaultLog( + + /// Returns a scoped logging namespace that logs all messages using the scope + /// provided here. +-pub fn scoped(comptime scope: @Type(.EnumLiteral)) type { ++pub fn scoped(comptime scope: @TypeOf(.EnumLiteral)) type { + return struct { + /// Log an error message. This log level is intended to be used + /// when something has gone wrong. This might be recoverable or might +diff --git a/src/link/strtab.zig b/src/link/strtab.zig +index abb58defef..2048aa216e 100644 +--- a/src/link/strtab.zig ++++ b/src/link/strtab.zig +@@ -5,7 +5,7 @@ const Allocator = mem.Allocator; + const StringIndexAdapter = std.hash_map.StringIndexAdapter; + const StringIndexContext = std.hash_map.StringIndexContext; + +-pub fn StringTable(comptime log_scope: @Type(.EnumLiteral)) type { ++pub fn StringTable(comptime log_scope: @TypeOf(.EnumLiteral)) type { + return struct { + const Self = @This(); + +-- +2.44.1 + diff --git a/run b/run index 9e10e10..410f871 100755 --- a/run +++ b/run @@ -1,83 +1,115 @@ #!/usr/bin/env bash set -xeuo pipefail -# commit e7d28344fa3ee81d6ad7ca5ce1f83d50d8502118 -# Merge: 817cf6a82e 20d86d9c63 -# Author: Andrew Kelley -# Date: 2022-12-07T01:52:39+02:00 -# -# Merge pull request #13560 from ziglang/wasi-bootstrap -# -# Nuke the C++ implementation of Zig from orbit using WASI -MERGE_WASI_BOOTSTRAP=0.10.0-610-ge7d28344fa -git checkout $MERGE_WASI_BOOTSTRAP +HERE=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) -# commit 3ba916584db5485c38ebf2390e8d22bc6d81bf8e -# Author: Andrew Kelley -# Date: 2022-11-05T03:47:19+02:00 -# -# actually remove stage1 -REMOVE_STAGE1=0.10.0-542-g3ba916584d -git revert --no-edit $REMOVE_STAGE1 +step00() { + # commit e7d28344fa3ee81d6ad7ca5ce1f83d50d8502118 + # Merge: 817cf6a82e 20d86d9c63 + # Author: Andrew Kelley + # Date: 2022-12-07T01:52:39+02:00 + # + # Merge pull request #13560 from ziglang/wasi-bootstrap + # + # Nuke the C++ implementation of Zig from orbit using WASI + local MERGE_WASI_BOOTSTRAP=0.10.0-610-ge7d28344fa + git checkout $MERGE_WASI_BOOTSTRAP -# commit 28514476ef8c824c3d189d98f23d0f8d23e496ea -# Author: Andrew Kelley -# Date: 2022-11-01T05:29:55+02:00 -# -# remove `-fstage1` option -# -# After this commit, the self-hosted compiler does not offer the option to -# use stage1 as a backend anymore. -REMOVE_FSTAGE1=0.10.0-539-g28514476ef -git revert --no-edit -X theirs $REMOVE_FSTAGE1 + # commit 3ba916584db5485c38ebf2390e8d22bc6d81bf8e + # Author: Andrew Kelley + # Date: 2022-11-05T03:47:19+02:00 + # + # actually remove stage1 + local REMOVE_STAGE1=0.10.0-542-g3ba916584d + git revert --no-edit $REMOVE_STAGE1 -git mv stage1/config.zig.in src + # commit 28514476ef8c824c3d189d98f23d0f8d23e496ea + # Author: Andrew Kelley + # Date: 2022-11-01T05:29:55+02:00 + # + # remove `-fstage1` option + # + # After this commit, the self-hosted compiler does not offer the option to + # use stage1 as a backend anymore. + local REMOVE_FSTAGE1=0.10.0-539-g28514476ef + git revert --no-edit -X theirs $REMOVE_FSTAGE1 -# removing the wasi-based stage1 just to be sure -git rm stage1/zig1.wasm.zst + git mv stage1/config.zig.in src -sed -i '/have_stage1/ s/false/true/' src/config.zig.in + # removing the wasi-based stage1 just to be sure + git rm stage1/zig1.wasm.zst -git checkout $REMOVE_FSTAGE1~1 build.zig CMakeLists.txt + sed -i '/have_stage1/ s/false/true/' src/config.zig.in -echo "Building the C++ (stage1) implementation" -mkdir build; pushd build - CC=clang-15 CXX=clang++-15 cmake .. - make -j"$(nproc)" install -popd + git checkout $REMOVE_FSTAGE1~1 build.zig CMakeLists.txt -echo "C++ implementation in build/stage3/bin/zig. Will build zig1.wasm.zst." - -git reset --hard -git checkout $MERGE_WASI_BOOTSTRAP -rm stage1/zig1.wasm.zst - -build/stage3/bin/zig build update-zig1 - -echo "stage1/zig1.wasm.zst built. Bootstrapping zig with it." - -rm -fr build -mkdir build; pushd build - CC=clang-15 CXX=clang++-15 cmake .. - make -j"$(nproc)" install -popd - -echo "Done" -true && exit - -# commit 89d1ccc477c1dbc8bb8d13ad2598ef0190c25898 -# Author: Veikka Tuominen -# Date: Fri Dec 9 18:40:01 2022 +0200 -# -# replace zig1.wasm to the removal of BoundFn -REPLACE_ZIG1_WASM=0.10.0-677-g89d1ccc477 -git archive --prefix=zig-$REPLACE_ZIG1_WASM/ $REPLACE_ZIG1_WASM | tar -C .. -x --exclude="stage1/zig1.wasm*" - -pushd ../zig-$REPLACE_ZIG1_WASM - ../zig/build/stage3/bin/zig update-zig1 - mkdir build; pushd build + echo "Building the C++ (stage1) implementation" + mkdir build + { + pushd build CC=clang-15 CXX=clang++-15 cmake .. make -j"$(nproc)" install - popd + popd + } -popd + echo "C++ implementation in build/stage3/bin/zig. Will build zig1.wasm.zst." + + git reset --hard + git checkout $MERGE_WASI_BOOTSTRAP + rm stage1/zig1.wasm.zst + + build/stage3/bin/zig build update-zig1 + + echo "stage1/zig1.wasm.zst built. Bootstrapping zig with it." + + rm -fr build + mkdir build + { + pushd build + CC=clang-15 CXX=clang++-15 cmake .. + make -j"$(nproc)" install + popd + } + + echo "Zig bootstrapped from selfhosted." +} + +step10() { + cat < + Date: 2022-12-08T17:52:05+00:00 + + Eliminate \$(BoundFn) type from the language + + Closes #9484 +EOF + local BOUNDFN=0.10.0-675-g9d93b2ccf1 + git archive --prefix=zig-$BOUNDFN/ $BOUNDFN | tar -C .. -x --exclude="stage1/zig1.wasm*" + + { + pushd "../zig-$REPLACE_ZIG1_WASM" + cp ../zig/stage1/zig1.wasm.zst stage1/ + patch -p1 <"$HERE/0.10.0-675-g9d93b2ccf1-TypeOf-hack.patch" + mkdir build + { + pushd build + CC=clang-15 CXX=clang++-15 cmake .. + make -j"$(nproc)" install + popd + } + build/stage3/bin/zig build update-zig1 + popd + } + echo "zig1.wasm.zst was built for BoundFn hack" +} + +step20() { + true +} + +step00 +step10 +step20