diff options
| author | Russ Cox <rsc@golang.org> | 2011-04-13 23:42:06 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2011-04-13 23:42:06 -0400 |
| commit | 507df959e48835cc58f89cdf23fcbead54d03563 (patch) | |
| tree | 37cff4db1baffad01f392f5d5c3c8a6294fd112f /src/cmd/ld | |
| parent | 4c006182dcb2c7fef7d05c121a5e9b3c0291cf82 (diff) | |
| download | go-507df959e48835cc58f89cdf23fcbead54d03563.tar.xz | |
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
Diffstat (limited to 'src/cmd/ld')
| -rw-r--r-- | src/cmd/ld/dwarf.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/cmd/ld/dwarf.c b/src/cmd/ld/dwarf.c index d0b6407796..fa55fcbb4a 100644 --- a/src/cmd/ld/dwarf.c +++ b/src/cmd/ld/dwarf.c @@ -1377,7 +1377,7 @@ static void synthesizechantypes(DWDie *die) { DWDie *sudog, *waitq, *link, *hchan, - *dws, *dww, *dwl, *dwh, *elemtype; + *dws, *dww, *dwh, *elemtype; DWAttr *a; int elemsize, linksize, sudogsize; @@ -1416,21 +1416,10 @@ synthesizechantypes(DWDie *die) newattr(dww, DW_AT_byte_size, DW_CLS_CONSTANT, getattr(waitq, DW_AT_byte_size)->value, NULL); - // link<T> - dwl = newdie(&dwtypes, DW_ABRV_STRUCTTYPE, - mkinternaltypename("link", getattr(elemtype, DW_AT_name)->data, NULL)); - copychildren(dwl, link); - substitutetype(dwl, "link", defptrto(dwl)); - substitutetype(dwl, "elem", elemtype); - newattr(dwl, DW_AT_byte_size, DW_CLS_CONSTANT, - linksize + (elemsize > 8 ? elemsize - 8 : 0), NULL); - // hchan<T> dwh = newdie(&dwtypes, DW_ABRV_STRUCTTYPE, mkinternaltypename("hchan", getattr(elemtype, DW_AT_name)->data, NULL)); copychildren(dwh, hchan); - substitutetype(dwh, "senddataq", defptrto(dwl)); - substitutetype(dwh, "recvdataq", defptrto(dwl)); substitutetype(dwh, "recvq", dww); substitutetype(dwh, "sendq", dww); substitutetype(dwh, "free", dws); |
