| author | |
| committer | |
| log | ed41d10a068065ea80f93736926d9c3240d62c49 |
| tree | 696f68dbd2e45a48f86680394ed21b85c879578a |
| parent | b7811d32690a9f3b4912635e16e6aa5ace25362c |
| signature | Commit is signed but in an unrecognized format. |
8 files changed, 23 insertions(+), 18 deletions(-)
src-self-hosted/compilation.zig+1-1| ... | @@ -160,7 +160,7 @@ pub const Compilation = struct { | ... | @@ -160,7 +160,7 @@ pub const Compilation = struct { |
| 160 | /// it uses an optional pointer so that tombstone removals are possible | 160 | /// it uses an optional pointer so that tombstone removals are possible |
| 161 | fn_link_set: event.Locked(FnLinkSet), | 161 | fn_link_set: event.Locked(FnLinkSet), |
| 162 | 162 | ||
| 163 | pub const FnLinkSet = std.LinkedList(?*Value.Fn); | 163 | pub const FnLinkSet = std.TailQueue(?*Value.Fn); |
| 164 | 164 | ||
| 165 | windows_subsystem_windows: bool, | 165 | windows_subsystem_windows: bool, |
| 166 | windows_subsystem_console: bool, | 166 | windows_subsystem_console: bool, |
src-self-hosted/value.zig+1-1| ... | @@ -186,7 +186,7 @@ pub const Value = struct { | ... | @@ -186,7 +186,7 @@ pub const Value = struct { |
| 186 | /// Path to the object file that contains this function | 186 | /// Path to the object file that contains this function |
| 187 | containing_object: Buffer, | 187 | containing_object: Buffer, |
| 188 | 188 | ||
| 189 | link_set_node: *std.LinkedList(?*Value.Fn).Node, | 189 | link_set_node: *std.TailQueue(?*Value.Fn).Node, |
| 190 | 190 | ||
| 191 | /// Creates a Fn value with 1 ref | 191 | /// Creates a Fn value with 1 ref |
| 192 | /// Takes ownership of symbol_name | 192 | /// Takes ownership of symbol_name |
std/atomic/queue.zig+1-1| ... | @@ -14,7 +14,7 @@ pub fn Queue(comptime T: type) type { | ... | @@ -14,7 +14,7 @@ pub fn Queue(comptime T: type) type { |
| 14 | mutex: std.Mutex, | 14 | mutex: std.Mutex, |
| 15 | 15 | ||
| 16 | pub const Self = @This(); | 16 | pub const Self = @This(); |
| 17 | pub const Node = std.LinkedList(T).Node; | 17 | pub const Node = std.TailQueue(T).Node; |
| 18 | 18 | ||
| 19 | pub fn init() Self { | 19 | pub fn init() Self { |
| 20 | return Self{ | 20 | return Self{ |
std/child_process.zig+3-3| ... | @@ -13,7 +13,7 @@ const BufMap = std.BufMap; | ... | @@ -13,7 +13,7 @@ const BufMap = std.BufMap; |
| 13 | const Buffer = std.Buffer; | 13 | const Buffer = std.Buffer; |
| 14 | const builtin = @import("builtin"); | 14 | const builtin = @import("builtin"); |
| 15 | const Os = builtin.Os; | 15 | const Os = builtin.Os; |
| 16 | const LinkedList = std.LinkedList; | 16 | const TailQueue = std.TailQueue; |
| 17 | const maxInt = std.math.maxInt; | 17 | const maxInt = std.math.maxInt; |
| 18 | 18 | ||
| 19 | pub const ChildProcess = struct { | 19 | pub const ChildProcess = struct { |
| ... | @@ -48,7 +48,7 @@ pub const ChildProcess = struct { | ... | @@ -48,7 +48,7 @@ pub const ChildProcess = struct { |
| 48 | pub cwd: ?[]const u8, | 48 | pub cwd: ?[]const u8, |
| 49 | 49 | ||
| 50 | err_pipe: if (os.windows.is_the_target) void else [2]os.fd_t, | 50 | err_pipe: if (os.windows.is_the_target) void else [2]os.fd_t, |
| 51 | llnode: if (os.windows.is_the_target) void else LinkedList(*ChildProcess).Node, | 51 | llnode: if (os.windows.is_the_target) void else TailQueue(*ChildProcess).Node, |
| 52 | 52 | ||
| 53 | pub const SpawnError = error{OutOfMemory} || os.ExecveError || os.SetIdError || | 53 | pub const SpawnError = error{OutOfMemory} || os.ExecveError || os.SetIdError || |
| 54 | os.ChangeCurDirError || windows.CreateProcessError; | 54 | os.ChangeCurDirError || windows.CreateProcessError; |
| ... | @@ -388,7 +388,7 @@ pub const ChildProcess = struct { | ... | @@ -388,7 +388,7 @@ pub const ChildProcess = struct { |
| 388 | 388 | ||
| 389 | self.pid = pid; | 389 | self.pid = pid; |
| 390 | self.err_pipe = err_pipe; | 390 | self.err_pipe = err_pipe; |
| 391 | self.llnode = LinkedList(*ChildProcess).Node.init(self); | 391 | self.llnode = TailQueue(*ChildProcess).Node.init(self); |
| 392 | self.term = null; | 392 | self.term = null; |
| 393 | 393 | ||
| 394 | if (self.stdin_behavior == StdIo.Pipe) { | 394 | if (self.stdin_behavior == StdIo.Pipe) { |
std/event/net.zig+1-1| ... | @@ -19,7 +19,7 @@ pub const Server = struct { | ... | @@ -19,7 +19,7 @@ pub const Server = struct { |
| 19 | waiting_for_emfile_node: PromiseNode, | 19 | waiting_for_emfile_node: PromiseNode, |
| 20 | listen_resume_node: event.Loop.ResumeNode, | 20 | listen_resume_node: event.Loop.ResumeNode, |
| 21 | 21 | ||
| 22 | const PromiseNode = std.LinkedList(promise).Node; | 22 | const PromiseNode = std.TailQueue(promise).Node; |
| 23 | 23 | ||
| 24 | pub fn init(loop: *Loop) Server { | 24 | pub fn init(loop: *Loop) Server { |
| 25 | // TODO can't initialize handler coroutine here because we need well defined copy elision | 25 | // TODO can't initialize handler coroutine here because we need well defined copy elision |
std/heap.zig+3-3| ... | @@ -347,10 +347,10 @@ pub const ArenaAllocator = struct { | ... | @@ -347,10 +347,10 @@ pub const ArenaAllocator = struct { |
| 347 | pub allocator: Allocator, | 347 | pub allocator: Allocator, |
| 348 | 348 | ||
| 349 | child_allocator: *Allocator, | 349 | child_allocator: *Allocator, |
| 350 | buffer_list: std.LinkedList([]u8), | 350 | buffer_list: std.TailQueue([]u8), |
| 351 | end_index: usize, | 351 | end_index: usize, |
| 352 | 352 | ||
| 353 | const BufNode = std.LinkedList([]u8).Node; | 353 | const BufNode = std.TailQueue([]u8).Node; |
| 354 | 354 | ||
| 355 | pub fn init(child_allocator: *Allocator) ArenaAllocator { | 355 | pub fn init(child_allocator: *Allocator) ArenaAllocator { |
| 356 | return ArenaAllocator{ | 356 | return ArenaAllocator{ |
| ... | @@ -359,7 +359,7 @@ pub const ArenaAllocator = struct { | ... | @@ -359,7 +359,7 @@ pub const ArenaAllocator = struct { |
| 359 | .shrinkFn = shrink, | 359 | .shrinkFn = shrink, |
| 360 | }, | 360 | }, |
| 361 | .child_allocator = child_allocator, | 361 | .child_allocator = child_allocator, |
| 362 | .buffer_list = std.LinkedList([]u8).init(), | 362 | .buffer_list = std.TailQueue([]u8).init(), |
| 363 | .end_index = 0, | 363 | .end_index = 0, |
| 364 | }; | 364 | }; |
| 365 | } | 365 | } |
std/linked_list.zig+12-7| ... | @@ -5,8 +5,13 @@ const testing = std.testing; | ... | @@ -5,8 +5,13 @@ const testing = std.testing; |
| 5 | const mem = std.mem; | 5 | const mem = std.mem; |
| 6 | const Allocator = mem.Allocator; | 6 | const Allocator = mem.Allocator; |
| 7 | 7 | ||
| 8 | /// Generic doubly linked list. | 8 | /// A tail queue is headed by a pair of pointers, one to the head of the |
| 9 | pub fn LinkedList(comptime T: type) type { | 9 | /// list and the other to the tail of the list. The elements are doubly |
| 10 | /// linked so that an arbitrary element can be removed without a need to | ||
| 11 | /// traverse the list. New elements can be added to the list before or | ||
| 12 | /// after an existing element, at the head of the list, or at the end of | ||
| 13 | /// the list. A tail queue may be traversed in either direction. | ||
| 14 | pub fn TailQueue(comptime T: type) type { | ||
| 10 | return struct { | 15 | return struct { |
| 11 | const Self = @This(); | 16 | const Self = @This(); |
| 12 | 17 | ||
| ... | @@ -219,9 +224,9 @@ pub fn LinkedList(comptime T: type) type { | ... | @@ -219,9 +224,9 @@ pub fn LinkedList(comptime T: type) type { |
| 219 | }; | 224 | }; |
| 220 | } | 225 | } |
| 221 | 226 | ||
| 222 | test "basic linked list test" { | 227 | test "basic TailQueue test" { |
| 223 | const allocator = debug.global_allocator; | 228 | const allocator = debug.global_allocator; |
| 224 | var list = LinkedList(u32).init(); | 229 | var list = TailQueue(u32).init(); |
| 225 | 230 | ||
| 226 | var one = try list.createNode(1, allocator); | 231 | var one = try list.createNode(1, allocator); |
| 227 | var two = try list.createNode(2, allocator); | 232 | var two = try list.createNode(2, allocator); |
| ... | @@ -271,10 +276,10 @@ test "basic linked list test" { | ... | @@ -271,10 +276,10 @@ test "basic linked list test" { |
| 271 | testing.expect(list.len == 2); | 276 | testing.expect(list.len == 2); |
| 272 | } | 277 | } |
| 273 | 278 | ||
| 274 | test "linked list concatenation" { | 279 | test "TailQueue concatenation" { |
| 275 | const allocator = debug.global_allocator; | 280 | const allocator = debug.global_allocator; |
| 276 | var list1 = LinkedList(u32).init(); | 281 | var list1 = TailQueue(u32).init(); |
| 277 | var list2 = LinkedList(u32).init(); | 282 | var list2 = TailQueue(u32).init(); |
| 278 | 283 | ||
| 279 | var one = try list1.createNode(1, allocator); | 284 | var one = try list1.createNode(1, allocator); |
| 280 | defer list1.destroyNode(one, allocator); | 285 | defer list1.destroyNode(one, allocator); |
std/std.zig+1-1| ... | @@ -7,7 +7,6 @@ pub const Buffer = @import("buffer.zig").Buffer; | ... | @@ -7,7 +7,6 @@ pub const Buffer = @import("buffer.zig").Buffer; |
| 7 | pub const BufferOutStream = @import("io.zig").BufferOutStream; | 7 | pub const BufferOutStream = @import("io.zig").BufferOutStream; |
| 8 | pub const DynLib = @import("dynamic_library.zig").DynLib; | 8 | pub const DynLib = @import("dynamic_library.zig").DynLib; |
| 9 | pub const HashMap = @import("hash_map.zig").HashMap; | 9 | pub const HashMap = @import("hash_map.zig").HashMap; |
| 10 | pub const LinkedList = @import("linked_list.zig").LinkedList; | ||
| 11 | pub const Mutex = @import("mutex.zig").Mutex; | 10 | pub const Mutex = @import("mutex.zig").Mutex; |
| 12 | pub const PackedIntArrayEndian = @import("packed_int_array.zig").PackedIntArrayEndian; | 11 | pub const PackedIntArrayEndian = @import("packed_int_array.zig").PackedIntArrayEndian; |
| 13 | pub const PackedIntArray = @import("packed_int_array.zig").PackedIntArray; | 12 | pub const PackedIntArray = @import("packed_int_array.zig").PackedIntArray; |
| ... | @@ -18,6 +17,7 @@ pub const StaticallyInitializedMutex = @import("statically_initialized_mutex.zig | ... | @@ -18,6 +17,7 @@ pub const StaticallyInitializedMutex = @import("statically_initialized_mutex.zig |
| 18 | pub const SegmentedList = @import("segmented_list.zig").SegmentedList; | 17 | pub const SegmentedList = @import("segmented_list.zig").SegmentedList; |
| 19 | pub const SpinLock = @import("spinlock.zig").SpinLock; | 18 | pub const SpinLock = @import("spinlock.zig").SpinLock; |
| 20 | pub const ChildProcess = @import("child_process.zig").ChildProcess; | 19 | pub const ChildProcess = @import("child_process.zig").ChildProcess; |
| 20 | pub const TailQueue = @import("linked_list.zig").TailQueue; | ||
| 21 | pub const Thread = @import("thread.zig").Thread; | 21 | pub const Thread = @import("thread.zig").Thread; |
| 22 | 22 | ||
| 23 | pub const atomic = @import("atomic.zig"); | 23 | pub const atomic = @import("atomic.zig"); |