]> Cypherpunks repositories - gostls13.git/commit
runtime: split spans during allocation without treap removal
authorMichael Anthony Knyszek <mknyszek@google.com>
Thu, 2 May 2019 07:05:21 +0000 (07:05 +0000)
committerMichael Knyszek <mknyszek@google.com>
Mon, 6 May 2019 21:14:52 +0000 (21:14 +0000)
commit5c15ed64deaf71dd3b84470f3de8aae0b667d6ef
tree47425a38d4db0aa16502bc3dc6dbff90684075ed
parentf4a5ae5594a21ea276d473fe9f804a30adbd8d07
runtime: split spans during allocation without treap removal

Now that the treap is first-fit, we can make a nice optimization.
Mainly, since we know that span splitting doesn't modify the relative
position of a span in a treap, we can actually modify a span in-place
on the treap. The only caveat is that we need to update the relevant
metadata.

To enable this optimization, this change introduces a mutate method on
the iterator which takes a callback that is passed the iterator's span.
The method records some properties of the span before it calls into the
callback and then uses those records to see what changed and update
treap metadata appropriately.

Change-Id: I74f7d2ee172800828434ba0194d3d78d3942acf2
Reviewed-on: https://go-review.googlesource.com/c/go/+/174879
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/mgclarge.go
src/runtime/mheap.go