Skip to content

Commit

Permalink
zig: update to 0.14.0-dev.2851+b074fb7dd
Browse files Browse the repository at this point in the history
  • Loading branch information
nektro committed Jan 29, 2025
1 parent 5633ec4 commit bc63f23
Show file tree
Hide file tree
Showing 173 changed files with 1,669 additions and 2,086 deletions.
10 changes: 4 additions & 6 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.2851+b074fb7dd";

comptime {
if (!std.mem.eql(u8, builtin.zig_version_string, recommended_zig_version)) {
Expand Down Expand Up @@ -154,7 +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: {
Expand Down Expand Up @@ -335,7 +334,7 @@ pub fn build(b: *Build) !void {
// 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, target, .Debug).getOutput(), "translated-c-headers.zig").step);
}

// zig build enum-extractor
Expand Down Expand Up @@ -363,7 +362,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 +428,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 +612,7 @@ const WindowsShim = struct {
.optimize = .ReleaseFast,
.use_llvm = true,
.use_lld = true,
.unwind_tables = false,
.unwind_tables = null,
.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.2851+b074fb7dd")
optionx(ZIG_COMMIT STRING "The zig commit to use in oven-sh/zig" DEFAULT "b074fb7ddaefaa6ed9c5235d22b2f7378e3b80e8")
optionx(ZIG_TARGET STRING "The zig target to use" DEFAULT ${DEFAULT_ZIG_TARGET})

if(CMAKE_BUILD_TYPE STREQUAL "Release")
Expand Down
2 changes: 1 addition & 1 deletion scripts/runner.node.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const { values: options, positionals: filters } = parseArgs({
},
["retries"]: {
type: "string",
default: isCI ? "4" : "0", // N retries = N+1 attempts
default: isCI ? "1" : "0", // N retries = N+1 attempts
},
},
});
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
58 changes: 29 additions & 29 deletions src/async/posix_event_loop.zig
Original file line number Diff line number Diff line change
Expand Up @@ -503,19 +503,19 @@ pub const FilePoll = struct {

pub fn fromKQueueEvent(kqueue_event: std.posix.system.kevent64_s) Flags.Set {
var flags = Flags.Set{};
if (kqueue_event.filter == std.posix.system.EVFILT_READ) {
if (kqueue_event.filter == std.posix.system.EVFILT.READ) {
flags.insert(Flags.readable);
if (kqueue_event.flags & std.posix.system.EV_EOF != 0) {
if (kqueue_event.flags & std.posix.system.EV.EOF != 0) {
flags.insert(Flags.hup);
}
} else if (kqueue_event.filter == std.posix.system.EVFILT_WRITE) {
} else if (kqueue_event.filter == std.posix.system.EVFILT.WRITE) {
flags.insert(Flags.writable);
if (kqueue_event.flags & std.posix.system.EV_EOF != 0) {
if (kqueue_event.flags & std.posix.system.EV.EOF != 0) {
flags.insert(Flags.hup);
}
} else if (kqueue_event.filter == std.posix.system.EVFILT_PROC) {
} else if (kqueue_event.filter == std.posix.system.EVFILT.PROC) {
flags.insert(Flags.process);
} else if (kqueue_event.filter == std.posix.system.EVFILT_MACHPORT) {
} else if (kqueue_event.filter == std.posix.system.EVFILT.MACHPORT) {
flags.insert(Flags.machport);
}
return flags;
Expand Down Expand Up @@ -782,7 +782,7 @@ pub const FilePoll = struct {
});

comptime {
@export(onTick, .{ .name = "Bun__internal_dispatch_ready_poll" });
@export(&onTick, .{ .name = "Bun__internal_dispatch_ready_poll" });
}

const timeout = std.mem.zeroes(std.posix.timespec);
Expand Down Expand Up @@ -837,45 +837,45 @@ pub const FilePoll = struct {
const one_shot_flag: u16 = if (!this.flags.contains(.one_shot))
0
else if (one_shot == .dispatch)
std.c.EV_DISPATCH | std.c.EV_ENABLE
std.c.EV.DISPATCH | std.c.EV.ENABLE
else
std.c.EV_ONESHOT;
std.c.EV.ONESHOT;

changelist[0] = switch (flag) {
.readable => .{
.ident = @intCast(fd.cast()),
.filter = std.posix.system.EVFILT_READ,
.filter = std.posix.system.EVFILT.READ,
.data = 0,
.fflags = 0,
.udata = @intFromPtr(Pollable.init(this).ptr()),
.flags = std.c.EV_ADD | one_shot_flag,
.flags = std.c.EV.ADD | one_shot_flag,
.ext = .{ this.generation_number, 0 },
},
.writable => .{
.ident = @intCast(fd.cast()),
.filter = std.posix.system.EVFILT_WRITE,
.filter = std.posix.system.EVFILT.WRITE,
.data = 0,
.fflags = 0,
.udata = @intFromPtr(Pollable.init(this).ptr()),
.flags = std.c.EV_ADD | one_shot_flag,
.flags = std.c.EV.ADD | one_shot_flag,
.ext = .{ this.generation_number, 0 },
},
.process => .{
.ident = @intCast(fd.cast()),
.filter = std.posix.system.EVFILT_PROC,
.filter = std.posix.system.EVFILT.PROC,
.data = 0,
.fflags = std.c.NOTE_EXIT,
.fflags = std.c.NOTE.EXIT,
.udata = @intFromPtr(Pollable.init(this).ptr()),
.flags = std.c.EV_ADD | one_shot_flag,
.flags = std.c.EV.ADD | one_shot_flag,
.ext = .{ this.generation_number, 0 },
},
.machport => .{
.ident = @intCast(fd.cast()),
.filter = std.posix.system.EVFILT_MACHPORT,
.filter = std.posix.system.EVFILT.MACHPORT,
.data = 0,
.fflags = 0,
.udata = @intFromPtr(Pollable.init(this).ptr()),
.flags = std.c.EV_ADD | one_shot_flag,
.flags = std.c.EV.ADD | one_shot_flag,
.ext = .{ this.generation_number, 0 },
},
else => unreachable,
Expand Down Expand Up @@ -913,7 +913,7 @@ pub const FilePoll = struct {
// processing an element of the changelist and there is enough room
// in the eventlist, then the event will be placed in the eventlist
// with EV_ERROR set in flags and the system error in data.
if (changelist[0].flags == std.c.EV_ERROR and changelist[0].data != 0) {
if (changelist[0].flags == std.c.EV.ERROR and changelist[0].data != 0) {
return JSC.Maybe(void).errnoSys(changelist[0].data, .kevent).?;
// Otherwise, -1 will be returned, and errno will be set to
// indicate the error condition.
Expand Down Expand Up @@ -1008,38 +1008,38 @@ pub const FilePoll = struct {
changelist[0] = switch (flag) {
.readable => .{
.ident = @intCast(fd.cast()),
.filter = std.posix.system.EVFILT_READ,
.filter = std.posix.system.EVFILT.READ,
.data = 0,
.fflags = 0,
.udata = @intFromPtr(Pollable.init(this).ptr()),
.flags = std.c.EV_DELETE,
.flags = std.c.EV.DELETE,
.ext = .{ 0, 0 },
},
.machport => .{
.ident = @intCast(fd.cast()),
.filter = std.posix.system.EVFILT_MACHPORT,
.filter = std.posix.system.EVFILT.MACHPORT,
.data = 0,
.fflags = 0,
.udata = @intFromPtr(Pollable.init(this).ptr()),
.flags = std.c.EV_DELETE,
.flags = std.c.EV.DELETE,
.ext = .{ 0, 0 },
},
.writable => .{
.ident = @intCast(fd.cast()),
.filter = std.posix.system.EVFILT_WRITE,
.filter = std.posix.system.EVFILT.WRITE,
.data = 0,
.fflags = 0,
.udata = @intFromPtr(Pollable.init(this).ptr()),
.flags = std.c.EV_DELETE,
.flags = std.c.EV.DELETE,
.ext = .{ 0, 0 },
},
.process => .{
.ident = @intCast(fd.cast()),
.filter = std.posix.system.EVFILT_PROC,
.filter = std.posix.system.EVFILT.PROC,
.data = 0,
.fflags = std.c.NOTE_EXIT,
.fflags = std.c.NOTE.EXIT,
.udata = @intFromPtr(Pollable.init(this).ptr()),
.flags = std.c.EV_DELETE,
.flags = std.c.EV.DELETE,
.ext = .{ 0, 0 },
},
else => unreachable,
Expand All @@ -1065,7 +1065,7 @@ pub const FilePoll = struct {
// processing an element of the changelist and there is enough room
// in the eventlist, then the event will be placed in the eventlist
// with EV_ERROR set in flags and the system error in data.
if (changelist[0].flags == std.c.EV_ERROR) {
if (changelist[0].flags == std.c.EV.ERROR) {
return JSC.Maybe(void).errnoSys(changelist[0].data, .kevent).?;
// Otherwise, -1 will be returned, and errno will be set to
// indicate the error condition.
Expand Down
Loading

0 comments on commit bc63f23

Please sign in to comment.