| ... | @@ -188,7 +188,8 @@ pub const Node = struct { | ... | @@ -188,7 +188,8 @@ pub const Node = struct { |
| 188 | var opt_free_index = @atomicLoad(Node.OptionalIndex, freelist_head, .seq_cst); | 188 | var opt_free_index = @atomicLoad(Node.OptionalIndex, freelist_head, .seq_cst); |
| 189 | while (opt_free_index.unwrap()) |free_index| { | 189 | while (opt_free_index.unwrap()) |free_index| { |
| 190 | const freelist_ptr = freelistByIndex(free_index); | 190 | const freelist_ptr = freelistByIndex(free_index); |
| 191 | opt_free_index = @cmpxchgWeak(Node.OptionalIndex, freelist_head, opt_free_index, freelist_ptr.*, .seq_cst, .seq_cst) orelse { | 191 | const next = @atomicLoad(Node.OptionalIndex, freelist_ptr, .seq_cst); |
| | 192 | opt_free_index = @cmpxchgWeak(Node.OptionalIndex, freelist_head, opt_free_index, next, .seq_cst, .seq_cst) orelse { |
| 192 | // We won the allocation race. | 193 | // We won the allocation race. |
| 193 | return init(free_index, parent, name, estimated_total_items); | 194 | return init(free_index, parent, name, estimated_total_items); |
| 194 | }; | 195 | }; |
| ... | @@ -249,7 +250,7 @@ pub const Node = struct { | ... | @@ -249,7 +250,7 @@ pub const Node = struct { |
| 249 | const freelist_head = &global_progress.node_freelist_first; | 250 | const freelist_head = &global_progress.node_freelist_first; |
| 250 | var first = @atomicLoad(Node.OptionalIndex, freelist_head, .seq_cst); | 251 | var first = @atomicLoad(Node.OptionalIndex, freelist_head, .seq_cst); |
| 251 | while (true) { | 252 | while (true) { |
| 252 | freelistByIndex(index).* = first; | 253 | @atomicStore(Node.OptionalIndex, freelistByIndex(index), first, .seq_cst); |
| 253 | first = @cmpxchgWeak(Node.OptionalIndex, freelist_head, first, index.toOptional(), .seq_cst, .seq_cst) orelse break; | 254 | first = @cmpxchgWeak(Node.OptionalIndex, freelist_head, first, index.toOptional(), .seq_cst, .seq_cst) orelse break; |
| 254 | } | 255 | } |
| 255 | } else { | 256 | } else { |