diff --git a/mps/code/arenacl.c b/mps/code/arenacl.c index 7cc3443b470..d7672a9d6ac 100644 --- a/mps/code/arenacl.c +++ b/mps/code/arenacl.c @@ -284,7 +284,7 @@ static Res ClientArenaCreate(Arena *arenaReturn, ArgList args) arena = CouldBeA(AbstractArena, clientArena); /* */ - res = SUPERCLASS(Arena, ClientArena)->init(arena, grainSize, args); + res = NextMethod(Arena, ClientArena, init)(arena, grainSize, args); if (res != ResOK) goto failSuperInit; SetClassOfArena(arena, CLASS(ClientArena)); @@ -311,7 +311,7 @@ static Res ClientArenaCreate(Arena *arenaReturn, ArgList args) return ResOK; failChunkCreate: - SUPERCLASS(Arena, ClientArena)->finish(arena); + NextMethod(Arena, ClientArena, finish)(arena); failSuperInit: AVER(res != ResOK); return res; @@ -336,7 +336,7 @@ static void ClientArenaDestroy(Arena arena) AVER(arena->reserved == 0); AVER(arena->committed == 0); - SUPERCLASS(Arena, ClientArena)->finish(arena); /* */ + NextMethod(Arena, ClientArena, finish)(arena); /* */ } diff --git a/mps/code/arenavm.c b/mps/code/arenavm.c index 9ecbc7e1b6e..4f2669e8a44 100644 --- a/mps/code/arenavm.c +++ b/mps/code/arenavm.c @@ -206,7 +206,7 @@ static Res VMArenaDescribe(Arena arena, mps_lib_FILE *stream, Count depth) /* ...but the next method is ArenaTrivDescribe, so don't call it; * see impl.c.arena#describe.triv.dont-upcall. * - res = SUPERCLASS(Arena, VMArena)->describe(arena, stream); + res = NextMethod(Arena, VMArena, describe)(arena, stream); if (res != ResOK) return res; * @@ -554,7 +554,7 @@ static Res VMArenaCreate(Arena *arenaReturn, ArgList args) arena = VMArena2Arena(vmArena); /* */ - res = SUPERCLASS(Arena, VMArena)->init(arena, grainSize, args); + res = NextMethod(Arena, VMArena, init)(arena, grainSize, args); if (res != ResOK) goto failArenaInit; SetClassOfArena(arena, CLASS(VMArena)); @@ -608,7 +608,7 @@ static Res VMArenaCreate(Arena *arenaReturn, ArgList args) return ResOK; failChunkCreate: - SUPERCLASS(Arena, VMArena)->finish(arena); + NextMethod(Arena, VMArena, finish)(arena); failArenaInit: VMUnmap(vm, VMBase(vm), VMLimit(vm)); failVMMap: @@ -646,7 +646,7 @@ static void VMArenaDestroy(Arena arena) vmArena->sig = SigInvalid; - SUPERCLASS(Arena, VMArena)->finish(arena); /* */ + NextMethod(Arena, VMArena, finish)(arena); /* */ /* Copy VM descriptor to stack-local storage so that we can continue * using the descriptor after the VM has been unmapped. */ diff --git a/mps/code/buffer.c b/mps/code/buffer.c index 179e65ee26b..75c21866082 100644 --- a/mps/code/buffer.c +++ b/mps/code/buffer.c @@ -1233,7 +1233,7 @@ static Res segBufInit(Buffer buffer, Pool pool, Bool isMutator, ArgList args) Res res; /* Initialize the superclass fields first via next-method call */ - res = SUPERCLASS(Buffer, SegBuf)->init(buffer, pool, isMutator, args); + res = NextMethod(Buffer, SegBuf, init)(buffer, pool, isMutator, args); if (res != ResOK) return res; SetClassOfBuffer(buffer, CLASS(SegBuf)); @@ -1257,7 +1257,7 @@ static void segBufFinish(Buffer buffer) SegBuf segbuf = MustBeA(SegBuf, buffer); AVER(BufferIsReset(buffer)); segbuf->sig = SigInvalid; - SUPERCLASS(Buffer, SegBuf)->finish(buffer); + NextMethod(Buffer, SegBuf, finish)(buffer); } @@ -1365,7 +1365,7 @@ static Res segBufDescribe(Buffer buffer, mps_lib_FILE *stream, Count depth) return ResPARAM; /* Describe the superclass fields first via next-method call */ - res = SUPERCLASS(Buffer, SegBuf)->describe(buffer, stream, depth); + res = NextMethod(Buffer, SegBuf, describe)(buffer, stream, depth); if (res != ResOK) return res; @@ -1424,7 +1424,7 @@ static Res rankBufInit(Buffer buffer, Pool pool, Bool isMutator, ArgList args) AVERT(Rank, rank); /* Initialize the superclass fields first via next-method call */ - res = SUPERCLASS(Buffer, RankBuf)->init(buffer, pool, isMutator, args); + res = NextMethod(Buffer, RankBuf, init)(buffer, pool, isMutator, args); if (res != ResOK) return res; SetClassOfBuffer(buffer, CLASS(RankBuf)); diff --git a/mps/code/cbs.c b/mps/code/cbs.c index 111f86fecc7..152c0f41325 100644 --- a/mps/code/cbs.c +++ b/mps/code/cbs.c @@ -226,7 +226,7 @@ static Res cbsInitComm(Land land, LandClass class, Pool blockPool = NULL; AVER(land != NULL); - res = SUPERCLASS(Land, CBS)->init(land, arena, alignment, args); + res = NextMethod(Land, CBS, init)(land, arena, alignment, args); if (res != ResOK) return res; @@ -302,7 +302,7 @@ static void cbsFinish(Land land) if (cbs->ownPool) PoolDestroy(cbsBlockPool(cbs)); - SUPERCLASS(Land, CBS)->finish(land); /* FIXME: Method call */ + NextMethod(Land, CBS, finish)(land); /* FIXME: Method call */ } @@ -1101,7 +1101,7 @@ static Res cbsDescribe(Land land, mps_lib_FILE *stream, Count depth) if (stream == NULL) return ResPARAM; - res = SUPERCLASS(Land, CBS)->describe(land, stream, depth); + res = NextMethod(Land, CBS, describe)(land, stream, depth); if (res != ResOK) return res; diff --git a/mps/code/failover.c b/mps/code/failover.c index 05297cbcc0e..13b4be79725 100644 --- a/mps/code/failover.c +++ b/mps/code/failover.c @@ -35,7 +35,7 @@ static Res failoverInit(Land land, Arena arena, Align alignment, ArgList args) Res res; AVER(land != NULL); - res = SUPERCLASS(Land, Failover)->init(land, arena, alignment, args); + res = NextMethod(Land, Failover, init)(land, arena, alignment, args); if (res != ResOK) return res; @@ -59,7 +59,7 @@ static void failoverFinish(Land land) { Failover fo = MustBeA(Failover, land); fo->sig = SigInvalid; - SUPERCLASS(Land, Failover)->finish(land); /* FIXME: Method call */ + NextMethod(Land, Failover, finish)(land); /* FIXME: Method call */ } @@ -253,7 +253,7 @@ static Res failoverDescribe(Land land, mps_lib_FILE *stream, Count depth) if (stream == NULL) return ResPARAM; - res = SUPERCLASS(Land, Failover)->describe(land, stream, depth); + res = NextMethod(Land, Failover, describe)(land, stream, depth); if (res != ResOK) return res; diff --git a/mps/code/freelist.c b/mps/code/freelist.c index d73f82858b8..cd68e0fc2b8 100644 --- a/mps/code/freelist.c +++ b/mps/code/freelist.c @@ -192,7 +192,7 @@ static Res freelistInit(Land land, Arena arena, Align alignment, ArgList args) Res res; AVER(land != NULL); - res = SUPERCLASS(Land, Freelist)->init(land, arena, alignment, args); + res = NextMethod(Land, Freelist, init)(land, arena, alignment, args); if (res != ResOK) return res; @@ -217,7 +217,7 @@ static void freelistFinish(Land land) Freelist fl = MustBeA(Freelist, land); fl->sig = SigInvalid; fl->list = freelistEND; - SUPERCLASS(Land, Freelist)->finish(land); /* FIXME: Method call */ + NextMethod(Land, Freelist, finish)(land); /* FIXME: Method call */ } @@ -758,7 +758,7 @@ static Res freelistDescribe(Land land, mps_lib_FILE *stream, Count depth) return ResPARAM; /* FIXME: Should use the class from the land itself. */ - res = SUPERCLASS(Land, Freelist)->describe(land, stream, depth); + res = NextMethod(Land, Freelist, describe)(land, stream, depth); if (res != ResOK) return res; diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c index 7fe6bdc0f66..b6aecf9a6cd 100644 --- a/mps/code/poolamc.c +++ b/mps/code/poolamc.c @@ -137,7 +137,7 @@ static Res AMCSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args) amcgen = arg.val.p; /* Initialize the superclass fields first via next-method call */ - res = SUPERCLASS(Seg, amcSeg)->init(seg, pool, base, size, args); + res = NextMethod(Seg, amcSeg, init)(seg, pool, base, size, args); if(res != ResOK) return res; SetClassOfSeg(seg, CLASS(amcSeg)); @@ -251,7 +251,7 @@ static Res AMCSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth) return ResFAIL; /* Describe the superclass fields first via next-method call */ - res = SUPERCLASS(Seg, amcSeg)->describe(seg, stream, depth); + res = NextMethod(Seg, amcSeg, describe)(seg, stream, depth); if(res != ResOK) return res; @@ -494,7 +494,7 @@ static Res AMCBufInit(Buffer buffer, Pool pool, Bool isMutator, ArgList args) forHashArrays = arg.val.b; /* call next method */ - res = SUPERCLASS(Buffer, amcBuf)->init(buffer, pool, isMutator, args); + res = NextMethod(Buffer, amcBuf, init)(buffer, pool, isMutator, args); if(res != ResOK) return res; SetClassOfBuffer(buffer, CLASS(amcBuf)); @@ -524,7 +524,7 @@ static void AMCBufFinish(Buffer buffer) { amcBuf amcbuf = MustBeA(amcBuf, buffer); amcbuf->sig = SigInvalid; - SUPERCLASS(Buffer, amcBuf)->finish(buffer); + NextMethod(Buffer, amcBuf, finish)(buffer); } diff --git a/mps/code/poolams.c b/mps/code/poolams.c index fcca0a3140a..833155f72d4 100644 --- a/mps/code/poolams.c +++ b/mps/code/poolams.c @@ -223,7 +223,7 @@ static Res AMSSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args) AMS ams; /* Initialize the superclass fields first via next-method call */ - res = SUPERCLASS(Seg, AMSSeg)->init(seg, pool, base, size, args); + res = NextMethod(Seg, AMSSeg, init)(seg, pool, base, size, args); if (res != ResOK) goto failNextMethod; SetClassOfSeg(seg, CLASS(AMSSeg)); @@ -264,7 +264,7 @@ static Res AMSSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args) return ResOK; failCreateTables: - SUPERCLASS(Seg, AMSSeg)->finish(seg); + NextMethod(Seg, AMSSeg, finish)(seg); failNextMethod: AVER(res != ResOK); return res; @@ -297,7 +297,7 @@ static void AMSSegFinish(Seg seg) amsseg->sig = SigInvalid; /* finish the superclass fields last */ - SUPERCLASS(Seg, AMSSeg)->finish(seg); + NextMethod(Seg, AMSSeg, finish)(seg); } @@ -359,7 +359,7 @@ static Res AMSSegMerge(Seg seg, Seg segHi, goto failCreateTables; /* Merge the superclass fields via next-method call */ - res = SUPERCLASS(Seg, AMSSeg)->merge(seg, segHi, base, mid, limit); + res = NextMethod(Seg, AMSSeg, merge)(seg, segHi, base, mid, limit); if (res != ResOK) goto failSuper; @@ -450,7 +450,7 @@ static Res AMSSegSplit(Seg seg, Seg segHi, /* Split the superclass fields via next-method call */ - res = SUPERCLASS(Seg, AMSSeg)->split(seg, segHi, base, mid, limit); + res = NextMethod(Seg, AMSSeg, split)(seg, segHi, base, mid, limit); if (res != ResOK) goto failSuper; @@ -536,7 +536,7 @@ static Res AMSSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth) return ResFAIL; /* Describe the superclass fields first via next-method call */ - res = SUPERCLASS(Seg, AMSSeg)->describe(seg, stream, depth); + res = NextMethod(Seg, AMSSeg, describe)(seg, stream, depth); if (res != ResOK) return res; diff --git a/mps/code/poolawl.c b/mps/code/poolawl.c index 902d7fe66a4..2406ee27691 100644 --- a/mps/code/poolawl.c +++ b/mps/code/poolawl.c @@ -195,7 +195,7 @@ static Res AWLSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args) || RankSetSingle(RankWEAK) == rankSet); /* Initialize the superclass fields first via next-method call */ - res = SUPERCLASS(Seg, AWLSeg)->init(seg, pool, base, size, args); + res = NextMethod(Seg, AWLSeg, init)(seg, pool, base, size, args); if (res != ResOK) goto failSuperInit; SetClassOfSeg(seg, CLASS(AWLSeg)); @@ -240,7 +240,7 @@ failControlAllocAlloc: failControlAllocScanned: ControlFree(arena, awlseg->mark, tableSize); failControlAllocMark: - SUPERCLASS(Seg, AWLSeg)->finish(seg); + NextMethod(Seg, AWLSeg, finish)(seg); failSuperInit: AVER(res != ResOK); return res; @@ -279,7 +279,7 @@ static void AWLSegFinish(Seg seg) awlseg->sig = SigInvalid; /* finish the superclass fields last */ - SUPERCLASS(Seg, AWLSeg)->finish(seg); + NextMethod(Seg, AWLSeg, finish)(seg); } diff --git a/mps/code/poollo.c b/mps/code/poollo.c index 6b4f27b310c..65aad7c79c3 100644 --- a/mps/code/poollo.c +++ b/mps/code/poollo.c @@ -110,7 +110,7 @@ static Res loSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args) void *p; /* Initialize the superclass fields first via next-method call */ - res = SUPERCLASS(Seg, LOSeg)->init(seg, pool, base, size, args); + res = NextMethod(Seg, LOSeg, init)(seg, pool, base, size, args); if(res != ResOK) goto failSuperInit; SetClassOfSeg(seg, CLASS(LOSeg)); @@ -146,7 +146,7 @@ static Res loSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args) failAllocTable: ControlFree(arena, loseg->mark, tablebytes); failMarkTable: - SUPERCLASS(Seg, LOSeg)->finish(seg); + NextMethod(Seg, LOSeg, finish)(seg); failSuperInit: AVER(res != ResOK); return res; @@ -179,7 +179,7 @@ static void loSegFinish(Seg seg) loseg->sig = SigInvalid; /* finish the superclass fields last */ - SUPERCLASS(Seg, LOSeg)->finish(seg); + NextMethod(Seg, LOSeg, finish)(seg); } diff --git a/mps/code/poolmrg.c b/mps/code/poolmrg.c index 410e155b3cb..9118752d311 100644 --- a/mps/code/poolmrg.c +++ b/mps/code/poolmrg.c @@ -227,7 +227,7 @@ static Res MRGLinkSegInit(Seg seg, Pool pool, Addr base, Size size, Res res; /* Initialize the superclass fields first via next-method call */ - res = SUPERCLASS(Seg, MRGLinkSeg)->init(seg, pool, base, size, args); + res = NextMethod(Seg, MRGLinkSeg, init)(seg, pool, base, size, args); if (res != ResOK) return res; SetClassOfSeg(seg, CLASS(MRGLinkSeg)); @@ -267,7 +267,7 @@ static Res MRGRefSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args) linkseg = arg.val.p; /* Initialize the superclass fields first via next-method call */ - res = SUPERCLASS(Seg, MRGRefSeg)->init(seg, pool, base, size, args); + res = NextMethod(Seg, MRGRefSeg, init)(seg, pool, base, size, args); if (res != ResOK) return res; SetClassOfSeg(seg, CLASS(MRGRefSeg)); diff --git a/mps/code/poolsnc.c b/mps/code/poolsnc.c index b7337700ef9..672e9aa5b43 100644 --- a/mps/code/poolsnc.c +++ b/mps/code/poolsnc.c @@ -119,7 +119,7 @@ static Res SNCBufInit(Buffer buffer, Pool pool, Bool isMutator, ArgList args) Res res; /* call next method */ - res = SUPERCLASS(Buffer, SNCBuf)->init(buffer, pool, isMutator, args); + res = NextMethod(Buffer, SNCBuf, init)(buffer, pool, isMutator, args); if (res != ResOK) return res; SetClassOfBuffer(buffer, CLASS(SNCBuf)); @@ -145,7 +145,7 @@ static void SNCBufFinish(Buffer buffer) sncbuf->sig = SigInvalid; - SUPERCLASS(Buffer, SNCBuf)->finish(buffer); + NextMethod(Buffer, SNCBuf, finish)(buffer); } @@ -205,7 +205,7 @@ static Res sncSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args) Res res; /* Initialize the superclass fields first via next-method call */ - res = SUPERCLASS(Seg, SNCSeg)->init(seg, pool, base, size, args); + res = NextMethod(Seg, SNCSeg, init)(seg, pool, base, size, args); if (res != ResOK) return res; SetClassOfSeg(seg, CLASS(SNCSeg)); diff --git a/mps/code/protocol.h b/mps/code/protocol.h index f2165ff72af..2c5da2201f3 100644 --- a/mps/code/protocol.h +++ b/mps/code/protocol.h @@ -189,26 +189,32 @@ extern void InstFinish(Inst inst); BEGIN MustBeA(Inst, inst)->class = (InstClass)(_class); END -/* SUPERCLASS - get the superclass object, given a class name +/* NextMethod -- call a method in the superclass * * See design.mps.protocol.int.static-superclass. * - * TODO: Several experiments with statically generating some kind of - * SUPERCLASS lookup have failed because the names of types, classes, - * and the hierarchy are inconsistent. Revisit this later. - * - * FIXME: Most uses of SUPERCLASS compile to constant expressions, but - * not that the compiler can tell. + * TODO: All uses of NextMethod are statically known, but several + * experiments with statically generating some kind of SUPERCLASS + * lookup have failed because the names of types, classes, and the + * hierarchy are inconsistent. Revisit this later. */ #define SUPERCLASS(kind, ident) \ ((CLASS_TYPE(kind))((InstClass)CLASS(ident))->superclass) +#define NextMethod(kind, ident, meth) (SUPERCLASS(kind, ident)->meth) -/* IsA, CouldBeA, MustBeA -- coerce instances safely + +/* IsA, CouldBeA, MustBeA -- coerce instances * - * FIXME: Wrap mps_lib_assert_fail_expr in check.h so that it is - * elided from some varieties. + * CouldBeA converts an instance to another class without checking. + * It is intended to be equivalent to the C++ "static_cast", although + * since this is C there is no actual static checking, so in fact it's + * more like "reinterpret_cast". + * + * MustBeA converts an instance to another class, but checks that the + * object is a subclass, causing an assertion if not (depending on + * build variety). It is like C++ "dynamic_cast" with an assert. */ #define CouldBeA(class, inst) ((INST_TYPE(class))inst) @@ -230,6 +236,7 @@ extern void InstFinish(Inst inst); #define MustBeA_CRITICAL(_class, inst) \ CouldBeA(_class, AVERP_CRITICAL(IsNonNullAndA(_class, inst), inst)) + /* ClassOf* -- get the class of an instance */ #define CLASS_DECLARE_CLASSOF(prefix, ident, kind, super) \ diff --git a/mps/code/seg.c b/mps/code/seg.c index f0f2b2420e1..1224accdee0 100644 --- a/mps/code/seg.c +++ b/mps/code/seg.c @@ -1067,7 +1067,7 @@ static Res gcSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args) Res res; /* Initialize the superclass fields first via next-method call */ - res = SUPERCLASS(Seg, GCSeg)->init(seg, pool, base, size, args); + res = NextMethod(Seg, GCSeg, init)(seg, pool, base, size, args); if (ResOK != res) return res; SetClassOfSeg(seg, CLASS(GCSeg)); @@ -1108,7 +1108,7 @@ static void gcSegFinish(Seg seg) RingFinish(&gcseg->greyRing); /* finish the superclass fields last */ - SUPERCLASS(Seg, GCSeg)->finish(seg); + NextMethod(Seg, GCSeg, finish)(seg); } @@ -1443,7 +1443,7 @@ static Res gcSegMerge(Seg seg, Seg segHi, } /* Merge the superclass fields via next-method call */ - res = SUPERCLASS(Seg, GCSeg)->merge(seg, segHi, base, mid, limit); + res = NextMethod(Seg, GCSeg, merge)(seg, segHi, base, mid, limit); if (res != ResOK) goto failSuper; @@ -1503,7 +1503,7 @@ static Res gcSegSplit(Seg seg, Seg segHi, } /* Split the superclass fields via next-method call */ - res = SUPERCLASS(Seg, GCSeg)->split(seg, segHi, base, mid, limit); + res = NextMethod(Seg, GCSeg, split)(seg, segHi, base, mid, limit); if (res != ResOK) goto failSuper; @@ -1547,7 +1547,7 @@ static Res gcSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth) return ResFAIL; /* Describe the superclass fields first via next-method call */ - res = SUPERCLASS(Seg, GCSeg)->describe(seg, stream, depth); + res = NextMethod(Seg, GCSeg, describe)(seg, stream, depth); if (res != ResOK) return res; diff --git a/mps/code/segsmss.c b/mps/code/segsmss.c index 9e1a5d92ca6..e82f2c6285a 100644 --- a/mps/code/segsmss.c +++ b/mps/code/segsmss.c @@ -119,7 +119,7 @@ static Res amstSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args) Res res; /* Initialize the superclass fields first via next-method call */ - res = SUPERCLASS(Seg, AMSTSeg)->init(seg, pool, base, size, args); + res = NextMethod(Seg, AMSTSeg, init)(seg, pool, base, size, args); if (res != ResOK) return res; SetClassOfSeg(seg, CLASS(AMSTSeg)); @@ -157,7 +157,7 @@ static void amstSegFinish(Seg seg) amstseg->sig = SigInvalid; /* finish the superclass fields last */ - SUPERCLASS(Seg, AMSTSeg)->finish(seg); + NextMethod(Seg, AMSTSeg, finish)(seg); } @@ -187,7 +187,7 @@ static Res amstSegMerge(Seg seg, Seg segHi, amst = PoolAMST(SegPool(seg)); /* Merge the superclass fields via direct next-method call */ - res = SUPERCLASS(Seg, AMSTSeg)->merge(seg, segHi, base, mid, limit); + res = NextMethod(Seg, AMSTSeg, merge)(seg, segHi, base, mid, limit); if (res != ResOK) goto failSuper; @@ -206,7 +206,7 @@ static Res amstSegMerge(Seg seg, Seg segHi, failDeliberate: /* Call the anti-method (see .fail) */ - res = SUPERCLASS(Seg, AMSTSeg)->split(seg, segHi, base, mid, limit); + res = NextMethod(Seg, AMSTSeg, split)(seg, segHi, base, mid, limit); AVER(res == ResOK); res = ResFAIL; failSuper: @@ -233,7 +233,7 @@ static Res amstSegSplit(Seg seg, Seg segHi, amst = PoolAMST(SegPool(seg)); /* Split the superclass fields via direct next-method call */ - res = SUPERCLASS(Seg, AMSTSeg)->split(seg, segHi, base, mid, limit); + res = NextMethod(Seg, AMSTSeg, split)(seg, segHi, base, mid, limit); if (res != ResOK) goto failSuper; @@ -256,7 +256,7 @@ static Res amstSegSplit(Seg seg, Seg segHi, failDeliberate: /* Call the anti-method. (see .fail) */ - res = SUPERCLASS(Seg, AMSTSeg)->merge(seg, segHi, base, mid, limit); + res = NextMethod(Seg, AMSTSeg, merge)(seg, segHi, base, mid, limit); AVER(res == ResOK); res = ResFAIL; failSuper: @@ -536,7 +536,7 @@ static Res AMSTBufferFill(Addr *baseReturn, Addr *limitReturn, amst = PoolAMST(pool); /* call next method */ - res = SUPERCLASS(Pool, AMSTPool)->bufferFill(&base, &limit, pool, buffer, size); + res = NextMethod(Pool, AMSTPool, bufferFill)(&base, &limit, pool, buffer, size); if (res != ResOK) return res;