not observed: do not use malloc to allocate stacks
during garbage collection, because it would make the
malloc data structures change underfoot.
R=r
DELTA=6 (3 added, 0 deleted, 3 changed)
OCL=30323
CL=30326
uint32 *ref;
//return oldmal(n);
- if(m->mallocing) {
+ if(m->mallocing || m->gcing) {
lock(&stacks);
if(stacks.size == 0)
FixAlloc_Init(&stacks, n, SysAlloc, nil, nil);
{
//return;
- if(m->mallocing) {
+ if(m->mallocing || m->gcing) {
lock(&stacks);
FixAlloc_Free(&stacks, v);
unlock(&stacks);
if(gcpercent < 0)
return;
+ m->gcing = 1;
semacquire(&gcsema);
gosave(&g->sched); // update g's stack pointer for scanstack
stoptheworld();
starttheworld();
gosave(&g->sched); // update g's stack pointer for debugging
semrelease(&gcsema);
+ m->gcing = 0;
}
int32 siz2;
int32 id;
int32 mallocing;
+ int32 gcing;
int32 locks;
Note havenextg;
G* nextg;