]> Cypherpunks repositories - gostls13.git/commit
runtime: drop chan circular linked list in favor of circular buffer
authorRuss Cox <rsc@golang.org>
Thu, 14 Apr 2011 03:42:06 +0000 (23:42 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 14 Apr 2011 03:42:06 +0000 (23:42 -0400)
commit507df959e48835cc58f89cdf23fcbead54d03563
tree37cff4db1baffad01f392f5d5c3c8a6294fd112f
parent4c006182dcb2c7fef7d05c121a5e9b3c0291cf82
runtime: drop chan circular linked list in favor of circular buffer

The list elements are already being allocated out of a
single memory buffer.  We can drop the Link* pointer
following and the memory it requires, replacing it with
index operations.

The change also keeps a channel from containing a pointer
back into its own allocation block, which would create a
cycle.  Blocks involved in cycles are not guaranteed to be
finalized properly, and channels depend on finalizers to
free OS-level locks on some systems.  The self-reference
was keeping channels from being garbage collected.

runtime-gdb.py will need to be updated in order to dump
the content of buffered channels with the new data structure.

Fixes #1676.

R=ken2, r
CC=golang-dev
https://golang.org/cl/4411045
src/cmd/ld/dwarf.c
src/pkg/runtime/chan.c
test/gc2.go [new file with mode: 0644]