From 735d099d31ecbe0496bbf2efa5fd80bb3c87595b Mon Sep 17 00:00:00 2001 From: Richard Brooksby Date: Sun, 13 Mar 2016 15:57:08 +0000 Subject: [PATCH] Removing white field from tracts. Copied from Perforce Change: 190075 ServerID: perforce.ravenbrook.com --- mps/code/seg.c | 40 ---------------------------------------- mps/code/trace.c | 9 +++++++-- mps/code/tract.c | 4 ---- mps/code/tract.h | 3 --- 4 files changed, 7 insertions(+), 49 deletions(-) diff --git a/mps/code/seg.c b/mps/code/seg.c index 157aebb4a63..3efb85c1807 100644 --- a/mps/code/seg.c +++ b/mps/code/seg.c @@ -170,7 +170,6 @@ static Res SegInit(Seg seg, Pool pool, Addr base, Size size, AVER(TractP(tract) == NULL); AVER(!TractHasSeg(tract)); AVER(TractPool(tract) == pool); - AVER(TractWhite(tract) == TraceSetEMPTY); TRACT_SET_SEG(tract, seg); } AVER(addr == SegLimit(seg)); @@ -227,7 +226,6 @@ static void SegFinish(Seg seg) limit = SegLimit(seg); TRACT_FOR(tract, addr, arena, base, limit) { AVERT(Tract, tract); - TractSetWhite(tract, TraceSetEMPTY); TRACT_UNSET_SEG(tract); } AVER(addr == SegLimit(seg)); @@ -686,27 +684,6 @@ Bool SegCheck(Seg seg) CHECKL(AddrIsArenaGrain(SegBase(seg), arena)); CHECKL(AddrIsArenaGrain(SegLimit(seg), arena)); - /* Each tract of the segment must agree about white traces. Note - * that even if the CHECKs are compiled away there is still a - * significant cost in looping over the tracts, hence the guard. See - * job003778. */ -#if defined(AVER_AND_CHECK_ALL) - { - Tract tract; - Addr addr; - TRACT_FOR(tract, addr, arena, SegBase(seg), SegLimit(seg)) { - Seg trseg = NULL; /* suppress compiler warning */ - - CHECKD_NOSIG(Tract, tract); - CHECKL(TRACT_SEG(&trseg, tract)); - CHECKL(trseg == seg); - CHECKL(TractWhite(tract) == seg->white); - CHECKL(TractPool(tract) == pool); - } - CHECKL(addr == SegLimit(seg)); - } -#endif /* AVER_AND_CHECK_ALL */ - /* The segment must belong to some pool, so it should be on a */ /* pool's segment ring. (Actually, this isn't true just after */ /* the segment is initialized.) */ @@ -1248,9 +1225,6 @@ static void gcSegSetGrey(Seg seg, TraceSet grey) static void gcSegSetWhite(Seg seg, TraceSet white) { GCSeg gcseg; - Tract tract; - Arena arena; - Addr addr, base, limit; AVERT_CRITICAL(Seg, seg); /* .seg.method.check */ AVERT_CRITICAL(TraceSet, white); /* .seg.method.check */ @@ -1258,20 +1232,6 @@ static void gcSegSetWhite(Seg seg, TraceSet white) AVERT_CRITICAL(GCSeg, gcseg); AVER_CRITICAL(&gcseg->segStruct == seg); - arena = PoolArena(SegPool(seg)); - AVERT_CRITICAL(Arena, arena); - base = SegBase(seg); - limit = SegLimit(seg); - /* Each tract of the segment records white traces */ - TRACT_FOR(tract, addr, arena, base, limit) { - Seg trseg = NULL; /* suppress compiler warning */ - AVERT_CRITICAL(Tract, tract); - AVER_CRITICAL(TRACT_SEG(&trseg, tract)); - AVER_CRITICAL(trseg == seg); - TractSetWhite(tract, BS_BITFIELD(Trace, white)); - } - AVER(addr == limit); - seg->white = BS_BITFIELD(Trace, white); } diff --git a/mps/code/trace.c b/mps/code/trace.c index 6d9cb0f0f98..bafe119c607 100644 --- a/mps/code/trace.c +++ b/mps/code/trace.c @@ -1336,8 +1336,13 @@ mps_res_t _mps_fix2(mps_ss_t mps_ss, mps_addr_t *mps_ref_io) } tract = PageTract(&chunk->pageTable[i]); - if (TraceSetInter(TractWhite(tract), ss->traces) == TraceSetEMPTY) { - /* Reference points to a tract that is not white for any of the + if (!TRACT_SEG(&seg, tract)) { + /* Reference points to a tract but not a segment, so it can't be white. */ + goto done; + } + + if (TraceSetInter(SegWhite(seg), ss->traces) == TraceSetEMPTY) { + /* Reference points to a segment that is not white for any of the * active traces. See */ STATISTIC_STAT ({ diff --git a/mps/code/tract.c b/mps/code/tract.c index 9aa815f47ba..6bade6a340f 100644 --- a/mps/code/tract.c +++ b/mps/code/tract.c @@ -47,10 +47,7 @@ Bool TractCheck(Tract tract) CHECKL(AddrIsArenaGrain(TractBase(tract), TractArena(tract))); } if (TractHasSeg(tract)) { - CHECKL(TraceSetCheck(TractWhite(tract))); CHECKU(Seg, (Seg)TractP(tract)); - } else { - CHECKL(TractWhite(tract) == TraceSetEMPTY); } return TRUE; } @@ -66,7 +63,6 @@ void TractInit(Tract tract, Pool pool, Addr base) tract->pool.pool = pool; tract->base = base; tract->p = NULL; - tract->white = TraceSetEMPTY; tract->hasSeg = FALSE; AVERT(Tract, tract); diff --git a/mps/code/tract.h b/mps/code/tract.h index ce7c602a176..64eb319c51d 100644 --- a/mps/code/tract.h +++ b/mps/code/tract.h @@ -44,7 +44,6 @@ typedef struct TractStruct { /* Tract structure */ PagePoolUnion pool; /* MUST BE FIRST ( pool) */ void *p; /* pointer for use of owning pool */ Addr base; /* Base address of the tract */ - TraceSet white : TraceLIMIT; /* traces for which tract is white */ BOOLFIELD(hasSeg); /* does tract have a seg in p? */ } TractStruct; @@ -60,8 +59,6 @@ extern Addr TractLimit(Tract tract, Arena arena); #define TractSetP(tract, pp) ((void)((tract)->p = (pp))) #define TractHasSeg(tract) ((Bool)(tract)->hasSeg) #define TractSetHasSeg(tract, b) ((void)((tract)->hasSeg = (b))) -#define TractWhite(tract) ((tract)->white) -#define TractSetWhite(tract, w) ((void)((tract)->white = (w))) extern Bool TractCheck(Tract tract); extern void TractInit(Tract tract, Pool pool, Addr base);