From 487c1a67dfaf0834bf7331dda924f7477d81fe68 Mon Sep 17 00:00:00 2001 From: Pekka Pirinen Date: Thu, 12 Apr 2001 17:50:36 +0100 Subject: [PATCH] Zonesets Copied from Perforce Change: 21796 ServerID: perforce.ravenbrook.com --- mps/src/ref.c | 57 +++++++++++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/mps/src/ref.c b/mps/src/ref.c index 0b7bb9266c3..8614cd5b451 100644 --- a/mps/src/ref.c +++ b/mps/src/ref.c @@ -1,16 +1,16 @@ /* impl.c.ref: REFERENCES * - * $HopeName: MMsrc!ref.c(trunk.11) $ + * $HopeName: MMsrc!ref.c(trunk.12) $ * Copyright (C) 1999 Harlequin Limited. All rights reserved. * - * .purpose: Implement operations on Ref, RefSet, and Rank. + * .purpose: Implement operations on Ref, RefSet, ZoneSet, and Rank. * * .design: See design.mps.ref and design.mps.refset. */ #include "mpm.h" -SRCID(ref, "$HopeName: MMsrc!ref.c(trunk.11) $"); +SRCID(ref, "$HopeName: MMsrc!ref.c(trunk.12) $"); /* RankCheck -- check a rank value */ @@ -33,54 +33,49 @@ Bool RankSetCheck(RankSet rankSet) } -/* RefSetOfRange -- calculate the reference set of a range of addresses - * - * .rsor.def: The reference set of a segment is the union of the - * set of potential references _to_ that segment, i.e. of all the - * addresses the segment occupies. - * - * .rsor.zones: The base and limit zones of the segment - * are calculated. The limit zone is one plus the zone of the last - * address in the segment, not the zone of the limit address. - * - * .rsor.univ: If the segment is large enough to span all zones, - * its reference set is universal. - * - * .rsor.swap: If the base zone is less than the limit zone, - * then the reference set looks like 000111100, otherwise it looks like - * 111000011. - */ +/* ZoneSetOfRange -- calculate the zone set of a range of addresses */ -RefSet RefSetOfRange(Arena arena, Addr base, Addr limit) +RefSet ZoneSetOfRange(Arena arena, Addr base, Addr limit) { Word zbase, zlimit; AVERT(Arena, arena); AVER(limit > base); - /* .rsor.zones */ + /* The base and limit zones of the range are calculated. The limit */ + /* zone is the zone after the last zone of the range, not the zone of */ + /* the limit address. */ zbase = (Word)base >> arena->zoneShift; zlimit = (((Word)limit-1) >> arena->zoneShift) + 1; - if (zlimit - zbase >= MPS_WORD_WIDTH) /* .rsor.univ */ - return RefSetUNIV; + + /* If the range is large enough to span all zones, its zone set is */ + /* universal. */ + if (zlimit - zbase >= MPS_WORD_WIDTH) + return ZoneSetUNIV; zbase &= MPS_WORD_WIDTH - 1; zlimit &= MPS_WORD_WIDTH - 1; - if (zbase < zlimit) /* .rsor.swap */ - return ((RefSet)1<