From 01ab9a012a7a34040ed9b69ec87b5b3301e0f50b Mon Sep 17 00:00:00 2001 From: Jan Ziak <0xe2.0x9a.0x9b@gmail.com> Date: Wed, 27 Feb 2013 08:28:53 -0800 Subject: [PATCH] runtime: improve precision of GC_REGION R=rsc CC=golang-dev https://golang.org/cl/7383054 --- src/pkg/runtime/mgc0.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c index e9d5d301b8..38ba84df40 100644 --- a/src/pkg/runtime/mgc0.c +++ b/src/pkg/runtime/mgc0.c @@ -546,7 +546,7 @@ static void scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking) { byte *b, *arena_start, *arena_used; - uintptr n, i, end_b, elemsize, ti, objti, count, type; + uintptr n, i, end_b, elemsize, size, ti, objti, count, type; uintptr *pc, precise_type, nominal_size; uintptr *map_ret, mapkey_size, mapval_size, mapkey_ti, mapval_ti; void *obj; @@ -905,9 +905,14 @@ scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking) continue; case GC_REGION: - // TODO(atom): to be expanded in a next CL. Same as GC_APTR for now. obj = (void*)(stack_top.b + pc[1]); + size = pc[2]; + objti = pc[3]; pc += 4; + + *objbufpos++ = (Obj){obj, size, objti}; + if(objbufpos == objbuf_end) + flushobjbuf(objbuf, &objbufpos, &wp, &wbuf, &nobj); break; case GC_CHAN: