]> Cypherpunks repositories - gostls13.git/commit
runtime: add mSpanList type to represent lists of mspans
authorMatthew Dempsky <mdempsky@google.com>
Thu, 15 Oct 2015 22:59:49 +0000 (15:59 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 22 Oct 2015 17:12:06 +0000 (17:12 +0000)
commit1652a2c316ff81a8b3c0363db92aaecdf2273540
tree33dbb0b171d90d4c542af9d87bc70db3646e474c
parent151f4ec95d26ed702160f61760cc80aa29b6fd3b
runtime: add mSpanList type to represent lists of mspans

This CL introduces a new mSpanList type to replace the empty mspan
variables that were previously used as list heads.

To be type safe, the previous circular linked list data structure is
now a tail queue instead.  One complication of this is
mSpanList_Remove needs to know the list a span is being removed from,
but this appears to be computable in all circumstances.

As a temporary sanity check, mSpanList_Insert and mSpanList_InsertBack
record the list that an mspan has been inserted into so that
mSpanList_Remove can verify that the correct list was specified.

Whereas mspan is 112 bytes on amd64, mSpanList is only 16 bytes.  This
shrinks the size of mheap from 50216 bytes to 12584 bytes.

Change-Id: I8146364753dbc3b4ab120afbb9c7b8740653c216
Reviewed-on: https://go-review.googlesource.com/15906
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/mcentral.go
src/runtime/mheap.go
src/runtime/stack.go