1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-27 08:43:40 -07:00

Merge mmdevel_lib

Copied from Perforce
 Change: 16125
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Richard Brooksby 1996-09-10 10:39:28 +01:00
parent 6bf5be633d
commit 01f50fb6a1
21 changed files with 392 additions and 178 deletions

View file

@ -1,6 +1,6 @@
/* impl.c.assert: ASSERTION IMPLEMENTATION
*
* $HopeName: MMsrc!assert.c(MMdevel_restr.2) $
* $HopeName: MMsrc!assert.c(MMdevel_lib.4) $
*
* This source provides the AssertFail function which is
* invoked by the assertion macros (see impl.h.assert).
@ -13,22 +13,24 @@
* even if printing fails. richard 1994-11-15
*/
#include "std.h"
#include "assert.h"
#include "lib.h"
#include "mpm.h"
static void AssertLib(const char *cond, const char *id,
const char *file, unsigned line)
{
Lib_fprintf(Lib_stderr,
"\nMPS ASSERTION FAILURE\n\n"
"Id: %s\n"
"File: %s\n"
"Line: %u\n"
"Condition: %s\n\n",
id, file, line, cond);
Lib_abort();
WriteF(mps_lib_stderr,
"\n"
"MPS ASSERTION FAILURE\n"
"\n"
"Id: $S\n", id,
"File: $S\n", file,
"Line: $U\n", (unsigned long)line,
"Condition: $S\n", cond,
"\n",
NULL);
mps_lib_abort();
}
static AssertHandler handler = AssertLib;

View file

@ -1,6 +1,6 @@
/* impl.c.buffer: ALLOCATION BUFFER IMPLEMENTATION
*
* $HopeName: MMsrc!buffer.c(trunk.10) $
* $HopeName: MMsrc!buffer.c(MMdevel_lib.3) $
* Copyright (C) 1996 Harlequin Group, all rights reserved
*
* This is the interface to allocation buffers.
@ -115,7 +115,7 @@
#include "mpm.h"
SRCID(buffer, "$HopeName: MMsrc!buffer.c(trunk.10) $");
SRCID(buffer, "$HopeName: MMsrc!buffer.c(MMdevel_lib.3) $");
Ring BufferPoolRing(Buffer buffer)
@ -551,28 +551,24 @@ void BufferCover(Buffer buffer)
}
Res BufferDescribe(Buffer buffer, Lib_FILE *stream)
Res BufferDescribe(Buffer buffer, mps_lib_FILE *stream)
{
AVERT(Buffer, buffer);
AVER(stream != NULL);
Lib_fprintf(stream,
"Buffer %p {\n"
" Pool %p\n"
" alignment %lu\n"
" base 0x%lX init 0x%lX alloc 0x%lX limit 0x%lX\n"
" grey 0x%lX shieldMode %lu"
"} Buffer %p\n",
(void *)buffer,
(void *)BufferPool(buffer),
(unsigned long)buffer->alignment,
(unsigned long)buffer->base,
(unsigned long)buffer->ap.init,
(unsigned long)buffer->ap.alloc,
(unsigned long)buffer->ap.limit,
(unsigned long)buffer->grey,
(unsigned long)buffer->shieldMode,
(void *)buffer);
WriteF(stream,
"Buffer $P ($U) {\n", (void *)buffer, (unsigned long)buffer->serial,
" base $A init $A alloc $A limit $A\n",
buffer->base, buffer->ap.init, buffer->ap.alloc, buffer->ap.limit,
" Pool $P\n", (void *)buffer->pool,
" Seg $P\n", (void *)buffer->seg,
" rank $U\n", (unsigned long)buffer->rank,
" alignment $W\n", (Word)buffer->alignment,
" grey $B\n", (unsigned long)buffer->grey,
" shieldMode $B\n", (unsigned long)buffer->shieldMode,
" p $P i $U\n", buffer->p, (unsigned long)buffer->i,
"} Buffer $P ($U)\n", (void *)buffer, (unsigned long)buffer->serial,
NULL);
return ResOK;
}

View file

@ -1,11 +1,11 @@
/* impl.c.format: OBJECT FORMATS
*
* $HopeName: MMsrc!format.c(MMdevel_restr.2) $
* $HopeName: MMsrc!format.c(MMdevel_lib.2) $
*/
#include "mpm.h"
SRCID(format, "$HopeName: MMsrc!format.c(MMdevel_restr.2) $");
SRCID(format, "$HopeName: MMsrc!format.c(MMdevel_lib.2) $");
Bool FormatCheck(Format format)
@ -85,3 +85,25 @@ Space FormatSpace(Format format)
{
return format->space;
}
Res FormatDescribe(Format format, mps_lib_FILE *stream)
{
Res res;
res = WriteF(stream,
"Format $P ($U) {\n", (void *)format, (unsigned long)format->serial,
" space $P ($U)\n", (void *)format->space, (unsigned long)format->space->serial,
" alignment $W\n", (Word)format->alignment,
" scan $P\n", (void *)format->scan,
" skip $P\n", (void *)format->skip,
" move $P\n", (void *)format->move,
" isMoved $P\n", (void *)format->isMoved,
" copy $P\n", (void *)format->copy,
" pad $P\n", (void *)format->pad,
"} Format $P ($U)\n", (void *)format, (unsigned long)format->serial,
NULL);
if(res != ResOK) return res;
return ResOK;
}

View file

@ -1,12 +1,17 @@
/* impl.c.mpm: GENERAL MPM SUPPORT
*
* $HopeName: MMsrc!mpm.c(trunk.3) $
* $HopeName: MMsrc!mpm.c(MMdevel_lib.6) $
* Copyright (C) 1996 Harlequin Group, all rights reserved.
*
* .readership: MM developers.
*
* .purpose: Miscellaneous support for the implementation of the MPM
* and pool classes.
*/
#include "mpm.h"
SRCID(mpm, "$HopeName: MMsrc!mpm.c(trunk.3) $");
SRCID(mpm, "$HopeName: MMsrc!mpm.c(MMdevel_lib.6) $");
/* MPMCheck -- test MPM assumptions */
@ -127,3 +132,143 @@ Size (AddrOffset)(Addr base, Addr limit)
AVER(base <= limit);
return (Size)((Word)limit - (Word)base);
}
/* WriteWord -- output a textual representation of a word to a stream */
static Res WriteWord(mps_lib_FILE *stream, Word w, unsigned base, unsigned width)
{
static const char digit[16] = "0123456789ABCDEF";
char buf[MPS_WORD_WIDTH + 1]; /* enough for binary, plus one for terminator */
unsigned i;
int r;
AVER(stream != NULL);
AVER(2 <= base && base <= 16);
AVER(width <= MPS_WORD_WIDTH);
/* Add digits to the buffer starting at the right-hand end, so that */
/* the buffer forms a string representing the number. A do...while */
/* loop is used to ensure that at least one digit (zero) is written */
/* when the number is zero. */
i = MPS_WORD_WIDTH;
buf[i] = '\0';
do {
--i;
buf[i] = digit[w % base];
w /= base;
} while(w > 0);
/* If the number is not as wide as the requested field, pad out the */
/* buffer with zeros. */
while(i > MPS_WORD_WIDTH - width) {
--i;
buf[i] = digit[0];
}
r = mps_lib_fputs(&buf[i], stream);
if(r == mps_lib_EOF)
return ResIO;
return ResOK;
}
/* WriteF -- write formatted output
*
* .writef.p: There is an assumption that void * fits in Word in
* the case of $P.
*
* .writef.div: Although MPS_WORD_WIDTH/4 appears three times, there
* are effectively three separate decisions to format at this width.
*/
Res WriteF(mps_lib_FILE *stream, ...)
{
const char *format;
int r;
Res res;
va_list args;
AVER(stream != NULL);
va_start(args, stream);
for(;;) {
format = va_arg(args, const char *);
if(format == NULL)
break;
while(*format != '\0') {
if(*format != '$') {
r = mps_lib_fputc(*format, stream);
if(r == mps_lib_EOF)
return ResIO;
} else {
++format;
AVER(*format != '\0');
switch(*format) {
case 'A': { /* address */
Addr addr = va_arg(args, Addr);
res = WriteWord(stream, (Word)addr, 0x10, MPS_WORD_WIDTH / 4);
if(res != ResOK) return res;
} break;
case 'P': { /* pointer, see .writef.p */
void *p = va_arg(args, void *);
res = WriteWord(stream, (Word)p, 0x10, MPS_WORD_WIDTH / 4);
if(res != ResOK) return res;
} break;
case 'S': { /* string */
char *s = va_arg(args, char *);
r = mps_lib_fputs(s, stream);
if(r == mps_lib_EOF)
return ResIO;
} break;
case 'C': { /* character */
char c = va_arg(args, int);
r = mps_lib_fputc(c, stream);
if(r == mps_lib_EOF)
return ResIO;
} break;
case 'W': { /* word */
Word w = va_arg(args, Word);
res = WriteWord(stream, w, 0x10, MPS_WORD_WIDTH / 4);
if(res != ResOK) return res;
} break;
case 'U': { /* decimal */
unsigned long u = va_arg(args, unsigned long);
res = WriteWord(stream, (Word)u, 10, 0);
if(res != ResOK) return res;
} break;
case 'B': { /* binary */
unsigned long u = va_arg(args, unsigned long);
res = WriteWord(stream, (Word)u, 2, MPS_WORD_WIDTH);
if(res != ResOK) return res;
} break;
case '$': { /* dollar char */
r = mps_lib_fputc('$', stream);
if(r == mps_lib_EOF)
return ResIO;
} break;
default:
NOTREACHED;
}
}
++format;
}
}
va_end(args);
return ResOK;
}

View file

@ -1,6 +1,6 @@
/* impl.h.mpm: MEMORY POOL MANAGER DEFINITIONS
*
* $HopeName: MMsrc!mpm.h(trunk.7) $
* $HopeName: MMsrc!mpm.h(MMdevel_lib.4) $
* Copyright (C) 1996 Harlequin Group, all rights reserved.
*/
@ -15,7 +15,7 @@
#include "poolmv.h"
#include "poolmfs.h"
#include "ss.h"
#include "lib.h"
#include "mpslib.h"
/* AVER, AVERT -- MPM assertions
@ -80,6 +80,8 @@ extern Shift SizeFloorLog2(Size size);
#define SizeIsAligned(s, a) WordIsAligned(SizeWord(s), a)
#define SizeAlignUp(s, a) ((Size)WordAlignUp(SizeWord(s), a))
extern Res WriteF(mps_lib_FILE *stream, ...);
/* Ring Interface -- see impl.c.ring */
@ -143,7 +145,7 @@ extern Res PoolInitV(Pool pool, Space space, PoolClass class, va_list args);
extern void PoolFinish(Pool pool);
extern Bool PoolClassCheck(PoolClass class);
extern Bool PoolCheck(Pool pool);
extern Res PoolDescribe(Pool pool, Lib_FILE *stream);
extern Res PoolDescribe(Pool pool, mps_lib_FILE *stream);
extern Space (PoolSpace)(Pool pool);
#define PoolSpace(pool) ((pool)->space)
@ -185,8 +187,8 @@ extern Res PoolNoBufferFill(Addr *baseReturn, Pool pool, Buffer buffer, Size siz
extern Bool PoolNoBufferTrip(Pool pool, Buffer buffer, Addr base, Size size);
extern void PoolNoBufferExpose(Pool pool, Buffer buffer);
extern void PoolNoBufferCover(Pool pool, Buffer buffer);
extern Res PoolNoDescribe(Pool pool, Lib_FILE *stream);
extern Res PoolTrivDescribe(Pool pool, Lib_FILE *stream);
extern Res PoolNoDescribe(Pool pool, mps_lib_FILE *stream);
extern Res PoolTrivDescribe(Pool pool, mps_lib_FILE *stream);
extern Res PoolNoCondemn(RefSet *condemnedReturn, Pool pool, Space space, TraceId ti);
extern void PoolNoGrey(Pool pool, Space space, TraceId ti);
extern Res PoolNoScan(ScanState ss, Pool pool, Bool *finishedReturn);
@ -268,7 +270,7 @@ extern Res TraceScanAreaTagged(ScanState ss, Addr *base, Addr *limit);
extern Res SpaceCreate(Space *spaceReturn, Addr base, Size size);
extern void SpaceDestroy(Space space);
extern Bool SpaceCheck(Space space);
extern Res SpaceDescribe(Space space, Lib_FILE *stream);
extern Res SpaceDescribe(Space space, mps_lib_FILE *stream);
extern Bool SpaceAccess(Addr addr, AccessSet mode);
extern void SpaceEnter(Space space);
extern void SpaceLeave(Space space);
@ -307,7 +309,7 @@ extern Bool SegCheck(Seg seg);
extern Res BufferCreate(Buffer *bufferReturn, Pool pool, Rank rank);
extern void BufferDestroy(Buffer buffer);
extern Bool BufferCheck(Buffer buffer);
extern Res BufferDescribe(Buffer buffer, Lib_FILE *stream);
extern Res BufferDescribe(Buffer buffer, mps_lib_FILE *stream);
extern Res BufferReserve(Addr *pReturn, Buffer buffer, Size size);
extern Res BufferFill(Addr *pReturn, Buffer buffer, Size size);
extern Bool BufferCommit(Buffer buffer, Addr p, Size size);
@ -341,6 +343,7 @@ extern Res FormatCreate(Format *formatReturn, Space space,
FormatPadMethod pad);
extern void FormatDestroy(Format format);
extern Space FormatSpace(Format format);
extern Res FormatDescribe(Format format, mps_lib_FILE *stream);
/* Reference Interface -- see impl.c.ref */
@ -407,7 +410,7 @@ extern Res RootCreate(Root *rootReturn, Space space,
void *p, size_t s);
extern void RootDestroy(Root root);
extern Bool RootCheck(Root root);
extern Res RootDescribe(Root root, Lib_FILE *stream);
extern Res RootDescribe(Root root, mps_lib_FILE *stream);
extern Bool RootIsAtomic(Root root);
extern Rank RootRank(Root root);
extern void RootGrey(Root root, Space space, TraceId ti);

View file

@ -1,6 +1,6 @@
/* ==== MPM STRESS TEST ====
*
* $HopeName: MMsrc!mpmss.c(MMdevel_restr.2) $
* $HopeName: MMsrc!mpmss.c(MMdevel_lib.2) $
*/
@ -9,7 +9,7 @@
#include <stdarg.h>
#include "std.h"
#include "mps.h"
#include "lib.h"
#include "mpslib.h"
#include "poolmfs.h"
#include "poolmv.h"
@ -58,7 +58,7 @@ static mps_res_t stress(mps_class_t class, mps_space_t space, size_t (*size)(int
{
mps_free(pool, (mps_addr_t)ps[i], ss[i]);
/* if(i == TEST_SET_SIZE/2)
PoolDescribe((Pool)pool, Lib_stdout); */
PoolDescribe((Pool)pool, mps_lib_stdout); */
}
mps_pool_destroy(pool);

View file

@ -1,6 +1,6 @@
/* impl.h.mpmtypes: MEMORY POOL MANAGER TYPES
*
* $HopeName: MMsrc!mpmtypes.h(trunk.3) $
* $HopeName: MMsrc!mpmtypes.h(MMdevel_lib.2) $
* Copyright (C) 1996 Harlequin Group, all rights reserved.
*
* .rationale: Types and type constants are almost all defined
@ -14,7 +14,7 @@
#define mpmtypes_h
#include "std.h"
#include "lib.h"
#include "mpslib.h"
/* TYPES */
@ -110,7 +110,7 @@ typedef Bool (*PoolBufferTripMethod) (Pool pool, Buffer buffer,
Addr base, Size size);
typedef void (*PoolBufferExposeMethod) (Pool pool, Buffer buffer);
typedef void (*PoolBufferCoverMethod) (Pool pool, Buffer buffer);
typedef Res (*PoolDescribeMethod) (Pool pool, Lib_FILE *stream);
typedef Res (*PoolDescribeMethod) (Pool pool, mps_lib_FILE *stream);
typedef Res (*PoolCondemnMethod) (RefSet *condemnedReturn, Pool pool,
Space space, TraceId ti);
typedef void (*PoolGreyMethod) (Pool pool, Space space, TraceId ti);

View file

@ -1,7 +1,7 @@
#
# BUILD FOR OSF/1, ALPHA, GCC PLATFORM
#
# $HopeName: MMsrc!o1algc.gmk(trunk.2) $
# $HopeName: MMsrc!o1algc.gmk(MMdevel_lib.2) $
#
# Copyright (C) 1995 Harlequin Group, all rights reserved
#
@ -14,7 +14,7 @@
PFM = o1algc
PFMDEFS = -D_ANSI_C_SOURCE
STD = assert.c deque.c error.c liban.c meter.c misc.c
STD = assert.c deque.c error.c mpsliban.c meter.c misc.c
MPM = arenan.c space.c pool.c poolclas.c poolmfs.c \
poolmv.c pools.c root.c fix.c format.c buffer.c lockan.c
AMC = poolamc.c

View file

@ -1,6 +1,6 @@
/* impl.c.pool: POOL IMPLEMENTATION
*
* $HopeName: MMsrc!pool.c(MMdevel_restr2.8) $
* $HopeName: MMsrc!pool.c(MMdevel_lib.4) $
* Copyright (C) 1994,1995,1996 Harlequin Group, all rights reserved
*
* This is the implementation of the generic pool interface. The
@ -9,7 +9,7 @@
#include "mpm.h"
SRCID(pool, "$HopeName: MMsrc!pool.c(MMdevel_restr2.8) $");
SRCID(pool, "$HopeName: MMsrc!pool.c(MMdevel_lib.4) $");
Bool PoolClassCheck(PoolClass class)
@ -247,27 +247,37 @@ void (PoolAccess)(Pool pool, Seg seg, AccessSet mode)
}
Res PoolDescribe(Pool pool, Lib_FILE *stream)
Res PoolDescribe(Pool pool, mps_lib_FILE *stream)
{
int e;
Res res;
Ring node;
AVERT(Pool, pool);
AVER(stream != NULL);
e = Lib_fprintf(stream,
"Pool %p {\n"
" Class %s\n"
" alignment %lu\n",
pool,
pool->class->name,
(unsigned long)pool->alignment);
if(e < 0) return ResIO;
res = WriteF(stream,
"Pool $P ($U) {\n", (void *)pool, (unsigned long)pool->serial,
" class $P (\"$S\")\n", (void *)pool->class, pool->class->name,
" space $P ($U)\n", (void *)pool->space, (unsigned long)pool->space->serial,
" alignment $W\n", (Word)pool->alignment,
NULL);
if(res != ResOK) return res;
res = (*pool->class->describe)(pool, stream);
if(res != ResOK) return res;
e = Lib_fprintf(stream, "} Pool %p\n", pool);
if(e < 0) return ResIO;
node = RingNext(&pool->bufferRing);
while(node != &pool->bufferRing) {
Buffer buffer = RING_ELT(Buffer, poolRing, node);
res = BufferDescribe(buffer, stream);
if(res != ResOK) return res;
node = RingNext(node);
}
res = WriteF(stream,
"} Pool $P ($U)\n", (void *)pool, (unsigned long)pool->serial,
NULL);
if(res != ResOK) return res;
return ResOK;
}
@ -449,7 +459,7 @@ void PoolNoBufferCover(Pool pool, Buffer buffer)
NOTREACHED;
}
Res PoolNoDescribe(Pool pool, Lib_FILE *stream)
Res PoolNoDescribe(Pool pool, mps_lib_FILE *stream)
{
AVERT(Pool, pool);
AVER(stream != NULL);
@ -457,15 +467,11 @@ Res PoolNoDescribe(Pool pool, Lib_FILE *stream)
return ResUNIMPL;
}
Res PoolTrivDescribe(Pool pool, Lib_FILE *stream)
Res PoolTrivDescribe(Pool pool, mps_lib_FILE *stream)
{
int e;
AVERT(Pool, pool);
AVER(stream != NULL);
e = Lib_fprintf(stream, " No class-specific description available.\n");
if(e < 0)
return ResIO;
return ResOK;
return WriteF(stream, " No class-specific description available.\n", NULL);
}
Res PoolNoCondemn(RefSet *condemnedReturn, Pool pool, Space space, TraceId ti)

View file

@ -1,6 +1,6 @@
/* impl.c.poolmfs: MANUAL FIXED SMALL UNIT POOL
*
* $HopeName: MMsrc!poolmfs.c(MMdevel_restr2.6) $
* $HopeName: MMsrc!poolmfs.c(MMdevel_lib.3) $
* Copyright (C) 1994,1995 Harlequin Group, all rights reserved
*
* This is the implementation of the MFS pool class. MFS operates
@ -34,7 +34,7 @@
#include "mpm.h"
#include "poolmfs.h"
SRCID(poolmfs, "$HopeName: MMsrc!poolmfs.c(MMdevel_restr2.6) $");
SRCID(poolmfs, "$HopeName: MMsrc!poolmfs.c(MMdevel_lib.3) $");
/* == Round up ==
@ -237,10 +237,10 @@ static void MFSFree(Pool pool, Addr old, Size size)
}
static Res MFSDescribe(Pool pool, Lib_FILE *stream)
static Res MFSDescribe(Pool pool, mps_lib_FILE *stream)
{
MFS mfs;
int e;
Res res;
AVERT(Pool, pool);
mfs = PoolPoolMFS(pool);
@ -248,21 +248,15 @@ static Res MFSDescribe(Pool pool, Lib_FILE *stream)
AVER(stream != NULL);
e = Lib_fprintf(stream,
" unrounded unit size %lu\n"
" unit size %lu segment size %lu\n"
" units per segment %u\n"
" free list begins at %p\n"
" seg list begin at %08lx\n",
(unsigned long)mfs->unroundedUnitSize,
(unsigned long)mfs->unitSize,
(unsigned long)mfs->extendBy,
mfs->unitsPerSeg,
mfs->freeList,
mfs->segList);
if(e < 0) /* standard.ansic 7.9.6.1 */
return ResIO;
res = WriteF(stream,
" unrounded unit size $W\n", (Word)mfs->unroundedUnitSize,
" unit size $W\n", (Word)mfs->unitSize,
" segment size $W\n", (Word)mfs->extendBy,
" units per segment $U\n", (unsigned long)mfs->unitsPerSeg,
" free list begins at $P\n", (void *)mfs->freeList,
" seg list begin at $P\n", (void *)mfs->segList,
NULL);
if(res != ResOK) return res;
return ResOK;
}

View file

@ -1,6 +1,6 @@
/* impl.c.poolmv: MANUAL VARIABLE POOL
*
* $HopeName: MMsrc!poolmv.c(trunk.13) $
* $HopeName: MMsrc!poolmv.c(MMdevel_lib.3) $
* Copyright (C) 1994, 1995 Harlequin Group, all rights reserved
*
* **** RESTRICTION: This pool may not allocate from the arena control
@ -37,7 +37,7 @@
#include "poolmfs.h"
#include "mpscmv.h"
SRCID(poolmv, "$HopeName: MMsrc!poolmv.c(trunk.13) $");
SRCID(poolmv, "$HopeName: MMsrc!poolmv.c(MMdevel_lib.3) $");
#define BLOCKPOOL(mv) (MFSPool(&(mv)->blockPoolStruct))
@ -52,7 +52,7 @@ static Res MVInit(Pool pool, va_list arg);
static void MVFinish(Pool pool);
static Res MVAlloc(Addr *pReturn, Pool pool, Size size);
static void MVFree(Pool pool, Addr old, Size size);
static Res MVDescribe(Pool pool, Lib_FILE *stream);
static Res MVDescribe(Pool pool, mps_lib_FILE *stream);
#endif /* 0 */
@ -496,12 +496,14 @@ static void MVFree(Pool pool, Addr old, Size size)
}
static Res MVDescribe(Pool pool, Lib_FILE *stream)
static Res MVDescribe(Pool pool, mps_lib_FILE *stream)
{
Res res;
MV mv;
MVSpan span;
Align step;
Size length;
char c;
Ring spans, node = NULL; /* gcc whinge stop */
AVERT(Pool, pool);
@ -510,33 +512,37 @@ static Res MVDescribe(Pool pool, Lib_FILE *stream)
AVER(stream != NULL);
Lib_fprintf(stream,
" blockPool = %p spanPool = %p\n"
" extendBy = %lX\n"
" avgSize = %lX\n"
" maxSize = %lX\n"
" space = %lX\n",
BLOCKPOOL(mv), SPANPOOL(mv),
(unsigned long)mv->extendBy,
(unsigned long)mv->avgSize,
(unsigned long)mv->maxSize,
mv->space);
res = WriteF(stream,
" blockPool $P ($U)\n",
(void *)BLOCKPOOL(mv), (unsigned long)BLOCKPOOL(mv)->serial,
" spanPool $P ($U)\n",
(void *)SPANPOOL(mv), (unsigned long)SPANPOOL(mv)->serial,
" extendBy $W\n", (Word)mv->extendBy,
" avgSize $W\n", (Word)mv->avgSize,
" maxSize $W\n", (Word)mv->maxSize,
" space $P\n", (void *)mv->space,
NULL);
if(res != ResOK) return res;
res = WriteF(stream, " Spans\n", NULL);
if(res != ResOK) return res;
Lib_fprintf(stream,
" Spans\n"
" desc seg space blockCount\n");
spans = &mv->spans;
RING_FOR(node, spans) {
span = RING_ELT(MVSpan, spans, node);
AVERT(MVSpan, span);
Lib_fprintf(stream, " %8lX %8lX %8lX %d\n",
(unsigned long)span,
(unsigned long)span->seg,
span->space, span->blockCount);
res = WriteF(stream,
" span $P", (void *)span,
" seg $P", (void *)span->seg,
" space $W", (unsigned long)span->space,
" blocks $U\n", (unsigned long)span->blockCount,
NULL);
if(res != ResOK) return res;
}
Lib_fprintf(stream, " Span allocation maps\n");
res = WriteF(stream, " Span allocation maps\n", NULL);
if(res != ResOK) return res;
step = pool->alignment;
length = 0x40 * step;
@ -546,34 +552,42 @@ static Res MVDescribe(Pool pool, Lib_FILE *stream)
Addr i, j;
MVBlock block;
span = RING_ELT(MVSpan, spans, node);
Lib_fprintf(stream, " MVSpan %8lX\n", (unsigned long)span);
res = WriteF(stream, " MVSpan $P\n", (void *)span, NULL);
if(res != ResOK) return res;
block = span->blocks;
AVER(block == &span->base); /* should be start sentinel */
for(i = span->base.base; i < span->limit.limit; i = AddrAdd(i, length)) {
Lib_fprintf(stream, " %8lX ", (unsigned long)i);
res = WriteF(stream, " $A ", i, NULL);
if(res != ResOK) return res;
for(j = i;
j < AddrAdd(i, length) && j < span->limit.limit;
j = AddrAdd(j, step)) {
for(j = i; j < AddrAdd(i, length) && j < span->limit.limit;
j = AddrAdd(j, step)) {
if(j == block->base) {
if(AddrAdd(j, step) == block->limit)
Lib_fputc('@', stream);
c = '@';
else
Lib_fputc('[', stream);
c = '[';
} else if(AddrAdd(j, step) == block->limit)
Lib_fputc(']', stream);
c = ']';
else if(j > block->base && j < block->limit)
Lib_fputc('=', stream);
c = '=';
else
Lib_fputc('.', stream);
c = '.';
if(j >= block->limit) {
block = block->next;
AVER(block != NULL); /* shouldn't pass limit sentinel */
}
res = WriteF(stream, "$C", c, NULL);
if(res != ResOK) return res;
}
Lib_fputc('\n', stream);
res = WriteF(stream, "\n", NULL);
if(res != ResOK) return res;
}
}

View file

@ -2,7 +2,7 @@
*
* NULL POOL
*
* $HopeName: MMsrc!pooln.c(MMdevel_restr2.5) $
* $HopeName: MMsrc!pooln.c(MMdevel_lib.2) $
*
* Copyright(C) 1995 Harlequin Group, all rights reserved
*
@ -13,7 +13,7 @@
#include "mpm.h"
#include "pooln.h"
SRCID(pooln, "$HopeName: MMsrc!pooln.c(MMdevel_restr2.5) $");
SRCID(pooln, "$HopeName: MMsrc!pooln.c(MMdevel_lib.2) $");
typedef struct PoolNStruct {
@ -159,7 +159,7 @@ static void NBufferCover(Pool pool, Buffer buffer)
NOTREACHED; /* can't create buffers, so shouldn't cover them */
}
static Res NDescribe(Pool pool, Lib_FILE *stream)
static Res NDescribe(Pool pool, mps_lib_FILE *stream)
{
PoolN poolN;

View file

@ -2,7 +2,7 @@
*
* ROOT IMPLEMENTATION
*
* $HopeName: MMsrc!root.c(MMdevel_restr.3) $
* $HopeName: MMsrc!root.c(MMdevel_lib.3) $
*
* Copyright (C) 1995 Harlequin Group, all rights reserved
*
@ -11,7 +11,7 @@
#include "mpm.h"
SRCID(root, "$HopeName: MMsrc!root.c(MMdevel_restr.3) $");
SRCID(root, "$HopeName: MMsrc!root.c(MMdevel_lib.3) $");
Bool RootCheck(Root root)
{
@ -229,48 +229,49 @@ Space RootSpace(Root root)
return root->space;
}
Res RootDescribe(Root root, Lib_FILE *stream)
Res RootDescribe(Root root, mps_lib_FILE *stream)
{
TraceId id;
Res res;
AVERT(Root, root);
AVER(stream != NULL);
Lib_fprintf(stream,
"Root %lX {\n"
" rank %d\n",
(unsigned long)root,
root->rank);
Lib_fprintf(stream, " Trace status\n");
for(id = 0; id < TRACE_MAX; ++id)
Lib_fprintf(stream, " %2lu %s\n",
(unsigned long)id,
TraceSetIsMember(root->grey, id) ?
"grey" : "not grey");
res = WriteF(stream,
"Root $P ($U) {\n", (void *)root, (unsigned long)root->serial,
" space $P ($U)\n", (void *)root->space, (unsigned long)root->space->serial,
" rank $U\n", (unsigned long)root->rank,
" grey $B\n", (unsigned long)root->grey,
NULL);
if(res != ResOK) return res;
switch(root->var)
{
case RootTABLE:
Lib_fprintf(stream, " table base 0x%lX limit 0x%lX\n",
(unsigned long)root->the.table.base,
(unsigned long)root->the.table.limit);
res = WriteF(stream,
" table base $P limit $P\n",
(void *)root->the.table.base,
(void *)root->the.table.limit,
NULL);
if(res != ResOK) return res;
break;
case RootFUN:
Lib_fprintf(stream,
" scan function 0x%lX\n"
" environment p 0x%lX s 0x%lX\n",
(unsigned long)root->the.fun.scan,
(unsigned long)root->the.fun.p,
root->the.fun.s);
res = WriteF(stream,
" scan function $P\n", (void *)root->the.fun.scan,
" environment p $P s $W\n",
root->the.fun.p, (Word)root->the.fun.s,
NULL);
if(res != ResOK) return res;
break;
default:
NOTREACHED;
}
Lib_fprintf(stream, "} Root 0x%lX\n", (unsigned long)root);
res = WriteF(stream,
"} Root $P ($U)\n", (void*)root, (unsigned long)root->serial,
NULL);
if(res != ResOK) return res;
return ResOK;
}

View file

@ -1,7 +1,7 @@
#
# BUILD FOR SOLARIS/SPARC/GCC PLATFORM
#
# $HopeName: MMsrc!sospgc.gmk(trunk.2) $
# $HopeName: MMsrc!sospgc.gmk(MMdevel_lib.2) $
#
# Copyright (C) 1995 Harlequin Group, all rights reserved
#
@ -11,7 +11,7 @@
PFM = sospgc
PFMDEFS = -D_POSIX_SOURCE -D__EXTENSIONS__
MPM = assert.c ring.c liban.c mpm.c \
MPM = assert.c ring.c mpsliban.c mpm.c \
arenavm.c vmso.c space.c pool.c poolmfs.c \
poolmv.c root.c format.c buffer.c lockan.c ref.c \
trace.c than.c protso.c shield.c mpsi.c ld.c
@ -19,7 +19,7 @@ MPMPS = sssosp.S
AMC = amc.c
LO = lo.c
DW = fmtdy.c dw.c
SW = assert.c ring.c liban.c mpm.c \
SW = assert.c ring.c mpsliban.c mpm.c \
arenavm.c vmrm.c space.c pool.c poolmfs.c \
poolmv.c root.c format.c buffer.c lockan.c ref.c \
trace.c than.c protso.c shield.c mpsi.c ld.c ssan.c

View file

@ -1,7 +1,7 @@
#
# BUILD FOR SUNOS/SPARC/GCC PLATFORM
#
# $HopeName: MMsrc!suspgc.gmk(trunk.18) $
# $HopeName: MMsrc!suspgc.gmk(MMdevel_lib.2) $
#
# Copyright (C) 1995 Harlequin Group, all rights reserved
#
@ -10,7 +10,7 @@
PFM = suspgc
MPM = assert.c ring.c liban.c mpm.c \
MPM = assert.c ring.c mpsliban.c mpm.c \
arenavm.c vmsu.c space.c pool.c poolmfs.c \
poolmv.c root.c format.c buffer.c lockan.c ref.c \
trace.c than.c protsu.c shield.c mpsi.c ld.c
@ -18,7 +18,7 @@ MPMS = sssusp.s
AMC = amc.c
LO = lo.c
DW = fmtdy.c dw.c
SW = assert.c ring.c liban.c mpm.c \
SW = assert.c ring.c mpsliban.c mpm.c \
arenavm.c vmrm.c space.c pool.c poolmfs.c \
poolmv.c root.c format.c buffer.c lockan.c ref.c \
trace.c than.c protsu.c shield.c mpsi.c ld.c ssan.c

View file

@ -2,7 +2,7 @@
*
* THREAD MANAGER
*
* $HopeName: MMsrc!th.h(MMdevel_restr.2) $
* $HopeName: MMsrc!th.h(MMdevel_lib.2) $
*
* Copyright (C) 1995 Harlequin Group, all rights reserved
*
@ -17,6 +17,7 @@
#include "mpm.h"
extern Bool ThreadCheck(Thread thread);
extern Res ThreadDescribe(Thread thread, mps_lib_FILE *stream);
/* == Register/Deregister ==

View file

@ -2,7 +2,7 @@
*
* ANSI THREADS MANAGER
*
* $HopeName: MMsrc!than.c(MMdevel_restr.2) $
* $HopeName: MMsrc!than.c(MMdevel_lib.2) $
*
* Copyright (C) 1995 Harlequin Group, all rights reserved
*
@ -17,7 +17,7 @@
#include "mpm.h"
SRCID(than, "$HopeName: MMsrc!than.c(MMdevel_restr.2) $");
SRCID(than, "$HopeName: MMsrc!than.c(MMdevel_lib.2) $");
Bool ThreadCheck(Thread thread)
@ -95,3 +95,17 @@ Res ThreadScan(ScanState ss, Thread thread, void *stackBot)
{
return StackScan(ss, stackBot);
}
Res ThreadDescribe(Thread thread, mps_lib_FILE *stream)
{
Res res;
res = WriteF(stream,
"Thread $P ($U) {\n", (void *)thread, (unsigned long)thread->serial,
" space $P ($U)\n", (void *)thread->space, (unsigned long)thread->space->serial,
"} Thread $P ($U)\n", (void *)thread, (unsigned long)thread->serial,
NULL);
if(res != ResOK) return res;
return ResOK;
}

View file

@ -2,7 +2,7 @@
*
* WIN32 THREAD MANAGER
*
* $HopeName: MMsrc!thnti3.c(MMdevel_restr.3) $
* $HopeName: MMsrc!thnti3.c(MMdevel_lib.2) $
*
* Copyright (C) 1995 Harlequin Group, all rights reserved
*
@ -67,7 +67,7 @@
#include <windows.h>
SRCID(thnti3, "$HopeName: MMsrc!thnti3.c(MMdevel_restr.3) $");
SRCID(thnti3, "$HopeName: MMsrc!thnti3.c(MMdevel_lib.2) $");
Bool ThreadCheck(Thread thread)
{
@ -243,3 +243,19 @@ Space ThreadSpace(Thread thread)
{
return thread->space;
}
Res ThreadDescribe(Thread thread, mps_lib_FILE *stream)
{
Res res;
res = WriteF(stream,
"Thread $P ($U) {\n", (void *)thread, (unsigned long)thread->serial,
" space $P ($U)\n", (void *)thread->space, (unsigned long)thread->space->serial,
" handle $W\n", (Word)thread->handle,
" id $U\n", (unsigned long)thread->id,
"} Thread $P ($U)\n", (void *)thread, (unsigned long)thread->serial,
NULL);
if(res != ResOK) return res;
return ResOK;
}

View file

@ -1,18 +1,18 @@
# ==== NTI3MV NMAKE FILE ====
#
# $HopeName: MMsrc!ntalmv.nmk(trunk.2) $
# $HopeName: MMsrc!ntalmv.nmk(MMdevel_lib.2) $
#
# Copyright (C) 1995 Harlequin Group, all rights reserved
#
PFM = ntalmv
PFMDEFS = /DWIN32 /D_WINDOWS
MPM = <assert> <ring> <liban> <mpm> \
MPM = <assert> <ring> <mpsliban> <mpm> \
<arenavm> <vmnt> <space> <pool> <poolmfs> \
<poolmv> <root> <format> <buffer> <locknt> \
<ref> <trace> <protnt> <shield> \
<than> <ssan> <mpsi> <mpsint> <ld>
SW = <assert> <ring> <liban> <mpm> \
SW = <assert> <ring> <mpsliban> <mpm> \
<arenavm> <vmrm> <space> <pool> <poolmfs> \
<poolmv> <root> <format> <buffer> <locknt> \
<ref> <trace> <protnt> <shield> \
@ -26,7 +26,7 @@ TESTLIB = <testlib>
# ==== ALMOST GENERIC PRODUCT BUILD FOR NMAKE ====
#
# $HopeName: MMsrc!ntalmv.nmk(trunk.2) $
# $HopeName: MMsrc!ntalmv.nmk(MMdevel_lib.2) $
#
# Copyright (C) 1995 Harlequin Group, all rights reserved
#

View file

@ -1,18 +1,18 @@
# ==== NTI3MV NMAKE FILE ====
#
# $HopeName: MMsrc!nti3mv.nmk(trunk.24) $
# $HopeName: MMsrc!nti3mv.nmk(MMdevel_lib.2) $
#
# Copyright (C) 1995 Harlequin Group, all rights reserved
#
PFM = nti3mv
PFMDEFS = /DWIN32 /D_WINDOWS
MPM = <assert> <ring> <liban> <mpm> \
MPM = <assert> <ring> <mpsliban> <mpm> \
<arenavm> <vmnt> <space> <pool> <poolmfs> \
<poolmv> <root> <format> <buffer> <locknt> \
<ref> <trace> <protnt> <shield> \
<thnti3> <ssnti3> <mpsi> <mpsint> <ld>
SW = <assert> <ring> <liban> <mpm> \
SW = <assert> <ring> <mpsliban> <mpm> \
<arenavm> <vmrm> <space> <pool> <poolmfs> \
<poolmv> <root> <format> <buffer> <locknt> \
<ref> <trace> <protnt> <shield> \
@ -26,7 +26,7 @@ TESTLIB = <testlib>
# ==== ALMOST GENERIC PRODUCT BUILD FOR NMAKE ====
#
# $HopeName: MMsrc!nti3mv.nmk(trunk.24) $
# $HopeName: MMsrc!nti3mv.nmk(MMdevel_lib.2) $
#
# Copyright (C) 1995 Harlequin Group, all rights reserved
#

View file

@ -1,18 +1,18 @@
# ==== NTI3MV NMAKE FILE ====
#
# $HopeName: MMsrc!ntppmv.nmk(trunk.2) $
# $HopeName: MMsrc!ntppmv.nmk(MMdevel_lib.2) $
#
# Copyright (C) 1995 Harlequin Group, all rights reserved
#
PFM = ntppmv
PFMDEFS = /DWIN32 /D_WINDOWS
MPM = <assert> <ring> <liban> <mpm> \
MPM = <assert> <ring> <mpsliban> <mpm> \
<arenavm> <vmnt> <space> <pool> <poolmfs> \
<poolmv> <root> <format> <buffer> <locknt> \
<ref> <trace> <protnt> <shield> \
<than> <ssan> <mpsi> <mpsint> <ld>
SW = <assert> <ring> <liban> <mpm> \
SW = <assert> <ring> <mpsliban> <mpm> \
<arenavm> <vmrm> <space> <pool> <poolmfs> \
<poolmv> <root> <format> <buffer> <locknt> \
<ref> <trace> <protnt> <shield> \
@ -26,7 +26,7 @@ TESTLIB = <testlib>
# ==== ALMOST GENERIC PRODUCT BUILD FOR NMAKE ====
#
# $HopeName: MMsrc!ntppmv.nmk(trunk.2) $
# $HopeName: MMsrc!ntppmv.nmk(MMdevel_lib.2) $
#
# Copyright (C) 1995 Harlequin Group, all rights reserved
#