mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Removing bogus arenatrivdescribe and turning arenadescribe the right way in.
Copied from Perforce Change: 191480 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
4a8e015d30
commit
546e082125
3 changed files with 24 additions and 65 deletions
|
|
@ -44,32 +44,7 @@ static void arenaFreePage(Arena arena, Addr base, Pool pool);
|
|||
static void arenaFreeLandFinish(Arena arena);
|
||||
static Res ArenaAbsInit(Arena arena, Size grainSize, ArgList args);
|
||||
static void ArenaAbsFinish(Arena arena);
|
||||
|
||||
|
||||
/* ArenaTrivDescribe -- produce trivial description of an arena */
|
||||
|
||||
static Res ArenaTrivDescribe(Arena arena, mps_lib_FILE *stream, Count depth)
|
||||
{
|
||||
if (!TESTT(Arena, arena))
|
||||
return ResFAIL;
|
||||
if (stream == NULL)
|
||||
return ResFAIL;
|
||||
|
||||
/* .describe.triv.never-called-from-subclass-method:
|
||||
* This Triv method seems to assume that it will never get called
|
||||
* from a subclass-method invoking ARENA_SUPERCLASS()->describe.
|
||||
* It assumes that it only gets called if the describe method has
|
||||
* not been subclassed. (That's the only reason for printing the
|
||||
* "No class-specific description available" message).
|
||||
* This is bogus, but that's the status quo. RHSK 2007-04-27.
|
||||
*/
|
||||
/* .describe.triv.dont-upcall: Therefore (for now) the last
|
||||
* subclass describe method should avoid invoking
|
||||
* ARENA_SUPERCLASS()->describe. RHSK 2007-04-27.
|
||||
*/
|
||||
return WriteF(stream, depth,
|
||||
" No class-specific description available.\n", NULL);
|
||||
}
|
||||
static Res ArenaAbsDescribe(Arena arena, mps_lib_FILE *stream, Count depth);
|
||||
|
||||
|
||||
static void ArenaNoFree(Addr base, Size size, Pool pool)
|
||||
|
|
@ -145,7 +120,7 @@ DEFINE_CLASS(Arena, AbstractArena, klass)
|
|||
klass->chunkInit = ArenaNoChunkInit;
|
||||
klass->chunkFinish = ArenaNoChunkFinish;
|
||||
klass->compact = ArenaTrivCompact;
|
||||
klass->describe = ArenaTrivDescribe;
|
||||
klass->describe = ArenaAbsDescribe;
|
||||
klass->pagesMarkAllocated = ArenaNoPagesMarkAllocated;
|
||||
klass->sig = ArenaClassSig;
|
||||
}
|
||||
|
|
@ -535,21 +510,16 @@ void ControlFinish(Arena arena)
|
|||
|
||||
/* ArenaDescribe -- describe the arena */
|
||||
|
||||
Res ArenaDescribe(Arena arena, mps_lib_FILE *stream, Count depth)
|
||||
static Res ArenaAbsDescribe(Arena arena, mps_lib_FILE *stream, Count depth)
|
||||
{
|
||||
Res res;
|
||||
ArenaClass klass;
|
||||
|
||||
if (!TESTC(AbstractArena, arena))
|
||||
return ResPARAM;
|
||||
if (stream == NULL)
|
||||
return ResPARAM;
|
||||
|
||||
klass = ClassOfPoly(Arena, arena);
|
||||
res = WriteF(stream, depth, "Arena $P {\n", (WriteFP)arena,
|
||||
" class $P (\"$S\")\n",
|
||||
(WriteFP)klass, (WriteFS)ClassName(klass),
|
||||
NULL);
|
||||
res = InstDescribe(CouldBeA(Inst, arena), stream, depth);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
|
||||
|
|
@ -586,27 +556,18 @@ Res ArenaDescribe(Arena arena, mps_lib_FILE *stream, Count depth)
|
|||
if (res != ResOK)
|
||||
return res;
|
||||
|
||||
res = Method(Arena, arena, describe)(arena, stream, depth);
|
||||
res = GlobalsDescribe(ArenaGlobals(arena), stream, depth + 2);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
|
||||
res = WriteF(stream, depth + 2, "Globals {\n", NULL);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
res = GlobalsDescribe(ArenaGlobals(arena), stream, depth + 4);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
res = WriteF(stream, depth + 2, "} Globals\n", NULL);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
|
||||
res = WriteF(stream, depth,
|
||||
"} Arena $P ($U)\n", (WriteFP)arena,
|
||||
(WriteFU)arena->serial,
|
||||
NULL);
|
||||
return res;
|
||||
}
|
||||
|
||||
Res ArenaDescribe(Arena arena, mps_lib_FILE *stream, Count depth)
|
||||
{
|
||||
return Method(Arena, arena, describe)(arena, stream, depth);
|
||||
}
|
||||
|
||||
|
||||
/* arenaDescribeTractsInChunk -- describe the tracts in a chunk */
|
||||
|
||||
|
|
|
|||
|
|
@ -197,15 +197,9 @@ static Res VMArenaDescribe(Arena arena, mps_lib_FILE *stream, Count depth)
|
|||
if (stream == NULL)
|
||||
return ResPARAM;
|
||||
|
||||
/* Describe the superclass fields first via next-method call */
|
||||
/* ...but the next method is ArenaTrivDescribe, so don't call it;
|
||||
* see impl.c.arena#describe.triv.dont-upcall.
|
||||
*
|
||||
res = NextMethod(Arena, VMArena, describe)(arena, stream);
|
||||
res = NextMethod(Arena, VMArena, describe)(arena, stream, depth);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
*
|
||||
*/
|
||||
|
||||
res = WriteF(stream, depth,
|
||||
" spareSize: $U\n", (WriteFU)vmArena->spareSize,
|
||||
|
|
@ -213,7 +207,7 @@ static Res VMArenaDescribe(Arena arena, mps_lib_FILE *stream, Count depth)
|
|||
if(res != ResOK)
|
||||
return res;
|
||||
|
||||
/* (incomplete: some fields are not Described) */
|
||||
/* TODO: incomplete -- some fields are not Described */
|
||||
|
||||
return ResOK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -947,8 +947,12 @@ Res GlobalsDescribe(Globals arenaGlobals, mps_lib_FILE *stream, Count depth)
|
|||
if (stream == NULL)
|
||||
return ResFAIL;
|
||||
|
||||
res = WriteF(stream, depth, "Globals\n", NULL);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
|
||||
arena = GlobalsArena(arenaGlobals);
|
||||
res = WriteF(stream, depth,
|
||||
res = WriteF(stream, depth + 2,
|
||||
"mpsVersion $S\n", (WriteFS)arenaGlobals->mpsVersionString,
|
||||
"lock $P\n", (WriteFP)arenaGlobals->lock,
|
||||
"pollThreshold $U kB\n",
|
||||
|
|
@ -979,45 +983,45 @@ Res GlobalsDescribe(Globals arenaGlobals, mps_lib_FILE *stream, Count depth)
|
|||
if (res != ResOK)
|
||||
return res;
|
||||
|
||||
res = ShieldDescribe(ArenaShield(arena), stream, depth);
|
||||
res = ShieldDescribe(ArenaShield(arena), stream, depth + 2);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
|
||||
res = RootsDescribe(arenaGlobals, stream, depth);
|
||||
res = RootsDescribe(arenaGlobals, stream, depth + 2);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
|
||||
RING_FOR(node, &arenaGlobals->poolRing, nextNode) {
|
||||
Pool pool = RING_ELT(Pool, arenaRing, node);
|
||||
res = PoolDescribe(pool, stream, depth);
|
||||
res = PoolDescribe(pool, stream, depth + 2);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
}
|
||||
|
||||
RING_FOR(node, &arena->formatRing, nextNode) {
|
||||
Format format = RING_ELT(Format, arenaRing, node);
|
||||
res = FormatDescribe(format, stream, depth);
|
||||
res = FormatDescribe(format, stream, depth + 2);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
}
|
||||
|
||||
RING_FOR(node, &arena->threadRing, nextNode) {
|
||||
Thread thread = ThreadRingThread(node);
|
||||
res = ThreadDescribe(thread, stream, depth);
|
||||
res = ThreadDescribe(thread, stream, depth + 2);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
}
|
||||
|
||||
RING_FOR(node, &arena->chainRing, nextNode) {
|
||||
Chain chain = RING_ELT(Chain, chainRing, node);
|
||||
res = ChainDescribe(chain, stream, depth);
|
||||
res = ChainDescribe(chain, stream, depth + 2);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
}
|
||||
|
||||
TRACE_SET_ITER(ti, trace, TraceSetUNIV, arena)
|
||||
if (TraceSetIsMember(arena->busyTraces, trace)) {
|
||||
res = TraceDescribe(trace, stream, depth);
|
||||
res = TraceDescribe(trace, stream, depth + 2);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue