From dee2b3438bb89366715442a2ade3db772b6031c8 Mon Sep 17 00:00:00 2001 From: Richard Brooksby Date: Thu, 27 Feb 2014 17:01:29 +0000 Subject: [PATCH] Inserting small ranges into the zone cbss so that they can be reallocated quickly. Copied from Perforce Change: 184579 ServerID: perforce.ravenbrook.com --- mps/code/zonedcbs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mps/code/zonedcbs.c b/mps/code/zonedcbs.c index 208fc08e5ac..4ecf8134868 100644 --- a/mps/code/zonedcbs.c +++ b/mps/code/zonedcbs.c @@ -127,6 +127,8 @@ void ZonedCBSFinish(ZonedCBS zcbs) Res ZonedCBSInsert(Range rangeReturn, ZonedCBS zcbs, Range range) { + ZoneSet zs; + AVERT(ZonedCBS, zcbs); /* TODO: Consider moving empty zone stripes back to freeCBS. At the @@ -136,6 +138,13 @@ Res ZonedCBSInsert(Range rangeReturn, ZonedCBS zcbs, Range range) eagerly in any case, but lazily if we're unable to find address space, even though that reduces first-fit. */ + zs = ZoneSetOfRange(zcbs->arena, RangeBase(range), RangeLimit(range)); + if (ZoneSetIsSingle(zs)) { + Index zone = AddrZone(zcbs->arena, RangeBase(range)); + CBS zoneCBS = ZonedCBSZoneCBS(zcbs, zone); + return CBSInsert(rangeReturn, zoneCBS, range); + } + return CBSInsert(rangeReturn, ZonedCBSFreeCBS(zcbs), range); }