Skip to content
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

zig: update to 0.14.0-dev #16862

Merged
merged 27 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bc63f23
zig: update to 0.14.0-dev.2851+b074fb7dd
nektro Jan 29, 2025
b2672ae
`bun run zig-format`
nektro Jan 29, 2025
57ec29d
add macos fixes to zig fork
nektro Jan 29, 2025
6c73c49
clean build exposed this
nektro Jan 29, 2025
7db3f21
fix DEBUG_REFCOUNT_NAME
nektro Jan 29, 2025
6b68182
Merge remote-tracking branch 'origin/main' into zig-014-dev
nektro Jan 29, 2025
78f6ec7
fix
nektro Jan 29, 2025
3b4b9b0
update to zig 0.14.0-dev.2987+183bb8b08
nektro Jan 29, 2025
60bf830
fix PASSWORD_WEAK_PARAMETERS
nektro Jan 29, 2025
0deebc4
linux fixes
nektro Jan 29, 2025
0e407c5
linux fix
nektro Jan 30, 2025
4ce39cb
windows fixes
nektro Jan 30, 2025
6feb03b
make TaggedPointer not use typeBaseName
nektro Jan 30, 2025
2f25de8
more windows fixes but im less confident why they were necessary
nektro Jan 30, 2025
d31a67d
a bit more
nektro Jan 30, 2025
6cec51c
fixed check-all
nektro Jan 31, 2025
01f8e72
ci: remove test file runner retries to reduce time while in broken state
nektro Jan 31, 2025
d2f1b28
remove calls to `@fence`
nektro Jan 31, 2025
edec7b8
fix calls to `@branchHint`
nektro Jan 31, 2025
70a135d
windows fixes
nektro Jan 31, 2025
f105b7b
add the node test retry back
nektro Jan 31, 2025
6cd6ecc
rename this back
nektro Jan 31, 2025
4b97797
address review
nektro Jan 31, 2025
fd994e5
address review
nektro Jan 31, 2025
18cf7d0
Merge remote-tracking branch 'origin/main' into zig-014-dev
nektro Feb 1, 2025
af6d0c6
port zig stdlib patches from before
nektro Feb 1, 2025
4e840f7
remove breaking change from argon2
nektro Feb 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ src/bake/generated.ts
test/cli/install/registry/packages/publish-pkg-*
test/cli/install/registry/packages/@secret/publish-pkg-8
test/js/third_party/prisma/prisma/sqlite/dev.db-journal
tmp

# Dependencies
/vendor
Expand Down Expand Up @@ -178,4 +179,4 @@ test/js/third_party/prisma/prisma/sqlite/dev.db-journal

.buildkite/ci.yml
*.sock
scratch*.{js,ts,tsx,cjs,mjs}
scratch*.{js,ts,tsx,cjs,mjs}
27 changes: 19 additions & 8 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const OperatingSystem = @import("src/env.zig").OperatingSystem;
const pathRel = fs.path.relative;

/// Do not rename this constant. It is scanned by some scripts to determine which zig version to install.
const recommended_zig_version = "0.13.0";
const recommended_zig_version = "0.14.0-dev.2987+183bb8b08";

comptime {
if (!std.mem.eql(u8, builtin.zig_version_string, recommended_zig_version)) {
Expand Down Expand Up @@ -154,8 +154,6 @@ pub fn build(b: *Build) !void {
std.log.info("zig compiler v{s}", .{builtin.zig_version_string});
checked_file_exists = std.AutoHashMap(u64, void).init(b.allocator);

b.zig_lib_dir = b.zig_lib_dir orelse b.path("vendor/zig/lib");

// TODO: Upgrade path for 0.14.0
// b.graph.zig_lib_directory = brk: {
// const sub_path = "vendor/zig/lib";
Expand Down Expand Up @@ -209,7 +207,7 @@ pub fn build(b: *Build) !void {
const bun_version = b.option([]const u8, "version", "Value of `Bun.version`") orelse "0.0.0";

b.reference_trace = ref_trace: {
const trace = b.option(u32, "reference-trace", "Set the reference trace") orelse 16;
const trace = b.option(u32, "reference-trace", "Set the reference trace") orelse 24;
break :ref_trace if (trace == 0) null else trace;
};

Expand Down Expand Up @@ -331,11 +329,25 @@ pub fn build(b: *Build) !void {
.{ .os = .windows, .arch = .x86_64 },
});
}
{
const step = b.step("check-macos", "Check for semantic analysis errors on Windows");
addMultiCheck(b, step, build_options, &.{
.{ .os = .mac, .arch = .x86_64 },
.{ .os = .mac, .arch = .aarch64 },
});
}
{
const step = b.step("check-linux", "Check for semantic analysis errors on Windows");
addMultiCheck(b, step, build_options, &.{
.{ .os = .linux, .arch = .x86_64 },
.{ .os = .linux, .arch = .aarch64 },
});
}

// zig build translate-c-headers
{
const step = b.step("translate-c", "Copy generated translated-c-headers.zig to zig-out");
step.dependOn(&b.addInstallFile(getTranslateC(b, b.host, .Debug).getOutput(), "translated-c-headers.zig").step);
step.dependOn(&b.addInstallFile(getTranslateC(b, b.graph.host, .Debug).getOutput(), "translated-c-headers.zig").step);
}

// zig build enum-extractor
Expand Down Expand Up @@ -363,7 +375,7 @@ pub fn addMultiCheck(
const check_target = b.resolveTargetQuery(.{
.os_tag = OperatingSystem.stdOSTag(check.os),
.cpu_arch = check.arch,
.cpu_model = getCpuModel(check.os, check.arch) orelse .determined_by_cpu_arch,
.cpu_model = getCpuModel(check.os, check.arch) orelse .determined_by_arch_os,
.os_version_min = getOSVersionMin(check.os),
.glibc_version = if (check.musl) null else getOSGlibCVersion(check.os),
});
Expand Down Expand Up @@ -429,7 +441,6 @@ pub fn addBunObject(b: *Build, opts: *BunBuildOptions) *Compile {
.strip = false, // stripped at the end
});
obj.bundle_compiler_rt = false;
obj.formatted_panics = true;
obj.root_module.omit_frame_pointer = false;

// Link libc
Expand Down Expand Up @@ -614,7 +625,7 @@ const WindowsShim = struct {
.optimize = .ReleaseFast,
.use_llvm = true,
.use_lld = true,
.unwind_tables = false,
.unwind_tables = .none,
.omit_frame_pointer = true,
.strip = true,
.linkage = .static,
Expand Down
2 changes: 1 addition & 1 deletion cmake/scripts/DownloadZig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ else()
set(ZIG_FILENAME ${ZIG_NAME}.tar.xz)
endif()

set(ZIG_DOWNLOAD_URL https://ziglang.org/download/${ZIG_VERSION}/${ZIG_FILENAME})
set(ZIG_DOWNLOAD_URL http://mirrors.nektro.net/zig/${ZIG_VERSION}/${ZIG_FILENAME})

execute_process(
COMMAND
Expand Down
4 changes: 2 additions & 2 deletions cmake/tools/SetupZig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ else()
unsupported(CMAKE_SYSTEM_NAME)
endif()

optionx(ZIG_VERSION STRING "The zig version of the compiler to download" DEFAULT "0.13.0")
optionx(ZIG_COMMIT STRING "The zig commit to use in oven-sh/zig" DEFAULT "131a009ba2eb127a3447d05b9e12f710429aa5ee")
optionx(ZIG_VERSION STRING "The zig version of the compiler to download" DEFAULT "0.14.0-dev.2987+183bb8b08")
optionx(ZIG_COMMIT STRING "The zig commit to use in oven-sh/zig" DEFAULT "b11877fd3e8fbc031c17872155ed481d5ba4e6af")
optionx(ZIG_TARGET STRING "The zig target to use" DEFAULT ${DEFAULT_ZIG_TARGET})

if(CMAKE_BUILD_TYPE STREQUAL "Release")
Expand Down
4 changes: 2 additions & 2 deletions src/Global.zig
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ pub inline fn configureAllocator(_: AllocatorConfiguration) void {
}

pub fn notimpl() noreturn {
@setCold(true);
@branchHint(.cold);
Output.panic("Not implemented yet!!!!!", .{});
}

// Make sure we always print any leftover
pub fn crash() noreturn {
@setCold(true);
@branchHint(.cold);
Global.exit(1);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Mutex.zig
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const FutexImpl = struct {
}

fn lockSlow(self: *@This()) void {
@setCold(true);
@branchHint(.cold);

// Avoid doing an atomic swap below if we already know the state is contended.
// An atomic swap unconditionally stores which marks the cache-line as modified unnecessarily.
Expand Down
12 changes: 6 additions & 6 deletions src/Watcher.zig
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,11 @@ fn appendFileAssumeCapacity(
// https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/kqueue.2.html
var event = std.mem.zeroes(KEvent);

event.flags = std.c.EV_ADD | std.c.EV_CLEAR | std.c.EV_ENABLE;
event.flags = std.c.EV.ADD | std.c.EV.CLEAR | std.c.EV.ENABLE;
// we want to know about the vnode
event.filter = std.c.EVFILT_VNODE;
event.filter = std.c.EVFILT.VNODE;

event.fflags = std.c.NOTE_WRITE | std.c.NOTE_RENAME | std.c.NOTE_DELETE;
event.fflags = std.c.NOTE.WRITE | std.c.NOTE.RENAME | std.c.NOTE.DELETE;

// id
event.ident = @intCast(fd.int());
Expand Down Expand Up @@ -425,15 +425,15 @@ fn appendDirectoryAssumeCapacity(
// https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/kqueue.2.html
var event = std.mem.zeroes(KEvent);

event.flags = std.c.EV_ADD | std.c.EV_CLEAR | std.c.EV_ENABLE;
event.flags = std.c.EV.ADD | std.c.EV.CLEAR | std.c.EV.ENABLE;
// we want to know about the vnode
event.filter = std.c.EVFILT_VNODE;
event.filter = std.c.EVFILT.VNODE;

// monitor:
// - Write
// - Rename
// - Delete
event.fflags = std.c.NOTE_WRITE | std.c.NOTE_RENAME | std.c.NOTE_DELETE;
event.fflags = std.c.NOTE.WRITE | std.c.NOTE.RENAME | std.c.NOTE.DELETE;

// id
event.ident = @intCast(fd.int());
Expand Down
16 changes: 8 additions & 8 deletions src/analytics/analytics_thread.zig
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ pub const Features = struct {
pub var s3: usize = 0;

comptime {
@export(napi_module_register, .{ .name = "Bun__napi_module_register_count" });
@export(process_dlopen, .{ .name = "Bun__process_dlopen_count" });
@export(&napi_module_register, .{ .name = "Bun__napi_module_register_count" });
@export(&process_dlopen, .{ .name = "Bun__process_dlopen_count" });
}

pub fn formatter() Formatter {
Expand All @@ -138,14 +138,14 @@ pub const Features = struct {
pub fn format(_: Formatter, comptime _: []const u8, _: std.fmt.FormatOptions, writer: anytype) !void {
const fields = comptime brk: {
const info: std.builtin.Type = @typeInfo(Features);
var buffer: [info.Struct.decls.len][]const u8 = .{""} ** info.Struct.decls.len;
var buffer: [info.@"struct".decls.len][]const u8 = .{""} ** info.@"struct".decls.len;
var count: usize = 0;
for (info.Struct.decls) |decl| {
for (info.@"struct".decls) |decl| {
var f = &@field(Features, decl.name);
_ = &f;
const Field = @TypeOf(f);
const FieldT: std.builtin.Type = @typeInfo(Field);
if (FieldT.Pointer.child != usize) continue;
if (FieldT.pointer.child != usize) continue;
buffer[count] = decl.name;
count += 1;
}
Expand Down Expand Up @@ -216,7 +216,7 @@ pub const packed_features_list = brk: {
};

pub const PackedFeatures = @Type(.{
.Struct = .{
.@"struct" = .{
.layout = .@"packed",
.backing_integer = u64,
.fields = brk: {
Expand All @@ -226,7 +226,7 @@ pub const PackedFeatures = @Type(.{
fields[i] = .{
.name = name,
.type = bool,
.default_value = &false,
.default_value_ptr = &false,
.is_comptime = false,
.alignment = 0,
};
Expand All @@ -236,7 +236,7 @@ pub const PackedFeatures = @Type(.{
fields[i] = .{
.name = std.fmt.comptimePrint("_{d}", .{i}),
.type = bool,
.default_value = &false,
.default_value_ptr = &false,
.is_comptime = false,
.alignment = 0,
};
Expand Down
2 changes: 1 addition & 1 deletion src/ast/base.zig
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub const Index = packed struct(u32) {

pub fn init(num: anytype) Index {
const NumType = @TypeOf(num);
if (comptime @typeInfo(NumType) == .Pointer) {
if (comptime @typeInfo(NumType) == .pointer) {
return init(num.*);
}

Expand Down
Loading