| ... | ... | @@ -347,10 +347,10 @@ pub const ArenaAllocator = struct { |
| 347 | 347 | pub allocator: Allocator, |
| 348 | 348 | |
| 349 | 349 | child_allocator: *Allocator, |
| 350 | | buffer_list: std.TailQueue([]u8), |
| 350 | buffer_list: std.SinglyLinkedList([]u8), |
| 351 | 351 | end_index: usize, |
| 352 | 352 | |
| 353 | | const BufNode = std.TailQueue([]u8).Node; |
| 353 | const BufNode = std.SinglyLinkedList([]u8).Node; |
| 354 | 354 | |
| 355 | 355 | pub fn init(child_allocator: *Allocator) ArenaAllocator { |
| 356 | 356 | return ArenaAllocator{ |
| ... | ... | @@ -359,7 +359,7 @@ pub const ArenaAllocator = struct { |
| 359 | 359 | .shrinkFn = shrink, |
| 360 | 360 | }, |
| 361 | 361 | .child_allocator = child_allocator, |
| 362 | | .buffer_list = std.TailQueue([]u8).init(), |
| 362 | .buffer_list = std.SinglyLinkedList([]u8).init(), |
| 363 | 363 | .end_index = 0, |
| 364 | 364 | }; |
| 365 | 365 | } |
| ... | ... | @@ -387,10 +387,9 @@ pub const ArenaAllocator = struct { |
| 387 | 387 | const buf_node = &buf_node_slice[0]; |
| 388 | 388 | buf_node.* = BufNode{ |
| 389 | 389 | .data = buf, |
| 390 | | .prev = null, |
| 391 | 390 | .next = null, |
| 392 | 391 | }; |
| 393 | | self.buffer_list.append(buf_node); |
| 392 | self.buffer_list.prepend(buf_node); |
| 394 | 393 | self.end_index = 0; |
| 395 | 394 | return buf_node; |
| 396 | 395 | } |
| ... | ... | @@ -398,7 +397,7 @@ pub const ArenaAllocator = struct { |
| 398 | 397 | fn alloc(allocator: *Allocator, n: usize, alignment: u29) ![]u8 { |
| 399 | 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 | 401 | while (true) { |
| 403 | 402 | const cur_buf = cur_node.data[@sizeOf(BufNode)..]; |
| 404 | 403 | const addr = @ptrToInt(cur_buf.ptr) + self.end_index; |