specify a more conservative initial capacity in initNextGen{1,2}()

This commit is contained in:
Joel Dice 2007-06-22 17:29:15 -06:00
parent 39bbcc03eb
commit 137fdcb69e
2 changed files with 9 additions and 3 deletions

View File

@ -39,6 +39,12 @@ min(unsigned a, unsigned b)
return (a < b ? a : b);
}
inline unsigned
avg(unsigned a, unsigned b)
{
return (a + b) / 2;
}
inline unsigned
pad(unsigned n)
{

View File

@ -285,7 +285,7 @@ class Segment {
if (p == 0) {
if (capacity > minimum) {
capacity = minimum + ((capacity - minimum) / 2);
capacity = avg(minimum, capacity);
} else {
abort(s->context);
}
@ -597,7 +597,7 @@ void
initNextGen1(Context* c)
{
unsigned minimum = MinimumGen1SizeInBytes / BytesPerWord;
unsigned desired = max(minimum, nextPowerOfTwo(c->gen1.position()));
unsigned desired = max(minimum, avg(c->gen1.position(), c->gen1.capacity()));
new (&(c->nextAgeMap)) Segment::Map
(&(c->nextGen1), log(TenureThreshold), 1, 0, false);
@ -634,7 +634,7 @@ void
initNextGen2(Context* c)
{
unsigned minimum = MinimumGen2SizeInBytes / BytesPerWord;
unsigned desired = max(minimum, nextPowerOfTwo(c->gen2.position()));
unsigned desired = max(minimum, avg(c->gen2.position(), c->gen2.capacity()));
new (&(c->nextPointerMap)) Segment::Map(&(c->nextGen2));
new (&(c->nextPageMap)) Segment::Map