From 5e4636ec8bf20e2602b0b1bd52c19f191f08d550 Mon Sep 17 00:00:00 2001 From: Richard Kistruck Date: Fri, 23 Mar 2007 15:30:08 +0000 Subject: [PATCH] Mps br/unfixed-summary: comment-out the "what caused et?" segdescribes. Save sketches (abzSketchTotal and abzSketchTotalPrev) in amcseg, which get Described when unfixedSummary is wrong: let's see whether there's a pattern to the way the previous summary was created. Copied from Perforce Change: 161994 ServerID: perforce.ravenbrook.com --- mps/code/poolamc.c | 36 +++++++++++++++++++++++++++++++++++- mps/code/trace.c | 17 ++++++++++++----- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c index 45edecf2b0f..97d193d6aea 100644 --- a/mps/code/poolamc.c +++ b/mps/code/poolamc.c @@ -86,10 +86,14 @@ typedef struct amcSegStruct *amcSeg; #define amcSegSig ((Sig)0x519A3C59) /* SIGnature AMC SeG */ +#define CB_SKETCH 5 + typedef struct amcSegStruct { GCSegStruct gcSegStruct; /* superclass fields must come first */ int *segTypeP; /* .segtype */ Bool new; /* allocated since last GC */ + char abzSketchTotalPrev[CB_SKETCH]; + char abzSketchTotal[CB_SKETCH]; Sig sig; /* */ } amcSegStruct; @@ -137,6 +141,8 @@ static Res AMCSegInit(Seg seg, Pool pool, Addr base, Size size, amcseg->segTypeP = segtype; /* .segtype */ amcseg->new = TRUE; + amcseg->abzSketchTotalPrev[0] = '\0'; + amcseg->abzSketchTotal[0] = '\0'; amcseg->sig = amcSegSig; AVERT(amcSeg, amcseg); @@ -221,7 +227,7 @@ static Res AMCSegDescribe(Seg seg, mps_lib_FILE *stream) Addr i, p, base, limit, init; Align step; Size row; - char abzSketch[5]; + char abzSketch[CB_SKETCH]; if (!CHECKT(Seg, seg)) return ResFAIL; if (stream == NULL) return ResFAIL; @@ -298,6 +304,12 @@ static Res AMCSegDescribe(Seg seg, mps_lib_FILE *stream) res = WriteF(stream, " Sketch: $S\n", (WriteFS)abzSketch, NULL); if (res != ResOK) return res; + res = WriteF(stream, " Sketch at previous Total scan: $S\n", (WriteFS)amcseg->abzSketchTotalPrev, NULL); + if (res != ResOK) return res; + + res = WriteF(stream, " Sketch at last Total scan: $S\n", (WriteFS)amcseg->abzSketchTotal, NULL); + if (res != ResOK) return res; + res = WriteF(stream, "} AMC Seg $P\n", (WriteFP)seg, NULL); if (res != ResOK) return res; @@ -1333,7 +1345,27 @@ static Res amcScanNailed(Bool *totalReturn, ScanState ss, Pool pool, * * See . */ +static Res AMCScanInner(Bool *totalReturn, ScanState ss, Pool pool, Seg seg); + static Res AMCScan(Bool *totalReturn, ScanState ss, Pool pool, Seg seg) +{ + Res res; + amcSeg amcseg; + + res = AMCScanInner(totalReturn, ss, pool, seg); + amcseg = Seg2amcSeg(seg); + if ( (res == ResOK) && totalReturn ) { + int i; + for (i = 0; i < NELEMS(amcseg->abzSketchTotalPrev); i += 1) { + amcseg->abzSketchTotalPrev[i] = amcseg->abzSketchTotal[i]; + } + AMCSegSketch(seg, amcseg->abzSketchTotal, NELEMS(amcseg->abzSketchTotal)); + } + + return res; +} + +static Res AMCScanInner(Bool *totalReturn, ScanState ss, Pool pool, Seg seg) { Addr base, limit; Arena arena; @@ -1577,6 +1609,7 @@ Res AMCFix(Pool pool, ScanState ss, Seg seg, Ref *refIO) do { res = BUFFER_RESERVE(&newRef, buffer, length, FALSE); if (res != ResOK) { + /* WriteF(mps_lib_get_stdout(), "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n" "AMCFix forwarding buffer: BUFFER_RESERVE failed,\n" @@ -1584,6 +1617,7 @@ Res AMCFix(Pool pool, ScanState ss, Seg seg, Ref *refIO) NULL ); SegDescribe(seg, mps_lib_get_stdout()); + */ goto returnRes; } diff --git a/mps/code/trace.c b/mps/code/trace.c index eaf948c6fa5..6178bf5c948 100644 --- a/mps/code/trace.c +++ b/mps/code/trace.c @@ -1094,11 +1094,13 @@ static Res traceScanSegRes(TraceSet ts, Rank rank, Arena arena, Seg seg) ShieldExpose(arena, seg); res = PoolScan(&wasTotal, &ss, SegPool(seg), seg); if (res != ResOK) { - WriteF(mps_lib_get_stdout(), - "PoolScan failed on this seg:\n", - NULL - ); - SegDescribe(seg, mps_lib_get_stdout()); + /* + WriteF(mps_lib_get_stdout(), + "PoolScan failed on this seg:\n", + NULL + ); + SegDescribe(seg, mps_lib_get_stdout()); + */ } /* Cover, regardless of result */ ShieldCover(arena, seg); @@ -1123,6 +1125,11 @@ static Res traceScanSegRes(TraceSet ts, Rank rank, Arena arena, Seg seg) /* following is true whether or not scan was total */ /* See . */ if (!RefSetSub(ss.unfixedSummary, SegSummary(seg))) { + printf("RongRongRongRongRongRongRongRongRongRongRong:\n"); + printf(" Total? %s:\n", + (res == ResOK) && wasTotal + ? "YES" + : "no"); SegDescribe(seg, mps_lib_get_stdout()); { TraceId ti;