Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
move minAddr and maxAddr into PoolTable
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinNowak committed Jan 18, 2015
1 parent ba77b23 commit 707b2d2
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions src/gc/gc.d
Original file line number Diff line number Diff line change
Expand Up @@ -1364,8 +1364,8 @@ struct Gcx
uint running;
int disabled; // turn off collections if >0

byte *minAddr; // min(baseAddr)
byte *maxAddr; // max(topAddr)
@property byte* minAddr() pure nothrow { return pooltable.minAddr; }
@property byte* maxAddr() pure nothrow { return pooltable.maxAddr; }

@property size_t npools() pure const nothrow { return pooltable.length; }
PoolTable pooltable;
Expand Down Expand Up @@ -1885,16 +1885,6 @@ struct Gcx
cstdlib.free(pool);
}

if (npools)
{
minAddr = pooltable[0].baseAddr;
maxAddr = pooltable[npools - 1].topAddr;
}
else
{
minAddr = maxAddr = null;
}

static if (USE_CACHE){
resetPoolCache();
}
Expand Down Expand Up @@ -2195,9 +2185,6 @@ struct Gcx
cstdlib.free(pool);
return null;
}

minAddr = pooltable[0].baseAddr;
maxAddr = pooltable[npools - 1].topAddr;
}

if (GC.config.profile)
Expand Down Expand Up @@ -3073,6 +3060,10 @@ nothrow:
pools[i] = pool;

++npools;

minAddr = pools[0].baseAddr;
maxAddr = pools[npools - 1].topAddr;

return true;
}

Expand Down Expand Up @@ -3120,8 +3111,19 @@ nothrow:
// npooltable[0 .. i] => used pools
// npooltable[i .. npools] => free pools

if (i)
{
minAddr = pools[0].baseAddr;
maxAddr = pools[i - 1].topAddr;
}
else
{
minAddr = maxAddr = null;
}

immutable len = npools;
npools = i;
// return freed pools to the caller
return pools[npools .. len];
}

Expand All @@ -3137,6 +3139,7 @@ nothrow:
private:
Pool** pools;
size_t npools;
byte* minAddr, maxAddr;
}

/* ============================ Pool =============================== */
Expand Down

0 comments on commit 707b2d2

Please sign in to comment.