mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-13 09:30:24 -08:00
Implementing nextmethod and replacing all uses of superclass with it.
Copied from Perforce Change: 190935 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
bfa333b5c0
commit
309fb8ec64
15 changed files with 70 additions and 63 deletions
|
|
@ -284,7 +284,7 @@ static Res ClientArenaCreate(Arena *arenaReturn, ArgList args)
|
||||||
|
|
||||||
arena = CouldBeA(AbstractArena, clientArena);
|
arena = CouldBeA(AbstractArena, clientArena);
|
||||||
/* <code/arena.c#init.caller> */
|
/* <code/arena.c#init.caller> */
|
||||||
res = SUPERCLASS(Arena, ClientArena)->init(arena, grainSize, args);
|
res = NextMethod(Arena, ClientArena, init)(arena, grainSize, args);
|
||||||
if (res != ResOK)
|
if (res != ResOK)
|
||||||
goto failSuperInit;
|
goto failSuperInit;
|
||||||
SetClassOfArena(arena, CLASS(ClientArena));
|
SetClassOfArena(arena, CLASS(ClientArena));
|
||||||
|
|
@ -311,7 +311,7 @@ static Res ClientArenaCreate(Arena *arenaReturn, ArgList args)
|
||||||
return ResOK;
|
return ResOK;
|
||||||
|
|
||||||
failChunkCreate:
|
failChunkCreate:
|
||||||
SUPERCLASS(Arena, ClientArena)->finish(arena);
|
NextMethod(Arena, ClientArena, finish)(arena);
|
||||||
failSuperInit:
|
failSuperInit:
|
||||||
AVER(res != ResOK);
|
AVER(res != ResOK);
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -336,7 +336,7 @@ static void ClientArenaDestroy(Arena arena)
|
||||||
AVER(arena->reserved == 0);
|
AVER(arena->reserved == 0);
|
||||||
AVER(arena->committed == 0);
|
AVER(arena->committed == 0);
|
||||||
|
|
||||||
SUPERCLASS(Arena, ClientArena)->finish(arena); /* <code/arena.c#finish.caller> */
|
NextMethod(Arena, ClientArena, finish)(arena); /* <code/arena.c#finish.caller> */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
/* ...but the next method is ArenaTrivDescribe, so don't call it;
|
||||||
* see impl.c.arena#describe.triv.dont-upcall.
|
* 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)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
*
|
*
|
||||||
|
|
@ -554,7 +554,7 @@ static Res VMArenaCreate(Arena *arenaReturn, ArgList args)
|
||||||
|
|
||||||
arena = VMArena2Arena(vmArena);
|
arena = VMArena2Arena(vmArena);
|
||||||
/* <code/arena.c#init.caller> */
|
/* <code/arena.c#init.caller> */
|
||||||
res = SUPERCLASS(Arena, VMArena)->init(arena, grainSize, args);
|
res = NextMethod(Arena, VMArena, init)(arena, grainSize, args);
|
||||||
if (res != ResOK)
|
if (res != ResOK)
|
||||||
goto failArenaInit;
|
goto failArenaInit;
|
||||||
SetClassOfArena(arena, CLASS(VMArena));
|
SetClassOfArena(arena, CLASS(VMArena));
|
||||||
|
|
@ -608,7 +608,7 @@ static Res VMArenaCreate(Arena *arenaReturn, ArgList args)
|
||||||
return ResOK;
|
return ResOK;
|
||||||
|
|
||||||
failChunkCreate:
|
failChunkCreate:
|
||||||
SUPERCLASS(Arena, VMArena)->finish(arena);
|
NextMethod(Arena, VMArena, finish)(arena);
|
||||||
failArenaInit:
|
failArenaInit:
|
||||||
VMUnmap(vm, VMBase(vm), VMLimit(vm));
|
VMUnmap(vm, VMBase(vm), VMLimit(vm));
|
||||||
failVMMap:
|
failVMMap:
|
||||||
|
|
@ -646,7 +646,7 @@ static void VMArenaDestroy(Arena arena)
|
||||||
|
|
||||||
vmArena->sig = SigInvalid;
|
vmArena->sig = SigInvalid;
|
||||||
|
|
||||||
SUPERCLASS(Arena, VMArena)->finish(arena); /* <code/global.c#finish.caller> */
|
NextMethod(Arena, VMArena, finish)(arena); /* <code/global.c#finish.caller> */
|
||||||
|
|
||||||
/* Copy VM descriptor to stack-local storage so that we can continue
|
/* Copy VM descriptor to stack-local storage so that we can continue
|
||||||
* using the descriptor after the VM has been unmapped. */
|
* using the descriptor after the VM has been unmapped. */
|
||||||
|
|
|
||||||
|
|
@ -1233,7 +1233,7 @@ static Res segBufInit(Buffer buffer, Pool pool, Bool isMutator, ArgList args)
|
||||||
Res res;
|
Res res;
|
||||||
|
|
||||||
/* Initialize the superclass fields first via next-method call */
|
/* 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)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
SetClassOfBuffer(buffer, CLASS(SegBuf));
|
SetClassOfBuffer(buffer, CLASS(SegBuf));
|
||||||
|
|
@ -1257,7 +1257,7 @@ static void segBufFinish(Buffer buffer)
|
||||||
SegBuf segbuf = MustBeA(SegBuf, buffer);
|
SegBuf segbuf = MustBeA(SegBuf, buffer);
|
||||||
AVER(BufferIsReset(buffer));
|
AVER(BufferIsReset(buffer));
|
||||||
segbuf->sig = SigInvalid;
|
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;
|
return ResPARAM;
|
||||||
|
|
||||||
/* Describe the superclass fields first via next-method call */
|
/* 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)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
|
@ -1424,7 +1424,7 @@ static Res rankBufInit(Buffer buffer, Pool pool, Bool isMutator, ArgList args)
|
||||||
AVERT(Rank, rank);
|
AVERT(Rank, rank);
|
||||||
|
|
||||||
/* Initialize the superclass fields first via next-method call */
|
/* 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)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
SetClassOfBuffer(buffer, CLASS(RankBuf));
|
SetClassOfBuffer(buffer, CLASS(RankBuf));
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,7 @@ static Res cbsInitComm(Land land, LandClass class,
|
||||||
Pool blockPool = NULL;
|
Pool blockPool = NULL;
|
||||||
|
|
||||||
AVER(land != 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)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
|
@ -302,7 +302,7 @@ static void cbsFinish(Land land)
|
||||||
if (cbs->ownPool)
|
if (cbs->ownPool)
|
||||||
PoolDestroy(cbsBlockPool(cbs));
|
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)
|
if (stream == NULL)
|
||||||
return ResPARAM;
|
return ResPARAM;
|
||||||
|
|
||||||
res = SUPERCLASS(Land, CBS)->describe(land, stream, depth);
|
res = NextMethod(Land, CBS, describe)(land, stream, depth);
|
||||||
if (res != ResOK)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ static Res failoverInit(Land land, Arena arena, Align alignment, ArgList args)
|
||||||
Res res;
|
Res res;
|
||||||
|
|
||||||
AVER(land != NULL);
|
AVER(land != NULL);
|
||||||
res = SUPERCLASS(Land, Failover)->init(land, arena, alignment, args);
|
res = NextMethod(Land, Failover, init)(land, arena, alignment, args);
|
||||||
if (res != ResOK)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
|
@ -59,7 +59,7 @@ static void failoverFinish(Land land)
|
||||||
{
|
{
|
||||||
Failover fo = MustBeA(Failover, land);
|
Failover fo = MustBeA(Failover, land);
|
||||||
fo->sig = SigInvalid;
|
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)
|
if (stream == NULL)
|
||||||
return ResPARAM;
|
return ResPARAM;
|
||||||
|
|
||||||
res = SUPERCLASS(Land, Failover)->describe(land, stream, depth);
|
res = NextMethod(Land, Failover, describe)(land, stream, depth);
|
||||||
if (res != ResOK)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ static Res freelistInit(Land land, Arena arena, Align alignment, ArgList args)
|
||||||
Res res;
|
Res res;
|
||||||
|
|
||||||
AVER(land != NULL);
|
AVER(land != NULL);
|
||||||
res = SUPERCLASS(Land, Freelist)->init(land, arena, alignment, args);
|
res = NextMethod(Land, Freelist, init)(land, arena, alignment, args);
|
||||||
if (res != ResOK)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
|
@ -217,7 +217,7 @@ static void freelistFinish(Land land)
|
||||||
Freelist fl = MustBeA(Freelist, land);
|
Freelist fl = MustBeA(Freelist, land);
|
||||||
fl->sig = SigInvalid;
|
fl->sig = SigInvalid;
|
||||||
fl->list = freelistEND;
|
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;
|
return ResPARAM;
|
||||||
|
|
||||||
/* FIXME: Should use the class from the land itself. */
|
/* 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)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ static Res AMCSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
|
||||||
amcgen = arg.val.p;
|
amcgen = arg.val.p;
|
||||||
|
|
||||||
/* Initialize the superclass fields first via next-method call */
|
/* 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)
|
if(res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
SetClassOfSeg(seg, CLASS(amcSeg));
|
SetClassOfSeg(seg, CLASS(amcSeg));
|
||||||
|
|
@ -251,7 +251,7 @@ static Res AMCSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth)
|
||||||
return ResFAIL;
|
return ResFAIL;
|
||||||
|
|
||||||
/* Describe the superclass fields first via next-method call */
|
/* 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)
|
if(res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
|
@ -494,7 +494,7 @@ static Res AMCBufInit(Buffer buffer, Pool pool, Bool isMutator, ArgList args)
|
||||||
forHashArrays = arg.val.b;
|
forHashArrays = arg.val.b;
|
||||||
|
|
||||||
/* call next method */
|
/* call next method */
|
||||||
res = SUPERCLASS(Buffer, amcBuf)->init(buffer, pool, isMutator, args);
|
res = NextMethod(Buffer, amcBuf, init)(buffer, pool, isMutator, args);
|
||||||
if(res != ResOK)
|
if(res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
SetClassOfBuffer(buffer, CLASS(amcBuf));
|
SetClassOfBuffer(buffer, CLASS(amcBuf));
|
||||||
|
|
@ -524,7 +524,7 @@ static void AMCBufFinish(Buffer buffer)
|
||||||
{
|
{
|
||||||
amcBuf amcbuf = MustBeA(amcBuf, buffer);
|
amcBuf amcbuf = MustBeA(amcBuf, buffer);
|
||||||
amcbuf->sig = SigInvalid;
|
amcbuf->sig = SigInvalid;
|
||||||
SUPERCLASS(Buffer, amcBuf)->finish(buffer);
|
NextMethod(Buffer, amcBuf, finish)(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ static Res AMSSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
|
||||||
AMS ams;
|
AMS ams;
|
||||||
|
|
||||||
/* Initialize the superclass fields first via next-method call */
|
/* 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)
|
if (res != ResOK)
|
||||||
goto failNextMethod;
|
goto failNextMethod;
|
||||||
SetClassOfSeg(seg, CLASS(AMSSeg));
|
SetClassOfSeg(seg, CLASS(AMSSeg));
|
||||||
|
|
@ -264,7 +264,7 @@ static Res AMSSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
|
||||||
return ResOK;
|
return ResOK;
|
||||||
|
|
||||||
failCreateTables:
|
failCreateTables:
|
||||||
SUPERCLASS(Seg, AMSSeg)->finish(seg);
|
NextMethod(Seg, AMSSeg, finish)(seg);
|
||||||
failNextMethod:
|
failNextMethod:
|
||||||
AVER(res != ResOK);
|
AVER(res != ResOK);
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -297,7 +297,7 @@ static void AMSSegFinish(Seg seg)
|
||||||
amsseg->sig = SigInvalid;
|
amsseg->sig = SigInvalid;
|
||||||
|
|
||||||
/* finish the superclass fields last */
|
/* 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;
|
goto failCreateTables;
|
||||||
|
|
||||||
/* Merge the superclass fields via next-method call */
|
/* 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)
|
if (res != ResOK)
|
||||||
goto failSuper;
|
goto failSuper;
|
||||||
|
|
||||||
|
|
@ -450,7 +450,7 @@ static Res AMSSegSplit(Seg seg, Seg segHi,
|
||||||
|
|
||||||
|
|
||||||
/* Split the superclass fields via next-method call */
|
/* 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)
|
if (res != ResOK)
|
||||||
goto failSuper;
|
goto failSuper;
|
||||||
|
|
||||||
|
|
@ -536,7 +536,7 @@ static Res AMSSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth)
|
||||||
return ResFAIL;
|
return ResFAIL;
|
||||||
|
|
||||||
/* Describe the superclass fields first via next-method call */
|
/* 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)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,7 @@ static Res AWLSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
|
||||||
|| RankSetSingle(RankWEAK) == rankSet);
|
|| RankSetSingle(RankWEAK) == rankSet);
|
||||||
|
|
||||||
/* Initialize the superclass fields first via next-method call */
|
/* 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)
|
if (res != ResOK)
|
||||||
goto failSuperInit;
|
goto failSuperInit;
|
||||||
SetClassOfSeg(seg, CLASS(AWLSeg));
|
SetClassOfSeg(seg, CLASS(AWLSeg));
|
||||||
|
|
@ -240,7 +240,7 @@ failControlAllocAlloc:
|
||||||
failControlAllocScanned:
|
failControlAllocScanned:
|
||||||
ControlFree(arena, awlseg->mark, tableSize);
|
ControlFree(arena, awlseg->mark, tableSize);
|
||||||
failControlAllocMark:
|
failControlAllocMark:
|
||||||
SUPERCLASS(Seg, AWLSeg)->finish(seg);
|
NextMethod(Seg, AWLSeg, finish)(seg);
|
||||||
failSuperInit:
|
failSuperInit:
|
||||||
AVER(res != ResOK);
|
AVER(res != ResOK);
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -279,7 +279,7 @@ static void AWLSegFinish(Seg seg)
|
||||||
awlseg->sig = SigInvalid;
|
awlseg->sig = SigInvalid;
|
||||||
|
|
||||||
/* finish the superclass fields last */
|
/* finish the superclass fields last */
|
||||||
SUPERCLASS(Seg, AWLSeg)->finish(seg);
|
NextMethod(Seg, AWLSeg, finish)(seg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ static Res loSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
/* Initialize the superclass fields first via next-method call */
|
/* 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)
|
if(res != ResOK)
|
||||||
goto failSuperInit;
|
goto failSuperInit;
|
||||||
SetClassOfSeg(seg, CLASS(LOSeg));
|
SetClassOfSeg(seg, CLASS(LOSeg));
|
||||||
|
|
@ -146,7 +146,7 @@ static Res loSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
|
||||||
failAllocTable:
|
failAllocTable:
|
||||||
ControlFree(arena, loseg->mark, tablebytes);
|
ControlFree(arena, loseg->mark, tablebytes);
|
||||||
failMarkTable:
|
failMarkTable:
|
||||||
SUPERCLASS(Seg, LOSeg)->finish(seg);
|
NextMethod(Seg, LOSeg, finish)(seg);
|
||||||
failSuperInit:
|
failSuperInit:
|
||||||
AVER(res != ResOK);
|
AVER(res != ResOK);
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -179,7 +179,7 @@ static void loSegFinish(Seg seg)
|
||||||
loseg->sig = SigInvalid;
|
loseg->sig = SigInvalid;
|
||||||
|
|
||||||
/* finish the superclass fields last */
|
/* finish the superclass fields last */
|
||||||
SUPERCLASS(Seg, LOSeg)->finish(seg);
|
NextMethod(Seg, LOSeg, finish)(seg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ static Res MRGLinkSegInit(Seg seg, Pool pool, Addr base, Size size,
|
||||||
Res res;
|
Res res;
|
||||||
|
|
||||||
/* Initialize the superclass fields first via next-method call */
|
/* 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)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
SetClassOfSeg(seg, CLASS(MRGLinkSeg));
|
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;
|
linkseg = arg.val.p;
|
||||||
|
|
||||||
/* Initialize the superclass fields first via next-method call */
|
/* 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)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
SetClassOfSeg(seg, CLASS(MRGRefSeg));
|
SetClassOfSeg(seg, CLASS(MRGRefSeg));
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ static Res SNCBufInit(Buffer buffer, Pool pool, Bool isMutator, ArgList args)
|
||||||
Res res;
|
Res res;
|
||||||
|
|
||||||
/* call next method */
|
/* call next method */
|
||||||
res = SUPERCLASS(Buffer, SNCBuf)->init(buffer, pool, isMutator, args);
|
res = NextMethod(Buffer, SNCBuf, init)(buffer, pool, isMutator, args);
|
||||||
if (res != ResOK)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
SetClassOfBuffer(buffer, CLASS(SNCBuf));
|
SetClassOfBuffer(buffer, CLASS(SNCBuf));
|
||||||
|
|
@ -145,7 +145,7 @@ static void SNCBufFinish(Buffer buffer)
|
||||||
|
|
||||||
sncbuf->sig = SigInvalid;
|
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;
|
Res res;
|
||||||
|
|
||||||
/* Initialize the superclass fields first via next-method call */
|
/* 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)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
SetClassOfSeg(seg, CLASS(SNCSeg));
|
SetClassOfSeg(seg, CLASS(SNCSeg));
|
||||||
|
|
|
||||||
|
|
@ -189,26 +189,32 @@ extern void InstFinish(Inst inst);
|
||||||
BEGIN MustBeA(Inst, inst)->class = (InstClass)(_class); END
|
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.
|
* See design.mps.protocol.int.static-superclass.
|
||||||
*
|
*
|
||||||
* TODO: Several experiments with statically generating some kind of
|
* TODO: All uses of NextMethod are statically known, but several
|
||||||
* SUPERCLASS lookup have failed because the names of types, classes,
|
* experiments with statically generating some kind of SUPERCLASS
|
||||||
* and the hierarchy are inconsistent. Revisit this later.
|
* 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SUPERCLASS(kind, ident) \
|
#define SUPERCLASS(kind, ident) \
|
||||||
((CLASS_TYPE(kind))((InstClass)CLASS(ident))->superclass)
|
((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
|
* CouldBeA converts an instance to another class without checking.
|
||||||
* elided from some varieties.
|
* 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)
|
#define CouldBeA(class, inst) ((INST_TYPE(class))inst)
|
||||||
|
|
@ -230,6 +236,7 @@ extern void InstFinish(Inst inst);
|
||||||
#define MustBeA_CRITICAL(_class, inst) \
|
#define MustBeA_CRITICAL(_class, inst) \
|
||||||
CouldBeA(_class, AVERP_CRITICAL(IsNonNullAndA(_class, inst), inst))
|
CouldBeA(_class, AVERP_CRITICAL(IsNonNullAndA(_class, inst), inst))
|
||||||
|
|
||||||
|
|
||||||
/* ClassOf* -- get the class of an instance */
|
/* ClassOf* -- get the class of an instance */
|
||||||
|
|
||||||
#define CLASS_DECLARE_CLASSOF(prefix, ident, kind, super) \
|
#define CLASS_DECLARE_CLASSOF(prefix, ident, kind, super) \
|
||||||
|
|
|
||||||
|
|
@ -1067,7 +1067,7 @@ static Res gcSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
|
||||||
Res res;
|
Res res;
|
||||||
|
|
||||||
/* Initialize the superclass fields first via next-method call */
|
/* 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)
|
if (ResOK != res)
|
||||||
return res;
|
return res;
|
||||||
SetClassOfSeg(seg, CLASS(GCSeg));
|
SetClassOfSeg(seg, CLASS(GCSeg));
|
||||||
|
|
@ -1108,7 +1108,7 @@ static void gcSegFinish(Seg seg)
|
||||||
RingFinish(&gcseg->greyRing);
|
RingFinish(&gcseg->greyRing);
|
||||||
|
|
||||||
/* finish the superclass fields last */
|
/* 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 */
|
/* 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)
|
if (res != ResOK)
|
||||||
goto failSuper;
|
goto failSuper;
|
||||||
|
|
||||||
|
|
@ -1503,7 +1503,7 @@ static Res gcSegSplit(Seg seg, Seg segHi,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Split the superclass fields via next-method call */
|
/* 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)
|
if (res != ResOK)
|
||||||
goto failSuper;
|
goto failSuper;
|
||||||
|
|
||||||
|
|
@ -1547,7 +1547,7 @@ static Res gcSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth)
|
||||||
return ResFAIL;
|
return ResFAIL;
|
||||||
|
|
||||||
/* Describe the superclass fields first via next-method call */
|
/* 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)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ static Res amstSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
|
||||||
Res res;
|
Res res;
|
||||||
|
|
||||||
/* Initialize the superclass fields first via next-method call */
|
/* 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)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
SetClassOfSeg(seg, CLASS(AMSTSeg));
|
SetClassOfSeg(seg, CLASS(AMSTSeg));
|
||||||
|
|
@ -157,7 +157,7 @@ static void amstSegFinish(Seg seg)
|
||||||
|
|
||||||
amstseg->sig = SigInvalid;
|
amstseg->sig = SigInvalid;
|
||||||
/* finish the superclass fields last */
|
/* 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));
|
amst = PoolAMST(SegPool(seg));
|
||||||
|
|
||||||
/* Merge the superclass fields via direct next-method call */
|
/* 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)
|
if (res != ResOK)
|
||||||
goto failSuper;
|
goto failSuper;
|
||||||
|
|
||||||
|
|
@ -206,7 +206,7 @@ static Res amstSegMerge(Seg seg, Seg segHi,
|
||||||
|
|
||||||
failDeliberate:
|
failDeliberate:
|
||||||
/* Call the anti-method (see .fail) */
|
/* 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);
|
AVER(res == ResOK);
|
||||||
res = ResFAIL;
|
res = ResFAIL;
|
||||||
failSuper:
|
failSuper:
|
||||||
|
|
@ -233,7 +233,7 @@ static Res amstSegSplit(Seg seg, Seg segHi,
|
||||||
amst = PoolAMST(SegPool(seg));
|
amst = PoolAMST(SegPool(seg));
|
||||||
|
|
||||||
/* Split the superclass fields via direct next-method call */
|
/* 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)
|
if (res != ResOK)
|
||||||
goto failSuper;
|
goto failSuper;
|
||||||
|
|
||||||
|
|
@ -256,7 +256,7 @@ static Res amstSegSplit(Seg seg, Seg segHi,
|
||||||
|
|
||||||
failDeliberate:
|
failDeliberate:
|
||||||
/* Call the anti-method. (see .fail) */
|
/* 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);
|
AVER(res == ResOK);
|
||||||
res = ResFAIL;
|
res = ResFAIL;
|
||||||
failSuper:
|
failSuper:
|
||||||
|
|
@ -536,7 +536,7 @@ static Res AMSTBufferFill(Addr *baseReturn, Addr *limitReturn,
|
||||||
amst = PoolAMST(pool);
|
amst = PoolAMST(pool);
|
||||||
|
|
||||||
/* call next method */
|
/* 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)
|
if (res != ResOK)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue