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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix DEBUG_REFCOUNT_NAME
nektro committed Jan 29, 2025
commit 7db3f21054405b956c849c167a466f086c9f0d90
2 changes: 1 addition & 1 deletion src/bun.js/api/Timer.zig
Original file line number Diff line number Diff line change
@@ -448,7 +448,7 @@ pub const TimerObject = struct {
},

pub usingnamespace JSC.Codegen.JSTimeout;
pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);

extern "C" fn Bun__JSTimeout__call(encodedTimeoutValue: JSValue, globalObject: *JSC.JSGlobalObject) void;

2 changes: 1 addition & 1 deletion src/bun.js/api/bun/dns_resolver.zig
Original file line number Diff line number Diff line change
@@ -1799,7 +1799,7 @@ pub const DNSResolver = struct {
pending_nameinfo_cache_cares: NameInfoPendingCache = NameInfoPendingCache.init(),

pub usingnamespace JSC.Codegen.JSDNSResolver;
pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);

const PollsMap = std.AutoArrayHashMap(c_ares.ares_socket_t, *PollType);

3 changes: 1 addition & 2 deletions src/bun.js/api/bun/h2_frame_parser.zig
Original file line number Diff line number Diff line change
@@ -643,8 +643,7 @@ const Handlers = struct {
pub const H2FrameParser = struct {
pub const log = Output.scoped(.H2FrameParser, false);
pub usingnamespace JSC.Codegen.JSH2FrameParser;
pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub const DEBUG_REFCOUNT_NAME = "H2";
pub usingnamespace bun.NewRefCounted(@This(), deinit, "H2");
const ENABLE_AUTO_CORK = true; // ENABLE CORK OPTIMIZATION
const ENABLE_ALLOCATOR_POOL = true; // ENABLE HIVE ALLOCATOR OPTIMIZATION

2 changes: 1 addition & 1 deletion src/bun.js/api/bun/process.zig
Original file line number Diff line number Diff line change
@@ -157,7 +157,7 @@ pub const Process = struct {
return @sizeOf(@This());
}

pub usingnamespace bun.NewRefCounted(Process, deinit);
pub usingnamespace bun.NewRefCounted(Process, deinit, null);

pub fn setExitHandler(this: *Process, handler: anytype) void {
this.exit_handler.init(handler);
4 changes: 1 addition & 3 deletions src/bun.js/api/bun/socket.zig
Original file line number Diff line number Diff line change
@@ -1342,9 +1342,7 @@ fn NewSocket(comptime ssl: bool) type {
// This is wasteful because it means we are keeping a JSC::Weak for every single open socket
has_pending_activity: std.atomic.Value(bool) = std.atomic.Value(bool).init(true),
native_callback: NativeCallbacks = .none,
pub usingnamespace bun.NewRefCounted(@This(), deinit);

pub const DEBUG_REFCOUNT_NAME = "Socket";
pub usingnamespace bun.NewRefCounted(@This(), deinit, "Socket");

// We use this direct callbacks on HTTP2 when available
pub const NativeCallbacks = union(enum) {
6 changes: 3 additions & 3 deletions src/bun.js/api/bun/subprocess.zig
Original file line number Diff line number Diff line change
@@ -199,7 +199,7 @@ pub const Subprocess = struct {
ref_count: u32 = 1,
abort_signal: ?*JSC.AbortSignal = null,

usingnamespace bun.NewRefCounted(@This(), deinit);
usingnamespace bun.NewRefCounted(@This(), deinit, null);

pub const Flags = packed struct {
is_sync: bool = false,
@@ -853,7 +853,7 @@ pub const Subprocess = struct {
ref_count: u32 = 1,
buffer: []const u8 = "",

pub usingnamespace bun.NewRefCounted(@This(), _deinit);
pub usingnamespace bun.NewRefCounted(@This(), _deinit, null);
const This = @This();
const print = bun.Output.scoped(.StaticPipeWriter, false);

@@ -981,7 +981,7 @@ pub const Subprocess = struct {
pub const IOReader = bun.io.BufferedReader;
pub const Poll = IOReader;

pub usingnamespace bun.NewRefCounted(PipeReader, _deinit);
pub usingnamespace bun.NewRefCounted(PipeReader, _deinit, null);

pub fn memoryCost(this: *const PipeReader) usize {
return this.reader.memoryCost();
18 changes: 9 additions & 9 deletions src/bun.js/api/html_rewriter.zig
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ pub const LOLHTMLContext = struct {
document_handlers: std.ArrayListUnmanaged(*DocumentHandler) = .{},
ref_count: u32 = 1,

pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);

fn deinit(this: *LOLHTMLContext) void {
for (this.selectors.items) |selector| {
@@ -395,7 +395,7 @@ pub const HTMLRewriter = struct {
bodyValueBufferer: ?JSC.WebCore.BodyValueBufferer = null,
tmp_sync_error: ?*JSC.JSValue = null,
ref_count: u32 = 1,
pub usingnamespace bun.NewRefCounted(BufferOutputSink, deinit);
pub usingnamespace bun.NewRefCounted(BufferOutputSink, deinit, null);

// const log = bun.Output.scoped(.BufferOutputSink, false);
pub fn init(context: *LOLHTMLContext, global: *JSGlobalObject, original: *Response, builder: *LOLHTML.HTMLRewriter.Builder) JSC.JSValue {
@@ -1066,7 +1066,7 @@ pub const TextChunk = struct {
ref_count: u32 = 1,

pub usingnamespace JSC.Codegen.JSTextChunk;
pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);
pub fn init(text_chunk: *LOLHTML.TextChunk) *TextChunk {
return TextChunk.new(.{ .text_chunk = text_chunk, .ref_count = 2 });
}
@@ -1175,7 +1175,7 @@ pub const DocType = struct {
return DocType.new(.{ .doctype = doctype, .ref_count = 2 });
}

pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);
pub usingnamespace JSC.Codegen.JSDocType;

/// The doctype name.
@@ -1242,7 +1242,7 @@ pub const DocEnd = struct {
doc_end: ?*LOLHTML.DocEnd,
ref_count: u32 = 1,

pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);
pub usingnamespace JSC.Codegen.JSDocEnd;

pub fn init(doc_end: *LOLHTML.DocEnd) *DocEnd {
@@ -1291,7 +1291,7 @@ pub const Comment = struct {
comment: ?*LOLHTML.Comment = null,
ref_count: u32 = 1,

pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);
pub usingnamespace JSC.Codegen.JSComment;

pub fn init(comment: *LOLHTML.Comment) *Comment {
@@ -1436,7 +1436,7 @@ pub const EndTag = struct {
};

pub usingnamespace JSC.Codegen.JSEndTag;
pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);

fn contentHandler(this: *EndTag, comptime Callback: (fn (*LOLHTML.EndTag, []const u8, bool) LOLHTML.Error!void), thisObject: JSValue, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue {
if (this.end_tag == null)
@@ -1554,7 +1554,7 @@ pub const AttributeIterator = struct {
}

pub usingnamespace JSC.Codegen.JSAttributeIterator;
pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);

pub fn next(this: *AttributeIterator, globalObject: *JSGlobalObject, _: *JSC.CallFrame) bun.JSError!JSValue {
const done_label = JSC.ZigString.static("done");
@@ -1591,7 +1591,7 @@ pub const Element = struct {
ref_count: u32 = 1,

pub usingnamespace JSC.Codegen.JSElement;
pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);

pub fn init(element: *LOLHTML.Element) *Element {
return Element.new(.{ .element = element, .ref_count = 2 });
2 changes: 1 addition & 1 deletion src/bun.js/api/server.zig
Original file line number Diff line number Diff line change
@@ -5792,7 +5792,7 @@ const ServePlugins = struct {
value: Value,
ref_count: u32 = 1,

pub usingnamespace bun.NewRefCounted(ServePlugins, deinit);
pub usingnamespace bun.NewRefCounted(ServePlugins, deinit, null);

pub const Value = union(enum) {
pending: struct {
6 changes: 3 additions & 3 deletions src/bun.js/api/server/HTMLBundle.zig
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ pub const HTMLBundleRoute = struct {
});
}

pub usingnamespace bun.NewRefCounted(@This(), _deinit);
pub usingnamespace bun.NewRefCounted(@This(), _deinit, null);

pub const Value = union(enum) {
pending_plugins,
@@ -512,7 +512,7 @@ pub const HTMLBundleRoute = struct {
server: ?AnyServer = null,
route: *HTMLBundleRoute,

pub usingnamespace bun.NewRefCounted(@This(), __deinit);
pub usingnamespace bun.NewRefCounted(@This(), __deinit, null);

fn __deinit(this: *PendingResponse) void {
if (this.is_response_pending) {
@@ -544,7 +544,7 @@ pub const HTMLBundleRoute = struct {
};

pub usingnamespace JSC.Codegen.JSHTMLBundle;
pub usingnamespace bun.NewRefCounted(HTMLBundle, deinit);
pub usingnamespace bun.NewRefCounted(HTMLBundle, deinit, null);
const bun = @import("root").bun;
const std = @import("std");
const JSC = bun.JSC;
2 changes: 1 addition & 1 deletion src/bun.js/api/server/StaticRoute.zig
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ headers: Headers = .{
},
ref_count: u32 = 1,

pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);

fn deinit(this: *StaticRoute) void {
this.blob.detach();
4 changes: 2 additions & 2 deletions src/bun.js/node/node_zlib_binding.zig
Original file line number Diff line number Diff line change
@@ -310,7 +310,7 @@ const CountedKeepAlive = struct {
};

pub const SNativeZlib = struct {
pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);
pub usingnamespace JSC.Codegen.JSNativeZlib;
pub usingnamespace CompressionStream(@This());

@@ -676,7 +676,7 @@ const ZlibContext = struct {
pub const NativeBrotli = JSC.Codegen.JSNativeBrotli.getConstructor;

pub const SNativeBrotli = struct {
pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);
pub usingnamespace JSC.Codegen.JSNativeBrotli;
pub usingnamespace CompressionStream(@This());

2 changes: 1 addition & 1 deletion src/bun.js/webcore/streams.zig
Original file line number Diff line number Diff line change
@@ -3428,7 +3428,7 @@ pub const FileSink = struct {

const log = Output.scoped(.FileSink, false);

pub usingnamespace bun.NewRefCounted(FileSink, deinit);
pub usingnamespace bun.NewRefCounted(FileSink, deinit, null);

pub const IOWriter = bun.io.StreamingWriter(@This(), onWrite, onError, onReady, onClose);
pub const Poll = IOWriter;
14 changes: 6 additions & 8 deletions src/bun.zig
Original file line number Diff line number Diff line change
@@ -3133,7 +3133,7 @@ pub fn New(comptime T: type) type {
/// Reference-counted heap-allocated instance value.
///
/// `ref_count` is expected to be defined on `T` with a default value set to `1`
pub fn NewRefCounted(comptime T: type, comptime deinit_fn: ?fn (self: *T) void) type {
pub fn NewRefCounted(comptime T: type, comptime deinit_fn: ?fn (self: *T) void, debug_name: ?[:0]const u8) type {
if (!@hasField(T, "ref_count")) {
@compileError("Expected a field named \"ref_count\" with a default value of 1 on " ++ @typeName(T));
}
@@ -3146,9 +3146,8 @@ pub fn NewRefCounted(comptime T: type, comptime deinit_fn: ?fn (self: *T) void)
}
}

// const output_name: []const u8 = if (@hasDecl(T, "DEBUG_REFCOUNT_NAME")) T.DEBUG_REFCOUNT_NAME else meta.typeBaseName(@typeName(T));
// const log = Output.scoped(output_name, true);
const log = Output.scoped("TODO:", true);
const output_name = debug_name orelse meta.typeBaseName(@typeName(T));
const log = Output.scoped(output_name, true);

return struct {
pub fn destroy(self: *T) void {
@@ -3193,7 +3192,7 @@ pub fn NewRefCounted(comptime T: type, comptime deinit_fn: ?fn (self: *T) void)
};
}

pub fn NewThreadSafeRefCounted(comptime T: type, comptime deinit_fn: ?fn (self: *T) void) type {
pub fn NewThreadSafeRefCounted(comptime T: type, comptime deinit_fn: ?fn (self: *T) void, debug_name: ?[:0]const u8) type {
if (!@hasField(T, "ref_count")) {
@compileError("Expected a field named \"ref_count\" with a default value of 1 on " ++ @typeName(T));
}
@@ -3206,9 +3205,8 @@ pub fn NewThreadSafeRefCounted(comptime T: type, comptime deinit_fn: ?fn (self:
}
}

// const output_name: []const u8 = if (@hasDecl(T, "DEBUG_REFCOUNT_NAME")) T.DEBUG_REFCOUNT_NAME else meta.typeBaseName(@typeName(T));
// const log = Output.scoped(output_name, true);
const log = Output.scoped("TODO:", true);
const output_name = debug_name orelse meta.typeBaseName(@typeName(T));
const log = Output.scoped(output_name, true);

return struct {
pub fn destroy(self: *T) void {
2 changes: 1 addition & 1 deletion src/bundler/bundle_v2.zig
Original file line number Diff line number Diff line change
@@ -1719,7 +1719,7 @@ pub const BundleV2 = struct {
ref_count: std.atomic.Value(u32) = std.atomic.Value(u32).init(1),
started_at_ns: u64 = 0,

pub usingnamespace bun.NewThreadSafeRefCounted(JSBundleCompletionTask, _deinit);
pub usingnamespace bun.NewThreadSafeRefCounted(JSBundleCompletionTask, _deinit, null);

pub fn configureBundler(
completion: *JSBundleCompletionTask,
2 changes: 1 addition & 1 deletion src/http.zig
Original file line number Diff line number Diff line change
@@ -235,7 +235,7 @@ const ProxyTunnel = struct {

const ProxyTunnelWrapper = SSLWrapper(*HTTPClient);

usingnamespace bun.NewRefCounted(ProxyTunnel, _deinit);
usingnamespace bun.NewRefCounted(ProxyTunnel, _deinit, null);

fn onOpen(this: *HTTPClient) void {
this.state.response_stage = .proxy_handshake;
4 changes: 2 additions & 2 deletions src/http/websocket_http_client.zig
Original file line number Diff line number Diff line change
@@ -226,7 +226,7 @@ pub fn NewHTTPUpgradeClient(comptime ssl: bool) type {
pub const name = if (ssl) "WebSocketHTTPSClient" else "WebSocketHTTPClient";

pub const shim = JSC.Shimmer("Bun", name, @This());
pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);

const HTTPClient = @This();
pub fn register(_: *JSC.JSGlobalObject, _: *anyopaque, ctx: *uws.SocketContext) callconv(.C) void {
@@ -1034,7 +1034,7 @@ pub fn NewWebSocketClient(comptime ssl: bool) type {

const WebSocket = @This();

pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);
pub fn register(global: *JSC.JSGlobalObject, loop_: *anyopaque, ctx_: *anyopaque) callconv(.C) void {
const vm = global.bunVM();
const loop = @as(*uws.Loop, @ptrCast(@alignCast(loop_)));
2 changes: 1 addition & 1 deletion src/s3/client.zig
Original file line number Diff line number Diff line change
@@ -202,7 +202,7 @@ const S3UploadStreamWrapper = struct {
callback_context: *anyopaque,
ref_count: u32 = 1,
path: []const u8, // this is owned by the task not by the wrapper
pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);
pub fn resolve(result: S3UploadResult, self: *@This()) void {
const sink = self.sink;
defer self.deref();
2 changes: 1 addition & 1 deletion src/s3/credentials.zig
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ pub const S3Credentials = struct {
insecure_http: bool = false,

ref_count: u32 = 1,
pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);

pub fn estimatedSize(this: *const @This()) usize {
return @sizeOf(S3Credentials) + this.accessKeyId.len + this.region.len + this.secretAccessKey.len + this.endpoint.len + this.bucket.len;
2 changes: 1 addition & 1 deletion src/s3/multipart.zig
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ pub const MultiPartUpload = struct {
callback: *const fn (S3SimpleRequest.S3UploadResult, *anyopaque) void,
callback_context: *anyopaque,

pub usingnamespace bun.NewRefCounted(@This(), deinit);
pub usingnamespace bun.NewRefCounted(@This(), deinit, null);

const log = bun.Output.scoped(.S3MultiPartUpload, true);

9 changes: 3 additions & 6 deletions src/shell/interpreter.zig
Original file line number Diff line number Diff line change
@@ -5338,7 +5338,7 @@ pub const Interpreter = struct {
const Blob = struct {
ref_count: usize = 1,
blob: bun.JSC.WebCore.Blob,
pub usingnamespace bun.NewRefCounted(Blob, _deinit);
pub usingnamespace bun.NewRefCounted(Blob, _deinit, null);

fn _deinit(this: *Blob) void {
this.blob.deinit();
@@ -11136,8 +11136,7 @@ pub const Interpreter = struct {
pub const ChildPtr = IOReaderChildPtr;
pub const ReaderImpl = bun.io.BufferedReader;

pub const DEBUG_REFCOUNT_NAME: []const u8 = "IOReaderRefCount";
pub usingnamespace bun.NewRefCounted(@This(), asyncDeinit);
pub usingnamespace bun.NewRefCounted(@This(), asyncDeinit, "IOReaderRefCount");

const InitFlags = packed struct(u8) {
pollable: bool = false,
@@ -11403,8 +11402,6 @@ pub const Interpreter = struct {
started: bool = false,
flags: InitFlags = .{},

pub const DEBUG_REFCOUNT_NAME: []const u8 = "IOWriterRefCount";

const debug = bun.Output.scoped(.IOWriter, true);

const ChildPtr = IOWriterChildPtr;
@@ -11416,7 +11413,7 @@ pub const Interpreter = struct {

pub const auto_poll = false;

pub usingnamespace bun.NewRefCounted(@This(), asyncDeinit);
pub usingnamespace bun.NewRefCounted(@This(), asyncDeinit, "IOWriterRefCount");
const This = @This();
pub const WriterImpl = bun.io.BufferedWriter(
This,
2 changes: 1 addition & 1 deletion src/shell/subproc.zig
Original file line number Diff line number Diff line change
@@ -1020,7 +1020,7 @@ pub const PipeReader = struct {
}
};

pub usingnamespace bun.NewRefCounted(PipeReader, deinit);
pub usingnamespace bun.NewRefCounted(PipeReader, deinit, null);

pub const CapturedWriter = struct {
dead: bool = true,
2 changes: 1 addition & 1 deletion src/sourcemap/sourcemap.zig
Original file line number Diff line number Diff line change
@@ -640,7 +640,7 @@ pub const ParsedSourceMap = struct {

is_standalone_module_graph: bool = false,

pub usingnamespace bun.NewThreadSafeRefCounted(ParsedSourceMap, deinitFn);
pub usingnamespace bun.NewThreadSafeRefCounted(ParsedSourceMap, deinitFn, null);

const SourceContentPtr = packed struct(u64) {
load_hint: SourceMapLoadHint = .none,