mirror of
https://github.com/golang/go
synced 2024-11-25 08:27:57 -07:00
fix gc bug. i think this is tgs's second bug.
i stumbled across it in all.bash. TBR=r OCL=24912 CL=24912
This commit is contained in:
parent
38c232fe37
commit
7cd24361bd
@ -122,7 +122,7 @@ int32
|
|||||||
mlookup(void *v, byte **base, uintptr *size, uint32 **ref)
|
mlookup(void *v, byte **base, uintptr *size, uint32 **ref)
|
||||||
{
|
{
|
||||||
uintptr n, nobj, i;
|
uintptr n, nobj, i;
|
||||||
byte *p, *ep;
|
byte *p;
|
||||||
MSpan *s;
|
MSpan *s;
|
||||||
|
|
||||||
s = MHeap_LookupMaybe(&mheap, (uintptr)v>>PageShift);
|
s = MHeap_LookupMaybe(&mheap, (uintptr)v>>PageShift);
|
||||||
@ -162,8 +162,11 @@ mlookup(void *v, byte **base, uintptr *size, uint32 **ref)
|
|||||||
*size = n;
|
*size = n;
|
||||||
nobj = (s->npages << PageShift) / (n + RefcountOverhead);
|
nobj = (s->npages << PageShift) / (n + RefcountOverhead);
|
||||||
if((byte*)s->gcref < p || (byte*)(s->gcref+nobj) > p+(s->npages<<PageShift)) {
|
if((byte*)s->gcref < p || (byte*)(s->gcref+nobj) > p+(s->npages<<PageShift)) {
|
||||||
printf("s->base sizeclass %d %p gcref %p block %D\n",
|
printf("odd span state=%d span=%p base=%p sizeclass=%d n=%d size=%d npages=%d\n",
|
||||||
s->sizeclass, p, s->gcref, s->npages<<PageShift);
|
s->state, s, p, s->sizeclass, nobj, n, s->npages);
|
||||||
|
printf("s->base sizeclass %d v=%p base=%p gcref=%p blocksize=%D nobj=%d size=%D end=%p end=%p\n",
|
||||||
|
s->sizeclass, v, p, s->gcref, s->npages<<PageShift,
|
||||||
|
nobj, n, s->gcref + nobj, p+(s->npages<<PageShift));
|
||||||
throw("bad gcref");
|
throw("bad gcref");
|
||||||
}
|
}
|
||||||
if(ref)
|
if(ref)
|
||||||
|
@ -228,6 +228,8 @@ MHeap_LookupMaybe(MHeap *h, PageID p)
|
|||||||
s = MHeapMap_GetMaybe(&h->map, p);
|
s = MHeapMap_GetMaybe(&h->map, p);
|
||||||
if(s == nil || p < s->start || p - s->start >= s->npages)
|
if(s == nil || p < s->start || p - s->start >= s->npages)
|
||||||
return nil;
|
return nil;
|
||||||
|
if(s->state != MSpanInUse)
|
||||||
|
return nil;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user