From ac9218f5f06dabec3ef7682619dd98fe587d6c08 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Tue, 30 Sep 2014 08:51:02 -0700 Subject: [PATCH] runtime: fix scanning of gc work buffer GC types were not being generated for the garbage collector work buffer. The markfor object was being collected as a result. This broke amd64p32 and maybe plan9 builds. Why it didn't break every build I'm not sure... Fixes #8812 LGTM=0intro, rsc R=golang-codereviews, dave, khr, 0intro, rsc CC=golang-codereviews https://golang.org/cl/149260043 --- src/runtime/mgc0.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/runtime/mgc0.c b/src/runtime/mgc0.c index c92fa1db73..9b9bc0ef13 100644 --- a/src/runtime/mgc0.c +++ b/src/runtime/mgc0.c @@ -140,7 +140,8 @@ static BitVector unrollglobgcprog(byte *prog, uintptr size); void runtime·bgsweep(void); static FuncVal bgsweepv = {runtime·bgsweep}; -struct { +typedef struct WorkData WorkData; +struct WorkData { uint64 full; // lock-free list of full blocks uint64 empty; // lock-free list of empty blocks byte pad0[CacheLineSize]; // prevents false-sharing between full/empty and nproc/nwait @@ -154,7 +155,8 @@ struct { // Copy of mheap.allspans for marker or sweeper. MSpan** spans; uint32 nspan; -} runtime·work; +}; +WorkData runtime·work; // scanblock scans a block of n bytes starting at pointer b for references // to other objects, scanning any it finds recursively until there are no @@ -1038,7 +1040,8 @@ runtime·MSpan_Sweep(MSpan *s, bool preserve) // State of background runtime·sweep. // Protected by runtime·gclock. -struct +typedef struct SweepData SweepData; +struct SweepData { G* g; bool parked; @@ -1047,7 +1050,8 @@ struct uint32 nbgsweep; uint32 npausesweep; -} runtime·sweep; +}; +SweepData runtime·sweep; // sweeps one span // returns number of pages returned to heap, or -1 if there is nothing to sweep -- 2.48.1