Skip to content

Commit 48a2783

Browse files
committed
cbe: implement optional slice representation change
2 parents e20d2b3 + 20925b2 commit 48a2783

File tree

378 files changed

+21796
-38974
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

378 files changed

+21796
-38974
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ test and debug from a git working tree.
6868
- `make` is typically sufficient to build zig during development iterations.
6969
- `make install` performs a build __and__ install.
7070
- `msbuild -p:Configuration=Release INSTALL.vcxproj` on Windows performs a
71-
build and install. To avoid install, pass cmake option `-DZIG_SKIP_INSTALL_LIB_FILES=ON`.
71+
build and install. To avoid install, pass cmake option `-DZIG_NO_LIB=ON`.
7272

7373
To test changes, do the following from the build directory:
7474

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,20 @@ body:
1414
attributes:
1515
label: Zig Version
1616
description: "The output of `zig version`"
17-
placeholder: "0.9.0-dev.1275+ac52e0056"
17+
placeholder: "0.10.0-dev.4583+875e98a57"
1818
validations:
1919
required: true
2020
- type: textarea
2121
id: repro
2222
attributes:
23-
label: Steps to Reproduce
24-
description: What exactly can someone else do, in order to observe the problem that you observed?
23+
label: Steps to Reproduce and Observed Behavior
24+
description: What exactly can someone else do, in order to observe the problem that you observed? Include the output and all error messages.
2525
validations:
2626
required: true
2727
- type: textarea
2828
id: expected
2929
attributes:
3030
label: Expected Behavior
31-
description: What did you expect to happen?
32-
validations:
33-
required: true
34-
- type: textarea
35-
id: actual
36-
attributes:
37-
label: Actual Behavior
38-
description: What happened instead? Be sure to include all error messages if any.
31+
description: What did you expect to happen instead?
3932
validations:
4033
required: true

CMakeLists.txt

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,20 @@ if("${ZIG_VERSION}" STREQUAL "")
8181
endif()
8282
message(STATUS "Configuring zig version ${ZIG_VERSION}")
8383

84-
set(ZIG_SKIP_INSTALL_LIB_FILES off CACHE BOOL
84+
set(ZIG_NO_LIB off CACHE BOOL
8585
"Disable copying lib/ files to install prefix during the build phase")
8686

87+
set(ZIG_SKIP_INSTALL_LIB_FILES off CACHE BOOL "Deprecated. Use ZIG_NO_LIB")
88+
if(ZIG_SKIP_INSTALL_LIB_FILES)
89+
message(WARNING "ZIG_SKIP_INSTALL_LIB_FILES is deprecated. Use ZIG_NO_LIB instead.")
90+
set(ZIG_NO_LIB ON)
91+
endif()
92+
8793
set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)")
8894
set(ZIG_SHARED_LLVM off CACHE BOOL "Prefer linking against shared LLVM libraries")
8995
set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries")
9096
set(ZIG_STATIC_ZLIB off CACHE BOOL "Prefer linking against static zlib")
97+
set(ZIG_STATIC_ZSTD off CACHE BOOL "Prefer linking against static zstd")
9198
set(ZIG_USE_CCACHE off CACHE BOOL "Use ccache if available")
9299

93100
if(CCACHE_PROGRAM AND ZIG_USE_CCACHE)
@@ -97,6 +104,7 @@ endif()
97104
if(ZIG_STATIC)
98105
set(ZIG_STATIC_LLVM ON)
99106
set(ZIG_STATIC_ZLIB ON)
107+
set(ZIG_STATIC_ZSTD ON)
100108
endif()
101109

102110
if (ZIG_SHARED_LLVM AND ZIG_STATIC_LLVM)
@@ -137,6 +145,12 @@ if(ZIG_STATIC_ZLIB)
137145
list(APPEND LLVM_LIBRARIES "${ZLIB}")
138146
endif()
139147

148+
if(ZIG_STATIC_ZSTD)
149+
list(REMOVE_ITEM LLVM_LIBRARIES "-lzstd")
150+
find_library(ZSTD NAMES libzstd.a libzstdstatic.a zstd NAMES_PER_DIR)
151+
list(APPEND LLVM_LIBRARIES "${ZSTD}")
152+
endif()
153+
140154
if(APPLE AND ZIG_STATIC)
141155
list(REMOVE_ITEM LLVM_LIBRARIES "-lcurses")
142156
find_library(CURSES NAMES libcurses.a libncurses.a NAMES_PER_DIR
@@ -996,10 +1010,10 @@ elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
9961010
else()
9971011
set(ZIG_RELEASE_ARG -Drelease -Dstrip)
9981012
endif()
999-
if(ZIG_SKIP_INSTALL_LIB_FILES)
1000-
set(ZIG_SKIP_INSTALL_LIB_FILES_ARG "-Dskip-install-lib-files")
1013+
if(ZIG_NO_LIB)
1014+
set(ZIG_NO_LIB_ARG "-Dno-lib")
10011015
else()
1002-
set(ZIG_SKIP_INSTALL_LIB_FILES_ARG "-Dskip-install-lib-files=false")
1016+
set(ZIG_NO_LIB_ARG "")
10031017
endif()
10041018
if(ZIG_SINGLE_THREADED)
10051019
set(ZIG_SINGLE_THREADED_ARG "-fsingle-threaded")
@@ -1072,7 +1086,7 @@ set(ZIG_BUILD_ARGS
10721086
"-Denable-stage1"
10731087
${ZIG_RELEASE_ARG}
10741088
${ZIG_STATIC_ARG}
1075-
${ZIG_SKIP_INSTALL_LIB_FILES_ARG}
1089+
${ZIG_NO_LIB_ARG}
10761090
${ZIG_SINGLE_THREADED_ARG}
10771091
"-Dtarget=${ZIG_TARGET_TRIPLE}"
10781092
"-Dcpu=${ZIG_TARGET_MCPU}"

build.zig

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ pub fn build(b: *Builder) !void {
6161
const skip_stage1 = b.option(bool, "skip-stage1", "Main test suite skips stage1 compile error tests") orelse false;
6262
const skip_run_translated_c = b.option(bool, "skip-run-translated-c", "Main test suite skips run-translated-c tests") orelse false;
6363
const skip_stage2_tests = b.option(bool, "skip-stage2-tests", "Main test suite skips self-hosted compiler tests") orelse false;
64-
const skip_install_lib_files = b.option(bool, "skip-install-lib-files", "Do not copy lib/ files to installation prefix") orelse false;
64+
const deprecated_skip_install_lib_files = b.option(bool, "skip-install-lib-files", "deprecated. see no-lib") orelse false;
65+
if (deprecated_skip_install_lib_files) {
66+
std.log.warn("-Dskip-install-lib-files is deprecated in favor of -Dno-lib", .{});
67+
}
68+
const skip_install_lib_files = b.option(bool, "no-lib", "skip copying of lib/ files to installation prefix. Useful for development") orelse deprecated_skip_install_lib_files;
6569

6670
const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false;
6771

@@ -122,8 +126,8 @@ pub fn build(b: *Builder) !void {
122126
return;
123127

124128
const tracy = b.option([]const u8, "tracy", "Enable Tracy integration. Supply path to Tracy source");
125-
const tracy_callstack = b.option(bool, "tracy-callstack", "Include callstack information with Tracy data. Does nothing if -Dtracy is not provided") orelse false;
126-
const tracy_allocation = b.option(bool, "tracy-allocation", "Include allocation information with Tracy data. Does nothing if -Dtracy is not provided") orelse false;
129+
const tracy_callstack = b.option(bool, "tracy-callstack", "Include callstack information with Tracy data. Does nothing if -Dtracy is not provided") orelse (tracy != null);
130+
const tracy_allocation = b.option(bool, "tracy-allocation", "Include allocation information with Tracy data. Does nothing if -Dtracy is not provided") orelse (tracy != null);
127131
const force_gpa = b.option(bool, "force-gpa", "Force the compiler to use GeneralPurposeAllocator") orelse false;
128132
const link_libc = b.option(bool, "force-link-libc", "Force self-hosted compiler to link libc") orelse (enable_llvm or only_c);
129133
const sanitize_thread = b.option(bool, "sanitize-thread", "Enable thread-sanitization") orelse false;
@@ -378,7 +382,7 @@ pub fn build(b: *Builder) !void {
378382
if (tracy) |tracy_path| {
379383
const client_cpp = fs.path.join(
380384
b.allocator,
381-
&[_][]const u8{ tracy_path, "TracyClient.cpp" },
385+
&[_][]const u8{ tracy_path, "public", "TracyClient.cpp" },
382386
) catch unreachable;
383387

384388
// On mingw, we need to opt into windows 7+ to get some features required by tracy.
@@ -635,6 +639,7 @@ fn addStaticLlvmOptionsToExe(exe: *std.build.LibExeObjStep) !void {
635639
}
636640

637641
exe.linkSystemLibrary("z");
642+
exe.linkSystemLibrary("zstd");
638643

639644
// This means we rely on clang-or-zig-built LLVM, Clang, LLD libraries.
640645
exe.linkSystemLibrary("c++");
@@ -673,13 +678,12 @@ fn addCxxKnownPath(
673678
exe.addObjectFile(path_unpadded);
674679

675680
// TODO a way to integrate with system c++ include files here
676-
// cc -E -Wp,-v -xc++ /dev/null
681+
// c++ -E -Wp,-v -xc++ /dev/null
677682
if (need_cpp_includes) {
678683
// I used these temporarily for testing something but we obviously need a
679684
// more general purpose solution here.
680-
//exe.addIncludePath("/nix/store/fvf3qjqa5qpcjjkq37pb6ypnk1mzhf5h-gcc-9.3.0/lib/gcc/x86_64-unknown-linux-gnu/9.3.0/../../../../include/c++/9.3.0");
681-
//exe.addIncludePath("/nix/store/fvf3qjqa5qpcjjkq37pb6ypnk1mzhf5h-gcc-9.3.0/lib/gcc/x86_64-unknown-linux-gnu/9.3.0/../../../../include/c++/9.3.0/x86_64-unknown-linux-gnu");
682-
//exe.addIncludePath("/nix/store/fvf3qjqa5qpcjjkq37pb6ypnk1mzhf5h-gcc-9.3.0/lib/gcc/x86_64-unknown-linux-gnu/9.3.0/../../../../include/c++/9.3.0/backward");
685+
//exe.addIncludePath("/nix/store/2lr0fc0ak8rwj0k8n3shcyz1hz63wzma-gcc-11.3.0/include/c++/11.3.0");
686+
//exe.addIncludePath("/nix/store/2lr0fc0ak8rwj0k8n3shcyz1hz63wzma-gcc-11.3.0/include/c++/11.3.0/x86_64-unknown-linux-gnu");
683687
}
684688
}
685689

ci/azure/macos_script

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ZIGDIR="$(pwd)"
99
ARCH="x86_64"
1010
TARGET="$ARCH-macos-none"
1111
MCPU="baseline"
12-
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4111+5206832a8"
12+
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0"
1313
PREFIX="$HOME/$CACHE_BASENAME"
1414
JOBS="-j2"
1515

@@ -55,12 +55,26 @@ stage3-release/bin/zig build test docs \
5555
-Dskip-non-native \
5656
--search-prefix "$PREFIX"
5757

58+
# Produce the experimental std lib documentation.
59+
mkdir -p "stage3-release/doc/std"
60+
stage3-release/bin/zig test "$(pwd)/../lib/std/std.zig" \
61+
--zig-lib-dir "$(pwd)/../lib" \
62+
-femit-docs="$(pwd)/stage3-release/doc/std" \
63+
-fno-emit-bin
64+
5865
if [ "${BUILD_REASON}" != "PullRequest" ]; then
59-
mv ../LICENSE stage3-release/
60-
mv ../zig-cache/langref.html stage3-release/
66+
# Remove the unnecessary bin dir in stage3-release/bin/zig
6167
mv stage3-release/bin/zig stage3-release/
6268
rmdir stage3-release/bin
6369

70+
# Remove the unnecessary zig dir in stage3-release/lib/zig/std/std.zig
71+
mv stage3-release/lib/zig stage3-release/lib2
72+
rmdir stage3-release/lib
73+
mv stage3-release/lib2 stage3-release/lib
74+
75+
mv ../LICENSE stage3-release/
76+
mv ../zig-cache/langref.html stage3-release/doc
77+
6478
VERSION=$(stage3-release/zig version)
6579
DIRNAME="zig-macos-$ARCH-$VERSION"
6680
TARBALL="$DIRNAME.tar.xz"

ci/azure/pipelines.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
vmImage: 'windows-2019'
1717
variables:
1818
TARGET: 'x86_64-windows-gnu'
19-
ZIG_LLVM_CLANG_LLD_NAME: 'zig+llvm+lld+clang-${{ variables.TARGET }}-0.10.0-dev.4459+4f9345d20'
19+
ZIG_LLVM_CLANG_LLD_NAME: 'zig+llvm+lld+clang-${{ variables.TARGET }}-0.10.0-dev.4560+828735ac0'
2020
ZIG_LLVM_CLANG_LLD_URL: 'https://ziglang.org/deps/${{ variables.ZIG_LLVM_CLANG_LLD_NAME }}.zip'
2121
steps:
2222
- pwsh: |
@@ -60,6 +60,7 @@ jobs:
6060
displayName: 'Build'
6161
6262
- pwsh: |
63+
Set-Variable -Name ZIGLIBDIR -Value "$(Get-Location)\lib"
6364
Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\stage3-release"
6465
Set-Variable -Name ZIGPREFIXPATH -Value "$(Get-Location)\$(ZIG_LLVM_CLANG_LLD_NAME)"
6566
@@ -75,6 +76,14 @@ jobs:
7576
-Dstatic-llvm `
7677
-Dskip-non-native
7778
CheckLastExitCode
79+
80+
# Produce the experimental std lib documentation.
81+
mkdir "$ZIGINSTALLDIR\doc\std" -force
82+
& "$ZIGINSTALLDIR\bin\zig.exe" test "$ZIGLIBDIR\std\std.zig" `
83+
--zig-lib-dir "$ZIGLIBDIR" `
84+
-femit-docs="$ZIGINSTALLDIR\doc\std" `
85+
-fno-emit-bin
86+
7887
name: test
7988
displayName: 'Test'
8089

ci/drone/drone.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,56 +9,56 @@ platform:
99

1010
steps:
1111
- name: build
12-
image: ziglang/static-base:llvm15-aarch64-2
12+
image: ziglang/static-base:llvm15-aarch64-3
1313
commands:
1414
- ./ci/drone/linux_script_build
1515

1616
- name: behavior
1717
depends_on:
1818
- build
19-
image: ziglang/static-base:llvm15-aarch64-2
19+
image: ziglang/static-base:llvm15-aarch64-3
2020
commands:
2121
- ./ci/drone/test_linux_behavior
2222

2323
- name: std_Debug
2424
depends_on:
2525
- build
26-
image: ziglang/static-base:llvm15-aarch64-2
26+
image: ziglang/static-base:llvm15-aarch64-3
2727
commands:
2828
- ./ci/drone/test_linux_std_Debug
2929

3030
- name: std_ReleaseSafe
3131
depends_on:
3232
- build
33-
image: ziglang/static-base:llvm15-aarch64-2
33+
image: ziglang/static-base:llvm15-aarch64-3
3434
commands:
3535
- ./ci/drone/test_linux_std_ReleaseSafe
3636

3737
- name: std_ReleaseFast
3838
depends_on:
3939
- build
40-
image: ziglang/static-base:llvm15-aarch64-2
40+
image: ziglang/static-base:llvm15-aarch64-3
4141
commands:
4242
- ./ci/drone/test_linux_std_ReleaseFast
4343

4444
- name: std_ReleaseSmall
4545
depends_on:
4646
- build
47-
image: ziglang/static-base:llvm15-aarch64-2
47+
image: ziglang/static-base:llvm15-aarch64-3
4848
commands:
4949
- ./ci/drone/test_linux_std_ReleaseSmall
5050

5151
- name: misc
5252
depends_on:
5353
- build
54-
image: ziglang/static-base:llvm15-aarch64-2
54+
image: ziglang/static-base:llvm15-aarch64-3
5555
commands:
5656
- ./ci/drone/test_linux_misc
5757

5858
- name: cases
5959
depends_on:
6060
- build
61-
image: ziglang/static-base:llvm15-aarch64-2
61+
image: ziglang/static-base:llvm15-aarch64-3
6262
commands:
6363
- ./ci/drone/test_linux_cases
6464

@@ -72,7 +72,7 @@ steps:
7272
- std_ReleaseSmall
7373
- misc
7474
- cases
75-
image: ziglang/static-base:llvm15-aarch64-2
75+
image: ziglang/static-base:llvm15-aarch64-3
7676
environment:
7777
SRHT_OAUTH_TOKEN:
7878
from_secret: SRHT_OAUTH_TOKEN

ci/drone/linux_script_finalize

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,21 @@ if [ -n "$DRONE_PULL_REQUEST" ]; then
1212
exit 0
1313
fi
1414

15-
apk update
16-
apk add py3-pip perl-utils jq curl
17-
pip3 install s3cmd
18-
1915
cd build
2016

21-
mv ../LICENSE "$INSTALL_PREFIX/"
22-
# https://github.com/ziglang/zig/issues/12689
23-
# mv ../zig-cache/langref.html "$INSTALL_PREFIX/"
17+
# Remove the unnecessary bin dir in $INSTALL_PREFIX/bin/zig
2418
mv "$INSTALL_PREFIX/bin/zig" "$INSTALL_PREFIX/"
2519
rmdir "$INSTALL_PREFIX/bin"
2620

21+
# Remove the unnecessary zig dir in $INSTALL_PREFIX/lib/zig/std/std.zig
22+
mv "$INSTALL_PREFIX/lib/zig" "$INSTALL_PREFIX/lib2"
23+
rmdir "$INSTALL_PREFIX/lib"
24+
mv "$INSTALL_PREFIX/lib2" "$INSTALL_PREFIX/lib"
25+
26+
mv ../LICENSE "$INSTALL_PREFIX/"
27+
# https://github.com/ziglang/zig/issues/12689
28+
# mv ../zig-cache/langref.html "$INSTALL_PREFIX/doc/"
29+
2730
GITBRANCH="$DRONE_BRANCH"
2831
VERSION="$("$INSTALL_PREFIX/zig" version)"
2932
DIRNAME="zig-linux-$ARCH-$VERSION"

ci/drone/test_linux_std_Debug

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,10 @@ $ZIG build test-std \
1313
-Dskip-release-fast \
1414
-Dskip-release-small \
1515
-Dskip-non-native
16+
17+
# Produce the experimental std lib documentation.
18+
mkdir -p "$INSTALL_PREFIX/doc/std"
19+
$ZIG test "$DRONE_WORKSPACE/lib/std/std.zig" \
20+
--zig-lib-dir "$DRONE_WORKSPACE/lib" \
21+
-femit-docs="$INSTALL_PREFIX/doc/std" \
22+
-fno-emit-bin

ci/srht/freebsd_script

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,26 @@ stage3/bin/zig build test docs \
6262
-Dskip-stage1 \
6363
-Dskip-non-native
6464

65+
# Produce the experimental std lib documentation.
66+
mkdir -p "stage3/doc/std"
67+
stage3/bin/zig test "$(pwd)/../lib/std/std.zig" \
68+
--zig-lib-dir "$(pwd)/../lib" \
69+
-femit-docs="$(pwd)/stage3/doc/std/" \
70+
-fno-emit-bin
71+
6572
if [ -f ~/.s3cfg ]; then
66-
mv ../LICENSE stage3/
67-
mv ../zig-cache/langref.html stage3/
73+
# Remove the unnecessary bin dir in stage3/bin/zig
6874
mv stage3/bin/zig stage3/
6975
rmdir stage3/bin
7076

77+
# Remove the unnecessary zig dir in stage3/lib/zig/std/std.zig
78+
mv stage3/lib/zig stage3/lib2
79+
rmdir stage3/lib
80+
mv stage3/lib2 stage3/lib
81+
82+
mv ../LICENSE stage3/
83+
mv ../zig-cache/langref.html stage3/doc/
84+
7185
GITBRANCH=$(basename $GITHUB_REF)
7286
VERSION=$(stage3/zig version)
7387
DIRNAME="zig-freebsd-x86_64-$VERSION"

0 commit comments

Comments
 (0)