| ... | @@ -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.TailQueue([]u8), | 350 | buffer_list: std.SinglyLinkedList([]u8), |
| 351 | end_index: usize, | 351 | end_index: usize, |
| 352 | | 352 | |
| 353 | const BufNode = std.TailQueue([]u8).Node; | 353 | const BufNode = std.SinglyLinkedList([]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.TailQueue([]u8).init(), | 362 | .buffer_list = std.SinglyLinkedList([]u8).init(), |
| 363 | .end_index = 0, | 363 | .end_index = 0, |
| 364 | }; | 364 | }; |
| 365 | } | 365 | } |
| ... | @@ -387,10 +387,9 @@ pub const ArenaAllocator = struct { | ... | @@ -387,10 +387,9 @@ pub const ArenaAllocator = struct { |
| 387 | const buf_node = &buf_node_slice[0]; | 387 | const buf_node = &buf_node_slice[0]; |
| 388 | buf_node.* = BufNode{ | 388 | buf_node.* = BufNode{ |
| 389 | .data = buf, | 389 | .data = buf, |
| 390 | .prev = null, | | |
| 391 | .next = null, | 390 | .next = null, |
| 392 | }; | 391 | }; |
| 393 | self.buffer_list.append(buf_node); | 392 | self.buffer_list.prepend(buf_node); |
| 394 | self.end_index = 0; | 393 | self.end_index = 0; |
| 395 | return buf_node; | 394 | return buf_node; |
| 396 | } | 395 | } |
| ... | @@ -398,7 +397,7 @@ pub const ArenaAllocator = struct { | ... | @@ -398,7 +397,7 @@ pub const ArenaAllocator = struct { |
| 398 | fn alloc(allocator: *Allocator, n: usize, alignment: u29) ![]u8 { | 397 | fn alloc(allocator: *Allocator, n: usize, alignment: u29) ![]u8 { |
| 399 | const self = @fieldParentPtr(ArenaAllocator, "allocator", allocator); | 398 | const self = @fieldParentPtr(ArenaAllocator, "allocator", allocator); |
| 400 | | 399 | |
| 401 | var cur_node = if (self.buffer_list.last) |last_node| last_node else try self.createNode(0, n + alignment); | 400 | var cur_node = if (self.buffer_list.first) |first_node| first_node else try self.createNode(0, n + alignment); |
| 402 | while (true) { | 401 | while (true) { |
| 403 | const cur_buf = cur_node.data[@sizeOf(BufNode)..]; | 402 | const cur_buf = cur_node.data[@sizeOf(BufNode)..]; |
| 404 | const addr = @ptrToInt(cur_buf.ptr) + self.end_index; | 403 | const addr = @ptrToInt(cur_buf.ptr) + self.end_index; |