From 62770e1f4ae3c8d73bb460a86b3dc90cc1f5622a Mon Sep 17 00:00:00 2001 From: Richard Kistruck Date: Mon, 11 Dec 2006 16:17:31 +0000 Subject: Mps _gc_start: make tracestartmessage reasons specific trigger names, not broad categories. Make _why text more explanatory. Copied from Perforce Change: 161196 ServerID: perforce.ravenbrook.com --- mps/code/config.h | 2 +- mps/code/mpmtypes.h | 13 ++++++++----- mps/code/mpsi.c | 4 ++-- mps/code/trace.c | 26 ++++++++++++++++---------- 4 files changed, 27 insertions(+), 18 deletions(-) (limited to 'mps/code') diff --git a/mps/code/config.h b/mps/code/config.h index c25b6c443c0..f88c6d867b3 100644 --- a/mps/code/config.h +++ b/mps/code/config.h @@ -212,7 +212,7 @@ /* Length (in chars) of a char buffer used to store the reason why a collection started in the TraceStartMessageStruct (used by mps_message_type_gc_start). */ -#define TRACE_START_MESSAGE_WHY_LEN 64 +#define TRACE_START_MESSAGE_WHY_LEN 128 diff --git a/mps/code/mpmtypes.h b/mps/code/mpmtypes.h index 7686ba26e16..ba49f280350 100644 --- a/mps/code/mpmtypes.h +++ b/mps/code/mpmtypes.h @@ -404,14 +404,17 @@ enum { TraceFINISHED }; -/* TraceStart reasons. Reasons for why a trace is started. */ +/* TraceStart reasons: the trigger that caused a trace to start. */ +/* Make these specific trigger names, not broad categories; */ +/* and if a new trigger is added, add a new reason. */ enum { TraceStartWhyBASE = 1, /* not a reason, the base of the enum. */ - TraceStartWhyNURSERY = TraceStartWhyBASE, - TraceStartWhyGLOBAL, - TraceStartWhyOPPORTUNISM, - TraceStartWhyCLIENT, + TraceStartWhyCHAIN_GEN0CAP = TraceStartWhyBASE, /* start minor */ + TraceStartWhyDYNAMICCRITERION, /* start full */ + TraceStartWhyOPPORTUNISM, /* start full */ + TraceStartWhyCLIENTFULL_INCREMENTAL, /* start full */ + TraceStartWhyCLIENTFULL_BLOCK, /* do full */ TraceStartWhyWALK, TraceStartWhyLIMIT /* not a reason, the limit of the enum. */ }; diff --git a/mps/code/mpsi.c b/mps/code/mpsi.c index 5f224f56c40..29b9be40a56 100644 --- a/mps/code/mpsi.c +++ b/mps/code/mpsi.c @@ -346,7 +346,7 @@ mps_res_t mps_arena_start_collect(mps_space_t mps_space) Res res; Arena arena = (Arena)mps_space; ArenaEnter(arena); - res = ArenaStartCollect(ArenaGlobals(arena), TraceStartWhyCLIENT); + res = ArenaStartCollect(ArenaGlobals(arena), TraceStartWhyCLIENTFULL_INCREMENTAL); ArenaLeave(arena); return res; } @@ -356,7 +356,7 @@ mps_res_t mps_arena_collect(mps_space_t mps_space) Res res; Arena arena = (Arena)mps_space; ArenaEnter(arena); - res = ArenaCollect(ArenaGlobals(arena), TraceStartWhyCLIENT); + res = ArenaCollect(ArenaGlobals(arena), TraceStartWhyCLIENTFULL_BLOCK); ArenaLeave(arena); return res; } diff --git a/mps/code/trace.c b/mps/code/trace.c index 757aee17db4..c9c36c0a0f5 100644 --- a/mps/code/trace.c +++ b/mps/code/trace.c @@ -223,20 +223,26 @@ static void traceStartWhyToString(char *s, size_t len, int why) AVER(why < TraceStartWhyLIMIT); switch(why) { - case TraceStartWhyNURSERY: - r = "Nursery generation is full."; + case TraceStartWhyCHAIN_GEN0CAP: + r = "Generation 0 of a chain has reached capacity:" + " start a minor collection."; break; - case TraceStartWhyGLOBAL: - r = "Preventing global exhaustion of memory."; + case TraceStartWhyDYNAMICCRITERION: + r = "Need to start full collection now, or there won't be enough" + " memory (ArenaAvail) to complete it."; break; case TraceStartWhyOPPORTUNISM: - r = "Opportunism."; + r = "Opportunism: client predicts plenty of idle time," + " so start full collection."; break; - case TraceStartWhyCLIENT: - r = "Client request."; + case TraceStartWhyCLIENTFULL_INCREMENTAL: + r = "Client requests: start incremental full collection now."; + break; + case TraceStartWhyCLIENTFULL_BLOCK: + r = "Client requests: immediate full collection."; break; case TraceStartWhyWALK: - r = "Walking."; + r = "Walking all live objects."; break; default: NOTREACHED; @@ -1730,7 +1736,7 @@ Size TracePoll(Globals globals) dynamicDeferral = (double)ArenaAvail(arena) - (double)sConsTrace; if (dynamicDeferral < 0.0) { /* start full GC */ - res = traceStartCollectAll(&trace, arena, TraceStartWhyGLOBAL); + res = traceStartCollectAll(&trace, arena, TraceStartWhyDYNAMICCRITERION); if (res != ResOK) goto failStart; scannedSize = traceWorkClock(trace); @@ -1754,7 +1760,7 @@ Size TracePoll(Globals globals) if (firstTime < 0) { double mortality; - res = TraceCreate(&trace, arena, TraceStartWhyNURSERY); + res = TraceCreate(&trace, arena, TraceStartWhyCHAIN_GEN0CAP); AVER(res == ResOK); res = ChainCondemnAuto(&mortality, firstChain, trace); if (res != ResOK) /* should try some other trace, really @@@@ */ -- cgit v1.2.1