diff --git a/mps/code/dbgpool.c b/mps/code/dbgpool.c index 8068dc64b97..5a56002695c 100644 --- a/mps/code/dbgpool.c +++ b/mps/code/dbgpool.c @@ -206,7 +206,7 @@ static Res DebugPoolInit(Pool pool, Arena arena, PoolClass klass, ArgList args) return ResOK; tagFail: - SuperclassPoly(Pool, klass)->finish(pool); + SuperclassPoly(Inst, klass)->finish(MustBeA(Inst, pool)); AVER(res != ResOK); return res; } @@ -214,8 +214,9 @@ tagFail: /* DebugPoolFinish -- finish method for a debug pool */ -static void DebugPoolFinish(Pool pool) +static void DebugPoolFinish(Inst inst) { + Pool pool = MustBeA(AbstractPool, inst); PoolDebugMixin debug; PoolClass klass; @@ -229,7 +230,7 @@ static void DebugPoolFinish(Pool pool) PoolDestroy(debug->tagPool); } klass = ClassOfPoly(Pool, pool); - SuperclassPoly(Pool, klass)->finish(pool); + SuperclassPoly(Inst, klass)->finish(inst); } @@ -775,8 +776,8 @@ void DebugPoolCheckFreeSpace(Pool pool) void PoolClassMixInDebug(PoolClass klass) { /* Can't check klass because it's not initialized yet */ + klass->protocol.finish = DebugPoolFinish; klass->init = DebugPoolInit; - klass->finish = DebugPoolFinish; klass->alloc = DebugPoolAlloc; klass->free = DebugPoolFree; } diff --git a/mps/code/mpm.h b/mps/code/mpm.h index 793e19db5b2..df60bc1043e 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h @@ -238,7 +238,7 @@ extern Size PoolTotalSize(Pool pool); extern Size PoolFreeSize(Pool pool); extern Res PoolAbsInit(Pool pool, Arena arena, PoolClass klass, ArgList arg); -extern void PoolAbsFinish(Pool pool); +extern void PoolAbsFinish(Inst inst); extern Res PoolNoAlloc(Addr *pReturn, Pool pool, Size size); extern Res PoolTrivAlloc(Addr *pReturn, Pool pool, Size size); extern void PoolNoFree(Pool pool, Addr old, Size size); diff --git a/mps/code/mpmst.h b/mps/code/mpmst.h index 930f442ea34..19b3cae7983 100644 --- a/mps/code/mpmst.h +++ b/mps/code/mpmst.h @@ -54,7 +54,6 @@ typedef struct mps_pool_class_s { Attr attr; /* attributes */ PoolVarargsMethod varargs; /* convert deprecated varargs into keywords */ PoolInitMethod init; /* initialize the pool descriptor */ - PoolFinishMethod finish; /* finish the pool descriptor */ PoolAllocMethod alloc; /* allocate memory from pool */ PoolFreeMethod free; /* free memory to pool */ PoolBufferFillMethod bufferFill; /* out-of-line reserve */ diff --git a/mps/code/pool.c b/mps/code/pool.c index d132365f7dc..b6fb278a121 100644 --- a/mps/code/pool.c +++ b/mps/code/pool.c @@ -43,7 +43,6 @@ Bool PoolClassCheck(PoolClass klass) CHECKL(!(klass->attr & AttrMOVINGGC) || (klass->attr & AttrGC)); CHECKL(FUNCHECK(klass->varargs)); CHECKL(FUNCHECK(klass->init)); - CHECKL(FUNCHECK(klass->finish)); CHECKL(FUNCHECK(klass->alloc)); CHECKL(FUNCHECK(klass->free)); CHECKL(FUNCHECK(klass->bufferFill)); @@ -70,7 +69,8 @@ Bool PoolClassCheck(PoolClass klass) CHECKL(FUNCHECK(klass->freeSize)); /* Check that pool classes overide sets of related methods. */ - CHECKL((klass->init == PoolAbsInit) == (klass->finish == PoolAbsFinish)); + CHECKL((klass->init == PoolAbsInit) == + (klass->protocol.finish == PoolAbsFinish)); CHECKL((klass->bufferFill == PoolNoBufferFill) == (klass->bufferEmpty == PoolNoBufferEmpty)); CHECKL((klass->framePush == PoolNoFramePush) == @@ -196,7 +196,7 @@ failControlAlloc: void PoolFinish(Pool pool) { AVERT(Pool, pool); - Method(Pool, pool, finish)(pool); + Method(Inst, pool, finish)(MustBeA(Inst, pool)); } diff --git a/mps/code/poolabs.c b/mps/code/poolabs.c index a25c3b814f1..eb360e687b9 100644 --- a/mps/code/poolabs.c +++ b/mps/code/poolabs.c @@ -154,8 +154,10 @@ Res PoolAbsInit(Pool pool, Arena arena, PoolClass klass, ArgList args) /* PoolAbsFinish -- finish an abstract pool instance */ -void PoolAbsFinish(Pool pool) +void PoolAbsFinish(Inst inst) { + Pool pool = MustBeA(AbstractPool, inst); + /* Detach the pool from the arena and format, and unsig it. */ RingRemove(PoolArenaRing(pool)); @@ -186,11 +188,11 @@ DEFINE_CLASS(Pool, AbstractPool, klass) { INHERIT_CLASS(&klass->protocol, AbstractPool, Inst); klass->protocol.describe = PoolAbsDescribe; + klass->protocol.finish = PoolAbsFinish; klass->size = sizeof(PoolStruct); klass->attr = 0; klass->varargs = ArgTrivVarargs; klass->init = PoolAbsInit; - klass->finish = PoolAbsFinish; klass->alloc = PoolNoAlloc; klass->free = PoolNoFree; klass->bufferFill = PoolNoBufferFill; diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c index 7ecc80ecaf3..0cf0f9c03d3 100644 --- a/mps/code/poolamc.c +++ b/mps/code/poolamc.c @@ -799,7 +799,7 @@ failGenAlloc: } ControlFree(arena, amc->gen, genArraySize); failGensAlloc: - PoolAbsFinish(pool); + NextMethod(Inst, AMCZPool, finish)(MustBeA(Inst, pool)); return res; } @@ -824,8 +824,9 @@ static Res AMCZInit(Pool pool, Arena arena, PoolClass klass, ArgList args) * * See . */ -static void AMCFinish(Pool pool) +static void AMCFinish(Inst inst) { + Pool pool = MustBeA(AbstractPool, inst); AMC amc = MustBeA(AMCZPool, pool); Ring ring; Ring node, nextNode; @@ -868,7 +869,8 @@ static void AMCFinish(Pool pool) } amc->sig = SigInvalid; - PoolAbsFinish(pool); + + NextMethod(Inst, AMCZPool, finish)(inst); } @@ -2023,11 +2025,11 @@ DEFINE_CLASS(Pool, AMCZPool, klass) PoolClassMixInFormat(klass); PoolClassMixInCollect(klass); klass->protocol.describe = AMCDescribe; + klass->protocol.finish = AMCFinish; klass->size = sizeof(AMCStruct); klass->attr |= AttrMOVINGGC; klass->varargs = AMCVarargs; klass->init = AMCZInit; - klass->finish = AMCFinish; klass->bufferFill = AMCBufferFill; klass->bufferEmpty = AMCBufferEmpty; klass->whiten = AMCWhiten; diff --git a/mps/code/poolams.c b/mps/code/poolams.c index 38600642d77..17679639dd8 100644 --- a/mps/code/poolams.c +++ b/mps/code/poolams.c @@ -836,7 +836,7 @@ static Res AMSInit(Pool pool, Arena arena, PoolClass klass, ArgList args) return ResOK; failGenInit: - PoolAbsFinish(pool); + NextMethod(Inst, AMSPool, finish)(MustBeA(Inst, pool)); failAbsInit: return res; } @@ -847,12 +847,11 @@ failAbsInit: * Destroys all the segs in the pool. Can't invalidate the AMS until * we've destroyed all the segments, as it may be checked. */ -void AMSFinish(Pool pool) +void AMSFinish(Inst inst) { - AMS ams; + Pool pool = MustBeA(AbstractPool, inst); + AMS ams = MustBeA(AMSPool, pool); - AVERT(Pool, pool); - ams = PoolAMS(pool); AVERT(AMS, ams); ams->segsDestroy(ams); @@ -861,7 +860,8 @@ void AMSFinish(Pool pool) RingFinish(&ams->segRing); PoolGenFinish(ams->pgen); ams->pgen = NULL; - PoolAbsFinish(pool); + + NextMethod(Inst, AMSPool, finish)(inst); } @@ -1744,10 +1744,10 @@ DEFINE_CLASS(Pool, AMSPool, klass) INHERIT_CLASS(klass, AMSPool, AbstractCollectPool); PoolClassMixInFormat(klass); klass->protocol.describe = AMSDescribe; + klass->protocol.finish = AMSFinish; klass->size = sizeof(AMSStruct); klass->varargs = AMSVarargs; klass->init = AMSInit; - klass->finish = AMSFinish; klass->bufferClass = RankBufClassGet; klass->bufferFill = AMSBufferFill; klass->bufferEmpty = AMSBufferEmpty; diff --git a/mps/code/poolams.h b/mps/code/poolams.h index e1dd091168c..28fd829f127 100644 --- a/mps/code/poolams.h +++ b/mps/code/poolams.h @@ -172,7 +172,7 @@ typedef struct AMSSegStruct { extern Res AMSInitInternal(AMS ams, Arena arena, PoolClass klass, Chain chain, unsigned gen, Bool shareAllocTable, ArgList args); -extern void AMSFinish(Pool pool); +extern void AMSFinish(Inst inst); extern Bool AMSCheck(AMS ams); extern Res AMSScan(Bool *totalReturn, ScanState ss, Pool pool, Seg seg); diff --git a/mps/code/poolawl.c b/mps/code/poolawl.c index 22e8e075b64..2287432ecc7 100644 --- a/mps/code/poolawl.c +++ b/mps/code/poolawl.c @@ -572,7 +572,7 @@ static Res AWLInit(Pool pool, Arena arena, PoolClass klass, ArgList args) return ResOK; failGenInit: - PoolAbsFinish(pool); + NextMethod(Inst, AWLPool, finish)(MustBeA(Inst, pool)); failAbsInit: AVER(res != ResOK); return res; @@ -581,8 +581,9 @@ failAbsInit: /* AWLFinish -- finish an AWL pool */ -static void AWLFinish(Pool pool) +static void AWLFinish(Inst inst) { + Pool pool = MustBeA(AbstractPool, inst); AWL awl = MustBeA(AWLPool, pool); Ring ring, node, nextNode; @@ -601,7 +602,8 @@ static void AWLFinish(Pool pool) } awl->sig = SigInvalid; PoolGenFinish(awl->pgen); - PoolAbsFinish(pool); + + NextMethod(Inst, AWLPool, finish)(inst); } @@ -1215,10 +1217,10 @@ DEFINE_CLASS(Pool, AWLPool, klass) { INHERIT_CLASS(klass, AWLPool, AbstractCollectPool); PoolClassMixInFormat(klass); + klass->protocol.finish = AWLFinish; klass->size = sizeof(AWLPoolStruct); klass->varargs = AWLVarargs; klass->init = AWLInit; - klass->finish = AWLFinish; klass->bufferClass = RankBufClassGet; klass->bufferFill = AWLBufferFill; klass->bufferEmpty = AWLBufferEmpty; diff --git a/mps/code/poollo.c b/mps/code/poollo.c index f20c54a9170..338d2c18618 100644 --- a/mps/code/poollo.c +++ b/mps/code/poollo.c @@ -502,7 +502,7 @@ static Res LOInit(Pool pool, Arena arena, PoolClass klass, ArgList args) return ResOK; failGenInit: - PoolAbsFinish(pool); + NextMethod(Inst, LOPool, finish)(MustBeA(Inst, pool)); failAbsInit: AVER(res != ResOK); return res; @@ -511,8 +511,9 @@ failAbsInit: /* LOFinish -- finish an LO pool */ -static void LOFinish(Pool pool) +static void LOFinish(Inst inst) { + Pool pool = MustBeA(AbstractPool, inst); LO lo = MustBeA(LOPool, pool); Ring node, nextNode; @@ -531,7 +532,8 @@ static void LOFinish(Pool pool) PoolGenFinish(lo->pgen); lo->sig = SigInvalid; - PoolAbsFinish(pool); + + NextMethod(Inst, LOPool, finish)(inst); } @@ -784,10 +786,10 @@ DEFINE_CLASS(Pool, LOPool, klass) INHERIT_CLASS(klass, LOPool, AbstractSegBufPool); PoolClassMixInFormat(klass); PoolClassMixInCollect(klass); + klass->protocol.finish = LOFinish; klass->size = sizeof(LOStruct); klass->varargs = LOVarargs; klass->init = LOInit; - klass->finish = LOFinish; klass->bufferFill = LOBufferFill; klass->bufferEmpty = LOBufferEmpty; klass->whiten = LOWhiten; diff --git a/mps/code/poolmfs.c b/mps/code/poolmfs.c index 688258db696..7b5443995b3 100644 --- a/mps/code/poolmfs.c +++ b/mps/code/poolmfs.c @@ -153,14 +153,16 @@ static void MFSTractFreeVisitor(Pool pool, Addr base, Size size, } -static void MFSFinish(Pool pool) +static void MFSFinish(Inst inst) { + Pool pool = MustBeA(AbstractPool, inst); MFS mfs = MustBeA(MFSPool, pool); MFSFinishTracts(pool, MFSTractFreeVisitor, UNUSED_POINTER); mfs->sig = SigInvalid; - PoolAbsFinish(pool); + + NextMethod(Inst, MFSPool, finish)(inst); } @@ -338,10 +340,10 @@ DEFINE_CLASS(Pool, MFSPool, klass) { INHERIT_CLASS(klass, MFSPool, AbstractPool); klass->protocol.describe = MFSDescribe; + klass->protocol.finish = MFSFinish; klass->size = sizeof(MFSStruct); klass->varargs = MFSVarargs; klass->init = MFSInit; - klass->finish = MFSFinish; klass->alloc = MFSAlloc; klass->free = MFSFree; klass->totalSize = MFSTotalSize; diff --git a/mps/code/poolmrg.c b/mps/code/poolmrg.c index 5d29dcc792f..f52715fe536 100644 --- a/mps/code/poolmrg.c +++ b/mps/code/poolmrg.c @@ -637,8 +637,9 @@ static Res MRGInit(Pool pool, Arena arena, PoolClass klass, ArgList args) /* MRGFinish -- finish a MRG pool */ -static void MRGFinish(Pool pool) +static void MRGFinish(Inst inst) { + Pool pool = MustBeA(AbstractPool, inst); MRG mrg = MustBeA(MRGPool, pool); Ring node, nextNode; @@ -676,7 +677,7 @@ static void MRGFinish(Pool pool) RingFinish(&mrg->refRing); /* */ - PoolAbsFinish(pool); + NextMethod(Inst, MRGPool, finish)(inst); } @@ -842,9 +843,9 @@ DEFINE_CLASS(Pool, MRGPool, klass) { INHERIT_CLASS(klass, MRGPool, AbstractPool); klass->protocol.describe = MRGDescribe; + klass->protocol.finish = MRGFinish; klass->size = sizeof(MRGStruct); klass->init = MRGInit; - klass->finish = MRGFinish; klass->grey = PoolTrivGrey; klass->blacken = PoolTrivBlacken; klass->scan = MRGScan; diff --git a/mps/code/poolmv.c b/mps/code/poolmv.c index 0ff6c0bc455..06fad8fb398 100644 --- a/mps/code/poolmv.c +++ b/mps/code/poolmv.c @@ -305,21 +305,20 @@ static Res MVInit(Pool pool, Arena arena, PoolClass klass, ArgList args) failSpanPoolInit: PoolFinish(mvBlockPool(mv)); failBlockPoolInit: - PoolAbsFinish(pool); + NextMethod(Inst, MVPool, finish)(MustBeA(Inst, pool)); return res; } /* MVFinish -- finish method for class MV */ -static void MVFinish(Pool pool) +static void MVFinish(Inst inst) { - MV mv; + Pool pool = MustBeA(AbstractPool, inst); + MV mv = MustBeA(MVPool, pool); Ring spans, node = NULL, nextNode; /* gcc whinge stop */ MVSpan span; - AVERT(Pool, pool); - mv = PoolMV(pool); AVERT(MV, mv); /* Destroy all the spans attached to the pool. */ @@ -335,7 +334,7 @@ static void MVFinish(Pool pool) PoolFinish(mvBlockPool(mv)); PoolFinish(mvSpanPool(mv)); - PoolAbsFinish(pool); + NextMethod(Inst, MVPool, finish)(inst); } @@ -866,10 +865,10 @@ DEFINE_CLASS(Pool, MVPool, klass) { INHERIT_CLASS(klass, MVPool, AbstractBufferPool); klass->protocol.describe = MVDescribe; + klass->protocol.finish = MVFinish; klass->size = sizeof(MVStruct); klass->varargs = MVVarargs; klass->init = MVInit; - klass->finish = MVFinish; klass->alloc = MVAlloc; klass->free = MVFree; klass->totalSize = MVTotalSize; diff --git a/mps/code/poolmv2.c b/mps/code/poolmv2.c index fca7e43288d..380b67c1811 100644 --- a/mps/code/poolmv2.c +++ b/mps/code/poolmv2.c @@ -33,7 +33,7 @@ typedef struct MVTStruct *MVT; static void MVTVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs); static Res MVTInit(Pool pool, Arena arena, PoolClass klass, ArgList arg); static Bool MVTCheck(MVT mvt); -static void MVTFinish(Pool pool); +static void MVTFinish(Inst inst); static Res MVTBufferFill(Addr *baseReturn, Addr *limitReturn, Pool pool, Buffer buffer, Size minSize); static void MVTBufferEmpty(Pool pool, Buffer buffer, Addr base, Addr limit); @@ -140,10 +140,10 @@ DEFINE_CLASS(Pool, MVTPool, klass) { INHERIT_CLASS(klass, MVTPool, AbstractBufferPool); klass->protocol.describe = MVTDescribe; + klass->protocol.finish = MVTFinish; klass->size = sizeof(MVTStruct); klass->varargs = MVTVarargs; klass->init = MVTInit; - klass->finish = MVTFinish; klass->free = MVTFree; klass->bufferFill = MVTBufferFill; klass->bufferEmpty = MVTBufferEmpty; @@ -376,7 +376,7 @@ failFreeLandInit: failFreeSecondaryInit: LandFinish(MVTFreePrimary(mvt)); failFreePrimaryInit: - PoolAbsFinish(pool); + NextMethod(Inst, MVTPool, finish)(MustBeA(Inst, pool)); failAbsInit: AVER(res != ResOK); return res; @@ -421,18 +421,15 @@ static Bool MVTCheck(MVT mvt) /* MVTFinish -- finish an MVT pool */ -static void MVTFinish(Pool pool) +static void MVTFinish(Inst inst) { - MVT mvt; - Arena arena; + Pool pool = MustBeA(AbstractPool, inst); + MVT mvt = MustBeA(MVTPool, pool); + Arena arena = PoolArena(pool); Ring ring; Ring node, nextNode; - AVERT(Pool, pool); - mvt = PoolMVT(pool); AVERT(MVT, mvt); - arena = PoolArena(pool); - AVERT(Arena, arena); mvt->sig = SigInvalid; @@ -450,7 +447,8 @@ static void MVTFinish(Pool pool) LandFinish(MVTFreeLand(mvt)); LandFinish(MVTFreeSecondary(mvt)); LandFinish(MVTFreePrimary(mvt)); - PoolAbsFinish(pool); + + NextMethod(Inst, MVTPool, finish)(inst); } diff --git a/mps/code/poolmvff.c b/mps/code/poolmvff.c index 5424d70fb99..cbf55ee1df0 100644 --- a/mps/code/poolmvff.c +++ b/mps/code/poolmvff.c @@ -578,7 +578,7 @@ failFreePrimaryInit: failTotalLandInit: PoolFinish(MVFFBlockPool(mvff)); failBlockPoolInit: - PoolAbsFinish(pool); + NextMethod(Inst, MVFFPool, finish)(MustBeA(Inst, pool)); failAbsInit: AVER(res != ResOK); return res; @@ -604,13 +604,12 @@ static Bool mvffFinishVisitor(Bool *deleteReturn, Land land, Range range, return TRUE; } -static void MVFFFinish(Pool pool) +static void MVFFFinish(Inst inst) { - MVFF mvff; + Pool pool = MustBeA(AbstractPool, inst); + MVFF mvff = MustBeA(MVFFPool, pool); Bool b; - AVERT(Pool, pool); - mvff = PoolMVFF(pool); AVERT(MVFF, mvff); mvff->sig = SigInvalid; @@ -623,7 +622,7 @@ static void MVFFFinish(Pool pool) LandFinish(MVFFFreePrimary(mvff)); LandFinish(MVFFTotalLand(mvff)); PoolFinish(MVFFBlockPool(mvff)); - PoolAbsFinish(pool); + NextMethod(Inst, MVFFPool, finish)(inst); } @@ -724,10 +723,10 @@ DEFINE_CLASS(Pool, MVFFPool, klass) INHERIT_CLASS(klass, MVFFPool, AbstractPool); PoolClassMixInBuffer(klass); klass->protocol.describe = MVFFDescribe; + klass->protocol.finish = MVFFFinish; klass->size = sizeof(MVFFStruct); klass->varargs = MVFFVarargs; klass->init = MVFFInit; - klass->finish = MVFFFinish; klass->alloc = MVFFAlloc; klass->free = MVFFFree; klass->bufferFill = MVFFBufferFill; diff --git a/mps/code/pooln.c b/mps/code/pooln.c index 7111236183a..af273c4ce47 100644 --- a/mps/code/pooln.c +++ b/mps/code/pooln.c @@ -65,14 +65,15 @@ failAbsInit: /* NFinish -- finish method for class N */ -static void NFinish(Pool pool) +static void NFinish(Inst inst) { + Pool pool = MustBeA(AbstractPool, inst); PoolN poolN = MustBeA(NPool, pool); /* Finish pool-specific structures. */ UNUSED(poolN); - PoolAbsFinish(pool); + NextMethod(Inst, NPool, finish)(inst); } @@ -257,10 +258,10 @@ DEFINE_CLASS(Pool, NPool, klass) { INHERIT_CLASS(klass, NPool, AbstractPool); klass->protocol.describe = NDescribe; + klass->protocol.finish = NFinish; klass->size = sizeof(PoolNStruct); klass->attr |= AttrGC; klass->init = NInit; - klass->finish = NFinish; klass->alloc = NAlloc; klass->free = NFree; klass->bufferFill = NBufferFill; diff --git a/mps/code/poolsnc.c b/mps/code/poolsnc.c index db0cb5f6173..ff0aa62dc76 100644 --- a/mps/code/poolsnc.c +++ b/mps/code/poolsnc.c @@ -380,13 +380,12 @@ static Res SNCInit(Pool pool, Arena arena, PoolClass klass, ArgList args) /* SNCFinish -- finish an SNC pool */ -static void SNCFinish(Pool pool) +static void SNCFinish(Inst inst) { - SNC snc; + Pool pool = MustBeA(AbstractPool, inst); + SNC snc = MustBeA(SNCPool, pool); Ring ring, node, nextNode; - AVERT(Pool, pool); - snc = PoolSNC(pool); AVERT(SNC, snc); ring = &pool->segRing; @@ -396,7 +395,7 @@ static void SNCFinish(Pool pool) SegFree(seg); } - PoolAbsFinish(pool); + NextMethod(Inst, SNCPool, finish)(inst); } @@ -668,10 +667,10 @@ DEFINE_CLASS(Pool, SNCPool, klass) { INHERIT_CLASS(klass, SNCPool, AbstractScanPool); PoolClassMixInFormat(klass); + klass->protocol.finish = SNCFinish; klass->size = sizeof(SNCStruct); klass->varargs = SNCVarargs; klass->init = SNCInit; - klass->finish = SNCFinish; klass->bufferFill = SNCBufferFill; klass->bufferEmpty = SNCBufferEmpty; klass->scan = SNCScan; diff --git a/mps/code/segsmss.c b/mps/code/segsmss.c index db26cfafd4f..9162deba674 100644 --- a/mps/code/segsmss.c +++ b/mps/code/segsmss.c @@ -344,14 +344,15 @@ static Res AMSTInit(Pool pool, Arena arena, PoolClass klass, ArgList args) /* AMSTFinish -- the pool class finish method */ -static void AMSTFinish(Pool pool) +static void AMSTFinish(Inst inst) { - AMST amst; + Pool pool = MustBeA(AbstractPool, inst); + AMST amst = MustBeA(AMSTPool, pool); - AVERT(Pool, pool); - amst = PoolAMST(pool); AVERT(AMST, amst); + amst->sig = SigInvalid; + printf("\nDestroying pool, having performed:\n"); printf(" %"PRIuLONGEST" splits (S)\n", (ulongest_t)amst->splits); printf(" %"PRIuLONGEST" merges (M)\n", (ulongest_t)amst->merges); @@ -361,8 +362,7 @@ static void AMSTFinish(Pool pool) printf(" %"PRIuLONGEST" buffered splits (C)\n", (ulongest_t)amst->bsplits); printf(" %"PRIuLONGEST" buffered merges (J)\n", (ulongest_t)amst->bmerges); - AMSFinish(pool); - amst->sig = SigInvalid; + NextMethod(Inst, AMSTPool, finish)(inst); } @@ -650,9 +650,9 @@ static void AMSTStressBufferedSeg(Seg seg, Buffer buffer) DEFINE_CLASS(Pool, AMSTPool, klass) { INHERIT_CLASS(klass, AMSTPool, AMSPool); + klass->protocol.finish = AMSTFinish; klass->size = sizeof(AMSTStruct); klass->init = AMSTInit; - klass->finish = AMSTFinish; klass->bufferFill = AMSTBufferFill; }